purplefox-tools
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -20,4 +20,3 @@ var __defProp = Object.defineProperty; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
import { resolveComponent, openBlock, createBlock, Teleport, createVNode, TransitionGroup, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, ref, readonly, reactive, withModifiers, renderSlot, computed, watch } from "vue"; | ||
import { Icon } from "@iconify/vue"; | ||
import { defineComponent, h, resolveComponent, openBlock, createBlock, Teleport, createVNode, TransitionGroup, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, ref, readonly, reactive, withModifiers, renderSlot, computed, watch } from "vue"; | ||
import { useRoute, useRouter } from "vue-router"; | ||
@@ -65,2 +64,1982 @@ var getRandomValues; | ||
} | ||
var matchName = /^[a-z0-9]+(-[a-z0-9]+)*$/; | ||
var iconDefaults = Object.freeze({ | ||
left: 0, | ||
top: 0, | ||
width: 16, | ||
height: 16, | ||
rotate: 0, | ||
vFlip: false, | ||
hFlip: false | ||
}); | ||
function fullIcon(data) { | ||
return __spreadValues(__spreadValues({}, iconDefaults), data); | ||
} | ||
var stringToIcon = (value, validate2, allowSimpleName, provider = "") => { | ||
const colonSeparated = value.split(":"); | ||
if (value.slice(0, 1) === "@") { | ||
if (colonSeparated.length < 2 || colonSeparated.length > 3) { | ||
return null; | ||
} | ||
provider = colonSeparated.shift().slice(1); | ||
} | ||
if (colonSeparated.length > 3 || !colonSeparated.length) { | ||
return null; | ||
} | ||
if (colonSeparated.length > 1) { | ||
const name2 = colonSeparated.pop(); | ||
const prefix = colonSeparated.pop(); | ||
const result = { | ||
provider: colonSeparated.length > 0 ? colonSeparated[0] : provider, | ||
prefix, | ||
name: name2 | ||
}; | ||
return validate2 && !validateIcon(result) ? null : result; | ||
} | ||
const name = colonSeparated[0]; | ||
const dashSeparated = name.split("-"); | ||
if (dashSeparated.length > 1) { | ||
const result = { | ||
provider, | ||
prefix: dashSeparated.shift(), | ||
name: dashSeparated.join("-") | ||
}; | ||
return validate2 && !validateIcon(result) ? null : result; | ||
} | ||
if (allowSimpleName && provider === "") { | ||
const result = { | ||
provider, | ||
prefix: "", | ||
name | ||
}; | ||
return validate2 && !validateIcon(result, allowSimpleName) ? null : result; | ||
} | ||
return null; | ||
}; | ||
var validateIcon = (icon, allowSimpleName) => { | ||
if (!icon) { | ||
return false; | ||
} | ||
return !!((icon.provider === "" || icon.provider.match(matchName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchName)) && icon.name.match(matchName)); | ||
}; | ||
function mergeIconData(icon, alias) { | ||
const result = __spreadValues({}, icon); | ||
for (const key in iconDefaults) { | ||
const prop = key; | ||
if (alias[prop] !== void 0) { | ||
const value = alias[prop]; | ||
if (result[prop] === void 0) { | ||
result[prop] = value; | ||
continue; | ||
} | ||
switch (prop) { | ||
case "rotate": | ||
result[prop] = (result[prop] + value) % 4; | ||
break; | ||
case "hFlip": | ||
case "vFlip": | ||
result[prop] = value !== result[prop]; | ||
break; | ||
default: | ||
result[prop] = value; | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
function getIconData$1(data, name, full = false) { | ||
function getIcon(name2, iteration) { | ||
var _a, _b, _c, _d; | ||
if (data.icons[name2] !== void 0) { | ||
return Object.assign({}, data.icons[name2]); | ||
} | ||
if (iteration > 5) { | ||
return null; | ||
} | ||
if (((_a = data.aliases) == null ? void 0 : _a[name2]) !== void 0) { | ||
const item = (_b = data.aliases) == null ? void 0 : _b[name2]; | ||
const result2 = getIcon(item.parent, iteration + 1); | ||
if (result2) { | ||
return mergeIconData(result2, item); | ||
} | ||
return result2; | ||
} | ||
if (iteration === 0 && ((_c = data.chars) == null ? void 0 : _c[name2]) !== void 0) { | ||
return getIcon((_d = data.chars) == null ? void 0 : _d[name2], iteration + 1); | ||
} | ||
return null; | ||
} | ||
const result = getIcon(name, 0); | ||
if (result) { | ||
for (const key in iconDefaults) { | ||
if (result[key] === void 0 && data[key] !== void 0) { | ||
result[key] = data[key]; | ||
} | ||
} | ||
} | ||
return result && full ? fullIcon(result) : result; | ||
} | ||
var matchChar = /^[a-f0-9]+(-[a-f0-9]+)*$/; | ||
function validateIconProps(item, fix) { | ||
for (const key in item) { | ||
const attr = key; | ||
const value = item[attr]; | ||
const type = typeof value; | ||
if (type === "undefined") { | ||
delete item[attr]; | ||
continue; | ||
} | ||
switch (key) { | ||
case "body": | ||
case "parent": | ||
if (type !== "string") { | ||
return key; | ||
} | ||
break; | ||
case "hFlip": | ||
case "vFlip": | ||
case "hidden": | ||
if (type !== "boolean") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
break; | ||
case "width": | ||
case "height": | ||
case "left": | ||
case "top": | ||
case "rotate": | ||
case "inlineHeight": | ||
case "inlineTop": | ||
case "verticalAlign": | ||
if (type !== "number") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
break; | ||
default: | ||
if (type === "object") { | ||
if (fix) { | ||
delete item[attr]; | ||
} else { | ||
return key; | ||
} | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
function validateIconSet(obj, options) { | ||
const fix = !!(options == null ? void 0 : options.fix); | ||
if (typeof obj !== "object" || obj === null || typeof obj.icons !== "object" || !obj.icons) { | ||
throw new Error("Bad icon set"); | ||
} | ||
const data = obj; | ||
if (typeof (options == null ? void 0 : options.prefix) === "string") { | ||
data.prefix = options.prefix; | ||
} else if (typeof data.prefix !== "string" || !data.prefix.match(matchName)) { | ||
throw new Error("Invalid prefix"); | ||
} | ||
if (typeof (options == null ? void 0 : options.provider) === "string") { | ||
data.provider = options.provider; | ||
} else if (data.provider !== void 0) { | ||
const value = data.provider; | ||
if (typeof value !== "string" || value !== "" && !value.match(matchName)) { | ||
if (fix) { | ||
delete data.provider; | ||
} else { | ||
throw new Error("Invalid provider"); | ||
} | ||
} | ||
} | ||
const icons = data.icons; | ||
Object.keys(icons).forEach((name) => { | ||
if (!name.match(matchName)) { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid icon name: "${name}"`); | ||
} | ||
const item = icons[name]; | ||
if (typeof item !== "object" || item === null || typeof item.body !== "string") { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid icon: "${name}"`); | ||
} | ||
const key = typeof item.parent === "string" ? "parent" : validateIconProps(item, fix); | ||
if (key !== null) { | ||
if (fix) { | ||
delete icons[name]; | ||
return; | ||
} | ||
throw new Error(`Invalid property "${key}" in icon "${name}"`); | ||
} | ||
}); | ||
if (!Object.keys(data.icons).length) { | ||
throw new Error("Icon set is empty"); | ||
} | ||
if (data.aliases !== void 0) { | ||
if (typeof data.aliases !== "object" || data.aliases === null) { | ||
if (fix) { | ||
delete data.aliases; | ||
} else { | ||
throw new Error("Invalid aliases list"); | ||
} | ||
} | ||
} | ||
if (typeof data.aliases === "object") { | ||
let validateAlias = function(name, iteration) { | ||
if (validatedAliases.has(name)) { | ||
return !failedAliases.has(name); | ||
} | ||
const item = aliases[name]; | ||
if (iteration > 5 || typeof item !== "object" || item === null || typeof item.parent !== "string" || !name.match(matchName)) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Invalid icon alias: "${name}"`); | ||
} | ||
const parent = item.parent; | ||
if (data.icons[parent] === void 0) { | ||
if (aliases[parent] === void 0 || !validateAlias(parent, iteration + 1)) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Missing parent icon for alias "${name}`); | ||
} | ||
} | ||
if (fix && item.body !== void 0) { | ||
delete item.body; | ||
} | ||
const key = item.body !== void 0 ? "body" : validateIconProps(item, fix); | ||
if (key !== null) { | ||
if (fix) { | ||
delete aliases[name]; | ||
failedAliases.add(name); | ||
return false; | ||
} | ||
throw new Error(`Invalid property "${key}" in alias "${name}"`); | ||
} | ||
validatedAliases.add(name); | ||
return true; | ||
}; | ||
const aliases = data.aliases; | ||
const validatedAliases = new Set(); | ||
const failedAliases = new Set(); | ||
Object.keys(aliases).forEach((name) => { | ||
validateAlias(name, 0); | ||
}); | ||
if (fix && !Object.keys(data.aliases).length) { | ||
delete data.aliases; | ||
} | ||
} | ||
Object.keys(iconDefaults).forEach((prop) => { | ||
const expectedType = typeof iconDefaults[prop]; | ||
const actualType = typeof data[prop]; | ||
if (actualType !== "undefined" && actualType !== expectedType) { | ||
throw new Error(`Invalid value type for "${prop}"`); | ||
} | ||
}); | ||
if (data.chars !== void 0) { | ||
if (typeof data.chars !== "object" || data.chars === null) { | ||
if (fix) { | ||
delete data.chars; | ||
} else { | ||
throw new Error("Invalid characters map"); | ||
} | ||
} | ||
} | ||
if (typeof data.chars === "object") { | ||
const chars = data.chars; | ||
Object.keys(chars).forEach((char) => { | ||
var _a; | ||
if (!char.match(matchChar) || typeof chars[char] !== "string") { | ||
if (fix) { | ||
delete chars[char]; | ||
return; | ||
} | ||
throw new Error(`Invalid character "${char}"`); | ||
} | ||
const target = chars[char]; | ||
if (data.icons[target] === void 0 && ((_a = data.aliases) == null ? void 0 : _a[target]) === void 0) { | ||
if (fix) { | ||
delete chars[char]; | ||
return; | ||
} | ||
throw new Error(`Character "${char}" points to missing icon "${target}"`); | ||
} | ||
}); | ||
if (fix && !Object.keys(data.chars).length) { | ||
delete data.chars; | ||
} | ||
} | ||
return data; | ||
} | ||
function isVariation(item) { | ||
for (const key in iconDefaults) { | ||
if (item[key] !== void 0) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
function parseIconSet(data, callback, options) { | ||
options = options || {}; | ||
const names = []; | ||
if (typeof data !== "object" || typeof data.icons !== "object") { | ||
return names; | ||
} | ||
const validate2 = options.validate; | ||
if (validate2 !== false) { | ||
try { | ||
validateIconSet(data, typeof validate2 === "object" ? validate2 : { fix: true }); | ||
} catch (err) { | ||
return names; | ||
} | ||
} | ||
if (data.not_found instanceof Array) { | ||
data.not_found.forEach((name) => { | ||
callback(name, null); | ||
names.push(name); | ||
}); | ||
} | ||
const icons = data.icons; | ||
Object.keys(icons).forEach((name) => { | ||
const iconData = getIconData$1(data, name, true); | ||
if (iconData) { | ||
callback(name, iconData); | ||
names.push(name); | ||
} | ||
}); | ||
const parseAliases = options.aliases || "all"; | ||
if (parseAliases !== "none" && typeof data.aliases === "object") { | ||
const aliases = data.aliases; | ||
Object.keys(aliases).forEach((name) => { | ||
if (parseAliases === "variations" && isVariation(aliases[name])) { | ||
return; | ||
} | ||
const iconData = getIconData$1(data, name, true); | ||
if (iconData) { | ||
callback(name, iconData); | ||
names.push(name); | ||
} | ||
}); | ||
} | ||
return names; | ||
} | ||
var storage$1 = Object.create(null); | ||
function newStorage(provider, prefix) { | ||
return { | ||
provider, | ||
prefix, | ||
icons: Object.create(null), | ||
missing: Object.create(null) | ||
}; | ||
} | ||
function getStorage(provider, prefix) { | ||
if (storage$1[provider] === void 0) { | ||
storage$1[provider] = Object.create(null); | ||
} | ||
const providerStorage = storage$1[provider]; | ||
if (providerStorage[prefix] === void 0) { | ||
providerStorage[prefix] = newStorage(provider, prefix); | ||
} | ||
return providerStorage[prefix]; | ||
} | ||
function addIconSet(storage2, data) { | ||
const t = Date.now(); | ||
return parseIconSet(data, (name, icon) => { | ||
if (icon) { | ||
storage2.icons[name] = icon; | ||
} else { | ||
storage2.missing[name] = t; | ||
} | ||
}); | ||
} | ||
function addIconToStorage(storage2, name, icon) { | ||
try { | ||
if (typeof icon.body === "string") { | ||
storage2.icons[name] = Object.freeze(fullIcon(icon)); | ||
return true; | ||
} | ||
} catch (err) { | ||
} | ||
return false; | ||
} | ||
function getIconFromStorage(storage2, name) { | ||
const value = storage2.icons[name]; | ||
return value === void 0 ? null : value; | ||
} | ||
var simpleNames = false; | ||
function allowSimpleNames(allow) { | ||
if (typeof allow === "boolean") { | ||
simpleNames = allow; | ||
} | ||
return simpleNames; | ||
} | ||
function getIconData(name) { | ||
const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name; | ||
return icon ? getIconFromStorage(getStorage(icon.provider, icon.prefix), icon.name) : null; | ||
} | ||
function addIcon(name, data) { | ||
const icon = stringToIcon(name, true, simpleNames); | ||
if (!icon) { | ||
return false; | ||
} | ||
const storage2 = getStorage(icon.provider, icon.prefix); | ||
return addIconToStorage(storage2, icon.name, data); | ||
} | ||
function addCollection(data, provider) { | ||
if (typeof data !== "object") { | ||
return false; | ||
} | ||
if (typeof provider !== "string") { | ||
provider = typeof data.provider === "string" ? data.provider : ""; | ||
} | ||
if (simpleNames && provider === "" && (typeof data.prefix !== "string" || data.prefix === "")) { | ||
let added = false; | ||
parseIconSet(data, (name, icon) => { | ||
if (icon && addIcon(name, icon)) { | ||
added = true; | ||
} | ||
}, { | ||
validate: { | ||
fix: true, | ||
prefix: "" | ||
} | ||
}); | ||
return added; | ||
} | ||
if (typeof data.prefix !== "string" || !validateIcon({ | ||
provider, | ||
prefix: data.prefix, | ||
name: "a" | ||
})) { | ||
return false; | ||
} | ||
const storage2 = getStorage(provider, data.prefix); | ||
return !!addIconSet(storage2, data); | ||
} | ||
var defaults = Object.freeze({ | ||
inline: false, | ||
width: null, | ||
height: null, | ||
hAlign: "center", | ||
vAlign: "middle", | ||
slice: false, | ||
hFlip: false, | ||
vFlip: false, | ||
rotate: 0 | ||
}); | ||
function mergeCustomisations(defaults2, item) { | ||
const result = {}; | ||
for (const key in defaults2) { | ||
const attr = key; | ||
result[attr] = defaults2[attr]; | ||
if (item[attr] === void 0) { | ||
continue; | ||
} | ||
const value = item[attr]; | ||
switch (attr) { | ||
case "inline": | ||
case "slice": | ||
if (typeof value === "boolean") { | ||
result[attr] = value; | ||
} | ||
break; | ||
case "hFlip": | ||
case "vFlip": | ||
if (value === true) { | ||
result[attr] = !result[attr]; | ||
} | ||
break; | ||
case "hAlign": | ||
case "vAlign": | ||
if (typeof value === "string" && value !== "") { | ||
result[attr] = value; | ||
} | ||
break; | ||
case "width": | ||
case "height": | ||
if (typeof value === "string" && value !== "" || typeof value === "number" && value || value === null) { | ||
result[attr] = value; | ||
} | ||
break; | ||
case "rotate": | ||
if (typeof value === "number") { | ||
result[attr] += value; | ||
} | ||
break; | ||
} | ||
} | ||
return result; | ||
} | ||
var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g; | ||
var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g; | ||
function calculateSize(size, ratio, precision) { | ||
if (ratio === 1) { | ||
return size; | ||
} | ||
precision = precision === void 0 ? 100 : precision; | ||
if (typeof size === "number") { | ||
return Math.ceil(size * ratio * precision) / precision; | ||
} | ||
if (typeof size !== "string") { | ||
return size; | ||
} | ||
const oldParts = size.split(unitsSplit); | ||
if (oldParts === null || !oldParts.length) { | ||
return size; | ||
} | ||
const newParts = []; | ||
let code = oldParts.shift(); | ||
let isNumber = unitsTest.test(code); | ||
while (true) { | ||
if (isNumber) { | ||
const num = parseFloat(code); | ||
if (isNaN(num)) { | ||
newParts.push(code); | ||
} else { | ||
newParts.push(Math.ceil(num * ratio * precision) / precision); | ||
} | ||
} else { | ||
newParts.push(code); | ||
} | ||
code = oldParts.shift(); | ||
if (code === void 0) { | ||
return newParts.join(""); | ||
} | ||
isNumber = !isNumber; | ||
} | ||
} | ||
function preserveAspectRatio(props) { | ||
let result = ""; | ||
switch (props.hAlign) { | ||
case "left": | ||
result += "xMin"; | ||
break; | ||
case "right": | ||
result += "xMax"; | ||
break; | ||
default: | ||
result += "xMid"; | ||
} | ||
switch (props.vAlign) { | ||
case "top": | ||
result += "YMin"; | ||
break; | ||
case "bottom": | ||
result += "YMax"; | ||
break; | ||
default: | ||
result += "YMid"; | ||
} | ||
result += props.slice ? " slice" : " meet"; | ||
return result; | ||
} | ||
function iconToSVG(icon, customisations) { | ||
const box = { | ||
left: icon.left, | ||
top: icon.top, | ||
width: icon.width, | ||
height: icon.height | ||
}; | ||
let body = icon.body; | ||
[icon, customisations].forEach((props) => { | ||
const transformations = []; | ||
const hFlip = props.hFlip; | ||
const vFlip = props.vFlip; | ||
let rotation = props.rotate; | ||
if (hFlip) { | ||
if (vFlip) { | ||
rotation += 2; | ||
} else { | ||
transformations.push("translate(" + (box.width + box.left) + " " + (0 - box.top) + ")"); | ||
transformations.push("scale(-1 1)"); | ||
box.top = box.left = 0; | ||
} | ||
} else if (vFlip) { | ||
transformations.push("translate(" + (0 - box.left) + " " + (box.height + box.top) + ")"); | ||
transformations.push("scale(1 -1)"); | ||
box.top = box.left = 0; | ||
} | ||
let tempValue; | ||
if (rotation < 0) { | ||
rotation -= Math.floor(rotation / 4) * 4; | ||
} | ||
rotation = rotation % 4; | ||
switch (rotation) { | ||
case 1: | ||
tempValue = box.height / 2 + box.top; | ||
transformations.unshift("rotate(90 " + tempValue + " " + tempValue + ")"); | ||
break; | ||
case 2: | ||
transformations.unshift("rotate(180 " + (box.width / 2 + box.left) + " " + (box.height / 2 + box.top) + ")"); | ||
break; | ||
case 3: | ||
tempValue = box.width / 2 + box.left; | ||
transformations.unshift("rotate(-90 " + tempValue + " " + tempValue + ")"); | ||
break; | ||
} | ||
if (rotation % 2 === 1) { | ||
if (box.left !== 0 || box.top !== 0) { | ||
tempValue = box.left; | ||
box.left = box.top; | ||
box.top = tempValue; | ||
} | ||
if (box.width !== box.height) { | ||
tempValue = box.width; | ||
box.width = box.height; | ||
box.height = tempValue; | ||
} | ||
} | ||
if (transformations.length) { | ||
body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>"; | ||
} | ||
}); | ||
let width, height; | ||
if (customisations.width === null && customisations.height === null) { | ||
height = "1em"; | ||
width = calculateSize(height, box.width / box.height); | ||
} else if (customisations.width !== null && customisations.height !== null) { | ||
width = customisations.width; | ||
height = customisations.height; | ||
} else if (customisations.height !== null) { | ||
height = customisations.height; | ||
width = calculateSize(height, box.width / box.height); | ||
} else { | ||
width = customisations.width; | ||
height = calculateSize(width, box.height / box.width); | ||
} | ||
if (width === "auto") { | ||
width = box.width; | ||
} | ||
if (height === "auto") { | ||
height = box.height; | ||
} | ||
width = typeof width === "string" ? width : width + ""; | ||
height = typeof height === "string" ? height : height + ""; | ||
const result = { | ||
attributes: { | ||
width, | ||
height, | ||
preserveAspectRatio: preserveAspectRatio(customisations), | ||
viewBox: box.left + " " + box.top + " " + box.width + " " + box.height | ||
}, | ||
body | ||
}; | ||
if (customisations.inline) { | ||
result.inline = true; | ||
} | ||
return result; | ||
} | ||
var regex = /\sid="(\S+)"/g; | ||
var randomPrefix = "IconifyId-" + Date.now().toString(16) + "-" + (Math.random() * 16777216 | 0).toString(16) + "-"; | ||
var counter = 0; | ||
function replaceIDs(body, prefix = randomPrefix) { | ||
const ids = []; | ||
let match; | ||
while (match = regex.exec(body)) { | ||
ids.push(match[1]); | ||
} | ||
if (!ids.length) { | ||
return body; | ||
} | ||
ids.forEach((id) => { | ||
const newID = typeof prefix === "function" ? prefix(id) : prefix + counter++; | ||
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + "$3"); | ||
}); | ||
return body; | ||
} | ||
var storage = Object.create(null); | ||
function setAPIModule(provider, item) { | ||
storage[provider] = item; | ||
} | ||
function getAPIModule(provider) { | ||
return storage[provider] || storage[""]; | ||
} | ||
function createAPIConfig(source) { | ||
let resources; | ||
if (typeof source.resources === "string") { | ||
resources = [source.resources]; | ||
} else { | ||
resources = source.resources; | ||
if (!(resources instanceof Array) || !resources.length) { | ||
return null; | ||
} | ||
} | ||
const result = { | ||
resources, | ||
path: source.path === void 0 ? "/" : source.path, | ||
maxURL: source.maxURL ? source.maxURL : 500, | ||
rotate: source.rotate ? source.rotate : 750, | ||
timeout: source.timeout ? source.timeout : 5e3, | ||
random: source.random === true, | ||
index: source.index ? source.index : 0, | ||
dataAfterTimeout: source.dataAfterTimeout !== false | ||
}; | ||
return result; | ||
} | ||
var configStorage = Object.create(null); | ||
var fallBackAPISources = [ | ||
"https://api.simplesvg.com", | ||
"https://api.unisvg.com" | ||
]; | ||
var fallBackAPI = []; | ||
while (fallBackAPISources.length > 0) { | ||
if (fallBackAPISources.length === 1) { | ||
fallBackAPI.push(fallBackAPISources.shift()); | ||
} else { | ||
if (Math.random() > 0.5) { | ||
fallBackAPI.push(fallBackAPISources.shift()); | ||
} else { | ||
fallBackAPI.push(fallBackAPISources.pop()); | ||
} | ||
} | ||
} | ||
configStorage[""] = createAPIConfig({ | ||
resources: ["https://api.iconify.design"].concat(fallBackAPI) | ||
}); | ||
function addAPIProvider(provider, customConfig) { | ||
const config2 = createAPIConfig(customConfig); | ||
if (config2 === null) { | ||
return false; | ||
} | ||
configStorage[provider] = config2; | ||
return true; | ||
} | ||
function getAPIConfig(provider) { | ||
return configStorage[provider]; | ||
} | ||
var mergeParams = (base, params) => { | ||
let result = base, hasParams = result.indexOf("?") !== -1; | ||
function paramToString(value) { | ||
switch (typeof value) { | ||
case "boolean": | ||
return value ? "true" : "false"; | ||
case "number": | ||
return encodeURIComponent(value); | ||
case "string": | ||
return encodeURIComponent(value); | ||
default: | ||
throw new Error("Invalid parameter"); | ||
} | ||
} | ||
Object.keys(params).forEach((key) => { | ||
let value; | ||
try { | ||
value = paramToString(params[key]); | ||
} catch (err) { | ||
return; | ||
} | ||
result += (hasParams ? "&" : "?") + encodeURIComponent(key) + "=" + value; | ||
hasParams = true; | ||
}); | ||
return result; | ||
}; | ||
var maxLengthCache = Object.create(null); | ||
var pathCache = Object.create(null); | ||
var detectFetch = () => { | ||
let callback; | ||
try { | ||
callback = fetch; | ||
if (typeof callback === "function") { | ||
return callback; | ||
} | ||
} catch (err) { | ||
} | ||
try { | ||
const chunk = String.fromCharCode(114) + String.fromCharCode(101); | ||
const req = global[chunk + "qui" + chunk]; | ||
callback = req("cross-fetch"); | ||
if (typeof callback === "function") { | ||
return callback; | ||
} | ||
} catch (err) { | ||
} | ||
return null; | ||
}; | ||
var fetchModule = detectFetch(); | ||
function calculateMaxLength(provider, prefix) { | ||
const config2 = getAPIConfig(provider); | ||
if (!config2) { | ||
return 0; | ||
} | ||
let result; | ||
if (!config2.maxURL) { | ||
result = 0; | ||
} else { | ||
let maxHostLength = 0; | ||
config2.resources.forEach((item) => { | ||
const host = item; | ||
maxHostLength = Math.max(maxHostLength, host.length); | ||
}); | ||
const url = mergeParams(prefix + ".json", { | ||
icons: "" | ||
}); | ||
result = config2.maxURL - maxHostLength - config2.path.length - url.length; | ||
} | ||
const cacheKey = provider + ":" + prefix; | ||
pathCache[provider] = config2.path; | ||
maxLengthCache[cacheKey] = result; | ||
return result; | ||
} | ||
var prepare = (provider, prefix, icons) => { | ||
const results = []; | ||
let maxLength = maxLengthCache[prefix]; | ||
if (maxLength === void 0) { | ||
maxLength = calculateMaxLength(provider, prefix); | ||
} | ||
const type = "icons"; | ||
let item = { | ||
type, | ||
provider, | ||
prefix, | ||
icons: [] | ||
}; | ||
let length = 0; | ||
icons.forEach((name, index) => { | ||
length += name.length + 1; | ||
if (length >= maxLength && index > 0) { | ||
results.push(item); | ||
item = { | ||
type, | ||
provider, | ||
prefix, | ||
icons: [] | ||
}; | ||
length = name.length; | ||
} | ||
item.icons.push(name); | ||
}); | ||
results.push(item); | ||
return results; | ||
}; | ||
function getPath(provider) { | ||
if (typeof provider === "string") { | ||
if (pathCache[provider] === void 0) { | ||
const config2 = getAPIConfig(provider); | ||
if (!config2) { | ||
return "/"; | ||
} | ||
pathCache[provider] = config2.path; | ||
} | ||
return pathCache[provider]; | ||
} | ||
return "/"; | ||
} | ||
var send = (host, params, status) => { | ||
if (!fetchModule) { | ||
status.done(void 0, 424); | ||
return; | ||
} | ||
let path = getPath(params.provider); | ||
switch (params.type) { | ||
case "icons": { | ||
const prefix = params.prefix; | ||
const icons = params.icons; | ||
const iconsList = icons.join(","); | ||
path += mergeParams(prefix + ".json", { | ||
icons: iconsList | ||
}); | ||
break; | ||
} | ||
case "custom": { | ||
const uri = params.uri; | ||
path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri; | ||
break; | ||
} | ||
default: | ||
status.done(void 0, 400); | ||
return; | ||
} | ||
let defaultError = 503; | ||
fetchModule(host + path).then((response) => { | ||
if (response.status !== 200) { | ||
setTimeout(() => { | ||
status.done(void 0, response.status); | ||
}); | ||
return; | ||
} | ||
defaultError = 501; | ||
return response.json(); | ||
}).then((data) => { | ||
if (typeof data !== "object" || data === null) { | ||
setTimeout(() => { | ||
status.done(void 0, defaultError); | ||
}); | ||
return; | ||
} | ||
setTimeout(() => { | ||
status.done(data); | ||
}); | ||
}).catch(() => { | ||
status.done(void 0, defaultError); | ||
}); | ||
}; | ||
var fetchAPIModule = { | ||
prepare, | ||
send | ||
}; | ||
function sortIcons(icons) { | ||
const result = { | ||
loaded: [], | ||
missing: [], | ||
pending: [] | ||
}; | ||
const storage2 = Object.create(null); | ||
icons.sort((a, b) => { | ||
if (a.provider !== b.provider) { | ||
return a.provider.localeCompare(b.provider); | ||
} | ||
if (a.prefix !== b.prefix) { | ||
return a.prefix.localeCompare(b.prefix); | ||
} | ||
return a.name.localeCompare(b.name); | ||
}); | ||
let lastIcon = { | ||
provider: "", | ||
prefix: "", | ||
name: "" | ||
}; | ||
icons.forEach((icon) => { | ||
if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) { | ||
return; | ||
} | ||
lastIcon = icon; | ||
const provider = icon.provider; | ||
const prefix = icon.prefix; | ||
const name = icon.name; | ||
if (storage2[provider] === void 0) { | ||
storage2[provider] = Object.create(null); | ||
} | ||
const providerStorage = storage2[provider]; | ||
if (providerStorage[prefix] === void 0) { | ||
providerStorage[prefix] = getStorage(provider, prefix); | ||
} | ||
const localStorage = providerStorage[prefix]; | ||
let list; | ||
if (localStorage.icons[name] !== void 0) { | ||
list = result.loaded; | ||
} else if (prefix === "" || localStorage.missing[name] !== void 0) { | ||
list = result.missing; | ||
} else { | ||
list = result.pending; | ||
} | ||
const item = { | ||
provider, | ||
prefix, | ||
name | ||
}; | ||
list.push(item); | ||
}); | ||
return result; | ||
} | ||
var callbacks = Object.create(null); | ||
var pendingUpdates = Object.create(null); | ||
function removeCallback(sources, id) { | ||
sources.forEach((source) => { | ||
const provider = source.provider; | ||
if (callbacks[provider] === void 0) { | ||
return; | ||
} | ||
const providerCallbacks = callbacks[provider]; | ||
const prefix = source.prefix; | ||
const items = providerCallbacks[prefix]; | ||
if (items) { | ||
providerCallbacks[prefix] = items.filter((row) => row.id !== id); | ||
} | ||
}); | ||
} | ||
function updateCallbacks(provider, prefix) { | ||
if (pendingUpdates[provider] === void 0) { | ||
pendingUpdates[provider] = Object.create(null); | ||
} | ||
const providerPendingUpdates = pendingUpdates[provider]; | ||
if (!providerPendingUpdates[prefix]) { | ||
providerPendingUpdates[prefix] = true; | ||
setTimeout(() => { | ||
providerPendingUpdates[prefix] = false; | ||
if (callbacks[provider] === void 0 || callbacks[provider][prefix] === void 0) { | ||
return; | ||
} | ||
const items = callbacks[provider][prefix].slice(0); | ||
if (!items.length) { | ||
return; | ||
} | ||
const storage2 = getStorage(provider, prefix); | ||
let hasPending = false; | ||
items.forEach((item) => { | ||
const icons = item.icons; | ||
const oldLength = icons.pending.length; | ||
icons.pending = icons.pending.filter((icon) => { | ||
if (icon.prefix !== prefix) { | ||
return true; | ||
} | ||
const name = icon.name; | ||
if (storage2.icons[name] !== void 0) { | ||
icons.loaded.push({ | ||
provider, | ||
prefix, | ||
name | ||
}); | ||
} else if (storage2.missing[name] !== void 0) { | ||
icons.missing.push({ | ||
provider, | ||
prefix, | ||
name | ||
}); | ||
} else { | ||
hasPending = true; | ||
return true; | ||
} | ||
return false; | ||
}); | ||
if (icons.pending.length !== oldLength) { | ||
if (!hasPending) { | ||
removeCallback([ | ||
{ | ||
provider, | ||
prefix | ||
} | ||
], item.id); | ||
} | ||
item.callback(icons.loaded.slice(0), icons.missing.slice(0), icons.pending.slice(0), item.abort); | ||
} | ||
}); | ||
}); | ||
} | ||
} | ||
var idCounter = 0; | ||
function storeCallback(callback, icons, pendingSources) { | ||
const id = idCounter++; | ||
const abort = removeCallback.bind(null, pendingSources, id); | ||
if (!icons.pending.length) { | ||
return abort; | ||
} | ||
const item = { | ||
id, | ||
icons, | ||
callback, | ||
abort | ||
}; | ||
pendingSources.forEach((source) => { | ||
const provider = source.provider; | ||
const prefix = source.prefix; | ||
if (callbacks[provider] === void 0) { | ||
callbacks[provider] = Object.create(null); | ||
} | ||
const providerCallbacks = callbacks[provider]; | ||
if (providerCallbacks[prefix] === void 0) { | ||
providerCallbacks[prefix] = []; | ||
} | ||
providerCallbacks[prefix].push(item); | ||
}); | ||
return abort; | ||
} | ||
function listToIcons(list, validate2 = true, simpleNames2 = false) { | ||
const result = []; | ||
list.forEach((item) => { | ||
const icon = typeof item === "string" ? stringToIcon(item, false, simpleNames2) : item; | ||
if (!validate2 || validateIcon(icon, simpleNames2)) { | ||
result.push({ | ||
provider: icon.provider, | ||
prefix: icon.prefix, | ||
name: icon.name | ||
}); | ||
} | ||
}); | ||
return result; | ||
} | ||
var defaultConfig = { | ||
resources: [], | ||
index: 0, | ||
timeout: 2e3, | ||
rotate: 750, | ||
random: false, | ||
dataAfterTimeout: false | ||
}; | ||
function sendQuery(config2, payload, query, done, success2) { | ||
const resourcesCount = config2.resources.length; | ||
const startIndex = config2.random ? Math.floor(Math.random() * resourcesCount) : config2.index; | ||
let resources; | ||
if (config2.random) { | ||
let list = config2.resources.slice(0); | ||
resources = []; | ||
while (list.length > 1) { | ||
const nextIndex = Math.floor(Math.random() * list.length); | ||
resources.push(list[nextIndex]); | ||
list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1)); | ||
} | ||
resources = resources.concat(list); | ||
} else { | ||
resources = config2.resources.slice(startIndex).concat(config2.resources.slice(0, startIndex)); | ||
} | ||
const startTime = Date.now(); | ||
let status = "pending"; | ||
let queriesSent = 0; | ||
let lastError = void 0; | ||
let timer = null; | ||
let queue = []; | ||
let doneCallbacks = []; | ||
if (typeof done === "function") { | ||
doneCallbacks.push(done); | ||
} | ||
function resetTimer() { | ||
if (timer) { | ||
clearTimeout(timer); | ||
timer = null; | ||
} | ||
} | ||
function abort() { | ||
if (status === "pending") { | ||
status = "aborted"; | ||
} | ||
resetTimer(); | ||
queue.forEach((item) => { | ||
if (item.abort) { | ||
item.abort(); | ||
} | ||
if (item.status === "pending") { | ||
item.status = "aborted"; | ||
} | ||
}); | ||
queue = []; | ||
} | ||
function subscribe(callback, overwrite) { | ||
if (overwrite) { | ||
doneCallbacks = []; | ||
} | ||
if (typeof callback === "function") { | ||
doneCallbacks.push(callback); | ||
} | ||
} | ||
function getQueryStatus() { | ||
return { | ||
startTime, | ||
payload, | ||
status, | ||
queriesSent, | ||
queriesPending: queue.length, | ||
subscribe, | ||
abort | ||
}; | ||
} | ||
function failQuery() { | ||
status = "failed"; | ||
doneCallbacks.forEach((callback) => { | ||
callback(void 0, lastError); | ||
}); | ||
} | ||
function clearQueue() { | ||
queue = queue.filter((item) => { | ||
if (item.status === "pending") { | ||
item.status = "aborted"; | ||
} | ||
if (item.abort) { | ||
item.abort(); | ||
} | ||
return false; | ||
}); | ||
} | ||
function moduleResponse(item, data, error2) { | ||
const isError = data === void 0; | ||
queue = queue.filter((queued) => queued !== item); | ||
switch (status) { | ||
case "pending": | ||
break; | ||
case "failed": | ||
if (isError || !config2.dataAfterTimeout) { | ||
return; | ||
} | ||
break; | ||
default: | ||
return; | ||
} | ||
if (isError) { | ||
if (error2 !== void 0) { | ||
lastError = error2; | ||
} | ||
if (!queue.length) { | ||
if (!resources.length) { | ||
failQuery(); | ||
} else { | ||
execNext(); | ||
} | ||
} | ||
return; | ||
} | ||
resetTimer(); | ||
clearQueue(); | ||
if (success2 && !config2.random) { | ||
const index = config2.resources.indexOf(item.resource); | ||
if (index !== -1 && index !== config2.index) { | ||
success2(index); | ||
} | ||
} | ||
status = "completed"; | ||
doneCallbacks.forEach((callback) => { | ||
callback(data); | ||
}); | ||
} | ||
function execNext() { | ||
if (status !== "pending") { | ||
return; | ||
} | ||
resetTimer(); | ||
const resource = resources.shift(); | ||
if (resource === void 0) { | ||
if (queue.length) { | ||
const timeout2 = typeof config2.timeout === "function" ? config2.timeout(startTime) : config2.timeout; | ||
if (timeout2) { | ||
timer = setTimeout(() => { | ||
resetTimer(); | ||
if (status === "pending") { | ||
clearQueue(); | ||
failQuery(); | ||
} | ||
}, timeout2); | ||
return; | ||
} | ||
} | ||
failQuery(); | ||
return; | ||
} | ||
const item = { | ||
getQueryStatus, | ||
status: "pending", | ||
resource, | ||
done: (data, error2) => { | ||
moduleResponse(item, data, error2); | ||
} | ||
}; | ||
queue.push(item); | ||
queriesSent++; | ||
const timeout = typeof config2.rotate === "function" ? config2.rotate(queriesSent, startTime) : config2.rotate; | ||
timer = setTimeout(execNext, timeout); | ||
query(resource, payload, item); | ||
} | ||
setTimeout(execNext); | ||
return getQueryStatus; | ||
} | ||
function setConfig(config2) { | ||
if (typeof config2 !== "object" || typeof config2.resources !== "object" || !(config2.resources instanceof Array) || !config2.resources.length) { | ||
throw new Error("Invalid Reduncancy configuration"); | ||
} | ||
const newConfig = Object.create(null); | ||
let key; | ||
for (key in defaultConfig) { | ||
if (config2[key] !== void 0) { | ||
newConfig[key] = config2[key]; | ||
} else { | ||
newConfig[key] = defaultConfig[key]; | ||
} | ||
} | ||
return newConfig; | ||
} | ||
function initRedundancy(cfg) { | ||
const config2 = setConfig(cfg); | ||
let queries = []; | ||
function cleanup() { | ||
queries = queries.filter((item) => item().status === "pending"); | ||
} | ||
function query(payload, queryCallback, doneCallback) { | ||
const query2 = sendQuery(config2, payload, queryCallback, (data, error2) => { | ||
cleanup(); | ||
if (doneCallback) { | ||
doneCallback(data, error2); | ||
} | ||
}, (newIndex) => { | ||
config2.index = newIndex; | ||
}); | ||
queries.push(query2); | ||
return query2; | ||
} | ||
function find(callback) { | ||
const result = queries.find((value) => { | ||
return callback(value); | ||
}); | ||
return result !== void 0 ? result : null; | ||
} | ||
const instance = { | ||
query, | ||
find, | ||
setIndex: (index) => { | ||
config2.index = index; | ||
}, | ||
getIndex: () => config2.index, | ||
cleanup | ||
}; | ||
return instance; | ||
} | ||
function emptyCallback$1() { | ||
} | ||
var redundancyCache = Object.create(null); | ||
function getRedundancyCache(provider) { | ||
if (redundancyCache[provider] === void 0) { | ||
const config2 = getAPIConfig(provider); | ||
if (!config2) { | ||
return; | ||
} | ||
const redundancy = initRedundancy(config2); | ||
const cachedReundancy = { | ||
config: config2, | ||
redundancy | ||
}; | ||
redundancyCache[provider] = cachedReundancy; | ||
} | ||
return redundancyCache[provider]; | ||
} | ||
function sendAPIQuery(target, query, callback) { | ||
let redundancy; | ||
let send2; | ||
if (typeof target === "string") { | ||
const api = getAPIModule(target); | ||
if (!api) { | ||
callback(void 0, 424); | ||
return emptyCallback$1; | ||
} | ||
send2 = api.send; | ||
const cached = getRedundancyCache(target); | ||
if (cached) { | ||
redundancy = cached.redundancy; | ||
} | ||
} else { | ||
const config2 = createAPIConfig(target); | ||
if (config2) { | ||
redundancy = initRedundancy(config2); | ||
const moduleKey = target.resources ? target.resources[0] : ""; | ||
const api = getAPIModule(moduleKey); | ||
if (api) { | ||
send2 = api.send; | ||
} | ||
} | ||
} | ||
if (!redundancy || !send2) { | ||
callback(void 0, 424); | ||
return emptyCallback$1; | ||
} | ||
return redundancy.query(query, send2, callback)().abort; | ||
} | ||
var cache = {}; | ||
function emptyCallback() { | ||
} | ||
var pendingIcons = Object.create(null); | ||
var iconsToLoad = Object.create(null); | ||
var loaderFlags = Object.create(null); | ||
var queueFlags = Object.create(null); | ||
function loadedNewIcons(provider, prefix) { | ||
if (loaderFlags[provider] === void 0) { | ||
loaderFlags[provider] = Object.create(null); | ||
} | ||
const providerLoaderFlags = loaderFlags[provider]; | ||
if (!providerLoaderFlags[prefix]) { | ||
providerLoaderFlags[prefix] = true; | ||
setTimeout(() => { | ||
providerLoaderFlags[prefix] = false; | ||
updateCallbacks(provider, prefix); | ||
}); | ||
} | ||
} | ||
var errorsCache = Object.create(null); | ||
function loadNewIcons(provider, prefix, icons) { | ||
function err() { | ||
const key = (provider === "" ? "" : "@" + provider + ":") + prefix; | ||
const time = Math.floor(Date.now() / 6e4); | ||
if (errorsCache[key] < time) { | ||
errorsCache[key] = time; | ||
console.error('Unable to retrieve icons for "' + key + '" because API is not configured properly.'); | ||
} | ||
} | ||
if (iconsToLoad[provider] === void 0) { | ||
iconsToLoad[provider] = Object.create(null); | ||
} | ||
const providerIconsToLoad = iconsToLoad[provider]; | ||
if (queueFlags[provider] === void 0) { | ||
queueFlags[provider] = Object.create(null); | ||
} | ||
const providerQueueFlags = queueFlags[provider]; | ||
if (pendingIcons[provider] === void 0) { | ||
pendingIcons[provider] = Object.create(null); | ||
} | ||
const providerPendingIcons = pendingIcons[provider]; | ||
if (providerIconsToLoad[prefix] === void 0) { | ||
providerIconsToLoad[prefix] = icons; | ||
} else { | ||
providerIconsToLoad[prefix] = providerIconsToLoad[prefix].concat(icons).sort(); | ||
} | ||
if (!providerQueueFlags[prefix]) { | ||
providerQueueFlags[prefix] = true; | ||
setTimeout(() => { | ||
providerQueueFlags[prefix] = false; | ||
const icons2 = providerIconsToLoad[prefix]; | ||
delete providerIconsToLoad[prefix]; | ||
const api = getAPIModule(provider); | ||
if (!api) { | ||
err(); | ||
return; | ||
} | ||
const params = api.prepare(provider, prefix, icons2); | ||
params.forEach((item) => { | ||
sendAPIQuery(provider, item, (data, error2) => { | ||
const storage2 = getStorage(provider, prefix); | ||
if (typeof data !== "object") { | ||
if (error2 !== 404) { | ||
return; | ||
} | ||
const t = Date.now(); | ||
item.icons.forEach((name) => { | ||
storage2.missing[name] = t; | ||
}); | ||
} else { | ||
try { | ||
const parsed = addIconSet(storage2, data); | ||
if (!parsed.length) { | ||
return; | ||
} | ||
const pending = providerPendingIcons[prefix]; | ||
parsed.forEach((name) => { | ||
delete pending[name]; | ||
}); | ||
if (cache.store) { | ||
cache.store(provider, data); | ||
} | ||
} catch (err2) { | ||
console.error(err2); | ||
} | ||
} | ||
loadedNewIcons(provider, prefix); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
var loadIcons = (icons, callback) => { | ||
const cleanedIcons = listToIcons(icons, true, allowSimpleNames()); | ||
const sortedIcons = sortIcons(cleanedIcons); | ||
if (!sortedIcons.pending.length) { | ||
let callCallback = true; | ||
if (callback) { | ||
setTimeout(() => { | ||
if (callCallback) { | ||
callback(sortedIcons.loaded, sortedIcons.missing, sortedIcons.pending, emptyCallback); | ||
} | ||
}); | ||
} | ||
return () => { | ||
callCallback = false; | ||
}; | ||
} | ||
const newIcons = Object.create(null); | ||
const sources = []; | ||
let lastProvider, lastPrefix; | ||
sortedIcons.pending.forEach((icon) => { | ||
const provider = icon.provider; | ||
const prefix = icon.prefix; | ||
if (prefix === lastPrefix && provider === lastProvider) { | ||
return; | ||
} | ||
lastProvider = provider; | ||
lastPrefix = prefix; | ||
sources.push({ | ||
provider, | ||
prefix | ||
}); | ||
if (pendingIcons[provider] === void 0) { | ||
pendingIcons[provider] = Object.create(null); | ||
} | ||
const providerPendingIcons = pendingIcons[provider]; | ||
if (providerPendingIcons[prefix] === void 0) { | ||
providerPendingIcons[prefix] = Object.create(null); | ||
} | ||
if (newIcons[provider] === void 0) { | ||
newIcons[provider] = Object.create(null); | ||
} | ||
const providerNewIcons = newIcons[provider]; | ||
if (providerNewIcons[prefix] === void 0) { | ||
providerNewIcons[prefix] = []; | ||
} | ||
}); | ||
const time = Date.now(); | ||
sortedIcons.pending.forEach((icon) => { | ||
const provider = icon.provider; | ||
const prefix = icon.prefix; | ||
const name = icon.name; | ||
const pendingQueue = pendingIcons[provider][prefix]; | ||
if (pendingQueue[name] === void 0) { | ||
pendingQueue[name] = time; | ||
newIcons[provider][prefix].push(name); | ||
} | ||
}); | ||
sources.forEach((source) => { | ||
const provider = source.provider; | ||
const prefix = source.prefix; | ||
if (newIcons[provider][prefix].length) { | ||
loadNewIcons(provider, prefix, newIcons[provider][prefix]); | ||
} | ||
}); | ||
return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback; | ||
}; | ||
var cacheVersion = "iconify2"; | ||
var cachePrefix = "iconify"; | ||
var countKey = cachePrefix + "-count"; | ||
var versionKey = cachePrefix + "-version"; | ||
var hour = 36e5; | ||
var cacheExpiration = 168; | ||
var config = { | ||
local: true, | ||
session: true | ||
}; | ||
var loaded = false; | ||
var count = { | ||
local: 0, | ||
session: 0 | ||
}; | ||
var emptyList = { | ||
local: [], | ||
session: [] | ||
}; | ||
var _window = typeof window === "undefined" ? {} : window; | ||
function getGlobal(key) { | ||
const attr = key + "Storage"; | ||
try { | ||
if (_window && _window[attr] && typeof _window[attr].length === "number") { | ||
return _window[attr]; | ||
} | ||
} catch (err) { | ||
} | ||
config[key] = false; | ||
return null; | ||
} | ||
function setCount(storage2, key, value) { | ||
try { | ||
storage2.setItem(countKey, value + ""); | ||
count[key] = value; | ||
return true; | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
function getCount(storage2) { | ||
const count2 = storage2.getItem(countKey); | ||
if (count2) { | ||
const total = parseInt(count2); | ||
return total ? total : 0; | ||
} | ||
return 0; | ||
} | ||
function initCache(storage2, key) { | ||
try { | ||
storage2.setItem(versionKey, cacheVersion); | ||
} catch (err) { | ||
} | ||
setCount(storage2, key, 0); | ||
} | ||
function destroyCache(storage2) { | ||
try { | ||
const total = getCount(storage2); | ||
for (let i = 0; i < total; i++) { | ||
storage2.removeItem(cachePrefix + i); | ||
} | ||
} catch (err) { | ||
} | ||
} | ||
var loadCache = () => { | ||
if (loaded) { | ||
return; | ||
} | ||
loaded = true; | ||
const minTime = Math.floor(Date.now() / hour) - cacheExpiration; | ||
function load(key) { | ||
const func = getGlobal(key); | ||
if (!func) { | ||
return; | ||
} | ||
const getItem = (index) => { | ||
const name = cachePrefix + index; | ||
const item = func.getItem(name); | ||
if (typeof item !== "string") { | ||
return false; | ||
} | ||
let valid = true; | ||
try { | ||
const data = JSON.parse(item); | ||
if (typeof data !== "object" || typeof data.cached !== "number" || data.cached < minTime || typeof data.provider !== "string" || typeof data.data !== "object" || typeof data.data.prefix !== "string") { | ||
valid = false; | ||
} else { | ||
const provider = data.provider; | ||
const prefix = data.data.prefix; | ||
const storage2 = getStorage(provider, prefix); | ||
valid = addIconSet(storage2, data.data).length > 0; | ||
} | ||
} catch (err) { | ||
valid = false; | ||
} | ||
if (!valid) { | ||
func.removeItem(name); | ||
} | ||
return valid; | ||
}; | ||
try { | ||
const version = func.getItem(versionKey); | ||
if (version !== cacheVersion) { | ||
if (version) { | ||
destroyCache(func); | ||
} | ||
initCache(func, key); | ||
return; | ||
} | ||
let total = getCount(func); | ||
for (let i = total - 1; i >= 0; i--) { | ||
if (!getItem(i)) { | ||
if (i === total - 1) { | ||
total--; | ||
} else { | ||
emptyList[key].push(i); | ||
} | ||
} | ||
} | ||
setCount(func, key, total); | ||
} catch (err) { | ||
} | ||
} | ||
for (const key in config) { | ||
load(key); | ||
} | ||
}; | ||
var storeCache = (provider, data) => { | ||
if (!loaded) { | ||
loadCache(); | ||
} | ||
function store(key) { | ||
if (!config[key]) { | ||
return false; | ||
} | ||
const func = getGlobal(key); | ||
if (!func) { | ||
return false; | ||
} | ||
let index = emptyList[key].shift(); | ||
if (index === void 0) { | ||
index = count[key]; | ||
if (!setCount(func, key, index + 1)) { | ||
return false; | ||
} | ||
} | ||
try { | ||
const item = { | ||
cached: Math.floor(Date.now() / hour), | ||
provider, | ||
data | ||
}; | ||
func.setItem(cachePrefix + index, JSON.stringify(item)); | ||
} catch (err) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
if (!store("local")) { | ||
store("session"); | ||
} | ||
}; | ||
var separator = /[\s,]+/; | ||
function flipFromString(custom, flip) { | ||
flip.split(separator).forEach((str) => { | ||
const value = str.trim(); | ||
switch (value) { | ||
case "horizontal": | ||
custom.hFlip = true; | ||
break; | ||
case "vertical": | ||
custom.vFlip = true; | ||
break; | ||
} | ||
}); | ||
} | ||
function alignmentFromString(custom, align) { | ||
align.split(separator).forEach((str) => { | ||
const value = str.trim(); | ||
switch (value) { | ||
case "left": | ||
case "center": | ||
case "right": | ||
custom.hAlign = value; | ||
break; | ||
case "top": | ||
case "middle": | ||
case "bottom": | ||
custom.vAlign = value; | ||
break; | ||
case "slice": | ||
case "crop": | ||
custom.slice = true; | ||
break; | ||
case "meet": | ||
custom.slice = false; | ||
} | ||
}); | ||
} | ||
function rotateFromString(value, defaultValue = 0) { | ||
const units = value.replace(/^-?[0-9.]*/, ""); | ||
function cleanup(value2) { | ||
while (value2 < 0) { | ||
value2 += 4; | ||
} | ||
return value2 % 4; | ||
} | ||
if (units === "") { | ||
const num = parseInt(value); | ||
return isNaN(num) ? 0 : cleanup(num); | ||
} else if (units !== value) { | ||
let split = 0; | ||
switch (units) { | ||
case "%": | ||
split = 25; | ||
break; | ||
case "deg": | ||
split = 90; | ||
} | ||
if (split) { | ||
let num = parseFloat(value.slice(0, value.length - units.length)); | ||
if (isNaN(num)) { | ||
return 0; | ||
} | ||
num = num / split; | ||
return num % 1 === 0 ? cleanup(num) : 0; | ||
} | ||
} | ||
return defaultValue; | ||
} | ||
const svgDefaults = { | ||
"xmlns": "http://www.w3.org/2000/svg", | ||
"xmlns:xlink": "http://www.w3.org/1999/xlink", | ||
"aria-hidden": true, | ||
"role": "img" | ||
}; | ||
let customisationAliases = {}; | ||
["horizontal", "vertical"].forEach((prefix) => { | ||
["Align", "Flip"].forEach((suffix) => { | ||
const attr = prefix.slice(0, 1) + suffix; | ||
const value = { | ||
attr, | ||
boolean: suffix === "Flip" | ||
}; | ||
customisationAliases[prefix + "-" + suffix.toLowerCase()] = value; | ||
customisationAliases[prefix.slice(0, 1) + "-" + suffix.toLowerCase()] = value; | ||
customisationAliases[prefix + suffix] = value; | ||
}); | ||
}); | ||
const render = (icon, props) => { | ||
const customisations = mergeCustomisations(defaults, props); | ||
const componentProps = __spreadValues({}, svgDefaults); | ||
let style = typeof props.style === "object" && !(props.style instanceof Array) ? __spreadValues({}, props.style) : {}; | ||
for (let key in props) { | ||
const value = props[key]; | ||
if (value === void 0) { | ||
continue; | ||
} | ||
switch (key) { | ||
case "icon": | ||
case "style": | ||
case "onLoad": | ||
break; | ||
case "inline": | ||
case "hFlip": | ||
case "vFlip": | ||
customisations[key] = value === true || value === "true" || value === 1; | ||
break; | ||
case "flip": | ||
if (typeof value === "string") { | ||
flipFromString(customisations, value); | ||
} | ||
break; | ||
case "align": | ||
if (typeof value === "string") { | ||
alignmentFromString(customisations, value); | ||
} | ||
break; | ||
case "color": | ||
style.color = value; | ||
break; | ||
case "rotate": | ||
if (typeof value === "string") { | ||
customisations[key] = rotateFromString(value); | ||
} else if (typeof value === "number") { | ||
customisations[key] = value; | ||
} | ||
break; | ||
case "ariaHidden": | ||
case "aria-hidden": | ||
if (value !== true && value !== "true") { | ||
delete componentProps["aria-hidden"]; | ||
} | ||
break; | ||
default: | ||
if (customisationAliases[key] !== void 0) { | ||
if (customisationAliases[key].boolean && (value === true || value === "true" || value === 1)) { | ||
customisations[customisationAliases[key].attr] = true; | ||
} else if (!customisationAliases[key].boolean && typeof value === "string" && value !== "") { | ||
customisations[customisationAliases[key].attr] = value; | ||
} | ||
} else if (defaults[key] === void 0) { | ||
componentProps[key] = value; | ||
} | ||
} | ||
} | ||
const item = iconToSVG(icon, customisations); | ||
for (let key in item.attributes) { | ||
componentProps[key] = item.attributes[key]; | ||
} | ||
if (item.inline && style.verticalAlign === void 0 && style["vertical-align"] === void 0) { | ||
style.verticalAlign = "-0.125em"; | ||
} | ||
let localCounter = 0; | ||
const id = props.id; | ||
componentProps["innerHTML"] = replaceIDs(item.body, id ? () => id + "-" + localCounter++ : "iconify-vue-"); | ||
if (Object.keys(style).length > 0) { | ||
componentProps["style"] = style; | ||
} | ||
return h("svg", componentProps); | ||
}; | ||
allowSimpleNames(true); | ||
setAPIModule("", fetchAPIModule); | ||
if (typeof document !== "undefined" && typeof window !== "undefined") { | ||
cache.store = storeCache; | ||
loadCache(); | ||
const _window2 = window; | ||
if (_window2.IconifyPreload !== void 0) { | ||
const preload = _window2.IconifyPreload; | ||
const err = "Invalid IconifyPreload syntax."; | ||
if (typeof preload === "object" && preload !== null) { | ||
(preload instanceof Array ? preload : [preload]).forEach((item) => { | ||
try { | ||
if (typeof item !== "object" || item === null || item instanceof Array || typeof item.icons !== "object" || typeof item.prefix !== "string" || !addCollection(item)) { | ||
console.error(err); | ||
} | ||
} catch (e) { | ||
console.error(err); | ||
} | ||
}); | ||
} | ||
} | ||
if (_window2.IconifyProviders !== void 0) { | ||
const providers = _window2.IconifyProviders; | ||
if (typeof providers === "object" && providers !== null) { | ||
for (let key in providers) { | ||
const err = "IconifyProviders[" + key + "] is invalid."; | ||
try { | ||
const value = providers[key]; | ||
if (typeof value !== "object" || !value || value.resources === void 0) { | ||
continue; | ||
} | ||
if (!addAPIProvider(key, value)) { | ||
console.error(err); | ||
} | ||
} catch (e) { | ||
console.error(err); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
const Icon = defineComponent({ | ||
inheritAttrs: false, | ||
data() { | ||
return { | ||
mounted: false, | ||
counter: 0 | ||
}; | ||
}, | ||
beforeMount() { | ||
this._name = ""; | ||
this._loadingIcon = null; | ||
this.mounted = true; | ||
}, | ||
unmounted() { | ||
this.abortLoading(); | ||
}, | ||
methods: { | ||
abortLoading() { | ||
if (this._loadingIcon) { | ||
this._loadingIcon.abort(); | ||
this._loadingIcon = null; | ||
} | ||
}, | ||
getIcon(icon, onload) { | ||
if (typeof icon === "object" && icon !== null && typeof icon.body === "string") { | ||
this._name = ""; | ||
this.abortLoading(); | ||
return { | ||
data: fullIcon(icon) | ||
}; | ||
} | ||
let iconName; | ||
if (typeof icon !== "string" || (iconName = stringToIcon(icon, false, true)) === null) { | ||
this.abortLoading(); | ||
return null; | ||
} | ||
const data = getIconData(iconName); | ||
if (data === null) { | ||
if (!this._loadingIcon || this._loadingIcon.name !== icon) { | ||
this.abortLoading(); | ||
this._name = ""; | ||
this._loadingIcon = { | ||
name: icon, | ||
abort: loadIcons([iconName], () => { | ||
this.counter++; | ||
}) | ||
}; | ||
} | ||
return null; | ||
} | ||
this.abortLoading(); | ||
if (this._name !== icon) { | ||
this._name = icon; | ||
if (onload) { | ||
onload(icon); | ||
} | ||
} | ||
const classes = ["iconify"]; | ||
if (iconName.prefix !== "") { | ||
classes.push("iconify--" + iconName.prefix); | ||
} | ||
if (iconName.provider !== "") { | ||
classes.push("iconify--" + iconName.provider); | ||
} | ||
return { data, classes }; | ||
} | ||
}, | ||
render() { | ||
if (!this.mounted) { | ||
return this.$slots.default ? this.$slots.default() : null; | ||
} | ||
this.counter; | ||
const props = this.$attrs; | ||
const icon = this.getIcon(props.icon, props.onLoad); | ||
if (!icon) { | ||
return this.$slots.default ? this.$slots.default() : null; | ||
} | ||
let newProps = props; | ||
if (icon.classes) { | ||
newProps = __spreadProps(__spreadValues({}, props), { | ||
class: (typeof props["class"] === "string" ? props["class"] + " " : "") + icon.classes.join(" ") | ||
}); | ||
} | ||
return render(icon.data, newProps); | ||
} | ||
}); | ||
var _export_sfc = (sfc, props) => { | ||
@@ -141,3 +2120,3 @@ for (const [key, val] of props) { | ||
} | ||
function install$1(app) { | ||
function install$3(app) { | ||
app.config.globalProperties.$notif = reactive({ | ||
@@ -235,5 +2214,28 @@ list: notifications, | ||
} | ||
function install(app) { | ||
function install$2(app) { | ||
app.component("Pf_Dialog", Dialog); | ||
} | ||
export { install as ModalPlugin, install$1 as NotificationsPlugin, useModal }; | ||
const mediaQueryLists = [ | ||
{ breakpoint: "sm", mediaQueryList: window.matchMedia("(min-width: 640px)") }, | ||
{ breakpoint: "md", mediaQueryList: window.matchMedia("(min-width: 768px)") }, | ||
{ breakpoint: "lg", mediaQueryList: window.matchMedia("(min-width: 1024px)") }, | ||
{ breakpoint: "xl", mediaQueryList: window.matchMedia("(min-width: 1280px)") }, | ||
{ breakpoint: "2xl", mediaQueryList: window.matchMedia("(min-width: 1536px)") } | ||
]; | ||
const breakpoints = reactive({}); | ||
mediaQueryLists.forEach(({ breakpoint, mediaQueryList }) => { | ||
function onMediaQueryListChange(evt) { | ||
breakpoints[breakpoint] = evt.matches; | ||
} | ||
mediaQueryList.addListener(onMediaQueryListChange); | ||
breakpoints[breakpoint] = mediaQueryList.matches; | ||
}); | ||
function install$1(app) { | ||
app.config.globalProperties.$responsive = reactive({ | ||
breakpoints | ||
}); | ||
} | ||
function install(app) { | ||
app.component(Icon); | ||
} | ||
export { install as IconPlugin, install$2 as ModalPlugin, install$3 as NotificationsPlugin, install$1 as ResponsivePlugin, useModal }; |
@@ -1,1 +0,1 @@ | ||
var K=Object.defineProperty,Q=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var b=(n,e,l)=>e in n?K(n,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[e]=l,g=(n,e)=>{for(var l in e||(e={}))Y.call(e,l)&&b(n,l,e[l]);if(w)for(var l of w(e))Z.call(e,l)&&b(n,l,e[l]);return n},x=(n,e)=>Q(n,W(e));(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("@iconify/vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","@iconify/vue","vue-router"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.PurplefoxTools={},n.Vue,n.vue,n.vueRouter))})(this,function(n,e,l,h){"use strict";var m,V=new Uint8Array(16);function N(){if(!m&&(m=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!m))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(V)}var k=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function E(t){return typeof t=="string"&&k.test(t)}for(var i=[],y=0;y<256;++y)i.push((y+256).toString(16).substr(1));function C(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(i[t[o+0]]+i[t[o+1]]+i[t[o+2]]+i[t[o+3]]+"-"+i[t[o+4]]+i[t[o+5]]+"-"+i[t[o+6]]+i[t[o+7]]+"-"+i[t[o+8]]+i[t[o+9]]+"-"+i[t[o+10]]+i[t[o+11]]+i[t[o+12]]+i[t[o+13]]+i[t[o+14]]+i[t[o+15]]).toLowerCase();if(!E(r))throw TypeError("Stringified UUID is invalid");return r}function v(t,o,r){t=t||{};var s=t.random||(t.rng||N)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,o){r=r||0;for(var c=0;c<16;++c)o[r+c]=s[c];return o}return C(s)}var _=(t,o)=>{for(const[r,s]of o)t[r]=s;return t};const T={components:{Icon:l.Icon},setup(){return{icons:{error:"mdi:alert",warning:"mdi:alert-circle",info:"mdi:information",success:"mdi:check-bold"},colors:{error:"text-red",warning:"text-orange",info:"text-purple",success:"text-green"}}}},S={class:"ml-4 leading-tight"};function I(t,o,r,s,c,p){const u=e.resolveComponent("Icon");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.TransitionGroup,{tag:"div",name:"list",class:"fixed w-2/3 space-y-2 transition-all sm:w-1/4 bottom-2 left-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.$notif.list,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:"flex items-center p-4 transition bg-white rounded shadow-sm"},[e.createVNode(u,{class:e.normalizeClass([s.colors[a.type],"text-xl"]),icon:s.icons[a.type],inline:""},null,8,["class","icon"]),e.createElementVNode("p",S,e.toDisplayString(a.message),1)]))),128))]),_:1})])}var R=_(T,[["render",I]]);const d=e.ref([]),q=e.readonly(d);function f(t,o,r){const s=v();d.value=[...d.value,{type:t,message:o,actions:r,id:s}],setTimeout(()=>{d.value=d.value.filter(c=>c.id!==s)},2e3)}function B(...t){f("error",...t)}function P(...t){f("warn",...t)}function D(...t){f("info",...t)}function M(...t){f("success",...t)}function L(t){t.config.globalProperties.$notif=e.reactive({list:q,push:f,error:B,warn:P,info:D,success:M}),t.component("Pf_TheNotifications",R)}var $="";const j={components:{Icon:l.Icon},props:{title:{type:String,default:null}},emits:["close"]},U={class:"flex items-start"},G={class:"flex-1 overflow-hidden title overflow-ellipsis"},O={class:"overflow-auto content"},z={class:"py-2"};function A(t,o,r,s,c,p){const u=e.resolveComponent("Icon");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createElementVNode("div",{class:"fixed inset-0 bg-gray-200",onClick:o[2]||(o[2]=a=>t.$emit("close"))},[e.createElementVNode("div",{class:"p-2 m-auto mt-2 bg-white rounded-md shadow-md sm:mt-4 top-2 pf-dialog",onClick:o[1]||(o[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",U,[e.createElementVNode("div",G,e.toDisplayString(r.title),1),e.createElementVNode("button",{class:"ml-2 eor-icon-btn",onClick:o[0]||(o[0]=a=>t.$emit("close"))},[e.createVNode(u,{icon:"mdi:close",class:"text-purple"})])]),e.createElementVNode("div",O,[e.renderSlot(t.$slots,"default")]),e.createElementVNode("div",z,[e.renderSlot(t.$slots,"footer")])])])])}var F=_(j,[["render",A]]);function H(t){const o=h.useRoute(),r=h.useRouter(),s=e.computed(()=>!!o.query[t]);return e.watch(s,c=>{c?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},{immediate:!0}),{isOpen:s,open(){const c=x(g({},o.query),{[t]:"open"});r.push({query:c})},async close(){const c=new Promise(u=>{const a=e.watch(s,J=>{J||(u(),a())})}),p=g({},o.query);return delete p[t],r.replace({query:p}),c}}}function X(t){t.component("Pf_Dialog",F)}n.ModalPlugin=X,n.NotificationsPlugin=L,n.useModal=H,Object.defineProperty(n,"__esModule",{value:!0}),n[Symbol.toStringTag]="Module"}); | ||
var pn=Object.defineProperty,gn=Object.defineProperties;var yn=Object.getOwnPropertyDescriptors;var qe=Object.getOwnPropertySymbols;var mn=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable;var Ue=(g,f,v)=>f in g?pn(g,f,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[f]=v,x=(g,f)=>{for(var v in f||(f={}))mn.call(f,v)&&Ue(g,v,f[v]);if(qe)for(var v of qe(f))vn.call(f,v)&&Ue(g,v,f[v]);return g},he=(g,f)=>gn(g,yn(f));(function(g,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],f):(g=typeof globalThis!="undefined"?globalThis:g||self,f(g.PurplefoxTools={},g.Vue,g.vueRouter))})(this,function(g,f,v){"use strict";var N,Qe=new Uint8Array(16);function Be(){if(!N&&(N=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!N))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return N(Qe)}var He=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ze(e){return typeof e=="string"&&He.test(e)}for(var m=[],Q=0;Q<256;++Q)m.push((Q+256).toString(16).substr(1));function Ge(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(m[e[t+0]]+m[e[t+1]]+m[e[t+2]]+m[e[t+3]]+"-"+m[e[t+4]]+m[e[t+5]]+"-"+m[e[t+6]]+m[e[t+7]]+"-"+m[e[t+8]]+m[e[t+9]]+"-"+m[e[t+10]]+m[e[t+11]]+m[e[t+12]]+m[e[t+13]]+m[e[t+14]]+m[e[t+15]]).toLowerCase();if(!ze(n))throw TypeError("Stringified UUID is invalid");return n}function Ke(e,t,n){e=e||{};var r=e.random||(e.rng||Be)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return Ge(r)}var C=/^[a-z0-9]+(-[a-z0-9]+)*$/,P=Object.freeze({left:0,top:0,width:16,height:16,rotate:0,vFlip:!1,hFlip:!1});function B(e){return x(x({},P),e)}var R=(e,t,n,r="")=>{const o=e.split(":");if(e.slice(0,1)==="@"){if(o.length<2||o.length>3)return null;r=o.shift().slice(1)}if(o.length>3||!o.length)return null;if(o.length>1){const s=o.pop(),l=o.pop(),a={provider:o.length>0?o[0]:r,prefix:l,name:s};return t&&!S(a)?null:a}const i=o[0],c=i.split("-");if(c.length>1){const s={provider:r,prefix:c.shift(),name:c.join("-")};return t&&!S(s)?null:s}if(n&&r===""){const s={provider:r,prefix:"",name:i};return t&&!S(s,n)?null:s}return null},S=(e,t)=>e?!!((e.provider===""||e.provider.match(C))&&(t&&e.prefix===""||e.prefix.match(C))&&e.name.match(C)):!1;function Ye(e,t){const n=x({},e);for(const r in P){const o=r;if(t[o]!==void 0){const i=t[o];if(n[o]===void 0){n[o]=i;continue}switch(o){case"rotate":n[o]=(n[o]+i)%4;break;case"hFlip":case"vFlip":n[o]=i!==n[o];break;default:n[o]=i}}}return n}function pe(e,t,n=!1){function r(i,c){var s,l,a,d;if(e.icons[i]!==void 0)return Object.assign({},e.icons[i]);if(c>5)return null;if(((s=e.aliases)==null?void 0:s[i])!==void 0){const u=(l=e.aliases)==null?void 0:l[i],h=r(u.parent,c+1);return h&&Ye(h,u)}return c===0&&((a=e.chars)==null?void 0:a[i])!==void 0?r((d=e.chars)==null?void 0:d[i],c+1):null}const o=r(t,0);if(o)for(const i in P)o[i]===void 0&&e[i]!==void 0&&(o[i]=e[i]);return o&&n?B(o):o}var Je=/^[a-f0-9]+(-[a-f0-9]+)*$/;function ge(e,t){for(const n in e){const r=n,i=typeof e[r];if(i==="undefined"){delete e[r];continue}switch(n){case"body":case"parent":if(i!=="string")return n;break;case"hFlip":case"vFlip":case"hidden":if(i!=="boolean")if(t)delete e[r];else return n;break;case"width":case"height":case"left":case"top":case"rotate":case"inlineHeight":case"inlineTop":case"verticalAlign":if(i!=="number")if(t)delete e[r];else return n;break;default:if(i==="object")if(t)delete e[r];else return n}}return null}function Xe(e,t){const n=!!(t==null?void 0:t.fix);if(typeof e!="object"||e===null||typeof e.icons!="object"||!e.icons)throw new Error("Bad icon set");const r=e;if(typeof(t==null?void 0:t.prefix)=="string")r.prefix=t.prefix;else if(typeof r.prefix!="string"||!r.prefix.match(C))throw new Error("Invalid prefix");if(typeof(t==null?void 0:t.provider)=="string")r.provider=t.provider;else if(r.provider!==void 0){const i=r.provider;if(typeof i!="string"||i!==""&&!i.match(C))if(n)delete r.provider;else throw new Error("Invalid provider")}const o=r.icons;if(Object.keys(o).forEach(i=>{if(!i.match(C)){if(n){delete o[i];return}throw new Error(`Invalid icon name: "${i}"`)}const c=o[i];if(typeof c!="object"||c===null||typeof c.body!="string"){if(n){delete o[i];return}throw new Error(`Invalid icon: "${i}"`)}const s=typeof c.parent=="string"?"parent":ge(c,n);if(s!==null){if(n){delete o[i];return}throw new Error(`Invalid property "${s}" in icon "${i}"`)}}),!Object.keys(r.icons).length)throw new Error("Icon set is empty");if(r.aliases!==void 0&&(typeof r.aliases!="object"||r.aliases===null))if(n)delete r.aliases;else throw new Error("Invalid aliases list");if(typeof r.aliases=="object"){let i=function(a,d){if(s.has(a))return!l.has(a);const u=c[a];if(d>5||typeof u!="object"||u===null||typeof u.parent!="string"||!a.match(C)){if(n)return delete c[a],l.add(a),!1;throw new Error(`Invalid icon alias: "${a}"`)}const h=u.parent;if(r.icons[h]===void 0&&(c[h]===void 0||!i(h,d+1))){if(n)return delete c[a],l.add(a),!1;throw new Error(`Missing parent icon for alias "${a}`)}n&&u.body!==void 0&&delete u.body;const y=u.body!==void 0?"body":ge(u,n);if(y!==null){if(n)return delete c[a],l.add(a),!1;throw new Error(`Invalid property "${y}" in alias "${a}"`)}return s.add(a),!0};const c=r.aliases,s=new Set,l=new Set;Object.keys(c).forEach(a=>{i(a,0)}),n&&!Object.keys(r.aliases).length&&delete r.aliases}if(Object.keys(P).forEach(i=>{const c=typeof P[i],s=typeof r[i];if(s!=="undefined"&&s!==c)throw new Error(`Invalid value type for "${i}"`)}),r.chars!==void 0&&(typeof r.chars!="object"||r.chars===null))if(n)delete r.chars;else throw new Error("Invalid characters map");if(typeof r.chars=="object"){const i=r.chars;Object.keys(i).forEach(c=>{var s;if(!c.match(Je)||typeof i[c]!="string"){if(n){delete i[c];return}throw new Error(`Invalid character "${c}"`)}const l=i[c];if(r.icons[l]===void 0&&((s=r.aliases)==null?void 0:s[l])===void 0){if(n){delete i[c];return}throw new Error(`Character "${c}" points to missing icon "${l}"`)}}),n&&!Object.keys(r.chars).length&&delete r.chars}return r}function We(e){for(const t in P)if(e[t]!==void 0)return!0;return!1}function ye(e,t,n){n=n||{};const r=[];if(typeof e!="object"||typeof e.icons!="object")return r;const o=n.validate;if(o!==!1)try{Xe(e,typeof o=="object"?o:{fix:!0})}catch{return r}e.not_found instanceof Array&&e.not_found.forEach(s=>{t(s,null),r.push(s)});const i=e.icons;Object.keys(i).forEach(s=>{const l=pe(e,s,!0);l&&(t(s,l),r.push(s))});const c=n.aliases||"all";if(c!=="none"&&typeof e.aliases=="object"){const s=e.aliases;Object.keys(s).forEach(l=>{if(c==="variations"&&We(s[l]))return;const a=pe(e,l,!0);a&&(t(l,a),r.push(l))})}return r}var H=Object.create(null);function Ze(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:Object.create(null)}}function _(e,t){H[e]===void 0&&(H[e]=Object.create(null));const n=H[e];return n[t]===void 0&&(n[t]=Ze(e,t)),n[t]}function z(e,t){const n=Date.now();return ye(t,(r,o)=>{o?e.icons[r]=o:e.missing[r]=n})}function et(e,t,n){try{if(typeof n.body=="string")return e.icons[t]=Object.freeze(B(n)),!0}catch{}return!1}function tt(e,t){const n=e.icons[t];return n===void 0?null:n}var T=!1;function me(e){return typeof e=="boolean"&&(T=e),T}function nt(e){const t=typeof e=="string"?R(e,!0,T):e;return t?tt(_(t.provider,t.prefix),t.name):null}function rt(e,t){const n=R(e,!0,T);if(!n)return!1;const r=_(n.provider,n.prefix);return et(r,n.name,t)}function ot(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=typeof e.provider=="string"?e.provider:""),T&&t===""&&(typeof e.prefix!="string"||e.prefix==="")){let r=!1;return ye(e,(o,i)=>{i&&rt(o,i)&&(r=!0)},{validate:{fix:!0,prefix:""}}),r}if(typeof e.prefix!="string"||!S({provider:t,prefix:e.prefix,name:"a"}))return!1;const n=_(t,e.prefix);return!!z(n,e)}var ve=Object.freeze({inline:!1,width:null,height:null,hAlign:"center",vAlign:"middle",slice:!1,hFlip:!1,vFlip:!1,rotate:0});function it(e,t){const n={};for(const r in e){const o=r;if(n[o]=e[o],t[o]===void 0)continue;const i=t[o];switch(o){case"inline":case"slice":typeof i=="boolean"&&(n[o]=i);break;case"hFlip":case"vFlip":i===!0&&(n[o]=!n[o]);break;case"hAlign":case"vAlign":typeof i=="string"&&i!==""&&(n[o]=i);break;case"width":case"height":(typeof i=="string"&&i!==""||typeof i=="number"&&i||i===null)&&(n[o]=i);break;case"rotate":typeof i=="number"&&(n[o]+=i);break}}return n}var st=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ct=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function G(e,t,n){if(t===1)return e;if(n=n===void 0?100:n,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const r=e.split(st);if(r===null||!r.length)return e;const o=[];let i=r.shift(),c=ct.test(i);for(;;){if(c){const s=parseFloat(i);isNaN(s)?o.push(i):o.push(Math.ceil(s*t*n)/n)}else o.push(i);if(i=r.shift(),i===void 0)return o.join("");c=!c}}function at(e){let t="";switch(e.hAlign){case"left":t+="xMin";break;case"right":t+="xMax";break;default:t+="xMid"}switch(e.vAlign){case"top":t+="YMin";break;case"bottom":t+="YMax";break;default:t+="YMid"}return t+=e.slice?" slice":" meet",t}function lt(e,t){const n={left:e.left,top:e.top,width:e.width,height:e.height};let r=e.body;[e,t].forEach(s=>{const l=[],a=s.hFlip,d=s.vFlip;let u=s.rotate;a?d?u+=2:(l.push("translate("+(n.width+n.left)+" "+(0-n.top)+")"),l.push("scale(-1 1)"),n.top=n.left=0):d&&(l.push("translate("+(0-n.left)+" "+(n.height+n.top)+")"),l.push("scale(1 -1)"),n.top=n.left=0);let h;switch(u<0&&(u-=Math.floor(u/4)*4),u=u%4,u){case 1:h=n.height/2+n.top,l.unshift("rotate(90 "+h+" "+h+")");break;case 2:l.unshift("rotate(180 "+(n.width/2+n.left)+" "+(n.height/2+n.top)+")");break;case 3:h=n.width/2+n.left,l.unshift("rotate(-90 "+h+" "+h+")");break}u%2==1&&((n.left!==0||n.top!==0)&&(h=n.left,n.left=n.top,n.top=h),n.width!==n.height&&(h=n.width,n.width=n.height,n.height=h)),l.length&&(r='<g transform="'+l.join(" ")+'">'+r+"</g>")});let o,i;t.width===null&&t.height===null?(i="1em",o=G(i,n.width/n.height)):t.width!==null&&t.height!==null?(o=t.width,i=t.height):t.height!==null?(i=t.height,o=G(i,n.width/n.height)):(o=t.width,i=G(o,n.height/n.width)),o==="auto"&&(o=n.width),i==="auto"&&(i=n.height),o=typeof o=="string"?o:o+"",i=typeof i=="string"?i:i+"";const c={attributes:{width:o,height:i,preserveAspectRatio:at(t),viewBox:n.left+" "+n.top+" "+n.width+" "+n.height},body:r};return t.inline&&(c.inline=!0),c}var ft=/\sid="(\S+)"/g,ut="IconifyId-"+Date.now().toString(16)+"-"+(Math.random()*16777216|0).toString(16)+"-",dt=0;function ht(e,t=ut){const n=[];let r;for(;r=ft.exec(e);)n.push(r[1]);return n.length&&n.forEach(o=>{const i=typeof t=="function"?t(o):t+dt++,c=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+c+')([")]|\\.[a-z])',"g"),"$1"+i+"$3")}),e}var K=Object.create(null);function pt(e,t){K[e]=t}function Y(e){return K[e]||K[""]}function J(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path===void 0?"/":e.path,maxURL:e.maxURL?e.maxURL:500,rotate:e.rotate?e.rotate:750,timeout:e.timeout?e.timeout:5e3,random:e.random===!0,index:e.index?e.index:0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var X=Object.create(null),A=["https://api.simplesvg.com","https://api.unisvg.com"],D=[];A.length>0;)A.length===1||Math.random()>.5?D.push(A.shift()):D.push(A.pop());X[""]=J({resources:["https://api.iconify.design"].concat(D)});function gt(e,t){const n=J(t);return n===null?!1:(X[e]=n,!0)}function W(e){return X[e]}var be=(e,t)=>{let n=e,r=n.indexOf("?")!==-1;function o(i){switch(typeof i){case"boolean":return i?"true":"false";case"number":return encodeURIComponent(i);case"string":return encodeURIComponent(i);default:throw new Error("Invalid parameter")}}return Object.keys(t).forEach(i=>{let c;try{c=o(t[i])}catch{return}n+=(r?"&":"?")+encodeURIComponent(i)+"="+c,r=!0}),n},we=Object.create(null),V=Object.create(null),yt=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}try{const t=String.fromCharCode(114)+String.fromCharCode(101);if(e=global[t+"qui"+t]("cross-fetch"),typeof e=="function")return e}catch{}return null},Ie=yt();function mt(e,t){const n=W(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let i=0;n.resources.forEach(s=>{i=Math.max(i,s.length)});const c=be(t+".json",{icons:""});r=n.maxURL-i-n.path.length-c.length}const o=e+":"+t;return V[e]=n.path,we[o]=r,r}var vt=(e,t,n)=>{const r=[];let o=we[t];o===void 0&&(o=mt(e,t));const i="icons";let c={type:i,provider:e,prefix:t,icons:[]},s=0;return n.forEach((l,a)=>{s+=l.length+1,s>=o&&a>0&&(r.push(c),c={type:i,provider:e,prefix:t,icons:[]},s=l.length),c.icons.push(l)}),r.push(c),r};function bt(e){if(typeof e=="string"){if(V[e]===void 0){const t=W(e);if(!t)return"/";V[e]=t.path}return V[e]}return"/"}var wt=(e,t,n)=>{if(!Ie){n.done(void 0,424);return}let r=bt(t.provider);switch(t.type){case"icons":{const i=t.prefix,s=t.icons.join(",");r+=be(i+".json",{icons:s});break}case"custom":{const i=t.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n.done(void 0,400);return}let o=503;Ie(e+r).then(i=>{if(i.status!==200){setTimeout(()=>{n.done(void 0,i.status)});return}return o=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{n.done(void 0,o)});return}setTimeout(()=>{n.done(i)})}).catch(()=>{n.done(void 0,o)})},It={prepare:vt,send:wt};function xt(e){const t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((o,i)=>o.provider!==i.provider?o.provider.localeCompare(i.provider):o.prefix!==i.prefix?o.prefix.localeCompare(i.prefix):o.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return e.forEach(o=>{if(r.name===o.name&&r.prefix===o.prefix&&r.provider===o.provider)return;r=o;const i=o.provider,c=o.prefix,s=o.name;n[i]===void 0&&(n[i]=Object.create(null));const l=n[i];l[c]===void 0&&(l[c]=_(i,c));const a=l[c];let d;a.icons[s]!==void 0?d=t.loaded:c===""||a.missing[s]!==void 0?d=t.missing:d=t.pending;const u={provider:i,prefix:c,name:s};d.push(u)}),t}var j=Object.create(null),Z=Object.create(null);function xe(e,t){e.forEach(n=>{const r=n.provider;if(j[r]===void 0)return;const o=j[r],i=n.prefix,c=o[i];c&&(o[i]=c.filter(s=>s.id!==t))})}function jt(e,t){Z[e]===void 0&&(Z[e]=Object.create(null));const n=Z[e];n[t]||(n[t]=!0,setTimeout(()=>{if(n[t]=!1,j[e]===void 0||j[e][t]===void 0)return;const r=j[e][t].slice(0);if(!r.length)return;const o=_(e,t);let i=!1;r.forEach(c=>{const s=c.icons,l=s.pending.length;s.pending=s.pending.filter(a=>{if(a.prefix!==t)return!0;const d=a.name;if(o.icons[d]!==void 0)s.loaded.push({provider:e,prefix:t,name:d});else if(o.missing[d]!==void 0)s.missing.push({provider:e,prefix:t,name:d});else return i=!0,!0;return!1}),s.pending.length!==l&&(i||xe([{provider:e,prefix:t}],c.id),c.callback(s.loaded.slice(0),s.missing.slice(0),s.pending.slice(0),c.abort))})}))}var kt=0;function Et(e,t,n){const r=kt++,o=xe.bind(null,n,r);if(!t.pending.length)return o;const i={id:r,icons:t,callback:e,abort:o};return n.forEach(c=>{const s=c.provider,l=c.prefix;j[s]===void 0&&(j[s]=Object.create(null));const a=j[s];a[l]===void 0&&(a[l]=[]),a[l].push(i)}),o}function Ct(e,t=!0,n=!1){const r=[];return e.forEach(o=>{const i=typeof o=="string"?R(o,!1,n):o;(!t||S(i,n))&&r.push({provider:i.provider,prefix:i.prefix,name:i.name})}),r}var je={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function _t(e,t,n,r,o){const i=e.resources.length,c=e.random?Math.floor(Math.random()*i):e.index;let s;if(e.random){let p=e.resources.slice(0);for(s=[];p.length>1;){const w=Math.floor(Math.random()*p.length);s.push(p[w]),p=p.slice(0,w).concat(p.slice(w+1))}s=s.concat(p)}else s=e.resources.slice(c).concat(e.resources.slice(0,c));const l=Date.now();let a="pending",d=0,u,h=null,y=[],b=[];typeof r=="function"&&b.push(r);function E(){h&&(clearTimeout(h),h=null)}function fe(){a==="pending"&&(a="aborted"),E(),y.forEach(p=>{p.abort&&p.abort(),p.status==="pending"&&(p.status="aborted")}),y=[]}function dn(p,w){w&&(b=[]),typeof p=="function"&&b.push(p)}function De(){return{startTime:l,payload:t,status:a,queriesSent:d,queriesPending:y.length,subscribe:dn,abort:fe}}function ue(){a="failed",b.forEach(p=>{p(void 0,u)})}function Ve(){y=y.filter(p=>(p.status==="pending"&&(p.status="aborted"),p.abort&&p.abort(),!1))}function hn(p,w,U){const $=w===void 0;switch(y=y.filter(I=>I!==p),a){case"pending":break;case"failed":if($||!e.dataAfterTimeout)return;break;default:return}if($){U!==void 0&&(u=U),y.length||(s.length?de():ue());return}if(E(),Ve(),o&&!e.random){const I=e.resources.indexOf(p.resource);I!==-1&&I!==e.index&&o(I)}a="completed",b.forEach(I=>{I(w)})}function de(){if(a!=="pending")return;E();const p=s.shift();if(p===void 0){if(y.length){const $=typeof e.timeout=="function"?e.timeout(l):e.timeout;if($){h=setTimeout(()=>{E(),a==="pending"&&(Ve(),ue())},$);return}}ue();return}const w={getQueryStatus:De,status:"pending",resource:p,done:($,I)=>{hn(w,$,I)}};y.push(w),d++;const U=typeof e.rotate=="function"?e.rotate(d,l):e.rotate;h=setTimeout(de,U),n(p,t,w)}return setTimeout(de),De}function Ot(e){if(typeof e!="object"||typeof e.resources!="object"||!(e.resources instanceof Array)||!e.resources.length)throw new Error("Invalid Reduncancy configuration");const t=Object.create(null);let n;for(n in je)e[n]!==void 0?t[n]=e[n]:t[n]=je[n];return t}function ke(e){const t=Ot(e);let n=[];function r(){n=n.filter(s=>s().status==="pending")}function o(s,l,a){const d=_t(t,s,l,(u,h)=>{r(),a&&a(u,h)},u=>{t.index=u});return n.push(d),d}function i(s){const l=n.find(a=>s(a));return l!==void 0?l:null}return{query:o,find:i,setIndex:s=>{t.index=s},getIndex:()=>t.index,cleanup:r}}function Ee(){}var ee=Object.create(null);function $t(e){if(ee[e]===void 0){const t=W(e);if(!t)return;const n=ke(t),r={config:t,redundancy:n};ee[e]=r}return ee[e]}function Pt(e,t,n){let r,o;if(typeof e=="string"){const i=Y(e);if(!i)return n(void 0,424),Ee;o=i.send;const c=$t(e);c&&(r=c.redundancy)}else{const i=J(e);if(i){r=ke(i);const c=e.resources?e.resources[0]:"",s=Y(c);s&&(o=s.send)}}return!r||!o?(n(void 0,424),Ee):r.query(t,o,n)().abort}var te={};function Ce(){}var O=Object.create(null),ne=Object.create(null),re=Object.create(null),oe=Object.create(null);function St(e,t){re[e]===void 0&&(re[e]=Object.create(null));const n=re[e];n[t]||(n[t]=!0,setTimeout(()=>{n[t]=!1,jt(e,t)}))}var _e=Object.create(null);function Tt(e,t,n){function r(){const s=(e===""?"":"@"+e+":")+t,l=Math.floor(Date.now()/6e4);_e[s]<l&&(_e[s]=l,console.error('Unable to retrieve icons for "'+s+'" because API is not configured properly.'))}ne[e]===void 0&&(ne[e]=Object.create(null));const o=ne[e];oe[e]===void 0&&(oe[e]=Object.create(null));const i=oe[e];O[e]===void 0&&(O[e]=Object.create(null));const c=O[e];o[t]===void 0?o[t]=n:o[t]=o[t].concat(n).sort(),i[t]||(i[t]=!0,setTimeout(()=>{i[t]=!1;const s=o[t];delete o[t];const l=Y(e);if(!l){r();return}l.prepare(e,t,s).forEach(d=>{Pt(e,d,(u,h)=>{const y=_(e,t);if(typeof u!="object"){if(h!==404)return;const b=Date.now();d.icons.forEach(E=>{y.missing[E]=b})}else try{const b=z(y,u);if(!b.length)return;const E=c[t];b.forEach(fe=>{delete E[fe]}),te.store&&te.store(e,u)}catch(b){console.error(b)}St(e,t)})})}))}var At=(e,t)=>{const n=Ct(e,!0,me()),r=xt(n);if(!r.pending.length){let a=!0;return t&&setTimeout(()=>{a&&t(r.loaded,r.missing,r.pending,Ce)}),()=>{a=!1}}const o=Object.create(null),i=[];let c,s;r.pending.forEach(a=>{const d=a.provider,u=a.prefix;if(u===s&&d===c)return;c=d,s=u,i.push({provider:d,prefix:u}),O[d]===void 0&&(O[d]=Object.create(null));const h=O[d];h[u]===void 0&&(h[u]=Object.create(null)),o[d]===void 0&&(o[d]=Object.create(null));const y=o[d];y[u]===void 0&&(y[u]=[])});const l=Date.now();return r.pending.forEach(a=>{const d=a.provider,u=a.prefix,h=a.name,y=O[d][u];y[h]===void 0&&(y[h]=l,o[d][u].push(h))}),i.forEach(a=>{const d=a.provider,u=a.prefix;o[d][u].length&&Tt(d,u,o[d][u])}),t?Et(t,r,i):Ce},Oe="iconify2",M="iconify",$e=M+"-count",Pe=M+"-version",Se=36e5,Mt=168,ie={local:!0,session:!0},se=!1,Te={local:0,session:0},Ae={local:[],session:[]},q=typeof window=="undefined"?{}:window;function Me(e){const t=e+"Storage";try{if(q&&q[t]&&typeof q[t].length=="number")return q[t]}catch{}return ie[e]=!1,null}function ce(e,t,n){try{return e.setItem($e,n+""),Te[t]=n,!0}catch{return!1}}function Le(e){const t=e.getItem($e);if(t){const n=parseInt(t);return n||0}return 0}function Lt(e,t){try{e.setItem(Pe,Oe)}catch{}ce(e,t,0)}function Ft(e){try{const t=Le(e);for(let n=0;n<t;n++)e.removeItem(M+n)}catch{}}var Fe=()=>{if(se)return;se=!0;const e=Math.floor(Date.now()/Se)-Mt;function t(n){const r=Me(n);if(!r)return;const o=i=>{const c=M+i,s=r.getItem(c);if(typeof s!="string")return!1;let l=!0;try{const a=JSON.parse(s);if(typeof a!="object"||typeof a.cached!="number"||a.cached<e||typeof a.provider!="string"||typeof a.data!="object"||typeof a.data.prefix!="string")l=!1;else{const d=a.provider,u=a.data.prefix,h=_(d,u);l=z(h,a.data).length>0}}catch{l=!1}return l||r.removeItem(c),l};try{const i=r.getItem(Pe);if(i!==Oe){i&&Ft(r),Lt(r,n);return}let c=Le(r);for(let s=c-1;s>=0;s--)o(s)||(s===c-1?c--:Ae[n].push(s));ce(r,n,c)}catch{}}for(const n in ie)t(n)},Nt=(e,t)=>{se||Fe();function n(r){if(!ie[r])return!1;const o=Me(r);if(!o)return!1;let i=Ae[r].shift();if(i===void 0&&(i=Te[r],!ce(o,r,i+1)))return!1;try{const c={cached:Math.floor(Date.now()/Se),provider:e,data:t};o.setItem(M+i,JSON.stringify(c))}catch{return!1}return!0}n("local")||n("session")},Ne=/[\s,]+/;function Rt(e,t){t.split(Ne).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Dt(e,t){t.split(Ne).forEach(n=>{const r=n.trim();switch(r){case"left":case"center":case"right":e.hAlign=r;break;case"top":case"middle":case"bottom":e.vAlign=r;break;case"slice":case"crop":e.slice=!0;break;case"meet":e.slice=!1}})}function Vt(e,t=0){const n=e.replace(/^-?[0-9.]*/,"");function r(o){for(;o<0;)o+=4;return o%4}if(n===""){const o=parseInt(e);return isNaN(o)?0:r(o)}else if(n!==e){let o=0;switch(n){case"%":o=25;break;case"deg":o=90}if(o){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/o,i%1==0?r(i):0)}}return t}const qt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"};let k={};["horizontal","vertical"].forEach(e=>{["Align","Flip"].forEach(t=>{const r={attr:e.slice(0,1)+t,boolean:t==="Flip"};k[e+"-"+t.toLowerCase()]=r,k[e.slice(0,1)+"-"+t.toLowerCase()]=r,k[e+t]=r})});const Ut=(e,t)=>{const n=it(ve,t),r=x({},qt);let o=typeof t.style=="object"&&!(t.style instanceof Array)?x({},t.style):{};for(let l in t){const a=t[l];if(a!==void 0)switch(l){case"icon":case"style":case"onLoad":break;case"inline":case"hFlip":case"vFlip":n[l]=a===!0||a==="true"||a===1;break;case"flip":typeof a=="string"&&Rt(n,a);break;case"align":typeof a=="string"&&Dt(n,a);break;case"color":o.color=a;break;case"rotate":typeof a=="string"?n[l]=Vt(a):typeof a=="number"&&(n[l]=a);break;case"ariaHidden":case"aria-hidden":a!==!0&&a!=="true"&&delete r["aria-hidden"];break;default:k[l]!==void 0?k[l].boolean&&(a===!0||a==="true"||a===1)?n[k[l].attr]=!0:!k[l].boolean&&typeof a=="string"&&a!==""&&(n[k[l].attr]=a):ve[l]===void 0&&(r[l]=a)}}const i=lt(e,n);for(let l in i.attributes)r[l]=i.attributes[l];i.inline&&o.verticalAlign===void 0&&o["vertical-align"]===void 0&&(o.verticalAlign="-0.125em");let c=0;const s=t.id;return r.innerHTML=ht(i.body,s?()=>s+"-"+c++:"iconify-vue-"),Object.keys(o).length>0&&(r.style=o),f.h("svg",r)};if(me(!0),pt("",It),typeof document!="undefined"&&typeof window!="undefined"){te.store=Nt,Fe();const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!ot(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let n in t){const r="IconifyProviders["+n+"] is invalid.";try{const o=t[n];if(typeof o!="object"||!o||o.resources===void 0)continue;gt(n,o)||console.error(r)}catch{console.error(r)}}}}const ae=f.defineComponent({inheritAttrs:!1,data(){return{mounted:!1,counter:0}},beforeMount(){this._name="",this._loadingIcon=null,this.mounted=!0},unmounted(){this.abortLoading()},methods:{abortLoading(){this._loadingIcon&&(this._loadingIcon.abort(),this._loadingIcon=null)},getIcon(e,t){if(typeof e=="object"&&e!==null&&typeof e.body=="string")return this._name="",this.abortLoading(),{data:B(e)};let n;if(typeof e!="string"||(n=R(e,!1,!0))===null)return this.abortLoading(),null;const r=nt(n);if(r===null)return(!this._loadingIcon||this._loadingIcon.name!==e)&&(this.abortLoading(),this._name="",this._loadingIcon={name:e,abort:At([n],()=>{this.counter++})}),null;this.abortLoading(),this._name!==e&&(this._name=e,t&&t(e));const o=["iconify"];return n.prefix!==""&&o.push("iconify--"+n.prefix),n.provider!==""&&o.push("iconify--"+n.provider),{data:r,classes:o}}},render(){if(!this.mounted)return this.$slots.default?this.$slots.default():null;this.counter;const e=this.$attrs,t=this.getIcon(e.icon,e.onLoad);if(!t)return this.$slots.default?this.$slots.default():null;let n=e;return t.classes&&(n=he(x({},e),{class:(typeof e.class=="string"?e.class+" ":"")+t.classes.join(" ")})),Ut(t.data,n)}});var Re=(e,t)=>{for(const[n,r]of t)e[n]=r;return e};const Qt={components:{Icon:ae},setup(){return{icons:{error:"mdi:alert",warning:"mdi:alert-circle",info:"mdi:information",success:"mdi:check-bold"},colors:{error:"text-red",warning:"text-orange",info:"text-purple",success:"text-green"}}}},Bt={class:"ml-4 leading-tight"};function Ht(e,t,n,r,o,i){const c=f.resolveComponent("Icon");return f.openBlock(),f.createBlock(f.Teleport,{to:"body"},[f.createVNode(f.TransitionGroup,{tag:"div",name:"list",class:"fixed w-2/3 space-y-2 transition-all sm:w-1/4 bottom-2 left-2"},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(e.$notif.list,s=>(f.openBlock(),f.createElementBlock("div",{key:s.id,class:"flex items-center p-4 transition bg-white rounded shadow-sm"},[f.createVNode(c,{class:f.normalizeClass([r.colors[s.type],"text-xl"]),icon:r.icons[s.type],inline:""},null,8,["class","icon"]),f.createElementVNode("p",Bt,f.toDisplayString(s.message),1)]))),128))]),_:1})])}var zt=Re(Qt,[["render",Ht]]);const L=f.ref([]),Gt=f.readonly(L);function F(e,t,n){const r=Ke();L.value=[...L.value,{type:e,message:t,actions:n,id:r}],setTimeout(()=>{L.value=L.value.filter(o=>o.id!==r)},2e3)}function Kt(...e){F("error",...e)}function Yt(...e){F("warn",...e)}function Jt(...e){F("info",...e)}function Xt(...e){F("success",...e)}function Wt(e){e.config.globalProperties.$notif=f.reactive({list:Gt,push:F,error:Kt,warn:Yt,info:Jt,success:Xt}),e.component("Pf_TheNotifications",zt)}var bn="";const Zt={components:{Icon:ae},props:{title:{type:String,default:null}},emits:["close"]},en={class:"flex items-start"},tn={class:"flex-1 overflow-hidden title overflow-ellipsis"},nn={class:"overflow-auto content"},rn={class:"py-2"};function on(e,t,n,r,o,i){const c=f.resolveComponent("Icon");return f.openBlock(),f.createBlock(f.Teleport,{to:"body"},[f.createElementVNode("div",{class:"fixed inset-0 bg-gray-200",onClick:t[2]||(t[2]=s=>e.$emit("close"))},[f.createElementVNode("div",{class:"p-2 m-auto mt-2 bg-white rounded-md shadow-md sm:mt-4 top-2 pf-dialog",onClick:t[1]||(t[1]=f.withModifiers(()=>{},["stop"]))},[f.createElementVNode("div",en,[f.createElementVNode("div",tn,f.toDisplayString(n.title),1),f.createElementVNode("button",{class:"ml-2 eor-icon-btn",onClick:t[0]||(t[0]=s=>e.$emit("close"))},[f.createVNode(c,{icon:"mdi:close",class:"text-purple"})])]),f.createElementVNode("div",nn,[f.renderSlot(e.$slots,"default")]),f.createElementVNode("div",rn,[f.renderSlot(e.$slots,"footer")])])])])}var sn=Re(Zt,[["render",on]]);function cn(e){const t=v.useRoute(),n=v.useRouter(),r=f.computed(()=>!!t.query[e]);return f.watch(r,o=>{o?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},{immediate:!0}),{isOpen:r,open(){const o=he(x({},t.query),{[e]:"open"});n.push({query:o})},async close(){const o=new Promise(c=>{const s=f.watch(r,l=>{l||(c(),s())})}),i=x({},t.query);return delete i[e],n.replace({query:i}),o}}}function an(e){e.component("Pf_Dialog",sn)}const ln=[{breakpoint:"sm",mediaQueryList:window.matchMedia("(min-width: 640px)")},{breakpoint:"md",mediaQueryList:window.matchMedia("(min-width: 768px)")},{breakpoint:"lg",mediaQueryList:window.matchMedia("(min-width: 1024px)")},{breakpoint:"xl",mediaQueryList:window.matchMedia("(min-width: 1280px)")},{breakpoint:"2xl",mediaQueryList:window.matchMedia("(min-width: 1536px)")}],le=f.reactive({});ln.forEach(({breakpoint:e,mediaQueryList:t})=>{function n(r){le[e]=r.matches}t.addListener(n),le[e]=t.matches});function fn(e){e.config.globalProperties.$responsive=f.reactive({breakpoints:le})}function un(e){e.component(ae)}g.IconPlugin=un,g.ModalPlugin=an,g.NotificationsPlugin=Wt,g.ResponsivePlugin=fn,g.useModal=cn,Object.defineProperty(g,"__esModule",{value:!0}),g[Symbol.toStringTag]="Module"}); |
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"main": "./dist/purplefox-tools.umd.js", | ||
@@ -25,3 +25,2 @@ "module": "./dist/purplefox-tools.es.js", | ||
"devDependencies": { | ||
"@iconify/vue": "^3.0.0", | ||
"@vitejs/plugin-vue": "^1.9.3", | ||
@@ -40,8 +39,8 @@ "vite": "^2.6.4", | ||
"dependencies": { | ||
"@iconify/vue": "^3.0.0", | ||
"uuid": "^8.3.2" | ||
}, | ||
"peerDependencies": { | ||
"@iconify/vue": "^3.0.0", | ||
"vue": "^3.2.16" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
95999
11
2404
3
+ Added@iconify/vue@^3.0.0