UNPKG

@artmate/chat

Version:

**开箱即用的AI组件库(基于 Vue3 + ElementPlus)**

2 lines (1 loc) 2.81 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./node_modules/@vueuse/shared/index.js"),d=require("vue"),S=n.isClient?window:void 0;function h(r){var c;const a=d.toValue(r);return(c=a==null?void 0:a.$el)!=null?c:a}function m(...r){const c=[],a=()=>{c.forEach(l=>l()),c.length=0},s=(l,o,i,f)=>(l.addEventListener(o,i,f),()=>l.removeEventListener(o,i,f)),p=d.computed(()=>{const l=n.toArray(d.toValue(r[0])).filter(o=>o!=null);return l.every(o=>typeof o!="string")?l:void 0}),E=n.watchImmediate(()=>{var l,o;return[(o=(l=p.value)==null?void 0:l.map(i=>h(i)))!=null?o:[S].filter(i=>i!=null),n.toArray(d.toValue(p.value?r[1]:r[0])),n.toArray(d.unref(p.value?r[2]:r[1])),d.toValue(p.value?r[3]:r[2])]},([l,o,i,f])=>{if(a(),!(l!=null&&l.length)||!(o!=null&&o.length)||!(i!=null&&i.length))return;const b=n.isObject(f)?{...f}:f;c.push(...l.flatMap(v=>o.flatMap(y=>i.map(A=>s(v,y,A,b)))))},{flush:"post"}),O=()=>{E(),a()};return n.tryOnScopeDispose(a),O}let P=!1;function C(r,c,a={}){const{window:s=S,ignore:p=[],capture:E=!0,detectIframe:O=!1,controls:l=!1}=a;if(!s)return l?{stop:n.noop,cancel:n.noop,trigger:n.noop}:n.noop;if(n.isIOS&&!P){P=!0;const e={passive:!0};Array.from(s.document.body.children).forEach(t=>m(t,"click",n.noop,e)),m(s.document.documentElement,"click",n.noop,e)}let o=!0;const i=e=>d.toValue(p).some(t=>{if(typeof t=="string")return Array.from(s.document.querySelectorAll(t)).some(u=>u===e.target||e.composedPath().includes(u));{const u=h(t);return u&&(e.target===u||e.composedPath().includes(u))}});function f(e){const t=d.toValue(e);return t&&t.$.subTree.shapeFlag===16}function b(e,t){const u=d.toValue(e),g=u.$.subTree&&u.$.subTree.children;return g==null||!Array.isArray(g)?!1:g.some(k=>k.el===t.target||t.composedPath().includes(k.el))}const v=e=>{const t=h(r);if(e.target!=null&&!(!(t instanceof Element)&&f(r)&&b(r,e))&&!(!t||t===e.target||e.composedPath().includes(t))){if("detail"in e&&e.detail===0&&(o=!i(e)),!o){o=!0;return}c(e)}};let y=!1;const A=[m(s,"click",e=>{y||(y=!0,setTimeout(()=>{y=!1},0),v(e))},{passive:!0,capture:E}),m(s,"pointerdown",e=>{const t=h(r);o=!i(e)&&!!(t&&!e.composedPath().includes(t))},{passive:!0}),O&&m(s,"blur",e=>{setTimeout(()=>{var t;const u=h(r);((t=s.document.activeElement)==null?void 0:t.tagName)==="IFRAME"&&!(u!=null&&u.contains(s.document.activeElement))&&c(e)},0)},{passive:!0})].filter(Boolean),I=()=>A.forEach(e=>e());return l?{stop:I,cancel:()=>{o=!1},trigger:e=>{o=!0,v(e),o=!1}}:I}exports.isClient=n.isClient;exports.isIOS=n.isIOS;exports.isObject=n.isObject;exports.noop=n.noop;exports.toArray=n.toArray;exports.tryOnScopeDispose=n.tryOnScopeDispose;exports.watchImmediate=n.watchImmediate;exports.defaultWindow=S;exports.onClickOutside=C;exports.unrefElement=h;exports.useEventListener=m;