import{a1 as e,a2 as t,a3 as a,b as o,c as l,w as r,y as i,z as s,A as n,n as u,i as d,D as c,j as b,k as h,e as p,W as f,X as m,a4 as y,l as g,L as v,d as x,I as k,J as _,ar as C,H as S,aU as I,aV as w,am as $,aL as D,ae as N,f as B,R as P,aW as j,a as H,aN as A}from"./index-83368bfa.js";import{_ as O}from"./u-icon.592effc8.js";import{_ as z}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as T}from"./u-safe-bottom.579f9172.js";const L=z({name:"u-badge",mixins:[t,{props:{isDot:{type:Boolean,default:e.badge.isDot},value:{type:[Number,String],default:e.badge.value},modelValue:{type:[Number,String],default:e.badge.modelValue},show:{type:Boolean,default:e.badge.show},max:{type:[Number,String],default:e.badge.max},type:{type:String,default:e.badge.type},showZero:{type:Boolean,default:e.badge.showZero},bgColor:{type:[String,null],default:e.badge.bgColor},color:{type:[String,null],default:e.badge.color},shape:{type:String,default:e.badge.shape},numberType:{type:String,default:e.badge.numberType},offset:{type:Array,default:e.badge.offset},inverted:{type:Boolean,default:e.badge.inverted},absolute:{type:Boolean,default:e.badge.absolute}}},a],computed:{boxStyle:()=>({}),badgeStyle(){const e={};if(this.color&&(e.color=this.color),this.bgColor&&!this.inverted&&(e.backgroundColor=this.bgColor),this.absolute&&(e.position="absolute",this.offset.length)){const t=this.offset[0],a=this.offset[1]||t;e.top=uni.$u.addUnit(t),e.right=uni.$u.addUnit(a)}return e},showValue(){switch(this.numberType){case"overflow":return Number(this.value)>Number(this.max)?this.max+"+":this.value;case"ellipsis":return Number(this.value)>Number(this.max)?"...":this.value;case"limit":return Number(this.value)>999?Number(this.value)>=9999?Math.floor(this.value/1e4*100)/100+"w":Math.floor(this.value/1e3*100)/100+"k":this.value;default:return Number(this.value)}}}},[["render",function(e,t,a,b,h,p){const f=c;return e.show&&(0!==Number(e.value)||e.showZero||e.isDot)?(o(),l(f,{key:0,class:n([[e.isDot?"u-badge--dot":"u-badge--not-dot",e.inverted&&"u-badge--inverted","horn"===e.shape&&"u-badge--horn",`u-badge--${e.type}${e.inverted?"--inverted":""}`],"u-badge"]),style:u([e.$u.addStyle(e.customStyle),p.badgeStyle])},{default:r((()=>[i(s(e.isDot?"":p.showValue),1)])),_:1},8,["class","style"])):d("v-if",!0)}],["__scopeId","data-v-99cd5b85"]]);const V=z({name:"u-tabbar-item",mixins:[t,a,{props:{name:{type:[String,Number,null],default:e.tabbarItem.name},icon:{icon:String,default:e.tabbarItem.icon},badge:{type:[String,Number,null],default:e.tabbarItem.badge},dot:{type:Boolean,default:e.tabbarItem.dot},text:{type:String,default:e.tabbarItem.text},badgeStyle:{type:[Object,String],default:e.tabbarItem.badgeStyle}}}],data:()=>({isActive:!1,parentData:{value:null,activeColor:"",inactiveColor:""}}),options:{virtualHost:!0},created(){this.init()},methods:{init(){this.updateParentData(),this.parent||uni.$u.error("u-tabbar-item必须搭配u-tabbar组件使用");const e=this.parent.children.indexOf(this);this.isActive=(this.name||e)===this.parentData.value},updateParentData(){this.getParentData("u-tabbar")},updateFromParent(){this.init()},clickHandler(){this.$nextTick((()=>{const e=this.parent.children.indexOf(this),t=this.name||e;t!==this.parent.value&&this.parent.$emit("change",t),this.$emit("click",t)}))}}},[["render",function(e,t,a,n,d,v){const x=b(h("u-icon"),O),k=b(h("u-badge"),L),_=g,C=c;return o(),l(_,{class:"u-tabbar-item",style:u([e.$u.addStyle(e.customStyle)]),onClick:v.clickHandler},{default:r((()=>[p(_,{class:"u-tabbar-item__icon"},{default:r((()=>[e.icon?(o(),l(x,{key:0,name:e.icon,color:d.isActive?d.parentData.activeColor:d.parentData.inactiveColor,size:20},null,8,["name","color"])):(o(),f(m,{key:1},[d.isActive?y(e.$slots,"active-icon",{key:0},void 0,!0):y(e.$slots,"inactive-icon",{key:1},void 0,!0)],64)),p(k,{absolute:"",offset:[0,e.dot?"34rpx":e.badge>9?"14rpx":"20rpx"],customStyle:e.badgeStyle,isDot:e.dot,value:e.badge||(e.dot?1:null),show:e.dot||e.badge>0},null,8,["offset","customStyle","isDot","value","show"])])),_:3}),y(e.$slots,"text",{},(()=>[p(C,{class:"u-tabbar-item__text",style:u({color:d.isActive?d.parentData.activeColor:d.parentData.inactiveColor})},{default:r((()=>[i(s(e.text),1)])),_:1},8,["style"])]),!0)])),_:3},8,["style","onClick"])}],["__scopeId","data-v-b5faebd4"]]);const M=z({name:"u-tabbar",mixins:[t,a,{props:{value:{type:[String,Number,null],default:e.tabbar.value},safeAreaInsetBottom:{type:Boolean,default:e.tabbar.safeAreaInsetBottom},border:{type:Boolean,default:e.tabbar.border},zIndex:{type:[String,Number],default:e.tabbar.zIndex},activeColor:{type:String,default:e.tabbar.activeColor},inactiveColor:{type:String,default:e.tabbar.inactiveColor},fixed:{type:Boolean,default:e.tabbar.fixed},placeholder:{type:Boolean,default:e.tabbar.placeholder}}}],data:()=>({placeholderHeight:0}),computed:{tabbarStyle(){const e={zIndex:this.zIndex};return uni.$u.deepMerge(e,uni.$u.addStyle(this.customStyle))},updateChild(){return[this.value,this.activeColor,this.inactiveColor]},updatePlaceholder(){return[this.fixed,this.placeholder]}},watch:{updateChild(){this.updateChildren()},updatePlaceholder(){this.setPlaceholderHeight()}},created(){this.children=[]},mounted(){this.setPlaceholderHeight()},methods:{updateChildren(){this.children.length&&this.children.map((e=>e.updateFromParent()))},async setPlaceholderHeight(){this.fixed&&this.placeholder&&(await uni.$u.sleep(20),this.$uGetRect(".u-tabbar__content").then((({height:e=50})=>{this.placeholderHeight=e})))}}},[["render",function(e,t,a,i,s,c){const f=g,m=b(h("u-safe-bottom"),T);return o(),l(f,{class:"u-tabbar"},{default:r((()=>[p(f,{class:n(["u-tabbar__content",[e.border&&"u-border-top",e.fixed&&"u-tabbar--fixed"]]),ref:"u-tabbar__content",onTouchmove:v(e.noop,["stop","prevent"]),style:u([c.tabbarStyle])},{default:r((()=>[p(f,{class:"u-tabbar__content__item-wrapper"},{default:r((()=>[y(e.$slots,"default",{},void 0,!0)])),_:3}),e.safeAreaInsetBottom?(o(),l(m,{key:0})):d("v-if",!0)])),_:3},8,["onTouchmove","class","style"]),e.placeholder?(o(),l(f,{key:0,class:"u-tabbar__placeholder",style:u({height:s.placeholderHeight+"px"})},null,8,["style"])):d("v-if",!0)])),_:3})}],["__scopeId","data-v-b564ac71"]]),R=z(x({__name:"tabbar",props:{addon:{type:String,default:""},color:{type:Object,default:()=>({backgroundColor:"",textColor:"",textHoverColor:""})},border:{type:Boolean,default:!0}},setup(e){const t=e;let a=t.addon;const i=k();!a&&i.addon&&(a=i.addon);const s=_({}),n=()=>{let e=j(k().tabbarList);if(1==e.length)Object.assign(s,e[0]);else{let t=!1;for(let o=0;o{"app"==e.info.type&&(t++,a=e)})),1==t&&Object.assign(s,a)}catch(o){}}}if(t.color)for(let a in t.color)t.color[a]&&s.value[a]&&(s.value[a]=t.color[a])};n(),C((()=>t.addon),((e,t)=>{e&&t&&e!=t&&n()}),{immediate:!0}),C((()=>t.color),((e,t)=>{e&&t&&e!=t&&n()}),{immediate:!0,deep:!0}),t.addon||C((()=>k().tabbarList),((e,t)=>{e&&n()}),{deep:!0,immediate:!0});const u=S((()=>{let e=I().params,t=[];for(let a in e)t.push(a+"="+e[a]);return"/"+w()+(t.length>0?"?"+t.join("&"):"")})),c=e=>{if(-1!=e.indexOf("http")||-1!=e.indexOf("http"))window.location.href=e;else{let t=I().params,a=[];for(let e in t)a.push(e+"="+t[e]);if(e=="/"+w()&&!a.length)return;H({url:e,mode:"reLaunch"})}},y=A();return $((()=>{D().in(y).select(".tab-bar-placeholder").boundingClientRect((e=>{let t={height:e?e.height:0};uni.setStorageSync("tabbarInfo",t)})).exec()})),(e,a)=>{const i=b(h("u-tabbar-item"),V),n=b(h("u-tabbar"),M),y=g;return s&&Object.keys(s).length?(o(),f(m,{key:0},[p(n,{value:B(u),zIndex:"9999",fixed:!0,placeholder:!0,safeAreaInsetBottom:!0,"inactive-color":s.value.textColor,"active-color":s.value.textHoverColor,border:t.border,class:"custom-tabbar"},{default:r((()=>[(o(!0),f(m,null,N(s.value.list,(e=>(o(),f(m,null,[1==s.value.type?(o(),l(i,{key:0,class:"py-[5rpx]","custom-style":{"background-color":s.value.backgroundColor},text:e.text,icon:B(P)(B(u)==e.link.url?e.iconSelectPath:e.iconPath),name:e.link.url,onClick:t=>c(e.link.url)},null,8,["custom-style","text","icon","name","onClick"])):d("v-if",!0),2==s.value.type?(o(),l(i,{key:1,class:"py-[5rpx]","custom-style":{"background-color":s.value.backgroundColor},icon:B(P)(B(u)==e.link.url?e.iconSelectPath:e.iconPath),name:e.link.url,onClick:t=>c(e.link.url)},null,8,["custom-style","icon","name","onClick"])):d("v-if",!0),3==s.value.type?(o(),l(i,{key:2,class:"py-[5rpx]","custom-style":{"background-color":s.value.backgroundColor},text:e.text,name:e.link.url,onClick:t=>c(e.link.url)},null,8,["custom-style","text","name","onClick"])):d("v-if",!0)],64)))),256))])),_:1},8,["value","inactive-color","active-color","border"]),p(y,{class:"tab-bar-placeholder"})],64)):d("v-if",!0)}}}),[["__scopeId","data-v-ba19ab24"]]);export{R as _};