3 lines
9.0 KiB
JavaScript
3 lines
9.0 KiB
JavaScript
|
import{M as w,n as E,j as I,I as y,k,ab as x,f as M,cz as D,i as A}from"./index-CbCftUfG.js";import{i as R,f as z}from"./page-NWzulROZ.js";class O{constructor(){this.promises={},this.raf=E.bind(null),this.scheduled=!1}do(e,t){let r=this.promises[e];return r||(this.scheduleFlush(),r=this.promises[e]=I()),t!==void 0&&r.then(()=>t()),r}measure(e){return this.do("read",e)}mutate(e){return this.do("write",e)}mutateElement(e,t){const r=R(e),n=r?this.mutate():Promise.resolve();return t!==void 0&&(r?n.then(()=>t()):t()),n}scheduleFlush(){this.scheduled||(this.scheduled=!0,this.raf(()=>{this.promises.read&&this.promises.read.resolve(),this.promises.write&&this.promises.write.resolve(),this.scheduled=!1,this.promises={}}))}}const L=new O;w&&(w.sequentialDom=L);let P=0;function U(a,e=()=>Promise.resolve(),t=null,r=!1,n=a){if(a.querySelector(".c-ripple"))return;a.classList.add("rp");const o=document.createElement("div");o.classList.add("c-ripple"),a.classList.contains("rp-square")&&o.classList.add("is-square"),a[r?"prepend":"append"](o);let d;const g=(i,c)=>{const p=Date.now(),s=document.createElement("div"),_=P++,u=+window.getComputedStyle(o).getPropertyValue("--ripple-duration").replace("s","")*1e3,S=d=()=>{const l=Date.now()-p,f=()=>{L.mutate(()=>{s.remove()}),t?.(_)};if(l<u){const h=Math.max(u-l,u/2);setTimeout(()=>s.classList.add("hiding"),Math.max(h-u/2,0)),setTimeout(f,h)}else s.classList.add("hiding"),setTimeout(f,u/2);y||(window.removeEventListener("contextmenu",d),window.removeEventListener("mousemove",d)),d=null,m=!1};e?.(_),E(()=>{if(S!==d)return;const l=o.getBoundingClientRect();s.classList.add("c-ripple__circle");const f=i-l.left,h=c-l.top,b=Math.sqrt((Math.abs(h-l.height/2)+l.height/2)**2+(Math.abs(f-l.width/2)+l.width/2)**2),q=f-b/2,C=h-b/2;s.style.width=s.style.height=b+"px",s.style.left=q+"px",s.style.top=C+"px",s.style.opacity="0",o.append(s),s.offsetWidth,s.style.opacity=""})},v=i=>i.target!==a&&(["BUTTON","A"].includes(i.target.tagName)||x(i.target,"c-ripple")!==o)&&(n===a||!z(i.target,n))&&!x(i.target,"checkbox-field");let m=!1;if(y){const i=()=>{d?.()},c=p=>{if(!k.isAvailable("animations")||p.touches.length>1||m||v(p))return;m=!0;const{clientX:s,clientY:_}=p.touches[0];g(s,_),n.addEventListener("touchend",i,{once:!0}),window.addEventListener("touchmove",u=>{u.cancelBubble=!0,u.stopPropagation(),i(),n.removeEventListener("touchend",i)},{once:!0})};return n.addEventListener("touchstart",c,{passive:!0}),{dispose:()=>n.removeEventListener("touchstart",c),element:o}}else{const i=c=>{if(![0,2].includes(c.button)||!k.isAvailable("animations")||n.dataset.ripple==="0"||v(c))return;if(m){m=!1;return}const{clientX:p,clientY:s}=c;g(p,s),window.addEventListener("mouseup",d,{once:!0,passive:!0}),window.addEventListener("contextmenu",d,{once:!0,passive:!0})};return n.addEventListener("mousedown",i,{passive:!0}),{dispose:()=>n.removeEventListener("mousedown",i),element:o}}}const B={check:"e900",checks:"e901",activesessions:"e902",add:"e903",add_reaction:"e904",addboost:"e905",addmember_filled:"e906",adduser:"e907",admin:"e908",ads:"e909",animals:"e90a",animations:"e90b",archive:"e90c",arrow_down:"e90d",arrow_next:"e90e",arrow_prev:"e90f",arrowcircle:"e910",arrowhead:"e911",attach:"e912",audio_repeat:"e913",audio_repeat_single:"e914",author_hidden:"e915",avatarnext:"e916",avatarprevious:"e917",binfilled:"e918",bold:"e919",bomb:"e91a",boost:"e91b",boostcircle:"e91c",botcom:"e91d",bots:"e91e",bubblereply:"e91f",bug:"e920",calendar:"e921",calendarfilter:"e922",camera:"e923",cameraadd:"e924",captiondown:"e925",captionup:"e926",car:"e927",card:"e928",card_outline:"e929",cash_circle:"e92a",channel:"e92b",channelviews:"e92c",chatspinned:"e92d",chatsplaceholder:"e92e",check1:"e92f",checkbox:"e930",checkboxblock:"e931",checkboxempty:"e932",checkboxon:"e933",checkretract:"e934",checkround:"e935",checkround_filled:"e936",clock:"e937",close:"e938",clouddownload:"e939",collapse:"e93a",colorize:"e93b",comments:"e93c",commentssticker:"e93d",copy:"e93e",crossgif:"e93f",crossround:"e940",crossstar:"e941",darkmode:"e942",data:"e943",delete:"e9
|
||
|
//# sourceMappingURL=button-DUmZNV0E.js.map
|