import{G as B,ac as v,d as L,V as b,U as M,aq as W,ab as C,ag as D,al as G,a4 as O,a7 as V,aG as $,j as l,O as x,Z as I,as as k,av as j,N as q,P as A}from"./ResizeObserver.es.62ab429c.js";const[U,d]=B("notice-bar"),X={text:String,mode:String,color:String,delay:v(1),speed:v(60),leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,default:null}};var Z=L({name:U,props:X,emits:["close","replay"],setup(e,{emit:f,slots:a}){let o=0,t=0,u;const m=b(),h=b(),n=M({show:!0,offset:0,duration:0}),y=()=>{if(a["left-icon"])return a["left-icon"]();if(e.leftIcon)return l(x,{class:d("left-icon"),name:e.leftIcon},null)},R=()=>{if(e.mode==="closeable")return"cross";if(e.mode==="link")return"arrow"},T=r=>{e.mode==="closeable"&&(n.show=!1,f("close",r))},E=()=>{if(a["right-icon"])return a["right-icon"]();const r=R();if(r)return l(x,{name:r,class:d("right-icon"),onClick:T},null)},N=()=>{n.offset=o,n.duration=0,j(()=>{k(()=>{n.offset=-t,n.duration=(t+o)/+e.speed,f("replay")})})},S=()=>{const r=e.scrollable===!1&&!e.wrapable,c={transform:n.offset?`translateX(${n.offset}px)`:"",transitionDuration:`${n.duration}s`};return l("div",{ref:m,role:"marquee",class:d("wrap")},[l("div",{ref:h,style:c,class:[d("content"),{"van-ellipsis":r}],onTransitionend:N},[a.default?a.default():e.text])])},i=()=>{const{delay:r,speed:c,scrollable:w}=e,P=q(r)?+r*1e3:0;o=0,t=0,n.offset=0,n.duration=0,clearTimeout(u),u=setTimeout(()=>{if(!m.value||!h.value||w===!1)return;const g=I(m).width,p=I(h).width;(w||p>g)&&k(()=>{o=g,t=p,n.offset=-t,n.duration=t/+c})},P)};return W(i),C(i),D("pageshow",i),G({reset:i}),O(()=>[e.text,e.scrollable],i),()=>{const{color:r,wrapable:c,background:w}=e;return V(l("div",{role:"alert",class:d({wrapable:c}),style:{color:r,background:w}},[y(),S(),E()]),[[$,n.show]])}}});const F=A(Z);var _={exports:{}},s=_.exports={};s.nextTick=function(){var e=typeof window!="undefined"&&window.setImmediate,f=typeof window!="undefined"&&window.postMessage&&window.addEventListener;if(e)return function(o){return window.setImmediate(o)};if(f){var a=[];return window.addEventListener("message",function(o){var t=o.source;if((t===window||t===null)&&o.data==="process-tick"&&(o.stopPropagation(),a.length>0)){var u=a.shift();u()}},!0),function(t){a.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}();s.title="browser";s.browser=!0;s.env={};s.argv=[];s.binding=function(e){throw new Error("process.binding is not supported")};s.cwd=function(){return"/"};s.chdir=function(e){throw new Error("process.chdir is not supported")};export{F as N,_ as b};
