CloudGamingAdmin/admin-client/dist/static/js/index-C9_-VgcV.js
2024-11-15 02:58:48 +08:00

2 lines
3.9 KiB
JavaScript

import{b as k,aA as r,aB as A,aC as W,l as x,aD as _,aE as $,n as I,aF as O,e as P,az as X}from"./index-D2_T1wn8.js";const L=A?window:void 0,Y=A?window.document:void 0;function q(a){var l;const n=r(a);return(l=n==null?void 0:n.$el)!=null?l:n}function S(...a){let l,n,f,u;if(typeof a[0]=="string"||Array.isArray(a[0])?([n,f,u]=a,l=L):[l,n,f,u]=a,!l)return $;Array.isArray(n)||(n=[n]),Array.isArray(f)||(f=[f]);const s=[],g=()=>{s.forEach(i=>i()),s.length=0},d=(i,p,o,c)=>(i.addEventListener(p,o,c),()=>i.removeEventListener(p,o,c)),v=I(()=>[q(l),r(u)],([i,p])=>{if(g(),!i)return;const o=O(p)?{...p}:p;s.push(...n.flatMap(c=>f.map(F=>d(i,c,F,o))))},{immediate:!0,flush:"post"}),E=()=>{v(),g()};return _(E),E}function j(){const a=k(!1),l=X();return l&&P(()=>{a.value=!0},l),a}function G(a){const l=j();return x(()=>(l.value,!!a()))}function K(a,l={}){var n,f;const{pointerTypes:u,preventDefault:s,stopPropagation:g,exact:d,onMove:v,onEnd:E,onStart:i,initialValue:p,axis:o="both",draggingElement:c=L,containerElement:F,handle:C=a,buttons:M=[0]}=l,e=k((n=r(p))!=null?n:{x:0,y:0}),b=k(),R=t=>u?u.includes(t.pointerType):!0,D=t=>{r(s)&&t.preventDefault(),r(g)&&t.stopPropagation()},H=t=>{var w;if(!r(M).includes(t.button)||r(l.disabled)||!R(t)||r(d)&&t.target!==r(a))return;const m=r(F),y=(w=m==null?void 0:m.getBoundingClientRect)==null?void 0:w.call(m),h=r(a).getBoundingClientRect(),z={x:t.clientX-(m?h.left-y.left+m.scrollLeft:h.left),y:t.clientY-(m?h.top-y.top+m.scrollTop:h.top)};(i==null?void 0:i(z,t))!==!1&&(b.value=z,D(t))},T=t=>{if(r(l.disabled)||!R(t)||!b.value)return;const w=r(F),m=r(a).getBoundingClientRect();let{x:y,y:h}=e.value;(o==="x"||o==="both")&&(y=t.clientX-b.value.x,w&&(y=Math.min(Math.max(0,y),w.scrollWidth-m.width))),(o==="y"||o==="both")&&(h=t.clientY-b.value.y,w&&(h=Math.min(Math.max(0,h),w.scrollHeight-m.height))),e.value={x:y,y:h},v==null||v(e.value,t),D(t)},V=t=>{r(l.disabled)||!R(t)||b.value&&(b.value=void 0,E==null||E(e.value,t),D(t))};if(A){const t={capture:(f=l.capture)!=null?f:!0};S(C,"pointerdown",H,t),S(c,"pointermove",T,t),S(c,"pointerup",V,t)}return{...W(e),position:e,isDragging:x(()=>!!b.value),style:x(()=>`left:${e.value.x}px;top:${e.value.y}px;`)}}const B=["fullscreenchange","webkitfullscreenchange","webkitendfullscreen","mozfullscreenchange","MSFullscreenChange"];function N(a,l={}){const{document:n=Y,autoExit:f=!1}=l,u=x(()=>{var e;return(e=q(a))!=null?e:n==null?void 0:n.querySelector("html")}),s=k(!1),g=x(()=>["requestFullscreen","webkitRequestFullscreen","webkitEnterFullscreen","webkitEnterFullScreen","webkitRequestFullScreen","mozRequestFullScreen","msRequestFullscreen"].find(e=>n&&e in n||u.value&&e in u.value)),d=x(()=>["exitFullscreen","webkitExitFullscreen","webkitExitFullScreen","webkitCancelFullScreen","mozCancelFullScreen","msExitFullscreen"].find(e=>n&&e in n||u.value&&e in u.value)),v=x(()=>["fullScreen","webkitIsFullScreen","webkitDisplayingFullscreen","mozFullScreen","msFullscreenElement"].find(e=>n&&e in n||u.value&&e in u.value)),E=["fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement"].find(e=>n&&e in n),i=G(()=>u.value&&n&&g.value!==void 0&&d.value!==void 0&&v.value!==void 0),p=()=>E?(n==null?void 0:n[E])===u.value:!1,o=()=>{if(v.value){if(n&&n[v.value]!=null)return n[v.value];{const e=u.value;if((e==null?void 0:e[v.value])!=null)return!!e[v.value]}}return!1};async function c(){if(!(!i.value||!s.value)){if(d.value)if((n==null?void 0:n[d.value])!=null)await n[d.value]();else{const e=u.value;(e==null?void 0:e[d.value])!=null&&await e[d.value]()}s.value=!1}}async function F(){if(!i.value||s.value)return;o()&&await c();const e=u.value;g.value&&(e==null?void 0:e[g.value])!=null&&(await e[g.value](),s.value=!0)}async function C(){await(s.value?c():F())}const M=()=>{const e=o();(!e||e&&p())&&(s.value=e)};return S(n,B,M,!1),S(()=>q(u),B,M,!1),f&&_(c),{isSupported:i,isFullscreen:s,enter:F,exit:c,toggle:C}}export{K as a,N as u};