Spaccogram/webk/public/button-DUmZNV0E.js

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:"e944",delete_filled:"e945",deletedaccount:"e946",deleteleft:"e947",deleteuser:"e948",devices:"e949",document:"e94a",down:"e94b",download:"e94c",dragfiles:"e94d",dragmedia:"e94e",eats:"e94f",edit:"e950",email:"e951",endcall_filled:"e952",enter:"e953",expand:"e954",eye:"e955",eye1:"e956",eye2:"e957",eyecross_outline:"e958",factcheck:"e959",fast_forward:"e95a",fast_rewind:"e95b",favourites:"e95c",flag:"e95d",flip:"e95e",folder:"e95f",fontsize:"e960",forward:"e961",forward_filled:"e962",fullscreen:"e963",gc_microphone:"e964",gc_microphoneoff:"e965",gifs:"e966",gift:"e967",gift_premium:"e968",group:"e969",group_filled:"e96a",groupmedia:"e96b",groupmediaoff:"e96c",hand:"e96d",help:"e96e",hide:"e96f",image:"e970",info:"e971",info2:"e972",italic:"e973",keyboard:"e974",lamp:"e975",language:"e976",largepause:"e977",largeplay:"e978",left:"e979",limit_chat:"e97a",limit_chats:"e97b",limit_file:"e97c",limit_folders:"e97d",limit_link:"e97e",limit_pin:"e97f",link:"e980",list:"e981",listscreenshare:"e982",livelocation:"e983",location:"e984",lock:"e985",lockoff:"e986",loginlogodesktop:"e987",loginlogomobile:"e988",logout:"e989",mediaspoiler:"e98a",mediaspoileroff:"e98b",mention:"e98c",menu:"e98d",message:"e98e",message_jump:"e98f",message_quote:"e990",messageunread:"e991",microphone:"e992",microphone_crossed:"e993",microphone_crossed_filled:"e994",microphone_filled:"e995",minus:"e996",monospace:"e997",more:"e998",multistories:"e999",mute:"e99a",muted:"e99b",mynotes:"e99c",newchannel:"e99d",newchannel_filled:"e99e",newchat_filled:"e99f",newgroup:"e9a0",newgroup_filled:"e9a1",newprivate:"e9a2",newprivate_filled:"e9a3",newtab:"e9a4",next:"e9a5",nochannel:"e9a6",noncontacts:"e9a7",nosound:"e9a8",online:"e9a9",passwordoff:"e9aa",pause:"e9ab",permissions:"e9ac",phone:"e9ad",phone_filled:"e9ae",pin:"e9af",pin2:"e9b0",pinlist:"e9b1",pinned_filled:"e9b2",pinnedchat:"e9b3",pip:"e9b4",play:"e9b5",playback_05:"e9b6",playback_15:"e9b7",playback_1x:"e9b8",playback_2x:"e9b9",plus:"e9ba",plusround:"e9bb",poll:"e9bc",premium_addone:"e9bd",premium_avatars:"e9be",premium_badge:"e9bf",premium_colors:"e9c0",premium_double:"e9c1",premium_emoji:"e9c2",premium_filesize:"e9c3",premium_lastseen:"e9c4",premium_limits:"e9c5",premium_lock:"e9c6",premium_management:"e9c7",premium_noads:"e9c8",premium_privacy:"e9c9",premium_reactions:"e9ca",premium_restrict:"e9cb",premium_speed:"e9cc",premium_status:"e9cd",premium_stickers:"e9ce",premium_tags:"e9cf",premium_transcription:"e9d0",premium_translate:"e9d1",premium_unlock:"e9d2",premium_wallpaper:"e9d3",previous:"e9d4",promote:"e9d5",quote:"e9d6",quote_outline:"e9d7",radiooff:"e9d8",radioon:"e9d9",reactions:"e9da",reactions_filled:"e9db",readchats:"e9dc",recent:"e9dd",replace:"e9de",reply:"e9df",reply_filled:"e9e0",restrict:"e9e1",revenue:"e9e2",rightpanel:"e9e3",rotate_left:"e9e4",rotate_right:"e9e5",saved:"e9e6",savedmessages:"e9e7",schedule:"e9e8",scheduled:"e9e9",search:"e9ea",select:"e9eb",send:"e9ec",send2:"e9ed",sending:"e9ee",sendingerror:"e9ef",settings:"e9f0",settings_filled:"e9f1",sharescreen_filled:"e9f2",shipping:"e9f3",shuffle:"e9f4",smallscreen:"e9f5",smile:"e9f6",speaker:"e9f7",speakerfilled:"e9f8",speakeroff:"e9f9",speakerofffilled:"e9fa",spoiler:"e9fb",sport:"e9fc",star:"e9fd",star_filled:"e9fe",statistics:"e9ff",stickers:"ea00",stickers_face:"ea01",stop:"ea02",stories:"ea03",storyreply:"ea04",storyrepost:"ea05",strikethrough:"ea06",tag:"ea07",tag_add:"ea08",tag_crossed:"ea09",tag_filter:"ea0a",tag_name:"ea0b",textedit:"ea0c",timer:"ea0d",tip:"ea0e",tools:"ea0f",topics:"ea10",transcribe:"ea11",unarchive:"ea12",unclaimed:"ea13",underline:"ea14",unmute:"ea15",unpin:"ea16",unread:"ea17",up:"ea18",user:"ea19",username:"ea1a",videocamera:"ea1b",videocamera_crossed_filled:"ea1c",videocamera_filled:"ea1d",videochat:"ea1e",volume_down:"ea1f",volume_mute:"ea20",volume_off:"ea21",volume_up:"ea22",webview:"ea23",zoomin:"ea24",zoomout:"ea25"},T=new Set(["avatarnext","avatarprevious","arrow_next","channel","chatspinned","fast_forward","fast_rewind","forward","forward_filled","group","group_filled","left","listscreenshare","logout","muted","newchannel_filled","newchannel","newgroup","newgroup_filled","next","nosound","previous","send","send2","reply","reply_filled","sharescreen_filled","transcribe","storyreply","premium_noads","topics","pinlist","deleteleft"]);function N(a){return String.fromCharCode(parseInt(B[a],16))}function j(a,...e){const t=document.createElement("span");return M.isRTL&&T.has(a)&&e.push("icon-reflect"),t.classList.add(D,...e),t.textContent=N(a),t}function H(a,e={}){const t=document.createElement(e.asLink?"a":e.asDiv?"div":"button");return t.className=a,e.noRipple||(e.rippleSquare&&t.classList.add("rp-square"),U(t)),e.icon&&F(t,e.icon,!1),e.onlyMobile&&t.classList.add("only-handhelds"),e.disabled&&t.setAttribute("disabled","true"),e.text&&t.append(A(e.text,e.textArgs)),t}function F(a,e,t=a.querySelector(".button-icon")){const r=j(e,"button-icon");return t?t.replaceWith(r):a.append(r),r}export{H as B,j as I,F as a,N as g,U as r,L as s};
//# sourceMappingURL=button-DUmZNV0E.js.map