import{S as v,U as m,W as y,X as I,j as i,A as R,E as _,G as $,d as p,ad as A,aT as f,aU as w,M as N,N as F,n as o,f as d,F as z}from"./index.3bfa6a0e.js";const P=t=>{const a=v(),e=()=>{a.value=I(t).height};return m(()=>{y(e),setTimeout(e,100)}),a};function L(t,a){const e=P(t);return l=>i("div",{class:a("placeholder"),style:{height:e.value?`${e.value}px`:void 0}},[l()])}const[E,n]=R("nav-bar"),M={title:String,fixed:Boolean,zIndex:_,border:$,leftText:String,rightText:String,leftArrow:Boolean,placeholder:Boolean,safeAreaInsetTop:Boolean};var O=p({name:E,props:M,emits:["click-left","click-right"],setup(t,{emit:a,slots:e}){const l=v(),s=L(l,n),h=c=>a("click-left",c),r=c=>a("click-right",c),H=()=>e.left?e.left():[t.leftArrow&&i(N,{class:n("arrow"),name:"arrow-left"},null),t.leftText&&i("span",{class:n("text")},[t.leftText])],k=()=>e.right?e.right():i("span",{class:n("text")},[t.rightText]),u=()=>{const{title:c,fixed:x,border:S,zIndex:b}=t,B=A(b),T=t.leftArrow||t.leftText||e.left,C=t.rightText||e.right;return i("div",{ref:l,style:B,class:[n({fixed:x}),{[w]:S,"van-safe-area-top":t.safeAreaInsetTop}]},[i("div",{class:n("content")},[T&&i("div",{class:[n("left"),f],onClick:h},[H()]),i("div",{class:[n("title"),"van-ellipsis"]},[e.title?e.title():c]),C&&i("div",{class:[n("right"),f],onClick:r},[k()])])])};return()=>t.fixed&&t.placeholder?s(u):u()}});const q=F(O);const j="_colHeader_nq1uz_1",D="_transparent_nq1uz_20",U="_headerSection_nq1uz_23";var g={colHeader:j,transparent:D,headerSection:U},K=p({name:"col-header",props:{title:String,isBack:{type:Boolean,default:!0},backIconColor:{type:String,default:"black"},isFixed:{type:Boolean,default:!0},styleName:{type:Object,default:()=>({})},titleClass:String,background:{type:String,default:"white"},color:{type:String,default:"#131415"},rightText:String,onClickRight:{type:Function,default:()=>{}},border:{type:Boolean,default:!0},onHeaderBack:{type:Function,default:()=>{}},hideHeader:{type:Boolean,default:!0}},watch:{backIconColor(){o({api:"backIconChange",content:{iconStyle:this.backIconColor}})}},data(){return{headerTitle:null,navBarHeight:0,titleHeight:44}},mounted(){this.headerTitle=this.title||this.$route.meta.title,this.navBarInit(()=>{this.onHeaderBack&&this.onHeaderBack()})},unmounted(){o({api:"setBarStatus",content:{status:1}}),o({api:"backIconChange",content:{iconStyle:"black"}})},methods:{navBarInit(t){o({api:"setBarStatus",content:{status:0}}),o({api:"backIconChange",content:{iconStyle:this.backIconColor||"black"}});const a=sessionStorage.getItem("navHeight"),e=sessionStorage.getItem("titleHeight");a&&e?(this.navBarHeight=Number(a),t&&t()):o({api:"getNavHeight"},l=>{const{content:s}=l,h=s.dpi||2;if(s.navHeight){const r=s.navHeight/h;sessionStorage.setItem("navHeight",String(r)),this.navBarHeight=r}if(s.titleHeight){const r=s.titleHeight/h;sessionStorage.setItem("titleHeight",String(r)),this.titleHeight=r}t&&t()}),!d().isApp&&t&&t()},onClickLeft(){d().isApp?o({api:"goBack"}):this.$router.back()},clickRight(){this.onClickRight&&this.onClickRight()}},render(){return d().isApp||!this.hideHeader?i("div",null,[this.$slots.content?i("div",{style:{paddingTop:`${this.navBarHeight}px`,background:this.background},class:g.headerSection},[this.$slots.content(this.navBarHeight)]):i(z,null,[i("div",{style:{minHeight:`calc(var(--van-nav-bar-height) + ${this.navBarHeight}px)`},class:g.headerSection},[i(q,{title:this.headerTitle,class:[g.colHeader],style:{background:this.background,color:this.color,paddingTop:`${this.navBarHeight}px`,zIndex:99},"left-arrow":this.isBack,rightText:this.rightText,fixed:this.isFixed,border:this.border,"onClick-right":this.clickRight,"onClick-left":this.onClickLeft},{right:()=>this.$slots.right&&this.$slots.right()||this.rightText})]),this.$slots.default?this.$slots.default():null])]):i("div",null,null)}});export{K as C,q as N,P as u};
