全栈小学生 0e47055ccb v1.0.0-beta.1
2023-04-15 17:12:49 +08:00

2 lines
14 KiB
JavaScript

import{i as k,r as ee,e as M,t as T,f as ae,g as N,h as te,n as le,j as A,w as oe,c as se,k as ie}from"./index-f02197a7.js";import{w as I,c as j,r as b,u as ue,a as ce,s as fe,A as de,S as pe,K as ve}from"./runtime-core.esm-bundler-7c3fd514.js";function P(e){var t;const r=N(e);return(t=r==null?void 0:r.$el)!=null?t:r}const E=k?window:void 0,D=k?window.document:void 0,me=k?window.navigator:void 0;k&&window.location;function _(...e){let t,r,n,a;if(te(e[0])||Array.isArray(e[0])?([r,n,a]=e,t=E):[t,r,n,a]=e,!t)return le;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const u=[],o=()=>{u.forEach(d=>d()),u.length=0},l=(d,g,v)=>(d.addEventListener(g,v,a),()=>d.removeEventListener(g,v,a)),s=I(()=>P(t),d=>{o(),d&&u.push(...r.flatMap(g=>n.map(v=>l(d,g,v))))},{immediate:!0,flush:"post"}),f=()=>{s(),o()};return T(f),f}function Ye(e,t,r={}){const{window:n=E,ignore:a=[],capture:u=!0,detectIframe:o=!1}=r;if(!n)return;let l=!0,s;const f=c=>a.some(i=>{if(typeof i=="string")return Array.from(n.document.querySelectorAll(i)).some(p=>p===c.target||c.composedPath().includes(p));{const p=P(i);return p&&(c.target===p||c.composedPath().includes(p))}}),d=c=>{n.clearTimeout(s);const i=P(e);if(!(!i||i===c.target||c.composedPath().includes(i))){if(c.detail===0&&(l=!f(c)),!l){l=!0;return}t(c)}},g=[_(n,"click",d,{passive:!0,capture:u}),_(n,"pointerdown",c=>{const i=P(e);i&&(l=!c.composedPath().includes(i)&&!f(c))},{passive:!0}),_(n,"pointerup",c=>{if(c.button===0){const i=c.composedPath();c.composedPath=()=>i,s=n.setTimeout(()=>d(c),50)}},{passive:!0}),o&&_(n,"blur",c=>{var i;const p=P(e);((i=n.document.activeElement)==null?void 0:i.tagName)==="IFRAME"&&!(p!=null&&p.contains(n.document.activeElement))&&t(c)})].filter(Boolean);return()=>g.forEach(c=>c())}function R(e,t=!1){const r=b(),n=()=>r.value=Boolean(e());return n(),A(n,t),r}function ge(e,t={}){const{window:r=E}=t,n=R(()=>r&&"matchMedia"in r&&typeof r.matchMedia=="function");let a;const u=b(!1),o=()=>{a&&("removeEventListener"in a?a.removeEventListener("change",l):a.removeListener(l))},l=()=>{n.value&&(o(),a=r.matchMedia(ee(e).value),u.value=a.matches,"addEventListener"in a?a.addEventListener("change",l):a.addListener(l))};return ce(l),T(()=>o()),u}function Ze(e={}){const{navigator:t=me,read:r=!1,source:n,copiedDuring:a=1500,legacy:u=!1}=e,o=["copy","cut"],l=R(()=>t&&"clipboard"in t),s=j(()=>l.value||u),f=b(""),d=b(!1),g=se(()=>d.value=!1,a);function v(){l.value?t.clipboard.readText().then(m=>{f.value=m}):f.value=p()}if(s.value&&r)for(const m of o)_(m,v);async function c(m=N(n)){s.value&&m!=null&&(l.value?await t.clipboard.writeText(m):i(m),f.value=m,d.value=!0,g.start())}function i(m){const y=document.createElement("textarea");y.value=m??"",y.style.position="absolute",y.style.opacity="0",document.body.appendChild(y),y.select(),document.execCommand("copy"),y.remove()}function p(){var m,y,O;return(O=(y=(m=document==null?void 0:document.getSelection)==null?void 0:m.call(document))==null?void 0:y.toString())!=null?O:""}return{isSupported:s,text:f,copied:d,copy:c}}function he(e){return JSON.parse(JSON.stringify(e))}const L=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},z="__vueuse_ssr_handlers__";L[z]=L[z]||{};const ye=L[z];function re(e,t){return ye[e]||t}function be(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}var Oe=Object.defineProperty,V=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,W=(e,t,r)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Q=(e,t)=>{for(var r in t||(t={}))_e.call(t,r)&&W(e,r,t[r]);if(V)for(var r of V(t))we.call(t,r)&&W(e,r,t[r]);return e};const Se={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}};function Ee(e,t,r,n={}){var a;const{flush:u="pre",deep:o=!0,listenToStorageChanges:l=!0,writeDefaults:s=!0,mergeDefaults:f=!1,shallow:d,window:g=E,eventFilter:v,onError:c=h=>{console.error(h)}}=n,i=(d?fe:b)(t);if(!r)try{r=re("getDefaultStorage",()=>{var h;return(h=E)==null?void 0:h.localStorage})()}catch(h){c(h)}if(!r)return i;const p=N(t),m=be(p),y=(a=n.serializer)!=null?a:Se[m],{pause:O,resume:w}=oe(i,()=>F(i.value),{flush:u,deep:o,eventFilter:v});return g&&l&&_(g,"storage",x),x(),i;function F(h){try{if(h==null)r.removeItem(e);else{const S=y.write(h),$=r.getItem(e);$!==S&&(r.setItem(e,S),g&&(g==null||g.dispatchEvent(new StorageEvent("storage",{key:e,oldValue:$,newValue:S,storageArea:r}))))}}catch(S){c(S)}}function C(h){const S=h?h.newValue:r.getItem(e);if(S==null)return s&&p!==null&&r.setItem(e,y.write(p)),p;if(!h&&f){const $=y.read(S);return M(f)?f($,p):m==="object"&&!Array.isArray($)?Q(Q({},p),$):$}else return typeof S!="string"?S:y.read(S)}function x(h){if(!(h&&h.storageArea!==r)){if(h&&h.key==null){i.value=p;return}if(!(h&&h.key!==e)){O();try{i.value=C(h)}catch(S){c(S)}finally{h?de(w):w()}}}}}function ne(e){return ge("(prefers-color-scheme: dark)",e)}var Pe=Object.defineProperty,q=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,B=(e,t,r)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$e=(e,t)=>{for(var r in t||(t={}))Ie.call(t,r)&&B(e,r,t[r]);if(q)for(var r of q(t))Fe.call(t,r)&&B(e,r,t[r]);return e};function Ce(e={}){const{selector:t="html",attribute:r="class",initialValue:n="auto",window:a=E,storage:u,storageKey:o="vueuse-color-scheme",listenToStorageChanges:l=!0,storageRef:s,emitAuto:f}=e,d=$e({auto:"",light:"light",dark:"dark"},e.modes||{}),g=ne({window:a}),v=j(()=>g.value?"dark":"light"),c=s||(o==null?b(n):Ee(o,n,u,{window:a,listenToStorageChanges:l})),i=j({get(){return c.value==="auto"&&!f?v.value:c.value},set(O){c.value=O}}),p=re("updateHTMLAttrs",(O,w,F)=>{const C=a==null?void 0:a.document.querySelector(O);if(C)if(w==="class"){const x=F.split(/\s/g);Object.values(d).flatMap(h=>(h||"").split(/\s/g)).filter(Boolean).forEach(h=>{x.includes(h)?C.classList.add(h):C.classList.remove(h)})}else C.setAttribute(w,F)});function m(O){var w;const F=O==="auto"?v.value:O;p(t,r,(w=d[F])!=null?w:F)}function y(O){e.onChanged?e.onChanged(O,m):m(O)}return I(i,y,{flush:"post",immediate:!0}),f&&I(v,()=>y(i.value),{flush:"post"}),A(()=>y(i.value)),i}function et(e,t,{window:r=E,initialValue:n=""}={}){const a=b(n),u=j(()=>{var o;return P(t)||((o=r==null?void 0:r.document)==null?void 0:o.documentElement)});return I([u,()=>N(e)],([o,l])=>{var s;if(o&&r){const f=(s=r.getComputedStyle(o).getPropertyValue(l))==null?void 0:s.trim();a.value=f||n}},{immediate:!0}),I(a,o=>{var l;(l=u.value)!=null&&l.style&&u.value.style.setProperty(N(e),o)}),a}var je=Object.defineProperty,Ne=Object.defineProperties,Te=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,H=(e,t,r)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Me=(e,t)=>{for(var r in t||(t={}))Re.call(t,r)&&H(e,r,t[r]);if(J)for(var r of J(t))xe.call(t,r)&&H(e,r,t[r]);return e},ke=(e,t)=>Ne(e,Te(t));function tt(e={}){const{valueDark:t="dark",valueLight:r="",window:n=E}=e,a=Ce(ke(Me({},e),{onChanged:(l,s)=>{var f;e.onChanged?(f=e.onChanged)==null||f.call(e,l==="dark"):s(l)},modes:{dark:t,light:r}})),u=ne({window:n});return j({get(){return a.value==="dark"},set(l){l===u.value?a.value="auto":a.value=l?"dark":"light"}})}function rt({document:e=D}={}){if(!e)return b("visible");const t=b(e.visibilityState);return _(e,"visibilitychange",()=>{t.value=e.visibilityState}),t}var U=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,ze=(e,t)=>{var r={};for(var n in e)Ae.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&U)for(var n of U(e))t.indexOf(n)<0&&Le.call(e,n)&&(r[n]=e[n]);return r};function De(e,t,r={}){const n=r,{window:a=E}=n,u=ze(n,["window"]);let o;const l=R(()=>a&&"ResizeObserver"in a),s=()=>{o&&(o.disconnect(),o=void 0)},f=I(()=>P(e),g=>{s(),l.value&&a&&g&&(o=new ResizeObserver(t),o.observe(g,u))},{immediate:!0,flush:"post"}),d=()=>{s(),f()};return T(d),{isSupported:l,stop:d}}function nt(e,t={}){const{reset:r=!0,windowResize:n=!0,windowScroll:a=!0,immediate:u=!0}=t,o=b(0),l=b(0),s=b(0),f=b(0),d=b(0),g=b(0),v=b(0),c=b(0);function i(){const p=P(e);if(!p){r&&(o.value=0,l.value=0,s.value=0,f.value=0,d.value=0,g.value=0,v.value=0,c.value=0);return}const m=p.getBoundingClientRect();o.value=m.height,l.value=m.bottom,s.value=m.left,f.value=m.right,d.value=m.top,g.value=m.width,v.value=m.x,c.value=m.y}return De(e,i),I(()=>P(e),p=>!p&&i()),a&&_("scroll",i,{capture:!0,passive:!0}),n&&_("resize",i,{passive:!0}),A(()=>{u&&i()}),{height:o,bottom:l,left:s,right:f,top:d,width:g,x:v,y:c,update:i}}const K=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]];function at(e,t={}){const{document:r=D,autoExit:n=!1}=t,a=e||(r==null?void 0:r.querySelector("html")),u=b(!1);let o=K[0];const l=R(()=>{if(r){for(const p of K)if(p[1]in r)return o=p,!0}else return!1;return!1}),[s,f,d,,g]=o;async function v(){l.value&&(r!=null&&r[d]&&await r[f](),u.value=!1)}async function c(){if(!l.value)return;await v();const p=P(a);p&&(await p[s](),u.value=!0)}async function i(){u.value?await v():await c()}return r&&_(r,g,()=>{u.value=!!(r!=null&&r[d])},!1),n&&T(v),{isSupported:l,isFullscreen:u,enter:c,exit:v,toggle:i}}var G=Object.getOwnPropertySymbols,Ve=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,Qe=(e,t)=>{var r={};for(var n in e)Ve.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&G)for(var n of G(e))t.indexOf(n)<0&&We.call(e,n)&&(r[n]=e[n]);return r};function qe(e,t,r={}){const n=r,{window:a=E}=n,u=Qe(n,["window"]);let o;const l=R(()=>a&&"MutationObserver"in a),s=()=>{o&&(o.disconnect(),o=void 0)},f=I(()=>P(e),g=>{s(),l.value&&a&&g&&(o=new MutationObserver(t),o.observe(g,u))},{immediate:!0}),d=()=>{s(),f()};return T(d),{isSupported:l,stop:d}}var X;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(X||(X={}));function lt(){const e=b([]);return e.value.set=t=>{t&&e.value.push(t)},pe(()=>{e.value.length=0}),e}function ot(e=null,t={}){var r,n;const{document:a=D}=t,u=ee((r=e??(a==null?void 0:a.title))!=null?r:null),o=e&&M(e);function l(s){if(!("titleTemplate"in t))return s;const f=t.titleTemplate||"%s";return M(f)?f(s):ue(f).replace(/%s/g,s)}return I(u,(s,f)=>{s!==f&&a&&(a.title=l(te(s)?s:""))},{immediate:!0}),t.observe&&!t.titleTemplate&&a&&!o&&qe((n=a.head)==null?void 0:n.querySelector("title"),()=>{a&&a.title!==u.value&&(u.value=l(a.title))},{childList:!0}),u}var Be=Object.defineProperty,Y=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Z=(e,t,r)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ue=(e,t)=>{for(var r in t||(t={}))Je.call(t,r)&&Z(e,r,t[r]);if(Y)for(var r of Y(t))He.call(t,r)&&Z(e,r,t[r]);return e};const Ke={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};Ue({linear:ae},Ke);function st(e,t,r,n={}){var a,u,o;const{clone:l=!1,passive:s=!1,eventName:f,deep:d=!1,defaultValue:g}=n,v=ve(),c=r||(v==null?void 0:v.emit)||((a=v==null?void 0:v.$emit)==null?void 0:a.bind(v))||((o=(u=v==null?void 0:v.proxy)==null?void 0:u.$emit)==null?void 0:o.bind(v==null?void 0:v.proxy));let i=f;t||(t="modelValue"),i=f||i||`update:${t.toString()}`;const p=y=>l?M(l)?l(y):he(y):y,m=()=>ie(e[t])?p(e[t]):g;if(s){const y=m(),O=b(y);return I(()=>e[t],w=>O.value=p(w)),I(O,w=>{(w!==e[t]||d)&&c(i,w)},{deep:d}),O}else return j({get(){return m()},set(y){c(i,y)}})}function it({window:e=E}={}){if(!e)return b(!1);const t=b(e.document.hasFocus());return _(e,"blur",()=>{t.value=!1}),_(e,"focus",()=>{t.value=!0}),t}function ut(e={}){const{window:t=E,initialWidth:r=1/0,initialHeight:n=1/0,listenOrientation:a=!0,includeScrollbar:u=!0}=e,o=b(r),l=b(n),s=()=>{t&&(u?(o.value=t.innerWidth,l.value=t.innerHeight):(o.value=t.document.documentElement.clientWidth,l.value=t.document.documentElement.clientHeight))};return s(),A(s),_("resize",s,{passive:!0}),a&&_("orientationchange",s,{passive:!0}),{width:o,height:l}}export{ut as a,nt as b,_ as c,De as d,et as e,tt as f,at as g,ot as h,st as i,rt as j,it as k,Ze as l,lt as m,Ye as o,P as u};