2 lines
108 KiB
JavaScript
2 lines
108 KiB
JavaScript
|
(function(R,b,n){"use strict";function Pe(e,t,o){let l;n.isRef(o)?l={evaluating:o}:l=o||{};const{lazy:i=!1,evaluating:r=void 0,shallow:s=!0,onError:a=b.noop}=l,u=n.shallowRef(!i),f=s?n.shallowRef(t):n.ref(t);let c=0;return n.watchEffect(async d=>{if(!u.value)return;c++;const h=c;let m=!1;r&&Promise.resolve().then(()=>{r.value=!0});try{const v=await e(S=>{d(()=>{r&&(r.value=!1),m||S()})});h===c&&(f.value=v)}catch(v){a(v)}finally{r&&h===c&&(r.value=!1),m=!0}}),i?n.computed(()=>(u.value=!0,f.value)):f}function Ot(e,t,o,l){let i=n.inject(e);return o&&(i=n.inject(e,o)),l&&(i=n.inject(e,o,l)),typeof t=="function"?n.computed(r=>t(i,r)):n.computed({get:r=>t.get(i,r),set:t.set})}function kt(e={}){const{inheritAttrs:t=!0}=e,o=n.shallowRef(),l=n.defineComponent({setup(r,{slots:s}){return()=>{o.value=s.default}}}),i=n.defineComponent({inheritAttrs:t,props:e.props,setup(r,{attrs:s,slots:a}){return()=>{var u;if(!o.value&&process.env.NODE_ENV!=="production")throw new Error("[VueUse] Failed to find the definition of reusable template");const f=(u=o.value)==null?void 0:u.call(o,{...e.props==null?_t(s):r,$slots:a});return t&&f?.length===1?f[0]:f}}});return b.makeDestructurable({define:l,reuse:i},[l,i])}function _t(e){const t={};for(const o in e)t[b.camelize(o)]=e[o];return t}function Vt(e={}){let t=0;const o=n.ref([]);function l(...s){const a=n.shallowReactive({key:t++,args:s,promise:void 0,resolve:()=>{},reject:()=>{},isResolving:!1,options:e});return o.value.push(a),a.promise=new Promise((u,f)=>{a.resolve=c=>(a.isResolving=!0,u(c)),a.reject=f}).finally(()=>{a.promise=void 0;const u=o.value.indexOf(a);u!==-1&&o.value.splice(u,1)}),a.promise}function i(...s){return e.singleton&&o.value.length>0?o.value[0].promise:l(...s)}const r=n.defineComponent((s,{slots:a})=>{const u=()=>o.value.map(f=>{var c;return n.h(n.Fragment,{key:f.key},(c=a.default)==null?void 0:c.call(a,f))});return e.transition?()=>n.h(n.TransitionGroup,e.transition,u):u});return r.start=i,r}function Ft(e){return function(...t){return e.apply(this,t.map(o=>n.toValue(o)))}}const M=b.isClient?window:void 0,j=b.isClient?window.document:void 0,q=b.isClient?window.navigator:void 0,Pt=b.isClient?window.location:void 0;function N(e){var t;const o=n.toValue(e);return(t=o?.$el)!=null?t:o}function O(...e){const t=[],o=()=>{t.forEach(a=>a()),t.length=0},l=(a,u,f,c)=>(a.addEventListener(u,f,c),()=>a.removeEventListener(u,f,c)),i=n.computed(()=>{const a=b.toArray(n.toValue(e[0])).filter(u=>u!=null);return a.every(u=>typeof u!="string")?a:void 0}),r=b.watchImmediate(()=>{var a,u;return[(u=(a=i.value)==null?void 0:a.map(f=>N(f)))!=null?u:[M].filter(f=>f!=null),b.toArray(n.toValue(i.value?e[1]:e[0])),b.toArray(n.unref(i.value?e[2]:e[1])),n.toValue(i.value?e[3]:e[2])]},([a,u,f,c])=>{if(o(),!a?.length||!u?.length||!f?.length)return;const d=b.isObject(c)?{...c}:c;t.push(...a.flatMap(h=>u.flatMap(m=>f.map(v=>l(h,m,v,d)))))},{flush:"post"}),s=()=>{r(),o()};return b.tryOnScopeDispose(o),s}let Ce=!1;function Ct(e,t,o={}){const{window:l=M,ignore:i=[],capture:r=!0,detectIframe:s=!1,controls:a=!1}=o;if(!l)return a?{stop:b.noop,cancel:b.noop,trigger:b.noop}:b.noop;if(b.isIOS&&!Ce){Ce=!0;const p={passive:!0};Array.from(l.document.body.children).forEach(w=>O(w,"click",b.noop,p)),O(l.document.documentElement,"click",b.noop,p)}let u=!0;const f=p=>n.toValue(i).some(w=>{if(typeof w=="string")return Array.from(l.document.querySelectorAll(w)).some(y=>y===p.target||p.composedPath().includes(y));{const y=N(w);return y&&(p.target===y||p.composedPath().includes(y))}});function c(p){const w=n.toValue(p);return w&&w.$.subTree.shapeFlag===16}function d(p,w){const y=n.toValue(p),g=y.$.subTree&&y.$.subTree.children;return g==null||!Array.isArray(g)?!1:g.some(T=>T.el===w.target||w.composedPath().includes(T.el))}const h=p=>{const w=N(e);if(p.target!=null&&!(!(w instanceof Element)&&c(e)&&d(e,p))&&!(!w||w===p.target||p.composedPath().includes(w))){if("detail"in p&&p.detail===0&&(u=!f(p)),!u){u=!0;return}t(p)}};let m=!1;const v=[O(l,"click",p=>{m||(m=!0,setTimeout(()=>{m=!1},0),h(p))},{passive:!0,capture:r}),O(l,"pointerdo
|