diff --git a/unpackage/cache/appleConfig.ini b/unpackage/cache/appleConfig.ini index bf66c16..3cd1ba6 100644 --- a/unpackage/cache/appleConfig.ini +++ b/unpackage/cache/appleConfig.ini @@ -5,7 +5,7 @@ appleAppid=com.fonchain.attendance appstore=70695af7d1a0be20d1ba633bf98ec76e [iosStyle] -iosStyle=storyboard +iosStyle=common [universalLinks] universalLinks= diff --git a/unpackage/cache/certdataios b/unpackage/cache/certdataios index 9887904..3c1a0fd 100644 --- a/unpackage/cache/certdataios +++ b/unpackage/cache/certdataios @@ -1,3 +1,3 @@ -iosProfile=D:/WebstormProjects/oa-base/files/ios/oa_dev_20240104.mobileprovision +iosProfile=D:/WebstormProjects/oa-base/files/ios/oa_dev_20240516 (1).mobileprovision ioscertFile=D:/WebstormProjects/oa-base/files/ios/20230714_dev.p12 ioscertPassword=uecGPNMV8s+KLcdEgW/MRg== diff --git a/unpackage/cache/uts_custom_ios/app-ios-debug.json b/unpackage/cache/uts_custom_ios/app-ios-debug.json index 6bebe31..7a65152 100644 --- a/unpackage/cache/uts_custom_ios/app-ios-debug.json +++ b/unpackage/cache/uts_custom_ios/app-ios-debug.json @@ -1 +1 @@ -{"dir":"/Users/seaman/srv/bdserver.dcloud.net.cn/service/storage/app/package/IOS/queue/b87978d0-38da-11ef-862d-698846b5d25e/wgtRoot/__UNI__4796942/"} \ No newline at end of file +{"dir":"/Users/seaman/srv/bdserver.dcloud.net.cn/service/storage/app/package/IOS/queue/c6861690-3d10-11ef-8a06-f1aa1b754da2/wgtRoot/__UNI__4796942/"} \ No newline at end of file diff --git a/unpackage/cache/wgt/__UNI__4796942/.manifest/apple-mobileprovision.mobileprovision b/unpackage/cache/wgt/__UNI__4796942/.manifest/apple-mobileprovision.mobileprovision index f2d74ed..409c3c6 100644 Binary files a/unpackage/cache/wgt/__UNI__4796942/.manifest/apple-mobileprovision.mobileprovision and b/unpackage/cache/wgt/__UNI__4796942/.manifest/apple-mobileprovision.mobileprovision differ diff --git a/unpackage/cache/wgt/__UNI__4796942/app-config-service.js b/unpackage/cache/wgt/__UNI__4796942/app-config-service.js index 2e8f877..62f4796 100644 --- a/unpackage/cache/wgt/__UNI__4796942/app-config-service.js +++ b/unpackage/cache/wgt/__UNI__4796942/app-config-service.js @@ -1,7 +1,7 @@ ;(function(){ let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[]; - const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","navigationBar":{"backgroundColor":"#F8F8F8","titleText":"uni-app","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"OA系统","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"4.15","entryPagePath":"pages/index/index","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}}; + const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","navigationBar":{"backgroundColor":"#F8F8F8","titleText":"uni-app","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"墨册","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"4.15","entryPagePath":"pages/index/index","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}}; const __uniRoutes = [{"path":"pages/index/index","meta":{"isQuit":true,"isEntry":true,"navigationBar":{"titleText":"uni-app","style":"custom","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute)); __uniConfig.styles=[];//styles __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); diff --git a/unpackage/cache/wgt/__UNI__4796942/app-service.js b/unpackage/cache/wgt/__UNI__4796942/app-service.js index db362c0..5f0861d 100644 --- a/unpackage/cache/wgt/__UNI__4796942/app-service.js +++ b/unpackage/cache/wgt/__UNI__4796942/app-service.js @@ -1 +1 @@ -if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e()).then((()=>n))),(n=>t.resolve(e()).then((()=>{throw n}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function t(e,t,...n){uni.__log__?uni.__log__(e,t,...n):console[e].apply(console,[...n,t])}const n=t=>(n,s=e.getCurrentInstance())=>{!e.isInSSRComponentSetup&&e.injectHook(t,n,s)},s=n("onShow"),r=n("onHide"),o={apiBaseUrl:"https://warehouse.szjixun.cn/oa_backend",h5Url:"http://114.218.158.24:8042/#/"},i={__name:"index",setup(n){const i=e=>{e.isConnected?uni.redirectTo({url:"/pages/index/index"}):uni.showToast({title:"网络无连接",icon:"none"})},a=e.ref(null);s((()=>{uni.onNetworkStatusChange(i),plus.push.getClientInfoAsync((e=>{t("log","at pages/index/index.vue:62","获取CID",e.clientid)}))})),r((()=>{uni.offNetworkStatusChange(i)}));const c=e=>{var t,n;if("load-complete"===(null==(n=null==(t=e.detail.data)?void 0:t[0])?void 0:n.action)){const{statusBarHeight:e}=uni.getSystemInfoSync(),t=getCurrentPages().pop().$getAppWebview();a.value=t.children()[0],a.value.setStyle({top:e,bottom:0})}};return(t,n)=>(e.openBlock(),e.createElementBlock("web-view",{class:"webview",onMessage:c,style:{flex:"1"},ref:"webViewRef",src:e.unref(o).h5Url},null,40,["src"]))}};__definePage("pages/index/index",i),uni.invokePushCallback({type:"enabled",offline:!0}),Promise.resolve().then((()=>{"undefined"!=typeof plus&&plus.push&&plus.globalEvent.addEventListener("newPath",(({path:e})=>{if(!e)return;const t=getCurrentPages(),n=t[t.length-1];n&&n.$page&&n.$page.fullPath===e||uni.navigateTo({url:e,fail(t){t.errMsg.indexOf("tabbar")>-1?uni.switchTab({url:e,fail(e){console.error(e.errMsg)}}):console.error(t.errMsg)}})})),plus.push.setAutoNotification&&plus.push.setAutoNotification(!1)}));const a={onLaunch:function(){},onShow:function(){t("log","at App.vue:6","App Show")},onHide:function(){t("log","at App.vue:9","App Hide")}},c={pages:[{path:"pages/index/index",style:{navigationBarTitleText:"uni-app",navigationStyle:"custom"}}],globalStyle:{navigationBarTextStyle:"black",navigationBarTitleText:"uni-app",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8"},uniIdRouter:{}};function u(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var l=u((function(e,t){var n;e.exports=(n=n||function(e,t){var n=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),s={},r=s.lib={},o=r.Base={extend:function(e){var t=n(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},i=r.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,s=this.sigBytes,r=e.sigBytes;if(this.clamp(),s%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[s+o>>>2]|=i<<24-(s+o)%4*8}else for(o=0;o>>2]=n[o>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,s=[],r=function(t){var n=987654321,s=4294967295;return function(){var r=((n=36969*(65535&n)+(n>>16)&s)<<16)+(t=18e3*(65535&t)+(t>>16)&s)&s;return r/=4294967296,(r+=.5)*(e.random()>.5?1:-1)}},o=0;o>>2]>>>24-r%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new i.init(n,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new i.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},h=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,s=n.words,r=n.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,u=e.min(4*c,r);if(c){for(var l=0;l>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,i=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],_=e[t+7],w=e[t+8],v=e[t+9],I=e[t+10],A=e[t+11],S=e[t+12],k=e[t+13],T=e[t+14],P=e[t+15],b=o[0],x=o[1],O=o[2],C=o[3];b=u(b,x,O,C,i,7,a[0]),C=u(C,b,x,O,c,12,a[1]),O=u(O,C,b,x,f,17,a[2]),x=u(x,O,C,b,p,22,a[3]),b=u(b,x,O,C,g,7,a[4]),C=u(C,b,x,O,m,12,a[5]),O=u(O,C,b,x,y,17,a[6]),x=u(x,O,C,b,_,22,a[7]),b=u(b,x,O,C,w,7,a[8]),C=u(C,b,x,O,v,12,a[9]),O=u(O,C,b,x,I,17,a[10]),x=u(x,O,C,b,A,22,a[11]),b=u(b,x,O,C,S,7,a[12]),C=u(C,b,x,O,k,12,a[13]),O=u(O,C,b,x,T,17,a[14]),b=l(b,x=u(x,O,C,b,P,22,a[15]),O,C,c,5,a[16]),C=l(C,b,x,O,y,9,a[17]),O=l(O,C,b,x,A,14,a[18]),x=l(x,O,C,b,i,20,a[19]),b=l(b,x,O,C,m,5,a[20]),C=l(C,b,x,O,I,9,a[21]),O=l(O,C,b,x,P,14,a[22]),x=l(x,O,C,b,g,20,a[23]),b=l(b,x,O,C,v,5,a[24]),C=l(C,b,x,O,T,9,a[25]),O=l(O,C,b,x,p,14,a[26]),x=l(x,O,C,b,w,20,a[27]),b=l(b,x,O,C,k,5,a[28]),C=l(C,b,x,O,f,9,a[29]),O=l(O,C,b,x,_,14,a[30]),b=h(b,x=l(x,O,C,b,S,20,a[31]),O,C,m,4,a[32]),C=h(C,b,x,O,w,11,a[33]),O=h(O,C,b,x,A,16,a[34]),x=h(x,O,C,b,T,23,a[35]),b=h(b,x,O,C,c,4,a[36]),C=h(C,b,x,O,g,11,a[37]),O=h(O,C,b,x,_,16,a[38]),x=h(x,O,C,b,I,23,a[39]),b=h(b,x,O,C,k,4,a[40]),C=h(C,b,x,O,i,11,a[41]),O=h(O,C,b,x,p,16,a[42]),x=h(x,O,C,b,y,23,a[43]),b=h(b,x,O,C,v,4,a[44]),C=h(C,b,x,O,S,11,a[45]),O=h(O,C,b,x,P,16,a[46]),b=d(b,x=h(x,O,C,b,f,23,a[47]),O,C,i,6,a[48]),C=d(C,b,x,O,_,10,a[49]),O=d(O,C,b,x,T,15,a[50]),x=d(x,O,C,b,m,21,a[51]),b=d(b,x,O,C,S,6,a[52]),C=d(C,b,x,O,p,10,a[53]),O=d(O,C,b,x,I,15,a[54]),x=d(x,O,C,b,c,21,a[55]),b=d(b,x,O,C,w,6,a[56]),C=d(C,b,x,O,P,10,a[57]),O=d(O,C,b,x,y,15,a[58]),x=d(x,O,C,b,k,21,a[59]),b=d(b,x,O,C,g,6,a[60]),C=d(C,b,x,O,A,10,a[61]),O=d(O,C,b,x,f,15,a[62]),x=d(x,O,C,b,v,21,a[63]),o[0]=o[0]+b|0,o[1]=o[1]+x|0,o[2]=o[2]+O|0,o[3]=o[3]+C|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var o=e.floor(s/4294967296),i=s;n[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,s,r,o,i){var a=e+(t&n|~t&s)+r+i;return(a<>>32-o)+t}function l(e,t,n,s,r,o,i){var a=e+(t&s|n&~s)+r+i;return(a<>>32-o)+t}function h(e,t,n,s,r,o,i){var a=e+(t^n^s)+r+i;return(a<>>32-o)+t}function d(e,t,n,s,r,o,i){var a=e+(n^(t|~s))+r+i;return(a<>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),n.MD5)})),u((function(e,t){var n,s,r;e.exports=(s=(n=h).lib.Base,r=n.enc.Utf8,void(n.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,s=4*n;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),a=o.words,c=i.words,u=0;u>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var c=s.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(e){var t=e.length,n=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o>>6-i%4*2;s[o>>>2]|=(a|c)<<24-o%4*8,o++}return r.create(s,o)}(e,t,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)}));const g="FUNCTION",m="pending",y="rejected";function _(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function w(e){return"object"===_(e)}function v(e){return"function"==typeof e}function I(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const A="REJECTED",S="NOT_PENDING";class k{constructor({createPromise:e,retryRule:t=A}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case A:return this.status===y;case S:return this.status!==m}}exec(){return this.needRetry?(this.status=m,this.promise=this.createPromise().then((e=>(this.status="fulfilled",Promise.resolve(e))),(e=>(this.status=y,Promise.reject(e)))),this.promise):this.promise}}function T(e){return e&&"string"==typeof e?JSON.parse(e):e}const P=T([]);T("");const b=T('[{"provider":"alipay","spaceName":"oaapp","spaceId":"env-00jxgxphla18","spaceAppId":"2021004145628977","accessKey":"ZALus7EgJXdovISb","secretKey":"7qzvVrPN0mAxfcLr"}]')||[];let x="";try{x="__UNI__4796942"}catch(me){}let O={};function C(e,t={}){var n,s;return n=O,s=e,Object.prototype.hasOwnProperty.call(n,s)||(O[e]=t),O[e]}O=uni._globalUniCloudObj?uni._globalUniCloudObj:uni._globalUniCloudObj={};const L=["invoke","success","fail","complete"],E=C("_globalUniCloudInterceptor");function U(e,t){E[e]||(E[e]={}),w(t)&&Object.keys(t).forEach((n=>{L.indexOf(n)>-1&&function(e,t,n){let s=E[e][t];s||(s=E[e][t]=[]),-1===s.indexOf(n)&&v(n)&&s.push(n)}(e,n,t[n])}))}function R(e,t){E[e]||(E[e]={}),w(t)?Object.keys(t).forEach((n=>{L.indexOf(n)>-1&&function(e,t,n){const s=E[e][t];if(!s)return;const r=s.indexOf(n);r>-1&&s.splice(r,1)}(e,n,t[n])})):delete E[e]}function N(e,t){return e&&0!==e.length?e.reduce(((e,n)=>e.then((()=>n(t)))),Promise.resolve()):Promise.resolve()}function D(e,t){return E[e]&&E[e][t]||[]}function M(e){U("callObject",e)}const F=C("_globalUniCloudListener"),q="response",j="needLogin",$="refreshToken",B="clientdb",K="cloudfunction",H="cloudobject";function J(e){return F[e]||(F[e]=[]),F[e]}function W(e,t){const n=J(e);n.includes(t)||n.push(t)}function V(e,t){const n=J(e),s=n.indexOf(t);-1!==s&&n.splice(s,1)}function z(e,t){const n=J(e);for(let s=0;s{G&&e(),function t(){if("function"==typeof getCurrentPages){const t=getCurrentPages();t&&t[0]&&(G=!0,e())}G||setTimeout((()=>{t()}),30)}()})),Q)}function X(e){const t={};for(const n in e){const s=e[n];v(s)&&(t[n]=I(s))}return t}class Z extends Error{constructor(e){super(e.message),this.errMsg=e.message||e.errMsg||"unknown system error",this.code=this.errCode=e.code||e.errCode||"SYSTEM_ERROR",this.errSubject=this.subject=e.subject||e.errSubject,this.cause=e.cause,this.requestId=e.requestId}toJson(e=0){if(!(e>=10))return e++,{errCode:this.errCode,errMsg:this.errMsg,errSubject:this.errSubject,cause:this.cause&&this.cause.toJson?this.cause.toJson(e):this.cause}}}var ee={request:e=>uni.request(e),uploadFile:e=>uni.uploadFile(e),setStorageSync:(e,t)=>uni.setStorageSync(e,t),getStorageSync:e=>uni.getStorageSync(e),removeStorageSync:e=>uni.removeStorageSync(e),clearStorageSync:()=>uni.clearStorageSync()};function te(e){return e&&te(e.__v_raw)||e}function ne(){return{token:ee.getStorageSync("uni_id_token")||ee.getStorageSync("uniIdToken"),tokenExpired:ee.getStorageSync("uni_id_token_expired")}}function se({token:e,tokenExpired:t}={}){e&&ee.setStorageSync("uni_id_token",e),t&&ee.setStorageSync("uni_id_token_expired",t)}let re,oe;function ie(){return re||(re=uni.getSystemInfoSync()),re}function ae(){let e,t;try{if(uni.getLaunchOptionsSync){if(uni.getLaunchOptionsSync.toString().indexOf("not yet implemented")>-1)return;const{scene:n,channel:s}=uni.getLaunchOptionsSync();e=s,t=n}}catch(n){}return{channel:e,scene:t}}function ce(){const e=uni.getLocale&&uni.getLocale()||"en";if(oe)return{...oe,locale:e,LOCALE:e};const t=ie(),{deviceId:n,osName:s,uniPlatform:r,appId:o}=t,i=["pixelRatio","brand","model","system","language","version","platform","host","SDKVersion","swanNativeVersion","app","AppPlatform","fontSizeSetting"];for(let a=0;a{t(Object.assign(e,{complete(e){e||(e={});const t=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400){const n=e.data&&e.data.error&&e.data.error.code||"SYS_ERR",r=e.data&&e.data.error&&e.data.error.message||e.errMsg||"request:fail";return s(new Z({code:n,message:r,requestId:t}))}const r=e.data;if(r.error)return s(new Z({code:r.error.code,message:r.error.message,requestId:t}));r.result=r.data,r.requestId=t,delete r.data,n(r)}}))}))},he=function(e){return p.stringify(f.parse(e))},de=class{constructor(e){["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),this.config=Object.assign({},{endpoint:0===e.spaceId.indexOf("mp-")?"https://api.next.bspapp.com":"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId,this.adapter=ee,this._getAccessTokenPromiseHub=new k({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new Z({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:S})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return le(e,this.adapter.request)}requestAuth(e){return this.requestWrapped(e)}request(e,t){return Promise.resolve().then((()=>this.hasAccessToken?t?this.requestWrapped(e):this.requestWrapped(e).catch((t=>new Promise(((e,n)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?n(t):e()})).then((()=>this.getAccessToken())).then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})))):this.getAccessToken().then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)}))))}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=ue(t.data,this.config.clientSecret),t}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};return"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=ue(n,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:s}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,name:n,filePath:s,fileType:r,onUploadProgress:o}){return new Promise(((i,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:r,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?i(e):a(new Z({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Z({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}async uploadFile({filePath:e,cloudPath:t,fileType:n="image",cloudPathAsRealPath:s=!1,onUploadProgress:r,config:o}){if("string"!==_(t))throw new Z({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new Z({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new Z({code:"INVALID_PARAM",message:"cloudPath不合法"});const i=o&&o.envType||this.config.envType;if(s&&("/"!==t[0]&&(t="/"+t),t.indexOf("\\")>-1))throw new Z({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:i,filename:s?t.split("/").pop():t,fileId:s?t:void 0})).result,c="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:u,accessKeyId:l,signature:h,host:d,ossPath:f,id:p,policy:g,ossCallbackUrl:m}=a,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:l,Signature:h,host:d,id:p,key:f,policy:g,success_action_status:200};if(u&&(y["x-oss-security-token"]=u),m){const e=JSON.stringify({callbackUrl:m,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=he(e)}const w={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:e,fileType:n};if(await this.uploadFileToOSS(Object.assign({},w,{onUploadProgress:r})),m)return{success:!0,filePath:e,fileID:c};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:e,fileID:c};throw new Z({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,n)=>{Array.isArray(e)&&0!==e.length||n(new Z({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),t({fileList:e.map((e=>({fileID:e,tempFileURL:e})))})}))}async getFileInfo({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new Z({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.info",params:JSON.stringify({id:e.map((e=>e.split("?")[0])).join(",")})};return{fileList:(await this.request(this.setupRequest(t))).result}}},fe={init(e){const t=new de(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}};const pe="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var ge,me;(me=ge||(ge={})).local="local",me.none="none",me.session="session";var ye=function(){},_e=u((function(e,t){var n;e.exports=(n=h,function(e){var t=n,s=t.lib,r=s.WordArray,o=s.Hasher,i=t.algo,a=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(a[r]=n(e.pow(s,.5))),c[r]=n(e.pow(s,1/3)),r++),s++}();var u=[],l=i.SHA256=o.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,s=n[0],r=n[1],o=n[2],i=n[3],a=n[4],l=n[5],h=n[6],d=n[7],f=0;f<64;f++){if(f<16)u[f]=0|e[t+f];else{var p=u[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=u[f-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[f]=g+u[f-7]+y+u[f-16]}var _=s&r^s&o^r&o,w=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+c[f]+u[f];d=h,h=l,l=a,a=i+v|0,i=o,o=r,r=s,s=v+(w+_)|0}n[0]=n[0]+s|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+i|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=e.floor(s/4294967296),n[15+(r+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)})),we=_e,ve=u((function(e,t){e.exports=h.HmacSHA256}));const Ie=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new Z({message:'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'})};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}const t=new Promise(((t,n)=>{e=(e,s)=>e?n(e):t(s)}));return e.promise=t,e};function Ae(e){return void 0===e}function Se(e){return"[object Null]"===Object.prototype.toString.call(e)}var ke;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(ke||(ke={}));const Te={adapter:null,runtime:void 0},Pe=["anonymousUuidKey"];class be extends ye{constructor(){super(),Te.adapter.root.tcbObject||(Te.adapter.root.tcbObject={})}setItem(e,t){Te.adapter.root.tcbObject[e]=t}getItem(e){return Te.adapter.root.tcbObject[e]}removeItem(e){delete Te.adapter.root.tcbObject[e]}clear(){delete Te.adapter.root.tcbObject}}function xe(e,t){switch(e){case"local":return t.localStorage||new be;case"none":return new be;default:return t.sessionStorage||new be}}class Oe{constructor(e){if(!this._storage){this._persistence=Te.adapter.primaryStorage||e.persistence,this._storage=xe(this._persistence,Te.adapter);const t=`access_token_${e.env}`,n=`access_token_expire_${e.env}`,s=`refresh_token_${e.env}`,r=`anonymous_uuid_${e.env}`,o=`login_type_${e.env}`,i=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:s,anonymousUuidKey:r,loginTypeKey:o,userInfoKey:i}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const n=xe(e,Te.adapter);for(const s in this.keys){const e=this.keys[s];if(t&&Pe.includes(s))continue;const r=this._storage.getItem(e);Ae(r)||Se(r)||(n.setItem(e,r),this._storage.removeItem(e))}this._storage=n}setStore(e,t,n){if(!this._storage)return;const s={version:n||"localCachev1",content:t},r=JSON.stringify(s);try{this._storage.setItem(e,r)}catch(o){throw o}}getStore(e,t){try{if(!this._storage)return}catch(s){return""}t=t||"localCachev1";const n=this._storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}removeStore(e){this._storage.removeItem(e)}}const Ce={},Le={};function Ee(e){return Ce[e]}class Ue{constructor(e,t){this.data=t||null,this.name=e}}class Re extends Ue{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const Ne=new class{constructor(){this._listeners={}}on(e,t){return n=e,s=t,(r=this._listeners)[n]=r[n]||[],r[n].push(s),this;var n,s,r}off(e,t){return function(e,t,n){if(n&&n[e]){const s=n[e].indexOf(t);-1!==s&&n[e].splice(s,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof Re)return console.error(e.error),this;const n="string"==typeof e?new Ue(e,t||{}):e,s=n.name;if(this._listens(s)){n.target=this;const e=this._listeners[s]?[...this._listeners[s]]:[];for(const t of e)t.call(this,n)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function De(e,t){Ne.on(e,t)}function Me(e,t={}){Ne.fire(e,t)}function Fe(e,t){Ne.off(e,t)}const qe="loginStateChanged",je="loginStateExpire",$e="loginTypeChanged",Be="anonymousConverted",Ke="refreshAccessToken";var He;!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL"}(He||(He={}));const Je=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],We={"X-SDK-Version":"1.3.5"};function Ve(e,t,n){const s=e[t];e[t]=function(t){const r={},o={};n.forEach((n=>{const{data:s,headers:i}=n.call(e,t);Object.assign(r,s),Object.assign(o,i)}));const i=t.data;return i&&(()=>{var e;if(e=i,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...i,...r};else for(const t in r)i.append(t,r[t])})(),t.headers={...t.headers||{},...o},s.call(e,t)}}function ze(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...We,"x-seqid":e}}}class Qe{constructor(e={}){var t;this.config=e,this._reqClass=new Te.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=Ee(this.config.env),this._localCache=(t=this.config.env,Le[t]),Ve(this._reqClass,"post",[ze]),Ve(this._reqClass,"upload",[ze]),Ve(this._reqClass,"download",[ze])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(n){t=n}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n,loginTypeKey:s,anonymousUuidKey:r}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let o=this._cache.getStore(n);if(!o)throw new Z({message:"未登录CloudBase"});const i={refresh_token:o},a=await this.request("auth.fetchAccessTokenWithRefreshToken",i);if(a.data.code){const{code:e}=a.data;if("SIGN_PARAM_INVALID"===e||"REFRESH_TOKEN_EXPIRED"===e||"INVALID_REFRESH_TOKEN"===e){if(this._cache.getStore(s)===He.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(r),t=this._cache.getStore(n),s=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(s.refresh_token),this._refreshAccessToken()}Me(je),this._cache.removeStore(n)}throw new Z({code:a.data.code,message:`刷新access token失败:${a.data.code}`})}if(a.data.access_token)return Me(Ke),this._cache.setStore(e,a.data.access_token),this._cache.setStore(t,a.data.access_token_expire+Date.now()),{accessToken:a.data.access_token,accessTokenExpire:a.data.access_token_expire};a.data.refresh_token&&(this._cache.removeStore(n),this._cache.setStore(n,a.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n}=this._cache.keys;if(!this._cache.getStore(n))throw new Z({message:"refresh token不存在,登录状态异常"});let s=this._cache.getStore(e),r=this._cache.getStore(t),o=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(s,r))&&(o=!1),(!s||!r||r{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:n,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:n,avatarUrl:s,province:r,country:o,city:i}=e,{data:a}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:s,province:r,country:o,city:i});this.setLocalUserInfo(a)}async refresh(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((e=>{this[e]=t[e]})),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class et{constructor(e){if(!e)throw new Z({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=Ee(e);const{refreshTokenKey:t,accessTokenKey:n,accessTokenExpireKey:s}=this._cache.keys,r=this._cache.getStore(t),o=this._cache.getStore(n),i=this._cache.getStore(s);this.credential={refreshToken:r,accessToken:o,accessTokenExpire:i},this.user=new Ze(e)}get isAnonymousAuth(){return this.loginType===He.ANONYMOUS}get isCustomAuth(){return this.loginType===He.CUSTOM}get isWeixinAuth(){return this.loginType===He.WECHAT||this.loginType===He.WECHAT_OPEN||this.loginType===He.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class tt extends Xe{async signIn(){this._cache.updatePersistence("local");const{anonymousUuidKey:e,refreshTokenKey:t}=this._cache.keys,n=this._cache.getStore(e)||void 0,s=this._cache.getStore(t)||void 0,r=await this._request.send("auth.signInAnonymously",{anonymous_uuid:n,refresh_token:s});if(r.uuid&&r.refresh_token){this._setAnonymousUUID(r.uuid),this.setRefreshToken(r.refresh_token),await this._request.refreshAccessToken(),Me(qe),Me($e,{env:this.config.env,loginType:He.ANONYMOUS,persistence:"local"});const e=new et(this.config.env);return await e.user.refresh(),e}throw new Z({message:"匿名登录失败"})}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:n}=this._cache.keys,s=this._cache.getStore(t),r=this._cache.getStore(n),o=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:s,refresh_token:r,ticket:e});if(o.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(o.refresh_token),await this._request.refreshAccessToken(),Me(Be,{env:this.config.env}),Me($e,{loginType:He.CUSTOM,persistence:"local"}),{credential:{refreshToken:o.refresh_token}};throw new Z({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(n,He.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class nt extends Xe{async signIn(e){if("string"!=typeof e)throw new Z({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,n=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(n.refresh_token)return this.setRefreshToken(n.refresh_token),await this._request.refreshAccessToken(),Me(qe),Me($e,{env:this.config.env,loginType:He.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new et(this.config.env);throw new Z({message:"自定义登录失败"})}}class st extends Xe{async signIn(e,t){if("string"!=typeof e)throw new Z({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token:o,access_token_expire:i}=s;if(r)return this.setRefreshToken(r),o&&i?this.setAccessToken(o,i):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Me(qe),Me($e,{env:this.config.env,loginType:He.EMAIL,persistence:this.config.persistence}),new et(this.config.env);throw s.code?new Z({code:s.code,message:`邮箱登录失败: ${s.message}`}):new Z({message:"邮箱登录失败"})}async activate(e){return this._request.send("auth.activateEndUserMail",{token:e})}async resetPasswordWithToken(e,t){return this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})}}class rt extends Xe{async signIn(e,t){if("string"!=typeof e)throw new Z({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:He.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token_expire:o,access_token:i}=s;if(r)return this.setRefreshToken(r),i&&o?this.setAccessToken(i,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Me(qe),Me($e,{env:this.config.env,loginType:He.USERNAME,persistence:this.config.persistence}),new et(this.config.env);throw s.code?new Z({code:s.code,message:`用户名密码登录失败: ${s.message}`}):new Z({message:"用户名密码登录失败"})}}class ot{constructor(e){this.config=e,this._cache=Ee(e.env),this._request=Ye(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),De($e,this._onLoginTypeChanged)}get currentUser(){const e=this.hasLoginState();return e&&e.user||null}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}anonymousAuthProvider(){return new tt(this.config)}customAuthProvider(){return new nt(this.config)}emailAuthProvider(){return new st(this.config)}usernameAuthProvider(){return new rt(this.config)}async signInAnonymously(){return new tt(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new st(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new rt(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new tt(this.config)),De(Be,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===He.ANONYMOUS)throw new Z({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:n}=this._cache.keys,s=this._cache.getStore(e);if(!s)return;const r=await this._request.send("auth.logout",{refresh_token:s});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(n),Me(qe),Me($e,{env:this.config.env,loginType:He.NULL,persistence:this.config.persistence}),r}async signUpWithEmailAndPassword(e,t){return this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})}async sendPasswordResetEmail(e){return this._request.send("auth.sendPasswordResetEmail",{email:e})}onLoginStateChanged(e){De(qe,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){De(je,e.bind(this))}onAccessTokenRefreshed(e){De(Ke,e.bind(this))}onAnonymousConverted(e){De(Be,e.bind(this))}onLoginTypeChanged(e){De($e,(()=>{const t=this.hasLoginState();e.call(this,t)}))}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{refreshTokenKey:e}=this._cache.keys;return this._cache.getStore(e)?new et(this.config.env):null}async isUsernameRegistered(e){if("string"!=typeof e)throw new Z({code:"PARAM_ERROR",message:"username must be a string"});const{data:t}=await this._request.send("auth.isUsernameRegistered",{username:e});return t&&t.isRegistered}getLoginState(){return Promise.resolve(this.hasLoginState())}async signInWithTicket(e){return new nt(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then((e=>e.code?e:{...e.data,requestId:e.seqId}))}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,n=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+n}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:n,env:s}=e.data;s===this.config.env&&(this._cache.updatePersistence(n),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const it=function(e,t){t=t||Ie();const n=Ye(this.config.env),{cloudPath:s,filePath:r,onUploadProgress:o,fileType:i="image"}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{const{data:{url:a,authorization:c,token:u,fileId:l,cosFileId:h},requestId:d}=e,f={key:s,signature:c,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":u};n.upload({url:a,data:f,file:r,name:s,fileType:i,onUploadProgress:o}).then((e=>{201===e.statusCode?t(null,{fileID:l,requestId:d}):t(new Z({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},at=function(e,t){t=t||Ie();const n=Ye(this.config.env),{cloudPath:s}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},ct=function({fileList:e},t){if(t=t||Ie(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let s of e)if(!s||"string"!=typeof s)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const n={fileid_list:e};return Ye(this.config.env).send("storage.batchDeleteFile",n).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},ut=function({fileList:e},t){t=t||Ie(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let n=[];for(let r of e)"object"==typeof r?(r.hasOwnProperty("fileID")&&r.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),n.push({fileid:r.fileID,max_age:r.maxAge})):"string"==typeof r?n.push({fileid:r}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const s={file_list:n};return Ye(this.config.env).send("storage.batchGetDownloadUrl",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},lt=async function({fileID:e},t){const n=(await ut.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==n.code)return t?t(n):new Promise((e=>{e(n)}));const s=Ye(this.config.env);let r=n.download_url;if(r=encodeURI(r),!t)return s.download({url:r});t(await s.download({url:r}))},ht=function({name:e,data:t,query:n,parse:s,search:r},o){const i=o||Ie();let a;try{a=t?JSON.stringify(t):""}catch(u){return Promise.reject(u)}if(!e)return Promise.reject(new Z({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:n,parse:s,search:r,function_name:e,request_data:a};return Ye(this.config.env).send("functions.invokeFunction",c).then((e=>{if(e.code)i(null,e);else{let n=e.data.response_data;if(s)i(null,{result:n,requestId:e.requestId});else try{n=JSON.parse(e.data.response_data),i(null,{result:n,requestId:e.requestId})}catch(t){i(new Z({message:"response data must be json"}))}}return i.promise})).catch((e=>{i(e)})),i.promise},dt={timeout:15e3,persistence:"session"},ft={};class pt{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(Te.adapter||(this.requestClient=new Te.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...dt,...e},!0){case this.config.timeout>6e5:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=6e5;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new pt(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||Te.adapter.primaryStorage||dt.persistence;var n;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;Ce[t]=new Oe(e),Le[t]=new Oe({...e,persistence:"local"})}(this.config),n=this.config,Ge[n.env]=new Qe(n),this.authObj=new ot(this.config),this.authObj}on(e,t){return De.apply(this,[e,t])}off(e,t){return Fe.apply(this,[e,t])}callFunction(e,t){return ht.apply(this,[e,t])}deleteFile(e,t){return ct.apply(this,[e,t])}getTempFileURL(e,t){return ut.apply(this,[e,t])}downloadFile(e,t){return lt.apply(this,[e,t])}uploadFile(e,t){return it.apply(this,[e,t])}getUploadMetadata(e,t){return at.apply(this,[e,t])}registerExtension(e){ft[e.name]=e}async invokeExtension(e,t){const n=ft[e];if(!n)throw new Z({message:`扩展${e} 必须先注册`});return await n.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:n}=function(e){const t=(n=e,"[object Array]"===Object.prototype.toString.call(n)?e:[e]);var n;for(const s of t){const{isMatch:e,genAdapter:t,runtime:n}=s;if(e())return{adapter:t(),runtime:n}}}(e)||{};t&&(Te.adapter=t),n&&(Te.runtime=n)}}var gt=new pt;function mt(e,t,n){void 0===n&&(n={});var s=/\?/.test(t),r="";for(var o in n)""===r?!s&&(t+="?"):r+="&",r+=o+"="+encodeURIComponent(n[o]);return/^http(s)?:\/\//.test(t+=r)?t:""+e+t}class yt{post(e){const{url:t,data:n,headers:s}=e;return new Promise(((e,r)=>{ee.request({url:mt("https:",t),data:n,method:"POST",header:s,success(t){e(t)},fail(e){r(e)}})}))}upload(e){return new Promise(((t,n)=>{const{url:s,file:r,data:o,headers:i,fileType:a}=e,c=ee.uploadFile({url:mt("https:",s),name:"file",formData:Object.assign({},o),filePath:r,fileType:a,header:i,success(e){const n={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&o.success_action_status&&(n.statusCode=parseInt(o.success_action_status,10)),t(n)},fail(e){n(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((t=>{e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}const _t={setItem(e,t){ee.setStorageSync(e,t)},getItem:e=>ee.getStorageSync(e),removeItem(e){ee.removeStorageSync(e)},clear(){ee.clearStorageSync()}};var wt={genAdapter:function(){return{root:{},reqClass:yt,localStorage:_t,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};gt.useAdapters(wt);const vt=gt,It=vt.init;vt.init=function(e){e.env=e.spaceId;const t=It.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const n=t.auth;return t.auth=function(e){const t=n.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var n;t[e]=(n=t[e],function(e){e=e||{};const{success:t,fail:s,complete:r}=X(e);if(!(t||s||r))return n.call(this,e);n.call(this,e).then((e=>{t&&t(e),r&&r(e)}),(e=>{s&&s(e),r&&r(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var At=vt,St=class extends de{getAccessToken(){return new Promise(((e,t)=>{const n="Anonymous_Access_token";this.setAccessToken(n),e(n)}))}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=ue(n,this.config.clientSecret);const r=ce();s["x-client-info"]=encodeURIComponent(JSON.stringify(r));const{token:o}=ne();return s["x-client-token"]=o,{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:JSON.parse(JSON.stringify(s))}}uploadFileToOSS({url:e,formData:t,name:n,filePath:s,fileType:r,onUploadProgress:o}){return new Promise(((i,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:r,success(e){e&&e.statusCode<400?i(e):a(new Z({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Z({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}uploadFile({filePath:e,cloudPath:t,fileType:n="image",onUploadProgress:s}){if(!t)throw new Z({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let r;return this.getOSSUploadOptionsFromPath({cloudPath:t}).then((t=>{const{url:o,formData:i,name:a}=t.result;r=t.result.fileUrl;const c={url:o,formData:i,name:a,filePath:e,fileType:n};return this.uploadFileToOSS(Object.assign({},c,{onUploadProgress:s}))})).then((()=>this.reportOSSUpload({cloudPath:t}))).then((t=>new Promise(((n,s)=>{t.success?n({success:!0,filePath:e,fileID:r}):s(new Z({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return e.result;throw new Z({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e,maxAge:t}={}){if(!Array.isArray(e)||0===e.length)throw new Z({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const n={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e,maxAge:t})};return this.request(this.setupRequest(n)).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new Z({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}},kt={init(e){const t=new St(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}},Tt=u((function(e,t){e.exports=h.enc.Hex}));function Pt(e="",t={}){const{data:n,functionName:s,method:r,headers:o,signHeaderKeys:i=[],config:a}=t,c=Date.now(),u="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),l=Object.assign({},o,{"x-from-app-id":a.spaceAppId,"x-from-env-id":a.spaceId,"x-to-env-id":a.spaceId,"x-from-instance-id":c,"x-from-function-name":s,"x-client-timestamp":c,"x-alipay-source":"client","x-request-id":u,"x-alipay-callid":u,"x-trace-id":u}),h=["x-from-app-id","x-from-env-id","x-to-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp"].concat(i),[d="",f=""]=e.split("?")||[],p=function(e){const t=e.signedHeaders.join(";"),n=e.signedHeaders.map((t=>`${t.toLowerCase()}:${e.headers[t]}\n`)).join(""),s=we(e.body).toString(Tt),r=`${e.method.toUpperCase()}\n${e.path}\n${e.query}\n${n}\n${t}\n${s}\n`,o=we(r).toString(Tt),i=`HMAC-SHA256\n${e.timestamp}\n${o}\n`,a=ve(i,e.secretKey).toString(Tt);return`HMAC-SHA256 Credential=${e.secretId}, SignedHeaders=${t}, Signature=${a}`}({path:d,query:f,method:r,headers:l,timestamp:c,body:JSON.stringify(n),secretId:a.accessKey,secretKey:a.secretKey,signedHeaders:h.sort()});return{url:`${a.endpoint}${e}`,headers:Object.assign({},l,{Authorization:p})}}function bt({url:e,data:t,method:n="POST",headers:s={}}){return new Promise(((r,o)=>{ee.request({url:e,method:n,data:t,header:s,dataType:"json",complete:(e={})=>{const t=s["x-trace-id"]||"";if(!e.statusCode||e.statusCode>=400){const{message:n,errMsg:s,trace_id:r}=e.data||{};return o(new Z({code:"SYS_ERR",message:n||s||"request:fail",requestId:r||t}))}r({status:e.statusCode,data:e.data,headers:e.header,requestId:t})}})}))}function xt(e,t){const{path:n,data:s,method:r="GET"}=e,{url:o,headers:i}=Pt(n,{functionName:"",data:s,method:r,headers:{"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":Date.now()+6e4},signHeaderKeys:["x-data-api-type","x-expire-timestamp"],config:t});return bt({url:o,data:s,method:r,headers:i}).then((e=>{const t=e.data||{};if(!t.success)throw new Z({code:e.errCode,message:e.errMsg,requestId:e.requestId});return t.data||{}})).catch((e=>{throw new Z({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}function Ot(e=""){const t=e.trim().replace(/^cloud:\/\//,""),n=t.indexOf("/");if(n<=0)throw new Z({code:"INVALID_PARAM",message:"fileID不合法"});const s=t.substring(0,n),r=t.substring(n+1);return s!==this.config.spaceId&&console.warn("file ".concat(e," does not belong to env ").concat(this.config.spaceId)),r}function Ct(e=""){return"cloud://".concat(this.config.spaceId,"/").concat(e.replace(/^\/+/,""))}var Lt={init:e=>{e.provider="alipay";const t=new class{constructor(e){if(["spaceId","spaceAppId","accessKey","secretKey"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),e.endpoint){if("string"!=typeof e.endpoint)throw new Error("endpoint must be string");if(!/^https:\/\//.test(e.endpoint))throw new Error("endpoint must start with https://");e.endpoint=e.endpoint.replace(/\/$/,"")}this.config=Object.assign({},e,{endpoint:e.endpoint||`https://${e.spaceId}.api-hz.cloudbasefunction.cn`})}callFunction(e){return function(e,t){const{name:n,data:s}=e,r="POST",{url:o,headers:i}=Pt("/functions/invokeFunction",{functionName:n,data:s,method:r,headers:{"x-to-function-name":n},signHeaderKeys:["x-to-function-name"],config:t});return bt({url:o,data:s,method:r,headers:i}).then((e=>({errCode:0,success:!0,requestId:e.requestId,result:e.data}))).catch((e=>{throw new Z({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}(e,this.config)}uploadFileToOSS({url:e,filePath:t,fileType:n,formData:s,onUploadProgress:r}){return new Promise(((o,i)=>{const a=ee.uploadFile({url:e,filePath:t,fileType:n,formData:s,name:"file",success(e){e&&e.statusCode<400?o(e):i(new Z({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){i(new Z({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof r&&a&&"function"==typeof a.onProgressUpdate&&a.onProgressUpdate((e=>{r({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}async uploadFile({filePath:e,cloudPath:t="",fileType:n="image",onUploadProgress:s}){if("string"!==_(t))throw new Z({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new Z({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new Z({code:"INVALID_PARAM",message:"cloudPath不合法"});const r=await xt({path:"/".concat(t.replace(/^\//,""),"?post_url")},this.config),{file_id:o,upload_url:i,form_data:a}=r,c=a&&a.reduce(((e,t)=>(e[t.key]=t.value,e)),{});return this.uploadFileToOSS({url:i,filePath:e,fileType:n,formData:c,onUploadProgress:s}).then((()=>({fileID:o})))}async getTempFileURL({fileList:e}){return new Promise(((t,n)=>{(!e||e.length<0)&&n(new Z({errCode:"INVALID_PARAM",errMsg:"fileList不能为空数组"})),e.length>50&&n(new Z({errCode:"INVALID_PARAM",errMsg:"fileList数组长度不能超过50"}));const s=[];for(const r of e){"string"!==_(r)&&n(new Z({errCode:"INVALID_PARAM",errMsg:"fileList的元素必须是非空的字符串"}));const e=Ot.call(this,r);s.push({file_id:e,expire:600})}xt({path:"/?download_url",data:{file_list:s},method:"POST"},this.config).then((e=>{const{file_list:n=[]}=e;t({fileList:n.map((e=>({fileID:Ct.call(this,e.file_id),tempFileURL:e.download_url})))})})).catch((e=>n(e)))}))}}(e);return t.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},t}};function Et({data:e}){let t;t=ce();const n=JSON.parse(JSON.stringify(e||{}));if(Object.assign(n,{clientInfo:t}),!n.uniIdToken){const{token:e}=ne();e&&(n.uniIdToken=e)}return n}const Ut=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var Rt=/[\\^$.*+?()[\]{}|]/g,Nt=RegExp(Rt.source);function Dt(e,t,n){return e.replace(new RegExp((s=t)&&Nt.test(s)?s.replace(Rt,"\\$&"):s,"g"),n);var s}const Mt=2e4,Ft={code:20101,message:"Invalid client"};function qt(e){const{errSubject:t,subject:n,errCode:s,errMsg:r,code:o,message:i,cause:a}=e||{};return new Z({subject:t||n||"uni-secure-network",code:s||o||Mt,message:r||i,cause:a})}let jt;function $t({secretType:e}={}){return"request"===e||"response"===e||"both"===e}function Bt({name:e,data:t={}}={}){return"DCloud-clientDB"===e&&"encryption"===t.redirectTo&&"getAppClientKey"===t.action}function Kt({functionName:e,result:t,logPvd:n}){}function Ht(e){const t=e.callFunction,n=function(n){const s=n.name;n.data=Et.call(e,{data:n.data});const r={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay"}[this.config.provider],o=$t(n),i=Bt(n),a=o||i;return t.call(this,n).then((e=>(e.errCode=0,!a&&Kt.call(this,{functionName:s,result:e,logPvd:r}),Promise.resolve(e))),(e=>(!a&&Kt.call(this,{functionName:s,result:e,logPvd:r}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:n=[]}={}){for(let s=0;sn.provider===e&&n.spaceId===t));return s&&s.config}({provider:e,spaceId:t});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},u=Object.keys(c);if(0===u.length)return!0;const l=function(e,t){let n,s,r;for(let o=0;oe.trim())).indexOf(t)>-1&&(s=i):r=i:n=i}return n||s||r}(u,n);if(!l)return!1;if((c[l]||[]).find(((e={})=>e.appId===s&&(e.platform||"").toLowerCase()===i.toLowerCase())))return!0;throw console.error(`此应用[appId: ${s}, platform: ${i}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),qt(Ft)}({provider:s,spaceId:r,functionName:o})?new jt({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(n.bind(e))(t):i(t),Object.defineProperty(a,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),a.then((e=>("undefined"!=typeof UTSJSONObject&&(e.result=new UTSJSONObject(e.result)),e)))}}jt=class{constructor(){throw qt({message:"Platform app is not enabled, please check whether secure network module is enabled in your manifest.json"})}};const Jt=Symbol("CLIENT_DB_INTERNAL");function Wt(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Jt,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,n,s){if("_uniClient"===n)return null;if("symbol"==typeof n)return e[n];if(n in e||"string"!=typeof n){const t=e[n];return"function"==typeof t?t.bind(e):t}return t.get(e,n,s)}})}function Vt(e){return{on:(t,n)=>{e[t]=e[t]||[],e[t].indexOf(n)>-1||e[t].push(n)},off:(t,n)=>{e[t]=e[t]||[];const s=e[t].indexOf(n);-1!==s&&e[t].splice(s,1)}}}const zt=["db.Geo","db.command","command.aggregate"];function Qt(e,t){return zt.indexOf(`${e}.${t}`)>-1}function Gt(e){switch(_(e=te(e))){case"array":return e.map((e=>Gt(e)));case"object":return e._internalType===Jt||Object.keys(e).forEach((t=>{e[t]=Gt(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function Yt(e){return e&&e.content&&e.content.$method}class Xt{constructor(e,t,n){this.content=e,this.prevStage=t||null,this.udb=null,this._database=n}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((e=>({$method:e.$method,$param:Gt(e.$param)})))}}toString(){return JSON.stringify(this.toJSON())}getAction(){const e=this.toJSON().$db.find((e=>"action"===e.$method));return e&&e.$param&&e.$param[0]}getCommand(){return{$db:this.toJSON().$db.filter((e=>"action"!==e.$method))}}get isAggregate(){let e=this;for(;e;){const t=Yt(e),n=Yt(e.prevStage);if("aggregate"===t&&"collection"===n||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===Yt(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=Yt(e),n=Yt(e.prevStage);if("aggregate"===t&&"command"===n)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return Zt({$method:e,$param:Gt(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const n=this.getAction(),s=this.getCommand();return s.$db.push({$method:e,$param:Gt(t)}),this._database._callCloudFunction({action:n,command:s})}}function Zt(e,t,n){return Wt(new Xt(e,t,n),{get(e,t){let s="db";return e&&e.content&&(s=e.content.$method),Qt(s,t)?Zt({$method:t},e,n):function(){return Zt({$method:t,$param:Gt(Array.from(arguments))},e,n)}}})}function en({path:e,method:t}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...e.map((e=>({$method:e}))),{$method:t,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}function tn(e,t={}){return Wt(new e(t),{get:(e,t)=>Qt("db",t)?Zt({$method:t},null,e):function(){return Zt({$method:t,$param:Gt(Array.from(arguments))},null,e)}})}class nn extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=C("_globalUniCloudDatabaseCallback")),t||(this.auth=Vt(this._authCallBacks)),this._isJQL=t,Object.assign(this,Vt(this._dbCallBacks)),this.env=Wt({},{get:(e,t)=>({$env:t})}),this.Geo=Wt({},{get:(e,t)=>en({path:["Geo"],method:t})}),this.serverDate=en({path:[],method:"serverDate"}),this.RegExp=en({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const n=this._dbCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const n=this._authCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),n=e.getCommand();if("getTemp"!==n.$db[n.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:n}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:n,queryList:s}){function r(e,t){if(n&&s)for(let n=0;nN(D(i,"complete"),e))).then((()=>(r(null,e),z(q,{type:B,content:e}),Promise.reject(e))))}const c=N(D(i,"invoke")),u=this._uniClient;return c.then((()=>u.callFunction({name:"DCloud-clientDB",type:"CLIENT_DB",data:{action:e,command:t,multiCommand:n}}))).then((e=>{const{code:t,message:n,token:s,tokenExpired:c,systemInfo:u=[]}=e.result;if(u)for(let r=0;r(console.warn(n),s)})}}return h=e,N(D(i,"success"),h).then((()=>N(D(i,"complete"),h))).then((()=>{r(h,null);const e=o._parseResult(h);return z(q,{type:B,content:e}),Promise.resolve(e)}));var h}),(e=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),a(new Z({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const sn="token无效,跳转登录页面",rn="token过期,跳转登录页面",on={TOKEN_INVALID_TOKEN_EXPIRED:rn,TOKEN_INVALID_INVALID_CLIENTID:sn,TOKEN_INVALID:sn,TOKEN_INVALID_WRONG_TOKEN:sn,TOKEN_INVALID_ANONYMOUS_USER:sn},an={"uni-id-token-expired":rn,"uni-id-check-token-failed":sn,"uni-id-token-not-exist":sn,"uni-id-check-device-feature-failed":sn};function cn(e,t){let n="";return n=e?`${e}/${t}`:t,n.replace(/^\//,"")}function un(e=[],t=""){const n=[],s=[];return e.forEach((e=>{!0===e.needLogin?n.push(cn(t,e.path)):!1===e.needLogin&&s.push(cn(t,e.path))})),{needLoginPage:n,notNeedLoginPage:s}}function ln(e){return e.split("?")[0].replace(/^\//,"")}function hn(){return function(e){let t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){const e=getCurrentPages();return e[e.length-1]}())}function dn(){return ln(hn())}function fn(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const n=t.list,s=ln(e);return n.some((e=>e.pagePath===s))}const pn=!!c.uniIdRouter,{loginPage:gn,routerNeedLogin:mn,resToLogin:yn,needLoginPage:_n,notNeedLoginPage:wn,loginPageInTabBar:vn}=function({pages:e=[],subPackages:t=[],uniIdRouter:n={},tabBar:s={}}=c){const{loginPage:r,needLogin:o=[],resToLogin:i=!0}=n,{needLoginPage:a,notNeedLoginPage:u}=un(e),{needLoginPage:l,notNeedLoginPage:h}=function(e=[]){const t=[],n=[];return e.forEach((e=>{const{root:s,pages:r=[]}=e,{needLoginPage:o,notNeedLoginPage:i}=un(r,s);t.push(...o),n.push(...i)})),{needLoginPage:t,notNeedLoginPage:n}}(t);return{loginPage:r,routerNeedLogin:o,resToLogin:i,needLoginPage:[...a,...l],notNeedLoginPage:[...u,...h],loginPageInTabBar:fn(r,s)}}();if(_n.indexOf(gn)>-1)throw new Error(`Login page [${gn}] should not be "needLogin", please check your pages.json`);function In(e){const t=dn();if("/"===e.charAt(0))return e;const[n,s]=e.split("?"),r=n.replace(/^\//,"").split("/"),o=t.split("/");o.pop();for(let i=0;i-1?s+`&uniIdRedirectUrl=${encodeURIComponent(r)}`:s+`?uniIdRedirectUrl=${encodeURIComponent(r)}`:s);var s,r;vn?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const o={navigateTo:uni.navigateTo,redirectTo:uni.redirectTo,switchTab:uni.switchTab,reLaunch:uni.reLaunch};setTimeout((()=>{o[e]({url:n})}),0)}function kn({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},n=function(){const{token:e,tokenExpired:t}=ne();let n;if(e){if(t-1)&&(_n.indexOf(t)>-1||mn.some((t=>{return n=e,new RegExp(t).test(n);var n})))}(e)&&n){if(n.uniIdRedirectUrl=e,J(j).length>0)return setTimeout((()=>{z(j,n)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function Tn(){!function(){const e=hn(),{abortLoginPageJump:t,autoToLoginPage:n}=kn({url:e});t||n&&Sn({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t{const{type:t,content:n}=e;let s=!1;switch(t){case"cloudobject":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in an}(n);break;case"clientdb":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in on}(n)}s&&function(e={}){const t=J(j);Y().then((()=>{const n=hn();if(n&&An({redirect:n}))return t.length>0?z(j,Object.assign({uniIdRedirectUrl:n},e)):void(gn&&Sn({api:"navigateTo",redirect:n}))}))}(n)}))}function bn(e){var t;(t=e).onResponse=function(e){W(q,e)},t.offResponse=function(e){V(q,e)},function(e){e.onNeedLogin=function(e){W(j,e)},e.offNeedLogin=function(e){V(j,e)},pn&&(C("_globalUniCloudStatus").needLoginInit||(C("_globalUniCloudStatus").needLoginInit=!0,Y().then((()=>{Tn.call(e)})),yn&&Pn.call(e)))}(e),function(e){e.onRefreshToken=function(e){W($,e)},e.offRefreshToken=function(e){V($,e)}}(e)}let xn;const On="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Cn=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Ln(){const e=ne().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((s=t[1],decodeURIComponent(xn(s).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(r){throw new Error("获取当前用户信息出错,详细错误信息为:"+r.message)}var s;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}xn="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Cn.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,s,r="",o=0;o>16&255):64===s?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return r}:atob;var En=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(u((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n="chooseAndUploadFile:ok",s="chooseAndUploadFile:fail";function r(e,t){return e.tempFiles.forEach(((e,n)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+n+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function o(e,t,{onChooseFile:s,onUploadProgress:r}){return t.then((e=>{if(s){const t=s(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:n,tempFilePaths:[],tempFiles:[]}:function(e,t,s=5,r){(t=Object.assign({},t)).errMsg=n;const o=t.tempFiles,i=o.length;let a=0;return new Promise((n=>{for(;a=i)return void(!o.find((e=>!e.url&&!e.errMsg))&&n(t));const u=o[s];e.uploadFile({provider:u.provider,filePath:u.path,cloudPath:u.cloudPath,fileType:u.fileType,cloudPathAsRealPath:u.cloudPathAsRealPath,onUploadProgress(e){e.index=s,e.tempFile=u,e.tempFilePath=u.path,r&&r(e)}}).then((e=>{u.url=e.fileID,s{u.errMsg=e.errMsg||e.message,s{uni.chooseImage({count:t,sizeType:n,sourceType:o,extension:i,success(t){e(r(t,"image"))},fail(e){a({errMsg:e.errMsg.replace("chooseImage:fail",s)})}})}))}(t),t):"video"===t.type?o(e,function(e){const{camera:t,compressed:n,maxDuration:o,sourceType:i=["album","camera"],extension:a}=e;return new Promise(((e,c)=>{uni.chooseVideo({camera:t,compressed:n,maxDuration:o,sourceType:i,extension:a,success(t){const{tempFilePath:n,duration:s,size:o,height:i,width:a}=t;e(r({errMsg:"chooseVideo:ok",tempFilePaths:[n],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:n,size:o,type:t.tempFile&&t.tempFile.type||"",width:a,height:i,duration:s,fileType:"video",cloudPath:""}]},"video"))},fail(e){c({errMsg:e.errMsg.replace("chooseVideo:fail",s)})}})}))}(t),t):o(e,function(e){const{count:t,extension:n}=e;return new Promise(((e,o)=>{let i=uni.chooseFile;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(i=wx.chooseMessageFile),"function"!=typeof i)return o({errMsg:s+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});i({type:"all",count:t,extension:n,success(t){e(r(t))},fail(e){o({errMsg:e.errMsg.replace("chooseFile:fail",s)})}})}))}(t),t)}}})));function Un(e){return{props:{localdata:{type:Array,default:()=>[]},options:{type:[Object,Array],default:()=>({})},spaceInfo:{type:Object,default:()=>({})},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:()=>({mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{},mixinDatacomError:null}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((t=>{e.push(this[t])})),e}),((e,t)=>{if("manual"===this.loadtime)return;let n=!1;const s=[];for(let r=2;r{this.mixinDatacomLoading=!1;const{data:s,count:r}=n.result;this.getcount&&(this.mixinDatacomPage.count=r),this.mixinDatacomHasMore=s.length{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,this.mixinDatacomError=e,n&&n(e)})))},mixinDatacomGet(t={}){let n;t=t||{},n="undefined"!=typeof __uniX&&__uniX?e.databaseForJQL(this.spaceInfo):e.database(this.spaceInfo);const s=t.action||this.action;s&&(n=n.action(s));const r=t.collection||this.collection;n=Array.isArray(r)?n.collection(...r):n.collection(r);const o=t.where||this.where;o&&Object.keys(o).length&&(n=n.where(o));const i=t.field||this.field;i&&(n=n.field(i));const a=t.foreignKey||this.foreignKey;a&&(n=n.foreignKey(a));const c=t.groupby||this.groupby;c&&(n=n.groupBy(c));const u=t.groupField||this.groupField;u&&(n=n.groupField(u)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(n=n.distinct());const l=t.orderby||this.orderby;l&&(n=n.orderBy(l));const h=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,d=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,f=void 0!==t.getcount?t.getcount:this.getcount,p=void 0!==t.gettree?t.gettree:this.gettree,g=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,m={getCount:f},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return p&&(m.getTree=y),g&&(m.getTreePath=y),n=n.skip(d*(h-1)).limit(d).get(m),n}}}}function Rn(e){return C("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function Nn({openid:e,callLoginByWeixin:t=!1}={}){throw Rn(this),new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `app`")}async function Dn(e){const t=Rn(this);return t.initPromise||(t.initPromise=Nn.call(this,e).then((e=>e)).catch((e=>{throw delete t.initPromise,e}))),t.initPromise}function Mn(e){const t={getSystemInfo:uni.getSystemInfo,getPushClientId:uni.getPushClientId};return function(n){return new Promise(((s,r)=>{t[e]({...n,success(e){s(e)},fail(e){r(e)}})}))}}class Fn extends class{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const n=this._callback[e];if(!n)return;const s=function(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t)return n;return-1}(n,t);n.splice(s,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const n=this._callback[e];if(n)for(let s=0;s{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()}),(e=>{throw this.emit("error",e),this.close(),e}))}async open(){return this.init()}_isUniCloudSSE(e){if("receive"!==e.type)return!1;const t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:n,messageId:s,message:r}=t;this._payloadQueue.push({action:n,messageId:s,message:r}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find((e=>e.messageId===this._currentMessageId+1));if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:n,message:s}=e;"end"===t?this._end({messageId:n,message:s}):"message"===t&&this._appendMessage({messageId:n,message:s})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){uni.onPushMessage(this._uniPushMessageCallback)}_destroy(){uni.offPushMessage(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const qn={tcb:At,tencent:At,aliyun:fe,private:kt,alipay:Lt};let jn=new class{init(e){let t={};const n=qn[e.provider];if(!n)throw new Error("未提供正确的provider参数");var s;return t=n.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new k({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const n=e.auth();return t.then((()=>n.getLoginState())).then((e=>e?Promise.resolve():n.signInAnonymously()))}}))}(t),Ht(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(s=t).database=function(e){if(e&&Object.keys(e).length>0)return s.init(e).database();if(this._database)return this._database;const t=tn(nn,{uniClient:s});return this._database=t,t},s.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return s.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=tn(nn,{uniClient:s,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=Ln,e.chooseAndUploadFile=En.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return Un(e)}}),e.SSEChannel=Fn,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:n=!1}={}){return Dn.call(e,{openid:t,callLoginByWeixin:n})}}(e),e.importObject=function(t){return function(n,s={}){s=function(e,t={}){return e.customUI=t.customUI||e.customUI,e.parseSystemError=t.parseSystemError||e.parseSystemError,Object.assign(e.loadingOptions,t.loadingOptions),Object.assign(e.errorOptions,t.errorOptions),"object"==typeof t.secretMethods&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},s);const{customUI:r,loadingOptions:o,errorOptions:i,parseSystemError:a}=s,c=!r;return new Proxy({},{get(r,u){switch(u){case"toString":return"[object UniCloudObject]";case"toJSON":return{}}return function({fn:e,interceptorName:t,getCallbackArgs:n}={}){return async function(...s){const r=n?n({params:s}):{};let o,i;try{return await N(D(t,"invoke"),{...r}),o=await e(...s),await N(D(t,"success"),{...r,result:o}),o}catch(a){throw i=a,await N(D(t,"fail"),{...r,error:i}),i}finally{await N(D(t,"complete"),i?{...r,error:i}:{...r,result:o})}}}({fn:async function r(...l){let h;c&&uni.showLoading({title:o.title,mask:o.mask});const d={name:n,type:"OBJECT",data:{method:u,params:l}};"object"==typeof s.secretMethods&&function(e,t){const n=t.data.method,s=e.secretMethods||{},r=s[n]||s["*"];r&&(t.secretType=r)}(s,d);let f=!1;try{h=await t.callFunction(d)}catch(e){f=!0,h={result:new Z(e)}}const{errSubject:p,errCode:g,errMsg:m,newToken:y}=h.result||{};if(c&&uni.hideLoading(),y&&y.token&&y.tokenExpired&&(se(y),z($,{...y})),g){let e=m;if(f&&a&&(e=(await a({objectName:n,methodName:u,params:l,errSubject:p,errCode:g,errMsg:m})).errMsg||m),c)if("toast"===i.type)uni.showToast({title:e,icon:"none"});else{if("modal"!==i.type)throw new Error(`Invalid errorOptions.type: ${i.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:n,cancelText:s,confirmText:r}={}){return new Promise(((o,i)=>{uni.showModal({title:e,content:t,showCancel:n,cancelText:s,confirmText:r,success(e){o(e)},fail(){o({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:i.retry,cancelText:"取消",confirmText:i.retry?"重试":"确定"});if(i.retry&&t)return r(...l)}}const t=new Z({subject:p,code:g,message:m,requestId:h.requestId});throw t.detail=h.result,z(q,{type:H,content:t}),t}return z(q,{type:H,content:h.result}),h.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:n,methodName:u,params:e}}})}})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const n=t[e];t[e]=function(){return n.apply(t,Array.from(arguments))},t[e]=function(e,t){return function(n){let s=!1;if("callFunction"===t){const e=n&&n.type||g;s=e!==g}const r="callFunction"===t&&!s,o=this._initPromiseHub.exec();n=n||{};const{success:i,fail:a,complete:c}=X(n),u=o.then((()=>s?Promise.resolve():N(D(t,"invoke"),n))).then((()=>e.call(this,n))).then((e=>s?Promise.resolve(e):N(D(t,"success"),e).then((()=>N(D(t,"complete"),e))).then((()=>(r&&z(q,{type:K,content:e}),Promise.resolve(e))))),(e=>s?Promise.reject(e):N(D(t,"fail"),e).then((()=>N(D(t,"complete"),e))).then((()=>(z(q,{type:K,content:e}),Promise.reject(e))))));if(!(i||a||c))return u;u.then((e=>{i&&i(e),c&&c(e),r&&z(q,{type:K,content:e})}),(e=>{a&&a(e),c&&c(e),r&&z(q,{type:K,content:e})}))}}(t[e],e).bind(t)})),t.init=this.init,t}};(()=>{const e=b;let t={};if(e&&1===e.length)t=e[0],jn=jn.init(t),jn._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let n;n=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{jn[e]=function(){return console.error(n),Promise.reject(new Z({code:"SYS_ERR",message:n}))}}))}Object.assign(jn,{get mixinDatacom(){return Un(jn)}}),bn(jn),jn.addInterceptor=U,jn.removeInterceptor=R,jn.interceptObject=M})();const{app:$n,Vuex:Bn,Pinia:Kn}={app:e.createVueApp(a)};uni.Vuex=Bn,uni.Pinia=Kn,$n.provide("__globalStyles",__uniConfig.styles),$n._component.mpType="app",$n._component.render=()=>{},$n.mount("#app")}(Vue); +if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e()).then((()=>n))),(n=>t.resolve(e()).then((()=>{throw n}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function t(e,t,...n){uni.__log__?uni.__log__(e,t,...n):console[e].apply(console,[...n,t])}const n=t=>(n,s=e.getCurrentInstance())=>{!e.isInSSRComponentSetup&&e.injectHook(t,n,s)},s=n("onShow"),r=n("onHide"),o={apiBaseUrl:"https://warehouse.szjixun.cn/oa_backend",h5Url:"http://192.168.88.50:8080/#/"},i={__name:"index",setup(n){const i=e=>{e.isConnected?uni.redirectTo({url:"/pages/index/index"}):uni.showToast({title:"网络无连接",icon:"none"})},a=e.ref(null);s((()=>{uni.onNetworkStatusChange(i),plus.push.getClientInfoAsync((e=>{t("log","at pages/index/index.vue:62","获取CID",e.clientid)}))})),r((()=>{uni.offNetworkStatusChange(i)}));const c=e=>{var t,n;if("load-complete"===(null==(n=null==(t=e.detail.data)?void 0:t[0])?void 0:n.action)){const{statusBarHeight:e}=uni.getSystemInfoSync(),t=getCurrentPages().pop().$getAppWebview();a.value=t.children()[0],a.value.setStyle({top:e,bottom:0})}};return(t,n)=>(e.openBlock(),e.createElementBlock("web-view",{class:"webview",onMessage:c,style:{flex:"1"},ref:"webViewRef",src:e.unref(o).h5Url},null,40,["src"]))}};__definePage("pages/index/index",i),uni.invokePushCallback({type:"enabled",offline:!0}),Promise.resolve().then((()=>{"undefined"!=typeof plus&&plus.push&&plus.globalEvent.addEventListener("newPath",(({path:e})=>{if(!e)return;const t=getCurrentPages(),n=t[t.length-1];n&&n.$page&&n.$page.fullPath===e||uni.navigateTo({url:e,fail(t){t.errMsg.indexOf("tabbar")>-1?uni.switchTab({url:e,fail(e){console.error(e.errMsg)}}):console.error(t.errMsg)}})})),plus.push.setAutoNotification&&plus.push.setAutoNotification(!1)}));const a={onLaunch:function(){},onShow:function(){t("log","at App.vue:6","App Show")},onHide:function(){t("log","at App.vue:9","App Hide")}},c={pages:[{path:"pages/index/index",style:{navigationBarTitleText:"uni-app",navigationStyle:"custom"}}],globalStyle:{navigationBarTextStyle:"black",navigationBarTitleText:"uni-app",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8"},uniIdRouter:{}};function u(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var l=u((function(e,t){var n;e.exports=(n=n||function(e,t){var n=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),s={},r=s.lib={},o=r.Base={extend:function(e){var t=n(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},i=r.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,s=this.sigBytes,r=e.sigBytes;if(this.clamp(),s%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[s+o>>>2]|=i<<24-(s+o)%4*8}else for(o=0;o>>2]=n[o>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,s=[],r=function(t){var n=987654321,s=4294967295;return function(){var r=((n=36969*(65535&n)+(n>>16)&s)<<16)+(t=18e3*(65535&t)+(t>>16)&s)&s;return r/=4294967296,(r+=.5)*(e.random()>.5?1:-1)}},o=0;o>>2]>>>24-r%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new i.init(n,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new i.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},h=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,s=n.words,r=n.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,u=e.min(4*c,r);if(c){for(var l=0;l>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,i=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],_=e[t+7],w=e[t+8],v=e[t+9],I=e[t+10],A=e[t+11],S=e[t+12],k=e[t+13],T=e[t+14],P=e[t+15],b=o[0],x=o[1],O=o[2],C=o[3];b=u(b,x,O,C,i,7,a[0]),C=u(C,b,x,O,c,12,a[1]),O=u(O,C,b,x,f,17,a[2]),x=u(x,O,C,b,p,22,a[3]),b=u(b,x,O,C,g,7,a[4]),C=u(C,b,x,O,m,12,a[5]),O=u(O,C,b,x,y,17,a[6]),x=u(x,O,C,b,_,22,a[7]),b=u(b,x,O,C,w,7,a[8]),C=u(C,b,x,O,v,12,a[9]),O=u(O,C,b,x,I,17,a[10]),x=u(x,O,C,b,A,22,a[11]),b=u(b,x,O,C,S,7,a[12]),C=u(C,b,x,O,k,12,a[13]),O=u(O,C,b,x,T,17,a[14]),b=l(b,x=u(x,O,C,b,P,22,a[15]),O,C,c,5,a[16]),C=l(C,b,x,O,y,9,a[17]),O=l(O,C,b,x,A,14,a[18]),x=l(x,O,C,b,i,20,a[19]),b=l(b,x,O,C,m,5,a[20]),C=l(C,b,x,O,I,9,a[21]),O=l(O,C,b,x,P,14,a[22]),x=l(x,O,C,b,g,20,a[23]),b=l(b,x,O,C,v,5,a[24]),C=l(C,b,x,O,T,9,a[25]),O=l(O,C,b,x,p,14,a[26]),x=l(x,O,C,b,w,20,a[27]),b=l(b,x,O,C,k,5,a[28]),C=l(C,b,x,O,f,9,a[29]),O=l(O,C,b,x,_,14,a[30]),b=h(b,x=l(x,O,C,b,S,20,a[31]),O,C,m,4,a[32]),C=h(C,b,x,O,w,11,a[33]),O=h(O,C,b,x,A,16,a[34]),x=h(x,O,C,b,T,23,a[35]),b=h(b,x,O,C,c,4,a[36]),C=h(C,b,x,O,g,11,a[37]),O=h(O,C,b,x,_,16,a[38]),x=h(x,O,C,b,I,23,a[39]),b=h(b,x,O,C,k,4,a[40]),C=h(C,b,x,O,i,11,a[41]),O=h(O,C,b,x,p,16,a[42]),x=h(x,O,C,b,y,23,a[43]),b=h(b,x,O,C,v,4,a[44]),C=h(C,b,x,O,S,11,a[45]),O=h(O,C,b,x,P,16,a[46]),b=d(b,x=h(x,O,C,b,f,23,a[47]),O,C,i,6,a[48]),C=d(C,b,x,O,_,10,a[49]),O=d(O,C,b,x,T,15,a[50]),x=d(x,O,C,b,m,21,a[51]),b=d(b,x,O,C,S,6,a[52]),C=d(C,b,x,O,p,10,a[53]),O=d(O,C,b,x,I,15,a[54]),x=d(x,O,C,b,c,21,a[55]),b=d(b,x,O,C,w,6,a[56]),C=d(C,b,x,O,P,10,a[57]),O=d(O,C,b,x,y,15,a[58]),x=d(x,O,C,b,k,21,a[59]),b=d(b,x,O,C,g,6,a[60]),C=d(C,b,x,O,A,10,a[61]),O=d(O,C,b,x,f,15,a[62]),x=d(x,O,C,b,v,21,a[63]),o[0]=o[0]+b|0,o[1]=o[1]+x|0,o[2]=o[2]+O|0,o[3]=o[3]+C|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var o=e.floor(s/4294967296),i=s;n[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,s,r,o,i){var a=e+(t&n|~t&s)+r+i;return(a<>>32-o)+t}function l(e,t,n,s,r,o,i){var a=e+(t&s|n&~s)+r+i;return(a<>>32-o)+t}function h(e,t,n,s,r,o,i){var a=e+(t^n^s)+r+i;return(a<>>32-o)+t}function d(e,t,n,s,r,o,i){var a=e+(n^(t|~s))+r+i;return(a<>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),n.MD5)})),u((function(e,t){var n,s,r;e.exports=(s=(n=h).lib.Base,r=n.enc.Utf8,void(n.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,s=4*n;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),a=o.words,c=i.words,u=0;u>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var c=s.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(e){var t=e.length,n=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o>>6-i%4*2;s[o>>>2]|=(a|c)<<24-o%4*8,o++}return r.create(s,o)}(e,t,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)}));const g="FUNCTION",m="pending",y="rejected";function _(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function w(e){return"object"===_(e)}function v(e){return"function"==typeof e}function I(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const A="REJECTED",S="NOT_PENDING";class k{constructor({createPromise:e,retryRule:t=A}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case A:return this.status===y;case S:return this.status!==m}}exec(){return this.needRetry?(this.status=m,this.promise=this.createPromise().then((e=>(this.status="fulfilled",Promise.resolve(e))),(e=>(this.status=y,Promise.reject(e)))),this.promise):this.promise}}function T(e){return e&&"string"==typeof e?JSON.parse(e):e}const P=T([]),b="app";T("");const x=T('[{"provider":"alipay","spaceName":"oaapp","spaceId":"env-00jxgxphla18","spaceAppId":"2021004145628977","accessKey":"ZALus7EgJXdovISb","secretKey":"7qzvVrPN0mAxfcLr"}]')||[];let O="";try{O="__UNI__4796942"}catch(ye){}let C={};function L(e,t={}){var n,s;return n=C,s=e,Object.prototype.hasOwnProperty.call(n,s)||(C[e]=t),C[e]}C=uni._globalUniCloudObj?uni._globalUniCloudObj:uni._globalUniCloudObj={};const E=["invoke","success","fail","complete"],U=L("_globalUniCloudInterceptor");function R(e,t){U[e]||(U[e]={}),w(t)&&Object.keys(t).forEach((n=>{E.indexOf(n)>-1&&function(e,t,n){let s=U[e][t];s||(s=U[e][t]=[]),-1===s.indexOf(n)&&v(n)&&s.push(n)}(e,n,t[n])}))}function N(e,t){U[e]||(U[e]={}),w(t)?Object.keys(t).forEach((n=>{E.indexOf(n)>-1&&function(e,t,n){const s=U[e][t];if(!s)return;const r=s.indexOf(n);r>-1&&s.splice(r,1)}(e,n,t[n])})):delete U[e]}function D(e,t){return e&&0!==e.length?e.reduce(((e,n)=>e.then((()=>n(t)))),Promise.resolve()):Promise.resolve()}function M(e,t){return U[e]&&U[e][t]||[]}function F(e){R("callObject",e)}const q=L("_globalUniCloudListener"),j="response",$="needLogin",B="refreshToken",K="clientdb",H="cloudfunction",J="cloudobject";function W(e){return q[e]||(q[e]=[]),q[e]}function V(e,t){const n=W(e);n.includes(t)||n.push(t)}function z(e,t){const n=W(e),s=n.indexOf(t);-1!==s&&n.splice(s,1)}function Q(e,t){const n=W(e);for(let s=0;s{Y&&e(),function t(){if("function"==typeof getCurrentPages){const t=getCurrentPages();t&&t[0]&&(Y=!0,e())}Y||setTimeout((()=>{t()}),30)}()})),G)}function Z(e){const t={};for(const n in e){const s=e[n];v(s)&&(t[n]=I(s))}return t}class ee extends Error{constructor(e){super(e.message),this.errMsg=e.message||e.errMsg||"unknown system error",this.code=this.errCode=e.code||e.errCode||"SYSTEM_ERROR",this.errSubject=this.subject=e.subject||e.errSubject,this.cause=e.cause,this.requestId=e.requestId}toJson(e=0){if(!(e>=10))return e++,{errCode:this.errCode,errMsg:this.errMsg,errSubject:this.errSubject,cause:this.cause&&this.cause.toJson?this.cause.toJson(e):this.cause}}}var te={request:e=>uni.request(e),uploadFile:e=>uni.uploadFile(e),setStorageSync:(e,t)=>uni.setStorageSync(e,t),getStorageSync:e=>uni.getStorageSync(e),removeStorageSync:e=>uni.removeStorageSync(e),clearStorageSync:()=>uni.clearStorageSync()};function ne(e){return e&&ne(e.__v_raw)||e}function se(){return{token:te.getStorageSync("uni_id_token")||te.getStorageSync("uniIdToken"),tokenExpired:te.getStorageSync("uni_id_token_expired")}}function re({token:e,tokenExpired:t}={}){e&&te.setStorageSync("uni_id_token",e),t&&te.setStorageSync("uni_id_token_expired",t)}let oe,ie;function ae(){return oe||(oe=uni.getSystemInfoSync()),oe}function ce(){let e,t;try{if(uni.getLaunchOptionsSync){if(uni.getLaunchOptionsSync.toString().indexOf("not yet implemented")>-1)return;const{scene:n,channel:s}=uni.getLaunchOptionsSync();e=s,t=n}}catch(n){}return{channel:e,scene:t}}function ue(){const e=uni.getLocale&&uni.getLocale()||"en";if(ie)return{...ie,locale:e,LOCALE:e};const t=ae(),{deviceId:n,osName:s,uniPlatform:r,appId:o}=t,i=["pixelRatio","brand","model","system","language","version","platform","host","SDKVersion","swanNativeVersion","app","AppPlatform","fontSizeSetting"];for(let a=0;a{t(Object.assign(e,{complete(e){e||(e={});const t=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400){const n=e.data&&e.data.error&&e.data.error.code||"SYS_ERR",r=e.data&&e.data.error&&e.data.error.message||e.errMsg||"request:fail";return s(new ee({code:n,message:r,requestId:t}))}const r=e.data;if(r.error)return s(new ee({code:r.error.code,message:r.error.message,requestId:t}));r.result=r.data,r.requestId=t,delete r.data,n(r)}}))}))},de=function(e){return p.stringify(f.parse(e))},fe=class{constructor(e){["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),this.config=Object.assign({},{endpoint:0===e.spaceId.indexOf("mp-")?"https://api.next.bspapp.com":"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId,this.adapter=te,this._getAccessTokenPromiseHub=new k({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new ee({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:S})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return he(e,this.adapter.request)}requestAuth(e){return this.requestWrapped(e)}request(e,t){return Promise.resolve().then((()=>this.hasAccessToken?t?this.requestWrapped(e):this.requestWrapped(e).catch((t=>new Promise(((e,n)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?n(t):e()})).then((()=>this.getAccessToken())).then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})))):this.getAccessToken().then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)}))))}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=le(t.data,this.config.clientSecret),t}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};return"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=le(n,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:s}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,name:n,filePath:s,fileType:r,onUploadProgress:o}){return new Promise(((i,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:r,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?i(e):a(new ee({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new ee({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}async uploadFile({filePath:e,cloudPath:t,fileType:n="image",cloudPathAsRealPath:s=!1,onUploadProgress:r,config:o}){if("string"!==_(t))throw new ee({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new ee({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new ee({code:"INVALID_PARAM",message:"cloudPath不合法"});const i=o&&o.envType||this.config.envType;if(s&&("/"!==t[0]&&(t="/"+t),t.indexOf("\\")>-1))throw new ee({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:i,filename:s?t.split("/").pop():t,fileId:s?t:void 0})).result,c="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:u,accessKeyId:l,signature:h,host:d,ossPath:f,id:p,policy:g,ossCallbackUrl:m}=a,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:l,Signature:h,host:d,id:p,key:f,policy:g,success_action_status:200};if(u&&(y["x-oss-security-token"]=u),m){const e=JSON.stringify({callbackUrl:m,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=de(e)}const w={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:e,fileType:n};if(await this.uploadFileToOSS(Object.assign({},w,{onUploadProgress:r})),m)return{success:!0,filePath:e,fileID:c};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:e,fileID:c};throw new ee({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,n)=>{Array.isArray(e)&&0!==e.length||n(new ee({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),t({fileList:e.map((e=>({fileID:e,tempFileURL:e})))})}))}async getFileInfo({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new ee({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.info",params:JSON.stringify({id:e.map((e=>e.split("?")[0])).join(",")})};return{fileList:(await this.request(this.setupRequest(t))).result}}},pe={init(e){const t=new fe(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}};const ge="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var me,ye;(ye=me||(me={})).local="local",ye.none="none",ye.session="session";var _e=function(){},we=u((function(e,t){var n;e.exports=(n=h,function(e){var t=n,s=t.lib,r=s.WordArray,o=s.Hasher,i=t.algo,a=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(a[r]=n(e.pow(s,.5))),c[r]=n(e.pow(s,1/3)),r++),s++}();var u=[],l=i.SHA256=o.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,s=n[0],r=n[1],o=n[2],i=n[3],a=n[4],l=n[5],h=n[6],d=n[7],f=0;f<64;f++){if(f<16)u[f]=0|e[t+f];else{var p=u[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=u[f-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[f]=g+u[f-7]+y+u[f-16]}var _=s&r^s&o^r&o,w=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+c[f]+u[f];d=h,h=l,l=a,a=i+v|0,i=o,o=r,r=s,s=v+(w+_)|0}n[0]=n[0]+s|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+i|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=e.floor(s/4294967296),n[15+(r+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)})),ve=we,Ie=u((function(e,t){e.exports=h.HmacSHA256}));const Ae=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new ee({message:'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'})};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}const t=new Promise(((t,n)=>{e=(e,s)=>e?n(e):t(s)}));return e.promise=t,e};function Se(e){return void 0===e}function ke(e){return"[object Null]"===Object.prototype.toString.call(e)}var Te;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(Te||(Te={}));const Pe={adapter:null,runtime:void 0},be=["anonymousUuidKey"];class xe extends _e{constructor(){super(),Pe.adapter.root.tcbObject||(Pe.adapter.root.tcbObject={})}setItem(e,t){Pe.adapter.root.tcbObject[e]=t}getItem(e){return Pe.adapter.root.tcbObject[e]}removeItem(e){delete Pe.adapter.root.tcbObject[e]}clear(){delete Pe.adapter.root.tcbObject}}function Oe(e,t){switch(e){case"local":return t.localStorage||new xe;case"none":return new xe;default:return t.sessionStorage||new xe}}class Ce{constructor(e){if(!this._storage){this._persistence=Pe.adapter.primaryStorage||e.persistence,this._storage=Oe(this._persistence,Pe.adapter);const t=`access_token_${e.env}`,n=`access_token_expire_${e.env}`,s=`refresh_token_${e.env}`,r=`anonymous_uuid_${e.env}`,o=`login_type_${e.env}`,i=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:s,anonymousUuidKey:r,loginTypeKey:o,userInfoKey:i}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const n=Oe(e,Pe.adapter);for(const s in this.keys){const e=this.keys[s];if(t&&be.includes(s))continue;const r=this._storage.getItem(e);Se(r)||ke(r)||(n.setItem(e,r),this._storage.removeItem(e))}this._storage=n}setStore(e,t,n){if(!this._storage)return;const s={version:n||"localCachev1",content:t},r=JSON.stringify(s);try{this._storage.setItem(e,r)}catch(o){throw o}}getStore(e,t){try{if(!this._storage)return}catch(s){return""}t=t||"localCachev1";const n=this._storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}removeStore(e){this._storage.removeItem(e)}}const Le={},Ee={};function Ue(e){return Le[e]}class Re{constructor(e,t){this.data=t||null,this.name=e}}class Ne extends Re{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const De=new class{constructor(){this._listeners={}}on(e,t){return n=e,s=t,(r=this._listeners)[n]=r[n]||[],r[n].push(s),this;var n,s,r}off(e,t){return function(e,t,n){if(n&&n[e]){const s=n[e].indexOf(t);-1!==s&&n[e].splice(s,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof Ne)return console.error(e.error),this;const n="string"==typeof e?new Re(e,t||{}):e,s=n.name;if(this._listens(s)){n.target=this;const e=this._listeners[s]?[...this._listeners[s]]:[];for(const t of e)t.call(this,n)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function Me(e,t){De.on(e,t)}function Fe(e,t={}){De.fire(e,t)}function qe(e,t){De.off(e,t)}const je="loginStateChanged",$e="loginStateExpire",Be="loginTypeChanged",Ke="anonymousConverted",He="refreshAccessToken";var Je;!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL"}(Je||(Je={}));const We=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],Ve={"X-SDK-Version":"1.3.5"};function ze(e,t,n){const s=e[t];e[t]=function(t){const r={},o={};n.forEach((n=>{const{data:s,headers:i}=n.call(e,t);Object.assign(r,s),Object.assign(o,i)}));const i=t.data;return i&&(()=>{var e;if(e=i,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...i,...r};else for(const t in r)i.append(t,r[t])})(),t.headers={...t.headers||{},...o},s.call(e,t)}}function Qe(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...Ve,"x-seqid":e}}}class Ge{constructor(e={}){var t;this.config=e,this._reqClass=new Pe.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=Ue(this.config.env),this._localCache=(t=this.config.env,Ee[t]),ze(this._reqClass,"post",[Qe]),ze(this._reqClass,"upload",[Qe]),ze(this._reqClass,"download",[Qe])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(n){t=n}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n,loginTypeKey:s,anonymousUuidKey:r}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let o=this._cache.getStore(n);if(!o)throw new ee({message:"未登录CloudBase"});const i={refresh_token:o},a=await this.request("auth.fetchAccessTokenWithRefreshToken",i);if(a.data.code){const{code:e}=a.data;if("SIGN_PARAM_INVALID"===e||"REFRESH_TOKEN_EXPIRED"===e||"INVALID_REFRESH_TOKEN"===e){if(this._cache.getStore(s)===Je.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(r),t=this._cache.getStore(n),s=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(s.refresh_token),this._refreshAccessToken()}Fe($e),this._cache.removeStore(n)}throw new ee({code:a.data.code,message:`刷新access token失败:${a.data.code}`})}if(a.data.access_token)return Fe(He),this._cache.setStore(e,a.data.access_token),this._cache.setStore(t,a.data.access_token_expire+Date.now()),{accessToken:a.data.access_token,accessTokenExpire:a.data.access_token_expire};a.data.refresh_token&&(this._cache.removeStore(n),this._cache.setStore(n,a.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n}=this._cache.keys;if(!this._cache.getStore(n))throw new ee({message:"refresh token不存在,登录状态异常"});let s=this._cache.getStore(e),r=this._cache.getStore(t),o=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(s,r))&&(o=!1),(!s||!r||r{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:n,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:n,avatarUrl:s,province:r,country:o,city:i}=e,{data:a}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:s,province:r,country:o,city:i});this.setLocalUserInfo(a)}async refresh(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((e=>{this[e]=t[e]})),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class tt{constructor(e){if(!e)throw new ee({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=Ue(e);const{refreshTokenKey:t,accessTokenKey:n,accessTokenExpireKey:s}=this._cache.keys,r=this._cache.getStore(t),o=this._cache.getStore(n),i=this._cache.getStore(s);this.credential={refreshToken:r,accessToken:o,accessTokenExpire:i},this.user=new et(e)}get isAnonymousAuth(){return this.loginType===Je.ANONYMOUS}get isCustomAuth(){return this.loginType===Je.CUSTOM}get isWeixinAuth(){return this.loginType===Je.WECHAT||this.loginType===Je.WECHAT_OPEN||this.loginType===Je.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class nt extends Ze{async signIn(){this._cache.updatePersistence("local");const{anonymousUuidKey:e,refreshTokenKey:t}=this._cache.keys,n=this._cache.getStore(e)||void 0,s=this._cache.getStore(t)||void 0,r=await this._request.send("auth.signInAnonymously",{anonymous_uuid:n,refresh_token:s});if(r.uuid&&r.refresh_token){this._setAnonymousUUID(r.uuid),this.setRefreshToken(r.refresh_token),await this._request.refreshAccessToken(),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.ANONYMOUS,persistence:"local"});const e=new tt(this.config.env);return await e.user.refresh(),e}throw new ee({message:"匿名登录失败"})}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:n}=this._cache.keys,s=this._cache.getStore(t),r=this._cache.getStore(n),o=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:s,refresh_token:r,ticket:e});if(o.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(o.refresh_token),await this._request.refreshAccessToken(),Fe(Ke,{env:this.config.env}),Fe(Be,{loginType:Je.CUSTOM,persistence:"local"}),{credential:{refreshToken:o.refresh_token}};throw new ee({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(n,Je.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class st extends Ze{async signIn(e){if("string"!=typeof e)throw new ee({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,n=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(n.refresh_token)return this.setRefreshToken(n.refresh_token),await this._request.refreshAccessToken(),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new tt(this.config.env);throw new ee({message:"自定义登录失败"})}}class rt extends Ze{async signIn(e,t){if("string"!=typeof e)throw new ee({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token:o,access_token_expire:i}=s;if(r)return this.setRefreshToken(r),o&&i?this.setAccessToken(o,i):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.EMAIL,persistence:this.config.persistence}),new tt(this.config.env);throw s.code?new ee({code:s.code,message:`邮箱登录失败: ${s.message}`}):new ee({message:"邮箱登录失败"})}async activate(e){return this._request.send("auth.activateEndUserMail",{token:e})}async resetPasswordWithToken(e,t){return this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})}}class ot extends Ze{async signIn(e,t){if("string"!=typeof e)throw new ee({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:Je.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token_expire:o,access_token:i}=s;if(r)return this.setRefreshToken(r),i&&o?this.setAccessToken(i,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.USERNAME,persistence:this.config.persistence}),new tt(this.config.env);throw s.code?new ee({code:s.code,message:`用户名密码登录失败: ${s.message}`}):new ee({message:"用户名密码登录失败"})}}class it{constructor(e){this.config=e,this._cache=Ue(e.env),this._request=Xe(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),Me(Be,this._onLoginTypeChanged)}get currentUser(){const e=this.hasLoginState();return e&&e.user||null}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}anonymousAuthProvider(){return new nt(this.config)}customAuthProvider(){return new st(this.config)}emailAuthProvider(){return new rt(this.config)}usernameAuthProvider(){return new ot(this.config)}async signInAnonymously(){return new nt(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new rt(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new ot(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new nt(this.config)),Me(Ke,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===Je.ANONYMOUS)throw new ee({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:n}=this._cache.keys,s=this._cache.getStore(e);if(!s)return;const r=await this._request.send("auth.logout",{refresh_token:s});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(n),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.NULL,persistence:this.config.persistence}),r}async signUpWithEmailAndPassword(e,t){return this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})}async sendPasswordResetEmail(e){return this._request.send("auth.sendPasswordResetEmail",{email:e})}onLoginStateChanged(e){Me(je,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){Me($e,e.bind(this))}onAccessTokenRefreshed(e){Me(He,e.bind(this))}onAnonymousConverted(e){Me(Ke,e.bind(this))}onLoginTypeChanged(e){Me(Be,(()=>{const t=this.hasLoginState();e.call(this,t)}))}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{refreshTokenKey:e}=this._cache.keys;return this._cache.getStore(e)?new tt(this.config.env):null}async isUsernameRegistered(e){if("string"!=typeof e)throw new ee({code:"PARAM_ERROR",message:"username must be a string"});const{data:t}=await this._request.send("auth.isUsernameRegistered",{username:e});return t&&t.isRegistered}getLoginState(){return Promise.resolve(this.hasLoginState())}async signInWithTicket(e){return new st(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then((e=>e.code?e:{...e.data,requestId:e.seqId}))}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,n=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+n}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:n,env:s}=e.data;s===this.config.env&&(this._cache.updatePersistence(n),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const at=function(e,t){t=t||Ae();const n=Xe(this.config.env),{cloudPath:s,filePath:r,onUploadProgress:o,fileType:i="image"}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{const{data:{url:a,authorization:c,token:u,fileId:l,cosFileId:h},requestId:d}=e,f={key:s,signature:c,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":u};n.upload({url:a,data:f,file:r,name:s,fileType:i,onUploadProgress:o}).then((e=>{201===e.statusCode?t(null,{fileID:l,requestId:d}):t(new ee({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},ct=function(e,t){t=t||Ae();const n=Xe(this.config.env),{cloudPath:s}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},ut=function({fileList:e},t){if(t=t||Ae(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let s of e)if(!s||"string"!=typeof s)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const n={fileid_list:e};return Xe(this.config.env).send("storage.batchDeleteFile",n).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},lt=function({fileList:e},t){t=t||Ae(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let n=[];for(let r of e)"object"==typeof r?(r.hasOwnProperty("fileID")&&r.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),n.push({fileid:r.fileID,max_age:r.maxAge})):"string"==typeof r?n.push({fileid:r}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const s={file_list:n};return Xe(this.config.env).send("storage.batchGetDownloadUrl",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},ht=async function({fileID:e},t){const n=(await lt.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==n.code)return t?t(n):new Promise((e=>{e(n)}));const s=Xe(this.config.env);let r=n.download_url;if(r=encodeURI(r),!t)return s.download({url:r});t(await s.download({url:r}))},dt=function({name:e,data:t,query:n,parse:s,search:r},o){const i=o||Ae();let a;try{a=t?JSON.stringify(t):""}catch(u){return Promise.reject(u)}if(!e)return Promise.reject(new ee({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:n,parse:s,search:r,function_name:e,request_data:a};return Xe(this.config.env).send("functions.invokeFunction",c).then((e=>{if(e.code)i(null,e);else{let n=e.data.response_data;if(s)i(null,{result:n,requestId:e.requestId});else try{n=JSON.parse(e.data.response_data),i(null,{result:n,requestId:e.requestId})}catch(t){i(new ee({message:"response data must be json"}))}}return i.promise})).catch((e=>{i(e)})),i.promise},ft={timeout:15e3,persistence:"session"},pt={};class gt{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(Pe.adapter||(this.requestClient=new Pe.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...ft,...e},!0){case this.config.timeout>6e5:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=6e5;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new gt(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||Pe.adapter.primaryStorage||ft.persistence;var n;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;Le[t]=new Ce(e),Ee[t]=new Ce({...e,persistence:"local"})}(this.config),n=this.config,Ye[n.env]=new Ge(n),this.authObj=new it(this.config),this.authObj}on(e,t){return Me.apply(this,[e,t])}off(e,t){return qe.apply(this,[e,t])}callFunction(e,t){return dt.apply(this,[e,t])}deleteFile(e,t){return ut.apply(this,[e,t])}getTempFileURL(e,t){return lt.apply(this,[e,t])}downloadFile(e,t){return ht.apply(this,[e,t])}uploadFile(e,t){return at.apply(this,[e,t])}getUploadMetadata(e,t){return ct.apply(this,[e,t])}registerExtension(e){pt[e.name]=e}async invokeExtension(e,t){const n=pt[e];if(!n)throw new ee({message:`扩展${e} 必须先注册`});return await n.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:n}=function(e){const t=(n=e,"[object Array]"===Object.prototype.toString.call(n)?e:[e]);var n;for(const s of t){const{isMatch:e,genAdapter:t,runtime:n}=s;if(e())return{adapter:t(),runtime:n}}}(e)||{};t&&(Pe.adapter=t),n&&(Pe.runtime=n)}}var mt=new gt;function yt(e,t,n){void 0===n&&(n={});var s=/\?/.test(t),r="";for(var o in n)""===r?!s&&(t+="?"):r+="&",r+=o+"="+encodeURIComponent(n[o]);return/^http(s)?:\/\//.test(t+=r)?t:""+e+t}class _t{post(e){const{url:t,data:n,headers:s}=e;return new Promise(((e,r)=>{te.request({url:yt("https:",t),data:n,method:"POST",header:s,success(t){e(t)},fail(e){r(e)}})}))}upload(e){return new Promise(((t,n)=>{const{url:s,file:r,data:o,headers:i,fileType:a}=e,c=te.uploadFile({url:yt("https:",s),name:"file",formData:Object.assign({},o),filePath:r,fileType:a,header:i,success(e){const n={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&o.success_action_status&&(n.statusCode=parseInt(o.success_action_status,10)),t(n)},fail(e){n(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((t=>{e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}const wt={setItem(e,t){te.setStorageSync(e,t)},getItem:e=>te.getStorageSync(e),removeItem(e){te.removeStorageSync(e)},clear(){te.clearStorageSync()}};var vt={genAdapter:function(){return{root:{},reqClass:_t,localStorage:wt,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};mt.useAdapters(vt);const It=mt,At=It.init;It.init=function(e){e.env=e.spaceId;const t=At.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const n=t.auth;return t.auth=function(e){const t=n.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var n;t[e]=(n=t[e],function(e){e=e||{};const{success:t,fail:s,complete:r}=Z(e);if(!(t||s||r))return n.call(this,e);n.call(this,e).then((e=>{t&&t(e),r&&r(e)}),(e=>{s&&s(e),r&&r(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var St=It,kt=class extends fe{getAccessToken(){return new Promise(((e,t)=>{const n="Anonymous_Access_token";this.setAccessToken(n),e(n)}))}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=le(n,this.config.clientSecret);const r=ue();s["x-client-info"]=encodeURIComponent(JSON.stringify(r));const{token:o}=se();return s["x-client-token"]=o,{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:JSON.parse(JSON.stringify(s))}}uploadFileToOSS({url:e,formData:t,name:n,filePath:s,fileType:r,onUploadProgress:o}){return new Promise(((i,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:r,success(e){e&&e.statusCode<400?i(e):a(new ee({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new ee({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}uploadFile({filePath:e,cloudPath:t,fileType:n="image",onUploadProgress:s}){if(!t)throw new ee({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let r;return this.getOSSUploadOptionsFromPath({cloudPath:t}).then((t=>{const{url:o,formData:i,name:a}=t.result;r=t.result.fileUrl;const c={url:o,formData:i,name:a,filePath:e,fileType:n};return this.uploadFileToOSS(Object.assign({},c,{onUploadProgress:s}))})).then((()=>this.reportOSSUpload({cloudPath:t}))).then((t=>new Promise(((n,s)=>{t.success?n({success:!0,filePath:e,fileID:r}):s(new ee({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return e.result;throw new ee({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e,maxAge:t}={}){if(!Array.isArray(e)||0===e.length)throw new ee({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const n={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e,maxAge:t})};return this.request(this.setupRequest(n)).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new ee({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}},Tt={init(e){const t=new kt(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}},Pt=u((function(e,t){e.exports=h.enc.Hex}));function bt(e="",t={}){const{data:n,functionName:s,method:r,headers:o,signHeaderKeys:i=[],config:a}=t,c=Date.now(),u="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),l=Object.assign({},o,{"x-from-app-id":a.spaceAppId,"x-from-env-id":a.spaceId,"x-to-env-id":a.spaceId,"x-from-instance-id":c,"x-from-function-name":s,"x-client-timestamp":c,"x-alipay-source":"client","x-request-id":u,"x-alipay-callid":u,"x-trace-id":u}),h=["x-from-app-id","x-from-env-id","x-to-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp"].concat(i),[d="",f=""]=e.split("?")||[],p=function(e){const t=e.signedHeaders.join(";"),n=e.signedHeaders.map((t=>`${t.toLowerCase()}:${e.headers[t]}\n`)).join(""),s=ve(e.body).toString(Pt),r=`${e.method.toUpperCase()}\n${e.path}\n${e.query}\n${n}\n${t}\n${s}\n`,o=ve(r).toString(Pt),i=`HMAC-SHA256\n${e.timestamp}\n${o}\n`,a=Ie(i,e.secretKey).toString(Pt);return`HMAC-SHA256 Credential=${e.secretId}, SignedHeaders=${t}, Signature=${a}`}({path:d,query:f,method:r,headers:l,timestamp:c,body:JSON.stringify(n),secretId:a.accessKey,secretKey:a.secretKey,signedHeaders:h.sort()});return{url:`${a.endpoint}${e}`,headers:Object.assign({},l,{Authorization:p})}}function xt({url:e,data:t,method:n="POST",headers:s={}}){return new Promise(((r,o)=>{te.request({url:e,method:n,data:t,header:s,dataType:"json",complete:(e={})=>{const t=s["x-trace-id"]||"";if(!e.statusCode||e.statusCode>=400){const{message:n,errMsg:s,trace_id:r}=e.data||{};return o(new ee({code:"SYS_ERR",message:n||s||"request:fail",requestId:r||t}))}r({status:e.statusCode,data:e.data,headers:e.header,requestId:t})}})}))}function Ot(e,t){const{path:n,data:s,method:r="GET"}=e,{url:o,headers:i}=bt(n,{functionName:"",data:s,method:r,headers:{"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":Date.now()+6e4},signHeaderKeys:["x-data-api-type","x-expire-timestamp"],config:t});return xt({url:o,data:s,method:r,headers:i}).then((e=>{const t=e.data||{};if(!t.success)throw new ee({code:e.errCode,message:e.errMsg,requestId:e.requestId});return t.data||{}})).catch((e=>{throw new ee({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}function Ct(e=""){const t=e.trim().replace(/^cloud:\/\//,""),n=t.indexOf("/");if(n<=0)throw new ee({code:"INVALID_PARAM",message:"fileID不合法"});const s=t.substring(0,n),r=t.substring(n+1);return s!==this.config.spaceId&&console.warn("file ".concat(e," does not belong to env ").concat(this.config.spaceId)),r}function Lt(e=""){return"cloud://".concat(this.config.spaceId,"/").concat(e.replace(/^\/+/,""))}var Et={init:e=>{e.provider="alipay";const t=new class{constructor(e){if(["spaceId","spaceAppId","accessKey","secretKey"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),e.endpoint){if("string"!=typeof e.endpoint)throw new Error("endpoint must be string");if(!/^https:\/\//.test(e.endpoint))throw new Error("endpoint must start with https://");e.endpoint=e.endpoint.replace(/\/$/,"")}this.config=Object.assign({},e,{endpoint:e.endpoint||`https://${e.spaceId}.api-hz.cloudbasefunction.cn`})}callFunction(e){return function(e,t){const{name:n,data:s}=e,r="POST",{url:o,headers:i}=bt("/functions/invokeFunction",{functionName:n,data:s,method:r,headers:{"x-to-function-name":n},signHeaderKeys:["x-to-function-name"],config:t});return xt({url:o,data:s,method:r,headers:i}).then((e=>({errCode:0,success:!0,requestId:e.requestId,result:e.data}))).catch((e=>{throw new ee({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}(e,this.config)}uploadFileToOSS({url:e,filePath:t,fileType:n,formData:s,onUploadProgress:r}){return new Promise(((o,i)=>{const a=te.uploadFile({url:e,filePath:t,fileType:n,formData:s,name:"file",success(e){e&&e.statusCode<400?o(e):i(new ee({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){i(new ee({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof r&&a&&"function"==typeof a.onProgressUpdate&&a.onProgressUpdate((e=>{r({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}async uploadFile({filePath:e,cloudPath:t="",fileType:n="image",onUploadProgress:s}){if("string"!==_(t))throw new ee({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new ee({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new ee({code:"INVALID_PARAM",message:"cloudPath不合法"});const r=await Ot({path:"/".concat(t.replace(/^\//,""),"?post_url")},this.config),{file_id:o,upload_url:i,form_data:a}=r,c=a&&a.reduce(((e,t)=>(e[t.key]=t.value,e)),{});return this.uploadFileToOSS({url:i,filePath:e,fileType:n,formData:c,onUploadProgress:s}).then((()=>({fileID:o})))}async getTempFileURL({fileList:e}){return new Promise(((t,n)=>{(!e||e.length<0)&&n(new ee({errCode:"INVALID_PARAM",errMsg:"fileList不能为空数组"})),e.length>50&&n(new ee({errCode:"INVALID_PARAM",errMsg:"fileList数组长度不能超过50"}));const s=[];for(const r of e){"string"!==_(r)&&n(new ee({errCode:"INVALID_PARAM",errMsg:"fileList的元素必须是非空的字符串"}));const e=Ct.call(this,r);s.push({file_id:e,expire:600})}Ot({path:"/?download_url",data:{file_list:s},method:"POST"},this.config).then((e=>{const{file_list:n=[]}=e;t({fileList:n.map((e=>({fileID:Lt.call(this,e.file_id),tempFileURL:e.download_url})))})})).catch((e=>n(e)))}))}}(e);return t.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},t}};function Ut({data:e}){let t;t=ue();const n=JSON.parse(JSON.stringify(e||{}));if(Object.assign(n,{clientInfo:t}),!n.uniIdToken){const{token:e}=se();e&&(n.uniIdToken=e)}return n}const Rt=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var Nt=/[\\^$.*+?()[\]{}|]/g,Dt=RegExp(Nt.source);function Mt(e,t,n){return e.replace(new RegExp((s=t)&&Dt.test(s)?s.replace(Nt,"\\$&"):s,"g"),n);var s}const Ft="request",qt="response",jt="both",$t={code:2e4,message:"System error"},Bt={code:20101,message:"Invalid client"};function Kt(e){const{errSubject:t,subject:n,errCode:s,errMsg:r,code:o,message:i,cause:a}=e||{};return new ee({subject:t||n||"uni-secure-network",code:s||o||$t.code,message:r||i,cause:a})}let Ht;function Jt({secretType:e}={}){return e===Ft||e===qt||e===jt}function Wt({name:e,data:t={}}={}){return"DCloud-clientDB"===e&&"encryption"===t.redirectTo&&"getAppClientKey"===t.action}function Vt({functionName:e,result:t,logPvd:n}){}function zt(e){const t=e.callFunction,n=function(n){const s=n.name;n.data=Ut.call(e,{data:n.data});const r={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay"}[this.config.provider],o=Jt(n),i=Wt(n),a=o||i;return t.call(this,n).then((e=>(e.errCode=0,!a&&Vt.call(this,{functionName:s,result:e,logPvd:r}),Promise.resolve(e))),(e=>(!a&&Vt.call(this,{functionName:s,result:e,logPvd:r}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:n=[]}={}){for(let s=0;sn.provider===e&&n.spaceId===t));return s&&s.config}({provider:e,spaceId:t});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},u=Object.keys(c);if(0===u.length)return!0;const l=function(e,t){let n,s,r;for(let o=0;oe.trim())).indexOf(t)>-1&&(s=i):r=i:n=i}return n||s||r}(u,n);if(!l)return!1;if((c[l]||[]).find(((e={})=>e.appId===s&&(e.platform||"").toLowerCase()===i.toLowerCase())))return!0;throw console.error(`此应用[appId: ${s}, platform: ${i}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),Kt(Bt)}({provider:s,spaceId:r,functionName:o})?new Ht({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(n.bind(e))(t):i(t),Object.defineProperty(a,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),a.then((e=>("undefined"!=typeof UTSJSONObject&&(e.result=new UTSJSONObject(e.result)),e)))}}Ht=class{constructor(){throw Kt({message:`Platform ${b} is not enabled, please check whether secure network module is enabled in your manifest.json`})}};const Qt=Symbol("CLIENT_DB_INTERNAL");function Gt(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Qt,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,n,s){if("_uniClient"===n)return null;if("symbol"==typeof n)return e[n];if(n in e||"string"!=typeof n){const t=e[n];return"function"==typeof t?t.bind(e):t}return t.get(e,n,s)}})}function Yt(e){return{on:(t,n)=>{e[t]=e[t]||[],e[t].indexOf(n)>-1||e[t].push(n)},off:(t,n)=>{e[t]=e[t]||[];const s=e[t].indexOf(n);-1!==s&&e[t].splice(s,1)}}}const Xt=["db.Geo","db.command","command.aggregate"];function Zt(e,t){return Xt.indexOf(`${e}.${t}`)>-1}function en(e){switch(_(e=ne(e))){case"array":return e.map((e=>en(e)));case"object":return e._internalType===Qt||Object.keys(e).forEach((t=>{e[t]=en(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function tn(e){return e&&e.content&&e.content.$method}class nn{constructor(e,t,n){this.content=e,this.prevStage=t||null,this.udb=null,this._database=n}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((e=>({$method:e.$method,$param:en(e.$param)})))}}toString(){return JSON.stringify(this.toJSON())}getAction(){const e=this.toJSON().$db.find((e=>"action"===e.$method));return e&&e.$param&&e.$param[0]}getCommand(){return{$db:this.toJSON().$db.filter((e=>"action"!==e.$method))}}get isAggregate(){let e=this;for(;e;){const t=tn(e),n=tn(e.prevStage);if("aggregate"===t&&"collection"===n||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===tn(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=tn(e),n=tn(e.prevStage);if("aggregate"===t&&"command"===n)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return sn({$method:e,$param:en(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const n=this.getAction(),s=this.getCommand();return s.$db.push({$method:e,$param:en(t)}),this._database._callCloudFunction({action:n,command:s})}}function sn(e,t,n){return Gt(new nn(e,t,n),{get(e,t){let s="db";return e&&e.content&&(s=e.content.$method),Zt(s,t)?sn({$method:t},e,n):function(){return sn({$method:t,$param:en(Array.from(arguments))},e,n)}}})}function rn({path:e,method:t}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...e.map((e=>({$method:e}))),{$method:t,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}function on(e,t={}){return Gt(new e(t),{get:(e,t)=>Zt("db",t)?sn({$method:t},null,e):function(){return sn({$method:t,$param:en(Array.from(arguments))},null,e)}})}class an extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=L("_globalUniCloudDatabaseCallback")),t||(this.auth=Yt(this._authCallBacks)),this._isJQL=t,Object.assign(this,Yt(this._dbCallBacks)),this.env=Gt({},{get:(e,t)=>({$env:t})}),this.Geo=Gt({},{get:(e,t)=>rn({path:["Geo"],method:t})}),this.serverDate=rn({path:[],method:"serverDate"}),this.RegExp=rn({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const n=this._dbCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const n=this._authCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),n=e.getCommand();if("getTemp"!==n.$db[n.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:n}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:n,queryList:s}){function r(e,t){if(n&&s)for(let n=0;nD(M(i,"complete"),e))).then((()=>(r(null,e),Q(j,{type:K,content:e}),Promise.reject(e))))}const c=D(M(i,"invoke")),u=this._uniClient;return c.then((()=>u.callFunction({name:"DCloud-clientDB",type:"CLIENT_DB",data:{action:e,command:t,multiCommand:n}}))).then((e=>{const{code:t,message:n,token:s,tokenExpired:c,systemInfo:u=[]}=e.result;if(u)for(let r=0;r(console.warn(n),s)})}}return h=e,D(M(i,"success"),h).then((()=>D(M(i,"complete"),h))).then((()=>{r(h,null);const e=o._parseResult(h);return Q(j,{type:K,content:e}),Promise.resolve(e)}));var h}),(e=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),a(new ee({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const cn="token无效,跳转登录页面",un="token过期,跳转登录页面",ln={TOKEN_INVALID_TOKEN_EXPIRED:un,TOKEN_INVALID_INVALID_CLIENTID:cn,TOKEN_INVALID:cn,TOKEN_INVALID_WRONG_TOKEN:cn,TOKEN_INVALID_ANONYMOUS_USER:cn},hn={"uni-id-token-expired":un,"uni-id-check-token-failed":cn,"uni-id-token-not-exist":cn,"uni-id-check-device-feature-failed":cn};function dn(e,t){let n="";return n=e?`${e}/${t}`:t,n.replace(/^\//,"")}function fn(e=[],t=""){const n=[],s=[];return e.forEach((e=>{!0===e.needLogin?n.push(dn(t,e.path)):!1===e.needLogin&&s.push(dn(t,e.path))})),{needLoginPage:n,notNeedLoginPage:s}}function pn(e){return e.split("?")[0].replace(/^\//,"")}function gn(){return function(e){let t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){const e=getCurrentPages();return e[e.length-1]}())}function mn(){return pn(gn())}function yn(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const n=t.list,s=pn(e);return n.some((e=>e.pagePath===s))}const _n=!!c.uniIdRouter,{loginPage:wn,routerNeedLogin:vn,resToLogin:In,needLoginPage:An,notNeedLoginPage:Sn,loginPageInTabBar:kn}=function({pages:e=[],subPackages:t=[],uniIdRouter:n={},tabBar:s={}}=c){const{loginPage:r,needLogin:o=[],resToLogin:i=!0}=n,{needLoginPage:a,notNeedLoginPage:u}=fn(e),{needLoginPage:l,notNeedLoginPage:h}=function(e=[]){const t=[],n=[];return e.forEach((e=>{const{root:s,pages:r=[]}=e,{needLoginPage:o,notNeedLoginPage:i}=fn(r,s);t.push(...o),n.push(...i)})),{needLoginPage:t,notNeedLoginPage:n}}(t);return{loginPage:r,routerNeedLogin:o,resToLogin:i,needLoginPage:[...a,...l],notNeedLoginPage:[...u,...h],loginPageInTabBar:yn(r,s)}}();if(An.indexOf(wn)>-1)throw new Error(`Login page [${wn}] should not be "needLogin", please check your pages.json`);function Tn(e){const t=mn();if("/"===e.charAt(0))return e;const[n,s]=e.split("?"),r=n.replace(/^\//,"").split("/"),o=t.split("/");o.pop();for(let i=0;i-1?s+`&uniIdRedirectUrl=${encodeURIComponent(r)}`:s+`?uniIdRedirectUrl=${encodeURIComponent(r)}`:s);var s,r;kn?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const o={navigateTo:uni.navigateTo,redirectTo:uni.redirectTo,switchTab:uni.switchTab,reLaunch:uni.reLaunch};setTimeout((()=>{o[e]({url:n})}),0)}function xn({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},n=function(){const{token:e,tokenExpired:t}=se();let n;if(e){if(t-1)&&(An.indexOf(t)>-1||vn.some((t=>{return n=e,new RegExp(t).test(n);var n})))}(e)&&n){if(n.uniIdRedirectUrl=e,W($).length>0)return setTimeout((()=>{Q($,n)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function On(){!function(){const e=gn(),{abortLoginPageJump:t,autoToLoginPage:n}=xn({url:e});t||n&&bn({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t{const{type:t,content:n}=e;let s=!1;switch(t){case"cloudobject":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in hn}(n);break;case"clientdb":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in ln}(n)}s&&function(e={}){const t=W($);X().then((()=>{const n=gn();if(n&&Pn({redirect:n}))return t.length>0?Q($,Object.assign({uniIdRedirectUrl:n},e)):void(wn&&bn({api:"navigateTo",redirect:n}))}))}(n)}))}function Ln(e){var t;(t=e).onResponse=function(e){V(j,e)},t.offResponse=function(e){z(j,e)},function(e){e.onNeedLogin=function(e){V($,e)},e.offNeedLogin=function(e){z($,e)},_n&&(L("_globalUniCloudStatus").needLoginInit||(L("_globalUniCloudStatus").needLoginInit=!0,X().then((()=>{On.call(e)})),In&&Cn.call(e)))}(e),function(e){e.onRefreshToken=function(e){V(B,e)},e.offRefreshToken=function(e){z(B,e)}}(e)}let En;const Un="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Rn=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Nn(){const e=se().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((s=t[1],decodeURIComponent(En(s).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(r){throw new Error("获取当前用户信息出错,详细错误信息为:"+r.message)}var s;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}En="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Rn.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,s,r="",o=0;o>16&255):64===s?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return r}:atob;var Dn=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(u((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n="chooseAndUploadFile:ok",s="chooseAndUploadFile:fail";function r(e,t){return e.tempFiles.forEach(((e,n)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+n+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function o(e,t,{onChooseFile:s,onUploadProgress:r}){return t.then((e=>{if(s){const t=s(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:n,tempFilePaths:[],tempFiles:[]}:function(e,t,s=5,r){(t=Object.assign({},t)).errMsg=n;const o=t.tempFiles,i=o.length;let a=0;return new Promise((n=>{for(;a=i)return void(!o.find((e=>!e.url&&!e.errMsg))&&n(t));const u=o[s];e.uploadFile({provider:u.provider,filePath:u.path,cloudPath:u.cloudPath,fileType:u.fileType,cloudPathAsRealPath:u.cloudPathAsRealPath,onUploadProgress(e){e.index=s,e.tempFile=u,e.tempFilePath=u.path,r&&r(e)}}).then((e=>{u.url=e.fileID,s{u.errMsg=e.errMsg||e.message,s{uni.chooseImage({count:t,sizeType:n,sourceType:o,extension:i,success(t){e(r(t,"image"))},fail(e){a({errMsg:e.errMsg.replace("chooseImage:fail",s)})}})}))}(t),t):"video"===t.type?o(e,function(e){const{camera:t,compressed:n,maxDuration:o,sourceType:i=["album","camera"],extension:a}=e;return new Promise(((e,c)=>{uni.chooseVideo({camera:t,compressed:n,maxDuration:o,sourceType:i,extension:a,success(t){const{tempFilePath:n,duration:s,size:o,height:i,width:a}=t;e(r({errMsg:"chooseVideo:ok",tempFilePaths:[n],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:n,size:o,type:t.tempFile&&t.tempFile.type||"",width:a,height:i,duration:s,fileType:"video",cloudPath:""}]},"video"))},fail(e){c({errMsg:e.errMsg.replace("chooseVideo:fail",s)})}})}))}(t),t):o(e,function(e){const{count:t,extension:n}=e;return new Promise(((e,o)=>{let i=uni.chooseFile;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(i=wx.chooseMessageFile),"function"!=typeof i)return o({errMsg:s+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});i({type:"all",count:t,extension:n,success(t){e(r(t))},fail(e){o({errMsg:e.errMsg.replace("chooseFile:fail",s)})}})}))}(t),t)}}})));function Mn(e){return{props:{localdata:{type:Array,default:()=>[]},options:{type:[Object,Array],default:()=>({})},spaceInfo:{type:Object,default:()=>({})},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:()=>({mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{},mixinDatacomError:null}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((t=>{e.push(this[t])})),e}),((e,t)=>{if("manual"===this.loadtime)return;let n=!1;const s=[];for(let r=2;r{this.mixinDatacomLoading=!1;const{data:s,count:r}=n.result;this.getcount&&(this.mixinDatacomPage.count=r),this.mixinDatacomHasMore=s.length{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,this.mixinDatacomError=e,n&&n(e)})))},mixinDatacomGet(t={}){let n;t=t||{},n="undefined"!=typeof __uniX&&__uniX?e.databaseForJQL(this.spaceInfo):e.database(this.spaceInfo);const s=t.action||this.action;s&&(n=n.action(s));const r=t.collection||this.collection;n=Array.isArray(r)?n.collection(...r):n.collection(r);const o=t.where||this.where;o&&Object.keys(o).length&&(n=n.where(o));const i=t.field||this.field;i&&(n=n.field(i));const a=t.foreignKey||this.foreignKey;a&&(n=n.foreignKey(a));const c=t.groupby||this.groupby;c&&(n=n.groupBy(c));const u=t.groupField||this.groupField;u&&(n=n.groupField(u)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(n=n.distinct());const l=t.orderby||this.orderby;l&&(n=n.orderBy(l));const h=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,d=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,f=void 0!==t.getcount?t.getcount:this.getcount,p=void 0!==t.gettree?t.gettree:this.gettree,g=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,m={getCount:f},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return p&&(m.getTree=y),g&&(m.getTreePath=y),n=n.skip(d*(h-1)).limit(d).get(m),n}}}}function Fn(e){return L("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function qn({openid:e,callLoginByWeixin:t=!1}={}){throw Fn(this),new Error(`[SecureNetwork] API \`initSecureNetworkByWeixin\` is not supported on platform \`${b}\``)}async function jn(e){const t=Fn(this);return t.initPromise||(t.initPromise=qn.call(this,e).then((e=>e)).catch((e=>{throw delete t.initPromise,e}))),t.initPromise}function $n(e){const t={getSystemInfo:uni.getSystemInfo,getPushClientId:uni.getPushClientId};return function(n){return new Promise(((s,r)=>{t[e]({...n,success(e){s(e)},fail(e){r(e)}})}))}}class Bn extends class{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const n=this._callback[e];if(!n)return;const s=function(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t)return n;return-1}(n,t);n.splice(s,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const n=this._callback[e];if(n)for(let s=0;s{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()}),(e=>{throw this.emit("error",e),this.close(),e}))}async open(){return this.init()}_isUniCloudSSE(e){if("receive"!==e.type)return!1;const t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:n,messageId:s,message:r}=t;this._payloadQueue.push({action:n,messageId:s,message:r}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find((e=>e.messageId===this._currentMessageId+1));if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:n,message:s}=e;"end"===t?this._end({messageId:n,message:s}):"message"===t&&this._appendMessage({messageId:n,message:s})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){uni.onPushMessage(this._uniPushMessageCallback)}_destroy(){uni.offPushMessage(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const Kn={tcb:St,tencent:St,aliyun:pe,private:Tt,alipay:Et};let Hn=new class{init(e){let t={};const n=Kn[e.provider];if(!n)throw new Error("未提供正确的provider参数");var s;return t=n.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new k({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const n=e.auth();return t.then((()=>n.getLoginState())).then((e=>e?Promise.resolve():n.signInAnonymously()))}}))}(t),zt(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(s=t).database=function(e){if(e&&Object.keys(e).length>0)return s.init(e).database();if(this._database)return this._database;const t=on(an,{uniClient:s});return this._database=t,t},s.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return s.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=on(an,{uniClient:s,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=Nn,e.chooseAndUploadFile=Dn.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return Mn(e)}}),e.SSEChannel=Bn,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:n=!1}={}){return jn.call(e,{openid:t,callLoginByWeixin:n})}}(e),e.importObject=function(t){return function(n,s={}){s=function(e,t={}){return e.customUI=t.customUI||e.customUI,e.parseSystemError=t.parseSystemError||e.parseSystemError,Object.assign(e.loadingOptions,t.loadingOptions),Object.assign(e.errorOptions,t.errorOptions),"object"==typeof t.secretMethods&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},s);const{customUI:r,loadingOptions:o,errorOptions:i,parseSystemError:a}=s,c=!r;return new Proxy({},{get(r,u){switch(u){case"toString":return"[object UniCloudObject]";case"toJSON":return{}}return function({fn:e,interceptorName:t,getCallbackArgs:n}={}){return async function(...s){const r=n?n({params:s}):{};let o,i;try{return await D(M(t,"invoke"),{...r}),o=await e(...s),await D(M(t,"success"),{...r,result:o}),o}catch(a){throw i=a,await D(M(t,"fail"),{...r,error:i}),i}finally{await D(M(t,"complete"),i?{...r,error:i}:{...r,result:o})}}}({fn:async function r(...l){let h;c&&uni.showLoading({title:o.title,mask:o.mask});const d={name:n,type:"OBJECT",data:{method:u,params:l}};"object"==typeof s.secretMethods&&function(e,t){const n=t.data.method,s=e.secretMethods||{},r=s[n]||s["*"];r&&(t.secretType=r)}(s,d);let f=!1;try{h=await t.callFunction(d)}catch(e){f=!0,h={result:new ee(e)}}const{errSubject:p,errCode:g,errMsg:m,newToken:y}=h.result||{};if(c&&uni.hideLoading(),y&&y.token&&y.tokenExpired&&(re(y),Q(B,{...y})),g){let e=m;if(f&&a&&(e=(await a({objectName:n,methodName:u,params:l,errSubject:p,errCode:g,errMsg:m})).errMsg||m),c)if("toast"===i.type)uni.showToast({title:e,icon:"none"});else{if("modal"!==i.type)throw new Error(`Invalid errorOptions.type: ${i.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:n,cancelText:s,confirmText:r}={}){return new Promise(((o,i)=>{uni.showModal({title:e,content:t,showCancel:n,cancelText:s,confirmText:r,success(e){o(e)},fail(){o({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:i.retry,cancelText:"取消",confirmText:i.retry?"重试":"确定"});if(i.retry&&t)return r(...l)}}const t=new ee({subject:p,code:g,message:m,requestId:h.requestId});throw t.detail=h.result,Q(j,{type:J,content:t}),t}return Q(j,{type:J,content:h.result}),h.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:n,methodName:u,params:e}}})}})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const n=t[e];t[e]=function(){return n.apply(t,Array.from(arguments))},t[e]=function(e,t){return function(n){let s=!1;if("callFunction"===t){const e=n&&n.type||g;s=e!==g}const r="callFunction"===t&&!s,o=this._initPromiseHub.exec();n=n||{};const{success:i,fail:a,complete:c}=Z(n),u=o.then((()=>s?Promise.resolve():D(M(t,"invoke"),n))).then((()=>e.call(this,n))).then((e=>s?Promise.resolve(e):D(M(t,"success"),e).then((()=>D(M(t,"complete"),e))).then((()=>(r&&Q(j,{type:H,content:e}),Promise.resolve(e))))),(e=>s?Promise.reject(e):D(M(t,"fail"),e).then((()=>D(M(t,"complete"),e))).then((()=>(Q(j,{type:H,content:e}),Promise.reject(e))))));if(!(i||a||c))return u;u.then((e=>{i&&i(e),c&&c(e),r&&Q(j,{type:H,content:e})}),(e=>{a&&a(e),c&&c(e),r&&Q(j,{type:H,content:e})}))}}(t[e],e).bind(t)})),t.init=this.init,t}};(()=>{const e=x;let t={};if(e&&1===e.length)t=e[0],Hn=Hn.init(t),Hn._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let n;n=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{Hn[e]=function(){return console.error(n),Promise.reject(new ee({code:"SYS_ERR",message:n}))}}))}Object.assign(Hn,{get mixinDatacom(){return Mn(Hn)}}),Ln(Hn),Hn.addInterceptor=R,Hn.removeInterceptor=N,Hn.interceptObject=F})();const{app:Jn,Vuex:Wn,Pinia:Vn}={app:e.createVueApp(a)};uni.Vuex=Wn,uni.Pinia=Vn,Jn.provide("__globalStyles",__uniConfig.styles),Jn._component.mpType="app",Jn._component.render=()=>{},Jn.mount("#app")}(Vue); diff --git a/unpackage/cache/wgt/__UNI__4796942/manifest.json b/unpackage/cache/wgt/__UNI__4796942/manifest.json index fdaec49..f119e5f 100644 --- a/unpackage/cache/wgt/__UNI__4796942/manifest.json +++ b/unpackage/cache/wgt/__UNI__4796942/manifest.json @@ -1 +1 @@ -{"@platforms":["android","iPhone","iPad"],"id":"__UNI__4796942","name":"OA系统","version":{"name":"2.0.1","code":201},"description":"","developer":{"name":"","email":"","url":""},"permissions":{"Camera":{},"Geolocation":{},"Push":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"autoclose":true,"delay":0,"target":"id:1","waiting":true},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"icons":{"android":{"hdpi":"D:\\WebstormProjects\\oa-base\\unpackage\\res\\icons\\72x72.png","xhdpi":"D:\\WebstormProjects\\oa-base\\unpackage\\res\\icons\\96x96.png","xxhdpi":"D:\\WebstormProjects\\oa-base\\unpackage\\res\\icons\\144x144.png","xxxhdpi":"D:\\WebstormProjects\\oa-base\\unpackage\\res\\icons\\192x192.png"},"ios":{"appstore":"appstore.png","ipad":{"app":"icon-ipad-app.png","app@2x":"icon-ipad-app@2x.png","notification":"icon-ipad-notification.png","notification@2x":"icon-ipad-notification@2x.png","proapp@2x":"icon-ipad-proapp@2x.png","settings":"icon-ipad-settings.png","settings@2x":"icon-ipad-settings@2x.png","spotlight":"icon-ipad-spotlight.png","spotlight@2x":"icon-ipad-spotlight@2x.png"},"iphone":{"app@2x":"icon-iphone-app@2x.png","app@3x":"icon-iphone-app@3x.png","notification@2x":"icon-iphone-notification@2x.png","notification@3x":"icon-iphone-notification@3x.png","settings@2x":"icon-iphone-settings@2x.png","settings@3x":"icon-iphone-settings@3x.png","spotlight@2x":"icon-iphone-spotlight@2x.png","spotlight@3x":"icon-iphone-spotlight@3x.png"},"prerendered":"false"}},"splashscreen":{"useOriginalMsgbox":true,"androidStyle":"default","android":{"hdpi":"static/image/sy.png","xhdpi":"static/image/sy.png","xxhdpi":"static/image/sy.png"},"iosStyle":"storyboard","ios":{"storyboard":"storyboard-ios.zip"}},"google":{"abiFilters":["armeabi-v7a","arm64-v8a"],"autoSdkPermissions":false,"permissions":["","","","","","","","","","","","","","","","",""],"targetSdkVersion":33,"custompermissions":true},"apple":{"dSYMs":false,"privacyDescription":{"NSCameraUsageDescription":"我们的应用使用摄像头来拍照,以便在进行外勤打卡时确认您的身份和打卡环境,确保打卡数据的真实性和准确性。","NSLocationWhenInUseUsageDescription":"我们的应用需要在您进行考勤打卡时获取位置信息,以确保打卡记录的准确性和验证打卡地点。","NSPhotoLibraryAddUsageDescription":"我们需要获取写入权限,以便我们能够将您通过应用程序拍摄的照片或视频保存到您的设备相册中。","NSPhotoLibraryUsageDescription":"我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。"},"appid":"com.fonchain.attendance","password":"uecGPNMV8s+KLcdEgW/MRg==","mobileprovision":"apple-mobileprovision.mobileprovision","p12":"apple-private.p12","devices":"iphone","plistcmds":["Add :UIFileSharingEnabled bool true"]},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}},"geolocation":{"baidu":{"__platform__":["ios","android"],"appkey_android":"ahdcPcBfatf61zRAgNl9SpBGUEURsnXN","appkey_ios":"5zzMAq3ofL5H5KfxRcf0zDMLTimvGIb0"},"system":{"__platform__":["ios","android"]}},"push":{"unipush":{"hms":{},"offline":true,"oppo":{},"version":"2","vivo":{}},"description":"管理消息推送能力"}},"debug":true,"syncDebug":true,"orientation":"portrait-primary"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"uni-app":{"control":"uni-v3","vueVersion":"3","compilerVersion":"4.15","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal","webView":{"minUserAgentVersion":"49.0"}},"adid":"124705060412"},"launch_path":"__uniappview.html"} \ No newline at end of file +{"@platforms":["android","iPhone","iPad"],"id":"__UNI__4796942","name":"墨册","version":{"name":"1.0.0","code":100},"description":"","developer":{"name":"","email":"","url":""},"permissions":{"Camera":{},"Geolocation":{},"Push":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"autoclose":true,"delay":0,"target":"id:1","waiting":true},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"icons":{"android":{"hdpi":"D:\\WebstormProjects\\oa-base\\unpackage\\res\\icons\\72x72.png","xhdpi":"D:\\WebstormProjects\\oa-base\\unpackage\\res\\icons\\96x96.png","xxhdpi":"D:\\WebstormProjects\\oa-base\\unpackage\\res\\icons\\144x144.png","xxxhdpi":"D:\\WebstormProjects\\oa-base\\unpackage\\res\\icons\\192x192.png"},"ios":{"appstore":"appstore.png","ipad":{"app":"icon-ipad-app.png","app@2x":"icon-ipad-app@2x.png","notification":"icon-ipad-notification.png","notification@2x":"icon-ipad-notification@2x.png","proapp@2x":"icon-ipad-proapp@2x.png","settings":"icon-ipad-settings.png","settings@2x":"icon-ipad-settings@2x.png","spotlight":"icon-ipad-spotlight.png","spotlight@2x":"icon-ipad-spotlight@2x.png"},"iphone":{"app@2x":"icon-iphone-app@2x.png","app@3x":"icon-iphone-app@3x.png","notification@2x":"icon-iphone-notification@2x.png","notification@3x":"icon-iphone-notification@3x.png","settings@2x":"icon-iphone-settings@2x.png","settings@3x":"icon-iphone-settings@3x.png","spotlight@2x":"icon-iphone-spotlight@2x.png","spotlight@3x":"icon-iphone-spotlight@3x.png"},"prerendered":"false"}},"splashscreen":{"useOriginalMsgbox":true,"androidStyle":"common","android":{"hdpi":"static/image/sy.png","xhdpi":"static/image/sy.png","xxhdpi":"static/image/sy.png"},"iosStyle":"common","ios":{"storyboard":"files/CustomStoryboard.zip"}},"google":{"abiFilters":["armeabi-v7a","arm64-v8a"],"autoSdkPermissions":false,"permissions":["","","","","","","","","","","","","","","","",""],"targetSdkVersion":33,"custompermissions":true},"apple":{"dSYMs":false,"idfa":false,"privacyDescription":{"NSCameraUsageDescription":"我们的应用使用摄像头来拍照,以便在进行外勤打卡时确认您的身份和打卡环境,确保打卡数据的真实性和准确性。","NSLocationWhenInUseUsageDescription":"我们的应用需要在您进行考勤打卡时获取位置信息,以确保打卡记录的准确性和验证打卡地点。","NSPhotoLibraryAddUsageDescription":"我们需要获取写入权限,以便我们能够将您通过应用程序拍摄的照片或视频保存到您的设备相册中。","NSPhotoLibraryUsageDescription":"我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。"},"appid":"com.fonchain.attendance","password":"uecGPNMV8s+KLcdEgW/MRg==","mobileprovision":"apple-mobileprovision.mobileprovision","p12":"apple-private.p12","devices":"iphone","plistcmds":["Add :UIFileSharingEnabled bool true"]},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}},"geolocation":{"baidu":{"__platform__":["ios","android"],"appkey_android":"ahdcPcBfatf61zRAgNl9SpBGUEURsnXN","appkey_ios":"5zzMAq3ofL5H5KfxRcf0zDMLTimvGIb0"},"system":{"__platform__":["ios","android"]}},"push":{"unipush":{"hms":{},"offline":true,"oppo":{},"version":"2","vivo":{}},"description":"管理消息推送能力"}},"debug":true,"syncDebug":true,"orientation":"portrait-primary"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"uni-app":{"control":"uni-v3","vueVersion":"3","compilerVersion":"4.15","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal","webView":{"minUserAgentVersion":"49.0"}},"adid":"124705060412"},"launch_path":"__uniappview.html"} \ No newline at end of file diff --git a/unpackage/debug/iOS_debug.ipa b/unpackage/debug/iOS_debug.ipa index 82b55a6..3b81f0f 100644 Binary files a/unpackage/debug/iOS_debug.ipa and b/unpackage/debug/iOS_debug.ipa differ diff --git a/unpackage/dist/build/app-plus/app-config-service.js b/unpackage/dist/build/app-plus/app-config-service.js index 2e8f877..62f4796 100644 --- a/unpackage/dist/build/app-plus/app-config-service.js +++ b/unpackage/dist/build/app-plus/app-config-service.js @@ -1,7 +1,7 @@ ;(function(){ let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[]; - const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","navigationBar":{"backgroundColor":"#F8F8F8","titleText":"uni-app","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"OA系统","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"4.15","entryPagePath":"pages/index/index","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}}; + const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","navigationBar":{"backgroundColor":"#F8F8F8","titleText":"uni-app","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"墨册","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"4.15","entryPagePath":"pages/index/index","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}}; const __uniRoutes = [{"path":"pages/index/index","meta":{"isQuit":true,"isEntry":true,"navigationBar":{"titleText":"uni-app","style":"custom","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute)); __uniConfig.styles=[];//styles __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); diff --git a/unpackage/dist/build/app-plus/app-service.js b/unpackage/dist/build/app-plus/app-service.js index db362c0..5f0861d 100644 --- a/unpackage/dist/build/app-plus/app-service.js +++ b/unpackage/dist/build/app-plus/app-service.js @@ -1 +1 @@ -if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e()).then((()=>n))),(n=>t.resolve(e()).then((()=>{throw n}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function t(e,t,...n){uni.__log__?uni.__log__(e,t,...n):console[e].apply(console,[...n,t])}const n=t=>(n,s=e.getCurrentInstance())=>{!e.isInSSRComponentSetup&&e.injectHook(t,n,s)},s=n("onShow"),r=n("onHide"),o={apiBaseUrl:"https://warehouse.szjixun.cn/oa_backend",h5Url:"http://114.218.158.24:8042/#/"},i={__name:"index",setup(n){const i=e=>{e.isConnected?uni.redirectTo({url:"/pages/index/index"}):uni.showToast({title:"网络无连接",icon:"none"})},a=e.ref(null);s((()=>{uni.onNetworkStatusChange(i),plus.push.getClientInfoAsync((e=>{t("log","at pages/index/index.vue:62","获取CID",e.clientid)}))})),r((()=>{uni.offNetworkStatusChange(i)}));const c=e=>{var t,n;if("load-complete"===(null==(n=null==(t=e.detail.data)?void 0:t[0])?void 0:n.action)){const{statusBarHeight:e}=uni.getSystemInfoSync(),t=getCurrentPages().pop().$getAppWebview();a.value=t.children()[0],a.value.setStyle({top:e,bottom:0})}};return(t,n)=>(e.openBlock(),e.createElementBlock("web-view",{class:"webview",onMessage:c,style:{flex:"1"},ref:"webViewRef",src:e.unref(o).h5Url},null,40,["src"]))}};__definePage("pages/index/index",i),uni.invokePushCallback({type:"enabled",offline:!0}),Promise.resolve().then((()=>{"undefined"!=typeof plus&&plus.push&&plus.globalEvent.addEventListener("newPath",(({path:e})=>{if(!e)return;const t=getCurrentPages(),n=t[t.length-1];n&&n.$page&&n.$page.fullPath===e||uni.navigateTo({url:e,fail(t){t.errMsg.indexOf("tabbar")>-1?uni.switchTab({url:e,fail(e){console.error(e.errMsg)}}):console.error(t.errMsg)}})})),plus.push.setAutoNotification&&plus.push.setAutoNotification(!1)}));const a={onLaunch:function(){},onShow:function(){t("log","at App.vue:6","App Show")},onHide:function(){t("log","at App.vue:9","App Hide")}},c={pages:[{path:"pages/index/index",style:{navigationBarTitleText:"uni-app",navigationStyle:"custom"}}],globalStyle:{navigationBarTextStyle:"black",navigationBarTitleText:"uni-app",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8"},uniIdRouter:{}};function u(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var l=u((function(e,t){var n;e.exports=(n=n||function(e,t){var n=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),s={},r=s.lib={},o=r.Base={extend:function(e){var t=n(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},i=r.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,s=this.sigBytes,r=e.sigBytes;if(this.clamp(),s%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[s+o>>>2]|=i<<24-(s+o)%4*8}else for(o=0;o>>2]=n[o>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,s=[],r=function(t){var n=987654321,s=4294967295;return function(){var r=((n=36969*(65535&n)+(n>>16)&s)<<16)+(t=18e3*(65535&t)+(t>>16)&s)&s;return r/=4294967296,(r+=.5)*(e.random()>.5?1:-1)}},o=0;o>>2]>>>24-r%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new i.init(n,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new i.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},h=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,s=n.words,r=n.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,u=e.min(4*c,r);if(c){for(var l=0;l>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,i=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],_=e[t+7],w=e[t+8],v=e[t+9],I=e[t+10],A=e[t+11],S=e[t+12],k=e[t+13],T=e[t+14],P=e[t+15],b=o[0],x=o[1],O=o[2],C=o[3];b=u(b,x,O,C,i,7,a[0]),C=u(C,b,x,O,c,12,a[1]),O=u(O,C,b,x,f,17,a[2]),x=u(x,O,C,b,p,22,a[3]),b=u(b,x,O,C,g,7,a[4]),C=u(C,b,x,O,m,12,a[5]),O=u(O,C,b,x,y,17,a[6]),x=u(x,O,C,b,_,22,a[7]),b=u(b,x,O,C,w,7,a[8]),C=u(C,b,x,O,v,12,a[9]),O=u(O,C,b,x,I,17,a[10]),x=u(x,O,C,b,A,22,a[11]),b=u(b,x,O,C,S,7,a[12]),C=u(C,b,x,O,k,12,a[13]),O=u(O,C,b,x,T,17,a[14]),b=l(b,x=u(x,O,C,b,P,22,a[15]),O,C,c,5,a[16]),C=l(C,b,x,O,y,9,a[17]),O=l(O,C,b,x,A,14,a[18]),x=l(x,O,C,b,i,20,a[19]),b=l(b,x,O,C,m,5,a[20]),C=l(C,b,x,O,I,9,a[21]),O=l(O,C,b,x,P,14,a[22]),x=l(x,O,C,b,g,20,a[23]),b=l(b,x,O,C,v,5,a[24]),C=l(C,b,x,O,T,9,a[25]),O=l(O,C,b,x,p,14,a[26]),x=l(x,O,C,b,w,20,a[27]),b=l(b,x,O,C,k,5,a[28]),C=l(C,b,x,O,f,9,a[29]),O=l(O,C,b,x,_,14,a[30]),b=h(b,x=l(x,O,C,b,S,20,a[31]),O,C,m,4,a[32]),C=h(C,b,x,O,w,11,a[33]),O=h(O,C,b,x,A,16,a[34]),x=h(x,O,C,b,T,23,a[35]),b=h(b,x,O,C,c,4,a[36]),C=h(C,b,x,O,g,11,a[37]),O=h(O,C,b,x,_,16,a[38]),x=h(x,O,C,b,I,23,a[39]),b=h(b,x,O,C,k,4,a[40]),C=h(C,b,x,O,i,11,a[41]),O=h(O,C,b,x,p,16,a[42]),x=h(x,O,C,b,y,23,a[43]),b=h(b,x,O,C,v,4,a[44]),C=h(C,b,x,O,S,11,a[45]),O=h(O,C,b,x,P,16,a[46]),b=d(b,x=h(x,O,C,b,f,23,a[47]),O,C,i,6,a[48]),C=d(C,b,x,O,_,10,a[49]),O=d(O,C,b,x,T,15,a[50]),x=d(x,O,C,b,m,21,a[51]),b=d(b,x,O,C,S,6,a[52]),C=d(C,b,x,O,p,10,a[53]),O=d(O,C,b,x,I,15,a[54]),x=d(x,O,C,b,c,21,a[55]),b=d(b,x,O,C,w,6,a[56]),C=d(C,b,x,O,P,10,a[57]),O=d(O,C,b,x,y,15,a[58]),x=d(x,O,C,b,k,21,a[59]),b=d(b,x,O,C,g,6,a[60]),C=d(C,b,x,O,A,10,a[61]),O=d(O,C,b,x,f,15,a[62]),x=d(x,O,C,b,v,21,a[63]),o[0]=o[0]+b|0,o[1]=o[1]+x|0,o[2]=o[2]+O|0,o[3]=o[3]+C|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var o=e.floor(s/4294967296),i=s;n[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,s,r,o,i){var a=e+(t&n|~t&s)+r+i;return(a<>>32-o)+t}function l(e,t,n,s,r,o,i){var a=e+(t&s|n&~s)+r+i;return(a<>>32-o)+t}function h(e,t,n,s,r,o,i){var a=e+(t^n^s)+r+i;return(a<>>32-o)+t}function d(e,t,n,s,r,o,i){var a=e+(n^(t|~s))+r+i;return(a<>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),n.MD5)})),u((function(e,t){var n,s,r;e.exports=(s=(n=h).lib.Base,r=n.enc.Utf8,void(n.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,s=4*n;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),a=o.words,c=i.words,u=0;u>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var c=s.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(e){var t=e.length,n=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o>>6-i%4*2;s[o>>>2]|=(a|c)<<24-o%4*8,o++}return r.create(s,o)}(e,t,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)}));const g="FUNCTION",m="pending",y="rejected";function _(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function w(e){return"object"===_(e)}function v(e){return"function"==typeof e}function I(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const A="REJECTED",S="NOT_PENDING";class k{constructor({createPromise:e,retryRule:t=A}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case A:return this.status===y;case S:return this.status!==m}}exec(){return this.needRetry?(this.status=m,this.promise=this.createPromise().then((e=>(this.status="fulfilled",Promise.resolve(e))),(e=>(this.status=y,Promise.reject(e)))),this.promise):this.promise}}function T(e){return e&&"string"==typeof e?JSON.parse(e):e}const P=T([]);T("");const b=T('[{"provider":"alipay","spaceName":"oaapp","spaceId":"env-00jxgxphla18","spaceAppId":"2021004145628977","accessKey":"ZALus7EgJXdovISb","secretKey":"7qzvVrPN0mAxfcLr"}]')||[];let x="";try{x="__UNI__4796942"}catch(me){}let O={};function C(e,t={}){var n,s;return n=O,s=e,Object.prototype.hasOwnProperty.call(n,s)||(O[e]=t),O[e]}O=uni._globalUniCloudObj?uni._globalUniCloudObj:uni._globalUniCloudObj={};const L=["invoke","success","fail","complete"],E=C("_globalUniCloudInterceptor");function U(e,t){E[e]||(E[e]={}),w(t)&&Object.keys(t).forEach((n=>{L.indexOf(n)>-1&&function(e,t,n){let s=E[e][t];s||(s=E[e][t]=[]),-1===s.indexOf(n)&&v(n)&&s.push(n)}(e,n,t[n])}))}function R(e,t){E[e]||(E[e]={}),w(t)?Object.keys(t).forEach((n=>{L.indexOf(n)>-1&&function(e,t,n){const s=E[e][t];if(!s)return;const r=s.indexOf(n);r>-1&&s.splice(r,1)}(e,n,t[n])})):delete E[e]}function N(e,t){return e&&0!==e.length?e.reduce(((e,n)=>e.then((()=>n(t)))),Promise.resolve()):Promise.resolve()}function D(e,t){return E[e]&&E[e][t]||[]}function M(e){U("callObject",e)}const F=C("_globalUniCloudListener"),q="response",j="needLogin",$="refreshToken",B="clientdb",K="cloudfunction",H="cloudobject";function J(e){return F[e]||(F[e]=[]),F[e]}function W(e,t){const n=J(e);n.includes(t)||n.push(t)}function V(e,t){const n=J(e),s=n.indexOf(t);-1!==s&&n.splice(s,1)}function z(e,t){const n=J(e);for(let s=0;s{G&&e(),function t(){if("function"==typeof getCurrentPages){const t=getCurrentPages();t&&t[0]&&(G=!0,e())}G||setTimeout((()=>{t()}),30)}()})),Q)}function X(e){const t={};for(const n in e){const s=e[n];v(s)&&(t[n]=I(s))}return t}class Z extends Error{constructor(e){super(e.message),this.errMsg=e.message||e.errMsg||"unknown system error",this.code=this.errCode=e.code||e.errCode||"SYSTEM_ERROR",this.errSubject=this.subject=e.subject||e.errSubject,this.cause=e.cause,this.requestId=e.requestId}toJson(e=0){if(!(e>=10))return e++,{errCode:this.errCode,errMsg:this.errMsg,errSubject:this.errSubject,cause:this.cause&&this.cause.toJson?this.cause.toJson(e):this.cause}}}var ee={request:e=>uni.request(e),uploadFile:e=>uni.uploadFile(e),setStorageSync:(e,t)=>uni.setStorageSync(e,t),getStorageSync:e=>uni.getStorageSync(e),removeStorageSync:e=>uni.removeStorageSync(e),clearStorageSync:()=>uni.clearStorageSync()};function te(e){return e&&te(e.__v_raw)||e}function ne(){return{token:ee.getStorageSync("uni_id_token")||ee.getStorageSync("uniIdToken"),tokenExpired:ee.getStorageSync("uni_id_token_expired")}}function se({token:e,tokenExpired:t}={}){e&&ee.setStorageSync("uni_id_token",e),t&&ee.setStorageSync("uni_id_token_expired",t)}let re,oe;function ie(){return re||(re=uni.getSystemInfoSync()),re}function ae(){let e,t;try{if(uni.getLaunchOptionsSync){if(uni.getLaunchOptionsSync.toString().indexOf("not yet implemented")>-1)return;const{scene:n,channel:s}=uni.getLaunchOptionsSync();e=s,t=n}}catch(n){}return{channel:e,scene:t}}function ce(){const e=uni.getLocale&&uni.getLocale()||"en";if(oe)return{...oe,locale:e,LOCALE:e};const t=ie(),{deviceId:n,osName:s,uniPlatform:r,appId:o}=t,i=["pixelRatio","brand","model","system","language","version","platform","host","SDKVersion","swanNativeVersion","app","AppPlatform","fontSizeSetting"];for(let a=0;a{t(Object.assign(e,{complete(e){e||(e={});const t=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400){const n=e.data&&e.data.error&&e.data.error.code||"SYS_ERR",r=e.data&&e.data.error&&e.data.error.message||e.errMsg||"request:fail";return s(new Z({code:n,message:r,requestId:t}))}const r=e.data;if(r.error)return s(new Z({code:r.error.code,message:r.error.message,requestId:t}));r.result=r.data,r.requestId=t,delete r.data,n(r)}}))}))},he=function(e){return p.stringify(f.parse(e))},de=class{constructor(e){["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),this.config=Object.assign({},{endpoint:0===e.spaceId.indexOf("mp-")?"https://api.next.bspapp.com":"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId,this.adapter=ee,this._getAccessTokenPromiseHub=new k({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new Z({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:S})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return le(e,this.adapter.request)}requestAuth(e){return this.requestWrapped(e)}request(e,t){return Promise.resolve().then((()=>this.hasAccessToken?t?this.requestWrapped(e):this.requestWrapped(e).catch((t=>new Promise(((e,n)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?n(t):e()})).then((()=>this.getAccessToken())).then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})))):this.getAccessToken().then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)}))))}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=ue(t.data,this.config.clientSecret),t}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};return"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=ue(n,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:s}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,name:n,filePath:s,fileType:r,onUploadProgress:o}){return new Promise(((i,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:r,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?i(e):a(new Z({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Z({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}async uploadFile({filePath:e,cloudPath:t,fileType:n="image",cloudPathAsRealPath:s=!1,onUploadProgress:r,config:o}){if("string"!==_(t))throw new Z({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new Z({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new Z({code:"INVALID_PARAM",message:"cloudPath不合法"});const i=o&&o.envType||this.config.envType;if(s&&("/"!==t[0]&&(t="/"+t),t.indexOf("\\")>-1))throw new Z({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:i,filename:s?t.split("/").pop():t,fileId:s?t:void 0})).result,c="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:u,accessKeyId:l,signature:h,host:d,ossPath:f,id:p,policy:g,ossCallbackUrl:m}=a,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:l,Signature:h,host:d,id:p,key:f,policy:g,success_action_status:200};if(u&&(y["x-oss-security-token"]=u),m){const e=JSON.stringify({callbackUrl:m,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=he(e)}const w={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:e,fileType:n};if(await this.uploadFileToOSS(Object.assign({},w,{onUploadProgress:r})),m)return{success:!0,filePath:e,fileID:c};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:e,fileID:c};throw new Z({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,n)=>{Array.isArray(e)&&0!==e.length||n(new Z({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),t({fileList:e.map((e=>({fileID:e,tempFileURL:e})))})}))}async getFileInfo({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new Z({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.info",params:JSON.stringify({id:e.map((e=>e.split("?")[0])).join(",")})};return{fileList:(await this.request(this.setupRequest(t))).result}}},fe={init(e){const t=new de(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}};const pe="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var ge,me;(me=ge||(ge={})).local="local",me.none="none",me.session="session";var ye=function(){},_e=u((function(e,t){var n;e.exports=(n=h,function(e){var t=n,s=t.lib,r=s.WordArray,o=s.Hasher,i=t.algo,a=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(a[r]=n(e.pow(s,.5))),c[r]=n(e.pow(s,1/3)),r++),s++}();var u=[],l=i.SHA256=o.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,s=n[0],r=n[1],o=n[2],i=n[3],a=n[4],l=n[5],h=n[6],d=n[7],f=0;f<64;f++){if(f<16)u[f]=0|e[t+f];else{var p=u[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=u[f-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[f]=g+u[f-7]+y+u[f-16]}var _=s&r^s&o^r&o,w=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+c[f]+u[f];d=h,h=l,l=a,a=i+v|0,i=o,o=r,r=s,s=v+(w+_)|0}n[0]=n[0]+s|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+i|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=e.floor(s/4294967296),n[15+(r+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)})),we=_e,ve=u((function(e,t){e.exports=h.HmacSHA256}));const Ie=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new Z({message:'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'})};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}const t=new Promise(((t,n)=>{e=(e,s)=>e?n(e):t(s)}));return e.promise=t,e};function Ae(e){return void 0===e}function Se(e){return"[object Null]"===Object.prototype.toString.call(e)}var ke;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(ke||(ke={}));const Te={adapter:null,runtime:void 0},Pe=["anonymousUuidKey"];class be extends ye{constructor(){super(),Te.adapter.root.tcbObject||(Te.adapter.root.tcbObject={})}setItem(e,t){Te.adapter.root.tcbObject[e]=t}getItem(e){return Te.adapter.root.tcbObject[e]}removeItem(e){delete Te.adapter.root.tcbObject[e]}clear(){delete Te.adapter.root.tcbObject}}function xe(e,t){switch(e){case"local":return t.localStorage||new be;case"none":return new be;default:return t.sessionStorage||new be}}class Oe{constructor(e){if(!this._storage){this._persistence=Te.adapter.primaryStorage||e.persistence,this._storage=xe(this._persistence,Te.adapter);const t=`access_token_${e.env}`,n=`access_token_expire_${e.env}`,s=`refresh_token_${e.env}`,r=`anonymous_uuid_${e.env}`,o=`login_type_${e.env}`,i=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:s,anonymousUuidKey:r,loginTypeKey:o,userInfoKey:i}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const n=xe(e,Te.adapter);for(const s in this.keys){const e=this.keys[s];if(t&&Pe.includes(s))continue;const r=this._storage.getItem(e);Ae(r)||Se(r)||(n.setItem(e,r),this._storage.removeItem(e))}this._storage=n}setStore(e,t,n){if(!this._storage)return;const s={version:n||"localCachev1",content:t},r=JSON.stringify(s);try{this._storage.setItem(e,r)}catch(o){throw o}}getStore(e,t){try{if(!this._storage)return}catch(s){return""}t=t||"localCachev1";const n=this._storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}removeStore(e){this._storage.removeItem(e)}}const Ce={},Le={};function Ee(e){return Ce[e]}class Ue{constructor(e,t){this.data=t||null,this.name=e}}class Re extends Ue{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const Ne=new class{constructor(){this._listeners={}}on(e,t){return n=e,s=t,(r=this._listeners)[n]=r[n]||[],r[n].push(s),this;var n,s,r}off(e,t){return function(e,t,n){if(n&&n[e]){const s=n[e].indexOf(t);-1!==s&&n[e].splice(s,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof Re)return console.error(e.error),this;const n="string"==typeof e?new Ue(e,t||{}):e,s=n.name;if(this._listens(s)){n.target=this;const e=this._listeners[s]?[...this._listeners[s]]:[];for(const t of e)t.call(this,n)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function De(e,t){Ne.on(e,t)}function Me(e,t={}){Ne.fire(e,t)}function Fe(e,t){Ne.off(e,t)}const qe="loginStateChanged",je="loginStateExpire",$e="loginTypeChanged",Be="anonymousConverted",Ke="refreshAccessToken";var He;!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL"}(He||(He={}));const Je=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],We={"X-SDK-Version":"1.3.5"};function Ve(e,t,n){const s=e[t];e[t]=function(t){const r={},o={};n.forEach((n=>{const{data:s,headers:i}=n.call(e,t);Object.assign(r,s),Object.assign(o,i)}));const i=t.data;return i&&(()=>{var e;if(e=i,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...i,...r};else for(const t in r)i.append(t,r[t])})(),t.headers={...t.headers||{},...o},s.call(e,t)}}function ze(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...We,"x-seqid":e}}}class Qe{constructor(e={}){var t;this.config=e,this._reqClass=new Te.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=Ee(this.config.env),this._localCache=(t=this.config.env,Le[t]),Ve(this._reqClass,"post",[ze]),Ve(this._reqClass,"upload",[ze]),Ve(this._reqClass,"download",[ze])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(n){t=n}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n,loginTypeKey:s,anonymousUuidKey:r}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let o=this._cache.getStore(n);if(!o)throw new Z({message:"未登录CloudBase"});const i={refresh_token:o},a=await this.request("auth.fetchAccessTokenWithRefreshToken",i);if(a.data.code){const{code:e}=a.data;if("SIGN_PARAM_INVALID"===e||"REFRESH_TOKEN_EXPIRED"===e||"INVALID_REFRESH_TOKEN"===e){if(this._cache.getStore(s)===He.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(r),t=this._cache.getStore(n),s=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(s.refresh_token),this._refreshAccessToken()}Me(je),this._cache.removeStore(n)}throw new Z({code:a.data.code,message:`刷新access token失败:${a.data.code}`})}if(a.data.access_token)return Me(Ke),this._cache.setStore(e,a.data.access_token),this._cache.setStore(t,a.data.access_token_expire+Date.now()),{accessToken:a.data.access_token,accessTokenExpire:a.data.access_token_expire};a.data.refresh_token&&(this._cache.removeStore(n),this._cache.setStore(n,a.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n}=this._cache.keys;if(!this._cache.getStore(n))throw new Z({message:"refresh token不存在,登录状态异常"});let s=this._cache.getStore(e),r=this._cache.getStore(t),o=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(s,r))&&(o=!1),(!s||!r||r{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:n,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:n,avatarUrl:s,province:r,country:o,city:i}=e,{data:a}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:s,province:r,country:o,city:i});this.setLocalUserInfo(a)}async refresh(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((e=>{this[e]=t[e]})),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class et{constructor(e){if(!e)throw new Z({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=Ee(e);const{refreshTokenKey:t,accessTokenKey:n,accessTokenExpireKey:s}=this._cache.keys,r=this._cache.getStore(t),o=this._cache.getStore(n),i=this._cache.getStore(s);this.credential={refreshToken:r,accessToken:o,accessTokenExpire:i},this.user=new Ze(e)}get isAnonymousAuth(){return this.loginType===He.ANONYMOUS}get isCustomAuth(){return this.loginType===He.CUSTOM}get isWeixinAuth(){return this.loginType===He.WECHAT||this.loginType===He.WECHAT_OPEN||this.loginType===He.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class tt extends Xe{async signIn(){this._cache.updatePersistence("local");const{anonymousUuidKey:e,refreshTokenKey:t}=this._cache.keys,n=this._cache.getStore(e)||void 0,s=this._cache.getStore(t)||void 0,r=await this._request.send("auth.signInAnonymously",{anonymous_uuid:n,refresh_token:s});if(r.uuid&&r.refresh_token){this._setAnonymousUUID(r.uuid),this.setRefreshToken(r.refresh_token),await this._request.refreshAccessToken(),Me(qe),Me($e,{env:this.config.env,loginType:He.ANONYMOUS,persistence:"local"});const e=new et(this.config.env);return await e.user.refresh(),e}throw new Z({message:"匿名登录失败"})}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:n}=this._cache.keys,s=this._cache.getStore(t),r=this._cache.getStore(n),o=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:s,refresh_token:r,ticket:e});if(o.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(o.refresh_token),await this._request.refreshAccessToken(),Me(Be,{env:this.config.env}),Me($e,{loginType:He.CUSTOM,persistence:"local"}),{credential:{refreshToken:o.refresh_token}};throw new Z({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(n,He.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class nt extends Xe{async signIn(e){if("string"!=typeof e)throw new Z({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,n=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(n.refresh_token)return this.setRefreshToken(n.refresh_token),await this._request.refreshAccessToken(),Me(qe),Me($e,{env:this.config.env,loginType:He.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new et(this.config.env);throw new Z({message:"自定义登录失败"})}}class st extends Xe{async signIn(e,t){if("string"!=typeof e)throw new Z({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token:o,access_token_expire:i}=s;if(r)return this.setRefreshToken(r),o&&i?this.setAccessToken(o,i):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Me(qe),Me($e,{env:this.config.env,loginType:He.EMAIL,persistence:this.config.persistence}),new et(this.config.env);throw s.code?new Z({code:s.code,message:`邮箱登录失败: ${s.message}`}):new Z({message:"邮箱登录失败"})}async activate(e){return this._request.send("auth.activateEndUserMail",{token:e})}async resetPasswordWithToken(e,t){return this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})}}class rt extends Xe{async signIn(e,t){if("string"!=typeof e)throw new Z({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:He.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token_expire:o,access_token:i}=s;if(r)return this.setRefreshToken(r),i&&o?this.setAccessToken(i,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Me(qe),Me($e,{env:this.config.env,loginType:He.USERNAME,persistence:this.config.persistence}),new et(this.config.env);throw s.code?new Z({code:s.code,message:`用户名密码登录失败: ${s.message}`}):new Z({message:"用户名密码登录失败"})}}class ot{constructor(e){this.config=e,this._cache=Ee(e.env),this._request=Ye(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),De($e,this._onLoginTypeChanged)}get currentUser(){const e=this.hasLoginState();return e&&e.user||null}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}anonymousAuthProvider(){return new tt(this.config)}customAuthProvider(){return new nt(this.config)}emailAuthProvider(){return new st(this.config)}usernameAuthProvider(){return new rt(this.config)}async signInAnonymously(){return new tt(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new st(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new rt(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new tt(this.config)),De(Be,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===He.ANONYMOUS)throw new Z({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:n}=this._cache.keys,s=this._cache.getStore(e);if(!s)return;const r=await this._request.send("auth.logout",{refresh_token:s});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(n),Me(qe),Me($e,{env:this.config.env,loginType:He.NULL,persistence:this.config.persistence}),r}async signUpWithEmailAndPassword(e,t){return this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})}async sendPasswordResetEmail(e){return this._request.send("auth.sendPasswordResetEmail",{email:e})}onLoginStateChanged(e){De(qe,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){De(je,e.bind(this))}onAccessTokenRefreshed(e){De(Ke,e.bind(this))}onAnonymousConverted(e){De(Be,e.bind(this))}onLoginTypeChanged(e){De($e,(()=>{const t=this.hasLoginState();e.call(this,t)}))}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{refreshTokenKey:e}=this._cache.keys;return this._cache.getStore(e)?new et(this.config.env):null}async isUsernameRegistered(e){if("string"!=typeof e)throw new Z({code:"PARAM_ERROR",message:"username must be a string"});const{data:t}=await this._request.send("auth.isUsernameRegistered",{username:e});return t&&t.isRegistered}getLoginState(){return Promise.resolve(this.hasLoginState())}async signInWithTicket(e){return new nt(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then((e=>e.code?e:{...e.data,requestId:e.seqId}))}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,n=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+n}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:n,env:s}=e.data;s===this.config.env&&(this._cache.updatePersistence(n),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const it=function(e,t){t=t||Ie();const n=Ye(this.config.env),{cloudPath:s,filePath:r,onUploadProgress:o,fileType:i="image"}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{const{data:{url:a,authorization:c,token:u,fileId:l,cosFileId:h},requestId:d}=e,f={key:s,signature:c,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":u};n.upload({url:a,data:f,file:r,name:s,fileType:i,onUploadProgress:o}).then((e=>{201===e.statusCode?t(null,{fileID:l,requestId:d}):t(new Z({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},at=function(e,t){t=t||Ie();const n=Ye(this.config.env),{cloudPath:s}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},ct=function({fileList:e},t){if(t=t||Ie(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let s of e)if(!s||"string"!=typeof s)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const n={fileid_list:e};return Ye(this.config.env).send("storage.batchDeleteFile",n).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},ut=function({fileList:e},t){t=t||Ie(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let n=[];for(let r of e)"object"==typeof r?(r.hasOwnProperty("fileID")&&r.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),n.push({fileid:r.fileID,max_age:r.maxAge})):"string"==typeof r?n.push({fileid:r}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const s={file_list:n};return Ye(this.config.env).send("storage.batchGetDownloadUrl",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},lt=async function({fileID:e},t){const n=(await ut.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==n.code)return t?t(n):new Promise((e=>{e(n)}));const s=Ye(this.config.env);let r=n.download_url;if(r=encodeURI(r),!t)return s.download({url:r});t(await s.download({url:r}))},ht=function({name:e,data:t,query:n,parse:s,search:r},o){const i=o||Ie();let a;try{a=t?JSON.stringify(t):""}catch(u){return Promise.reject(u)}if(!e)return Promise.reject(new Z({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:n,parse:s,search:r,function_name:e,request_data:a};return Ye(this.config.env).send("functions.invokeFunction",c).then((e=>{if(e.code)i(null,e);else{let n=e.data.response_data;if(s)i(null,{result:n,requestId:e.requestId});else try{n=JSON.parse(e.data.response_data),i(null,{result:n,requestId:e.requestId})}catch(t){i(new Z({message:"response data must be json"}))}}return i.promise})).catch((e=>{i(e)})),i.promise},dt={timeout:15e3,persistence:"session"},ft={};class pt{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(Te.adapter||(this.requestClient=new Te.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...dt,...e},!0){case this.config.timeout>6e5:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=6e5;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new pt(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||Te.adapter.primaryStorage||dt.persistence;var n;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;Ce[t]=new Oe(e),Le[t]=new Oe({...e,persistence:"local"})}(this.config),n=this.config,Ge[n.env]=new Qe(n),this.authObj=new ot(this.config),this.authObj}on(e,t){return De.apply(this,[e,t])}off(e,t){return Fe.apply(this,[e,t])}callFunction(e,t){return ht.apply(this,[e,t])}deleteFile(e,t){return ct.apply(this,[e,t])}getTempFileURL(e,t){return ut.apply(this,[e,t])}downloadFile(e,t){return lt.apply(this,[e,t])}uploadFile(e,t){return it.apply(this,[e,t])}getUploadMetadata(e,t){return at.apply(this,[e,t])}registerExtension(e){ft[e.name]=e}async invokeExtension(e,t){const n=ft[e];if(!n)throw new Z({message:`扩展${e} 必须先注册`});return await n.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:n}=function(e){const t=(n=e,"[object Array]"===Object.prototype.toString.call(n)?e:[e]);var n;for(const s of t){const{isMatch:e,genAdapter:t,runtime:n}=s;if(e())return{adapter:t(),runtime:n}}}(e)||{};t&&(Te.adapter=t),n&&(Te.runtime=n)}}var gt=new pt;function mt(e,t,n){void 0===n&&(n={});var s=/\?/.test(t),r="";for(var o in n)""===r?!s&&(t+="?"):r+="&",r+=o+"="+encodeURIComponent(n[o]);return/^http(s)?:\/\//.test(t+=r)?t:""+e+t}class yt{post(e){const{url:t,data:n,headers:s}=e;return new Promise(((e,r)=>{ee.request({url:mt("https:",t),data:n,method:"POST",header:s,success(t){e(t)},fail(e){r(e)}})}))}upload(e){return new Promise(((t,n)=>{const{url:s,file:r,data:o,headers:i,fileType:a}=e,c=ee.uploadFile({url:mt("https:",s),name:"file",formData:Object.assign({},o),filePath:r,fileType:a,header:i,success(e){const n={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&o.success_action_status&&(n.statusCode=parseInt(o.success_action_status,10)),t(n)},fail(e){n(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((t=>{e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}const _t={setItem(e,t){ee.setStorageSync(e,t)},getItem:e=>ee.getStorageSync(e),removeItem(e){ee.removeStorageSync(e)},clear(){ee.clearStorageSync()}};var wt={genAdapter:function(){return{root:{},reqClass:yt,localStorage:_t,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};gt.useAdapters(wt);const vt=gt,It=vt.init;vt.init=function(e){e.env=e.spaceId;const t=It.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const n=t.auth;return t.auth=function(e){const t=n.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var n;t[e]=(n=t[e],function(e){e=e||{};const{success:t,fail:s,complete:r}=X(e);if(!(t||s||r))return n.call(this,e);n.call(this,e).then((e=>{t&&t(e),r&&r(e)}),(e=>{s&&s(e),r&&r(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var At=vt,St=class extends de{getAccessToken(){return new Promise(((e,t)=>{const n="Anonymous_Access_token";this.setAccessToken(n),e(n)}))}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=ue(n,this.config.clientSecret);const r=ce();s["x-client-info"]=encodeURIComponent(JSON.stringify(r));const{token:o}=ne();return s["x-client-token"]=o,{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:JSON.parse(JSON.stringify(s))}}uploadFileToOSS({url:e,formData:t,name:n,filePath:s,fileType:r,onUploadProgress:o}){return new Promise(((i,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:r,success(e){e&&e.statusCode<400?i(e):a(new Z({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Z({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}uploadFile({filePath:e,cloudPath:t,fileType:n="image",onUploadProgress:s}){if(!t)throw new Z({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let r;return this.getOSSUploadOptionsFromPath({cloudPath:t}).then((t=>{const{url:o,formData:i,name:a}=t.result;r=t.result.fileUrl;const c={url:o,formData:i,name:a,filePath:e,fileType:n};return this.uploadFileToOSS(Object.assign({},c,{onUploadProgress:s}))})).then((()=>this.reportOSSUpload({cloudPath:t}))).then((t=>new Promise(((n,s)=>{t.success?n({success:!0,filePath:e,fileID:r}):s(new Z({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return e.result;throw new Z({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e,maxAge:t}={}){if(!Array.isArray(e)||0===e.length)throw new Z({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const n={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e,maxAge:t})};return this.request(this.setupRequest(n)).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new Z({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}},kt={init(e){const t=new St(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}},Tt=u((function(e,t){e.exports=h.enc.Hex}));function Pt(e="",t={}){const{data:n,functionName:s,method:r,headers:o,signHeaderKeys:i=[],config:a}=t,c=Date.now(),u="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),l=Object.assign({},o,{"x-from-app-id":a.spaceAppId,"x-from-env-id":a.spaceId,"x-to-env-id":a.spaceId,"x-from-instance-id":c,"x-from-function-name":s,"x-client-timestamp":c,"x-alipay-source":"client","x-request-id":u,"x-alipay-callid":u,"x-trace-id":u}),h=["x-from-app-id","x-from-env-id","x-to-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp"].concat(i),[d="",f=""]=e.split("?")||[],p=function(e){const t=e.signedHeaders.join(";"),n=e.signedHeaders.map((t=>`${t.toLowerCase()}:${e.headers[t]}\n`)).join(""),s=we(e.body).toString(Tt),r=`${e.method.toUpperCase()}\n${e.path}\n${e.query}\n${n}\n${t}\n${s}\n`,o=we(r).toString(Tt),i=`HMAC-SHA256\n${e.timestamp}\n${o}\n`,a=ve(i,e.secretKey).toString(Tt);return`HMAC-SHA256 Credential=${e.secretId}, SignedHeaders=${t}, Signature=${a}`}({path:d,query:f,method:r,headers:l,timestamp:c,body:JSON.stringify(n),secretId:a.accessKey,secretKey:a.secretKey,signedHeaders:h.sort()});return{url:`${a.endpoint}${e}`,headers:Object.assign({},l,{Authorization:p})}}function bt({url:e,data:t,method:n="POST",headers:s={}}){return new Promise(((r,o)=>{ee.request({url:e,method:n,data:t,header:s,dataType:"json",complete:(e={})=>{const t=s["x-trace-id"]||"";if(!e.statusCode||e.statusCode>=400){const{message:n,errMsg:s,trace_id:r}=e.data||{};return o(new Z({code:"SYS_ERR",message:n||s||"request:fail",requestId:r||t}))}r({status:e.statusCode,data:e.data,headers:e.header,requestId:t})}})}))}function xt(e,t){const{path:n,data:s,method:r="GET"}=e,{url:o,headers:i}=Pt(n,{functionName:"",data:s,method:r,headers:{"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":Date.now()+6e4},signHeaderKeys:["x-data-api-type","x-expire-timestamp"],config:t});return bt({url:o,data:s,method:r,headers:i}).then((e=>{const t=e.data||{};if(!t.success)throw new Z({code:e.errCode,message:e.errMsg,requestId:e.requestId});return t.data||{}})).catch((e=>{throw new Z({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}function Ot(e=""){const t=e.trim().replace(/^cloud:\/\//,""),n=t.indexOf("/");if(n<=0)throw new Z({code:"INVALID_PARAM",message:"fileID不合法"});const s=t.substring(0,n),r=t.substring(n+1);return s!==this.config.spaceId&&console.warn("file ".concat(e," does not belong to env ").concat(this.config.spaceId)),r}function Ct(e=""){return"cloud://".concat(this.config.spaceId,"/").concat(e.replace(/^\/+/,""))}var Lt={init:e=>{e.provider="alipay";const t=new class{constructor(e){if(["spaceId","spaceAppId","accessKey","secretKey"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),e.endpoint){if("string"!=typeof e.endpoint)throw new Error("endpoint must be string");if(!/^https:\/\//.test(e.endpoint))throw new Error("endpoint must start with https://");e.endpoint=e.endpoint.replace(/\/$/,"")}this.config=Object.assign({},e,{endpoint:e.endpoint||`https://${e.spaceId}.api-hz.cloudbasefunction.cn`})}callFunction(e){return function(e,t){const{name:n,data:s}=e,r="POST",{url:o,headers:i}=Pt("/functions/invokeFunction",{functionName:n,data:s,method:r,headers:{"x-to-function-name":n},signHeaderKeys:["x-to-function-name"],config:t});return bt({url:o,data:s,method:r,headers:i}).then((e=>({errCode:0,success:!0,requestId:e.requestId,result:e.data}))).catch((e=>{throw new Z({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}(e,this.config)}uploadFileToOSS({url:e,filePath:t,fileType:n,formData:s,onUploadProgress:r}){return new Promise(((o,i)=>{const a=ee.uploadFile({url:e,filePath:t,fileType:n,formData:s,name:"file",success(e){e&&e.statusCode<400?o(e):i(new Z({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){i(new Z({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof r&&a&&"function"==typeof a.onProgressUpdate&&a.onProgressUpdate((e=>{r({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}async uploadFile({filePath:e,cloudPath:t="",fileType:n="image",onUploadProgress:s}){if("string"!==_(t))throw new Z({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new Z({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new Z({code:"INVALID_PARAM",message:"cloudPath不合法"});const r=await xt({path:"/".concat(t.replace(/^\//,""),"?post_url")},this.config),{file_id:o,upload_url:i,form_data:a}=r,c=a&&a.reduce(((e,t)=>(e[t.key]=t.value,e)),{});return this.uploadFileToOSS({url:i,filePath:e,fileType:n,formData:c,onUploadProgress:s}).then((()=>({fileID:o})))}async getTempFileURL({fileList:e}){return new Promise(((t,n)=>{(!e||e.length<0)&&n(new Z({errCode:"INVALID_PARAM",errMsg:"fileList不能为空数组"})),e.length>50&&n(new Z({errCode:"INVALID_PARAM",errMsg:"fileList数组长度不能超过50"}));const s=[];for(const r of e){"string"!==_(r)&&n(new Z({errCode:"INVALID_PARAM",errMsg:"fileList的元素必须是非空的字符串"}));const e=Ot.call(this,r);s.push({file_id:e,expire:600})}xt({path:"/?download_url",data:{file_list:s},method:"POST"},this.config).then((e=>{const{file_list:n=[]}=e;t({fileList:n.map((e=>({fileID:Ct.call(this,e.file_id),tempFileURL:e.download_url})))})})).catch((e=>n(e)))}))}}(e);return t.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},t}};function Et({data:e}){let t;t=ce();const n=JSON.parse(JSON.stringify(e||{}));if(Object.assign(n,{clientInfo:t}),!n.uniIdToken){const{token:e}=ne();e&&(n.uniIdToken=e)}return n}const Ut=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var Rt=/[\\^$.*+?()[\]{}|]/g,Nt=RegExp(Rt.source);function Dt(e,t,n){return e.replace(new RegExp((s=t)&&Nt.test(s)?s.replace(Rt,"\\$&"):s,"g"),n);var s}const Mt=2e4,Ft={code:20101,message:"Invalid client"};function qt(e){const{errSubject:t,subject:n,errCode:s,errMsg:r,code:o,message:i,cause:a}=e||{};return new Z({subject:t||n||"uni-secure-network",code:s||o||Mt,message:r||i,cause:a})}let jt;function $t({secretType:e}={}){return"request"===e||"response"===e||"both"===e}function Bt({name:e,data:t={}}={}){return"DCloud-clientDB"===e&&"encryption"===t.redirectTo&&"getAppClientKey"===t.action}function Kt({functionName:e,result:t,logPvd:n}){}function Ht(e){const t=e.callFunction,n=function(n){const s=n.name;n.data=Et.call(e,{data:n.data});const r={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay"}[this.config.provider],o=$t(n),i=Bt(n),a=o||i;return t.call(this,n).then((e=>(e.errCode=0,!a&&Kt.call(this,{functionName:s,result:e,logPvd:r}),Promise.resolve(e))),(e=>(!a&&Kt.call(this,{functionName:s,result:e,logPvd:r}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:n=[]}={}){for(let s=0;sn.provider===e&&n.spaceId===t));return s&&s.config}({provider:e,spaceId:t});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},u=Object.keys(c);if(0===u.length)return!0;const l=function(e,t){let n,s,r;for(let o=0;oe.trim())).indexOf(t)>-1&&(s=i):r=i:n=i}return n||s||r}(u,n);if(!l)return!1;if((c[l]||[]).find(((e={})=>e.appId===s&&(e.platform||"").toLowerCase()===i.toLowerCase())))return!0;throw console.error(`此应用[appId: ${s}, platform: ${i}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),qt(Ft)}({provider:s,spaceId:r,functionName:o})?new jt({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(n.bind(e))(t):i(t),Object.defineProperty(a,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),a.then((e=>("undefined"!=typeof UTSJSONObject&&(e.result=new UTSJSONObject(e.result)),e)))}}jt=class{constructor(){throw qt({message:"Platform app is not enabled, please check whether secure network module is enabled in your manifest.json"})}};const Jt=Symbol("CLIENT_DB_INTERNAL");function Wt(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Jt,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,n,s){if("_uniClient"===n)return null;if("symbol"==typeof n)return e[n];if(n in e||"string"!=typeof n){const t=e[n];return"function"==typeof t?t.bind(e):t}return t.get(e,n,s)}})}function Vt(e){return{on:(t,n)=>{e[t]=e[t]||[],e[t].indexOf(n)>-1||e[t].push(n)},off:(t,n)=>{e[t]=e[t]||[];const s=e[t].indexOf(n);-1!==s&&e[t].splice(s,1)}}}const zt=["db.Geo","db.command","command.aggregate"];function Qt(e,t){return zt.indexOf(`${e}.${t}`)>-1}function Gt(e){switch(_(e=te(e))){case"array":return e.map((e=>Gt(e)));case"object":return e._internalType===Jt||Object.keys(e).forEach((t=>{e[t]=Gt(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function Yt(e){return e&&e.content&&e.content.$method}class Xt{constructor(e,t,n){this.content=e,this.prevStage=t||null,this.udb=null,this._database=n}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((e=>({$method:e.$method,$param:Gt(e.$param)})))}}toString(){return JSON.stringify(this.toJSON())}getAction(){const e=this.toJSON().$db.find((e=>"action"===e.$method));return e&&e.$param&&e.$param[0]}getCommand(){return{$db:this.toJSON().$db.filter((e=>"action"!==e.$method))}}get isAggregate(){let e=this;for(;e;){const t=Yt(e),n=Yt(e.prevStage);if("aggregate"===t&&"collection"===n||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===Yt(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=Yt(e),n=Yt(e.prevStage);if("aggregate"===t&&"command"===n)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return Zt({$method:e,$param:Gt(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const n=this.getAction(),s=this.getCommand();return s.$db.push({$method:e,$param:Gt(t)}),this._database._callCloudFunction({action:n,command:s})}}function Zt(e,t,n){return Wt(new Xt(e,t,n),{get(e,t){let s="db";return e&&e.content&&(s=e.content.$method),Qt(s,t)?Zt({$method:t},e,n):function(){return Zt({$method:t,$param:Gt(Array.from(arguments))},e,n)}}})}function en({path:e,method:t}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...e.map((e=>({$method:e}))),{$method:t,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}function tn(e,t={}){return Wt(new e(t),{get:(e,t)=>Qt("db",t)?Zt({$method:t},null,e):function(){return Zt({$method:t,$param:Gt(Array.from(arguments))},null,e)}})}class nn extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=C("_globalUniCloudDatabaseCallback")),t||(this.auth=Vt(this._authCallBacks)),this._isJQL=t,Object.assign(this,Vt(this._dbCallBacks)),this.env=Wt({},{get:(e,t)=>({$env:t})}),this.Geo=Wt({},{get:(e,t)=>en({path:["Geo"],method:t})}),this.serverDate=en({path:[],method:"serverDate"}),this.RegExp=en({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const n=this._dbCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const n=this._authCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),n=e.getCommand();if("getTemp"!==n.$db[n.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:n}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:n,queryList:s}){function r(e,t){if(n&&s)for(let n=0;nN(D(i,"complete"),e))).then((()=>(r(null,e),z(q,{type:B,content:e}),Promise.reject(e))))}const c=N(D(i,"invoke")),u=this._uniClient;return c.then((()=>u.callFunction({name:"DCloud-clientDB",type:"CLIENT_DB",data:{action:e,command:t,multiCommand:n}}))).then((e=>{const{code:t,message:n,token:s,tokenExpired:c,systemInfo:u=[]}=e.result;if(u)for(let r=0;r(console.warn(n),s)})}}return h=e,N(D(i,"success"),h).then((()=>N(D(i,"complete"),h))).then((()=>{r(h,null);const e=o._parseResult(h);return z(q,{type:B,content:e}),Promise.resolve(e)}));var h}),(e=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),a(new Z({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const sn="token无效,跳转登录页面",rn="token过期,跳转登录页面",on={TOKEN_INVALID_TOKEN_EXPIRED:rn,TOKEN_INVALID_INVALID_CLIENTID:sn,TOKEN_INVALID:sn,TOKEN_INVALID_WRONG_TOKEN:sn,TOKEN_INVALID_ANONYMOUS_USER:sn},an={"uni-id-token-expired":rn,"uni-id-check-token-failed":sn,"uni-id-token-not-exist":sn,"uni-id-check-device-feature-failed":sn};function cn(e,t){let n="";return n=e?`${e}/${t}`:t,n.replace(/^\//,"")}function un(e=[],t=""){const n=[],s=[];return e.forEach((e=>{!0===e.needLogin?n.push(cn(t,e.path)):!1===e.needLogin&&s.push(cn(t,e.path))})),{needLoginPage:n,notNeedLoginPage:s}}function ln(e){return e.split("?")[0].replace(/^\//,"")}function hn(){return function(e){let t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){const e=getCurrentPages();return e[e.length-1]}())}function dn(){return ln(hn())}function fn(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const n=t.list,s=ln(e);return n.some((e=>e.pagePath===s))}const pn=!!c.uniIdRouter,{loginPage:gn,routerNeedLogin:mn,resToLogin:yn,needLoginPage:_n,notNeedLoginPage:wn,loginPageInTabBar:vn}=function({pages:e=[],subPackages:t=[],uniIdRouter:n={},tabBar:s={}}=c){const{loginPage:r,needLogin:o=[],resToLogin:i=!0}=n,{needLoginPage:a,notNeedLoginPage:u}=un(e),{needLoginPage:l,notNeedLoginPage:h}=function(e=[]){const t=[],n=[];return e.forEach((e=>{const{root:s,pages:r=[]}=e,{needLoginPage:o,notNeedLoginPage:i}=un(r,s);t.push(...o),n.push(...i)})),{needLoginPage:t,notNeedLoginPage:n}}(t);return{loginPage:r,routerNeedLogin:o,resToLogin:i,needLoginPage:[...a,...l],notNeedLoginPage:[...u,...h],loginPageInTabBar:fn(r,s)}}();if(_n.indexOf(gn)>-1)throw new Error(`Login page [${gn}] should not be "needLogin", please check your pages.json`);function In(e){const t=dn();if("/"===e.charAt(0))return e;const[n,s]=e.split("?"),r=n.replace(/^\//,"").split("/"),o=t.split("/");o.pop();for(let i=0;i-1?s+`&uniIdRedirectUrl=${encodeURIComponent(r)}`:s+`?uniIdRedirectUrl=${encodeURIComponent(r)}`:s);var s,r;vn?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const o={navigateTo:uni.navigateTo,redirectTo:uni.redirectTo,switchTab:uni.switchTab,reLaunch:uni.reLaunch};setTimeout((()=>{o[e]({url:n})}),0)}function kn({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},n=function(){const{token:e,tokenExpired:t}=ne();let n;if(e){if(t-1)&&(_n.indexOf(t)>-1||mn.some((t=>{return n=e,new RegExp(t).test(n);var n})))}(e)&&n){if(n.uniIdRedirectUrl=e,J(j).length>0)return setTimeout((()=>{z(j,n)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function Tn(){!function(){const e=hn(),{abortLoginPageJump:t,autoToLoginPage:n}=kn({url:e});t||n&&Sn({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t{const{type:t,content:n}=e;let s=!1;switch(t){case"cloudobject":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in an}(n);break;case"clientdb":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in on}(n)}s&&function(e={}){const t=J(j);Y().then((()=>{const n=hn();if(n&&An({redirect:n}))return t.length>0?z(j,Object.assign({uniIdRedirectUrl:n},e)):void(gn&&Sn({api:"navigateTo",redirect:n}))}))}(n)}))}function bn(e){var t;(t=e).onResponse=function(e){W(q,e)},t.offResponse=function(e){V(q,e)},function(e){e.onNeedLogin=function(e){W(j,e)},e.offNeedLogin=function(e){V(j,e)},pn&&(C("_globalUniCloudStatus").needLoginInit||(C("_globalUniCloudStatus").needLoginInit=!0,Y().then((()=>{Tn.call(e)})),yn&&Pn.call(e)))}(e),function(e){e.onRefreshToken=function(e){W($,e)},e.offRefreshToken=function(e){V($,e)}}(e)}let xn;const On="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Cn=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Ln(){const e=ne().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((s=t[1],decodeURIComponent(xn(s).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(r){throw new Error("获取当前用户信息出错,详细错误信息为:"+r.message)}var s;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}xn="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Cn.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,s,r="",o=0;o>16&255):64===s?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return r}:atob;var En=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(u((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n="chooseAndUploadFile:ok",s="chooseAndUploadFile:fail";function r(e,t){return e.tempFiles.forEach(((e,n)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+n+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function o(e,t,{onChooseFile:s,onUploadProgress:r}){return t.then((e=>{if(s){const t=s(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:n,tempFilePaths:[],tempFiles:[]}:function(e,t,s=5,r){(t=Object.assign({},t)).errMsg=n;const o=t.tempFiles,i=o.length;let a=0;return new Promise((n=>{for(;a=i)return void(!o.find((e=>!e.url&&!e.errMsg))&&n(t));const u=o[s];e.uploadFile({provider:u.provider,filePath:u.path,cloudPath:u.cloudPath,fileType:u.fileType,cloudPathAsRealPath:u.cloudPathAsRealPath,onUploadProgress(e){e.index=s,e.tempFile=u,e.tempFilePath=u.path,r&&r(e)}}).then((e=>{u.url=e.fileID,s{u.errMsg=e.errMsg||e.message,s{uni.chooseImage({count:t,sizeType:n,sourceType:o,extension:i,success(t){e(r(t,"image"))},fail(e){a({errMsg:e.errMsg.replace("chooseImage:fail",s)})}})}))}(t),t):"video"===t.type?o(e,function(e){const{camera:t,compressed:n,maxDuration:o,sourceType:i=["album","camera"],extension:a}=e;return new Promise(((e,c)=>{uni.chooseVideo({camera:t,compressed:n,maxDuration:o,sourceType:i,extension:a,success(t){const{tempFilePath:n,duration:s,size:o,height:i,width:a}=t;e(r({errMsg:"chooseVideo:ok",tempFilePaths:[n],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:n,size:o,type:t.tempFile&&t.tempFile.type||"",width:a,height:i,duration:s,fileType:"video",cloudPath:""}]},"video"))},fail(e){c({errMsg:e.errMsg.replace("chooseVideo:fail",s)})}})}))}(t),t):o(e,function(e){const{count:t,extension:n}=e;return new Promise(((e,o)=>{let i=uni.chooseFile;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(i=wx.chooseMessageFile),"function"!=typeof i)return o({errMsg:s+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});i({type:"all",count:t,extension:n,success(t){e(r(t))},fail(e){o({errMsg:e.errMsg.replace("chooseFile:fail",s)})}})}))}(t),t)}}})));function Un(e){return{props:{localdata:{type:Array,default:()=>[]},options:{type:[Object,Array],default:()=>({})},spaceInfo:{type:Object,default:()=>({})},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:()=>({mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{},mixinDatacomError:null}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((t=>{e.push(this[t])})),e}),((e,t)=>{if("manual"===this.loadtime)return;let n=!1;const s=[];for(let r=2;r{this.mixinDatacomLoading=!1;const{data:s,count:r}=n.result;this.getcount&&(this.mixinDatacomPage.count=r),this.mixinDatacomHasMore=s.length{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,this.mixinDatacomError=e,n&&n(e)})))},mixinDatacomGet(t={}){let n;t=t||{},n="undefined"!=typeof __uniX&&__uniX?e.databaseForJQL(this.spaceInfo):e.database(this.spaceInfo);const s=t.action||this.action;s&&(n=n.action(s));const r=t.collection||this.collection;n=Array.isArray(r)?n.collection(...r):n.collection(r);const o=t.where||this.where;o&&Object.keys(o).length&&(n=n.where(o));const i=t.field||this.field;i&&(n=n.field(i));const a=t.foreignKey||this.foreignKey;a&&(n=n.foreignKey(a));const c=t.groupby||this.groupby;c&&(n=n.groupBy(c));const u=t.groupField||this.groupField;u&&(n=n.groupField(u)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(n=n.distinct());const l=t.orderby||this.orderby;l&&(n=n.orderBy(l));const h=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,d=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,f=void 0!==t.getcount?t.getcount:this.getcount,p=void 0!==t.gettree?t.gettree:this.gettree,g=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,m={getCount:f},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return p&&(m.getTree=y),g&&(m.getTreePath=y),n=n.skip(d*(h-1)).limit(d).get(m),n}}}}function Rn(e){return C("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function Nn({openid:e,callLoginByWeixin:t=!1}={}){throw Rn(this),new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `app`")}async function Dn(e){const t=Rn(this);return t.initPromise||(t.initPromise=Nn.call(this,e).then((e=>e)).catch((e=>{throw delete t.initPromise,e}))),t.initPromise}function Mn(e){const t={getSystemInfo:uni.getSystemInfo,getPushClientId:uni.getPushClientId};return function(n){return new Promise(((s,r)=>{t[e]({...n,success(e){s(e)},fail(e){r(e)}})}))}}class Fn extends class{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const n=this._callback[e];if(!n)return;const s=function(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t)return n;return-1}(n,t);n.splice(s,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const n=this._callback[e];if(n)for(let s=0;s{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()}),(e=>{throw this.emit("error",e),this.close(),e}))}async open(){return this.init()}_isUniCloudSSE(e){if("receive"!==e.type)return!1;const t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:n,messageId:s,message:r}=t;this._payloadQueue.push({action:n,messageId:s,message:r}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find((e=>e.messageId===this._currentMessageId+1));if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:n,message:s}=e;"end"===t?this._end({messageId:n,message:s}):"message"===t&&this._appendMessage({messageId:n,message:s})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){uni.onPushMessage(this._uniPushMessageCallback)}_destroy(){uni.offPushMessage(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const qn={tcb:At,tencent:At,aliyun:fe,private:kt,alipay:Lt};let jn=new class{init(e){let t={};const n=qn[e.provider];if(!n)throw new Error("未提供正确的provider参数");var s;return t=n.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new k({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const n=e.auth();return t.then((()=>n.getLoginState())).then((e=>e?Promise.resolve():n.signInAnonymously()))}}))}(t),Ht(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(s=t).database=function(e){if(e&&Object.keys(e).length>0)return s.init(e).database();if(this._database)return this._database;const t=tn(nn,{uniClient:s});return this._database=t,t},s.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return s.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=tn(nn,{uniClient:s,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=Ln,e.chooseAndUploadFile=En.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return Un(e)}}),e.SSEChannel=Fn,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:n=!1}={}){return Dn.call(e,{openid:t,callLoginByWeixin:n})}}(e),e.importObject=function(t){return function(n,s={}){s=function(e,t={}){return e.customUI=t.customUI||e.customUI,e.parseSystemError=t.parseSystemError||e.parseSystemError,Object.assign(e.loadingOptions,t.loadingOptions),Object.assign(e.errorOptions,t.errorOptions),"object"==typeof t.secretMethods&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},s);const{customUI:r,loadingOptions:o,errorOptions:i,parseSystemError:a}=s,c=!r;return new Proxy({},{get(r,u){switch(u){case"toString":return"[object UniCloudObject]";case"toJSON":return{}}return function({fn:e,interceptorName:t,getCallbackArgs:n}={}){return async function(...s){const r=n?n({params:s}):{};let o,i;try{return await N(D(t,"invoke"),{...r}),o=await e(...s),await N(D(t,"success"),{...r,result:o}),o}catch(a){throw i=a,await N(D(t,"fail"),{...r,error:i}),i}finally{await N(D(t,"complete"),i?{...r,error:i}:{...r,result:o})}}}({fn:async function r(...l){let h;c&&uni.showLoading({title:o.title,mask:o.mask});const d={name:n,type:"OBJECT",data:{method:u,params:l}};"object"==typeof s.secretMethods&&function(e,t){const n=t.data.method,s=e.secretMethods||{},r=s[n]||s["*"];r&&(t.secretType=r)}(s,d);let f=!1;try{h=await t.callFunction(d)}catch(e){f=!0,h={result:new Z(e)}}const{errSubject:p,errCode:g,errMsg:m,newToken:y}=h.result||{};if(c&&uni.hideLoading(),y&&y.token&&y.tokenExpired&&(se(y),z($,{...y})),g){let e=m;if(f&&a&&(e=(await a({objectName:n,methodName:u,params:l,errSubject:p,errCode:g,errMsg:m})).errMsg||m),c)if("toast"===i.type)uni.showToast({title:e,icon:"none"});else{if("modal"!==i.type)throw new Error(`Invalid errorOptions.type: ${i.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:n,cancelText:s,confirmText:r}={}){return new Promise(((o,i)=>{uni.showModal({title:e,content:t,showCancel:n,cancelText:s,confirmText:r,success(e){o(e)},fail(){o({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:i.retry,cancelText:"取消",confirmText:i.retry?"重试":"确定"});if(i.retry&&t)return r(...l)}}const t=new Z({subject:p,code:g,message:m,requestId:h.requestId});throw t.detail=h.result,z(q,{type:H,content:t}),t}return z(q,{type:H,content:h.result}),h.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:n,methodName:u,params:e}}})}})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const n=t[e];t[e]=function(){return n.apply(t,Array.from(arguments))},t[e]=function(e,t){return function(n){let s=!1;if("callFunction"===t){const e=n&&n.type||g;s=e!==g}const r="callFunction"===t&&!s,o=this._initPromiseHub.exec();n=n||{};const{success:i,fail:a,complete:c}=X(n),u=o.then((()=>s?Promise.resolve():N(D(t,"invoke"),n))).then((()=>e.call(this,n))).then((e=>s?Promise.resolve(e):N(D(t,"success"),e).then((()=>N(D(t,"complete"),e))).then((()=>(r&&z(q,{type:K,content:e}),Promise.resolve(e))))),(e=>s?Promise.reject(e):N(D(t,"fail"),e).then((()=>N(D(t,"complete"),e))).then((()=>(z(q,{type:K,content:e}),Promise.reject(e))))));if(!(i||a||c))return u;u.then((e=>{i&&i(e),c&&c(e),r&&z(q,{type:K,content:e})}),(e=>{a&&a(e),c&&c(e),r&&z(q,{type:K,content:e})}))}}(t[e],e).bind(t)})),t.init=this.init,t}};(()=>{const e=b;let t={};if(e&&1===e.length)t=e[0],jn=jn.init(t),jn._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let n;n=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{jn[e]=function(){return console.error(n),Promise.reject(new Z({code:"SYS_ERR",message:n}))}}))}Object.assign(jn,{get mixinDatacom(){return Un(jn)}}),bn(jn),jn.addInterceptor=U,jn.removeInterceptor=R,jn.interceptObject=M})();const{app:$n,Vuex:Bn,Pinia:Kn}={app:e.createVueApp(a)};uni.Vuex=Bn,uni.Pinia=Kn,$n.provide("__globalStyles",__uniConfig.styles),$n._component.mpType="app",$n._component.render=()=>{},$n.mount("#app")}(Vue); +if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e()).then((()=>n))),(n=>t.resolve(e()).then((()=>{throw n}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function t(e,t,...n){uni.__log__?uni.__log__(e,t,...n):console[e].apply(console,[...n,t])}const n=t=>(n,s=e.getCurrentInstance())=>{!e.isInSSRComponentSetup&&e.injectHook(t,n,s)},s=n("onShow"),r=n("onHide"),o={apiBaseUrl:"https://warehouse.szjixun.cn/oa_backend",h5Url:"http://192.168.88.50:8080/#/"},i={__name:"index",setup(n){const i=e=>{e.isConnected?uni.redirectTo({url:"/pages/index/index"}):uni.showToast({title:"网络无连接",icon:"none"})},a=e.ref(null);s((()=>{uni.onNetworkStatusChange(i),plus.push.getClientInfoAsync((e=>{t("log","at pages/index/index.vue:62","获取CID",e.clientid)}))})),r((()=>{uni.offNetworkStatusChange(i)}));const c=e=>{var t,n;if("load-complete"===(null==(n=null==(t=e.detail.data)?void 0:t[0])?void 0:n.action)){const{statusBarHeight:e}=uni.getSystemInfoSync(),t=getCurrentPages().pop().$getAppWebview();a.value=t.children()[0],a.value.setStyle({top:e,bottom:0})}};return(t,n)=>(e.openBlock(),e.createElementBlock("web-view",{class:"webview",onMessage:c,style:{flex:"1"},ref:"webViewRef",src:e.unref(o).h5Url},null,40,["src"]))}};__definePage("pages/index/index",i),uni.invokePushCallback({type:"enabled",offline:!0}),Promise.resolve().then((()=>{"undefined"!=typeof plus&&plus.push&&plus.globalEvent.addEventListener("newPath",(({path:e})=>{if(!e)return;const t=getCurrentPages(),n=t[t.length-1];n&&n.$page&&n.$page.fullPath===e||uni.navigateTo({url:e,fail(t){t.errMsg.indexOf("tabbar")>-1?uni.switchTab({url:e,fail(e){console.error(e.errMsg)}}):console.error(t.errMsg)}})})),plus.push.setAutoNotification&&plus.push.setAutoNotification(!1)}));const a={onLaunch:function(){},onShow:function(){t("log","at App.vue:6","App Show")},onHide:function(){t("log","at App.vue:9","App Hide")}},c={pages:[{path:"pages/index/index",style:{navigationBarTitleText:"uni-app",navigationStyle:"custom"}}],globalStyle:{navigationBarTextStyle:"black",navigationBarTitleText:"uni-app",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8"},uniIdRouter:{}};function u(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var l=u((function(e,t){var n;e.exports=(n=n||function(e,t){var n=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),s={},r=s.lib={},o=r.Base={extend:function(e){var t=n(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},i=r.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,s=this.sigBytes,r=e.sigBytes;if(this.clamp(),s%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[s+o>>>2]|=i<<24-(s+o)%4*8}else for(o=0;o>>2]=n[o>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,s=[],r=function(t){var n=987654321,s=4294967295;return function(){var r=((n=36969*(65535&n)+(n>>16)&s)<<16)+(t=18e3*(65535&t)+(t>>16)&s)&s;return r/=4294967296,(r+=.5)*(e.random()>.5?1:-1)}},o=0;o>>2]>>>24-r%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new i.init(n,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new i.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},h=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,s=n.words,r=n.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,u=e.min(4*c,r);if(c){for(var l=0;l>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,i=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],_=e[t+7],w=e[t+8],v=e[t+9],I=e[t+10],A=e[t+11],S=e[t+12],k=e[t+13],T=e[t+14],P=e[t+15],b=o[0],x=o[1],O=o[2],C=o[3];b=u(b,x,O,C,i,7,a[0]),C=u(C,b,x,O,c,12,a[1]),O=u(O,C,b,x,f,17,a[2]),x=u(x,O,C,b,p,22,a[3]),b=u(b,x,O,C,g,7,a[4]),C=u(C,b,x,O,m,12,a[5]),O=u(O,C,b,x,y,17,a[6]),x=u(x,O,C,b,_,22,a[7]),b=u(b,x,O,C,w,7,a[8]),C=u(C,b,x,O,v,12,a[9]),O=u(O,C,b,x,I,17,a[10]),x=u(x,O,C,b,A,22,a[11]),b=u(b,x,O,C,S,7,a[12]),C=u(C,b,x,O,k,12,a[13]),O=u(O,C,b,x,T,17,a[14]),b=l(b,x=u(x,O,C,b,P,22,a[15]),O,C,c,5,a[16]),C=l(C,b,x,O,y,9,a[17]),O=l(O,C,b,x,A,14,a[18]),x=l(x,O,C,b,i,20,a[19]),b=l(b,x,O,C,m,5,a[20]),C=l(C,b,x,O,I,9,a[21]),O=l(O,C,b,x,P,14,a[22]),x=l(x,O,C,b,g,20,a[23]),b=l(b,x,O,C,v,5,a[24]),C=l(C,b,x,O,T,9,a[25]),O=l(O,C,b,x,p,14,a[26]),x=l(x,O,C,b,w,20,a[27]),b=l(b,x,O,C,k,5,a[28]),C=l(C,b,x,O,f,9,a[29]),O=l(O,C,b,x,_,14,a[30]),b=h(b,x=l(x,O,C,b,S,20,a[31]),O,C,m,4,a[32]),C=h(C,b,x,O,w,11,a[33]),O=h(O,C,b,x,A,16,a[34]),x=h(x,O,C,b,T,23,a[35]),b=h(b,x,O,C,c,4,a[36]),C=h(C,b,x,O,g,11,a[37]),O=h(O,C,b,x,_,16,a[38]),x=h(x,O,C,b,I,23,a[39]),b=h(b,x,O,C,k,4,a[40]),C=h(C,b,x,O,i,11,a[41]),O=h(O,C,b,x,p,16,a[42]),x=h(x,O,C,b,y,23,a[43]),b=h(b,x,O,C,v,4,a[44]),C=h(C,b,x,O,S,11,a[45]),O=h(O,C,b,x,P,16,a[46]),b=d(b,x=h(x,O,C,b,f,23,a[47]),O,C,i,6,a[48]),C=d(C,b,x,O,_,10,a[49]),O=d(O,C,b,x,T,15,a[50]),x=d(x,O,C,b,m,21,a[51]),b=d(b,x,O,C,S,6,a[52]),C=d(C,b,x,O,p,10,a[53]),O=d(O,C,b,x,I,15,a[54]),x=d(x,O,C,b,c,21,a[55]),b=d(b,x,O,C,w,6,a[56]),C=d(C,b,x,O,P,10,a[57]),O=d(O,C,b,x,y,15,a[58]),x=d(x,O,C,b,k,21,a[59]),b=d(b,x,O,C,g,6,a[60]),C=d(C,b,x,O,A,10,a[61]),O=d(O,C,b,x,f,15,a[62]),x=d(x,O,C,b,v,21,a[63]),o[0]=o[0]+b|0,o[1]=o[1]+x|0,o[2]=o[2]+O|0,o[3]=o[3]+C|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var o=e.floor(s/4294967296),i=s;n[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,s,r,o,i){var a=e+(t&n|~t&s)+r+i;return(a<>>32-o)+t}function l(e,t,n,s,r,o,i){var a=e+(t&s|n&~s)+r+i;return(a<>>32-o)+t}function h(e,t,n,s,r,o,i){var a=e+(t^n^s)+r+i;return(a<>>32-o)+t}function d(e,t,n,s,r,o,i){var a=e+(n^(t|~s))+r+i;return(a<>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),n.MD5)})),u((function(e,t){var n,s,r;e.exports=(s=(n=h).lib.Base,r=n.enc.Utf8,void(n.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,s=4*n;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),a=o.words,c=i.words,u=0;u>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var c=s.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(e){var t=e.length,n=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o>>6-i%4*2;s[o>>>2]|=(a|c)<<24-o%4*8,o++}return r.create(s,o)}(e,t,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)}));const g="FUNCTION",m="pending",y="rejected";function _(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function w(e){return"object"===_(e)}function v(e){return"function"==typeof e}function I(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const A="REJECTED",S="NOT_PENDING";class k{constructor({createPromise:e,retryRule:t=A}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case A:return this.status===y;case S:return this.status!==m}}exec(){return this.needRetry?(this.status=m,this.promise=this.createPromise().then((e=>(this.status="fulfilled",Promise.resolve(e))),(e=>(this.status=y,Promise.reject(e)))),this.promise):this.promise}}function T(e){return e&&"string"==typeof e?JSON.parse(e):e}const P=T([]),b="app";T("");const x=T('[{"provider":"alipay","spaceName":"oaapp","spaceId":"env-00jxgxphla18","spaceAppId":"2021004145628977","accessKey":"ZALus7EgJXdovISb","secretKey":"7qzvVrPN0mAxfcLr"}]')||[];let O="";try{O="__UNI__4796942"}catch(ye){}let C={};function L(e,t={}){var n,s;return n=C,s=e,Object.prototype.hasOwnProperty.call(n,s)||(C[e]=t),C[e]}C=uni._globalUniCloudObj?uni._globalUniCloudObj:uni._globalUniCloudObj={};const E=["invoke","success","fail","complete"],U=L("_globalUniCloudInterceptor");function R(e,t){U[e]||(U[e]={}),w(t)&&Object.keys(t).forEach((n=>{E.indexOf(n)>-1&&function(e,t,n){let s=U[e][t];s||(s=U[e][t]=[]),-1===s.indexOf(n)&&v(n)&&s.push(n)}(e,n,t[n])}))}function N(e,t){U[e]||(U[e]={}),w(t)?Object.keys(t).forEach((n=>{E.indexOf(n)>-1&&function(e,t,n){const s=U[e][t];if(!s)return;const r=s.indexOf(n);r>-1&&s.splice(r,1)}(e,n,t[n])})):delete U[e]}function D(e,t){return e&&0!==e.length?e.reduce(((e,n)=>e.then((()=>n(t)))),Promise.resolve()):Promise.resolve()}function M(e,t){return U[e]&&U[e][t]||[]}function F(e){R("callObject",e)}const q=L("_globalUniCloudListener"),j="response",$="needLogin",B="refreshToken",K="clientdb",H="cloudfunction",J="cloudobject";function W(e){return q[e]||(q[e]=[]),q[e]}function V(e,t){const n=W(e);n.includes(t)||n.push(t)}function z(e,t){const n=W(e),s=n.indexOf(t);-1!==s&&n.splice(s,1)}function Q(e,t){const n=W(e);for(let s=0;s{Y&&e(),function t(){if("function"==typeof getCurrentPages){const t=getCurrentPages();t&&t[0]&&(Y=!0,e())}Y||setTimeout((()=>{t()}),30)}()})),G)}function Z(e){const t={};for(const n in e){const s=e[n];v(s)&&(t[n]=I(s))}return t}class ee extends Error{constructor(e){super(e.message),this.errMsg=e.message||e.errMsg||"unknown system error",this.code=this.errCode=e.code||e.errCode||"SYSTEM_ERROR",this.errSubject=this.subject=e.subject||e.errSubject,this.cause=e.cause,this.requestId=e.requestId}toJson(e=0){if(!(e>=10))return e++,{errCode:this.errCode,errMsg:this.errMsg,errSubject:this.errSubject,cause:this.cause&&this.cause.toJson?this.cause.toJson(e):this.cause}}}var te={request:e=>uni.request(e),uploadFile:e=>uni.uploadFile(e),setStorageSync:(e,t)=>uni.setStorageSync(e,t),getStorageSync:e=>uni.getStorageSync(e),removeStorageSync:e=>uni.removeStorageSync(e),clearStorageSync:()=>uni.clearStorageSync()};function ne(e){return e&&ne(e.__v_raw)||e}function se(){return{token:te.getStorageSync("uni_id_token")||te.getStorageSync("uniIdToken"),tokenExpired:te.getStorageSync("uni_id_token_expired")}}function re({token:e,tokenExpired:t}={}){e&&te.setStorageSync("uni_id_token",e),t&&te.setStorageSync("uni_id_token_expired",t)}let oe,ie;function ae(){return oe||(oe=uni.getSystemInfoSync()),oe}function ce(){let e,t;try{if(uni.getLaunchOptionsSync){if(uni.getLaunchOptionsSync.toString().indexOf("not yet implemented")>-1)return;const{scene:n,channel:s}=uni.getLaunchOptionsSync();e=s,t=n}}catch(n){}return{channel:e,scene:t}}function ue(){const e=uni.getLocale&&uni.getLocale()||"en";if(ie)return{...ie,locale:e,LOCALE:e};const t=ae(),{deviceId:n,osName:s,uniPlatform:r,appId:o}=t,i=["pixelRatio","brand","model","system","language","version","platform","host","SDKVersion","swanNativeVersion","app","AppPlatform","fontSizeSetting"];for(let a=0;a{t(Object.assign(e,{complete(e){e||(e={});const t=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400){const n=e.data&&e.data.error&&e.data.error.code||"SYS_ERR",r=e.data&&e.data.error&&e.data.error.message||e.errMsg||"request:fail";return s(new ee({code:n,message:r,requestId:t}))}const r=e.data;if(r.error)return s(new ee({code:r.error.code,message:r.error.message,requestId:t}));r.result=r.data,r.requestId=t,delete r.data,n(r)}}))}))},de=function(e){return p.stringify(f.parse(e))},fe=class{constructor(e){["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),this.config=Object.assign({},{endpoint:0===e.spaceId.indexOf("mp-")?"https://api.next.bspapp.com":"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId,this.adapter=te,this._getAccessTokenPromiseHub=new k({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new ee({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:S})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return he(e,this.adapter.request)}requestAuth(e){return this.requestWrapped(e)}request(e,t){return Promise.resolve().then((()=>this.hasAccessToken?t?this.requestWrapped(e):this.requestWrapped(e).catch((t=>new Promise(((e,n)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?n(t):e()})).then((()=>this.getAccessToken())).then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})))):this.getAccessToken().then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)}))))}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=le(t.data,this.config.clientSecret),t}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};return"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=le(n,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:s}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,name:n,filePath:s,fileType:r,onUploadProgress:o}){return new Promise(((i,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:r,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?i(e):a(new ee({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new ee({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}async uploadFile({filePath:e,cloudPath:t,fileType:n="image",cloudPathAsRealPath:s=!1,onUploadProgress:r,config:o}){if("string"!==_(t))throw new ee({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new ee({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new ee({code:"INVALID_PARAM",message:"cloudPath不合法"});const i=o&&o.envType||this.config.envType;if(s&&("/"!==t[0]&&(t="/"+t),t.indexOf("\\")>-1))throw new ee({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:i,filename:s?t.split("/").pop():t,fileId:s?t:void 0})).result,c="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:u,accessKeyId:l,signature:h,host:d,ossPath:f,id:p,policy:g,ossCallbackUrl:m}=a,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:l,Signature:h,host:d,id:p,key:f,policy:g,success_action_status:200};if(u&&(y["x-oss-security-token"]=u),m){const e=JSON.stringify({callbackUrl:m,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=de(e)}const w={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:e,fileType:n};if(await this.uploadFileToOSS(Object.assign({},w,{onUploadProgress:r})),m)return{success:!0,filePath:e,fileID:c};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:e,fileID:c};throw new ee({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,n)=>{Array.isArray(e)&&0!==e.length||n(new ee({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),t({fileList:e.map((e=>({fileID:e,tempFileURL:e})))})}))}async getFileInfo({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new ee({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.info",params:JSON.stringify({id:e.map((e=>e.split("?")[0])).join(",")})};return{fileList:(await this.request(this.setupRequest(t))).result}}},pe={init(e){const t=new fe(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}};const ge="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var me,ye;(ye=me||(me={})).local="local",ye.none="none",ye.session="session";var _e=function(){},we=u((function(e,t){var n;e.exports=(n=h,function(e){var t=n,s=t.lib,r=s.WordArray,o=s.Hasher,i=t.algo,a=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(a[r]=n(e.pow(s,.5))),c[r]=n(e.pow(s,1/3)),r++),s++}();var u=[],l=i.SHA256=o.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,s=n[0],r=n[1],o=n[2],i=n[3],a=n[4],l=n[5],h=n[6],d=n[7],f=0;f<64;f++){if(f<16)u[f]=0|e[t+f];else{var p=u[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=u[f-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[f]=g+u[f-7]+y+u[f-16]}var _=s&r^s&o^r&o,w=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+c[f]+u[f];d=h,h=l,l=a,a=i+v|0,i=o,o=r,r=s,s=v+(w+_)|0}n[0]=n[0]+s|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+i|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=e.floor(s/4294967296),n[15+(r+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)})),ve=we,Ie=u((function(e,t){e.exports=h.HmacSHA256}));const Ae=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new ee({message:'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'})};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}const t=new Promise(((t,n)=>{e=(e,s)=>e?n(e):t(s)}));return e.promise=t,e};function Se(e){return void 0===e}function ke(e){return"[object Null]"===Object.prototype.toString.call(e)}var Te;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(Te||(Te={}));const Pe={adapter:null,runtime:void 0},be=["anonymousUuidKey"];class xe extends _e{constructor(){super(),Pe.adapter.root.tcbObject||(Pe.adapter.root.tcbObject={})}setItem(e,t){Pe.adapter.root.tcbObject[e]=t}getItem(e){return Pe.adapter.root.tcbObject[e]}removeItem(e){delete Pe.adapter.root.tcbObject[e]}clear(){delete Pe.adapter.root.tcbObject}}function Oe(e,t){switch(e){case"local":return t.localStorage||new xe;case"none":return new xe;default:return t.sessionStorage||new xe}}class Ce{constructor(e){if(!this._storage){this._persistence=Pe.adapter.primaryStorage||e.persistence,this._storage=Oe(this._persistence,Pe.adapter);const t=`access_token_${e.env}`,n=`access_token_expire_${e.env}`,s=`refresh_token_${e.env}`,r=`anonymous_uuid_${e.env}`,o=`login_type_${e.env}`,i=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:s,anonymousUuidKey:r,loginTypeKey:o,userInfoKey:i}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const n=Oe(e,Pe.adapter);for(const s in this.keys){const e=this.keys[s];if(t&&be.includes(s))continue;const r=this._storage.getItem(e);Se(r)||ke(r)||(n.setItem(e,r),this._storage.removeItem(e))}this._storage=n}setStore(e,t,n){if(!this._storage)return;const s={version:n||"localCachev1",content:t},r=JSON.stringify(s);try{this._storage.setItem(e,r)}catch(o){throw o}}getStore(e,t){try{if(!this._storage)return}catch(s){return""}t=t||"localCachev1";const n=this._storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}removeStore(e){this._storage.removeItem(e)}}const Le={},Ee={};function Ue(e){return Le[e]}class Re{constructor(e,t){this.data=t||null,this.name=e}}class Ne extends Re{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const De=new class{constructor(){this._listeners={}}on(e,t){return n=e,s=t,(r=this._listeners)[n]=r[n]||[],r[n].push(s),this;var n,s,r}off(e,t){return function(e,t,n){if(n&&n[e]){const s=n[e].indexOf(t);-1!==s&&n[e].splice(s,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof Ne)return console.error(e.error),this;const n="string"==typeof e?new Re(e,t||{}):e,s=n.name;if(this._listens(s)){n.target=this;const e=this._listeners[s]?[...this._listeners[s]]:[];for(const t of e)t.call(this,n)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function Me(e,t){De.on(e,t)}function Fe(e,t={}){De.fire(e,t)}function qe(e,t){De.off(e,t)}const je="loginStateChanged",$e="loginStateExpire",Be="loginTypeChanged",Ke="anonymousConverted",He="refreshAccessToken";var Je;!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL"}(Je||(Je={}));const We=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],Ve={"X-SDK-Version":"1.3.5"};function ze(e,t,n){const s=e[t];e[t]=function(t){const r={},o={};n.forEach((n=>{const{data:s,headers:i}=n.call(e,t);Object.assign(r,s),Object.assign(o,i)}));const i=t.data;return i&&(()=>{var e;if(e=i,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...i,...r};else for(const t in r)i.append(t,r[t])})(),t.headers={...t.headers||{},...o},s.call(e,t)}}function Qe(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...Ve,"x-seqid":e}}}class Ge{constructor(e={}){var t;this.config=e,this._reqClass=new Pe.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=Ue(this.config.env),this._localCache=(t=this.config.env,Ee[t]),ze(this._reqClass,"post",[Qe]),ze(this._reqClass,"upload",[Qe]),ze(this._reqClass,"download",[Qe])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(n){t=n}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n,loginTypeKey:s,anonymousUuidKey:r}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let o=this._cache.getStore(n);if(!o)throw new ee({message:"未登录CloudBase"});const i={refresh_token:o},a=await this.request("auth.fetchAccessTokenWithRefreshToken",i);if(a.data.code){const{code:e}=a.data;if("SIGN_PARAM_INVALID"===e||"REFRESH_TOKEN_EXPIRED"===e||"INVALID_REFRESH_TOKEN"===e){if(this._cache.getStore(s)===Je.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(r),t=this._cache.getStore(n),s=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(s.refresh_token),this._refreshAccessToken()}Fe($e),this._cache.removeStore(n)}throw new ee({code:a.data.code,message:`刷新access token失败:${a.data.code}`})}if(a.data.access_token)return Fe(He),this._cache.setStore(e,a.data.access_token),this._cache.setStore(t,a.data.access_token_expire+Date.now()),{accessToken:a.data.access_token,accessTokenExpire:a.data.access_token_expire};a.data.refresh_token&&(this._cache.removeStore(n),this._cache.setStore(n,a.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n}=this._cache.keys;if(!this._cache.getStore(n))throw new ee({message:"refresh token不存在,登录状态异常"});let s=this._cache.getStore(e),r=this._cache.getStore(t),o=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(s,r))&&(o=!1),(!s||!r||r{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:n,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:n,avatarUrl:s,province:r,country:o,city:i}=e,{data:a}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:s,province:r,country:o,city:i});this.setLocalUserInfo(a)}async refresh(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((e=>{this[e]=t[e]})),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class tt{constructor(e){if(!e)throw new ee({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=Ue(e);const{refreshTokenKey:t,accessTokenKey:n,accessTokenExpireKey:s}=this._cache.keys,r=this._cache.getStore(t),o=this._cache.getStore(n),i=this._cache.getStore(s);this.credential={refreshToken:r,accessToken:o,accessTokenExpire:i},this.user=new et(e)}get isAnonymousAuth(){return this.loginType===Je.ANONYMOUS}get isCustomAuth(){return this.loginType===Je.CUSTOM}get isWeixinAuth(){return this.loginType===Je.WECHAT||this.loginType===Je.WECHAT_OPEN||this.loginType===Je.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class nt extends Ze{async signIn(){this._cache.updatePersistence("local");const{anonymousUuidKey:e,refreshTokenKey:t}=this._cache.keys,n=this._cache.getStore(e)||void 0,s=this._cache.getStore(t)||void 0,r=await this._request.send("auth.signInAnonymously",{anonymous_uuid:n,refresh_token:s});if(r.uuid&&r.refresh_token){this._setAnonymousUUID(r.uuid),this.setRefreshToken(r.refresh_token),await this._request.refreshAccessToken(),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.ANONYMOUS,persistence:"local"});const e=new tt(this.config.env);return await e.user.refresh(),e}throw new ee({message:"匿名登录失败"})}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:n}=this._cache.keys,s=this._cache.getStore(t),r=this._cache.getStore(n),o=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:s,refresh_token:r,ticket:e});if(o.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(o.refresh_token),await this._request.refreshAccessToken(),Fe(Ke,{env:this.config.env}),Fe(Be,{loginType:Je.CUSTOM,persistence:"local"}),{credential:{refreshToken:o.refresh_token}};throw new ee({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(n,Je.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class st extends Ze{async signIn(e){if("string"!=typeof e)throw new ee({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,n=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(n.refresh_token)return this.setRefreshToken(n.refresh_token),await this._request.refreshAccessToken(),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new tt(this.config.env);throw new ee({message:"自定义登录失败"})}}class rt extends Ze{async signIn(e,t){if("string"!=typeof e)throw new ee({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token:o,access_token_expire:i}=s;if(r)return this.setRefreshToken(r),o&&i?this.setAccessToken(o,i):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.EMAIL,persistence:this.config.persistence}),new tt(this.config.env);throw s.code?new ee({code:s.code,message:`邮箱登录失败: ${s.message}`}):new ee({message:"邮箱登录失败"})}async activate(e){return this._request.send("auth.activateEndUserMail",{token:e})}async resetPasswordWithToken(e,t){return this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})}}class ot extends Ze{async signIn(e,t){if("string"!=typeof e)throw new ee({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:Je.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:r,access_token_expire:o,access_token:i}=s;if(r)return this.setRefreshToken(r),i&&o?this.setAccessToken(i,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.USERNAME,persistence:this.config.persistence}),new tt(this.config.env);throw s.code?new ee({code:s.code,message:`用户名密码登录失败: ${s.message}`}):new ee({message:"用户名密码登录失败"})}}class it{constructor(e){this.config=e,this._cache=Ue(e.env),this._request=Xe(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),Me(Be,this._onLoginTypeChanged)}get currentUser(){const e=this.hasLoginState();return e&&e.user||null}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}anonymousAuthProvider(){return new nt(this.config)}customAuthProvider(){return new st(this.config)}emailAuthProvider(){return new rt(this.config)}usernameAuthProvider(){return new ot(this.config)}async signInAnonymously(){return new nt(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new rt(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new ot(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new nt(this.config)),Me(Ke,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===Je.ANONYMOUS)throw new ee({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:n}=this._cache.keys,s=this._cache.getStore(e);if(!s)return;const r=await this._request.send("auth.logout",{refresh_token:s});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(n),Fe(je),Fe(Be,{env:this.config.env,loginType:Je.NULL,persistence:this.config.persistence}),r}async signUpWithEmailAndPassword(e,t){return this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})}async sendPasswordResetEmail(e){return this._request.send("auth.sendPasswordResetEmail",{email:e})}onLoginStateChanged(e){Me(je,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){Me($e,e.bind(this))}onAccessTokenRefreshed(e){Me(He,e.bind(this))}onAnonymousConverted(e){Me(Ke,e.bind(this))}onLoginTypeChanged(e){Me(Be,(()=>{const t=this.hasLoginState();e.call(this,t)}))}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{refreshTokenKey:e}=this._cache.keys;return this._cache.getStore(e)?new tt(this.config.env):null}async isUsernameRegistered(e){if("string"!=typeof e)throw new ee({code:"PARAM_ERROR",message:"username must be a string"});const{data:t}=await this._request.send("auth.isUsernameRegistered",{username:e});return t&&t.isRegistered}getLoginState(){return Promise.resolve(this.hasLoginState())}async signInWithTicket(e){return new st(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then((e=>e.code?e:{...e.data,requestId:e.seqId}))}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,n=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+n}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:n,env:s}=e.data;s===this.config.env&&(this._cache.updatePersistence(n),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const at=function(e,t){t=t||Ae();const n=Xe(this.config.env),{cloudPath:s,filePath:r,onUploadProgress:o,fileType:i="image"}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{const{data:{url:a,authorization:c,token:u,fileId:l,cosFileId:h},requestId:d}=e,f={key:s,signature:c,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":u};n.upload({url:a,data:f,file:r,name:s,fileType:i,onUploadProgress:o}).then((e=>{201===e.statusCode?t(null,{fileID:l,requestId:d}):t(new ee({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},ct=function(e,t){t=t||Ae();const n=Xe(this.config.env),{cloudPath:s}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},ut=function({fileList:e},t){if(t=t||Ae(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let s of e)if(!s||"string"!=typeof s)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const n={fileid_list:e};return Xe(this.config.env).send("storage.batchDeleteFile",n).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},lt=function({fileList:e},t){t=t||Ae(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let n=[];for(let r of e)"object"==typeof r?(r.hasOwnProperty("fileID")&&r.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),n.push({fileid:r.fileID,max_age:r.maxAge})):"string"==typeof r?n.push({fileid:r}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const s={file_list:n};return Xe(this.config.env).send("storage.batchGetDownloadUrl",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},ht=async function({fileID:e},t){const n=(await lt.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==n.code)return t?t(n):new Promise((e=>{e(n)}));const s=Xe(this.config.env);let r=n.download_url;if(r=encodeURI(r),!t)return s.download({url:r});t(await s.download({url:r}))},dt=function({name:e,data:t,query:n,parse:s,search:r},o){const i=o||Ae();let a;try{a=t?JSON.stringify(t):""}catch(u){return Promise.reject(u)}if(!e)return Promise.reject(new ee({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:n,parse:s,search:r,function_name:e,request_data:a};return Xe(this.config.env).send("functions.invokeFunction",c).then((e=>{if(e.code)i(null,e);else{let n=e.data.response_data;if(s)i(null,{result:n,requestId:e.requestId});else try{n=JSON.parse(e.data.response_data),i(null,{result:n,requestId:e.requestId})}catch(t){i(new ee({message:"response data must be json"}))}}return i.promise})).catch((e=>{i(e)})),i.promise},ft={timeout:15e3,persistence:"session"},pt={};class gt{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(Pe.adapter||(this.requestClient=new Pe.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...ft,...e},!0){case this.config.timeout>6e5:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=6e5;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new gt(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||Pe.adapter.primaryStorage||ft.persistence;var n;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;Le[t]=new Ce(e),Ee[t]=new Ce({...e,persistence:"local"})}(this.config),n=this.config,Ye[n.env]=new Ge(n),this.authObj=new it(this.config),this.authObj}on(e,t){return Me.apply(this,[e,t])}off(e,t){return qe.apply(this,[e,t])}callFunction(e,t){return dt.apply(this,[e,t])}deleteFile(e,t){return ut.apply(this,[e,t])}getTempFileURL(e,t){return lt.apply(this,[e,t])}downloadFile(e,t){return ht.apply(this,[e,t])}uploadFile(e,t){return at.apply(this,[e,t])}getUploadMetadata(e,t){return ct.apply(this,[e,t])}registerExtension(e){pt[e.name]=e}async invokeExtension(e,t){const n=pt[e];if(!n)throw new ee({message:`扩展${e} 必须先注册`});return await n.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:n}=function(e){const t=(n=e,"[object Array]"===Object.prototype.toString.call(n)?e:[e]);var n;for(const s of t){const{isMatch:e,genAdapter:t,runtime:n}=s;if(e())return{adapter:t(),runtime:n}}}(e)||{};t&&(Pe.adapter=t),n&&(Pe.runtime=n)}}var mt=new gt;function yt(e,t,n){void 0===n&&(n={});var s=/\?/.test(t),r="";for(var o in n)""===r?!s&&(t+="?"):r+="&",r+=o+"="+encodeURIComponent(n[o]);return/^http(s)?:\/\//.test(t+=r)?t:""+e+t}class _t{post(e){const{url:t,data:n,headers:s}=e;return new Promise(((e,r)=>{te.request({url:yt("https:",t),data:n,method:"POST",header:s,success(t){e(t)},fail(e){r(e)}})}))}upload(e){return new Promise(((t,n)=>{const{url:s,file:r,data:o,headers:i,fileType:a}=e,c=te.uploadFile({url:yt("https:",s),name:"file",formData:Object.assign({},o),filePath:r,fileType:a,header:i,success(e){const n={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&o.success_action_status&&(n.statusCode=parseInt(o.success_action_status,10)),t(n)},fail(e){n(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((t=>{e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}const wt={setItem(e,t){te.setStorageSync(e,t)},getItem:e=>te.getStorageSync(e),removeItem(e){te.removeStorageSync(e)},clear(){te.clearStorageSync()}};var vt={genAdapter:function(){return{root:{},reqClass:_t,localStorage:wt,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};mt.useAdapters(vt);const It=mt,At=It.init;It.init=function(e){e.env=e.spaceId;const t=At.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const n=t.auth;return t.auth=function(e){const t=n.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var n;t[e]=(n=t[e],function(e){e=e||{};const{success:t,fail:s,complete:r}=Z(e);if(!(t||s||r))return n.call(this,e);n.call(this,e).then((e=>{t&&t(e),r&&r(e)}),(e=>{s&&s(e),r&&r(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var St=It,kt=class extends fe{getAccessToken(){return new Promise(((e,t)=>{const n="Anonymous_Access_token";this.setAccessToken(n),e(n)}))}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=le(n,this.config.clientSecret);const r=ue();s["x-client-info"]=encodeURIComponent(JSON.stringify(r));const{token:o}=se();return s["x-client-token"]=o,{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:JSON.parse(JSON.stringify(s))}}uploadFileToOSS({url:e,formData:t,name:n,filePath:s,fileType:r,onUploadProgress:o}){return new Promise(((i,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:r,success(e){e&&e.statusCode<400?i(e):a(new ee({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new ee({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}uploadFile({filePath:e,cloudPath:t,fileType:n="image",onUploadProgress:s}){if(!t)throw new ee({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let r;return this.getOSSUploadOptionsFromPath({cloudPath:t}).then((t=>{const{url:o,formData:i,name:a}=t.result;r=t.result.fileUrl;const c={url:o,formData:i,name:a,filePath:e,fileType:n};return this.uploadFileToOSS(Object.assign({},c,{onUploadProgress:s}))})).then((()=>this.reportOSSUpload({cloudPath:t}))).then((t=>new Promise(((n,s)=>{t.success?n({success:!0,filePath:e,fileID:r}):s(new ee({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return e.result;throw new ee({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e,maxAge:t}={}){if(!Array.isArray(e)||0===e.length)throw new ee({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const n={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e,maxAge:t})};return this.request(this.setupRequest(n)).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new ee({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}},Tt={init(e){const t=new kt(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}},Pt=u((function(e,t){e.exports=h.enc.Hex}));function bt(e="",t={}){const{data:n,functionName:s,method:r,headers:o,signHeaderKeys:i=[],config:a}=t,c=Date.now(),u="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),l=Object.assign({},o,{"x-from-app-id":a.spaceAppId,"x-from-env-id":a.spaceId,"x-to-env-id":a.spaceId,"x-from-instance-id":c,"x-from-function-name":s,"x-client-timestamp":c,"x-alipay-source":"client","x-request-id":u,"x-alipay-callid":u,"x-trace-id":u}),h=["x-from-app-id","x-from-env-id","x-to-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp"].concat(i),[d="",f=""]=e.split("?")||[],p=function(e){const t=e.signedHeaders.join(";"),n=e.signedHeaders.map((t=>`${t.toLowerCase()}:${e.headers[t]}\n`)).join(""),s=ve(e.body).toString(Pt),r=`${e.method.toUpperCase()}\n${e.path}\n${e.query}\n${n}\n${t}\n${s}\n`,o=ve(r).toString(Pt),i=`HMAC-SHA256\n${e.timestamp}\n${o}\n`,a=Ie(i,e.secretKey).toString(Pt);return`HMAC-SHA256 Credential=${e.secretId}, SignedHeaders=${t}, Signature=${a}`}({path:d,query:f,method:r,headers:l,timestamp:c,body:JSON.stringify(n),secretId:a.accessKey,secretKey:a.secretKey,signedHeaders:h.sort()});return{url:`${a.endpoint}${e}`,headers:Object.assign({},l,{Authorization:p})}}function xt({url:e,data:t,method:n="POST",headers:s={}}){return new Promise(((r,o)=>{te.request({url:e,method:n,data:t,header:s,dataType:"json",complete:(e={})=>{const t=s["x-trace-id"]||"";if(!e.statusCode||e.statusCode>=400){const{message:n,errMsg:s,trace_id:r}=e.data||{};return o(new ee({code:"SYS_ERR",message:n||s||"request:fail",requestId:r||t}))}r({status:e.statusCode,data:e.data,headers:e.header,requestId:t})}})}))}function Ot(e,t){const{path:n,data:s,method:r="GET"}=e,{url:o,headers:i}=bt(n,{functionName:"",data:s,method:r,headers:{"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":Date.now()+6e4},signHeaderKeys:["x-data-api-type","x-expire-timestamp"],config:t});return xt({url:o,data:s,method:r,headers:i}).then((e=>{const t=e.data||{};if(!t.success)throw new ee({code:e.errCode,message:e.errMsg,requestId:e.requestId});return t.data||{}})).catch((e=>{throw new ee({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}function Ct(e=""){const t=e.trim().replace(/^cloud:\/\//,""),n=t.indexOf("/");if(n<=0)throw new ee({code:"INVALID_PARAM",message:"fileID不合法"});const s=t.substring(0,n),r=t.substring(n+1);return s!==this.config.spaceId&&console.warn("file ".concat(e," does not belong to env ").concat(this.config.spaceId)),r}function Lt(e=""){return"cloud://".concat(this.config.spaceId,"/").concat(e.replace(/^\/+/,""))}var Et={init:e=>{e.provider="alipay";const t=new class{constructor(e){if(["spaceId","spaceAppId","accessKey","secretKey"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),e.endpoint){if("string"!=typeof e.endpoint)throw new Error("endpoint must be string");if(!/^https:\/\//.test(e.endpoint))throw new Error("endpoint must start with https://");e.endpoint=e.endpoint.replace(/\/$/,"")}this.config=Object.assign({},e,{endpoint:e.endpoint||`https://${e.spaceId}.api-hz.cloudbasefunction.cn`})}callFunction(e){return function(e,t){const{name:n,data:s}=e,r="POST",{url:o,headers:i}=bt("/functions/invokeFunction",{functionName:n,data:s,method:r,headers:{"x-to-function-name":n},signHeaderKeys:["x-to-function-name"],config:t});return xt({url:o,data:s,method:r,headers:i}).then((e=>({errCode:0,success:!0,requestId:e.requestId,result:e.data}))).catch((e=>{throw new ee({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}(e,this.config)}uploadFileToOSS({url:e,filePath:t,fileType:n,formData:s,onUploadProgress:r}){return new Promise(((o,i)=>{const a=te.uploadFile({url:e,filePath:t,fileType:n,formData:s,name:"file",success(e){e&&e.statusCode<400?o(e):i(new ee({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){i(new ee({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof r&&a&&"function"==typeof a.onProgressUpdate&&a.onProgressUpdate((e=>{r({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}async uploadFile({filePath:e,cloudPath:t="",fileType:n="image",onUploadProgress:s}){if("string"!==_(t))throw new ee({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new ee({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new ee({code:"INVALID_PARAM",message:"cloudPath不合法"});const r=await Ot({path:"/".concat(t.replace(/^\//,""),"?post_url")},this.config),{file_id:o,upload_url:i,form_data:a}=r,c=a&&a.reduce(((e,t)=>(e[t.key]=t.value,e)),{});return this.uploadFileToOSS({url:i,filePath:e,fileType:n,formData:c,onUploadProgress:s}).then((()=>({fileID:o})))}async getTempFileURL({fileList:e}){return new Promise(((t,n)=>{(!e||e.length<0)&&n(new ee({errCode:"INVALID_PARAM",errMsg:"fileList不能为空数组"})),e.length>50&&n(new ee({errCode:"INVALID_PARAM",errMsg:"fileList数组长度不能超过50"}));const s=[];for(const r of e){"string"!==_(r)&&n(new ee({errCode:"INVALID_PARAM",errMsg:"fileList的元素必须是非空的字符串"}));const e=Ct.call(this,r);s.push({file_id:e,expire:600})}Ot({path:"/?download_url",data:{file_list:s},method:"POST"},this.config).then((e=>{const{file_list:n=[]}=e;t({fileList:n.map((e=>({fileID:Lt.call(this,e.file_id),tempFileURL:e.download_url})))})})).catch((e=>n(e)))}))}}(e);return t.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},t}};function Ut({data:e}){let t;t=ue();const n=JSON.parse(JSON.stringify(e||{}));if(Object.assign(n,{clientInfo:t}),!n.uniIdToken){const{token:e}=se();e&&(n.uniIdToken=e)}return n}const Rt=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var Nt=/[\\^$.*+?()[\]{}|]/g,Dt=RegExp(Nt.source);function Mt(e,t,n){return e.replace(new RegExp((s=t)&&Dt.test(s)?s.replace(Nt,"\\$&"):s,"g"),n);var s}const Ft="request",qt="response",jt="both",$t={code:2e4,message:"System error"},Bt={code:20101,message:"Invalid client"};function Kt(e){const{errSubject:t,subject:n,errCode:s,errMsg:r,code:o,message:i,cause:a}=e||{};return new ee({subject:t||n||"uni-secure-network",code:s||o||$t.code,message:r||i,cause:a})}let Ht;function Jt({secretType:e}={}){return e===Ft||e===qt||e===jt}function Wt({name:e,data:t={}}={}){return"DCloud-clientDB"===e&&"encryption"===t.redirectTo&&"getAppClientKey"===t.action}function Vt({functionName:e,result:t,logPvd:n}){}function zt(e){const t=e.callFunction,n=function(n){const s=n.name;n.data=Ut.call(e,{data:n.data});const r={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay"}[this.config.provider],o=Jt(n),i=Wt(n),a=o||i;return t.call(this,n).then((e=>(e.errCode=0,!a&&Vt.call(this,{functionName:s,result:e,logPvd:r}),Promise.resolve(e))),(e=>(!a&&Vt.call(this,{functionName:s,result:e,logPvd:r}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:n=[]}={}){for(let s=0;sn.provider===e&&n.spaceId===t));return s&&s.config}({provider:e,spaceId:t});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},u=Object.keys(c);if(0===u.length)return!0;const l=function(e,t){let n,s,r;for(let o=0;oe.trim())).indexOf(t)>-1&&(s=i):r=i:n=i}return n||s||r}(u,n);if(!l)return!1;if((c[l]||[]).find(((e={})=>e.appId===s&&(e.platform||"").toLowerCase()===i.toLowerCase())))return!0;throw console.error(`此应用[appId: ${s}, platform: ${i}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),Kt(Bt)}({provider:s,spaceId:r,functionName:o})?new Ht({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(n.bind(e))(t):i(t),Object.defineProperty(a,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),a.then((e=>("undefined"!=typeof UTSJSONObject&&(e.result=new UTSJSONObject(e.result)),e)))}}Ht=class{constructor(){throw Kt({message:`Platform ${b} is not enabled, please check whether secure network module is enabled in your manifest.json`})}};const Qt=Symbol("CLIENT_DB_INTERNAL");function Gt(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Qt,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,n,s){if("_uniClient"===n)return null;if("symbol"==typeof n)return e[n];if(n in e||"string"!=typeof n){const t=e[n];return"function"==typeof t?t.bind(e):t}return t.get(e,n,s)}})}function Yt(e){return{on:(t,n)=>{e[t]=e[t]||[],e[t].indexOf(n)>-1||e[t].push(n)},off:(t,n)=>{e[t]=e[t]||[];const s=e[t].indexOf(n);-1!==s&&e[t].splice(s,1)}}}const Xt=["db.Geo","db.command","command.aggregate"];function Zt(e,t){return Xt.indexOf(`${e}.${t}`)>-1}function en(e){switch(_(e=ne(e))){case"array":return e.map((e=>en(e)));case"object":return e._internalType===Qt||Object.keys(e).forEach((t=>{e[t]=en(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function tn(e){return e&&e.content&&e.content.$method}class nn{constructor(e,t,n){this.content=e,this.prevStage=t||null,this.udb=null,this._database=n}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((e=>({$method:e.$method,$param:en(e.$param)})))}}toString(){return JSON.stringify(this.toJSON())}getAction(){const e=this.toJSON().$db.find((e=>"action"===e.$method));return e&&e.$param&&e.$param[0]}getCommand(){return{$db:this.toJSON().$db.filter((e=>"action"!==e.$method))}}get isAggregate(){let e=this;for(;e;){const t=tn(e),n=tn(e.prevStage);if("aggregate"===t&&"collection"===n||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===tn(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=tn(e),n=tn(e.prevStage);if("aggregate"===t&&"command"===n)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return sn({$method:e,$param:en(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const n=this.getAction(),s=this.getCommand();return s.$db.push({$method:e,$param:en(t)}),this._database._callCloudFunction({action:n,command:s})}}function sn(e,t,n){return Gt(new nn(e,t,n),{get(e,t){let s="db";return e&&e.content&&(s=e.content.$method),Zt(s,t)?sn({$method:t},e,n):function(){return sn({$method:t,$param:en(Array.from(arguments))},e,n)}}})}function rn({path:e,method:t}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...e.map((e=>({$method:e}))),{$method:t,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}function on(e,t={}){return Gt(new e(t),{get:(e,t)=>Zt("db",t)?sn({$method:t},null,e):function(){return sn({$method:t,$param:en(Array.from(arguments))},null,e)}})}class an extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=L("_globalUniCloudDatabaseCallback")),t||(this.auth=Yt(this._authCallBacks)),this._isJQL=t,Object.assign(this,Yt(this._dbCallBacks)),this.env=Gt({},{get:(e,t)=>({$env:t})}),this.Geo=Gt({},{get:(e,t)=>rn({path:["Geo"],method:t})}),this.serverDate=rn({path:[],method:"serverDate"}),this.RegExp=rn({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const n=this._dbCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const n=this._authCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),n=e.getCommand();if("getTemp"!==n.$db[n.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:n}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:n,queryList:s}){function r(e,t){if(n&&s)for(let n=0;nD(M(i,"complete"),e))).then((()=>(r(null,e),Q(j,{type:K,content:e}),Promise.reject(e))))}const c=D(M(i,"invoke")),u=this._uniClient;return c.then((()=>u.callFunction({name:"DCloud-clientDB",type:"CLIENT_DB",data:{action:e,command:t,multiCommand:n}}))).then((e=>{const{code:t,message:n,token:s,tokenExpired:c,systemInfo:u=[]}=e.result;if(u)for(let r=0;r(console.warn(n),s)})}}return h=e,D(M(i,"success"),h).then((()=>D(M(i,"complete"),h))).then((()=>{r(h,null);const e=o._parseResult(h);return Q(j,{type:K,content:e}),Promise.resolve(e)}));var h}),(e=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),a(new ee({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const cn="token无效,跳转登录页面",un="token过期,跳转登录页面",ln={TOKEN_INVALID_TOKEN_EXPIRED:un,TOKEN_INVALID_INVALID_CLIENTID:cn,TOKEN_INVALID:cn,TOKEN_INVALID_WRONG_TOKEN:cn,TOKEN_INVALID_ANONYMOUS_USER:cn},hn={"uni-id-token-expired":un,"uni-id-check-token-failed":cn,"uni-id-token-not-exist":cn,"uni-id-check-device-feature-failed":cn};function dn(e,t){let n="";return n=e?`${e}/${t}`:t,n.replace(/^\//,"")}function fn(e=[],t=""){const n=[],s=[];return e.forEach((e=>{!0===e.needLogin?n.push(dn(t,e.path)):!1===e.needLogin&&s.push(dn(t,e.path))})),{needLoginPage:n,notNeedLoginPage:s}}function pn(e){return e.split("?")[0].replace(/^\//,"")}function gn(){return function(e){let t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){const e=getCurrentPages();return e[e.length-1]}())}function mn(){return pn(gn())}function yn(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const n=t.list,s=pn(e);return n.some((e=>e.pagePath===s))}const _n=!!c.uniIdRouter,{loginPage:wn,routerNeedLogin:vn,resToLogin:In,needLoginPage:An,notNeedLoginPage:Sn,loginPageInTabBar:kn}=function({pages:e=[],subPackages:t=[],uniIdRouter:n={},tabBar:s={}}=c){const{loginPage:r,needLogin:o=[],resToLogin:i=!0}=n,{needLoginPage:a,notNeedLoginPage:u}=fn(e),{needLoginPage:l,notNeedLoginPage:h}=function(e=[]){const t=[],n=[];return e.forEach((e=>{const{root:s,pages:r=[]}=e,{needLoginPage:o,notNeedLoginPage:i}=fn(r,s);t.push(...o),n.push(...i)})),{needLoginPage:t,notNeedLoginPage:n}}(t);return{loginPage:r,routerNeedLogin:o,resToLogin:i,needLoginPage:[...a,...l],notNeedLoginPage:[...u,...h],loginPageInTabBar:yn(r,s)}}();if(An.indexOf(wn)>-1)throw new Error(`Login page [${wn}] should not be "needLogin", please check your pages.json`);function Tn(e){const t=mn();if("/"===e.charAt(0))return e;const[n,s]=e.split("?"),r=n.replace(/^\//,"").split("/"),o=t.split("/");o.pop();for(let i=0;i-1?s+`&uniIdRedirectUrl=${encodeURIComponent(r)}`:s+`?uniIdRedirectUrl=${encodeURIComponent(r)}`:s);var s,r;kn?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const o={navigateTo:uni.navigateTo,redirectTo:uni.redirectTo,switchTab:uni.switchTab,reLaunch:uni.reLaunch};setTimeout((()=>{o[e]({url:n})}),0)}function xn({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},n=function(){const{token:e,tokenExpired:t}=se();let n;if(e){if(t-1)&&(An.indexOf(t)>-1||vn.some((t=>{return n=e,new RegExp(t).test(n);var n})))}(e)&&n){if(n.uniIdRedirectUrl=e,W($).length>0)return setTimeout((()=>{Q($,n)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function On(){!function(){const e=gn(),{abortLoginPageJump:t,autoToLoginPage:n}=xn({url:e});t||n&&bn({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t{const{type:t,content:n}=e;let s=!1;switch(t){case"cloudobject":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in hn}(n);break;case"clientdb":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in ln}(n)}s&&function(e={}){const t=W($);X().then((()=>{const n=gn();if(n&&Pn({redirect:n}))return t.length>0?Q($,Object.assign({uniIdRedirectUrl:n},e)):void(wn&&bn({api:"navigateTo",redirect:n}))}))}(n)}))}function Ln(e){var t;(t=e).onResponse=function(e){V(j,e)},t.offResponse=function(e){z(j,e)},function(e){e.onNeedLogin=function(e){V($,e)},e.offNeedLogin=function(e){z($,e)},_n&&(L("_globalUniCloudStatus").needLoginInit||(L("_globalUniCloudStatus").needLoginInit=!0,X().then((()=>{On.call(e)})),In&&Cn.call(e)))}(e),function(e){e.onRefreshToken=function(e){V(B,e)},e.offRefreshToken=function(e){z(B,e)}}(e)}let En;const Un="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Rn=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Nn(){const e=se().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((s=t[1],decodeURIComponent(En(s).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(r){throw new Error("获取当前用户信息出错,详细错误信息为:"+r.message)}var s;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}En="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Rn.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,s,r="",o=0;o>16&255):64===s?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return r}:atob;var Dn=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(u((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n="chooseAndUploadFile:ok",s="chooseAndUploadFile:fail";function r(e,t){return e.tempFiles.forEach(((e,n)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+n+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function o(e,t,{onChooseFile:s,onUploadProgress:r}){return t.then((e=>{if(s){const t=s(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:n,tempFilePaths:[],tempFiles:[]}:function(e,t,s=5,r){(t=Object.assign({},t)).errMsg=n;const o=t.tempFiles,i=o.length;let a=0;return new Promise((n=>{for(;a=i)return void(!o.find((e=>!e.url&&!e.errMsg))&&n(t));const u=o[s];e.uploadFile({provider:u.provider,filePath:u.path,cloudPath:u.cloudPath,fileType:u.fileType,cloudPathAsRealPath:u.cloudPathAsRealPath,onUploadProgress(e){e.index=s,e.tempFile=u,e.tempFilePath=u.path,r&&r(e)}}).then((e=>{u.url=e.fileID,s{u.errMsg=e.errMsg||e.message,s{uni.chooseImage({count:t,sizeType:n,sourceType:o,extension:i,success(t){e(r(t,"image"))},fail(e){a({errMsg:e.errMsg.replace("chooseImage:fail",s)})}})}))}(t),t):"video"===t.type?o(e,function(e){const{camera:t,compressed:n,maxDuration:o,sourceType:i=["album","camera"],extension:a}=e;return new Promise(((e,c)=>{uni.chooseVideo({camera:t,compressed:n,maxDuration:o,sourceType:i,extension:a,success(t){const{tempFilePath:n,duration:s,size:o,height:i,width:a}=t;e(r({errMsg:"chooseVideo:ok",tempFilePaths:[n],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:n,size:o,type:t.tempFile&&t.tempFile.type||"",width:a,height:i,duration:s,fileType:"video",cloudPath:""}]},"video"))},fail(e){c({errMsg:e.errMsg.replace("chooseVideo:fail",s)})}})}))}(t),t):o(e,function(e){const{count:t,extension:n}=e;return new Promise(((e,o)=>{let i=uni.chooseFile;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(i=wx.chooseMessageFile),"function"!=typeof i)return o({errMsg:s+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});i({type:"all",count:t,extension:n,success(t){e(r(t))},fail(e){o({errMsg:e.errMsg.replace("chooseFile:fail",s)})}})}))}(t),t)}}})));function Mn(e){return{props:{localdata:{type:Array,default:()=>[]},options:{type:[Object,Array],default:()=>({})},spaceInfo:{type:Object,default:()=>({})},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:()=>({mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{},mixinDatacomError:null}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((t=>{e.push(this[t])})),e}),((e,t)=>{if("manual"===this.loadtime)return;let n=!1;const s=[];for(let r=2;r{this.mixinDatacomLoading=!1;const{data:s,count:r}=n.result;this.getcount&&(this.mixinDatacomPage.count=r),this.mixinDatacomHasMore=s.length{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,this.mixinDatacomError=e,n&&n(e)})))},mixinDatacomGet(t={}){let n;t=t||{},n="undefined"!=typeof __uniX&&__uniX?e.databaseForJQL(this.spaceInfo):e.database(this.spaceInfo);const s=t.action||this.action;s&&(n=n.action(s));const r=t.collection||this.collection;n=Array.isArray(r)?n.collection(...r):n.collection(r);const o=t.where||this.where;o&&Object.keys(o).length&&(n=n.where(o));const i=t.field||this.field;i&&(n=n.field(i));const a=t.foreignKey||this.foreignKey;a&&(n=n.foreignKey(a));const c=t.groupby||this.groupby;c&&(n=n.groupBy(c));const u=t.groupField||this.groupField;u&&(n=n.groupField(u)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(n=n.distinct());const l=t.orderby||this.orderby;l&&(n=n.orderBy(l));const h=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,d=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,f=void 0!==t.getcount?t.getcount:this.getcount,p=void 0!==t.gettree?t.gettree:this.gettree,g=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,m={getCount:f},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return p&&(m.getTree=y),g&&(m.getTreePath=y),n=n.skip(d*(h-1)).limit(d).get(m),n}}}}function Fn(e){return L("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function qn({openid:e,callLoginByWeixin:t=!1}={}){throw Fn(this),new Error(`[SecureNetwork] API \`initSecureNetworkByWeixin\` is not supported on platform \`${b}\``)}async function jn(e){const t=Fn(this);return t.initPromise||(t.initPromise=qn.call(this,e).then((e=>e)).catch((e=>{throw delete t.initPromise,e}))),t.initPromise}function $n(e){const t={getSystemInfo:uni.getSystemInfo,getPushClientId:uni.getPushClientId};return function(n){return new Promise(((s,r)=>{t[e]({...n,success(e){s(e)},fail(e){r(e)}})}))}}class Bn extends class{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const n=this._callback[e];if(!n)return;const s=function(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t)return n;return-1}(n,t);n.splice(s,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const n=this._callback[e];if(n)for(let s=0;s{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()}),(e=>{throw this.emit("error",e),this.close(),e}))}async open(){return this.init()}_isUniCloudSSE(e){if("receive"!==e.type)return!1;const t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:n,messageId:s,message:r}=t;this._payloadQueue.push({action:n,messageId:s,message:r}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find((e=>e.messageId===this._currentMessageId+1));if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:n,message:s}=e;"end"===t?this._end({messageId:n,message:s}):"message"===t&&this._appendMessage({messageId:n,message:s})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){uni.onPushMessage(this._uniPushMessageCallback)}_destroy(){uni.offPushMessage(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const Kn={tcb:St,tencent:St,aliyun:pe,private:Tt,alipay:Et};let Hn=new class{init(e){let t={};const n=Kn[e.provider];if(!n)throw new Error("未提供正确的provider参数");var s;return t=n.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new k({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const n=e.auth();return t.then((()=>n.getLoginState())).then((e=>e?Promise.resolve():n.signInAnonymously()))}}))}(t),zt(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(s=t).database=function(e){if(e&&Object.keys(e).length>0)return s.init(e).database();if(this._database)return this._database;const t=on(an,{uniClient:s});return this._database=t,t},s.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return s.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=on(an,{uniClient:s,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=Nn,e.chooseAndUploadFile=Dn.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return Mn(e)}}),e.SSEChannel=Bn,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:n=!1}={}){return jn.call(e,{openid:t,callLoginByWeixin:n})}}(e),e.importObject=function(t){return function(n,s={}){s=function(e,t={}){return e.customUI=t.customUI||e.customUI,e.parseSystemError=t.parseSystemError||e.parseSystemError,Object.assign(e.loadingOptions,t.loadingOptions),Object.assign(e.errorOptions,t.errorOptions),"object"==typeof t.secretMethods&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},s);const{customUI:r,loadingOptions:o,errorOptions:i,parseSystemError:a}=s,c=!r;return new Proxy({},{get(r,u){switch(u){case"toString":return"[object UniCloudObject]";case"toJSON":return{}}return function({fn:e,interceptorName:t,getCallbackArgs:n}={}){return async function(...s){const r=n?n({params:s}):{};let o,i;try{return await D(M(t,"invoke"),{...r}),o=await e(...s),await D(M(t,"success"),{...r,result:o}),o}catch(a){throw i=a,await D(M(t,"fail"),{...r,error:i}),i}finally{await D(M(t,"complete"),i?{...r,error:i}:{...r,result:o})}}}({fn:async function r(...l){let h;c&&uni.showLoading({title:o.title,mask:o.mask});const d={name:n,type:"OBJECT",data:{method:u,params:l}};"object"==typeof s.secretMethods&&function(e,t){const n=t.data.method,s=e.secretMethods||{},r=s[n]||s["*"];r&&(t.secretType=r)}(s,d);let f=!1;try{h=await t.callFunction(d)}catch(e){f=!0,h={result:new ee(e)}}const{errSubject:p,errCode:g,errMsg:m,newToken:y}=h.result||{};if(c&&uni.hideLoading(),y&&y.token&&y.tokenExpired&&(re(y),Q(B,{...y})),g){let e=m;if(f&&a&&(e=(await a({objectName:n,methodName:u,params:l,errSubject:p,errCode:g,errMsg:m})).errMsg||m),c)if("toast"===i.type)uni.showToast({title:e,icon:"none"});else{if("modal"!==i.type)throw new Error(`Invalid errorOptions.type: ${i.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:n,cancelText:s,confirmText:r}={}){return new Promise(((o,i)=>{uni.showModal({title:e,content:t,showCancel:n,cancelText:s,confirmText:r,success(e){o(e)},fail(){o({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:i.retry,cancelText:"取消",confirmText:i.retry?"重试":"确定"});if(i.retry&&t)return r(...l)}}const t=new ee({subject:p,code:g,message:m,requestId:h.requestId});throw t.detail=h.result,Q(j,{type:J,content:t}),t}return Q(j,{type:J,content:h.result}),h.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:n,methodName:u,params:e}}})}})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const n=t[e];t[e]=function(){return n.apply(t,Array.from(arguments))},t[e]=function(e,t){return function(n){let s=!1;if("callFunction"===t){const e=n&&n.type||g;s=e!==g}const r="callFunction"===t&&!s,o=this._initPromiseHub.exec();n=n||{};const{success:i,fail:a,complete:c}=Z(n),u=o.then((()=>s?Promise.resolve():D(M(t,"invoke"),n))).then((()=>e.call(this,n))).then((e=>s?Promise.resolve(e):D(M(t,"success"),e).then((()=>D(M(t,"complete"),e))).then((()=>(r&&Q(j,{type:H,content:e}),Promise.resolve(e))))),(e=>s?Promise.reject(e):D(M(t,"fail"),e).then((()=>D(M(t,"complete"),e))).then((()=>(Q(j,{type:H,content:e}),Promise.reject(e))))));if(!(i||a||c))return u;u.then((e=>{i&&i(e),c&&c(e),r&&Q(j,{type:H,content:e})}),(e=>{a&&a(e),c&&c(e),r&&Q(j,{type:H,content:e})}))}}(t[e],e).bind(t)})),t.init=this.init,t}};(()=>{const e=x;let t={};if(e&&1===e.length)t=e[0],Hn=Hn.init(t),Hn._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let n;n=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{Hn[e]=function(){return console.error(n),Promise.reject(new ee({code:"SYS_ERR",message:n}))}}))}Object.assign(Hn,{get mixinDatacom(){return Mn(Hn)}}),Ln(Hn),Hn.addInterceptor=R,Hn.removeInterceptor=N,Hn.interceptObject=F})();const{app:Jn,Vuex:Wn,Pinia:Vn}={app:e.createVueApp(a)};uni.Vuex=Wn,uni.Pinia=Vn,Jn.provide("__globalStyles",__uniConfig.styles),Jn._component.mpType="app",Jn._component.render=()=>{},Jn.mount("#app")}(Vue); diff --git a/unpackage/dist/build/app-plus/manifest.json b/unpackage/dist/build/app-plus/manifest.json index 1417561..46c09d3 100644 --- a/unpackage/dist/build/app-plus/manifest.json +++ b/unpackage/dist/build/app-plus/manifest.json @@ -5,10 +5,10 @@ "iPad" ], "id": "__UNI__4796942", - "name": "OA系统", + "name": "墨册", "version": { - "name": "2.0.1", - "code": 201 + "name": "1.0.0", + "code": 100 }, "description": "", "developer": { @@ -79,13 +79,13 @@ }, "splashscreen": { "useOriginalMsgbox": true, - "androidStyle": "default", + "androidStyle": "common", "android": { "hdpi": "static/image/sy.png", "xhdpi": "static/image/sy.png", "xxhdpi": "static/image/sy.png" }, - "iosStyle": "storyboard", + "iosStyle": "common", "ios": { "storyboard": "files/CustomStoryboard.zip" } @@ -124,7 +124,8 @@ "NSPhotoLibraryUsageDescription": "我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。", "NSPhotoLibraryAddUsageDescription": "我们需要获取写入权限,以便我们能够将您通过应用程序拍摄的照片或视频保存到您的设备相册中。", "NSCameraUsageDescription": "我们的应用使用摄像头来拍照,以便在进行外勤打卡时确认您的身份和打卡环境,确保打卡数据的真实性和准确性。" - } + }, + "idfa": false }, "plugins": { "geolocation": {