import{K as e,L as t,M as s,b as l,e as a,w as r,g as o,N as n,O as i,y as u,z as c,q as d,l as p,G as f,d as g,r as h,n as _,o as m,P as y,h as v,v as x,Q as w,R as P,S as k,T as b,D as C,E as T,U as W,V as S,W as M,F as $,j as z,k as U,X as j,Y as F}from"./index-f6e54d8f.js";import{_ as I}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as N}from"./uni-icons.7467b650.js";const B=I({name:"u-line-progress",mixins:[t,s,{props:{activeColor:{type:String,default:e.lineProgress.activeColor},inactiveColor:{type:String,default:e.lineProgress.color},percentage:{type:[String,Number],default:e.lineProgress.inactiveColor},showText:{type:Boolean,default:e.lineProgress.showText},height:{type:[String,Number],default:e.lineProgress.height}}}],data:()=>({lineWidth:0}),watch:{percentage(e){this.resizeProgressWidth()}},computed:{progressStyle(){let e={};return e.width=this.lineWidth,e.backgroundColor=this.activeColor,e.height=uni.$u.addUnit(this.height),e},innserPercentage(){return uni.$u.range(0,100,this.percentage)}},mounted(){this.init()},methods:{init(){uni.$u.sleep(20).then((()=>{this.resizeProgressWidth()}))},getProgressWidth(){return this.$uGetRect(".u-line-progress__background")},resizeProgressWidth(){this.getProgressWidth().then((e=>{const{width:t}=e;this.lineWidth=t*this.innserPercentage/100+"px"}))}}},[["render",function(e,t,s,g,h,_){const m=p,y=f;return l(),a(m,{class:"u-line-progress",style:n([e.$u.addStyle(e.customStyle)])},{default:r((()=>[o(m,{class:"u-line-progress__background",ref:"u-line-progress__background",style:n([{backgroundColor:e.inactiveColor,height:e.$u.addUnit(e.height)}])},null,8,["style"]),o(m,{class:"u-line-progress__line",style:n([_.progressStyle])},{default:r((()=>[i(e.$slots,"default",{},(()=>[e.showText&&e.percentage>=10?(l(),a(y,{key:0,class:"u-line-progress__text"},{default:r((()=>[u(c(_.innserPercentage+"%"),1)])),_:1})):d("v-if",!0)]),!0)])),_:3},8,["style"])])),_:3},8,["style"])}],["__scopeId","data-v-f5f0deb3"]]),L=I(g({__name:"updatePopup",setup(e){let t=!0;const s=h(!1),n=h(0),i=h("0.00"),g=h("0.00"),I=h({}),L=_((()=>!/.wgt/.test(I.value.url)&&"ios"===F()));m((e=>{I.value=JSON.parse(decodeURIComponent(e.update))}));let R=null;function q(){P(I.value.url)}function E(){s.value=!0,R=k({url:b(I.value.url),success:e=>{200===e.statusCode&&(C({title:"准备安装"}),setTimeout((()=>{plus.runtime.install(e.tempFilePath,{force:!0},(function(){T(),plus.nativeUI.alert("应用资源更新完成!",(function(){plus.runtime.restart()}))}),(function(e){T(),W({title:"提示",content:e.message,showCancel:!1}),setTimeout((()=>{t=!1,S()}),1200)}))}),1e3))}}),R.onProgressUpdate((e=>{n.value=e.progress,i.value=(e.totalBytesWritten/Math.pow(1024,2)).toFixed(2),g.value=(e.totalBytesExpectedToWrite/Math.pow(1024,2)).toFixed(2)}))}function G(){s.value?M({title:"是否取消下载?",cancelText:"否",confirmText:"是",success:e=>{e.confirm&&(R&&R.abort(),t=!1,S())}}):(t=!1,S())}return y((()=>t)),(e,t)=>{const h=$,_=p,m=f,y=z(U("u-line-progress"),B),P=z(U("uni-icons"),N);return l(),a(_,{class:"mask"},{default:r((()=>[o(_,{class:"content po-re flex-col-center"},{default:r((()=>[o(_,{class:"qw_update_img"},{default:r((()=>[o(h,{src:"/zhxy-jsd/assets/ic_ar-f220aac6.png",class:"wh-full"})])),_:1}),o(_,{class:"w-full flex-1 flex-col"},{default:r((()=>[o(m,{class:"font-w-700 theme-color font-17"},{default:r((()=>[u("发现新版本")])),_:1}),o(_,{class:"px-15 py-10 flex-1 font-13 color-6"},{default:r((()=>[d("v-if",!0),o(_,{class:"mt-5"},{default:r((()=>[u(" 更新说明: "),o(_,{class:"pl-10 mt-5",innerHTML:v(I).note},null,8,["innerHTML"])])),_:1})])),_:1})])),_:1}),o(_,{class:"w-full"},{default:r((()=>[v(L)?(l(),a(_,{key:0,class:"theme-bottom-back w-full py-10 mt-15",onClick:q},{default:r((()=>[u("立即跳转更新 ")])),_:1})):(l(),x(w,{key:1},[v(s)?(l(),a(_,{key:1,class:"w-full py-15"},{default:r((()=>[o(y,{percentage:v(n),activeColor:v(j)},null,8,["percentage","activeColor"]),o(_,{class:"mt-10 font-12 theme-color text-center"},{default:r((()=>[o(m,null,{default:r((()=>[u("安装包下载中,请稍后")])),_:1}),o(m,null,{default:r((()=>[u("("+c(v(i))+"/"+c(v(g))+"M)",1)])),_:1})])),_:1})])),_:1})):(l(),a(_,{key:0,class:"theme-bottom-back w-full py-10 mt-15",onClick:E},{default:r((()=>[u(" 立即下载更新 ")])),_:1}))],64))])),_:1}),o(_,{class:"po-ab",style:{bottom:"-120rpx"},onClick:G},{default:r((()=>[o(P,{type:"close",size:"40",color:"#fff"})])),_:1})])),_:1})])),_:1})}}}),[["__scopeId","data-v-f8184428"]]);export{L as default};