import{y as e,E as a,d as o,I as t,r as s,ae as r,a0 as l,n,aa as c,j as i,as as f,ay as d,a as u,S as p,a6 as b,aq as m,V as g,af as y,w as h}from"./index-f2a402e7.js";const[w,v]=e("notice-bar"),k=h(o({name:w,props:{text:String,mode:String,color:String,delay:a(1),speed:a(60),leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,"default":null}},emits:["close","replay"],setup(e,{emit:a,slots:o}){let h,w=0,k=0;const x=t(),S=t(),j=s({show:!0,offset:0,duration:0}),I=o=>{"closeable"===e.mode&&(j.show=!1,a("close",o))},A=()=>{if(o["right-icon"])return o["right-icon"]();const a="closeable"===e.mode?"cross":"link"===e.mode?"arrow":void 0;return a?u(p,{name:a,"class":v("right-icon"),onClick:I},null):void 0},T=()=>{j.offset=w,j.duration=0,g((()=>{m((()=>{j.offset=-k,j.duration=(k+w)/+e.speed,a("replay")}))}))},q=()=>{const a=!1===e.scrollable&&!e.wrapable,t={transform:j.offset?"translateX(".concat(j.offset,"px)"):"",transitionDuration:"".concat(j.duration,"s")};return u("div",{ref:x,role:"marquee","class":v("wrap")},[u("div",{ref:S,style:t,"class":[v("content"),{"van-ellipsis":a}],onTransitionend:T},[o["default"]?o["default"]():e.text])])},B=()=>{const{delay:a,speed:o,scrollable:t}=e,s=y(a)?1e3*+a:0;w=0,k=0,j.offset=0,j.duration=0,clearTimeout(h),h=setTimeout((()=>{if(!x.value||!S.value||!1===t)return;const e=b(x).width,a=b(S).width;(t||a>e)&&m((()=>{w=e,k=a,j.offset=-k,j.duration=k/+o}))}),s)};return r(B),l(B),n("pageshow",B),c({reset:B}),i((()=>[e.text,e.scrollable]),B),()=>{const{color:a,wrapable:t,background:s}=e;return f(u("div",{role:"alert","class":v({wrapable:t}),style:{color:a,background:s}},[o["left-icon"]?o["left-icon"]():e.leftIcon?u(p,{"class":v("left-icon"),name:e.leftIcon},null):void 0,q(),A()]),[[d,j.show]])}}})),x=e=>{if(null===e)return null;const a=Object.assign({},e);return Object.keys(a).forEach((o=>a[o]="object"==typeof e[o]?x(e[o]):e[o])),Array.isArray(e)?(a.length=e.length,Array.from(a)):a};export{k as N,x as d};
