iconify-icon
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -259,3 +259,2 @@ import { IconifyIcon } from '@iconify/types'; | ||
declare interface IconifyIconSVGAttributes { | ||
viewBox: string; | ||
preserveAspectRatio: string; | ||
@@ -262,0 +261,0 @@ } |
@@ -10,4 +10,4 @@ /** | ||
* @license MIT | ||
* @version 0.0.5 | ||
* @version 0.0.6 | ||
*/ | ||
!function(){"use strict";const t=Object.freeze({inline:!1,width:null,height:null,hFlip:!1,vFlip:!1,rotate:0});const e=/[\s,]+/;const{inline:n,...o}={...t,viewBox:"",preserveAspectRatio:""};function i(t){const n={...o},i=(e,n)=>t.getAttribute(e)||n;var r;return n.width=i("width",null),n.height=i("height",null),n.rotate=function(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function o(t){for(;t<0;)t+=4;return t%4}if(""===n){const e=parseInt(t);return isNaN(e)?0:o(e)}if(n!==t){let e=0;switch(n){case"%":e=25;break;case"deg":e=90}if(e){let i=parseFloat(t.slice(0,t.length-n.length));return isNaN(i)?0:(i/=e,i%1==0?o(i):0)}}return e}(i("rotate","")),r=n,i("flip","").split(e).forEach((t=>{switch(t.trim()){case"horizontal":r.hFlip=!0;break;case"vertical":r.vFlip=!0}})),n.viewBox=i("viewBox",i("viewbox","")),n.preserveAspectRatio=i("preserveAspectRatio",i("preserveaspectratio","")),n}const r=/^[a-z0-9]+(-[a-z0-9]+)*$/,c=Object.freeze({left:0,top:0,width:16,height:16,rotate:0,vFlip:!1,hFlip:!1});function s(t){return{...c,...t}}const a=(t,e,n,o="")=>{const i=t.split(":");if("@"===t.slice(0,1)){if(i.length<2||i.length>3)return null;o=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const t=i.pop(),n=i.pop(),r={provider:i.length>0?i[0]:o,prefix:n,name:t};return e&&!u(r)?null:r}const r=i[0],c=r.split("-");if(c.length>1){const t={provider:o,prefix:c.shift(),name:c.join("-")};return e&&!u(t)?null:t}if(n&&""===o){const t={provider:o,prefix:"",name:r};return e&&!u(t,n)?null:t}return null},u=(t,e)=>!!t&&!(""!==t.provider&&!t.provider.match(r)||!(e&&""===t.prefix||t.prefix.match(r))||!t.name.match(r));function l(t,e,n=!1){const o=function e(n,o){if(void 0!==t.icons[n])return Object.assign({},t.icons[n]);if(o>5)return null;const i=t.aliases;if(i&&void 0!==i[n]){const t=i[n],r=e(t.parent,o+1);return r?function(t,e){const n={...t};for(const t in c){const o=t;if(void 0!==e[o]){const t=e[o];if(void 0===n[o]){n[o]=t;continue}switch(o){case"rotate":n[o]=(n[o]+t)%4;break;case"hFlip":case"vFlip":n[o]=t!==n[o];break;default:n[o]=t}}}return n}(r,t):r}const r=t.chars;return!o&&r&&void 0!==r[n]?e(r[n],o+1):null}(e,0);if(o)for(const e in c)void 0===o[e]&&void 0!==t[e]&&(o[e]=t[e]);return o&&n?s(o):o}function f(t,e,n){n=n||{};const o=[];if("object"!=typeof t||"object"!=typeof t.icons)return o;t.not_found instanceof Array&&t.not_found.forEach((t=>{e(t,null),o.push(t)}));const i=t.icons;Object.keys(i).forEach((n=>{const i=l(t,n,!0);i&&(e(n,i),o.push(n))}));const r=n.aliases||"all";if("none"!==r&&"object"==typeof t.aliases){const n=t.aliases;Object.keys(n).forEach((i=>{if("variations"===r&&function(t){for(const e in c)if(void 0!==t[e])return!0;return!1}(n[i]))return;const s=l(t,i,!0);s&&(e(i,s),o.push(i))}))}return o}const d={provider:"string",aliases:"object",not_found:"object"};for(const t in c)d[t]=typeof c[t];function h(t){if("object"!=typeof t||null===t)return null;const e=t;if("string"!=typeof e.prefix||!t.icons||"object"!=typeof t.icons)return null;for(const e in d)if(void 0!==t[e]&&typeof t[e]!==d[e])return null;const n=e.icons;for(const t in n){const e=n[t];if(!t.match(r)||"string"!=typeof e.body)return null;for(const t in c)if(void 0!==e[t]&&typeof e[t]!=typeof c[t])return null}const o=e.aliases;if(o)for(const t in o){const e=o[t],i=e.parent;if(!t.match(r)||"string"!=typeof i||!n[i]&&!o[i])return null;for(const t in c)if(void 0!==e[t]&&typeof e[t]!=typeof c[t])return null}return e}let p=Object.create(null);try{const t=window||self;t&&1===t._iconifyStorage.version&&(p=t._iconifyStorage.storage)}catch(t){}function g(){try{const t=window||self;t&&!t._iconifyStorage&&(t._iconifyStorage={version:1,storage:p})}catch(t){}}function v(t,e){void 0===p[t]&&(p[t]=Object.create(null));const n=p[t];return void 0===n[e]&&(n[e]=function(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:Object.create(null)}}(t,e)),n[e]}function y(t,e){if(!h(e))return[];const n=Date.now();return f(e,((e,o)=>{o?t.icons[e]=o:t.missing[e]=n}))}function b(t,e){let n,o=[];return n="string"==typeof t?[t]:Object.keys(p),n.forEach((t=>{let n;n="string"==typeof t&&"string"==typeof e?[e]:void 0===p[t]?[]:Object.keys(p[t]),n.forEach((e=>{const n=v(t,e),i=Object.keys(n.icons).map((n=>(""!==t?"@"+t+":":"")+e+":"+n));o=o.concat(i)}))})),o}let m=!1;function x(t){return"boolean"==typeof t&&(m=t),m}function w(t){const e="string"==typeof t?a(t,!0,m):t;if(!e)return;const n=v(e.provider,e.prefix),o=e.name;return n.icons[o]||(n.missing[o]?null:void 0)}function j(t,e){const n=a(t,!0,m);if(!n)return!1;return function(t,e,n){try{if("string"==typeof n.body)return t.icons[e]=Object.freeze(s(n)),!0}catch(t){}return!1}(v(n.provider,n.prefix),n.name,e)}function O(t,e){if("object"!=typeof t)return!1;if("string"!=typeof e&&(e="string"==typeof t.provider?t.provider:""),m&&""===e&&("string"!=typeof t.prefix||""===t.prefix)){let e=!1;return h(t)&&(t.prefix="",f(t,((t,n)=>{n&&j(t,n)&&(e=!0)}))),e}if("string"!=typeof t.prefix||!u({provider:e,prefix:t.prefix,name:"a"}))return!1;return!!y(v(e,t.prefix),t)}function k(t){return!!w(t)}function _(t){const e=w(t);return e?{...e}:null}const I=Object.create(null),A=Object.create(null);function S(t,e){t.forEach((t=>{const n=t.provider;if(void 0===I[n])return;const o=I[n],i=t.prefix,r=o[i];r&&(o[i]=r.filter((t=>t.id!==e)))}))}let E=0;const C=Object.create(null);function M(t,e){C[t]=e}function P(t){return C[t]||C[""]}var R={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function T(t,e,n,o){const i=t.resources.length,r=t.random?Math.floor(Math.random()*i):t.index;let c;if(t.random){let e=t.resources.slice(0);for(c=[];e.length>1;){const t=Math.floor(Math.random()*e.length);c.push(e[t]),e=e.slice(0,t).concat(e.slice(t+1))}c=c.concat(e)}else c=t.resources.slice(r).concat(t.resources.slice(0,r));const s=Date.now();let a,u="pending",l=0,f=null,d=[],h=[];function p(){f&&(clearTimeout(f),f=null)}function g(){"pending"===u&&(u="aborted"),p(),d.forEach((t=>{"pending"===t.status&&(t.status="aborted")})),d=[]}function v(t,e){e&&(h=[]),"function"==typeof t&&h.push(t)}function y(){u="failed",h.forEach((t=>{t(void 0,a)}))}function b(){d.forEach((t=>{"pending"===t.status&&(t.status="aborted")})),d=[]}function m(){if("pending"!==u)return;p();const o=c.shift();if(void 0===o)return d.length?void(f=setTimeout((()=>{p(),"pending"===u&&(b(),y())}),t.timeout)):void y();const i={status:"pending",resource:o,callback:(e,n)=>{!function(e,n,o){const i="success"!==n;switch(d=d.filter((t=>t!==e)),u){case"pending":break;case"failed":if(i||!t.dataAfterTimeout)return;break;default:return}if("abort"===n)return a=o,void y();if(i)return a=o,void(d.length||(c.length?m():y()));if(p(),b(),!t.random){const n=t.resources.indexOf(e.resource);-1!==n&&n!==t.index&&(t.index=n)}u="completed",h.forEach((t=>{t(o)}))}(i,e,n)}};d.push(i),l++,f=setTimeout(m,t.rotate),n(o,e,i.callback)}return"function"==typeof o&&h.push(o),setTimeout(m),function(){return{startTime:s,payload:e,status:u,queriesSent:l,queriesPending:d.length,subscribe:v,abort:g}}}function N(t){const e=function(t){if(!("object"==typeof t&&"object"==typeof t.resources&&t.resources instanceof Array&&t.resources.length))throw new Error("Invalid Reduncancy configuration");const e=Object.create(null);let n;for(n in R)void 0!==t[n]?e[n]=t[n]:e[n]=R[n];return e}(t);let n=[];function o(){n=n.filter((t=>"pending"===t().status))}return{query:function(t,i,r){const c=T(e,t,i,((t,e)=>{o(),r&&r(t,e)}));return n.push(c),c},find:function(t){const e=n.find((e=>t(e)));return void 0!==e?e:null},setIndex:t=>{e.index=t},getIndex:()=>e.index,cleanup:o}}function F(t){let e;if("string"==typeof t.resources)e=[t.resources];else if(e=t.resources,!(e instanceof Array&&e.length))return null;return{resources:e,path:void 0===t.path?"/":t.path,maxURL:t.maxURL?t.maxURL:500,rotate:t.rotate?t.rotate:750,timeout:t.timeout?t.timeout:5e3,random:!0===t.random,index:t.index?t.index:0,dataAfterTimeout:!1!==t.dataAfterTimeout}}const D=Object.create(null),z=["https://api.simplesvg.com","https://api.unisvg.com"],L=[];for(;z.length>0;)1===z.length||Math.random()>.5?L.push(z.shift()):L.push(z.pop());function q(t,e){const n=F(e);return null!==n&&(D[t]=n,!0)}function Q(t){return D[t]}function U(){return Object.keys(D)}function B(){}D[""]=F({resources:["https://api.iconify.design"].concat(L)});const J=Object.create(null);function $(t,e,n){let o,i;if("string"==typeof t){const e=P(t);if(!e)return n(void 0,424),B;i=e.send;const r=function(t){if(void 0===J[t]){const e=Q(t);if(!e)return;const n={config:e,redundancy:N(e)};J[t]=n}return J[t]}(t);r&&(o=r.redundancy)}else{const e=F(t);if(e){o=N(e);const n=P(t.resources?t.resources[0]:"");n&&(i=n.send)}}return o&&i?o.query(e,i,n)().abort:(n(void 0,424),B)}const H={};function G(){}const K=Object.create(null),V=Object.create(null),W=Object.create(null),X=Object.create(null);function Y(t,e){void 0===W[t]&&(W[t]=Object.create(null));const n=W[t];n[e]||(n[e]=!0,setTimeout((()=>{n[e]=!1,function(t,e){void 0===A[t]&&(A[t]=Object.create(null));const n=A[t];n[e]||(n[e]=!0,setTimeout((()=>{if(n[e]=!1,void 0===I[t]||void 0===I[t][e])return;const o=I[t][e].slice(0);if(!o.length)return;const i=v(t,e);let r=!1;o.forEach((n=>{const o=n.icons,c=o.pending.length;o.pending=o.pending.filter((n=>{if(n.prefix!==e)return!0;const c=n.name;if(void 0!==i.icons[c])o.loaded.push({provider:t,prefix:e,name:c});else{if(void 0===i.missing[c])return r=!0,!0;o.missing.push({provider:t,prefix:e,name:c})}return!1})),o.pending.length!==c&&(r||S([{provider:t,prefix:e}],n.id),n.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),n.abort))}))})))}(t,e)})))}const Z=Object.create(null);function tt(t,e,n){void 0===V[t]&&(V[t]=Object.create(null));const o=V[t];void 0===X[t]&&(X[t]=Object.create(null));const i=X[t];void 0===K[t]&&(K[t]=Object.create(null));const r=K[t];void 0===o[e]?o[e]=n:o[e]=o[e].concat(n).sort(),i[e]||(i[e]=!0,setTimeout((()=>{i[e]=!1;const n=o[e];delete o[e];const c=P(t);if(!c)return void function(){const n=(""===t?"":"@"+t+":")+e,o=Math.floor(Date.now()/6e4);Z[n]<o&&(Z[n]=o,console.error('Unable to retrieve icons for "'+n+'" because API is not configured properly.'))}();c.prepare(t,e,n).forEach((n=>{$(t,n,((o,i)=>{const c=v(t,e);if("object"!=typeof o){if(404!==i)return;const t=Date.now();n.icons.forEach((e=>{c.missing[e]=t}))}else try{const n=y(c,o);if(!n.length)return;const i=r[e];n.forEach((t=>{delete i[t]})),H.store&&H.store(t,o)}catch(t){console.error(t)}Y(t,e)}))}))})))}const et=(t,e)=>{const n=function(t,e=!0,n=!1){const o=[];return t.forEach((t=>{const i="string"==typeof t?a(t,!1,n):t;e&&!u(i,n)||o.push({provider:i.provider,prefix:i.prefix,name:i.name})})),o}(t,!0,x()),o=function(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort(((t,e)=>t.provider!==e.provider?t.provider.localeCompare(e.provider):t.prefix!==e.prefix?t.prefix.localeCompare(e.prefix):t.name.localeCompare(e.name)));let o={provider:"",prefix:"",name:""};return t.forEach((t=>{if(o.name===t.name&&o.prefix===t.prefix&&o.provider===t.provider)return;o=t;const i=t.provider,r=t.prefix,c=t.name;void 0===n[i]&&(n[i]=Object.create(null));const s=n[i];void 0===s[r]&&(s[r]=v(i,r));const a=s[r];let u;u=void 0!==a.icons[c]?e.loaded:""===r||void 0!==a.missing[c]?e.missing:e.pending;const l={provider:i,prefix:r,name:c};u.push(l)})),e}(n);if(!o.pending.length){let t=!0;return e&&setTimeout((()=>{t&&e(o.loaded,o.missing,o.pending,G)})),()=>{t=!1}}const i=Object.create(null),r=[];let c,s;o.pending.forEach((t=>{const e=t.provider,n=t.prefix;if(n===s&&e===c)return;c=e,s=n,r.push({provider:e,prefix:n}),void 0===K[e]&&(K[e]=Object.create(null));const o=K[e];void 0===o[n]&&(o[n]=Object.create(null)),void 0===i[e]&&(i[e]=Object.create(null));const a=i[e];void 0===a[n]&&(a[n]=[])}));const l=Date.now();return o.pending.forEach((t=>{const e=t.provider,n=t.prefix,o=t.name,r=K[e][n];void 0===r[o]&&(r[o]=l,i[e][n].push(o))})),r.forEach((t=>{const e=t.provider,n=t.prefix;i[e][n].length&&tt(e,n,i[e][n])})),e?function(t,e,n){const o=E++,i=S.bind(null,n,o);if(!e.pending.length)return i;const r={id:o,icons:e,callback:t,abort:i};return n.forEach((t=>{const e=t.provider,n=t.prefix;void 0===I[e]&&(I[e]=Object.create(null));const o=I[e];void 0===o[n]&&(o[n]=[]),o[n].push(r)})),i}(e,o,r):G},nt=t=>new Promise(((e,n)=>{const o="string"==typeof t?a(t):t;et([o||t],(i=>{if(i.length&&o){const t=w(o);if(t)return void e({...t})}n(t)}))}));function ot(t,e){const n="string"==typeof t?a(t,!0,!0):null;if(!n){const e=function(t){try{const e="string"==typeof t?JSON.parse(t):t;if("string"==typeof e.body)return{...c,...e}}catch(t){}}(t);return{value:t,data:e}}const o=w(n);if(void 0!==o||!n.prefix)return{value:t,name:n,data:o};const i=et([n],(()=>e(t,n,w(n))));return{value:t,name:n,loading:i}}function it(t){return t.hasAttribute("inline")}const rt=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ct=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function st(t,e,n){if(1===e)return t;if(n=void 0===n?100:n,"number"==typeof t)return Math.ceil(t*e*n)/n;if("string"!=typeof t)return t;const o=t.split(rt);if(null===o||!o.length)return t;const i=[];let r=o.shift(),c=ct.test(r);for(;;){if(c){const t=parseFloat(r);isNaN(t)?i.push(r):i.push(Math.ceil(t*e*n)/n)}else i.push(r);if(r=o.shift(),void 0===r)return i.join("");c=!c}}function at(t,e){const n={left:t.left,top:t.top,width:t.width,height:t.height};let o,i,r=t.body;[t,e].forEach((t=>{const e=[],o=t.hFlip,i=t.vFlip;let c,s=t.rotate;switch(o?i?s+=2:(e.push("translate("+(n.width+n.left).toString()+" "+(0-n.top).toString()+")"),e.push("scale(-1 1)"),n.top=n.left=0):i&&(e.push("translate("+(0-n.left).toString()+" "+(n.height+n.top).toString()+")"),e.push("scale(1 -1)"),n.top=n.left=0),s<0&&(s-=4*Math.floor(s/4)),s%=4,s){case 1:c=n.height/2+n.top,e.unshift("rotate(90 "+c.toString()+" "+c.toString()+")");break;case 2:e.unshift("rotate(180 "+(n.width/2+n.left).toString()+" "+(n.height/2+n.top).toString()+")");break;case 3:c=n.width/2+n.left,e.unshift("rotate(-90 "+c.toString()+" "+c.toString()+")")}s%2==1&&(0===n.left&&0===n.top||(c=n.left,n.left=n.top,n.top=c),n.width!==n.height&&(c=n.width,n.width=n.height,n.height=c)),e.length&&(r='<g transform="'+e.join(" ")+'">'+r+"</g>")})),null===e.width&&null===e.height?(i="1em",o=st(i,n.width/n.height)):null!==e.width&&null!==e.height?(o=e.width,i=e.height):null!==e.height?(i=e.height,o=st(i,n.width/n.height)):(o=e.width,i=st(o,n.height/n.width)),"auto"===o&&(o=n.width),"auto"===i&&(i=n.height),o="string"==typeof o?o:o.toString()+"",i="string"==typeof i?i:i.toString()+"";const c={attributes:{width:o,height:i,viewBox:n.left.toString()+" "+n.top.toString()+" "+n.width.toString()+" "+n.height.toString()},body:r};return e.inline&&(c.inline=!0),c}function ut(e,n){return at(s(e),n?function(t,e){const n={};for(const o in t){const i=o;if(n[i]=t[i],void 0===e[i])continue;const r=e[i];switch(i){case"inline":"boolean"==typeof r&&(n[i]=r);break;case"hFlip":case"vFlip":!0===r&&(n[i]=!n[i]);break;case"width":case"height":("string"==typeof r&&""!==r||"number"==typeof r&&r||null===r)&&(n[i]=r);break;case"rotate":"number"==typeof r&&(n[i]+=r)}}return n}(t,n):t)}const lt={},ft={};let dt=(()=>{let t;try{if(t=fetch,"function"==typeof t)return t}catch(t){}return null})();function ht(t){dt=t}function pt(){return dt}const gt={prepare:(t,e,n)=>{const o=[];let i=lt[e];void 0===i&&(i=function(t,e){const n=Q(t);if(!n)return 0;let o;if(n.maxURL){let t=0;n.resources.forEach((e=>{const n=e;t=Math.max(t,n.length)}));const i=e+".json?icons=";o=n.maxURL-t-n.path.length-i.length}else o=0;const i=t+":"+e;return ft[t]=n.path,lt[i]=o,o}(t,e));const r="icons";let c={type:r,provider:t,prefix:e,icons:[]},s=0;return n.forEach(((n,a)=>{s+=n.length+1,s>=i&&a>0&&(o.push(c),c={type:r,provider:t,prefix:e,icons:[]},s=n.length),c.icons.push(n)})),o.push(c),o},send:(t,e,n)=>{if(!dt)return void n("abort",424);let o=function(t){if("string"==typeof t){if(void 0===ft[t]){const e=Q(t);if(!e)return"/";ft[t]=e.path}return ft[t]}return"/"}(e.provider);switch(e.type){case"icons":{const t=e.prefix,n=e.icons.join(",");o+=t+".json?"+new URLSearchParams({icons:n}).toString();break}case"custom":{const t=e.uri;o+="/"===t.slice(0,1)?t.slice(1):t;break}default:return void n("abort",400)}let i=503;dt(t+o).then((t=>{const e=t.status;if(200===e)return i=501,t.json();setTimeout((()=>{n(function(t){return 404===t}(e)?"abort":"next",e)}))})).then((t=>{"object"==typeof t&&null!==t?setTimeout((()=>{n("success",t)})):setTimeout((()=>{n("next",i)}))})).catch((()=>{n("next",i)}))}},vt="iconify2",yt="iconify",bt="iconify-count",mt="iconify-version",xt=36e5,wt={local:!0,session:!0};let jt=!1;const Ot={local:0,session:0},kt={local:[],session:[]};let _t="undefined"==typeof window?{}:window;function It(t){const e=t+"Storage";try{if(_t&&_t[e]&&"number"==typeof _t[e].length)return _t[e]}catch(t){}return wt[t]=!1,null}function At(t,e,n){try{return t.setItem(bt,n.toString()),Ot[e]=n,!0}catch(t){}return!1}function St(t){const e=t.getItem(bt);if(e){const t=parseInt(e);return t||0}return 0}const Et=()=>{if(jt)return;jt=!0;const t=Math.floor(Date.now()/xt)-168;function e(e){const n=It(e);if(!n)return;const o=e=>{const o=yt+e.toString(),i=n.getItem(o);if("string"!=typeof i)return!1;let r=!0;try{const e=JSON.parse(i);if("object"!=typeof e||"number"!=typeof e.cached||e.cached<t||"string"!=typeof e.provider||"object"!=typeof e.data||"string"!=typeof e.data.prefix)r=!1;else{const t=e.provider,n=e.data.prefix;r=y(v(t,n),e.data).length>0}}catch(t){r=!1}return r||n.removeItem(o),r};try{const t=n.getItem(mt);if(t!==vt)return t&&function(t){try{const e=St(t);for(let n=0;n<e;n++)t.removeItem(yt+n.toString())}catch(t){}}(n),void function(t,e){try{t.setItem(mt,vt)}catch(t){}At(t,e,0)}(n,e);let i=St(n);for(let t=i-1;t>=0;t--)o(t)||(t===i-1?i--:kt[e].push(t));At(n,e,i)}catch(t){}}for(const t in wt)e(t)},Ct=(t,e)=>{function n(n){if(!wt[n])return!1;const o=It(n);if(!o)return!1;let i=kt[n].shift();if(void 0===i&&(i=Ot[n],!At(o,n,i+1)))return!1;try{const n={cached:Math.floor(Date.now()/xt),provider:t,data:e};o.setItem(yt+i.toString(),JSON.stringify(n))}catch(t){return!1}return!0}jt||Et(),Object.keys(e.icons).length&&(e.not_found&&delete(e=Object.assign({},e)).not_found,n("local")||n("session"))};function Mt(t,e){switch(t){case"local":case"session":wt[t]=e;break;case"all":for(const t in wt)wt[t]=e}}function Pt(t,e){let n=-1===t.indexOf("xlink:")?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const t in e)n+=" "+t+'="'+e[t]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}const Rt={"background-color":"currentColor"},Tt={"background-color":"transparent"},Nt={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},Ft={"-webkit-mask":Rt,mask:Rt,background:Tt};for(const t in Ft){const e=Ft[t];for(const n in Nt)e[t+"-"+n]=Nt[n]}function Dt(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const zt=["left","top","width","height"];function Lt(t,e){let n=e.icon.data;const o=e.customisations,i=o.viewBox;if(i){const t=i.split(/\s+/),e={};let o=!1;if(4===t.length){for(let n=0;n<4;n++){const i=parseFloat(t[n]);isNaN(i)?o=!0:e[zt[n]]=i}o||(n={...n,...e})}}const r=at(n,{...e.customisations,inline:e.inline});o.preserveAspectRatio&&(r.attributes.preserveAspectRatio=o.preserveAspectRatio);const c=e.renderedMode;let s;if("svg"===c)s=function(t){const e=document.createElement("span");return e.innerHTML=Pt(t.body,t.attributes),e.firstChild}(r);else s=function(t,e,n){const o=document.createElement("span");let i=t.body;-1!==i.indexOf("<a")&&(i+="\x3c!-- "+Date.now()+" --\x3e");const r=t.attributes,c='url("data:image/svg+xml,'+(u=Pt(i,{...r,width:e.width+"",height:e.height+""}),u.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")+'")'),s=o.style,a={"--svg":c,width:Dt(r.width),height:Dt(r.height),...n?Rt:Tt};var u;for(const t in a)s.setProperty(t,a[t]);return o}(r,n,"mask"===c);if(t.childNodes.length>1){const e=t.lastChild;"SPAN"===s.tagName&&e.tagName===s.tagName?e.setAttribute("style",s.getAttribute("style")):t.replaceChild(s,e)}else t.appendChild(s)}function qt(t,e){let n=t.firstChild;n||(n=document.createElement("style"),t.appendChild(n)),n.textContent=":host{display:inline-block;vertical-align:"+(e?"-0.125em":"0")+"}span,svg{display:block}"}function Qt(t,e,n){return{rendered:!1,inline:e,icon:t,lastRender:n&&(n.rendered?n:n.lastRender)}}!function(t="iconify-icon"){let e,n;try{e=window.customElements,n=window.HTMLElement}catch(t){return}if(!e||!n)return;const r=e.get(t);if(r)return r;const c=["icon","mode","inline","width","height","rotate","flip"],s=class extends n{_shadowRoot;_state;_checkQueued=!1;constructor(){super();const t=this._shadowRoot=this.attachShadow({mode:"closed"}),e=it(this);qt(t,e),this._state=Qt({value:""},e),this._queueCheck()}static get observedAttributes(){return c.slice(0)}attributeChangedCallback(t){if("inline"===t){const t=it(this),e=this._state;t!==e.inline&&(e.inline=t,qt(this._shadowRoot,t))}else this._queueCheck()}get icon(){const t=this.getAttribute("icon");if(t&&"{"===t.slice(0,1))try{return JSON.parse(t)}catch(t){}return t}set icon(t){"object"==typeof t&&(t=JSON.stringify(t)),this.setAttribute("icon",t)}get inline(){return it(this)}set inline(t){this.setAttribute("inline",t?"true":null)}restartAnimation(){const t=this._state;if(t.rendered){const e=this._shadowRoot;if("svg"===t.renderedMode)try{return void e.lastChild.setCurrentTime(0)}catch(t){}Lt(e,t)}}get status(){const t=this._state;return t.rendered?"rendered":null===t.icon.data?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout((()=>{this._check()})))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const t=this._state,e=this.getAttribute("icon");if(e!==t.icon.value)return void this._iconChanged(e);if(!t.rendered)return;const n=this.getAttribute("mode"),r=i(this);(t.attrMode!==n||function(t,e){for(const n in o)if(t[n]!==e[n])return!0;return!1}(t.customisations,r))&&this._renderIcon(t.icon,r,n)}_iconChanged(t){const e=ot(t,((t,e,n)=>{const o=this._state;if(o.rendered||this.getAttribute("icon")!==t)return;const i={value:t,name:e,data:n};i.data?this._gotIconData(i):o.icon=i}));e.data?this._gotIconData(e):this._state=Qt(e,this._state.inline,this._state)}_gotIconData(t){this._checkQueued=!1,this._renderIcon(t,i(this),this.getAttribute("mode"))}_renderIcon(t,e,n){const o=function(t,e){switch(e){case"svg":case"bg":case"mask":return e}return"style"!==e&&-1===t.indexOf("<a")?"svg":-1===t.indexOf("currentColor")?"bg":"mask"}(t.data.body,n),i=this._state.inline;Lt(this._shadowRoot,this._state={rendered:!0,icon:t,inline:i,customisations:e,attrMode:n,renderedMode:o})}};c.forEach((t=>{Object.hasOwn(s.prototype,t)||Object.defineProperty(s.prototype,t,{get:function(){return this.getAttribute(t)},set:function(e){this.setAttribute(t,e)}})}));const a=function(){let t;M("",gt),x(!0);try{t=window}catch(t){}if(t){if(H.store=Ct,Et(),void 0!==t.IconifyPreload){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";"object"==typeof e&&null!==e&&(e instanceof Array?e:[e]).forEach((t=>{try{("object"!=typeof t||null===t||t instanceof Array||"object"!=typeof t.icons||"string"!=typeof t.prefix||!O(t))&&console.error(n)}catch(t){console.error(n)}}))}if(void 0!==t.IconifyProviders){const e=t.IconifyProviders;if("object"==typeof e&&null!==e)for(const t in e){const n="IconifyProviders["+t+"] is invalid.";try{const o=e[t];if("object"!=typeof o||!o||void 0===o.resources)continue;q(t,o)||console.error(n)}catch(t){console.error(n)}}}}return{enableCache:t=>Mt(t,!0),disableCache:t=>Mt(t,!1),iconExists:k,getIcon:_,listIcons:b,shareStorage:g,addIcon:j,addCollection:O,calculateSize:st,buildIcon:ut,loadIcons:et,loadIcon:nt,addAPIProvider:q,_api:{getAPIConfig:Q,setAPIModule:M,sendAPIQuery:$,setFetch:ht,getFetch:pt,listAPIProviders:U}}}();for(const t in a)s[t]=s.prototype[t]=a[t];e.define(t,s)}()}(); | ||
!function(){"use strict";const t=Object.freeze({inline:!1,width:null,height:null,hFlip:!1,vFlip:!1,rotate:0});const e=/[\s,]+/;const{inline:n,...o}={...t,preserveAspectRatio:""};function i(t){const n={...o},i=(e,n)=>t.getAttribute(e)||n;var r;return n.width=i("width",null),n.height=i("height",null),n.rotate=function(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function o(t){for(;t<0;)t+=4;return t%4}if(""===n){const e=parseInt(t);return isNaN(e)?0:o(e)}if(n!==t){let e=0;switch(n){case"%":e=25;break;case"deg":e=90}if(e){let i=parseFloat(t.slice(0,t.length-n.length));return isNaN(i)?0:(i/=e,i%1==0?o(i):0)}}return e}(i("rotate","")),r=n,i("flip","").split(e).forEach((t=>{switch(t.trim()){case"horizontal":r.hFlip=!0;break;case"vertical":r.vFlip=!0}})),n.preserveAspectRatio=i("preserveAspectRatio",i("preserveaspectratio","")),n}const r=/^[a-z0-9]+(-[a-z0-9]+)*$/,c=Object.freeze({left:0,top:0,width:16,height:16,rotate:0,vFlip:!1,hFlip:!1});function s(t){return{...c,...t}}const a=(t,e,n,o="")=>{const i=t.split(":");if("@"===t.slice(0,1)){if(i.length<2||i.length>3)return null;o=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const t=i.pop(),n=i.pop(),r={provider:i.length>0?i[0]:o,prefix:n,name:t};return e&&!u(r)?null:r}const r=i[0],c=r.split("-");if(c.length>1){const t={provider:o,prefix:c.shift(),name:c.join("-")};return e&&!u(t)?null:t}if(n&&""===o){const t={provider:o,prefix:"",name:r};return e&&!u(t,n)?null:t}return null},u=(t,e)=>!!t&&!(""!==t.provider&&!t.provider.match(r)||!(e&&""===t.prefix||t.prefix.match(r))||!t.name.match(r));function l(t,e,n=!1){const o=function e(n,o){if(void 0!==t.icons[n])return Object.assign({},t.icons[n]);if(o>5)return null;const i=t.aliases;if(i&&void 0!==i[n]){const t=i[n],r=e(t.parent,o+1);return r?function(t,e){const n={...t};for(const t in c){const o=t;if(void 0!==e[o]){const t=e[o];if(void 0===n[o]){n[o]=t;continue}switch(o){case"rotate":n[o]=(n[o]+t)%4;break;case"hFlip":case"vFlip":n[o]=t!==n[o];break;default:n[o]=t}}}return n}(r,t):r}const r=t.chars;return!o&&r&&void 0!==r[n]?e(r[n],o+1):null}(e,0);if(o)for(const e in c)void 0===o[e]&&void 0!==t[e]&&(o[e]=t[e]);return o&&n?s(o):o}function f(t,e,n){n=n||{};const o=[];if("object"!=typeof t||"object"!=typeof t.icons)return o;t.not_found instanceof Array&&t.not_found.forEach((t=>{e(t,null),o.push(t)}));const i=t.icons;Object.keys(i).forEach((n=>{const i=l(t,n,!0);i&&(e(n,i),o.push(n))}));const r=n.aliases||"all";if("none"!==r&&"object"==typeof t.aliases){const n=t.aliases;Object.keys(n).forEach((i=>{if("variations"===r&&function(t){for(const e in c)if(void 0!==t[e])return!0;return!1}(n[i]))return;const s=l(t,i,!0);s&&(e(i,s),o.push(i))}))}return o}const d={provider:"string",aliases:"object",not_found:"object"};for(const t in c)d[t]=typeof c[t];function h(t){if("object"!=typeof t||null===t)return null;const e=t;if("string"!=typeof e.prefix||!t.icons||"object"!=typeof t.icons)return null;for(const e in d)if(void 0!==t[e]&&typeof t[e]!==d[e])return null;const n=e.icons;for(const t in n){const e=n[t];if(!t.match(r)||"string"!=typeof e.body)return null;for(const t in c)if(void 0!==e[t]&&typeof e[t]!=typeof c[t])return null}const o=e.aliases;if(o)for(const t in o){const e=o[t],i=e.parent;if(!t.match(r)||"string"!=typeof i||!n[i]&&!o[i])return null;for(const t in c)if(void 0!==e[t]&&typeof e[t]!=typeof c[t])return null}return e}let p=Object.create(null);try{const t=window||self;t&&1===t._iconifyStorage.version&&(p=t._iconifyStorage.storage)}catch(t){}function g(){try{const t=window||self;t&&!t._iconifyStorage&&(t._iconifyStorage={version:1,storage:p})}catch(t){}}function v(t,e){void 0===p[t]&&(p[t]=Object.create(null));const n=p[t];return void 0===n[e]&&(n[e]=function(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:Object.create(null)}}(t,e)),n[e]}function y(t,e){if(!h(e))return[];const n=Date.now();return f(e,((e,o)=>{o?t.icons[e]=o:t.missing[e]=n}))}function b(t,e){let n,o=[];return n="string"==typeof t?[t]:Object.keys(p),n.forEach((t=>{let n;n="string"==typeof t&&"string"==typeof e?[e]:void 0===p[t]?[]:Object.keys(p[t]),n.forEach((e=>{const n=v(t,e),i=Object.keys(n.icons).map((n=>(""!==t?"@"+t+":":"")+e+":"+n));o=o.concat(i)}))})),o}let m=!1;function x(t){return"boolean"==typeof t&&(m=t),m}function w(t){const e="string"==typeof t?a(t,!0,m):t;if(!e)return;const n=v(e.provider,e.prefix),o=e.name;return n.icons[o]||(n.missing[o]?null:void 0)}function j(t,e){const n=a(t,!0,m);if(!n)return!1;return function(t,e,n){try{if("string"==typeof n.body)return t.icons[e]=Object.freeze(s(n)),!0}catch(t){}return!1}(v(n.provider,n.prefix),n.name,e)}function O(t,e){if("object"!=typeof t)return!1;if("string"!=typeof e&&(e="string"==typeof t.provider?t.provider:""),m&&""===e&&("string"!=typeof t.prefix||""===t.prefix)){let e=!1;return h(t)&&(t.prefix="",f(t,((t,n)=>{n&&j(t,n)&&(e=!0)}))),e}if("string"!=typeof t.prefix||!u({provider:e,prefix:t.prefix,name:"a"}))return!1;return!!y(v(e,t.prefix),t)}function k(t){return!!w(t)}function _(t){const e=w(t);return e?{...e}:null}const I=Object.create(null),A=Object.create(null);function S(t,e){t.forEach((t=>{const n=t.provider;if(void 0===I[n])return;const o=I[n],i=t.prefix,r=o[i];r&&(o[i]=r.filter((t=>t.id!==e)))}))}let E=0;const C=Object.create(null);function M(t,e){C[t]=e}function P(t){return C[t]||C[""]}var R={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function T(t,e,n,o){const i=t.resources.length,r=t.random?Math.floor(Math.random()*i):t.index;let c;if(t.random){let e=t.resources.slice(0);for(c=[];e.length>1;){const t=Math.floor(Math.random()*e.length);c.push(e[t]),e=e.slice(0,t).concat(e.slice(t+1))}c=c.concat(e)}else c=t.resources.slice(r).concat(t.resources.slice(0,r));const s=Date.now();let a,u="pending",l=0,f=null,d=[],h=[];function p(){f&&(clearTimeout(f),f=null)}function g(){"pending"===u&&(u="aborted"),p(),d.forEach((t=>{"pending"===t.status&&(t.status="aborted")})),d=[]}function v(t,e){e&&(h=[]),"function"==typeof t&&h.push(t)}function y(){u="failed",h.forEach((t=>{t(void 0,a)}))}function b(){d.forEach((t=>{"pending"===t.status&&(t.status="aborted")})),d=[]}function m(){if("pending"!==u)return;p();const o=c.shift();if(void 0===o)return d.length?void(f=setTimeout((()=>{p(),"pending"===u&&(b(),y())}),t.timeout)):void y();const i={status:"pending",resource:o,callback:(e,n)=>{!function(e,n,o){const i="success"!==n;switch(d=d.filter((t=>t!==e)),u){case"pending":break;case"failed":if(i||!t.dataAfterTimeout)return;break;default:return}if("abort"===n)return a=o,void y();if(i)return a=o,void(d.length||(c.length?m():y()));if(p(),b(),!t.random){const n=t.resources.indexOf(e.resource);-1!==n&&n!==t.index&&(t.index=n)}u="completed",h.forEach((t=>{t(o)}))}(i,e,n)}};d.push(i),l++,f=setTimeout(m,t.rotate),n(o,e,i.callback)}return"function"==typeof o&&h.push(o),setTimeout(m),function(){return{startTime:s,payload:e,status:u,queriesSent:l,queriesPending:d.length,subscribe:v,abort:g}}}function F(t){const e=function(t){if(!("object"==typeof t&&"object"==typeof t.resources&&t.resources instanceof Array&&t.resources.length))throw new Error("Invalid Reduncancy configuration");const e=Object.create(null);let n;for(n in R)void 0!==t[n]?e[n]=t[n]:e[n]=R[n];return e}(t);let n=[];function o(){n=n.filter((t=>"pending"===t().status))}return{query:function(t,i,r){const c=T(e,t,i,((t,e)=>{o(),r&&r(t,e)}));return n.push(c),c},find:function(t){const e=n.find((e=>t(e)));return void 0!==e?e:null},setIndex:t=>{e.index=t},getIndex:()=>e.index,cleanup:o}}function N(t){let e;if("string"==typeof t.resources)e=[t.resources];else if(e=t.resources,!(e instanceof Array&&e.length))return null;return{resources:e,path:void 0===t.path?"/":t.path,maxURL:t.maxURL?t.maxURL:500,rotate:t.rotate?t.rotate:750,timeout:t.timeout?t.timeout:5e3,random:!0===t.random,index:t.index?t.index:0,dataAfterTimeout:!1!==t.dataAfterTimeout}}const D=Object.create(null),z=["https://api.simplesvg.com","https://api.unisvg.com"],L=[];for(;z.length>0;)1===z.length||Math.random()>.5?L.push(z.shift()):L.push(z.pop());function q(t,e){const n=N(e);return null!==n&&(D[t]=n,!0)}function Q(t){return D[t]}function U(){return Object.keys(D)}function J(){}D[""]=N({resources:["https://api.iconify.design"].concat(L)});const $=Object.create(null);function H(t,e,n){let o,i;if("string"==typeof t){const e=P(t);if(!e)return n(void 0,424),J;i=e.send;const r=function(t){if(void 0===$[t]){const e=Q(t);if(!e)return;const n={config:e,redundancy:F(e)};$[t]=n}return $[t]}(t);r&&(o=r.redundancy)}else{const e=N(t);if(e){o=F(e);const n=P(t.resources?t.resources[0]:"");n&&(i=n.send)}}return o&&i?o.query(e,i,n)().abort:(n(void 0,424),J)}const B={};function G(){}const K=Object.create(null),V=Object.create(null),W=Object.create(null),X=Object.create(null);function Y(t,e){void 0===W[t]&&(W[t]=Object.create(null));const n=W[t];n[e]||(n[e]=!0,setTimeout((()=>{n[e]=!1,function(t,e){void 0===A[t]&&(A[t]=Object.create(null));const n=A[t];n[e]||(n[e]=!0,setTimeout((()=>{if(n[e]=!1,void 0===I[t]||void 0===I[t][e])return;const o=I[t][e].slice(0);if(!o.length)return;const i=v(t,e);let r=!1;o.forEach((n=>{const o=n.icons,c=o.pending.length;o.pending=o.pending.filter((n=>{if(n.prefix!==e)return!0;const c=n.name;if(void 0!==i.icons[c])o.loaded.push({provider:t,prefix:e,name:c});else{if(void 0===i.missing[c])return r=!0,!0;o.missing.push({provider:t,prefix:e,name:c})}return!1})),o.pending.length!==c&&(r||S([{provider:t,prefix:e}],n.id),n.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),n.abort))}))})))}(t,e)})))}const Z=Object.create(null);function tt(t,e,n){void 0===V[t]&&(V[t]=Object.create(null));const o=V[t];void 0===X[t]&&(X[t]=Object.create(null));const i=X[t];void 0===K[t]&&(K[t]=Object.create(null));const r=K[t];void 0===o[e]?o[e]=n:o[e]=o[e].concat(n).sort(),i[e]||(i[e]=!0,setTimeout((()=>{i[e]=!1;const n=o[e];delete o[e];const c=P(t);if(!c)return void function(){const n=(""===t?"":"@"+t+":")+e,o=Math.floor(Date.now()/6e4);Z[n]<o&&(Z[n]=o,console.error('Unable to retrieve icons for "'+n+'" because API is not configured properly.'))}();c.prepare(t,e,n).forEach((n=>{H(t,n,((o,i)=>{const c=v(t,e);if("object"!=typeof o){if(404!==i)return;const t=Date.now();n.icons.forEach((e=>{c.missing[e]=t}))}else try{const n=y(c,o);if(!n.length)return;const i=r[e];n.forEach((t=>{delete i[t]})),B.store&&B.store(t,o)}catch(t){console.error(t)}Y(t,e)}))}))})))}const et=(t,e)=>{const n=function(t,e=!0,n=!1){const o=[];return t.forEach((t=>{const i="string"==typeof t?a(t,!1,n):t;e&&!u(i,n)||o.push({provider:i.provider,prefix:i.prefix,name:i.name})})),o}(t,!0,x()),o=function(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort(((t,e)=>t.provider!==e.provider?t.provider.localeCompare(e.provider):t.prefix!==e.prefix?t.prefix.localeCompare(e.prefix):t.name.localeCompare(e.name)));let o={provider:"",prefix:"",name:""};return t.forEach((t=>{if(o.name===t.name&&o.prefix===t.prefix&&o.provider===t.provider)return;o=t;const i=t.provider,r=t.prefix,c=t.name;void 0===n[i]&&(n[i]=Object.create(null));const s=n[i];void 0===s[r]&&(s[r]=v(i,r));const a=s[r];let u;u=void 0!==a.icons[c]?e.loaded:""===r||void 0!==a.missing[c]?e.missing:e.pending;const l={provider:i,prefix:r,name:c};u.push(l)})),e}(n);if(!o.pending.length){let t=!0;return e&&setTimeout((()=>{t&&e(o.loaded,o.missing,o.pending,G)})),()=>{t=!1}}const i=Object.create(null),r=[];let c,s;o.pending.forEach((t=>{const e=t.provider,n=t.prefix;if(n===s&&e===c)return;c=e,s=n,r.push({provider:e,prefix:n}),void 0===K[e]&&(K[e]=Object.create(null));const o=K[e];void 0===o[n]&&(o[n]=Object.create(null)),void 0===i[e]&&(i[e]=Object.create(null));const a=i[e];void 0===a[n]&&(a[n]=[])}));const l=Date.now();return o.pending.forEach((t=>{const e=t.provider,n=t.prefix,o=t.name,r=K[e][n];void 0===r[o]&&(r[o]=l,i[e][n].push(o))})),r.forEach((t=>{const e=t.provider,n=t.prefix;i[e][n].length&&tt(e,n,i[e][n])})),e?function(t,e,n){const o=E++,i=S.bind(null,n,o);if(!e.pending.length)return i;const r={id:o,icons:e,callback:t,abort:i};return n.forEach((t=>{const e=t.provider,n=t.prefix;void 0===I[e]&&(I[e]=Object.create(null));const o=I[e];void 0===o[n]&&(o[n]=[]),o[n].push(r)})),i}(e,o,r):G},nt=t=>new Promise(((e,n)=>{const o="string"==typeof t?a(t):t;et([o||t],(i=>{if(i.length&&o){const t=w(o);if(t)return void e({...t})}n(t)}))}));function ot(t,e){const n="string"==typeof t?a(t,!0,!0):null;if(!n){const e=function(t){try{const e="string"==typeof t?JSON.parse(t):t;if("string"==typeof e.body)return{...c,...e}}catch(t){}}(t);return{value:t,data:e}}const o=w(n);if(void 0!==o||!n.prefix)return{value:t,name:n,data:o};const i=et([n],(()=>e(t,n,w(n))));return{value:t,name:n,loading:i}}function it(t){return t.hasAttribute("inline")}const rt=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ct=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function st(t,e,n){if(1===e)return t;if(n=void 0===n?100:n,"number"==typeof t)return Math.ceil(t*e*n)/n;if("string"!=typeof t)return t;const o=t.split(rt);if(null===o||!o.length)return t;const i=[];let r=o.shift(),c=ct.test(r);for(;;){if(c){const t=parseFloat(r);isNaN(t)?i.push(r):i.push(Math.ceil(t*e*n)/n)}else i.push(r);if(r=o.shift(),void 0===r)return i.join("");c=!c}}function at(t,e){const n={left:t.left,top:t.top,width:t.width,height:t.height};let o,i,r=t.body;[t,e].forEach((t=>{const e=[],o=t.hFlip,i=t.vFlip;let c,s=t.rotate;switch(o?i?s+=2:(e.push("translate("+(n.width+n.left).toString()+" "+(0-n.top).toString()+")"),e.push("scale(-1 1)"),n.top=n.left=0):i&&(e.push("translate("+(0-n.left).toString()+" "+(n.height+n.top).toString()+")"),e.push("scale(1 -1)"),n.top=n.left=0),s<0&&(s-=4*Math.floor(s/4)),s%=4,s){case 1:c=n.height/2+n.top,e.unshift("rotate(90 "+c.toString()+" "+c.toString()+")");break;case 2:e.unshift("rotate(180 "+(n.width/2+n.left).toString()+" "+(n.height/2+n.top).toString()+")");break;case 3:c=n.width/2+n.left,e.unshift("rotate(-90 "+c.toString()+" "+c.toString()+")")}s%2==1&&(0===n.left&&0===n.top||(c=n.left,n.left=n.top,n.top=c),n.width!==n.height&&(c=n.width,n.width=n.height,n.height=c)),e.length&&(r='<g transform="'+e.join(" ")+'">'+r+"</g>")})),null===e.width&&null===e.height?(i="1em",o=st(i,n.width/n.height)):null!==e.width&&null!==e.height?(o=e.width,i=e.height):null!==e.height?(i=e.height,o=st(i,n.width/n.height)):(o=e.width,i=st(o,n.height/n.width)),"auto"===o&&(o=n.width),"auto"===i&&(i=n.height),o="string"==typeof o?o:o.toString()+"",i="string"==typeof i?i:i.toString()+"";const c={attributes:{width:o,height:i,viewBox:n.left.toString()+" "+n.top.toString()+" "+n.width.toString()+" "+n.height.toString()},body:r};return e.inline&&(c.inline=!0),c}function ut(e,n){return at(s(e),n?function(t,e){const n={};for(const o in t){const i=o;if(n[i]=t[i],void 0===e[i])continue;const r=e[i];switch(i){case"inline":"boolean"==typeof r&&(n[i]=r);break;case"hFlip":case"vFlip":!0===r&&(n[i]=!n[i]);break;case"width":case"height":("string"==typeof r&&""!==r||"number"==typeof r&&r||null===r)&&(n[i]=r);break;case"rotate":"number"==typeof r&&(n[i]+=r)}}return n}(t,n):t)}const lt={},ft={};let dt=(()=>{let t;try{if(t=fetch,"function"==typeof t)return t}catch(t){}return null})();function ht(t){dt=t}function pt(){return dt}const gt={prepare:(t,e,n)=>{const o=[];let i=lt[e];void 0===i&&(i=function(t,e){const n=Q(t);if(!n)return 0;let o;if(n.maxURL){let t=0;n.resources.forEach((e=>{const n=e;t=Math.max(t,n.length)}));const i=e+".json?icons=";o=n.maxURL-t-n.path.length-i.length}else o=0;const i=t+":"+e;return ft[t]=n.path,lt[i]=o,o}(t,e));const r="icons";let c={type:r,provider:t,prefix:e,icons:[]},s=0;return n.forEach(((n,a)=>{s+=n.length+1,s>=i&&a>0&&(o.push(c),c={type:r,provider:t,prefix:e,icons:[]},s=n.length),c.icons.push(n)})),o.push(c),o},send:(t,e,n)=>{if(!dt)return void n("abort",424);let o=function(t){if("string"==typeof t){if(void 0===ft[t]){const e=Q(t);if(!e)return"/";ft[t]=e.path}return ft[t]}return"/"}(e.provider);switch(e.type){case"icons":{const t=e.prefix,n=e.icons.join(",");o+=t+".json?"+new URLSearchParams({icons:n}).toString();break}case"custom":{const t=e.uri;o+="/"===t.slice(0,1)?t.slice(1):t;break}default:return void n("abort",400)}let i=503;dt(t+o).then((t=>{const e=t.status;if(200===e)return i=501,t.json();setTimeout((()=>{n(function(t){return 404===t}(e)?"abort":"next",e)}))})).then((t=>{"object"==typeof t&&null!==t?setTimeout((()=>{n("success",t)})):setTimeout((()=>{n("next",i)}))})).catch((()=>{n("next",i)}))}},vt="iconify2",yt="iconify",bt="iconify-count",mt="iconify-version",xt=36e5,wt={local:!0,session:!0};let jt=!1;const Ot={local:0,session:0},kt={local:[],session:[]};let _t="undefined"==typeof window?{}:window;function It(t){const e=t+"Storage";try{if(_t&&_t[e]&&"number"==typeof _t[e].length)return _t[e]}catch(t){}return wt[t]=!1,null}function At(t,e,n){try{return t.setItem(bt,n.toString()),Ot[e]=n,!0}catch(t){}return!1}function St(t){const e=t.getItem(bt);if(e){const t=parseInt(e);return t||0}return 0}const Et=()=>{if(jt)return;jt=!0;const t=Math.floor(Date.now()/xt)-168;function e(e){const n=It(e);if(!n)return;const o=e=>{const o=yt+e.toString(),i=n.getItem(o);if("string"!=typeof i)return!1;let r=!0;try{const e=JSON.parse(i);if("object"!=typeof e||"number"!=typeof e.cached||e.cached<t||"string"!=typeof e.provider||"object"!=typeof e.data||"string"!=typeof e.data.prefix)r=!1;else{const t=e.provider,n=e.data.prefix;r=y(v(t,n),e.data).length>0}}catch(t){r=!1}return r||n.removeItem(o),r};try{const t=n.getItem(mt);if(t!==vt)return t&&function(t){try{const e=St(t);for(let n=0;n<e;n++)t.removeItem(yt+n.toString())}catch(t){}}(n),void function(t,e){try{t.setItem(mt,vt)}catch(t){}At(t,e,0)}(n,e);let i=St(n);for(let t=i-1;t>=0;t--)o(t)||(t===i-1?i--:kt[e].push(t));At(n,e,i)}catch(t){}}for(const t in wt)e(t)},Ct=(t,e)=>{function n(n){if(!wt[n])return!1;const o=It(n);if(!o)return!1;let i=kt[n].shift();if(void 0===i&&(i=Ot[n],!At(o,n,i+1)))return!1;try{const n={cached:Math.floor(Date.now()/xt),provider:t,data:e};o.setItem(yt+i.toString(),JSON.stringify(n))}catch(t){return!1}return!0}jt||Et(),Object.keys(e.icons).length&&(e.not_found&&delete(e=Object.assign({},e)).not_found,n("local")||n("session"))};function Mt(t,e){switch(t){case"local":case"session":wt[t]=e;break;case"all":for(const t in wt)wt[t]=e}}function Pt(t,e){let n=-1===t.indexOf("xlink:")?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const t in e)n+=" "+t+'="'+e[t]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}const Rt={"background-color":"currentColor"},Tt={"background-color":"transparent"},Ft={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},Nt={"-webkit-mask":Rt,mask:Rt,background:Tt};for(const t in Nt){const e=Nt[t];for(const n in Ft)e[t+"-"+n]=Ft[n]}function Dt(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}function zt(t,e){const n=e.icon.data,o=e.customisations,i=at(n,{...o,inline:e.inline});o.preserveAspectRatio&&(i.attributes.preserveAspectRatio=o.preserveAspectRatio);const r=e.renderedMode;let c;if("svg"===r)c=function(t){const e=document.createElement("span");return e.innerHTML=Pt(t.body,t.attributes),e.firstChild}(i);else c=function(t,e,n){const o=document.createElement("span");let i=t.body;-1!==i.indexOf("<a")&&(i+="\x3c!-- "+Date.now()+" --\x3e");const r=t.attributes,c='url("data:image/svg+xml,'+(u=Pt(i,{...r,width:e.width+"",height:e.height+""}),u.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")+'")'),s=o.style,a={"--svg":c,width:Dt(r.width),height:Dt(r.height),...n?Rt:Tt};var u;for(const t in a)s.setProperty(t,a[t]);return o}(i,n,"mask"===r);if(t.childNodes.length>1){const e=t.lastChild;"SPAN"===c.tagName&&e.tagName===c.tagName?e.setAttribute("style",c.getAttribute("style")):t.replaceChild(c,e)}else t.appendChild(c)}function Lt(t,e){let n=t.firstChild;n||(n=document.createElement("style"),t.appendChild(n)),n.textContent=":host{display:inline-block;vertical-align:"+(e?"-0.125em":"0")+"}span,svg{display:block}"}function qt(t,e,n){return{rendered:!1,inline:e,icon:t,lastRender:n&&(n.rendered?n:n.lastRender)}}!function(t="iconify-icon"){let e,n;try{e=window.customElements,n=window.HTMLElement}catch(t){return}if(!e||!n)return;const r=e.get(t);if(r)return r;const c=["icon","mode","inline","width","height","rotate","flip"],s=class extends n{_shadowRoot;_state;_checkQueued=!1;constructor(){super();const t=this._shadowRoot=this.attachShadow({mode:"closed"}),e=it(this);Lt(t,e),this._state=qt({value:""},e),this._queueCheck()}static get observedAttributes(){return c.slice(0)}attributeChangedCallback(t){if("inline"===t){const t=it(this),e=this._state;t!==e.inline&&(e.inline=t,Lt(this._shadowRoot,t))}else this._queueCheck()}get icon(){const t=this.getAttribute("icon");if(t&&"{"===t.slice(0,1))try{return JSON.parse(t)}catch(t){}return t}set icon(t){"object"==typeof t&&(t=JSON.stringify(t)),this.setAttribute("icon",t)}get inline(){return it(this)}set inline(t){this.setAttribute("inline",t?"true":null)}restartAnimation(){const t=this._state;if(t.rendered){const e=this._shadowRoot;if("svg"===t.renderedMode)try{return void e.lastChild.setCurrentTime(0)}catch(t){}zt(e,t)}}get status(){const t=this._state;return t.rendered?"rendered":null===t.icon.data?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout((()=>{this._check()})))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const t=this._state,e=this.getAttribute("icon");if(e!==t.icon.value)return void this._iconChanged(e);if(!t.rendered)return;const n=this.getAttribute("mode"),r=i(this);(t.attrMode!==n||function(t,e){for(const n in o)if(t[n]!==e[n])return!0;return!1}(t.customisations,r))&&this._renderIcon(t.icon,r,n)}_iconChanged(t){const e=ot(t,((t,e,n)=>{const o=this._state;if(o.rendered||this.getAttribute("icon")!==t)return;const i={value:t,name:e,data:n};i.data?this._gotIconData(i):o.icon=i}));e.data?this._gotIconData(e):this._state=qt(e,this._state.inline,this._state)}_gotIconData(t){this._checkQueued=!1,this._renderIcon(t,i(this),this.getAttribute("mode"))}_renderIcon(t,e,n){const o=function(t,e){switch(e){case"svg":case"bg":case"mask":return e}return"style"!==e&&-1===t.indexOf("<a")?"svg":-1===t.indexOf("currentColor")?"bg":"mask"}(t.data.body,n),i=this._state.inline;zt(this._shadowRoot,this._state={rendered:!0,icon:t,inline:i,customisations:e,attrMode:n,renderedMode:o})}};c.forEach((t=>{Object.hasOwn(s.prototype,t)||Object.defineProperty(s.prototype,t,{get:function(){return this.getAttribute(t)},set:function(e){this.setAttribute(t,e)}})}));const a=function(){let t;M("",gt),x(!0);try{t=window}catch(t){}if(t){if(B.store=Ct,Et(),void 0!==t.IconifyPreload){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";"object"==typeof e&&null!==e&&(e instanceof Array?e:[e]).forEach((t=>{try{("object"!=typeof t||null===t||t instanceof Array||"object"!=typeof t.icons||"string"!=typeof t.prefix||!O(t))&&console.error(n)}catch(t){console.error(n)}}))}if(void 0!==t.IconifyProviders){const e=t.IconifyProviders;if("object"==typeof e&&null!==e)for(const t in e){const n="IconifyProviders["+t+"] is invalid.";try{const o=e[t];if("object"!=typeof o||!o||void 0===o.resources)continue;q(t,o)||console.error(n)}catch(t){console.error(n)}}}}return{enableCache:t=>Mt(t,!0),disableCache:t=>Mt(t,!1),iconExists:k,getIcon:_,listIcons:b,shareStorage:g,addIcon:j,addCollection:O,calculateSize:st,buildIcon:ut,loadIcons:et,loadIcon:nt,addAPIProvider:q,_api:{getAPIConfig:Q,setAPIModule:M,sendAPIQuery:H,setFetch:ht,getFetch:pt,listAPIProviders:U}}}();for(const t in a)s[t]=s.prototype[t]=a[t];e.define(t,s)}()}(); |
@@ -5,3 +5,3 @@ { | ||
"author": "Vjacheslav Trushkin <cyberalien@gmail.com> (https://iconify.design)", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "./dist/iconify-icon.cjs", |
@@ -24,3 +24,3 @@ # What is Iconify? | ||
```html | ||
<script src="https://code.iconify.design/iconify-icon/0.0.5/iconify-icon.min.js"></script> | ||
<script src="https://code.iconify.design/iconify-icon/0.0.6/iconify-icon.min.js"></script> | ||
``` | ||
@@ -31,3 +31,3 @@ | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/iconify-icon@0.0.5/dist/iconify-icon.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/iconify-icon@0.0.6/dist/iconify-icon.min.js"></script> | ||
``` | ||
@@ -34,0 +34,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242798
7184