zxq-com 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -40,6 +40,11 @@ export declare const EVENT_TYPE: {
40
40
  readonly DEV2: "dev-2";
41
41
  };
42
42
 
43
+ /**
44
+ * 自定义的svg图片转化为组件
45
+ * @example @assets/icon/avatar.svg
46
+ * <Icon icon="svg:avatar"></Icon>
47
+ */
43
48
  export declare function loadLocalSvgIcons(svgEagers: any): Promise<void>;
44
49
 
45
50
  declare function sendMsg(msg: WsMessage): void;
package/dist/zxq-com.js CHANGED
@@ -1106,18 +1106,6 @@ function useWs(i, N) {
1106
1106
  emit: z
1107
1107
  };
1108
1108
  }
1109
- var loaded = !1;
1110
- loaded ||= (loadSvgIcons(), !0);
1111
- async function loadSvgIcons() {
1112
- let i = import.meta.glob("@/assets/icon/*.svg", {
1113
- eager: !0,
1114
- query: "?raw"
1115
- });
1116
- await Promise.all(Object.entries(i).map((i) => {
1117
- let [N, P] = i, F = N.lastIndexOf("/") + 1, I = N.lastIndexOf(".");
1118
- return addIcon(`svg:${N.slice(F, I)}`, { ...parseSvg(typeof P == "object" ? P.default : P) });
1119
- }));
1120
- }
1121
1109
  async function loadLocalSvgIcons(i) {
1122
1110
  await Promise.all(Object.entries(i).map((i) => {
1123
1111
  let [N, P] = i, F = N.lastIndexOf("/") + 1, I = N.lastIndexOf(".");
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`@vueuse/core`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@vueuse/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ZxqCom={},e.Vue,e.VueUse))})(this,function(e,t,n){Object.defineProperty(e,`__esModule`,{value:!0});var r={class:`zxq-button`},i=(0,t.defineComponent)({name:`ZButton`,__name:`Button`,setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,r,[(0,t.renderSlot)(e.$slots,`default`)]))}}),a=/^[a-z0-9]+(-[a-z0-9]+)*$/,o=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!s(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!s(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!s(e,n)?null:e}return null},s=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,c=Object.freeze({left:0,top:0,width:16,height:16}),l=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),u=Object.freeze({...c,...l}),d=Object.freeze({...u,body:``,hidden:!1});function f(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function p(e,t){let n=f(e,t);for(let r in d)r in l?r in e&&!(r in n)&&(n[r]=l[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function m(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}function h(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=p(r[e]||i[e],a)}return o(t),n.forEach(o),p(e,a)}function g(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=m(e);for(let i in r){let a=r[i];a&&(t(i,h(e,i,a)),n.push(i))}return n}var ee={provider:``,aliases:{},not_found:{},...c};function _(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function v(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!_(e,ee))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!_(t,d))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!_(t,d))return null}return t}var y=Object.create(null);function b(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function x(e,t){let n=y[e]||(y[e]=Object.create(null));return n[t]||(n[t]=b(e,t))}function te(e,t){return v(t)?g(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ne(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var S=!1;function C(e){return typeof e==`boolean`&&(S=e),S}function re(e){let t=typeof e==`string`?o(e,!0,S):e;if(t){let e=x(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function w(e,t){let n=o(e,!0,S);if(!n)return!1;let r=x(n.provider,n.prefix);return t?ne(r,n.name,t):(r.missing.add(n.name),!0)}function ie(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),S&&!t&&!e.prefix){let t=!1;return v(e)&&(e.prefix=``,g(e,(e,n)=>{w(e,n)&&(t=!0)})),t}let n=e.prefix;return s({prefix:n,name:`a`})?!!te(x(t,n),e):!1}var T=Object.freeze({width:null,height:null}),E=Object.freeze({...T,...l}),ae=/(-?[0-9.]*[0-9]+[0-9.]*)/g,oe=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function D(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(ae);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=oe.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function se(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function ce(e,t){return e?`<defs>`+e+`</defs>`+t:t}function le(e,t,n){let r=se(e);return ce(r.defs,t+r.content+n)}var ue=e=>e===`unset`||e===`undefined`||e===`none`;function de(e,t){let n={...u,...e},r={...E,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=le(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,d,f;o===null?(f=s===null?`1em`:s===`auto`?l:s,d=D(f,c/l)):(d=o===`auto`?c:o,f=s===null?D(d,l/c):s===`auto`?l:s);let p={},m=(e,t)=>{ue(t)||(p[e]=t.toString())};m(`width`,d),m(`height`,f);let h=[i.left,i.top,c,l];return p.viewBox=h.join(` `),{attributes:p,viewBox:h,body:a}}var fe=/\sid="(\S+)"/g,pe=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),me=0;function he(e,t=pe){let n=[],r;for(;r=fe.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(me++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var O=Object.create(null);function ge(e,t){O[e]=t}function k(e){return O[e]||O[``]}function A(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||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var j=Object.create(null),M=[`https://api.simplesvg.com`,`https://api.unisvg.com`],N=[];M.length>0;)M.length===1||Math.random()>.5?N.push(M.shift()):N.push(M.pop());j[``]=A({resources:[`https://api.iconify.design`].concat(N)});function _e(e,t){let n=A(t);return n===null?!1:(j[e]=n,!0)}function P(e){return j[e]}var F=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function ve(e,t){let n=P(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{let n=t;e=Math.max(e,n.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function ye(e){return e===404}var be=(e,t,n)=>{let r=[],i=ve(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function xe(e){if(typeof e==`string`){let t=P(e);if(t)return t.path}return`/`}var Se={prepare:be,send:(e,t,n)=>{if(!F){n(`abort`,424);return}let r=xe(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;F(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(ye(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function Ce(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=x(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function we(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Te(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||we([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var Ee=0;function De(e,t,n){let r=Ee++,i=we.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function Oe(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?o(e,t,n):e;i&&r.push(i)}),r}var ke={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ae(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function ee(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function _(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function v(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function y(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,_();return}if(i){u=r,f.length||(o.length?b():_());return}if(m(),v(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function b(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(v(),_())},e.timeout);return}_();return}let i={status:`pending`,resource:r,callback:(e,t)=>{y(i,e,t)}};f.push(i),l++,d=setTimeout(b,e.rotate),n(r,t,i.callback)}return setTimeout(b),ee}function je(e){let t={...ke,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=Ae(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function Me(){}var I=Object.create(null);function Ne(e){if(!I[e]){let t=P(e);if(!t)return;I[e]={config:t,redundancy:je(t)}}return I[e]}function Pe(e,t,n){let r,i;if(typeof e==`string`){let t=k(e);if(!t)return n(void 0,424),Me;i=t.send;let a=Ne(e);a&&(r=a.redundancy)}else{let t=A(e);if(t){r=je(t);let n=k(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),Me):r.query(t,i,n)().abort}function L(){}function Fe(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Te(e)}))}function Ie(e){let t=[],n=[];return e.forEach(e=>{(e.match(a)?t:n).push(e)}),{valid:t,invalid:n}}function R(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!te(e,n).length){r();return}}catch(e){console.error(e)}r(),Fe(e)}function z(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Le(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){z(e.loadIcons(r,n,t),t=>{R(e,r,t)});return}if(i){r.forEach(r=>{z(i(r,n,t),t=>{R(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:o,invalid:s}=Ie(r);if(s.length&&R(e,s,null),!o.length)return;let c=n.match(a)?k(t):null;if(!c){R(e,o,null);return}c.prepare(t,n,o).forEach(n=>{Pe(t,n,t=>{R(e,n.icons,t)})})}))}var Re=(e,t)=>{let n=Ce(Oe(e,!0,C()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,L)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(x(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=x(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&Le(e,t)}),t?De(t,n,i):L};function ze(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in T?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Be=/[\s,]+/;function Ve(e,t){t.split(Be).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function He(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function Ue(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function We(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function Ge(e){return`data:image/svg+xml,`+We(e)}function Ke(e){return`url("`+Ge(e)+`")`}var B={...E,inline:!1},qe={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Je={display:`inline-block`},V={backgroundColor:`currentColor`},H={backgroundColor:`transparent`},U={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},W={webkitMask:V,mask:V,background:H};for(let e in W){let t=W[e];for(let n in U)t[e+n]=U[n]}var G={};[`horizontal`,`vertical`].forEach(e=>{let t=e.slice(0,1)+`Flip`;G[e+`-flip`]=t,G[e.slice(0,1)+`-flip`]=t,G[e+`Flip`]=t});function K(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var q=(e,n)=>{let r=ze(B,n),i={...qe},a=n.mode||`svg`,o={},s=n.style,c=typeof s==`object`&&!(s instanceof Array)?s:{};for(let e in n){let t=n[e];if(t!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:break;case`inline`:case`hFlip`:case`vFlip`:r[e]=t===!0||t===`true`||t===1;break;case`flip`:typeof t==`string`&&Ve(r,t);break;case`color`:o.color=t;break;case`rotate`:typeof t==`string`?r[e]=He(t):typeof t==`number`&&(r[e]=t);break;case`ariaHidden`:case`aria-hidden`:t!==!0&&t!==`true`&&delete i[`aria-hidden`];break;default:{let n=G[e];n?(t===!0||t===`true`||t===1)&&(r[n]=!0):B[e]===void 0&&(i[e]=t)}}}let l=de(e,r),u=l.attributes;if(r.inline&&(o.verticalAlign=`-0.125em`),a===`svg`){i.style={...o,...c},Object.assign(i,u);let e=0,r=n.id;return typeof r==`string`&&(r=r.replace(/-/g,`_`)),i.innerHTML=he(l.body,r?()=>r+`ID`+ e++:`iconifyVue`),(0,t.h)(`svg`,i)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=Ue(d,{...u,width:f+``,height:p+``});return i.style={...o,"--svg":Ke(h),width:K(u.width),height:K(u.height),...Je,...m?V:H,...c},(0,t.h)(`span`,i)};if(C(!0),ge(``,Se),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!ie(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;_e(e,r)||console.error(n)}catch{console.error(n)}}}}var Ye={...u,body:``},Xe=(0,t.defineComponent)((e,{emit:n})=>{let r=(0,t.ref)(null);function i(){r.value&&=(r.value.abort?.(),null)}let a=(0,t.ref)(!!e.ssr),s=(0,t.ref)(``),c=(0,t.shallowRef)(null);function l(){let a=e.icon;if(typeof a==`object`&&a&&typeof a.body==`string`)return s.value=``,{data:a};let c;if(typeof a!=`string`||(c=o(a,!1,!0))===null)return null;let l=re(c);if(!l){let e=r.value;return(!e||e.name!==a)&&(l===null?r.value={name:a}:r.value={name:a,abort:Re([c],d)}),null}i(),s.value!==a&&(s.value=a,(0,t.nextTick)(()=>{n(`load`,a)}));let u=e.customise;if(u){l=Object.assign({},l);let e=u(l.body,c.name,c.prefix,c.provider);typeof e==`string`&&(l.body=e)}let f=[`iconify`];return c.prefix!==``&&f.push(`iconify--`+c.prefix),c.provider!==``&&f.push(`iconify--`+c.provider),{data:l,classes:f}}function d(){let e=l();e?e.data!==c.value?.data&&(c.value=e):c.value=null}return a.value?d():(0,t.onMounted)(()=>{a.value=!0,d()}),(0,t.watch)(()=>e.icon,d),(0,t.onUnmounted)(i),()=>{let t=c.value;if(!t)return q(Ye,e);let n=e;return t.classes&&(n={...e,class:t.classes.join(` `)}),q({...u,...t.data},n)}},{props:[`icon`,`mode`,`ssr`,`width`,`height`,`style`,`color`,`inline`,`rotate`,`hFlip`,`horizontalFlip`,`vFlip`,`verticalFlip`,`flip`,`id`,`ariaHidden`,`customise`,`title`],emits:[`load`]}),J=(0,t.defineComponent)({name:`ZIcon`,__name:`Icon`,props:{icon:{}},setup(e){let n=e,r=(0,t.computed)(()=>typeof n.icon==`string`);return(n,i)=>r.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Xe),{key:0,icon:e.icon},null,8,[`icon`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.icon),{key:1}))}});function Ze(e=``){return e+(crypto?.randomUUID?.()||`${Date.now()}_${Math.random().toString(16).slice(2)}`)}function Y(...e){console.log(`【zxqWs】`,...e)}let Qe={DEV1:`dev-1`,DEV2:`dev-2`};var X=(0,t.ref)(),{status:Z,data:$e,send:et,close:tt,open:Q}=(0,n.useWebSocket)(X,{immediate:!1,autoConnect:!1,heartbeat:{message:`ping`,interval:5e3,pongTimeout:15e3},autoReconnect:{retries:3,delay:1e4,onFailed(){console.error(`超过重连次数`)}}});function nt(e){et(JSON.stringify(e))}let rt={sendMsg:nt,close:tt,status:Z};var $=new Map;function it(e,n){X.value||(X.value=n.url,Q()),(0,t.watch)(Z,e=>{Y(`ws status`,e)}),(0,t.watch)($e,e=>{if(e!==`pong`)try{let{sourceIp:t,event:r,payload:i}=JSON.parse(e);if(n?.trustIp&&t!==n.trustIp)return;let a=$.get(r);a&&a.forEach(({fn:e,off:t})=>{e(i),t&&t()})}catch(e){console.error(`ws 数据格式有误`,e)}})}function at(e,n){n&&it(null,n),Z.value===`CLOSED`&&X.value&&Q();let r=Ze();function i(t){Y(`ws on`);let n=$.get(e);if(n)n.set(r,{fn:t});else{let n=new Map().set(r,{fn:t});$.set(e,n)}}function a(){Y(`ws off`);let t=$.get(e);t&&t.has(r)&&(t.delete(r),t.size===0&&$.delete(e))}function o(t){Y(`ws once`);let n=$.get(e);if(n)n.set(r,{fn:t});else{let n=new Map().set(r,{fn:t,off:a});$.set(e,n)}}(0,t.onBeforeUnmount)(()=>{a()});function s(e){nt(e)}return{on:i,off:a,once:o,emit:s}}var ot=!1;ot||=(st(),!0);async function st(){let e={}.glob(`@/assets/icon/*.svg`,{eager:!0,query:`?raw`});await Promise.all(Object.entries(e).map(e=>{let[t,n]=e,r=t.lastIndexOf(`/`)+1,i=t.lastIndexOf(`.`);return w(`svg:${t.slice(r,i)}`,{...lt(typeof n==`object`?n.default:n)})}))}async function ct(e){await Promise.all(Object.entries(e).map(e=>{let[t,n]=e,r=t.lastIndexOf(`/`)+1,i=t.lastIndexOf(`.`);return w(`svg:${t.slice(r,i)}`,{...lt(typeof n==`object`?n.default:n)})}))}function lt(e){let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,n=[...t.childNodes].filter(e=>e.nodeType===Node.ELEMENT_NODE).map(e=>new XMLSerializer().serializeToString(e)).join(``),[r,i,a,o]=(t.getAttribute(`viewBox`)||``).split(` `).map(e=>{let t=Number(e);return Number.isNaN(t)?void 0:t});return{body:n,height:o,left:r,top:i,width:a}}var ut=[i,J];e.EVENT_TYPE=Qe,e.ZButton=i,e.ZIcon=J,e.default={install(e){ut.forEach(t=>{e.component(t.name,t)})}},e.loadLocalSvgIcons=ct,e.useWs=at,e.ws=rt,e.zwqWs=it});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`@vueuse/core`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@vueuse/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ZxqCom={},e.Vue,e.VueUse))})(this,function(e,t,n){Object.defineProperty(e,`__esModule`,{value:!0});var r={class:`zxq-button`},i=(0,t.defineComponent)({name:`ZButton`,__name:`Button`,setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,r,[(0,t.renderSlot)(e.$slots,`default`)]))}}),a=/^[a-z0-9]+(-[a-z0-9]+)*$/,o=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!s(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!s(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!s(e,n)?null:e}return null},s=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,c=Object.freeze({left:0,top:0,width:16,height:16}),l=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),u=Object.freeze({...c,...l}),d=Object.freeze({...u,body:``,hidden:!1});function f(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function p(e,t){let n=f(e,t);for(let r in d)r in l?r in e&&!(r in n)&&(n[r]=l[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function m(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}function h(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=p(r[e]||i[e],a)}return o(t),n.forEach(o),p(e,a)}function g(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=m(e);for(let i in r){let a=r[i];a&&(t(i,h(e,i,a)),n.push(i))}return n}var ee={provider:``,aliases:{},not_found:{},...c};function _(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function v(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!_(e,ee))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!_(t,d))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!_(t,d))return null}return t}var y=Object.create(null);function b(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function x(e,t){let n=y[e]||(y[e]=Object.create(null));return n[t]||(n[t]=b(e,t))}function te(e,t){return v(t)?g(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ne(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var S=!1;function C(e){return typeof e==`boolean`&&(S=e),S}function re(e){let t=typeof e==`string`?o(e,!0,S):e;if(t){let e=x(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function w(e,t){let n=o(e,!0,S);if(!n)return!1;let r=x(n.provider,n.prefix);return t?ne(r,n.name,t):(r.missing.add(n.name),!0)}function ie(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),S&&!t&&!e.prefix){let t=!1;return v(e)&&(e.prefix=``,g(e,(e,n)=>{w(e,n)&&(t=!0)})),t}let n=e.prefix;return s({prefix:n,name:`a`})?!!te(x(t,n),e):!1}var T=Object.freeze({width:null,height:null}),E=Object.freeze({...T,...l}),ae=/(-?[0-9.]*[0-9]+[0-9.]*)/g,oe=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function D(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(ae);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=oe.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function se(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function ce(e,t){return e?`<defs>`+e+`</defs>`+t:t}function le(e,t,n){let r=se(e);return ce(r.defs,t+r.content+n)}var ue=e=>e===`unset`||e===`undefined`||e===`none`;function de(e,t){let n={...u,...e},r={...E,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=le(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,d,f;o===null?(f=s===null?`1em`:s===`auto`?l:s,d=D(f,c/l)):(d=o===`auto`?c:o,f=s===null?D(d,l/c):s===`auto`?l:s);let p={},m=(e,t)=>{ue(t)||(p[e]=t.toString())};m(`width`,d),m(`height`,f);let h=[i.left,i.top,c,l];return p.viewBox=h.join(` `),{attributes:p,viewBox:h,body:a}}var fe=/\sid="(\S+)"/g,pe=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),me=0;function he(e,t=pe){let n=[],r;for(;r=fe.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(me++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var O=Object.create(null);function ge(e,t){O[e]=t}function k(e){return O[e]||O[``]}function A(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||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var j=Object.create(null),M=[`https://api.simplesvg.com`,`https://api.unisvg.com`],N=[];M.length>0;)M.length===1||Math.random()>.5?N.push(M.shift()):N.push(M.pop());j[``]=A({resources:[`https://api.iconify.design`].concat(N)});function _e(e,t){let n=A(t);return n===null?!1:(j[e]=n,!0)}function P(e){return j[e]}var ve=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function ye(e,t){let n=P(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{let n=t;e=Math.max(e,n.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function be(e){return e===404}var xe=(e,t,n)=>{let r=[],i=ye(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function Se(e){if(typeof e==`string`){let t=P(e);if(t)return t.path}return`/`}var Ce={prepare:xe,send:(e,t,n)=>{if(!ve){n(`abort`,424);return}let r=Se(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;ve(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(be(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function we(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=x(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function Te(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Ee(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||Te([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var De=0;function Oe(e,t,n){let r=De++,i=Te.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function ke(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?o(e,t,n):e;i&&r.push(i)}),r}var Ae={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function je(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function ee(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function _(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function v(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function y(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,_();return}if(i){u=r,f.length||(o.length?b():_());return}if(m(),v(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function b(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(v(),_())},e.timeout);return}_();return}let i={status:`pending`,resource:r,callback:(e,t)=>{y(i,e,t)}};f.push(i),l++,d=setTimeout(b,e.rotate),n(r,t,i.callback)}return setTimeout(b),ee}function F(e){let t={...Ae,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=je(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function I(){}var L=Object.create(null);function Me(e){if(!L[e]){let t=P(e);if(!t)return;L[e]={config:t,redundancy:F(t)}}return L[e]}function Ne(e,t,n){let r,i;if(typeof e==`string`){let t=k(e);if(!t)return n(void 0,424),I;i=t.send;let a=Me(e);a&&(r=a.redundancy)}else{let t=A(e);if(t){r=F(t);let n=k(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),I):r.query(t,i,n)().abort}function R(){}function Pe(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Ee(e)}))}function Fe(e){let t=[],n=[];return e.forEach(e=>{(e.match(a)?t:n).push(e)}),{valid:t,invalid:n}}function z(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!te(e,n).length){r();return}}catch(e){console.error(e)}r(),Pe(e)}function B(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Ie(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){B(e.loadIcons(r,n,t),t=>{z(e,r,t)});return}if(i){r.forEach(r=>{B(i(r,n,t),t=>{z(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:o,invalid:s}=Fe(r);if(s.length&&z(e,s,null),!o.length)return;let c=n.match(a)?k(t):null;if(!c){z(e,o,null);return}c.prepare(t,n,o).forEach(n=>{Ne(t,n,t=>{z(e,n.icons,t)})})}))}var Le=(e,t)=>{let n=we(ke(e,!0,C()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,R)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(x(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=x(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&Ie(e,t)}),t?Oe(t,n,i):R};function Re(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in T?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var ze=/[\s,]+/;function Be(e,t){t.split(ze).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function Ve(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function He(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function Ue(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function We(e){return`data:image/svg+xml,`+Ue(e)}function Ge(e){return`url("`+We(e)+`")`}var V={...E,inline:!1},Ke={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},qe={display:`inline-block`},H={backgroundColor:`currentColor`},U={backgroundColor:`transparent`},W={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},G={webkitMask:H,mask:H,background:U};for(let e in G){let t=G[e];for(let n in W)t[e+n]=W[n]}var K={};[`horizontal`,`vertical`].forEach(e=>{let t=e.slice(0,1)+`Flip`;K[e+`-flip`]=t,K[e.slice(0,1)+`-flip`]=t,K[e+`Flip`]=t});function q(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var J=(e,n)=>{let r=Re(V,n),i={...Ke},a=n.mode||`svg`,o={},s=n.style,c=typeof s==`object`&&!(s instanceof Array)?s:{};for(let e in n){let t=n[e];if(t!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:break;case`inline`:case`hFlip`:case`vFlip`:r[e]=t===!0||t===`true`||t===1;break;case`flip`:typeof t==`string`&&Be(r,t);break;case`color`:o.color=t;break;case`rotate`:typeof t==`string`?r[e]=Ve(t):typeof t==`number`&&(r[e]=t);break;case`ariaHidden`:case`aria-hidden`:t!==!0&&t!==`true`&&delete i[`aria-hidden`];break;default:{let n=K[e];n?(t===!0||t===`true`||t===1)&&(r[n]=!0):V[e]===void 0&&(i[e]=t)}}}let l=de(e,r),u=l.attributes;if(r.inline&&(o.verticalAlign=`-0.125em`),a===`svg`){i.style={...o,...c},Object.assign(i,u);let e=0,r=n.id;return typeof r==`string`&&(r=r.replace(/-/g,`_`)),i.innerHTML=he(l.body,r?()=>r+`ID`+ e++:`iconifyVue`),(0,t.h)(`svg`,i)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=He(d,{...u,width:f+``,height:p+``});return i.style={...o,"--svg":Ge(h),width:q(u.width),height:q(u.height),...qe,...m?H:U,...c},(0,t.h)(`span`,i)};if(C(!0),ge(``,Ce),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!ie(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;_e(e,r)||console.error(n)}catch{console.error(n)}}}}var Je={...u,body:``},Ye=(0,t.defineComponent)((e,{emit:n})=>{let r=(0,t.ref)(null);function i(){r.value&&=(r.value.abort?.(),null)}let a=(0,t.ref)(!!e.ssr),s=(0,t.ref)(``),c=(0,t.shallowRef)(null);function l(){let a=e.icon;if(typeof a==`object`&&a&&typeof a.body==`string`)return s.value=``,{data:a};let c;if(typeof a!=`string`||(c=o(a,!1,!0))===null)return null;let l=re(c);if(!l){let e=r.value;return(!e||e.name!==a)&&(l===null?r.value={name:a}:r.value={name:a,abort:Le([c],d)}),null}i(),s.value!==a&&(s.value=a,(0,t.nextTick)(()=>{n(`load`,a)}));let u=e.customise;if(u){l=Object.assign({},l);let e=u(l.body,c.name,c.prefix,c.provider);typeof e==`string`&&(l.body=e)}let f=[`iconify`];return c.prefix!==``&&f.push(`iconify--`+c.prefix),c.provider!==``&&f.push(`iconify--`+c.provider),{data:l,classes:f}}function d(){let e=l();e?e.data!==c.value?.data&&(c.value=e):c.value=null}return a.value?d():(0,t.onMounted)(()=>{a.value=!0,d()}),(0,t.watch)(()=>e.icon,d),(0,t.onUnmounted)(i),()=>{let t=c.value;if(!t)return J(Je,e);let n=e;return t.classes&&(n={...e,class:t.classes.join(` `)}),J({...u,...t.data},n)}},{props:[`icon`,`mode`,`ssr`,`width`,`height`,`style`,`color`,`inline`,`rotate`,`hFlip`,`horizontalFlip`,`vFlip`,`verticalFlip`,`flip`,`id`,`ariaHidden`,`customise`,`title`],emits:[`load`]}),Y=(0,t.defineComponent)({name:`ZIcon`,__name:`Icon`,props:{icon:{}},setup(e){let n=e,r=(0,t.computed)(()=>typeof n.icon==`string`);return(n,i)=>r.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ye),{key:0,icon:e.icon},null,8,[`icon`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.icon),{key:1}))}});function Xe(e=``){return e+(crypto?.randomUUID?.()||`${Date.now()}_${Math.random().toString(16).slice(2)}`)}function X(...e){console.log(`【zxqWs】`,...e)}let Ze={DEV1:`dev-1`,DEV2:`dev-2`};var Z=(0,t.ref)(),{status:Q,data:Qe,send:$e,close:et,open:tt}=(0,n.useWebSocket)(Z,{immediate:!1,autoConnect:!1,heartbeat:{message:`ping`,interval:5e3,pongTimeout:15e3},autoReconnect:{retries:3,delay:1e4,onFailed(){console.error(`超过重连次数`)}}});function nt(e){$e(JSON.stringify(e))}let rt={sendMsg:nt,close:et,status:Q};var $=new Map;function it(e,n){Z.value||(Z.value=n.url,tt()),(0,t.watch)(Q,e=>{X(`ws status`,e)}),(0,t.watch)(Qe,e=>{if(e!==`pong`)try{let{sourceIp:t,event:r,payload:i}=JSON.parse(e);if(n?.trustIp&&t!==n.trustIp)return;let a=$.get(r);a&&a.forEach(({fn:e,off:t})=>{e(i),t&&t()})}catch(e){console.error(`ws 数据格式有误`,e)}})}function at(e,n){n&&it(null,n),Q.value===`CLOSED`&&Z.value&&tt();let r=Xe();function i(t){X(`ws on`);let n=$.get(e);if(n)n.set(r,{fn:t});else{let n=new Map().set(r,{fn:t});$.set(e,n)}}function a(){X(`ws off`);let t=$.get(e);t&&t.has(r)&&(t.delete(r),t.size===0&&$.delete(e))}function o(t){X(`ws once`);let n=$.get(e);if(n)n.set(r,{fn:t});else{let n=new Map().set(r,{fn:t,off:a});$.set(e,n)}}(0,t.onBeforeUnmount)(()=>{a()});function s(e){nt(e)}return{on:i,off:a,once:o,emit:s}}async function ot(e){await Promise.all(Object.entries(e).map(e=>{let[t,n]=e,r=t.lastIndexOf(`/`)+1,i=t.lastIndexOf(`.`);return w(`svg:${t.slice(r,i)}`,{...st(typeof n==`object`?n.default:n)})}))}function st(e){let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,n=[...t.childNodes].filter(e=>e.nodeType===Node.ELEMENT_NODE).map(e=>new XMLSerializer().serializeToString(e)).join(``),[r,i,a,o]=(t.getAttribute(`viewBox`)||``).split(` `).map(e=>{let t=Number(e);return Number.isNaN(t)?void 0:t});return{body:n,height:o,left:r,top:i,width:a}}var ct=[i,Y];e.EVENT_TYPE=Ze,e.ZButton=i,e.ZIcon=Y,e.default={install(e){ct.forEach(t=>{e.component(t.name,t)})}},e.loadLocalSvgIcons=ot,e.useWs=at,e.ws=rt,e.zwqWs=it});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zxq-com",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/zxq-com.umd.cjs",
6
6
  "module": "./dist/zxq-com.js",