wecom.global.prod.js 52 KB

1
  1. var ww=function(e){"use strict";const t="undefined"!=typeof window?window:void 0,n="undefined"!=typeof document?document:void 0,r="undefined"!=typeof navigator?navigator:void 0,i="undefined"!=typeof location?location:void 0;function o(){return i?.href||""}function a(){return n?.title||""}const s=r?.userAgent||"",c=r?.platform||"",u=s?.match(/wxwork\/([\d.]+)/i)?.[1],l=!!u,d=!l&&/micromessenger/i.test(s),f=/\bAndroid\b/i.test(s),p=/Win/i.test(c),{isIOS:h,isMac:g}=function(){const e=r?.maxTouchPoints??1,t=/Mac/i.test(c);if(t&&e>2)return{isMac:!1,isIOS:!0};return{isMac:t,isIOS:/\b(iPhone|iPad|iPod)\b/i.test(s)}}();let m,y,w;function v(){return m}function C(){return y?.getResult()?.params}function S(){return w?.getResult()?.params}function k(){const e=v();if(l&&e?.getAgentConfigSignature){const e=S();return e?.corpid}const t=C();return t?.appId}function b(){const e=function(){const e=v();return l&&e?.getAgentConfigSignature?S():C()}();if(!e)return;const t=k();return{appId:t,verifyAppId:t,verifySignType:"sha1",verifyTimestamp:e.timestamp,verifyNonceStr:e.nonceStr,verifySignature:e.signature}}const T={config:"preVerifyJsApi",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareWechat:"menu:share:wechat",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress",getBrandWCPayRequest:"getBrandWCPayRequest"},I={};for(const Hn of Object.keys(T))I[T[Hn]]=Hn;function x(e){return T[e]||e}function A(e){return I[e]||e}function W(e){return e.map(x)}const M=o();function _(e){if("undefined"!=typeof Buffer)return Buffer.from(e).toString("base64");let t="";const n=new Uint8Array(e),r=n.byteLength;for(let i=0;i<r;i++)t+=String.fromCharCode(n[i]);return btoa(t)}function L(e){if("undefined"!=typeof Buffer)return Buffer.from(e,"base64").buffer;const t=atob(e),n=t.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=t.charCodeAt(i);return r.buffer}function P(e,t,n){if(R(e))try{return e.call(n,t)}catch(r){!function(...e){console.error("[wwsdk]",...e)}(r)}}function B(e,t){return e.slice(0,t.length)===t}function E(e){return e?M.split("#")[0]:o().split("#")[0]}function D(e){return V(e)?e.slice(e.indexOf(":")+1):""}function O(e){return!1===e||0===e}function R(e){return"function"==typeof e}function V(e){return"string"==typeof e}function N(e){return e?V(e)?e:e.join(";"):e}async function F(n,r){e.isWeixinJSBridgeReady||await e.onWeixinJSBridgeReady,t.WeixinJSBridge.on(n,r)}async function j(n,r={},i){e.isWeixinJSBridgeReady||await e.onWeixinJSBridgeReady;const o=await new Promise((e=>{const i={...r,...b()};t.WeixinJSBridge.invoke(n,i,e)}));o.errMsg||(o.errMsg=function(e,t){const n=A(e);if(!t)return`${n}:ok`;let r=D(t);"confirm"===r&&(r="ok");"failed"===r&&(r="fail");B(r,"failed_")&&(r=r.slice(7));B(r,"fail_")&&(r=r.slice(5));r=r.replace(/_/g,"").toLowerCase(),("access denied"===r||"no permission to execute"===r)&&(r="permission denied");"config"===n&&"function not exist"===r&&(r="ok");r||(r="fail");return`${n}:${r}`}(n,o.err_msg||o.errmsg));const a=D(o.errMsg);if(null==o.errCode&&(o.errCode=null!=o.err_code?o.err_code:"ok"===a?0:-1),P(i,o),"ok"!==a&&"yes"!==a)throw o;return o}e.isWeixinJSBridgeReady=!!t?.WeixinJSBridge,e.onWeixinJSBridgeReady=Promise.resolve(),e.isWeixinJSBridgeReady||(e.onWeixinJSBridgeReady=new Promise((t=>{n?.addEventListener("WeixinJSBridgeReady",(()=>{e.isWeixinJSBridgeReady=!0,t()}))})));class U extends Error{constructor(e){super(`SDK Error: ${e}`)}}class z extends U{constructor(){super("Aborted")}}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $=1,J=2;class G{checkValid(){return l&&this.url!==E(this.useOriginalURL)&&(this.error=new z),!this.error}getResult(){if(this.checkValid())return this.result}async awaitPromise(e){try{return this.result=await e,this.result}catch(t){throw this.error=t,t}}constructor(e,t){q(this,"type",void 0),q(this,"url",void 0),q(this,"promise",void 0),q(this,"result",void 0),q(this,"error",void 0),q(this,"useOriginalURL",void 0),this.type=e,this.useOriginalURL=d&&!p&&!g&&e===$,this.url=E(this.useOriginalURL),this.promise=this.awaitPromise(t(this.url))}}async function Q(){const e=y;if(e?.checkValid())return e.promise;const t=new G($,(async e=>{const n=v();if(!n?.getConfigSignature)throw new U("Missing getConfigSignature");const r=await n.getConfigSignature(e);if(!t.checkValid())throw new z;const i=function(e,t){return{appId:e.corpId,timestamp:`${t.timestamp}`,nonceStr:t.nonceStr,signature:t.signature,jsApiList:W(e.jsApiList||["config"]),openTagList:W(e.openTagList||[])}}(n,r),o=await j("preVerifyJSAPI",{appId:i.appId,verifyJsApiList:i.jsApiList,verifyOpenTagList:i.openTagList,verifyAppId:i.appId,verifySignType:"sha1",verifyTimestamp:i.timestamp,verifyNonceStr:i.nonceStr,verifySignature:i.signature});if(!t.checkValid())throw new z;return{params:i,result:o}}));return t.promise.then((e=>{const t=v();P(t?.onConfigSuccess,e.result),P(t?.onConfigComplete,e.result)}),(e=>{const t=v();P(t?.onConfigFail,e),P(t?.onConfigComplete,e)})),function(e){y=e}(t),t.promise}async function H(){const e=w;if(e?.checkValid())return e.promise;const t=new G(J,(async e=>{let n;l&&function(e,t){const n=e?.split(".")||[],r=t?.split(".")||[];for(let i=0,o=Math.max(n.length,r.length);i<o;i++){const e=parseInt(n[i])||0,t=parseInt(r[i])||0;if(e>t)return 1;if(e<t)return-1}return 0}(u,"3.0.24")<0&&(n=Q());const[r]=await Promise.all([K(e),n]);if(!t.checkValid())throw new z;const i=await j("agentConfig",r);if(!t.checkValid())throw new z;return{params:r,result:i}}));return t.promise.then((e=>Z(e.result)),(e=>X(e))),function(e){w=e}(t),t.promise}async function K(e){const t=v();if(!t?.getAgentConfigSignature)throw new U("Missing getAgentConfigSignature");const n=await t.getAgentConfigSignature(e);return{corpid:t.corpId,agentid:`${t.agentId}`,timestamp:`${n.timestamp}`,nonceStr:n.nonceStr,signature:n.signature,jsApiList:W(t.jsApiList||["agentConfig"])}}function Z(e){const t=v();P(t?.onAgentConfigSuccess,e),P(t?.onAgentConfigComplete,e)}function X(e){const t=v();P(t?.onAgentConfigFail,e),P(t?.onAgentConfigComplete,e)}function Y(){const e=v();if(e)return l&&e.getAgentConfigSignature?H():e.getConfigSignature?Q():void 0}async function ee(e,t,n=t){return ne(t,(async()=>(await Y(),j(e,n))))}async function te(e,t,n){await Y(),F(e,(()=>{ne(t,n)}))}function ne(e,t){return t(e).then((t=>(P(e?.success,t),P(e?.complete,t),t)),(t=>{throw P("cancel"===D(t.errMsg)?e?.cancel:e?.fail,t),P(e?.complete,t),t}))}var re,ie,oe,ae,se,ce,ue,le,de,fe,pe,he,ge,me,ye,we,ve,Ce,Se,ke,be,Te,Ie,xe,Ae,We,Me;function _e(e){if("string"==typeof e.advertisData&&(e.advertisData=L(e.advertisData)),e.serviceDataV2){const t=e.serviceDataV2;for(const e of Object.keys(t))"string"==typeof t[e]&&(t[e]=L(t[e]));e.serviceData=t,delete e.serviceDataV2}}function Le(e){return{timeStamp:`${e.timestamp}`,nonceStr:e.nonceStr,package:e.package,paySign:e.paySign,signType:e.signType||"SHA1"}}function Pe(e){const t={};for(const r of Object.keys(e)){if(!(n=e[r])||"object"!=typeof n){t[r]=e[r];continue}const i=Pe(e[r]);for(const e of Object.keys(i))t[`${r}.${e}`]=i[e]}var n;return t}function Be(e){if(!e||!V(e))return;const[t,...n]=e.split("?");return n.length?`${t}.html?${n.join("?")}`:`${t}.html`}function Ee(e={}){return ne(e,(async()=>{if(!l)return async function(){if(!t?.WWOpenData?.agentConfig)throw new U("Missing WWOpenData.agentConfig");const e=await K(E()),n=new Promise(((n,r)=>{t.WWOpenData.agentConfig({...e,success:n,fail:r})}));return n.then(Z,X),n}();const{result:e}=await H();if(!p&&!t?.WeixinSandBox)throw new U("Missing WeixinSandBox");if(t?.WWOpenData||await j("wwapp.initWwOpenData"),!t?.WWOpenData)throw new U("Init WWOpenData failed");return t.WWOpenData.initJSSDK&&t.WWOpenData.initJSSDK({invoke:j,ensureAgentConfigReady:H}),e}))}function De(e){const t=document.createElement("iframe"),{style:n}=t;n.display="block",n.border="none",n.background="transparent",t.referrerPolicy="origin",t.setAttribute("frameborder","0"),t.setAttribute("allowtransparency","true");const r=function(e){if("string"==typeof e)return document.querySelector(e);return e}(e);return r&&r.appendChild(t),t}e.Proximity=void 0,(re=e.Proximity||(e.Proximity={})).CLProximityUnknown="0",re.CLProximityImmediate="1",re.CLProximityNear="2",re.CLProximityFar="3",e.LocationType=void 0,(ie=e.LocationType||(e.LocationType={})).wgs84="wgs84",ie.gcj02="gcj02",e.NetworkType=void 0,(oe=e.NetworkType||(e.NetworkType={})).wifi="wifi",oe.network2g="2g",oe.network3g="3g",oe.network4g="4g",oe.none="none",oe.unknown="unknown",e.ChooseMessageFileType=void 0,(ae=e.ChooseMessageFileType||(e.ChooseMessageFileType={})).video="video",ae.image="image",ae.file="file",ae.video_and_image="video_and_image",e.TempFileType=void 0,(se=e.TempFileType||(e.TempFileType={})).video="video",se.image="image",se.file="file",e.SizeType=void 0,(ce=e.SizeType||(e.SizeType={})).original="original",ce.compressed="compressed",e.SourceType=void 0,(ue=e.SourceType||(e.SourceType={})).album="album",ue.camera="camera",e.CameraMode=void 0,(le=e.CameraMode||(e.CameraMode={})).normal="normal",le.batch="batch",le.front="front",le.batch_front="batch_front",e.LiveType=void 0,(de=e.LiveType||(e.LiveType={}))[de.common=0]="common",de[de.corp_training=1]="corp_training",de[de.edu_normal_class=2]="edu_normal_class",de[de.edu_small_class=3]="edu_small_class",e.WedocSelectedFileType=void 0,(fe=e.WedocSelectedFileType||(e.WedocSelectedFileType={}))[fe.other=0]="other",fe[fe.doc=3]="doc",fe[fe.sheet=4]="sheet",fe[fe.form=5]="form",fe[fe.slide=6]="slide",fe[fe.mindmap=7]="mindmap",fe[fe.flowchart=8]="flowchart",fe[fe.smartsheet=10]="smartsheet",e.ProductViewType=void 0,(pe=e.ProductViewType||(e.ProductViewType={}))[pe.normal=0]="normal",pe[pe.scan=1]="scan",e.CreateExternalPaymentType=void 0,(he=e.CreateExternalPaymentType||(e.CreateExternalPaymentType={}))[he.chat=0]="chat",he[he.qrcode=1]="qrcode",e.EntryType=void 0,(ge=e.EntryType||(e.EntryType={})).contact_profile="contact_profile",ge.single_chat_tools="single_chat_tools",ge.group_chat_tools="group_chat_tools",ge.chat_attachment="chat_attachment",ge.single_kf_tools="single_kf_tools",ge.chain_single_chat_tools="chain_single_chat_tools",ge.chain_group_chat_tools="chain_group_chat_tools",ge.internal_group_chat_board="internal_group_chat_board",ge.normal="normal",e.OpenAppManagePageType=void 0,(me=e.OpenAppManagePageType||(e.OpenAppManagePageType={})).permission="permission",me.datazone_permission="datazone_permission",e.EnvVersion=void 0,(ye=e.EnvVersion||(e.EnvVersion={})).release="release",ye.trial="trial",ye.develop="develop",e.OpenUserProfileType=void 0,(we=e.OpenUserProfileType||(e.OpenUserProfileType={}))[we.internal=1]="internal",we[we.external=2]="external",e.PrintFileIdType=void 0,(ve=e.PrintFileIdType||(e.PrintFileIdType={}))[ve.mediaid=1]="mediaid",ve[ve.url=2]="url",ve[ve.localId=4]="localId",e.InTalkType=void 0,(Ce=e.InTalkType||(e.InTalkType={})).None="None",Ce.HWOpenTalk="HWOpenTalk",Ce.VoIP="VoIP",Ce.SystemCall="SystemCall",e.ScanQRCodeType=void 0,(Se=e.ScanQRCodeType||(e.ScanQRCodeType={})).qrCode="qrCode",Se.barCode="barCode",e.InputCorpGroupContactMode=void 0,(ke=e.InputCorpGroupContactMode||(e.InputCorpGroupContactMode={})).single="single",ke.multi="multi",e.InputCorpGroupContactType=void 0,(be=e.InputCorpGroupContactType||(e.InputCorpGroupContactType={})).department="department",be.user="user",e.SelectEnterpriseContactMode=void 0,(Te=e.SelectEnterpriseContactMode||(e.SelectEnterpriseContactMode={})).single="single",Te.multi="multi",e.SelectEnterpriseContactType=void 0,(Ie=e.SelectEnterpriseContactType||(e.SelectEnterpriseContactType={})).department="department",Ie.user="user",e.SelectExternalContactType=void 0,(xe=e.SelectExternalContactType||(e.SelectExternalContactType={}))[xe.all=0]="all",xe[xe.unselected=1]="unselected",e.SelectPrivilegedContactMode=void 0,(Ae=e.SelectPrivilegedContactMode||(e.SelectPrivilegedContactMode={})).single="single",Ae.multi="multi",e.OAType=void 0,(We=e.OAType||(e.OAType={})).create_approval="10001",We.view_approval="10002",e.OaExtDataType=void 0,(Me=e.OaExtDataType||(e.OaExtDataType={})).link="link",Me.text="text";const Oe=Fe();let Re,Ve=0;function Ne(){return`${Oe}-${Ve++}`}function Fe(){return Math.random().toString(36).slice(2)}function je(e){return e&&"object"==typeof e?{...e,message:e.message,stack:e.stack}:e}function Ue(e){try{return"string"==typeof e?JSON.parse(e):e}catch(t){}}function ze(e,t,n){const r=[];let i=!1,o=!1;function a(n){if(n.origin!==t||e.contentWindow!==n.source)return;const r=Ue(n.data);"string"==typeof r?.type&&r.type.startsWith("ww-iframe-handle:")&&d(r,n)}window.addEventListener("message",a);const s=new MessageChannel;s.port1.onmessage=e=>{d(Ue(e.data),e)};const{invoke:c,handleCallMessage:u,handleResponseMessage:l}=function(e,t){const n=new Map;return{invoke:function(t,r){return r?.dropResult?(e({type:"ww-iframe-handle:call",args:t},r),Promise.resolve(void 0)):new Promise(((i,o)=>{const a=Ne();n.set(a,{resolve:i,reject:o}),e({type:"ww-iframe-handle:call",uid:a,args:t},r)}))},handleCallMessage:async function(n,r){if(!n.uid)return t(n.args,r);try{e({type:"ww-iframe-handle:response",uid:n.uid,kind:"resolve",args:await t(n.args,r)})}catch(i){throw e({type:"ww-iframe-handle:response",uid:n.uid,kind:"reject",args:je(i)}),i}},handleResponseMessage:function(e){const t=n.get(e.uid);t&&(t[e.kind](e.args),n.delete(e.uid))}}}((function(e,t){i?f(e,t):r.push({msg:e,opts:t})}),n);function d(e,t){switch(e.type){case"ww-iframe-handle:ready":return function(e){if(i)return;i=!0,e.supportChannel&&(f({type:"ww-iframe-handle:set-port",port:s.port2},{transfer:[s.port2],serialize:!1}),o=!0);for(const t of r)f(t.msg,t.opts)}(e);case"ww-iframe-handle:call":return u(e,t);case"ww-iframe-handle:response":return void l(e)}}function f(n,r){const i=!1===r?.serialize?n:JSON.stringify(n);o?s.port1.postMessage(i,r?.transfer):e.contentWindow?.postMessage(i,t,r?.transfer)}return e.addEventListener("load",(()=>{i||f({type:"ww-iframe-handle:init"})})),{el:e,invoke:c,dispose:function(){window.removeEventListener("message",a),s.port1.onmessage=null}}}function qe(e,t,n){P(t[e.name],e.payload||e.data,n)}function $e(){const e=new Map;return{subscribe:function(t,n){e.set(t,n)},handleMessage:function(t){return e.get(t.type)?.(t)}}}function Je(e,t){Re?.();const n=De(document.body),{style:r}=n;r.position="fixed",r.left="0",r.top="0",r.zIndex="1000",r.width="100vw",r.height="100vh",n.classList.add("wecom-jssdk-modal"),n.setAttribute("src",e);const{origin:i}=new URL(e),o=ze(n,i,(e=>("close"===e.type&&a(),t?.(e))));function a(){o.dispose(),n.parentNode?.removeChild(n)}return Re=a,o}const Ge={agentConfig:K,suiteConfig:async function(e){const t=v();if(!t?.getSuiteConfigSignature)throw new U("Missing getSuiteConfigSignature");const n=await t.getSuiteConfigSignature(e);return{suiteid:t.suiteId,timestamp:`${n.timestamp}`,nonceStr:n.nonceStr,signature:n.signature,jsApiList:W(t.jsApiList||["agentConfig"])}}};async function Qe(e,t){let n=new Error("Missing signature handler");for(const i of t)try{if(!Object.prototype.hasOwnProperty.call(Ge,i))continue;return{type:i,params:await Ge[i](e)}}catch(r){n=r}throw n}function He(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ke(e,t){return!!e&&e.indexOf(t)>=0}var Ze=Ye("Identifier","name"),Xe=Ye("Literal","value");function Ye(e,t){return function(n){var r;return(r={type:e})[t]=n,r}}function et(e){return nt(e,65,90)||nt(e,97,122)||36===e||95===e}function tt(e){return nt(e,48,57)}function nt(e,t,n){return e>=t&&e<=n}for(var rt={null:null,true:!0,false:!1,NaN:NaN,Infinity:1/0},it="await break case catch class const continue debugger default delete do else enum export extends false finally for function if import in instanceof new null return super switch this throw true try typeof var void while with yield".split(" "),ot={},at=0,st=it;at<st.length;at++){ot[st[at]]=!0}function ct(e){et(e.peek())||e.unexpected();var t,n=e.index;do{e.next()}while(et(t=e.peek())||tt(t));return e.expr.slice(n,e.index)}var ut={n:"\n",r:"\r",t:"\t"};function lt(e){var t=e.peek();return tt(t)||46===t?function(e){for(var t,n="";tt(e.peek());)n+=e.nextCh();if("0"===n){if(e.eat(120)||e.eat(88)){for(n="";tt(t=e.peek())||nt(t,65,70)||nt(t,97,102);)n+=e.nextCh();return n||e.unexpected(),e.build(Xe(parseInt(n,16)))}if(e.eat(98)||e.eat(66)){for(n="";48===e.peek()||49===e.peek();)n+=e.nextCh();return n||e.unexpected(),e.build(Xe(parseInt(n,2)))}}if(46===e.peek())for(n+=e.nextCh();tt(e.peek());)n+=e.nextCh();if(101===e.peek()||69===e.peek()){n+=e.nextCh(),43!==e.peek()&&45!==e.peek()||(n+=e.nextCh());for(var r=!1;tt(e.peek());)r=!0,n+=e.nextCh();r||e.unexpected()}return et(e.peek())&&e.throw("Variable name cannot start with a number (".concat(n).concat(e.peekCh(),").")),46!==e.peek()&&"."!==n||e.unexpected(),e.build(Xe(parseFloat(n)))}(e):39===t||34===t?function(e){for(var t,n=e.nextCh(),r="";t=e.nextCh();){if(t===n)return e.build(Xe(r));"\\"===t?(t=e.nextCh(),He(ut,t)?r+=ut[t]:r+=t):r+=t}e.unexpected()}(e):et(t)?function(e){var t=ct(e);return He(rt,t)?e.build(Xe(rt[t])):(He(ot,t)&&e.unexpected(t),e.build(Ze(t)))}(e):void e.unexpected()}function dt(e,t,n){var r;return void 0===n&&(n=!1),n?(e.expect(91),r=ft(e),e.expect(93)):r=function(e){var t=ct(e);return e.build(Ze(t))}(e),e.build({type:"MemberExpression",object:t,property:r,computed:n})}function ft(e){return function(e){for(var t,n=lt(e);t=e.peek();)if(91!==t){if(!e.eat(46))break;n=dt(e,n)}else n=dt(e,n,!0);return n}(e)}function pt(e){var t,n={expr:t=e.trim(),index:0,peek:function(){return this.expr.charCodeAt(this.index)},peekCh:function(){return this.expr.charAt(this.index)},next:function(){this.index+=1},nextCh:function(){return this.index+=1,this.expr.charAt(this.index-1)},eat:function(e){return this.peek()===e&&(this.next(),this.skipWhitespace(),!0)},expect:function(e){this.eat(e)||this.unexpected()},skip:function(e){this.index+=e,this.skipWhitespace()},skipWhitespace:function(){for(var e=t.charCodeAt(this.index);32===e||9===e||13===e||10===e;)this.index+=1,e=t.charCodeAt(this.index);return this.index},build:function(e){return this.skipWhitespace(),e},unexpected:function(e){if(!e&&this.index>=t.length)throw this.throw("Unexpected end of input.");throw this.throw("Unexpected token '".concat(e||this.peekCh(),"'."))},throw:function(e){throw new SyntaxError("".concat(e," (1:").concat(this.index,")"))}},r=ft(n);return n.index!==n.expr.length&&n.unexpected(),r}var ht=["constrcutor","prototype","__proto__"];function gt(e,t,n){if(void 0===t&&(t=[]),void 0===n&&(n=[]),"Identifier"===e.type)return n.unshift(e.name),n;if("MemberExpression"===e.type){var r=e.object,i=e.property;if(e.computed){if("Literal"!==i.type)return;var o=i.value;if(Ke(t,o))return;n.unshift(o)}else{if("Identifier"!==i.type)return;var a=i.name;if(Ke(t,a))return;n.unshift(a)}return gt(r,t,n)}}function mt(e,t,n,r){for(var i,o=e,a=0,s=t.length-1;a<s;a++){var c=t[a];He(o,c)&&("object"==typeof(i=o[c])&&null!==i)||r(o,c,"string"==typeof t[a+1]?{}:[]),o=o[c]}return r(o,t[t.length-1],n),o}function yt(e,t,n){e[t]=n}function wt(e){if(Array.isArray(e))return e.map(wt);if(null==e||"object"!=typeof e)return e;const t={};for(const n of Object.keys(e))t[n]=wt(e[n]);return t}const vt=new WeakMap;function Ct(e){return Object.keys(e).filter((t=>"function"==typeof e[t]))}function St(e){return Object.entries(e).reduce(((e,[t,n])=>("function"!=typeof n&&(e[t]=n),e)),{})}const kt="https://open.work.weixin.qq.com",bt=`${kt}/wwopen/ww-open-data-frame`,Tt=["constructor","prototype","__proto__","__ob__"];const It="2.3.1";var xt,At,Wt,Mt;e.WWLoginType=void 0,(xt=e.WWLoginType||(e.WWLoginType={})).serviceApp="ServiceApp",xt.corpApp="CorpApp",e.WWLoginLangType=void 0,(At=e.WWLoginLangType||(e.WWLoginLangType={})).zh="zh",At.en="en",e.WWLoginRedirectType=void 0,(Wt=e.WWLoginRedirectType||(e.WWLoginRedirectType={})).top="top",Wt.callback="callback",Wt.self="self",e.WWLoginPanelSizeType=void 0,(Mt=e.WWLoginPanelSizeType||(e.WWLoginPanelSizeType={})).middle="middle",Mt.small="small";const _t={[e.WWLoginPanelSizeType.middle]:["480px","416px"],[e.WWLoginPanelSizeType.small]:["320px","380px"]};function Lt(e){const t=new WeakMap;return(n,...r)=>(t.has(n)||t.set(n,e(n,...r)),t.get(n))}function Pt(e){return Lt((t=>{const n=function(e){return vt.get(e)}(t);if(!n)throw new TypeError("Illegal invocation");return e(n)}))}const Bt=Pt((({frame:e,invoke:t,subscribe:n})=>{const r=new Map,i=new Map;return n("ref.event",(e=>{const t=i.get(e.refId);if(t)for(const n of t)n(e.data)})),n("refDispose",(e=>{r.delete(e.refId),i.delete(e.refId)})),{get:async function(n){const o=await t({type:"ref.get",name:n});if(!o)return;const a=r.get(o.refId)?.deref();if(a)return a;const s=function(n){i.has(n)||i.set(n,[]);const r=i.get(n);function o(e,r,i){return t({type:"ref.call",refId:n,name:e,data:r},i)}function a(e){return r.push(e),()=>{const t=r.indexOf(e);t>=0&&r.splice(t,1)}}return{frame:e,invoke:o,subscribe:a}}(o.refId);var c;return r.set(o.refId,(c=s,"undefined"!=typeof WeakRef?new WeakRef(c):{deref:()=>c})),s}}}));function Et(e){return"function"==typeof Symbol?Symbol(e):e}class Dt{concat(){if(1===this.list.length)return Ot(this.current);const e=new Uint8Array(this.list.reduce(((e,t)=>e+t.offset),0));return this.list.reduce(((t,n)=>(e.set(new Uint8Array(Ot(n)),t),t+n.offset)),0),e.buffer}ensureCapacity(e){const t=this.current,n=t.offset+e;if(n<=t.size)return;const r=t.buffer;!r.resizable||n>r.maxByteLength?(this.current=this.createBufferItem(),this.list.push(this.current)):(t.size=Math.min(2*t.size,r.maxByteLength),r.resize(t.size))}createBufferItem(){const e=new ArrayBuffer(65536,{maxByteLength:1048576});return{view:new DataView(e),buffer:e,size:e.byteLength,offset:0}}constructor(){q(this,"list",void 0),q(this,"current",void 0),this.current=this.createBufferItem(),this.list=[this.current]}}function Ot(e){return e.offset>=e.size?e.buffer:e.buffer.resizable&&e.buffer.transfer?e.buffer.transfer(e.offset):e.buffer.slice(0,e.offset)}var Rt;!function(e){e[e.int32=1]="int32",e[e.float64=2]="float64",e[e.boolean=3]="boolean",e[e.null=4]="null",e[e[void 0]=5]="undefined",e[e.valueRef=6]="valueRef"}(Rt||(Rt={}));const Vt=-Math.pow(2,31),Nt=Math.pow(2,31);function Ft(){return{buffer:new Dt,values:[],stringIndexMap:new Map}}function jt(e,t){e.buffer.ensureCapacity(1);const n=e.buffer.current;n.view.setUint8(n.offset,t),n.offset+=1}function Ut(e,t){e.buffer.ensureCapacity(4);const n=e.buffer.current;n.view.setUint32(n.offset,t),n.offset+=4}function zt(e,t){let n=e.stringIndexMap.get(t);n||(n=e.values.push(t),e.stringIndexMap.set(t,n)),Ut(e,n-1)}function qt(e,t){if(null!==t)switch(typeof t){case"number":if(function(e){if(!Number.isInteger(e))return!1;return Vt<=e&&e<Nt}(t)){jt(e,1),function(e,t){e.buffer.ensureCapacity(4);const n=e.buffer.current;n.view.setInt32(n.offset,t),n.offset+=4}(e,t);break}jt(e,2),function(e,t){e.buffer.ensureCapacity(8);const n=e.buffer.current;n.view.setFloat64(n.offset,t),n.offset+=8}(e,t);break;case"string":jt(e,6),zt(e,t);break;case"boolean":jt(e,3),jt(e,t?1:0);break;case"undefined":jt(e,5);break;default:jt(e,6),function(e,t){Ut(e,e.values.push(t)-1)}(e,t)}else jt(e,4)}var $t,Jt;!function(e){e[e.set=1]="set",e[e.call=2]="call",e[e.dispose=3]="dispose"}($t||($t={})),function(e){e[e.value=1]="value",e[e.ref=2]="ref"}(Jt||(Jt={}));const Gt=Et("__WECOM_REFLECT_ID__"),Qt=Pt((({invoke:e})=>{const t="function"==typeof FinalizationRegistry?new FinalizationRegistry((function(e){jt(a,3),Ut(a,e),c()})):null,n=new WeakSet;let r=1;const i=Promise.resolve();let o=!1,a=Ft();function s(e){n.has(e)?(jt(a,2),Ut(a,e[Gt])):(jt(a,1),qt(a,e))}function c(){o||(o=!0,i.then(u))}function u(){o=!1;const t={buffer:(n=a).buffer.concat(),values:n.values};var n;a=Ft(),e({type:"reflect.command",commands:t},{serialize:!1,dropResult:!0,transfer:[t.buffer]})}function l(){return r++}return{genReflectId:l,bind:function(e,r=l()){return n.has(e)?e[Gt]:(e[Gt]=r,n.add(e),t?.register(e,r),r)},set:function(e,t,n){const r=e[Gt];if(!r)throw new TypeError("Illegal invocation");jt(a,1),Ut(a,r),zt(a,t),s(n),c()},call:function(e,t,n,r){const i=e[Gt];if(!i)throw new TypeError("Illegal invocation");jt(a,2),Ut(a,i),zt(a,t),Ut(a,(r?r[Gt]:0)??0),Ut(a,n.length),n.forEach(s),c()}}}));function Ht(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function Kt(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,Ht(e,t,"get"))}function Zt(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}function Xt(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,Ht(e,t,"set"),n),n}const Yt=new WeakMap,en=new WeakMap;function tn(e,t){Yt.set(e,t),en.set(t,e)}function nn(e){return Yt.has(e)?Yt.get(e):e}function rn(e){return en.has(e)?en.get(e):e}let on=null;var an=new WeakMap,sn=new WeakMap,cn=new WeakMap;let un=Gt;class ln{get src(){return Kt(this,an)}get loading(){return!Kt(this,sn)}get complete(){return Kt(this,sn)}get error(){return Kt(this,cn)}__handleSettled(e){Xt(this,sn,!0),Xt(this,cn,e),e?P(this.onerror,e):P(this.onload,void 0)}constructor(e){q(this,un,void 0),q(this,"onload",void 0),q(this,"onerror",void 0),Zt(this,an,{writable:!0,value:void 0}),Zt(this,sn,{writable:!0,value:!1}),Zt(this,cn,{writable:!0,value:void 0}),Xt(this,an,e),tn(this,(on||(on=new Image,on.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"),on))}}const dn=Pt((({frame:e,invoke:t,subscribe:n})=>{const r=Qt(e),i=new Map;function o(e,t){return"string"==typeof e?{type:"url",src:e}:{type:"arraybuffer",data:e,mime:t}}return n("image.settled",(e=>{const t=i.get(e.refId);i.delete(e.refId),t&&t(e)})),{createImage:function(e,n){const a=new ln(e),s=r.bind(a);return t({type:"image.load",refId:s,data:o(e,n)},{serialize:"string"==typeof e}),i.set(s,(e=>{a.__handleSettled(e.error)})),a}}})),fn=Lt((e=>{const t=new Map;return e.subscribe((e=>{if("event.trigger"!==e.type)return;const n=t.get(`${e.capture}|${e.name}`);if(!n?.size)return;const r=function(e){const t=new CustomEvent(e.type,{detail:e.detail});for(const n of Object.keys(e))n in t||(t[n]=e[n]);return Object.defineProperties(t,{target:{value:e.target},currentTarget:{value:e.currentTarget}}),t}(e.event);for(const t of Array.from(n))P(t,r)})),{addListener:function(n,r,i){const o="boolean"==typeof i?i:!!i?.capture;t.has(`${o}|${n}`)||t.set(`${o}|${n}`,new Set);const a=t.get(`${o}|${n}`);a.size||e.invoke("event.subscribe",{name:n,capture:o}),a.add(r)},removeListener:function(n,r,i){const o="boolean"==typeof i?i:!!i?.capture;if(!t.has(`${o}|${n}`))return;const a=t.get(`${o}|${n}`);a.delete(r),a.size||e.invoke("event.unsubscribe",{name:n,capture:o})}}}));var pn=new WeakMap,hn=new WeakMap;let gn=Gt;var mn=new WeakMap,yn=new WeakMap;let wn=Gt;class vn{addColorStop(e,t){Kt(this,yn).addColorStop(e,t),Kt(this,mn).call(this,"addColorStop",[e,t])}constructor(e,t){q(this,wn,void 0),Zt(this,mn,{writable:!0,value:void 0}),Zt(this,yn,{writable:!0,value:void 0}),Xt(this,mn,e),Xt(this,yn,t),e.bind(this),tn(this,t)}}const Cn=["fillStyle","filter","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","imageSmoothingQuality","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","strokeStyle"],Sn=["direction","font","fontKerning","fontStretch","fontVariantCaps","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","textAlign","textBaseline","textRendering","wordSpacing"],kn=["arc","arcTo","beginPath","bezierCurveTo","clip","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect","reset","resetTransform","restore","rotate","roundRect","save","scale","setLineDash","setTransform","transform","translate"],bn=["clearRect","drawFocusIfNeeded","drawImage","fill","fillRect","fillText","stroke","strokeRect","strokeText"],Tn=["getContextAttributes","getLineDash","getTransform","isContextLost","isPointInPath","isPointInStroke","measureText"],In=[["createConicGradient",vn],["createLinearGradient",vn],["createPattern",class{setTransform(e){Kt(this,hn).setTransform(e),Kt(this,pn).call(this,"setTransform",[e])}constructor(e,t){q(this,gn,void 0),Zt(this,pn,{writable:!0,value:void 0}),Zt(this,hn,{writable:!0,value:void 0}),Xt(this,pn,e),Xt(this,hn,t),e.bind(this),tn(this,t)}}],["createRadialGradient",vn]],xn=Et("__WECOM_INTERNAL__"),An=Lt(((e,t,n)=>new _n(e,t,n)));let Wn=xn,Mn=Gt;class _n{constructor(e,t,n){q(this,"canvas",void 0),q(this,Wn,void 0),q(this,Mn,void 0),this.canvas=e,this[xn]={store:t,native:n,props:Object.create(null)},t.bind(this),tn(this,n)}}const Ln=_n.prototype;for(const Hn of Cn)Object.defineProperty(Ln,Hn,{configurable:!0,enumerable:!0,get(){const{native:e,props:t}=this[xn];return t[Hn]??rn(e[Hn])},set(e){const{store:t,props:n}=this[xn];n[Hn]=nn(e),t.set(this,Hn,e)}});for(const Hn of Sn)Object.defineProperty(Ln,Hn,{configurable:!0,enumerable:!0,get(){return rn(this[xn].native[Hn])},set(e){const{store:t,native:n}=this[xn];n[Hn]=nn(e),t.set(this,Hn,e)}});for(const Hn of Tn)Ln[Hn]=function(...e){const{native:t}=this[xn];return Pn(t,Hn,e)};for(const Hn of kn)Ln[Hn]=function(...e){const{store:t,native:n}=this[xn];Pn(n,Hn,e),t.call(this,Hn,e)};for(const Hn of bn)Ln[Hn]=function(...e){const{store:t}=this[xn];t.call(this,Hn,e)};for(const[Hn,Kn]of In)Ln[Hn]=function(...e){const{store:t,native:n}=this[xn],r=Pn(n,Hn,e),i=new Kn(t,r);return t.call(this,Hn,e,i),i};function Pn(e,t,n){switch(n.length){case 1:return e[t](n[0]);case 2:return e[t](n[0],n[1]);case 3:return e[t](n[0],n[1],n[2]);case 4:return e[t](n[0],n[1],n[2],n[3]);case 5:return e[t](n[0],n[1],n[2],n[3],n[4]);case 6:return e[t](n[0],n[1],n[2],n[3],n[4],n[5]);default:return e[t](...n)}}var Bn=new WeakMap,En=new WeakMap,Dn=new WeakMap,On=new WeakMap,Rn=new WeakMap;let Vn=Gt;class Nn{get width(){return Kt(this,Bn).width}set width(e){Kt(this,Bn).width=e,Kt(this,En).set(this,"width",e)}get height(){return Kt(this,Bn).height}set height(e){Kt(this,Bn).height=e,Kt(this,En).set(this,"height",e)}createImage(e,t){return Kt(this,Dn).createImage(e,t)}getContext(e,t){if("2d"!==e)throw new Error(`Failed to execute 'getContext' on 'FrameCanvas': The provided value '${e}' is not a valid enum value of type RenderingContextType`);if(Kt(this,Rn))return Kt(this,Rn);const n=Kt(this,Bn).getContext(e,t);return Xt(this,Rn,An(this,Kt(this,En),n)),Kt(this,En).call(this,"getContext",[e,t],Kt(this,Rn)),Kt(this,Rn)}addEventListener(e,t,n){Kt(this,On).addListener(e,t,n)}removeEventListener(e,t,n){Kt(this,On).removeListener(e,t,n)}constructor(e,t,n){q(this,Vn,void 0),Zt(this,Bn,{writable:!0,value:void 0}),Zt(this,En,{writable:!0,value:void 0}),Zt(this,Dn,{writable:!0,value:void 0}),Zt(this,On,{writable:!0,value:void 0}),Zt(this,Rn,{writable:!0,value:void 0}),Xt(this,Bn,new OffscreenCanvas(n.width,n.height)),Xt(this,En,Qt(e.frame)),Kt(this,En).bind(this,t),Xt(this,Dn,dn(e.frame)),Xt(this,On,fn(e)),tn(this,Kt(this,Bn))}}const Fn=new WeakMap,jn=Lt((e=>{const{genReflectId:t}=Qt(e.frame);return t()}));const Un=Lt((e=>({scrollTo(t){e.invoke("scrollTo",t)},scrollIntoView(t,n){e.invoke("scrollIntoView",{selector:t,options:n})}})));function zn(e){return function(e){const t="0123456789abcdef";let n,r="";for(let i=0;i<e.length;i++)n=e.charCodeAt(i),r+=t.charAt(n>>>4&15)+t.charAt(15&n);return r}(function(e){return function(e){let t="";for(let n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}(function(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;const n=new Array(80);let r=1732584193,i=-271733879,o=-1732584194,a=271733878,s=-1009589776;for(let c=0;c<e.length;c+=16){const t=r,u=i,l=o,d=a,f=s;for(let p=0;p<80;p++){n[p]=p<16?e[c+p]:Gn(n[p-3]^n[p-8]^n[p-14]^n[p-16],1);const t=Jn(Jn(Gn(r,5),qn(p,i,o,a)),Jn(Jn(s,n[p]),$n(p)));s=a,a=o,o=Gn(i,30),i=r,r=t}r=Jn(r,t),i=Jn(i,u),o=Jn(o,l),a=Jn(a,d),s=Jn(s,f)}return[r,i,o,a,s]}(function(e){const t=new Array(e.length>>2);for(let n=0;n<t.length;n++)t[n]=0;for(let n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}(e),8*e.length))}(e))}function qn(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function $n(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function Jn(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function Gn(e,t){return e<<t|e>>>32-t}const Qn={isWeChat:d,isWeCom:l};return e.FrameCanvas=Nn,e.IS_WECOM_SDK=!0,e.SDK_VERSION=It,e.addCard=function(e){return ne(e,(async()=>{await Y();const t=await j("batchAddCard",{card_list:e.cardList.map((e=>({card_id:e.cardId,card_ext:e.cardExt})))});if(!t.card_list)return t;for(const e of t.card_list)e.cardId=e.card_id,delete e.card_id,e.cardExt=e.card_ext,delete e.card_ext,e.isSuccess=!!e.is_succ,delete e.is_succ;return t.cardList=t.card_list,delete t.card_list,t}))},e.addDevice=function(e){return ee("addDevice",e)},e.checkJsApi=async function(e){return ne(e,(async()=>{await Y();const t=await j("checkJsApi",{jsApiList:W(e.jsApiList)});if("string"==typeof t.checkResult)try{t.checkResult=JSON.parse(t.checkResult)}catch(n){t.checkResult={}}return t.checkResult=function(e){const t={...e};for(const n of Object.keys(e))t[A(n)]=e[n];return t}(Pe(t.checkResult)),t}))},e.checkSchedule=function(e){return ee("checkSchedule",e)},e.chooseCard=function(e){return ne(e,(async()=>{await Y();const t=await j("chooseCard",{app_id:k(),location_id:e.shopId||"",sign_type:e.signType||"SHA1",card_id:e.cardId||"",card_type:e.cardType||"",card_sign:e.cardSign,time_stamp:`${e.timestamp}`,nonce_str:e.nonceStr});return t.cardList=t.choose_card_info,delete t.choose_card_info,t}))},e.chooseImage=function(e={}){return ne(e,(async()=>{await Y();const t=await j("chooseImage",{scene:"1|2",count:e.count||9,sizeType:e.sizeType||["original","compressed"],sourceType:e.sourceType||["album","camera"],defaultCameraMode:e.defaultCameraMode||"normal",isSaveToAlbum:O(e.isSaveToAlbum)?0:1});if(f&&t.localIds){t.localIds=t.localIds||"[]";try{t.localIds=JSON.parse(t.localIds)}catch(n){}}return t}))},e.chooseInvoice=function(e){return ee("chooseInvoice",e)},e.chooseMessageFile=function(e){return ee("chooseMessageFile",e)},e.chooseWXPay=function(e){return ee("getBrandWCPayRequest",e,Le(e))},e.claimClassAdmin=function(e={}){return ee("claimClassAdmin",e)},e.closeBLEConnection=function(e){return ee("closeBLEConnection",e)},e.closeBluetoothAdapter=function(e={}){return ee("closeBluetoothAdapter",e)},e.closeWindow=function(e={}){return ee("closeWindow",e)},e.connectWifi=function(e){return ee("connectWifi",e)},e.consumeAndShareCard=function(e){return ee("consumedShareCard",e,{consumedCardId:e.cardId,consumedCode:e.code})},e.createBLEConnection=function(e){return ee("createBLEConnection",e)},e.createChatWithMsg=function(e){return ee("createChatWithMsg",e)},e.createCorpGroupChat=function(e){return ee("createCorpGroupChat",e,{groupName:e.groupName||"",userIds:e.userIds,openUserIds:e.openUserIds,externalUserIds:e.externalUserIds,corpGroupUserIds:e.corpGroupUserIds})},e.createDoc=function(e){return ee("createDoc",e)},e.createExternalPayment=function(e={}){return ee("createExternalPayment",e)},e.createJSAPIPanel=function(e,t){const n=De(t.el),{style:r}=n;r.width="100%",r.height="100%";const i=new Map,{subscribe:o,handleMessage:a}=$e(),{dispose:s}=ze(n,"https://login.work.weixin.qq.com",a);return o("call",(e=>{qe(e,t)})),o("getStaticOptions",(()=>({name:e,options:{...t,el:void 0,params:void 0}}))),o("jsapiCallback",(e=>{if(!i.has(e.seq))return;const t=i.get(e.seq);i.delete(e.seq),P("success"===e.kind?t?.success:t?.fail,e.payload),P(t?.complete,e.payload)})),o("getJSAPIParams",(async n=>{const r=R(t.params)?await t.params():t.params,o=E();return i.set(n.seq,r),{webToken:t.webToken,url:o,configParams:n.payload?.skipSignature?void 0:await Qe(o,n.payload?.preferSignatureTypeList||["agentConfig"]),jsapi:e,jsapiParams:r}})),o("openModalFrame",(e=>{Je(e.payload.url)})),n.style.opacity="0",n.src="https://login.work.weixin.qq.com/wwopen/ww-jsapi-transparent-frame",{el:n,unmount(){s(),n.parentNode?.removeChild(n)}}},e.createOpenDataFrameFactory=function(e){const n=l?Ee():void 0;let r=i();async function i(){if(l)try{return await n,function(e){return new Promise(((n,r)=>{t.WWOpenData.createOpenSessionInjector(e,((e,t)=>{e||!t?r(e||new Error("System error")):n(t)}))}))}({url:bt})}catch(r){throw P(e?.onError,r),P(e?.handleError,r),r}}async function o(e){if(!l)return;const t=await r;t&&t(e)}return{createOpenDataFrame:function(e){if(!e.template)throw new Error("options.template is required");const a=De(e.el),s=n?.then((()=>t?.WWOpenData?.registerOpenFrame(a))),{subscribe:c,handleMessage:u}=$e(),{invoke:d,dispose:f}=ze(a,kt,u),p={el:a,data:wt(e.data)||{},setData:async function(e){(function(e,t,n){void 0===n&&(n={});for(var r=n.protectedKeys||ht,i=n.set||yt,o=0,a=Object.keys(t);o<a.length;o++){var s=a[o];if(!Ke(r,s))if(Ke(s,"[")||Ke(s,"."))try{var c=gt(pt(s),r||[]);c?mt(e,c,t[s],i):i(e,s,t[s])}catch(u){i(e,s,t[s])}else i(e,s,t[s])}})(p.data,e,{protectedKeys:Tt}),await d({type:"update",options:{data:e}})},dispose:function(){f(),s?.then((e=>{t?.WWOpenData?.unregisterOpenFrame(e)}))},...e.methods};return vt.set(p,{frame:p,invoke:d,subscribe:c}),a.src=bt,c("init",(async()=>({id:l?await s:void 0,hooks:Ct(e),options:St({...e,el:void 0,methods:void 0,data:p.data}),config:{support:["injectSession"]}}))),c("call",(t=>{let n=e;return"method"===t.kind&&(n=n.methods),qe(t,n,p)})),c("injectSession",(async()=>{await o(a)})),c("refreshSession",(async()=>{r=i(),await o(a)})),c("invokeJsapi",(e=>j("wwapp.invokeJsApiByCallInfo",{callInfo:e.callInfo}))),c("invokeDownload",(e=>{if(!e.url.startsWith("https://open.work.weixin.qq.com/"))throw new Error("Invalid download url");const t=document.createElement("a");t.href=e.url,t.target="_blank",t.style.display="none",t.click()})),c("agentConfig",(async()=>{const e=E();return{url:e,params:await K(e)}})),c("modal",(async t=>{const n=l?"wecom-window":void 0;if("function"!=typeof e.handleModal)return{modalType:n};return{modalType:!1===e.handleModal({modalUrl:t.modalUrl,modalSize:t.modalSize})?"iframe":n}})),p}}},e.createSchoolPayment=function(e){return ee("createSchoolPayment",e)},e.createScrollViewContext=async function(e,t){const{get:n}=Bt(e),r=await n(t);if(r)return Un(r)},e.createWWLoginPanel=function(t){const{width:n,height:r}=function(t=e.WWLoginPanelSizeType.middle){const n=_t[t]||_t[e.WWLoginPanelSizeType.middle];return{width:n[0],height:n[1]}}(t.params?.panel_size),i=De(t.el),{style:o}=i;o.width=n,o.height=r;const{dispose:a}=ze(i,"https://login.work.weixin.qq.com",(e=>{if("call"===e.type)return qe(e,t);throw new Error(`Unknown message type '${e.type}'`)})),s=new URL("https://login.work.weixin.qq.com/wwlogin/sso/login");for(const e of Object.keys(t.params||{}))s.searchParams.set(e,t.params[e]);return s.searchParams.set("version",It),i.src=s.href,{el:i,unmount(){a(),i.parentNode?.removeChild(i)}}},e.discoverDevice=function(e){return ee("discoverDevice",e)},e.downloadImage=function(e){return ee("downloadImage",e,{serverId:e.serverId,isShowProgressTips:O(e.isShowProgressTips)?0:1})},e.downloadLivingReplay=function(e){return ee("downloadLivingReplay",e)},e.downloadVoice=function(e){return ee("downloadVoice",e,{serverId:e.serverId,isShowProgressTips:O(e.isShowProgressTips)?0:1})},e.ensureAgentConfigReady=H,e.ensureConfigReady=function(){const e=v();return l&&e?.getAgentConfigSignature?H():Q()},e.ensureCorpConfigReady=Q,e.enterHWOpenTalk=function(e){return ee("enterHWOpenTalk",e)},e.enterpriseVerify=function(e={}){return ee("enterpriseVerify",e)},e.env=Qn,e.getApprovalSelectedItems=function(e){return ne(e,(async()=>{await Y();const t=await j("getApprovalSelectedItems",{key:e.key});if(!t.selectedData)return t;try{t.selectedData=JSON.parse(t.selectedData)}catch(n){t.selectedData=[]}return t}))},e.getBLEDeviceCharacteristics=function(e){return ee("getBLEDeviceCharacteristics",e)},e.getBLEDeviceServices=function(e){return ee("getBLEDeviceServices",e)},e.getBeacons=function(e={}){return ee("getBeacons",e)},e.getBluetoothAdapterState=function(e={}){return ee("getBluetoothAdapterState",e)},e.getBluetoothDevices=function(e={}){return ne(e,(async()=>{await Y();const e=await j("getBluetoothDevices");for(const t of e.devices||[])_e(t);return e}))},e.getCanvas=async function(e,t){const{get:n}=Bt(e),r=await n(t);if(!r)return;if(Fn.has(r))return Fn.get(r);const i=jn(r),o=await r.invoke("bind",{refId:i});return o?(Fn.has(r)||Fn.set(r,new Nn(r,i,o)),Fn.get(r)):void 0},e.getClipboardData=function(e={}){return ee("getClipboardData",e)},e.getConnectedBluetoothDevices=function(e){return ee("getConnectedBluetoothDevices",e)},e.getConnectedWifi=function(e={}){return ee("getConnectedWifi",e)},e.getContext=function(e={}){return ee("getContext",e)},e.getCurCorpGroupChat=function(e={}){return ee("getCurCorpGroupChat",e)},e.getCurCorpGroupContact=function(e){return ee("getCurCorpGroupContact",e)},e.getCurExternalChat=function(e={}){return ee("getCurExternalChat",e)},e.getCurExternalContact=function(e={}){return ee("getCurExternalContact",e)},e.getLocalFileData=function(e){return ee("getLocalFileData",e)},e.getLocalImgData=function(e){return ee("getLocalImgData",e)},e.getLocation=function(e={}){return ne(e,(async()=>{await Y();const t=await j("geoLocation",{type:e.type||"wgs84"});return delete t.type,t}))},e.getNetworkType=function(e={}){return ee("getNetworkType",e)},e.getNodeInfo=async function(e,t,n){const{get:r}=Bt(e),i=await r(t);if(i)return i.invoke("nodeInfo.get",{fields:n})},e.getShareInfo=function(e){return ee("getShareInfo",e)},e.getSignature=function(e){let t=e;"string"==typeof e&&(t={ticket:e});const n=t.nonceStr||Fe(),r=t.timestamp||Math.floor(Date.now()/1e3),i=t.url||o().split("#")[0];return{timestamp:r,nonceStr:n,signature:zn(`jsapi_ticket=${t.ticket}&noncestr=${n}&timestamp=${r}&url=${i}`)}},e.getVerifyParams=b,e.getWifiList=function(e={}){return ee("getWifiList",e)},e.hideAllNonBaseMenuItem=function(e={}){return ee("hideAllNonBaseMenuItem",e)},e.hideChatAttachmentMenu=function(e){return ee("hideChatAttachmentMenu",e)},e.hideMenuItems=function(e){return ee("hideMenuItems",e)},e.hideOptionMenu=function(e={}){return ee("hideOptionMenu",e)},e.initOpenData=Ee,e.invoke=j,e.launchMiniprogram=function(e){return ee("launchMiniprogram",e,{appid:e.appid,path:Be(e.path),envVersion:e.envVersion})},e.navigateToAddCustomer=function(e={}){return ee("navigateToAddCustomer",e)},e.navigateToKfChat=function(e){return ee("navigateToKfChat",e)},e.notifyBLECharacteristicValueChange=function(e){return ee("notifyBLECharacteristicValueChange",e)},e.on=F,e.onBLECharacteristicValueChange=function(e){F("onBLECharacteristicValueChange",(t=>{"string"==typeof t?.value&&(t.value=L(t.value)),e(t)}))},e.onBLEConnectionStateChange=function(e){F("onBLEConnectionStateChange",e)},e.onBeaconServiceChange=function(e){F("onBeaconServiceChange",e)},e.onBeaconUpdate=function(e){F("onBeaconUpdate",e)},e.onBluetoothAdapterStateChange=function(e){F("onBluetoothAdapterStateChange",e)},e.onBluetoothDeviceFound=function(e){F("onBluetoothDeviceFound",(t=>{for(const e of t.devices||[])_e(e);e(t)}))},e.onGetWifiList=function(e){F("onGetWifiList",e)},e.onHistoryBack=function(e){F("historyBack",e)},e.onLocationChange=function(e){F("auto:location:report",e)},e.onMenuShareAppMessage=function(e){te("menu:share:appmessage",e,(()=>j("sendAppMessage",{title:e.title||a(),desc:e.desc||"",link:e.link||o(),img_url:e.imgUrl||"",type:e.type||"link",data_url:e.dataUrl||"",finder_feed:e.finderFeed||e.finder_feed,finder_topic:e.finderTopic||e.finder_topic,finder_profile:e.finderProfile||e.finder_profile,enableIdTrans:e.enableIdTrans?1:0})))},e.onMenuShareQQ=function(e){te("menu:share:qq",e,(()=>j("shareQQ",{title:e.title||a(),desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||o()})))},e.onMenuShareQZone=function(e){te("menu:share:QZone",e,(()=>j("shareQZone",{title:e.title||a(),desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||o()})))},e.onMenuShareTimeline=function(e){te("menu:share:timeline",e,(()=>j("shareTimeline",{title:e.title||a(),desc:e.title||a(),img_url:e.imgUrl||"",link:e.link||o(),type:e.type||"link",data_url:e.dataUrl||"",enableIdTrans:e.enableIdTrans?1:0})))},e.onMenuShareWechat=function(e){te("menu:share:wechat",e,(()=>j("shareWechat",{title:e.title||a(),desc:e.desc||"",link:e.link||o(),img_url:e.imgUrl||"",type:e.type||"link",data_url:e.dataUrl||"",enableIdTrans:e.enableIdTrans?1:0})))},e.onMenuShareWeibo=function(e){te("menu:share:weiboApp",e,(()=>j("shareWeiboApp",{title:e.title||a(),desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||o()})))},e.onNetworkStatusChange=function(e){F("onNetworkStatusChange",e)},e.onSearchBeacons=function(e){F("onBeaconsInRange",e)},e.onUserCaptureScreen=function(e){F("onUserCaptureScreen",e)},e.onVoicePlayEnd=function(e){F("onVoicePlayEnd",e)},e.onVoiceRecordEnd=function(e){F("onVoiceRecordEnd",e)},e.onWifiConnected=function(e){F("onWifiConnected",e)},e.openAddress=function(e={}){return ne(e,(async()=>{await Y();const e=await j("editAddress");return e.postalCode=e.addressPostalCode,delete e.addressPostalCode,e.provinceName=e.proviceFirstStageName,delete e.proviceFirstStageName,e.cityName=e.addressCitySecondStageName,delete e.addressCitySecondStageName,e.countryName=e.addressCountiesThirdStageName,delete e.addressCountiesThirdStageName,e.detailInfo=e.addressDetailInfo,delete e.addressDetailInfo,e}))},e.openAppComment=function(e={}){return ee("openAppComment",e)},e.openAppDeviceDataAuth=function(e={}){return ee("openAppDeviceDataAuth",e)},e.openAppManage=function(e={}){return ee("openAppManage",e)},e.openAppPurchase=function(e){return ee("openAppPurchase",e)},e.openBluetoothAdapter=function(e={}){return ee("openBluetoothAdapter",e)},e.openBusinessView=function(e){return ne(e,(async()=>{await Y();const t=await j("openBusinessView",{businessType:e.businessType,queryString:e.queryString||"",envVersion:e.envVersion});if(!f||!t.extraData)return t;try{t.extraData=JSON.parse(t.extraData)}catch(n){t.extraData={}}return t}))},e.openCard=function(e){return ee("batchViewCard",e,{card_list:e.cardList.map((e=>({card_id:e.cardId,code:e.code})))})},e.openDefaultBrowser=function(e){return ee("openDefaultBrowser",e)},e.openDeviceProfile=function(e){return ee("openDeviceProfile",e)},e.openEnterpriseChat=function(e={}){return ee("openEnterpriseChat",e,{chatId:e.chatId||"",chatname:e.groupName||"",groupName:e.groupName||"",useridlist:N(e.userIds),userIds:N(e.userIds),openIds:N(e.openIds),externalUserIds:N(e.externalUserIds)})},e.openEnterpriseRedPacket=function(e){return ee("getRecevieBizHongBaoRequest",e,Le(e))},e.openExistedChatWithMsg=function(e){return ee("openExistedChatWithMsg",e)},e.openLocation=function(e){return ee("openLocation",e,{latitude:e.latitude,longitude:e.longitude,name:e.name||"",address:e.address||"",scale:e.scale||28,infoUrl:e.infoUrl||""})},e.openProductSpecificView=function(e){return ee("openProductViewWithPid",e,{pid:e.productId,view_type:e.viewType||0,ext_info:e.extInfo})},e.openThirdAppServiceChat=function(e={}){return ee("openThirdAppServiceChat",e)},e.openUserProfile=function(e){return ee("openUserProfile",e)},e.pauseVoice=function(e){return ee("pauseVoice",e)},e.playVoice=function(e){return ee("playVoice",e)},e.previewFile=function(e){return ee("previewFile",e)},e.previewImage=function(e){return ee("imagePreview",e)},e.printFile=function(e){return ee("printFile",e)},e.queryCurrHWOpenTalk=function(e={}){return ee("queryCurrHWOpenTalk",e)},e.readBLECharacteristicValue=function(e){return ee("readBLECharacteristicValue",e)},e.refundExternalPayment=function(e){return ee("refundExternalPayment",e)},e.register=function(e){!function(e){if(!e.corpId)throw new Error("Missing corpId");m=e}(e),(d||l)&&Y()},e.replayLiving=function(e){return ee("replayLiving",e)},e.saveApprovalSelectedItems=function(e){return ee("saveApprovalSelectedItems",e,{key:e.key,selectedData:"string"==typeof e.selectedData?e.selectedData:JSON.stringify(e.selectedData)})},e.scanQRCode=function(e={}){return ne(e,(async()=>{await Y();const t=await j("scanQRCode",{needResult:e.needResult?1:0,scanType:e.scanType||["qrCode","barCode"]});if(!h)return t;const n=t.resultStr;if(!n)return t;let r;try{r=JSON.parse(n)}catch(i){}return t.resultStr=r?.scan_code?.scan_result,t}))},e.selectCorpGroupContact=function(e){return ne(e,(async()=>{await Y();const t=await j("selectCorpGroupContact",e);if(!V(t.result))return t;try{t.result=JSON.parse(t.result)}catch(n){}return t}))},e.selectEnterpriseContact=function(e){return ne(e,(async()=>{await Y();const t=await j("selectEnterpriseContact",e);if(!V(t.result))return t;try{t.result=JSON.parse(t.result)}catch(n){}return t}))},e.selectExternalContact=function(e={}){return ee("selectExternalContact",e)},e.selectPrivilegedContact=function(e){return ee("selectPrivilegedContact",e)},e.sendChatMessage=function(e){return ee("sendChatMessage",e)},e.setClipboardData=function(e){return ee("setClipboardData",e)},e.setKeepScreenOn=function(e){return ee("setKeepScreenOn",e)},e.setShareAttr=function(e={}){return ee("setShareAttr",e)},e.shareAppMessage=function(e){return ee("shareAppMessage",e)},e.shareToExternalChat=function(e){return ee("shareToExternalChat",e)},e.shareToExternalContact=function(e){return ee("shareToExternalContact",e)},e.shareToExternalMoments=function(e){return ee("shareToExternalMoments",e)},e.shareWechatMessage=function(e){return ee("shareWechatMessage",e)},e.showAllNonBaseMenuItem=function(e={}){return ee("showAllNonBaseMenuItem",e)},e.showMenuItems=function(e){return ee("showMenuItems",e)},e.showOptionMenu=function(e={}){return ee("showOptionMenu",e)},e.showSecurityGatewayConfirmModal=function(e){const t=new URL("https://open.work.weixin.qq.com/wwopen/secureGateway/confirm");if(t.searchParams.set("confirm_id",e.confirmId),h||f)return void(location.href=t.href);t.searchParams.set("modal","true");const n=Je(t.href,(t=>{switch(t.type){case"call":return qe(t,e);case"close":return;default:throw new Error(`Unknown message type '${t.type}'`)}}));return{el:n.el,unmount(){n.dispose(),n.el.parentNode?.removeChild(n.el)}}},e.startAutoLBS=function(e){return ee("startAutoLBS",e)},e.startBeaconDiscovery=function(e){return ee("startBeaconDiscovery",e)},e.startBluetoothDevicesDiscovery=function(e={}){return ee("startBluetoothDevicesDiscovery",e)},e.startLiving=function(e={}){return ee("startLiving",e)},e.startMeeting=function(e={}){return ee("startMeeting",e)},e.startRecord=function(e={}){return ee("startRecord",e)},e.startSearchBeacons=function(e={}){return ee("startMonitoringBeacons",e)},e.startWecast=function(e={}){return ee("startWecast",e)},e.startWifi=function(e={}){return ee("startWifi",e)},e.stopAutoLBS=function(e={}){return ee("stopAutoLBS",e)},e.stopBeaconDiscovery=function(e={}){return ee("stopBeaconDiscovery",e)},e.stopBluetoothDevicesDiscovery=function(e={}){return ee("stopBluetoothDevicesDiscovery",e)},e.stopRecord=function(e={}){return ee("stopRecord",e)},e.stopSearchBeacons=function(e={}){return ee("stopMonitoringBeacons",e)},e.stopVoice=function(e){return ee("stopVoice",e)},e.stopWifi=function(e={}){return ee("stopWifi",e)},e.thirdPartyOpenPage=function(e){return ee("thirdPartyOpenPage",e)},e.translateVoice=function(e){return ee("translateVoice",e,{localId:e.localId,isShowProgressTips:O(e.isShowProgressTips)?0:1})},e.updateAppMessageShareData=function(e={}){return ee("updateAppMessageShareData",e)},e.updateCorpGroupChat=function(e){return ee("updateCorpGroupChat",e)},e.updateEnterpriseChat=function(e){return ee("updateEnterpriseChat",e,{chatId:e.chatId,userIdsToAdd:N(e.userIdsToAdd)})},e.updateMomentsSetting=function(e){return ee("updateMomentsSetting",e)},e.updateTimelineShareData=function(e={}){return ee("updateTimelineShareData",e)},e.uploadImage=function(e){return ee("uploadImage",e,{localId:e.localId,isShowProgressTips:O(e.isShowProgressTips)?0:1})},e.uploadVoice=function(e){return ee("uploadVoice",e,{localId:e.localId,isShowProgressTips:O(e.isShowProgressTips)?0:1})},e.wedocSelectDoc=function(e){return ee("wedocSelectDoc",e)},e.wedriveSelectDir=function(e={}){return ee("wedriveSelectDir",e)},e.wedriveSelectFile=function(e){return ee("wedriveSelectFile",e)},e.wedriveSelectFileForDownload=function(e){return ee("wedriveSelectFileForDownload",e)},e.wedriveSelectFileForShare=function(e){return ee("wedriveSelectFileForShare",e)},e.writeBLECharacteristicValue=function(e){return ee("writeBLECharacteristicValue",e,{deviceId:e.deviceId,serviceId:e.serviceId,characteristicId:e.characteristicId,value:_(e.value)})},e}({});