import{U as v,V as T,X as y,Y as I,j as i,E as $,G as R,H as _,d as k,ae as w,aU as u,aV as N,N as A,O as F,n as l,f,F as z}from"./ResizeObserver.es.45df6c0f.js";const P=t=>{const a=v(),e=()=>{a.value=I(t).height};return T(()=>{y(e),setTimeout(e,100)}),a};function L(t,a){const e=P(t);return o=>i("div",{class:a("placeholder"),style:{height:e.value?`${e.value}px`:void 0}},[o()])}const[O,n]=$("nav-bar"),D={title:String,fixed:Boolean,zIndex:R,border:_,leftText:String,rightText:String,leftArrow:Boolean,placeholder:Boolean,safeAreaInsetTop:Boolean};var E=k({name:O,props:D,emits:["click-left","click-right"],setup(t,{emit:a,slots:e}){const o=v(),s=L(o,n),h=c=>a("click-left",c),r=c=>a("click-right",c),p=()=>e.left?e.left():[t.leftArrow&&i(A,{class:n("arrow"),name:"arrow-left"},null),t.leftText&&i("span",{class:n("text")},[t.leftText])],H=()=>e.right?e.right():i("span",{class:n("text")},[t.rightText]),g=()=>{const{title:c,fixed:x,border:B,zIndex:C}=t,b=w(C),S=t.leftArrow||t.leftText||e.left,m=t.rightText||e.right;return i("div",{ref:o,style:b,class:[n({fixed:x}),{[N]:B,"van-safe-area-top":t.safeAreaInsetTop}]},[i("div",{class:n("content")},[S&&i("div",{class:[n("left"),u],onClick:h},[p()]),i("div",{class:[n("title"),"van-ellipsis"]},[e.title?e.title():c]),m&&i("div",{class:[n("right"),u],onClick:r},[H()])])])};return()=>t.fixed&&t.placeholder?s(g):g()}});const q=F(E);const M="_colHeader_nq1uz_1",V="_transparent_nq1uz_20",j="_headerSection_nq1uz_23";var d={colHeader:M,transparent:V,headerSection:j},G=k({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:!1},leftClickDefault:{type:Boolean,default:!0}},emits:["leftClick"],watch:{backIconColor(){l({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(){l({api:"setBarStatus",content:{status:1}}),l({api:"backIconChange",content:{iconStyle:"black"}})},methods:{navBarInit(t){l({api:"setBarStatus",content:{status:0}}),l({api:"backIconChange",content:{iconStyle:this.backIconColor||"black"}});const a=sessionStorage.getItem("navHeight"),e=sessionStorage.getItem("titleHeight");a&&e?(this.navBarHeight=Number(a),t&&t()):l({api:"getNavHeight"},o=>{const{content:s}=o,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()}),!f().isApp&&t&&t()},onClickLeft(){this.$emit("leftClick",null),this.leftClickDefault&&(f().isApp?l({api:"goBack"}):this.$router.back())},clickRight(){this.onClickRight&&this.onClickRight()}},render(){return this.hideHeader?i("div",null,null):i("div",null,[this.$slots.content?i("div",{style:{paddingTop:`${this.navBarHeight}px`,background:this.background},class:d.headerSection},[this.$slots.content(this.navBarHeight)]):i(z,null,[i("div",{style:{minHeight:`calc(var(--van-nav-bar-height) + ${this.navBarHeight}px)`},class:d.headerSection},[i(q,{title:this.headerTitle,class:[d.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])])}});export{G as C,q as N,P as u};
