{"ast":null,"code":"import { getAssetPath } from '@stencil/core/internal/client';\nlet CACHED_MAP;\nconst getIconMap = () => {\n if (typeof window === 'undefined') {\n return new Map();\n } else {\n if (!CACHED_MAP) {\n const win = window;\n win.Ionicons = win.Ionicons || {};\n CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();\n }\n return CACHED_MAP;\n }\n};\nconst addIcons = icons => {\n Object.keys(icons).forEach(name => {\n addToIconMap(name, icons[name]);\n /**\n * Developers can also pass in the SVG object directly\n * and Ionicons can map the object to a kebab case name.\n * Example: addIcons({ addCircleOutline });\n * This will create an \"addCircleOutline\" entry and\n * an \"add-circle-outline\" entry.\n * Usage: \n * Using name=\"addCircleOutline\" is valid too, but the\n * kebab case naming is preferred.\n */\n const toKebabCase = name.replace(/([a-z0-9]|(?=[A-Z]))([A-Z0-9])/g, \"$1-$2\").toLowerCase();\n if (name !== toKebabCase) {\n addToIconMap(toKebabCase, icons[name]);\n }\n });\n};\nconst addToIconMap = (name, data) => {\n const map = getIconMap();\n const existingIcon = map.get(name);\n if (existingIcon === undefined) {\n map.set(name, data);\n /**\n * Importing and defining the same icon reference\n * multiple times should not yield a warning.\n */\n } else if (existingIcon !== data) {\n console.warn(`[Ionicons Warning]: Multiple icons were mapped to name \"${name}\". Ensure that multiple icons are not mapped to the same icon name.`);\n }\n};\nconst getUrl = i => {\n let url = getSrc(i.src);\n if (url) {\n return url;\n }\n url = getName(i.name, i.icon, i.mode, i.ios, i.md);\n if (url) {\n return getNamedUrl(url, i);\n }\n if (i.icon) {\n url = getSrc(i.icon);\n if (url) {\n return url;\n }\n url = getSrc(i.icon[i.mode]);\n if (url) {\n return url;\n }\n }\n return null;\n};\nconst getNamedUrl = (iconName, iconEl) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n try {\n return getAssetPath(`svg/${iconName}.svg`);\n } catch (e) {\n /**\n * In the custom elements build version of ionicons, referencing an icon\n * by name will throw an invalid URL error because the asset path is not defined.\n * This catches that error and logs something that is more developer-friendly.\n * We also include a reference to the ion-icon element so developers can\n * figure out which instance of ion-icon needs to be updated.\n */\n console.warn(`[Ionicons Warning]: Could not load icon with name \"${iconName}\". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to the icon component.`, iconEl);\n }\n};\nconst getName = (iconName, icon, mode, ios, md) => {\n // default to \"md\" if somehow the mode wasn't set\n mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';\n // if an icon was passed in using the ios or md attributes\n // set the iconName to whatever was passed in\n if (ios && mode === 'ios') {\n iconName = toLower(ios);\n } else if (md && mode === 'md') {\n iconName = toLower(md);\n } else {\n if (!iconName && icon && !isSrc(icon)) {\n iconName = icon;\n }\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n }\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n // only allow alpha characters and dash\n const invalidChars = iconName.replace(/[a-z]|-|\\d/gi, '');\n if (invalidChars !== '') {\n return null;\n }\n return iconName;\n};\nconst getSrc = src => {\n if (isStr(src)) {\n src = src.trim();\n if (isSrc(src)) {\n return src;\n }\n }\n return null;\n};\nconst isSrc = str => str.length > 0 && /(\\/|\\.)/.test(str);\nconst isStr = val => typeof val === 'string';\nconst toLower = val => val.toLowerCase();\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `ion-input` should inherit\n * the `title` attribute that developers set directly on `ion-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\nconst inheritAttributes = (el, attributes = []) => {\n const attributeObject = {};\n attributes.forEach(attr => {\n if (el.hasAttribute(attr)) {\n const value = el.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = el.getAttribute(attr);\n }\n el.removeAttribute(attr);\n }\n });\n return attributeObject;\n};\n/**\n * Returns `true` if the document or host element\n * has a `dir` set to `rtl`. The host value will always\n * take priority over the root document value.\n */\nconst isRTL = hostEl => {\n if (hostEl) {\n if (hostEl.dir !== '') {\n return hostEl.dir.toLowerCase() === 'rtl';\n }\n }\n return (document === null || document === void 0 ? void 0 : document.dir.toLowerCase()) === 'rtl';\n};\nexport { addIcons as a, inheritAttributes as b, getName as c, isRTL as d, getUrl as g, isStr as i };","map":{"version":3,"names":["getAssetPath","CACHED_MAP","getIconMap","window","Map","win","Ionicons","map","addIcons","icons","Object","keys","forEach","name","addToIconMap","toKebabCase","replace","toLowerCase","data","existingIcon","get","undefined","set","console","warn","getUrl","i","url","getSrc","src","getName","icon","mode","ios","md","getNamedUrl","iconName","iconEl","e","toLower","isSrc","isStr","trim","invalidChars","str","length","test","val","inheritAttributes","el","attributes","attributeObject","attr","hasAttribute","value","getAttribute","removeAttribute","isRTL","hostEl","dir","document","a","b","c","d","g"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/ionicons/components/utils.js"],"sourcesContent":["import { getAssetPath } from '@stencil/core/internal/client';\n\nlet CACHED_MAP;\nconst getIconMap = () => {\n if (typeof window === 'undefined') {\n return new Map();\n }\n else {\n if (!CACHED_MAP) {\n const win = window;\n win.Ionicons = win.Ionicons || {};\n CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();\n }\n return CACHED_MAP;\n }\n};\nconst addIcons = (icons) => {\n Object.keys(icons).forEach(name => {\n addToIconMap(name, icons[name]);\n /**\n * Developers can also pass in the SVG object directly\n * and Ionicons can map the object to a kebab case name.\n * Example: addIcons({ addCircleOutline });\n * This will create an \"addCircleOutline\" entry and\n * an \"add-circle-outline\" entry.\n * Usage: \n * Using name=\"addCircleOutline\" is valid too, but the\n * kebab case naming is preferred.\n */\n const toKebabCase = name.replace(/([a-z0-9]|(?=[A-Z]))([A-Z0-9])/g, \"$1-$2\").toLowerCase();\n if (name !== toKebabCase) {\n addToIconMap(toKebabCase, icons[name]);\n }\n });\n};\nconst addToIconMap = (name, data) => {\n const map = getIconMap();\n const existingIcon = map.get(name);\n if (existingIcon === undefined) {\n map.set(name, data);\n /**\n * Importing and defining the same icon reference\n * multiple times should not yield a warning.\n */\n }\n else if (existingIcon !== data) {\n console.warn(`[Ionicons Warning]: Multiple icons were mapped to name \"${name}\". Ensure that multiple icons are not mapped to the same icon name.`);\n }\n};\nconst getUrl = (i) => {\n let url = getSrc(i.src);\n if (url) {\n return url;\n }\n url = getName(i.name, i.icon, i.mode, i.ios, i.md);\n if (url) {\n return getNamedUrl(url, i);\n }\n if (i.icon) {\n url = getSrc(i.icon);\n if (url) {\n return url;\n }\n url = getSrc(i.icon[i.mode]);\n if (url) {\n return url;\n }\n }\n return null;\n};\nconst getNamedUrl = (iconName, iconEl) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n try {\n return getAssetPath(`svg/${iconName}.svg`);\n }\n catch (e) {\n /**\n * In the custom elements build version of ionicons, referencing an icon\n * by name will throw an invalid URL error because the asset path is not defined.\n * This catches that error and logs something that is more developer-friendly.\n * We also include a reference to the ion-icon element so developers can\n * figure out which instance of ion-icon needs to be updated.\n */\n console.warn(`[Ionicons Warning]: Could not load icon with name \"${iconName}\". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to the icon component.`, iconEl);\n }\n};\nconst getName = (iconName, icon, mode, ios, md) => {\n // default to \"md\" if somehow the mode wasn't set\n mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';\n // if an icon was passed in using the ios or md attributes\n // set the iconName to whatever was passed in\n if (ios && mode === 'ios') {\n iconName = toLower(ios);\n }\n else if (md && mode === 'md') {\n iconName = toLower(md);\n }\n else {\n if (!iconName && icon && !isSrc(icon)) {\n iconName = icon;\n }\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n }\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n // only allow alpha characters and dash\n const invalidChars = iconName.replace(/[a-z]|-|\\d/gi, '');\n if (invalidChars !== '') {\n return null;\n }\n return iconName;\n};\nconst getSrc = (src) => {\n if (isStr(src)) {\n src = src.trim();\n if (isSrc(src)) {\n return src;\n }\n }\n return null;\n};\nconst isSrc = (str) => str.length > 0 && /(\\/|\\.)/.test(str);\nconst isStr = (val) => typeof val === 'string';\nconst toLower = (val) => val.toLowerCase();\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `ion-input` should inherit\n * the `title` attribute that developers set directly on `ion-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\nconst inheritAttributes = (el, attributes = []) => {\n const attributeObject = {};\n attributes.forEach(attr => {\n if (el.hasAttribute(attr)) {\n const value = el.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = el.getAttribute(attr);\n }\n el.removeAttribute(attr);\n }\n });\n return attributeObject;\n};\n/**\n * Returns `true` if the document or host element\n * has a `dir` set to `rtl`. The host value will always\n * take priority over the root document value.\n */\nconst isRTL = (hostEl) => {\n if (hostEl) {\n if (hostEl.dir !== '') {\n return hostEl.dir.toLowerCase() === 'rtl';\n }\n }\n return (document === null || document === void 0 ? void 0 : document.dir.toLowerCase()) === 'rtl';\n};\n\nexport { addIcons as a, inheritAttributes as b, getName as c, isRTL as d, getUrl as g, isStr as i };\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,+BAA+B;AAE5D,IAAIC,UAAU;AACd,MAAMC,UAAU,GAAGA,CAAA,KAAM;EACvB,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,OAAO,IAAIC,GAAG,CAAC,CAAC;EAClB,CAAC,MACI;IACH,IAAI,CAACH,UAAU,EAAE;MACf,MAAMI,GAAG,GAAGF,MAAM;MAClBE,GAAG,CAACC,QAAQ,GAAGD,GAAG,CAACC,QAAQ,IAAI,CAAC,CAAC;MACjCL,UAAU,GAAGI,GAAG,CAACC,QAAQ,CAACC,GAAG,GAAGF,GAAG,CAACC,QAAQ,CAACC,GAAG,IAAI,IAAIH,GAAG,CAAC,CAAC;IAC/D;IACA,OAAOH,UAAU;EACnB;AACF,C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