Files
nihonbuzz-academy/public/js/filament/notifications/notifications.js
2026-01-23 17:28:21 +07:00

2 lines
6.8 KiB
JavaScript

(()=>{var O=Object.create;var $=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var u=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var j=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Y(t))!W.call(i,n)&&n!==e&&$(i,n,{get:()=>t[n],enumerable:!(s=V(t,n))||s.enumerable});return i};var J=(i,t,e)=>(e=i!=null?O(H(i)):{},j(t||!i||!i.__esModule?$(e,"default",{value:i,enumerable:!0}):e,i));var T=u((ut,k)=>{var m,x=typeof global<"u"&&(global.crypto||global.msCrypto);x&&x.getRandomValues&&(g=new Uint8Array(16),m=function(){return x.getRandomValues(g),g});var g;m||(y=new Array(16),m=function(){for(var i=0,t;i<16;i++)(i&3)===0&&(t=Math.random()*4294967296),y[i]=t>>>((i&3)<<3)&255;return y});var y;k.exports=m});var S=u((ct,P)=>{var _=[];for(c=0;c<256;++c)_[c]=(c+256).toString(16).substr(1);var c;function K(i,t){var e=t||0,s=_;return s[i[e++]]+s[i[e++]]+s[i[e++]]+s[i[e++]]+"-"+s[i[e++]]+s[i[e++]]+"-"+s[i[e++]]+s[i[e++]]+"-"+s[i[e++]]+s[i[e++]]+"-"+s[i[e++]]+s[i[e++]]+s[i[e++]]+s[i[e++]]+s[i[e++]]+s[i[e++]]}P.exports=K});var F=u((lt,b)=>{var Q=T(),X=S(),h=Q(),Z=[h[0]|1,h[1],h[2],h[3],h[4],h[5]],U=(h[6]<<8|h[7])&16383,C=0,D=0;function tt(i,t,e){var s=t&&e||0,n=t||[];i=i||{};var r=i.clockseq!==void 0?i.clockseq:U,o=i.msecs!==void 0?i.msecs:new Date().getTime(),a=i.nsecs!==void 0?i.nsecs:D+1,E=o-C+(a-D)/1e4;if(E<0&&i.clockseq===void 0&&(r=r+1&16383),(E<0||o>C)&&i.nsecs===void 0&&(a=0),a>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");C=o,D=a,U=r,o+=122192928e5;var l=((o&268435455)*1e4+a)%4294967296;n[s++]=l>>>24&255,n[s++]=l>>>16&255,n[s++]=l>>>8&255,n[s++]=l&255;var d=o/4294967296*1e4&268435455;n[s++]=d>>>8&255,n[s++]=d&255,n[s++]=d>>>24&15|16,n[s++]=d>>>16&255,n[s++]=r>>>8|128,n[s++]=r&255;for(var z=i.node||Z,f=0;f<6;++f)n[s+f]=z[f];return t||X(n)}b.exports=tt});var M=u((dt,R)=>{var it=T(),et=S();function st(i,t,e){var s=t&&e||0;typeof i=="string"&&(t=i=="binary"?new Array(16):null,i=null),i=i||{};var n=i.random||(i.rng||it)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t)for(var r=0;r<16;++r)t[s+r]=n[r];return t||et(n)}R.exports=st});var I=u((ft,G)=>{var nt=F(),B=M(),A=B;A.v1=nt;A.v4=B;G.exports=A});function N(i,t=()=>{}){let e=!1;return function(){e?t.apply(this,arguments):(e=!0,i.apply(this,arguments))}}var q=i=>{i.data("notificationComponent",({notification:t})=>({isShown:!1,computedStyle:null,transitionDuration:null,transitionEasing:null,init(){this.computedStyle=window.getComputedStyle(this.$el),this.transitionDuration=parseFloat(this.computedStyle.transitionDuration)*1e3,this.transitionEasing=this.computedStyle.transitionTimingFunction,this.configureTransitions(),this.configureAnimations(),t.duration&&t.duration!=="persistent"&&setTimeout(()=>{if(!this.$el.matches(":hover")){this.close();return}this.$el.addEventListener("mouseleave",()=>this.close())},t.duration),this.isShown=!0},configureTransitions(){let e=this.computedStyle.display,s=()=>{i.mutateDom(()=>{this.$el.style.setProperty("display",e),this.$el.style.setProperty("visibility","visible")}),this.$el._x_isShown=!0},n=()=>{i.mutateDom(()=>{this.$el._x_isShown?this.$el.style.setProperty("visibility","hidden"):this.$el.style.setProperty("display","none")})},r=N(o=>o?s():n(),o=>{this.$el._x_toggleAndCascadeWithTransitions(this.$el,o,s,n)});i.effect(()=>r(this.isShown))},configureAnimations(){let e;Livewire.interceptMessage(({onFinish:s,onSuccess:n})=>{requestAnimationFrame(()=>{let r=()=>this.$el.getBoundingClientRect().top,o=r();s(()=>{e=()=>{this.isShown&&this.$el.animate([{transform:`translateY(${o-r()}px)`},{transform:"translateY(0px)"}],{duration:this.transitionDuration,easing:this.transitionEasing})},this.$el.getAnimations().forEach(a=>a.finish())}),n(({payload:a})=>{a?.snapshot?.data?.isFilamentNotificationsComponent&&e()})})})},close(){this.isShown=!1,setTimeout(()=>window.dispatchEvent(new CustomEvent("notificationClosed",{detail:{id:t.id}})),this.transitionDuration)},markAsRead(){window.dispatchEvent(new CustomEvent("markedNotificationAsRead",{detail:{id:t.id}}))},markAsUnread(){window.dispatchEvent(new CustomEvent("markedNotificationAsUnread",{detail:{id:t.id}}))}}))};var L=J(I(),1),v=class{constructor(){return this.id((0,L.v4)()),this}id(t){return this.id=t,this}title(t){return this.title=t,this}body(t){return this.body=t,this}actions(t){return this.actions=t,this}status(t){return this.status=t,this}color(t){return this.color=t,this}icon(t){return this.icon=t,this}iconColor(t){return this.iconColor=t,this}duration(t){return this.duration=t,this}seconds(t){return this.duration(t*1e3),this}persistent(){return this.duration("persistent"),this}danger(){return this.status("danger"),this}info(){return this.status("info"),this}success(){return this.status("success"),this}warning(){return this.status("warning"),this}view(t){return this.view=t,this}viewData(t){return this.viewData=t,this}send(){return window.dispatchEvent(new CustomEvent("notificationSent",{detail:{notification:this}})),this}},p=class{constructor(t){return this.name(t),this}name(t){return this.name=t,this}color(t){return this.color=t,this}dispatch(t,e){return this.event(t),this.eventData(e),this}dispatchSelf(t,e){return this.dispatch(t,e),this.dispatchDirection="self",this}dispatchTo(t,e,s){return this.dispatch(e,s),this.dispatchDirection="to",this.dispatchToComponent=t,this}emit(t,e){return this.dispatch(t,e),this}emitSelf(t,e){return this.dispatchSelf(t,e),this}emitTo(t,e,s){return this.dispatchTo(t,e,s),this}dispatchDirection(t){return this.dispatchDirection=t,this}dispatchToComponent(t){return this.dispatchToComponent=t,this}event(t){return this.event=t,this}eventData(t){return this.eventData=t,this}extraAttributes(t){return this.extraAttributes=t,this}icon(t){return this.icon=t,this}iconPosition(t){return this.iconPosition=t,this}outlined(t=!0){return this.isOutlined=t,this}disabled(t=!0){return this.isDisabled=t,this}label(t){return this.label=t,this}close(t=!0){return this.shouldClose=t,this}openUrlInNewTab(t=!0){return this.shouldOpenUrlInNewTab=t,this}size(t){return this.size=t,this}url(t){return this.url=t,this}view(t){return this.view=t,this}button(){return this.view("filament::components.button.index"),this}grouped(){return this.view("filament::components.dropdown.list.item"),this}iconButton(){return this.view("filament::components.icon-button"),this}link(){return this.view("filament::components.link"),this}},w=class{constructor(t){return this.actions(t),this}actions(t){return this.actions=t.map(e=>e.grouped()),this}color(t){return this.color=t,this}icon(t){return this.icon=t,this}iconPosition(t){return this.iconPosition=t,this}label(t){return this.label=t,this}tooltip(t){return this.tooltip=t,this}};window.FilamentNotificationAction=p;window.FilamentNotificationActionGroup=w;window.FilamentNotification=v;document.addEventListener("alpine:init",()=>{window.Alpine.plugin(q)});})();