1import { E as a, d as u, V as c, u as g, $ as d, c as h, b as f, o as l } from "./vue.runtime.esm-bundler-BJOiy3_W.js"; 2import { _ as m } from "./_plugin-vue_export-helper-CHgC5LLL.js"; 3const s = {}; 4function p(e) { 5 return Object.keys(e).reduce((r, t) => (e[t] !== !1 && e[t] !== null && e[t] !== void 0 && (r[t] = e[t]), r), {}); 6} 7const S = { 8 name: "InlineSvg", 9 inheritAttrs: !1, 10 render() { 11 return this.svgElSource ? a( 12 "svg", 13 Object.assign( 14 {}, 15 // source attrs 16 this.getSvgAttrs(this.svgElSource), 17 // component attrs and listeners 18 p(this.$attrs), 19 // content 20 { innerHTML: this.getSvgContent(this.svgElSource) } 21 ) 22 ) : null; 23 }, 24 props: { 25 src: { 26 type: String, 27 required: !0 28 }, 29 title: { 30 type: String 31 }, 32 transformSource: { 33 type: Function, 34 default: (e) => e 35 }, 36 keepDuringLoading: { 37 type: Boolean, 38 default: !0 39 } 40 }, 41 emits: ["loaded", "unloaded", "error"], 42 data() { 43 return { 44 /** @type {SVGElement} */ 45 svgElSource: null, 46 /** @type {XMLHttpRequest} */ 47 request: void 0 48 }; 49 }, 50 watch: { 51 src(e) {
52 this.getSource(e); 53 } 54 }, 55 mounted() { 56 this.getSource(this.src); 57 }, 58 methods: { 59 getSvgAttrs(e) { 60 let r = {}; 61 const t = e.attributes; 62 if (!t) 63 return r; 64 for (let n = t.length - 1; n >= 0; n--) 65 r[t[n].name] = t[n].value; 66 return r; 67 }, 68 getSvgContent(e) { 69 return e = e.cloneNode(!0), e = this.transformSource(e), this.title && v(e, this.title), e.innerHTML; 70 }, 71 /** 72 * Get svgElSource 73 * @param {string} src 74 */ 75 getSource(e) { 76 s[e] || (s[e] = this.download(e)), this.svgElSource && s[e].getIsPending() && !this.keepDuringLoading && (this.svgElSource = null, this.$emit("unloaded")), s[e].then((r) => { 77 this.svgElSource = r, this.$nextTick(() => { 78 this.$emit("loaded", this.$el); 79 }); 80 }).catch((r) => { 81 this.svgElSource && (this.svgElSource = null, this.$emit("unloaded")), delete s[e], this.$emit("error", r); 82 }); 83 }, 84 /** 85 * Get the contents of the SVG 86 * @param {string} url 87 * @returns {PromiseWithState<Element>} 88 */ 89 download(e) { 90 return E(new Promise((r, t) => { 91 const n = new XMLHttpRequest(); 92 n.open("GET", e, !0), this.request = n, n.onload = () => { 93 if (n.status >= 200 && n.status < 400) 94 try { 95 let o = new DOMParser().parseFromString(n.responseText, "text/xml").getElementsByTagName("svg")[0]; 96 o ? r(o) : t(new Error('Loaded file is not valid SVG"')); 97 } catch (i) { 98 t(i); 99 } 100 else 101 t(new Error("Error loading SVG")); 102 }, n.onerror = t, n.send(); 103 })); 104 } 105 } 106}; 107function v(e, r) { 108 const t = e.getElementsByTagName("title"); 109 if (t.length) 110 t[0].textContent = r; 111 else { 112 const n = document.createElementNS("http://www.w3.org/2000/svg", "title"); 113 n.textContent = r, e.insertBefore(n, e.firstChild); 114 } 115} 116function E(e) { 117 if (e.getIsPending) return e; 118 let r = !0, t = e.then( 119 (n) => (r = !1, n), 120 (n) => { 121 throw r = !1, n; 122 } 123 ); 124 return t.getIsPending = function() { 125 return r; 126 }, t; 127} 128const w = ["src"], P = /* @__PURE__ */ u({ 129 __name: "SvgIcon", 130 props: { 131 name: {}, 132 spin: { type: Boolean, default: !1 }, 133 inline: { type: Boolean, default: !0 } 134 }, 135 setup(e) { 136 const r = e, t = f(() => `/static/img/icon/${r.name}.svg`); 137 return (n, i) => e.inline ? (l(), c(g(S), d({ 138 key: 0, 139 class: { spinner: r.spin }, 140 src: t.value 141 }, n.$attrs), null, 16, ["class", "src"])) : (l(), h("img", { 142 key: 1, 143 src: t.value, 144 alt: "" 145 }, null, 8, w)); 146 } 147}), I = /* @__PURE__ */ m(P, [["__scopeId", "data-v-f1cf3ba6"]]); 148export { 149 I as S 150};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.