@x-edu/live-player 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.browserslistrc +10 -10
- package/.eslintignore +8 -8
- package/.eslintrc.js +26 -26
- package/.gem-mine +11 -11
- package/.postcssrc.js +6 -6
- package/README.md +145 -145
- package/babel.config.js +33 -33
- package/doc/develop.md +23 -23
- package/gem-mine.config.js +86 -86
- package/jest.config.js +9 -9
- package/jsconfig.json +15 -15
- package/mock/helper.js +8 -8
- package/mock/index.js +34 -34
- package/package.json +99 -99
- package/public/3rd/ali-player/alipayercomponents-1.0.8.min.js +26 -26
- package/public/3rd/ali-player/aliplayer-hls-min.js +27 -27
- package/public/3rd/ali-player/aliplayer-min.js +1 -1
- package/public/3rd/im-web-push/index.umd.js +14 -14
- package/public/JsBridge.js +1602 -1602
- package/public/fish/editor/themes/default/css/ueditor.css +1905 -1905
- package/public/fish/editor/third-party/codemirror/codemirror.css +104 -104
- package/public/fish/editor/third-party/codemirror/codemirror.js +3581 -3581
- package/public/fish/editor/third-party/zeroclipboard/ZeroClipboard.js +1255 -1255
- package/public/fish/editor/ueditor.all.min.js +16 -16
- package/public/fish/editor/ueditor.config.js +467 -467
- package/public/fish/icon/umd-4.1.2.js +1 -1
- package/public/fish/video/videoplayer.min.css +6 -6
- package/public/fish/video/videoplayer.min.js +31 -31
- package/public/fish/video/zh-CN.js +82 -82
- package/public/icon/demo.css +539 -539
- package/public/icon/demo_index.html +2189 -2189
- package/public/icon/iconfont.css +363 -363
- package/public/icon/iconfont.json +618 -618
- package/public/index.html +50 -50
- package/script/image/readme.md +77 -77
- package/script/postcss.js +48 -48
- package/src/App.jsx +24 -24
- package/src/asset/img/course/playing.svg +21 -21
- package/src/asset/img/icon-course-white.svg +3 -3
- package/src/asset/img/icon-course.svg +3 -3
- package/src/asset/img/icon-eye-white.svg +4 -4
- package/src/asset/img/icon-eye.svg +4 -4
- package/src/asset/img/icon-school-white.svg +3 -3
- package/src/asset/img/icon-school.svg +3 -3
- package/src/asset/img/loading.svg +52 -52
- package/src/asset/img/video-play.svg +6 -6
- package/src/asset/style/background.less +19 -19
- package/src/asset/style/banner.less +36 -36
- package/src/asset/style/base.less +74 -74
- package/src/asset/style/index.less +114 -114
- package/src/asset/style/reset-theme.less +141 -141
- package/src/asset/style/theme/index.less +55 -55
- package/src/asset/style/theme/party/global.less +20 -20
- package/src/asset/style/theme/party/override.less +57 -57
- package/src/asset/style/theme/test/global.less +18 -18
- package/src/asset/style/theme/test/override.less +45 -45
- package/src/asset/style/variable.less +12 -12
- package/src/component/AliPlayer/index.jsx +49 -49
- package/src/component/Avatar/index.jsx +50 -50
- package/src/component/Empty/index.jsx +34 -34
- package/src/component/Empty/index.module.less +37 -37
- package/src/component/IMChatroom/component/status/403.jsx +13 -13
- package/src/component/IMChatroom/component/status/404.jsx +13 -13
- package/src/component/IMChatroom/component/status/Error.jsx +23 -23
- package/src/component/IMChatroom/component/status/Loading.jsx +5 -5
- package/src/component/IMChatroom/config/app/config.js +118 -118
- package/src/component/IMChatroom/config/app/index.js +60 -60
- package/src/component/IMChatroom/config/env.js +5 -5
- package/src/component/IMChatroom/config/index.js +3 -3
- package/src/component/IMChatroom/config/request/config/base.js +124 -124
- package/src/component/IMChatroom/config/request/config/chatroom.js +26 -26
- package/src/component/IMChatroom/config/request/config/imCoreApi.js +21 -21
- package/src/component/IMChatroom/config/request/index.js +21 -21
- package/src/component/IMChatroom/config/request/proxy.js +39 -39
- package/src/component/IMChatroom/config/url.js +7 -7
- package/src/component/IMChatroom/constants/errorCode.js +9 -9
- package/src/component/IMChatroom/constants/index.js +84 -84
- package/src/component/IMChatroom/constants/origin.js +27 -27
- package/src/component/IMChatroom/context/chatroom.js +154 -154
- package/src/component/IMChatroom/context/connect.js +28 -28
- package/src/component/IMChatroom/i18n/en/index.json +73 -73
- package/src/component/IMChatroom/i18n/index.jsx +14 -14
- package/src/component/IMChatroom/i18n/language.js +9 -9
- package/src/component/IMChatroom/i18n/zh-CN/index.json +73 -73
- package/src/component/IMChatroom/index.jsx +49 -49
- package/src/component/IMChatroom/page/chat/index.jsx +27 -27
- package/src/component/IMChatroom/page/chat/messageEditor/index.jsx +375 -375
- package/src/component/IMChatroom/page/chat/messageList/index.jsx +354 -354
- package/src/component/IMChatroom/page/chat/stickedMessage/index.jsx +59 -59
- package/src/component/IMChatroom/page/chat/stickedMessage/style/index.module.less +7 -7
- package/src/component/IMChatroom/page/chat/style/index.module.less +51 -51
- package/src/component/IMChatroom/page/home/connect/index.jsx +188 -188
- package/src/component/IMChatroom/page/home/connect/status.jsx +124 -124
- package/src/component/IMChatroom/page/home/context/cmd.jsx +37 -37
- package/src/component/IMChatroom/page/home/context/index.jsx +67 -67
- package/src/component/IMChatroom/page/home/index.jsx +164 -164
- package/src/component/IMChatroom/page/home/notice/index.jsx +123 -123
- package/src/component/IMChatroom/page/home/notice/style/index.module.less +49 -49
- package/src/component/IMChatroom/page/home/style/index.module.less +110 -110
- package/src/component/IMChatroom/page/member/index.jsx +15 -15
- package/src/component/IMChatroom/page/member/memberCount/index.jsx +44 -44
- package/src/component/IMChatroom/page/member/memberList/index.jsx +121 -121
- package/src/component/IMChatroom/page/member/style/index.module.less +2 -2
- package/src/component/IMChatroom/sdk/bridge.js +39 -39
- package/src/component/IMChatroom/sdk/cs/constants.js +20 -20
- package/src/component/IMChatroom/sdk/cs/index.js +101 -101
- package/src/component/IMChatroom/sdk/imChatroom.js +15 -15
- package/src/component/IMChatroom/sdk/imcore/constants.js +128 -128
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomDestroyed.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomInfoGetFail.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomKickedByAdmin.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomKickedBySelf.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomLoginFail.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomLoginSuccess.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomMemberLogin.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/chatroomMemberLogout.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/connectionConnected.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/connectionConnecting.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/connectionDisconnect.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/emitters/index.js +57 -57
- package/src/component/IMChatroom/sdk/imcore/emitters/messageReceive.js +36 -36
- package/src/component/IMChatroom/sdk/imcore/index.js +178 -178
- package/src/component/IMChatroom/sdk/imcore/interceptors/request.js +7 -7
- package/src/component/IMChatroom/sdk/imcore/interceptors/response.js +5 -5
- package/src/component/IMChatroom/sdk/imcore/plugins/getAuth.js +64 -64
- package/src/component/IMChatroom/sdk/imcore/plugins/getConversationId.js +20 -20
- package/src/component/IMChatroom/sdk/imcore/plugins/getExtInfo.js +10 -10
- package/src/component/IMChatroom/sdk/imcore/plugins/getLoginInfo.js +48 -48
- package/src/component/IMChatroom/sdk/imcore/plugins/getPlatformType.js +12 -12
- package/src/component/IMChatroom/sdk/imcore/plugins/index.js +22 -22
- package/src/component/IMChatroom/sdk/imcore/util/format.js +177 -177
- package/src/component/IMChatroom/sdk/imcore/util/parser.js +35 -35
- package/src/component/IMChatroom/sdk/oms.js +18 -18
- package/src/component/IMChatroom/sdk/uc.js +3 -3
- package/src/component/IMChatroom/subscription/channel/app.js +5 -5
- package/src/component/IMChatroom/subscription/channel/ctl.js +22 -22
- package/src/component/IMChatroom/subscription/channel/member.js +40 -40
- package/src/component/IMChatroom/subscription/channel/message.js +13 -13
- package/src/component/IMChatroom/subscription/channel/ntf.js +86 -86
- package/src/component/IMChatroom/subscription/channel/tel.js +5 -5
- package/src/component/IMChatroom/subscription/channel/websocket.js +5 -5
- package/src/component/IMChatroom/subscription/event.js +37 -37
- package/src/component/IMChatroom/subscription/index.js +19 -19
- package/src/component/IMChatroom/util/account.js +8 -8
- package/src/component/IMChatroom/util/chatroom.js +255 -255
- package/src/component/IMChatroom/util/jsonBigInt.js +5 -5
- package/src/component/IMChatroom/util/location.js +12 -12
- package/src/component/Icon/index.jsx +16 -16
- package/src/component/Icon/index.module.less +2 -2
- package/src/component/Pagination/LocalPagination.jsx +27 -27
- package/src/component/Pagination/RemotePagination.jsx +32 -32
- package/src/component/Pagination/index.jsx +32 -31
- package/src/component/Pagination/index.module.less +117 -110
- package/src/component/PlayerTip/index.jsx +34 -34
- package/src/component/VideoBase/index.jsx +242 -242
- package/src/component/VideoBase/style.less +65 -65
- package/src/component/VideoBase/utils.js +81 -81
- package/src/component/mixin.less +9 -9
- package/src/component/status/403.jsx +15 -15
- package/src/component/status/404/index.jsx +73 -73
- package/src/component/status/404/index.module.less +36 -36
- package/src/component/status/Error/error.module.less +13 -13
- package/src/component/status/Error/index.jsx +47 -47
- package/src/component/status/Loading/img/loading.svg +52 -52
- package/src/component/status/Loading/index.jsx +31 -31
- package/src/component/status/Loading/index.less +56 -56
- package/src/component/status/None/index.jsx +20 -20
- package/src/component/status/None/index.module.less +35 -35
- package/src/component/status/Status/index.jsx +26 -26
- package/src/component/status/Status/index.module.less +8 -8
- package/src/config/constant/commonUrl.js +2 -2
- package/src/config/constant/user.js +6 -6
- package/src/config/context/site-config.js +48 -48
- package/src/config/env/index.js +5 -5
- package/src/config/env/local/index.js +13 -13
- package/src/config/env/ncet-xedu/api.js +175 -175
- package/src/config/env/ncet-xedu/app.js +12 -12
- package/src/config/env/ncet-xedu/cs.js +8 -8
- package/src/config/env/ncet-xedu/index.js +14 -14
- package/src/config/env/ncet-xedu/push.js +5 -5
- package/src/config/env/preproduction/api.js +144 -144
- package/src/config/env/preproduction/app.js +12 -12
- package/src/config/env/preproduction/cs.js +8 -8
- package/src/config/env/preproduction/index.js +14 -14
- package/src/config/env/preproduction/push.js +5 -5
- package/src/config/env/product/api.js +113 -113
- package/src/config/env/product/app.js +12 -12
- package/src/config/env/product/cs.js +5 -5
- package/src/config/env/product/index.js +14 -14
- package/src/config/env/product/push.js +5 -5
- package/src/config/live.js +80 -80
- package/src/config/publicLive.js +53 -53
- package/src/config/request/assessments.js +24 -24
- package/src/config/request/config-center.js +8 -8
- package/src/config/request/helper.js +166 -166
- package/src/config/request/im-broadcasts.js +12 -12
- package/src/config/request/live-activity-gateway.js +8 -8
- package/src/config/request/live-activity.js +13 -13
- package/src/config/request/raw.js +6 -6
- package/src/config/request/x-cloud-web.js +13 -13
- package/src/config/request/x-proxy.js +34 -34
- package/src/demo/Detail.jsx +11 -11
- package/src/demo/List.jsx +66 -64
- package/src/demo/index.jsx +17 -17
- package/src/detail/LineSwitch/index.jsx +71 -71
- package/src/detail/LiveCountDown/index.jsx +44 -44
- package/src/detail/LiveCountDown/index.module.less +31 -31
- package/src/detail/LiveOnlineCount/img/icon.svg +15 -15
- package/src/detail/LiveOnlineCount/index.jsx +68 -68
- package/src/detail/LiveOnlineCount/index.module.less +34 -34
- package/src/detail/LiveOnlineCount/util.js +74 -74
- package/src/detail/LiveStatus/AnchorOnTheWay.jsx +88 -88
- package/src/detail/LiveStatus/index.jsx +202 -202
- package/src/detail/LiveStatus/index.module.less +192 -192
- package/src/detail/LiveVideo/config.js +37 -37
- package/src/detail/LiveVideo/index.jsx +188 -188
- package/src/detail/LiveVideo/index.module.less +41 -41
- package/src/detail/NotLoginChatroom/index.jsx +37 -37
- package/src/detail/NotLoginChatroom/index.module.less +46 -46
- package/src/detail/RecordVideo/index.jsx +150 -150
- package/src/detail/RecordVideo/index.module.less +31 -31
- package/src/detail/ReplayVideo/index.jsx +93 -93
- package/src/detail/ReplayVideo/index.module.less +65 -65
- package/src/detail/const.js +20 -20
- package/src/detail/hook/usePullSource.js +82 -82
- package/src/detail/hook/usePullState.js +51 -51
- package/src/detail/index.jsx +482 -482
- package/src/detail/index.module.less +188 -188
- package/src/hook/useAsync.js +84 -84
- package/src/hook/useGoToPage.js +83 -83
- package/src/hook/useInterval.js +28 -28
- package/src/hook/useIsMounted.js +17 -17
- package/src/hook/useModuleByRole.js +53 -53
- package/src/hook/usePageScrollable.js +52 -52
- package/src/hook/usePortal.js +83 -83
- package/src/hook/useScrollRestore/index.js +32 -32
- package/src/hook/useScrollRestore/scrollContext.js +20 -20
- package/src/hook/useTrackRef.js +11 -11
- package/src/hook/useWindowSize.js +28 -28
- package/src/hook/useZoom.js +47 -47
- package/src/index.js +10 -10
- package/src/lib/getLiveOnlineCount.js +10 -10
- package/src/lib/getServiceConfig.js +102 -102
- package/src/list/Empty/index.jsx +20 -20
- package/src/list/Empty/index.module.less +23 -23
- package/src/list/ListItem/Action/index.jsx +100 -98
- package/src/list/ListItem/Action/index.module.less +19 -21
- package/src/list/ListItem/img/play.svg +15 -15
- package/src/list/ListItem/img/video.svg +3 -0
- package/src/list/ListItem/index.jsx +46 -28
- package/src/list/ListItem/index.module.less +152 -146
- package/src/list/index.module.less +35 -35
- package/src/service/common.js +73 -73
- package/src/service/content-mgr.js +73 -73
- package/src/service/im-group.js +12 -12
- package/src/service/im.js +7 -7
- package/src/service/imBroadcasts.js +33 -33
- package/src/service/like.js +134 -134
- package/src/service/manageApi.js +7 -7
- package/src/service/managePortal.js +6 -6
- package/src/service/myStudyRecord.js +93 -93
- package/src/service/navigation.js +47 -47
- package/src/service/ndMeeting.js +10 -10
- package/src/service/ndr.js +122 -122
- package/src/service/news.js +93 -93
- package/src/service/personalCenter.js +270 -270
- package/src/service/qualityCourse.js +31 -31
- package/src/service/recommend.js +81 -81
- package/src/service/school.js +323 -323
- package/src/service/search.js +170 -170
- package/src/service/site-config.js +7 -7
- package/src/service/socialCensor.js +45 -45
- package/src/service/specialEdu.js +31 -31
- package/src/service/suggestion.js +85 -85
- package/src/service/syncClassroom.js +321 -321
- package/src/service/tCourse.js +204 -204
- package/src/service/tchTraining.js +37 -37
- package/src/service/uc.js +45 -45
- package/src/util/app.js +1 -1
- package/src/util/array.js +3 -3
- package/src/util/auth/func.js +57 -57
- package/src/util/date.js +53 -53
- package/src/util/env.js +9 -9
- package/src/util/getTimestamp.js +10 -10
- package/src/util/hof.js +105 -105
- package/src/util/live/index.js +42 -42
- package/src/util/netUrl.js +35 -35
- package/src/util/object.js +13 -13
- package/src/util/push/index.js +58 -58
- package/src/util/request.js +227 -227
- package/src/util/type.js +17 -17
- package/src/util/url.js +203 -203
- package/src/util/video.js +26 -26
- package/test/setup.js +21 -21
- package/test/unit/component/header/logo.spec.jsx +8 -8
- package/test/unit/helper.jsx +25 -25
- package/test/unit/util/date.spec.js +40 -40
- package/dist/XEduLivePlayer.common.js +0 -72605
- package/dist/XEduLivePlayerPre.common.js +0 -72625
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).webImPush=t()}(this,(function(){"use strict";var WORD_MASK=[0,255,65535,16777215,4294967295];function copyBytes$1(e,t,n,r,i){var o;for(o=0;o<i;o++)n[r+o]=e[t+o]}function selfCopyBytes(e,t,n,r){var i;for(i=0;i<r;i++)e[t+i]=e[t-n+i]}function SnappyDecompressor$1(e){this.array=e,this.pos=0}SnappyDecompressor$1.prototype.readUncompressedLength=function(){for(var e,t,n=0,r=0;r<32&&this.pos<this.array.length;){if(e=this.array[this.pos],this.pos+=1,(t=127&e)<<r>>>r!==t)return-1;if(n|=t<<r,e<128)return n;r+=7}return-1},SnappyDecompressor$1.prototype.uncompressToBuffer=function(e){for(var t,n,r,i,o=this.array,s=o.length,a=this.pos,u=0;a<o.length;)if(t=o[a],a+=1,0==(3&t)){if((n=1+(t>>>2))>60){if(a+3>=s)return!1;r=n-60,n=1+((n=o[a]+(o[a+1]<<8)+(o[a+2]<<16)+(o[a+3]<<24))&WORD_MASK[r]),a+=r}if(a+n>s)return!1;copyBytes$1(o,a,e,u,n),a+=n,u+=n}else{switch(3&t){case 1:n=4+(t>>>2&7),i=o[a]+(t>>>5<<8),a+=1;break;case 2:if(a+1>=s)return!1;n=1+(t>>>2),i=o[a]+(o[a+1]<<8),a+=2;break;case 3:if(a+3>=s)return!1;n=1+(t>>>2),i=o[a]+(o[a+1]<<8)+(o[a+2]<<16)+(o[a+3]<<24),a+=4}if(0===i||i>u)return!1;selfCopyBytes(e,u,i,n),u+=n}return!0};var SnappyDecompressor_1=SnappyDecompressor$1,snappy_decompressor={SnappyDecompressor:SnappyDecompressor_1},BLOCK_LOG=16,BLOCK_SIZE=1<<BLOCK_LOG,MAX_HASH_TABLE_BITS=14,globalHashTables=new Array(MAX_HASH_TABLE_BITS+1);function hashFunc(e,t){return 506832829*e>>>t}function load32(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24)}function equals32(e,t,n){return e[t]===e[n]&&e[t+1]===e[n+1]&&e[t+2]===e[n+2]&&e[t+3]===e[n+3]}function copyBytes(e,t,n,r,i){var o;for(o=0;o<i;o++)n[r+o]=e[t+o]}function emitLiteral(e,t,n,r,i){return n<=60?(r[i]=n-1<<2,i+=1):n<256?(r[i]=240,r[i+1]=n-1,i+=2):(r[i]=244,r[i+1]=n-1&255,r[i+2]=n-1>>>8,i+=3),copyBytes(e,t,r,i,n),i+n}function emitCopyLessThan64(e,t,n,r){return r<12&&n<2048?(e[t]=1+(r-4<<2)+(n>>>8<<5),e[t+1]=255&n,t+2):(e[t]=2+(r-1<<2),e[t+1]=255&n,e[t+2]=n>>>8,t+3)}function emitCopy(e,t,n,r){for(;r>=68;)t=emitCopyLessThan64(e,t,n,64),r-=64;return r>64&&(t=emitCopyLessThan64(e,t,n,60),r-=60),emitCopyLessThan64(e,t,n,r)}function compressFragment(e,t,n,r,i){for(var o=1;1<<o<=n&&o<=MAX_HASH_TABLE_BITS;)o+=1;var s=32-(o-=1);void 0===globalHashTables[o]&&(globalHashTables[o]=new Uint16Array(1<<o));var a,u=globalHashTables[o];for(a=0;a<u.length;a++)u[a]=0;var l,f,c,h,p,d,y,g,m,v,b=t+n,w=t,S=t,O=!0;if(n>=15)for(l=b-15,c=hashFunc(load32(e,t+=1),s);O;){d=32,h=t;do{if(f=c,y=d>>>5,d+=1,h=(t=h)+y,t>l){O=!1;break}c=hashFunc(load32(e,h),s),p=w+u[f],u[f]=t-w}while(!equals32(e,t,p));if(!O)break;i=emitLiteral(e,S,t-S,r,i);do{for(g=t,m=4;t+m<b&&e[t+m]===e[p+m];)m+=1;if(t+=m,i=emitCopy(r,i,g-p,m),S=t,t>=l){O=!1;break}u[hashFunc(load32(e,t-1),s)]=t-1-w,p=w+u[v=hashFunc(load32(e,t),s)],u[v]=t-w}while(equals32(e,t,p));if(!O)break;c=hashFunc(load32(e,t+=1),s)}return S<b&&(i=emitLiteral(e,S,b-S,r,i)),i}function putVarint(e,t,n){do{t[n]=127&e,(e>>>=7)>0&&(t[n]+=128),n+=1}while(e>0);return n}function SnappyCompressor$1(e){this.array=e}SnappyCompressor$1.prototype.maxCompressedLength=function(){var e=this.array.length;return 32+e+Math.floor(e/6)},SnappyCompressor$1.prototype.compressToBuffer=function(e){var t,n=this.array,r=n.length,i=0,o=0;for(o=putVarint(r,e,o);i<r;)o=compressFragment(n,i,t=Math.min(r-i,BLOCK_SIZE),e,o),i+=t;return o};var SnappyCompressor_1=SnappyCompressor$1,snappy_compressor={SnappyCompressor:SnappyCompressor_1};function isNode(){return"object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node}function isUint8Array(e){return e instanceof Uint8Array&&(!isNode()||!Buffer.isBuffer(e))}function isArrayBuffer(e){return e instanceof ArrayBuffer}function isBuffer(e){return!!isNode()&&Buffer.isBuffer(e)}var SnappyDecompressor=snappy_decompressor.SnappyDecompressor,SnappyCompressor=snappy_compressor.SnappyCompressor,TYPE_ERROR_MSG="Argument compressed must be type of ArrayBuffer, Buffer, or Uint8Array";function uncompress(e){if(!isUint8Array(e)&&!isArrayBuffer(e)&&!isBuffer(e))throw new TypeError(TYPE_ERROR_MSG);var t=!1,n=!1;isUint8Array(e)?t=!0:isArrayBuffer(e)&&(n=!0,e=new Uint8Array(e));var r,i,o=new SnappyDecompressor(e),s=o.readUncompressedLength();if(-1===s)throw new Error("Invalid Snappy bitstream");if(t){if(r=new Uint8Array(s),!o.uncompressToBuffer(r))throw new Error("Invalid Snappy bitstream")}else if(n){if(r=new ArrayBuffer(s),i=new Uint8Array(r),!o.uncompressToBuffer(i))throw new Error("Invalid Snappy bitstream")}else if(r=Buffer.alloc(s),!o.uncompressToBuffer(r))throw new Error("Invalid Snappy bitstream");return r}function compress(e){if(!isUint8Array(e)&&!isArrayBuffer(e)&&!isBuffer(e))throw new TypeError(TYPE_ERROR_MSG);var t=!1,n=!1;isUint8Array(e)?t=!0:isArrayBuffer(e)&&(n=!0,e=new Uint8Array(e));var r,i,o,s=new SnappyCompressor(e),a=s.maxCompressedLength();return t?(r=new Uint8Array(a),o=s.compressToBuffer(r)):n?(r=new ArrayBuffer(a),i=new Uint8Array(r),o=s.compressToBuffer(i)):(r=Buffer.alloc(a),o=s.compressToBuffer(r)),r.slice(0,o)}var uncompress_1=uncompress,compress_1=compress,snappyjs={uncompress:uncompress_1,compress:compress_1},proto={nested:{push:{nested:{Errors:{values:{EC_RPC_OK:0,EC_RPC_PARSE_ERROR:-32700,EC_RPC_INVALID_REQUEST:-32600,EC_RPC_METHOD_NOT_FOUND:-32601,EC_RPC_INVALID_PARAMS:-32602,EC_RPC_INTERNAL_ERROR:-32603,EC_RPC_NO_PERMISSION:-32604,EC_RPC_REQUEST_TIMEOUT:-32605,EC_RPC_APPLICATION_ERROR:-32500,EC_RPC_TRANSPORT_ERROR:-32300}},OP:{values:{OP_NOOP:0,OP_REQUEST:1,OP_RESPONSE:2,OP_HEARTBEAT:3,OP_HEARTBEAT_ACK:4,OP_PING:10,OP_PONG:11,OP_ADDR:12}},RequestMsg:{fields:{methodId:{type:"sint32",id:1},seq:{type:"uint32",id:2},data:{type:"bytes",id:10}}},ResponseMsg:{fields:{seq:{type:"uint32",id:1},errCode:{type:"sint32",id:3},errMsg:{type:"string",id:4},data:{type:"bytes",id:10}}},Body:{fields:{crypto:{type:"Crypto",id:1},msgs:{rule:"repeated",type:"bytes",id:10}},nested:{Crypto:{values:{NONE:0,TEA:1}}}},PshMessageType:{values:{MessageType_Notification:0,MessageType_Message:1}},PshPlatform:{values:{Platform_Unknown:0,Platform_Android:1,Platform_iOS:2,Platform_WP:4,Platform_WEB:8,Platform_PC:16,Platform_Chrome:32,Platform_WeiXin:128}},PshMsgData:{fields:{msgType:{type:"PshMessageType",id:1},compression:{type:"Compression",id:2},msgTime:{type:"uint64",id:3},contentType:{type:"string",id:10},content:{type:"bytes",id:11},extraFields:{keyType:"string",type:"string",id:20}},nested:{Compression:{values:{NONE:0,SNAPPY:1}}}},PshDispatchedMsg:{fields:{msgId:{type:"uint64",id:2},msgTime:{type:"uint64",id:3},senderUid:{type:"string",id:4},flag:{type:"uint32",id:5},clientMsgToken:{type:"string",id:7},topic:{type:"string",id:18},msgData:{type:"bytes",id:20},ttl:{type:"uint64",id:30},useBroadcastInbox:{type:"bool",id:31}}},MethodID:{values:{METHOD_NONE:0,METHOD_LOGIN:1,METHOD_LOGOUT:2,METHOD_RELOGIN:3,METHOD_REGISTER_DEVICE:4,METHOD_ACKMSG:17,METHOD_SET_ALIAS:56,METHOD_CLEAR_ALIAS:57,METHOD_SUBSCRIBE:64,METHOD_UNSUBSCRIBE:65,METHOD_UNSUBSCRIBE_ALL:66,METHOD_PUBLISH:68,METHOD_SEND_UPSTREAM_MSG:80,METHOD_NEWMSG_NOTIFY:4096,METHOD_SESSION_BROKEN_NOTIFY:4368,METHOD_SESSION_REPLACED_NOTIFY:4369}},RegisterDeviceReq:{fields:{devInfo:{type:"DevInfo",id:1},appId:{type:"string",id:2}},nested:{DevInfo:{fields:{platform:{type:"int32",id:2},uuid:{type:"string",id:20}}}}},RegisterDeviceResp:{fields:{devToken:{type:"string",id:1}}},LoginReq:{fields:{appId:{type:"string",id:1},devToken:{type:"string",id:2},lastMsgId:{type:"uint64",id:3},sdkVer:{type:"string",id:7},sdkDesc:{type:"string",id:9},cryptoKey:{type:"bytes",id:10},platform:{type:"int32",id:20},serverOptions:{type:"ServerOptions",id:50},appKeyHash:{type:"string",id:100}},nested:{ServerOptions:{values:{UNSET:0,CLEAN_SESSION:5},fields:{options:{keyType:"int32",type:"int32",id:1}}}}},LoginResp:{fields:{session:{type:"string",id:5}}},ReloginReq:{fields:{appId:{type:"string",id:1},devToken:{type:"string",id:2},session:{type:"string",id:5},cryptoKey:{type:"string",id:10},appKeyHash:{type:"string",id:100}}},ReloginResp:{fields:{session:{type:"string",id:5}}},LogoutReq:{fields:{}},AckMsgReq:{fields:{msgIds:{rule:"repeated",type:"uint64",id:1},broadcastMsgIds:{rule:"repeated",type:"uint64",id:2}}},SetAliasReq:{fields:{alias:{type:"string",id:1}}},ClearAliasReq:{fields:{}},NewMsgNoti:{fields:{msgs:{rule:"repeated",type:"bytes",id:10}}},SubscribeReq:{fields:{topicFilters:{keyType:"string",type:"int32",id:1}}},UnsubscribeReq:{fields:{topicFilters:{rule:"repeated",type:"string",id:1}}},UnsubscribeAllReq:{fields:{}},PublishReq:{fields:{topic:{type:"string",id:1},content:{type:"bytes",id:2},clientMsgToken:{type:"string",id:7},flag:{type:"int32",id:10},ttl:{type:"uint64",id:11},compression:{type:"uint32",id:20}}},PublishResp:{fields:{msgId:{type:"uint64",id:1}}},SendUpstreamMsgReq:{fields:{clientMsgToken:{type:"string",id:1},ttl:{type:"uint64",id:2},contentType:{type:"string",id:10},content:{type:"string",id:11},extraHeaders:{keyType:"string",type:"string",id:20}}}}}}},commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return commonjsRequire(e,null==t?n.path:t)}},n.exports),n.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var protobuf=createCommonjsModule((function(module){
|
|
2
|
-
/*!
|
|
3
|
-
* protobuf.js v6.11.0 (c) 2016, daniel wirtz
|
|
4
|
-
* compiled thu, 29 apr 2021 02:20:44 utc
|
|
5
|
-
* licensed under the bsd-3-clause license
|
|
6
|
-
* see: https://github.com/dcodeio/protobuf.js for details
|
|
7
|
-
*/
|
|
8
|
-
(function(undefined$1){!function(e,t,n){var r=function n(r){var i=t[r];return i||e[r][0].call(i=t[r]={exports:{}},n,i,i.exports),i.exports}(n[0]);r.util.global.protobuf=r,"function"==typeof undefined$1&&undefined$1.amd&&undefined$1(["long"],(function(e){return e&&e.isLong&&(r.util.Long=e,r.configure()),r})),module&&module.exports&&(module.exports=r)}({1:[function(e,t,n){t.exports=function(e,t){var n=new Array(arguments.length-1),r=0,i=2,o=!0;for(;i<arguments.length;)n[r++]=arguments[i++];return new Promise((function(i,s){n[r]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];i.apply(null,t)}};try{e.apply(t||null,n)}catch(e){o&&(o=!1,s(e))}}))}},{}],2:[function(e,t,n){var r=n;r.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var i=new Array(64),o=new Array(123),s=0;s<64;)o[i[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(e,t,n){for(var r,o=null,s=[],a=0,u=0;t<n;){var l=e[t++];switch(u){case 0:s[a++]=i[l>>2],r=(3&l)<<4,u=1;break;case 1:s[a++]=i[r|l>>4],r=(15&l)<<2,u=2;break;case 2:s[a++]=i[r|l>>6],s[a++]=i[63&l],u=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return u&&(s[a++]=i[r],s[a++]=61,1===u&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var a="invalid encoding";r.decode=function(e,t,n){for(var r,i=n,s=0,u=0;u<e.length;){var l=e.charCodeAt(u++);if(61===l&&s>1)break;if((l=o[l])===undefined$1)throw Error(a);switch(s){case 0:r=l,s=1;break;case 1:t[n++]=r<<2|(48&l)>>4,r=l,s=2;break;case 2:t[n++]=(15&r)<<4|(60&l)>>2,r=l,s=3;break;case 3:t[n++]=(3&r)<<6|l,s=0}}if(1===s)throw Error(a);return n-i},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},{}],3:[function(e,t,n){function r(e,t){"string"==typeof e&&(t=e,e=undefined$1);var n=[];function i(e){if("string"!=typeof e){var t=o();if(r.verbose&&console.log("codegen: "+t),t="return "+t,e){for(var s=Object.keys(e),a=new Array(s.length+1),u=new Array(s.length),l=0;l<s.length;)a[l]=s[l],u[l]=e[s[l++]];return a[l]=t,Function.apply(null,a).apply(null,u)}return Function(t)()}for(var f=new Array(arguments.length-1),c=0;c<f.length;)f[c]=arguments[++c];if(c=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var n=f[c++];switch(t){case"d":case"f":return String(Number(n));case"i":return String(Math.floor(n));case"j":return JSON.stringify(n);case"s":return String(n)}return"%"})),c!==f.length)throw Error("parameter count mismatch");return n.push(e),i}function o(r){return"function "+(r||t||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return i.toString=o,i}t.exports=r,r.verbose=!1},{}],4:[function(e,t,n){function r(){this._listeners={}}t.exports=r,r.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},r.prototype.off=function(e,t){if(e===undefined$1)this._listeners={};else if(t===undefined$1)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},r.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}},{}],5:[function(e,t,n){t.exports=o;var r=e(1),i=e(7)("fs");function o(e,t,n){return"function"==typeof t?(n=t,t={}):t||(t={}),n?!t.xhr&&i&&i.readFile?i.readFile(e,(function(r,i){return r&&"undefined"!=typeof XMLHttpRequest?o.xhr(e,t,n):r?n(r):n(null,t.binary?i:i.toString("utf8"))})):o.xhr(e,t,n):r(o,this,e,t)}o.xhr=function(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4!==r.readyState)return undefined$1;if(0!==r.status&&200!==r.status)return n(Error("status "+r.status));if(t.binary){var e=r.response;if(!e){e=[];for(var i=0;i<r.responseText.length;++i)e.push(255&r.responseText.charCodeAt(i))}return n(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return n(null,r.responseText)},t.binary&&("overrideMimeType"in r&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.responseType="arraybuffer"),r.open("GET",e),r.send()}},{1:1,7:7}],6:[function(e,t,n){function r(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function o(e,r,i){t[0]=e,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function a(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?i:o,e.writeFloatBE=r?o:i,e.readFloatLE=r?s:a,e.readFloatBE=r?a:s}():function(){function t(e,t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,r)}}function n(e,t,n){var r=e(t,n),i=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,o),e.readFloatLE=n.bind(null,s),e.readFloatBE=n.bind(null,a)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function a(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:o,e.writeDoubleBE=r?o:i,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,n,r,i,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,i,o+t),e(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))e(0,i,o+t),e(2146959360,i,o+n);else if(r>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+n);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+n);else{var u=Math.floor(Math.log(r)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(a=r*Math.pow(2,-u))>>>0,i,o+t),e((s<<31|u+1023<<20|1048576*a&1048575)>>>0,i,o+n)}}}function n(e,t,n,r,i){var o=e(r,i+t),s=e(r,i+n),a=2*(s>>31)+1,u=s>>>20&2047,l=4294967296*(1048575&s)+o;return 2047===u?l?NaN:a*(1/0):0===u?5e-324*a*l:a*Math.pow(2,u-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,o,4,0),e.readDoubleLE=n.bind(null,s,0,4),e.readDoubleBE=n.bind(null,a,4,0)}(),e}function i(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function o(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function s(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}t.exports=r(r)},{}],7:[function(require,module,exports){function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],8:[function(e,t,n){var r=n,i=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},o=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=i(e),r="";n&&(r=t.shift()+"/");for(var o=0;o<t.length;)".."===t[o]?o>0&&".."!==t[o-1]?t.splice(--o,2):n?t.splice(o,1):++o:"."===t[o]?t.splice(o,1):++o;return r+t.join("/")};r.resolve=function(e,t,n){return n||(t=o(t)),i(t)?t:(n||(e=o(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?o(e+"/"+t):t)}},{}],9:[function(e,t,n){t.exports=function(e,t,n){var r=n||8192,i=r>>>1,o=null,s=r;return function(n){if(n<1||n>i)return e(n);s+n>r&&(o=e(r),s=0);var a=t.call(o,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},{}],10:[function(e,t,n){var r=n;r.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},r.read=function(e,t,n){if(n-t<1)return"";for(var r,i=null,o=[],s=0;t<n;)(r=e[t++])<128?o[s++]=r:r>191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},r.write=function(e,t,n){for(var r,i,o=n,s=0;s<e.length;++s)(r=e.charCodeAt(s))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&i),++s,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}},{}],11:[function(e,t,n){var r=n,i=e(14),o=e(33);function s(e,t,n,r){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",r);for(var o=t.resolvedType.values,s=Object.keys(o),a=0;a<s.length;++a)t.repeated&&o[s[a]]===t.typeDefault&&e("default:"),e("case%j:",s[a])("case %i:",o[s[a]])("m%s=%j",r,o[s[a]])("break");e("}")}else e('if(typeof d%s!=="object")',r)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",r,n,r);else{var u=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",r,r);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",r,r);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",r,r);break;case"uint64":u=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",r,r,u)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,u?"true":"");break;case"bytes":e('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length)",r)("m%s=d%s",r,r);break;case"string":e("m%s=String(d%s)",r,r);break;case"bool":e("m%s=Boolean(d%s)",r,r)}}return e}function a(e,t,n,r){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",r,n,r,r):e("d%s=types[%i].toObject(m%s,o)",r,n,r);else{var o=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",r,r,r,r,o?"true":"",r);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",r,r,r,r,r);break;default:e("d%s=m%s",r,r)}}return e}r.fromObject=function(e){var t=e.fieldsArray,n=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return n("return new this.ctor");n("var m=new this.ctor");for(var r=0;r<t.length;++r){var a=t[r].resolve(),u=o.safeProp(a.name);a.map?(n("if(d%s){",u)('if(typeof d%s!=="object")',u)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",u)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",u),s(n,a,r,u+"[ks[i]]")("}")("}")):a.repeated?(n("if(d%s){",u)("if(!Array.isArray(d%s))",u)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",u)("for(var i=0;i<d%s.length;++i){",u),s(n,a,r,u+"[i]")("}")("}")):(a.resolvedType instanceof i||n("if(d%s!=null){",u),s(n,a,r,u),a.resolvedType instanceof i||n("}"))}return n("return m")},r.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);if(!t.length)return o.codegen()("return {}");for(var n=o.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),r=[],s=[],u=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?r:t[l].map?s:u).push(t[l]);if(r.length){for(n("if(o.arrays||o.defaults){"),l=0;l<r.length;++l)n("d%s=[]",o.safeProp(r[l].name));n("}")}if(s.length){for(n("if(o.objects||o.defaults){"),l=0;l<s.length;++l)n("d%s={}",o.safeProp(s[l].name));n("}")}if(u.length){for(n("if(o.defaults){"),l=0;l<u.length;++l){var f=u[l],c=o.safeProp(f.name);if(f.resolvedType instanceof i)n("d%s=o.enums===String?%j:%j",c,f.resolvedType.valuesById[f.typeDefault],f.typeDefault);else if(f.long)n("if(util.Long){")("var n=new util.Long(%i,%i,%j)",f.typeDefault.low,f.typeDefault.high,f.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",c)("}else")("d%s=o.longs===String?%j:%i",c,f.typeDefault.toString(),f.typeDefault.toNumber());else if(f.bytes){var h="["+Array.prototype.slice.call(f.typeDefault).join(",")+"]";n("if(o.bytes===String)d%s=%j",c,String.fromCharCode.apply(String,f.typeDefault))("else{")("d%s=%s",c,h)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",c,c)("}")}else n("d%s=%j",c,f.typeDefault)}n("}")}var p=!1;for(l=0;l<t.length;++l){f=t[l];var d=e._fieldsArray.indexOf(f);c=o.safeProp(f.name);f.map?(p||(p=!0,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",c,c)("d%s={}",c)("for(var j=0;j<ks2.length;++j){"),a(n,f,d,c+"[ks2[j]]")("}")):f.repeated?(n("if(m%s&&m%s.length){",c,c)("d%s=[]",c)("for(var j=0;j<m%s.length;++j){",c),a(n,f,d,c+"[j]")("}")):(n("if(m%s!=null&&m.hasOwnProperty(%j)){",c,f.name),a(n,f,d,c),f.partOf&&n("if(o.oneofs)")("d%s=%j",o.safeProp(f.partOf.name),f.name)),n("}")}return n("return d")}},{14:14,33:33}],12:[function(e,t,n){t.exports=function(e){var t=o.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var n=0;n<e.fieldsArray.length;++n){var a=e._fieldsArray[n].resolve(),u=a.resolvedType instanceof r?"int32":a.type,l="m"+o.safeProp(a.name);t("case %i:",a.id),a.map?(t("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),i.defaults[a.keyType]!==undefined$1?t("k=%j",i.defaults[a.keyType]):t("k=null"),i.defaults[u]!==undefined$1?t("value=%j",i.defaults[u]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),i.basic[u]===undefined$1?t("value=types[%i].decode(r,r.uint32())",n):t("value=r.%s()",u),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),i.long[a.keyType]!==undefined$1?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),i.packed[u]!==undefined$1&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,u)("}else"),i.basic[u]===undefined$1?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,n):t("%s.push(r.%s())",l,u)):i.basic[u]===undefined$1?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,n):t("%s=r.%s()",l,u),t("break")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),n=0;n<e._fieldsArray.length;++n){var f=e._fieldsArray[n];f.required&&t("if(!m.hasOwnProperty(%j))",f.name)("throw util.ProtocolError(%j,{instance:m})",s(f))}return t("return m")};var r=e(14),i=e(32),o=e(33);function s(e){return"missing required '"+e.name+"'"}},{14:14,32:32,33:33}],13:[function(e,t,n){t.exports=function(e){for(var t,n=o.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(o.compareFieldsById),u=0;u<a.length;++u){var l=a[u].resolve(),f=e._fieldsArray.indexOf(l),c=l.resolvedType instanceof r?"int32":l.type,h=i.basic[c];t="m"+o.safeProp(l.name),l.map?(n("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|i.mapKey[l.keyType],l.keyType),h===undefined$1?n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",f,t):n(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|h,c,t),n("}")("}")):l.repeated?(n("if(%s!=null&&%s.length){",t,t),l.packed&&i.packed[c]!==undefined$1?n("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",c,t)("w.ldelim()"):(n("for(var i=0;i<%s.length;++i)",t),h===undefined$1?s(n,l,f,t+"[i]"):n("w.uint32(%i).%s(%s[i])",(l.id<<3|h)>>>0,c,t)),n("}")):(l.optional&&n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),h===undefined$1?s(n,l,f,t):n("w.uint32(%i).%s(%s)",(l.id<<3|h)>>>0,c,t))}return n("return w")};var r=e(14),i=e(32),o=e(33);function s(e,t,n,r){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",n,r,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",n,r,(t.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(e,t,n){t.exports=s;var r=e(22);((s.prototype=Object.create(r.prototype)).constructor=s).className="Enum";var i=e(21),o=e(33);function s(e,t,n,i,o){if(r.call(this,e,n),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=o||{},this.reserved=undefined$1,t)for(var s=Object.keys(t),a=0;a<s.length;++a)"number"==typeof t[s[a]]&&(this.valuesById[this.values[s[a]]=t[s[a]]]=s[a])}s.fromJSON=function(e,t){var n=new s(e,t.values,t.options,t.comment,t.comments);return n.reserved=t.reserved,n},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:undefined$1,"comment",t?this.comment:undefined$1,"comments",t?this.comments:undefined$1])},s.prototype.add=function(e,t,n){if(!o.isString(e))throw TypeError("name must be a string");if(!o.isInteger(t))throw TypeError("id must be an integer");if(this.values[e]!==undefined$1)throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(this.valuesById[t]!==undefined$1){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=n||null,this},s.prototype.remove=function(e){if(!o.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},s.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},s.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)}},{21:21,22:22,33:33}],15:[function(e,t,n){t.exports=l;var r=e(22);((l.prototype=Object.create(r.prototype)).constructor=l).className="Field";var i,o=e(14),s=e(32),a=e(33),u=/^required|optional|repeated$/;function l(e,t,n,i,o,l,f){if(a.isObject(i)?(f=o,l=i,i=o=undefined$1):a.isObject(o)&&(f=l,l=o,o=undefined$1),r.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(n))throw TypeError("type must be a string");if(i!==undefined$1&&!u.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(o!==undefined$1&&!a.isString(o))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:undefined$1,this.type=n,this.id=t,this.extend=o||undefined$1,this.required="required"===i,this.optional=!this.required,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&s.long[n]!==undefined$1,this.bytes="bytes"===n,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=f}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,n){return"packed"===e&&(this._packed=null),r.prototype.setOption.call(this,e,t,n)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||undefined$1,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:undefined$1])},l.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=s.defaults[this.type])===undefined$1&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(this.options.packed===undefined$1||!this.resolvedType||this.resolvedType instanceof o)||delete this.options.packed,Object.keys(this.options).length||(this.options=undefined$1)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),r.prototype.resolve.call(this)},l.d=function(e,t,n,r){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(i,o){a.decorateType(i.constructor).add(new l(o,e,t,n,{default:r}))}},l._configure=function(e){i=e}},{14:14,22:22,32:32,33:33}],16:[function(e,t,n){var r=t.exports=e(17);r.build="light",r.load=function(e,t,n){return"function"==typeof t?(n=t,t=new r.Root):t||(t=new r.Root),t.load(e,n)},r.loadSync=function(e,t){return t||(t=new r.Root),t.loadSync(e)},r.encoder=e(13),r.decoder=e(12),r.verifier=e(36),r.converter=e(11),r.ReflectionObject=e(22),r.Namespace=e(21),r.Root=e(26),r.Enum=e(14),r.Type=e(31),r.Field=e(15),r.OneOf=e(23),r.MapField=e(18),r.Service=e(30),r.Method=e(20),r.Message=e(19),r.wrappers=e(37),r.types=e(32),r.util=e(33),r.ReflectionObject._configure(r.Root),r.Namespace._configure(r.Type,r.Service,r.Enum),r.Root._configure(r.Type),r.Field._configure(r.Type)},{11:11,12:12,13:13,14:14,15:15,17:17,18:18,19:19,20:20,21:21,22:22,23:23,26:26,30:30,31:31,32:32,33:33,36:36,37:37}],17:[function(e,t,n){var r=n;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=e(38),r.BufferWriter=e(39),r.Reader=e(24),r.BufferReader=e(25),r.util=e(35),r.rpc=e(28),r.roots=e(27),r.configure=i,i()},{24:24,25:25,27:27,28:28,35:35,38:38,39:39}],18:[function(e,t,n){t.exports=s;var r=e(15);((s.prototype=Object.create(r.prototype)).constructor=s).className="MapField";var i=e(32),o=e(33);function s(e,t,n,i,s,a){if(r.call(this,e,t,i,undefined$1,undefined$1,s,a),!o.isString(n))throw TypeError("keyType must be a string");this.keyType=n,this.resolvedKeyType=null,this.map=!0}s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:undefined$1])},s.prototype.resolve=function(){if(this.resolved)return this;if(i.mapKey[this.keyType]===undefined$1)throw Error("invalid key type: "+this.keyType);return r.prototype.resolve.call(this)},s.d=function(e,t,n){return"function"==typeof n?n=o.decorateType(n).name:n&&"object"==typeof n&&(n=o.decorateEnum(n).name),function(r,i){o.decorateType(r.constructor).add(new s(i,e,t,n))}}},{15:15,32:32,33:33}],19:[function(e,t,n){t.exports=i;var r=e(35);function i(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)this[t[n]]=e[t[n]]}i.create=function(e){return this.$type.create(e)},i.encode=function(e,t){return this.$type.encode(e,t)},i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},i.decode=function(e){return this.$type.decode(e)},i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},i.verify=function(e){return this.$type.verify(e)},i.fromObject=function(e){return this.$type.fromObject(e)},i.toObject=function(e,t){return this.$type.toObject(e,t)},i.prototype.toJSON=function(){return this.$type.toObject(this,r.toJSONOptions)}},{35:35}],20:[function(e,t,n){t.exports=o;var r=e(22);((o.prototype=Object.create(r.prototype)).constructor=o).className="Method";var i=e(33);function o(e,t,n,o,s,a,u,l,f){if(i.isObject(s)?(u=s,s=a=undefined$1):i.isObject(a)&&(u=a,a=undefined$1),t!==undefined$1&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(n))throw TypeError("requestType must be a string");if(!i.isString(o))throw TypeError("responseType must be a string");r.call(this,e,u),this.type=t||"rpc",this.requestType=n,this.requestStream=!!s||undefined$1,this.responseType=o,this.responseStream=!!a||undefined$1,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=f}o.fromJSON=function(e,t){return new o(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||undefined$1,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:undefined$1,"parsedOptions",this.parsedOptions])},o.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),r.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(e,t,n){t.exports=f;var r=e(22);((f.prototype=Object.create(r.prototype)).constructor=f).className="Namespace";var i,o,s,a=e(15),u=e(33);function l(e,t){if(!e||!e.length)return undefined$1;for(var n={},r=0;r<e.length;++r)n[e[r].name]=e[r].toJSON(t);return n}function f(e,t){r.call(this,e,t),this.nested=undefined$1,this._nestedArray=null}function c(e){return e._nestedArray=null,e}f.fromJSON=function(e,t){return new f(e,t.options).addJSON(t.nested)},f.arrayToJSON=l,f.isReservedId=function(e,t){if(e)for(var n=0;n<e.length;++n)if("string"!=typeof e[n]&&e[n][0]<=t&&e[n][1]>t)return!0;return!1},f.isReservedName=function(e,t){if(e)for(var n=0;n<e.length;++n)if(e[n]===t)return!0;return!1},Object.defineProperty(f.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=u.toArray(this.nested))}}),f.prototype.toJSON=function(e){return u.toObject(["options",this.options,"nested",l(this.nestedArray,e)])},f.prototype.addJSON=function(e){if(e)for(var t,n=Object.keys(e),r=0;r<n.length;++r)t=e[n[r]],this.add((t.fields!==undefined$1?i.fromJSON:t.values!==undefined$1?s.fromJSON:t.methods!==undefined$1?o.fromJSON:t.id!==undefined$1?a.fromJSON:f.fromJSON)(n[r],t));return this},f.prototype.get=function(e){return this.nested&&this.nested[e]||null},f.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof s)return this.nested[e].values;throw Error("no such enum: "+e)},f.prototype.add=function(e){if(!(e instanceof a&&e.extend!==undefined$1||e instanceof i||e instanceof s||e instanceof o||e instanceof f))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof f&&e instanceof f)||t instanceof i||t instanceof o)throw Error("duplicate name '"+e.name+"' in "+this);for(var n=t.nestedArray,r=0;r<n.length;++r)e.add(n[r]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),c(this)},f.prototype.remove=function(e){if(!(e instanceof r))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=undefined$1),e.onRemove(this),c(this)},f.prototype.define=function(e,t){if(u.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var n=this;e.length>0;){var r=e.shift();if(n.nested&&n.nested[r]){if(!((n=n.nested[r])instanceof f))throw Error("path conflicts with non-namespace objects")}else n.add(n=new f(r))}return t&&n.addJSON(t),n},f.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof f?e[t++].resolveAll():e[t++].resolve();return this.resolve()},f.prototype.lookup=function(e,t,n){if("boolean"==typeof t?(n=t,t=undefined$1):t&&!Array.isArray(t)&&(t=[t]),u.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var r=this.get(e[0]);if(r){if(1===e.length){if(!t||t.indexOf(r.constructor)>-1)return r}else if(r instanceof f&&(r=r.lookup(e.slice(1),t,!0)))return r}else for(var i=0;i<this.nestedArray.length;++i)if(this._nestedArray[i]instanceof f&&(r=this._nestedArray[i].lookup(e,t,!0)))return r;return null===this.parent||n?null:this.parent.lookup(e,t)},f.prototype.lookupType=function(e){var t=this.lookup(e,[i]);if(!t)throw Error("no such type: "+e);return t},f.prototype.lookupEnum=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},f.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[i,s]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},f.prototype.lookupService=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},f._configure=function(e,t,n){i=e,o=t,s=n}},{15:15,22:22,33:33}],22:[function(e,t,n){t.exports=o,o.className="ReflectionObject";var r,i=e(33);function o(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(o.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),o.prototype.toJSON=function(){throw Error()},o.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof r&&t._handleAdd(this)},o.prototype.onRemove=function(e){var t=e.root;t instanceof r&&t._handleRemove(this),this.parent=null,this.resolved=!1},o.prototype.resolve=function(){return this.resolved||this.root instanceof r&&(this.resolved=!0),this},o.prototype.getOption=function(e){return this.options?this.options[e]:undefined$1},o.prototype.setOption=function(e,t,n){return n&&this.options&&this.options[e]!==undefined$1||((this.options||(this.options={}))[e]=t),this},o.prototype.setParsedOption=function(e,t,n){this.parsedOptions||(this.parsedOptions=[]);var r=this.parsedOptions;if(n){var o=r.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(o){var s=o[e];i.setProperty(s,n,t)}else(o={})[e]=i.setProperty({},n,t),r.push(o)}else{var a={};a[e]=t,r.push(a)}return this},o.prototype.setOptions=function(e,t){if(e)for(var n=Object.keys(e),r=0;r<n.length;++r)this.setOption(n[r],e[n[r]],t);return this},o.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},o._configure=function(e){r=e}},{33:33}],23:[function(e,t,n){t.exports=s;var r=e(22);((s.prototype=Object.create(r.prototype)).constructor=s).className="OneOf";var i=e(15),o=e(33);function s(e,t,n,i){if(Array.isArray(t)||(n=t,t=undefined$1),r.call(this,e,n),t!==undefined$1&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}s.fromJSON=function(e,t){return new s(e,t.oneof,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:undefined$1])},s.prototype.add=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},s.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){r.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var n=e.get(this.oneof[t]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}a(this)},s.prototype.onRemove=function(e){for(var t,n=0;n<this.fieldsArray.length;++n)(t=this.fieldsArray[n]).parent&&t.parent.remove(t);r.prototype.onRemove.call(this,e)},s.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,n){o.decorateType(t.constructor).add(new s(n,e)),Object.defineProperty(t,n,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}}},{15:15,22:22,33:33}],24:[function(e,t,n){t.exports=u;var r,i=e(35),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}var l,f="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")},c=function(){return i.Buffer?function(e){return(u.create=function(e){return i.Buffer.isBuffer(e)?new r(e):f(e)})(e)}:f};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw a(this,8);return new o(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}u.create=c(),u.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,u.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return l}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|p(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},u.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},u._configure=function(e){r=e,u.create=c(),r._configure();var t=i.Long?"toLong":"toNumber";i.merge(u.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return d.call(this)[t](!0)},sfixed64:function(){return d.call(this)[t](!1)}})}},{35:35}],25:[function(e,t,n){t.exports=o;var r=e(24);(o.prototype=Object.create(r.prototype)).constructor=o;var i=e(35);function o(e){r.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},{24:24,35:35}],26:[function(e,t,n){t.exports=c;var r=e(21);((c.prototype=Object.create(r.prototype)).constructor=c).className="Root";var i,o,s,a=e(15),u=e(14),l=e(23),f=e(33);function c(e){r.call(this,"",e),this.deferred=[],this.files=[]}function h(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=f.path.resolve,c.prototype.fetch=f.fetch,c.prototype.load=function e(t,n,r){"function"==typeof n&&(r=n,n=undefined$1);var i=this;if(!r)return f.asPromise(e,i,t,n);var a=r===h;function u(e,t){if(r){var n=r;if(r=null,a)throw e;n(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var n=e.substring(t);if(n in s)return n}return null}function c(e,t){try{if(f.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),f.isString(t)){o.filename=e;var r,s=o(t,i,n),c=0;if(s.imports)for(;c<s.imports.length;++c)(r=l(s.imports[c])||i.resolvePath(e,s.imports[c]))&&p(r);if(s.weakImports)for(c=0;c<s.weakImports.length;++c)(r=l(s.weakImports[c])||i.resolvePath(e,s.weakImports[c]))&&p(r,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}a||d||u(null,i)}function p(e,t){if(!(i.files.indexOf(e)>-1))if(i.files.push(e),e in s)a?c(e,s[e]):(++d,setTimeout((function(){--d,c(e,s[e])})));else if(a){var n;try{n=f.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||u(e))}c(e,n)}else++d,i.fetch(e,(function(n,o){--d,r&&(n?t?d||u(null,i):u(n):c(e,o))}))}var d=0;f.isString(t)&&(t=[t]);for(var y,g=0;g<t.length;++g)(y=i.resolvePath("",t[g]))&&p(y);return a?i:(d||u(null,i),undefined$1)},c.prototype.loadSync=function(e,t){if(!f.isNode)throw Error("not supported");return this.load(e,t,h)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return r.prototype.resolveAll.call(this)};var p=/^[A-Z]/;function d(e,t){var n=t.parent.lookup(t.extend);if(n){var r=new a(t.fullName,t.id,t.type,t.rule,undefined$1,t.options);return r.declaringField=t,t.extensionField=r,n.add(r),!0}return!1}c.prototype._handleAdd=function(e){if(e instanceof a)e.extend===undefined$1||e.extensionField||d(0,e)||this.deferred.push(e);else if(e instanceof u)p.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof l)){if(e instanceof i)for(var t=0;t<this.deferred.length;)d(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);p.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(e){if(e instanceof a){if(e.extend!==undefined$1)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof u)p.test(e.name)&&delete e.parent[e.name];else if(e instanceof r){for(var n=0;n<e.nestedArray.length;++n)this._handleRemove(e._nestedArray[n]);p.test(e.name)&&delete e.parent[e.name]}},c._configure=function(e,t,n){i=e,o=t,s=n}},{14:14,15:15,21:21,23:23,33:33}],27:[function(e,t,n){t.exports={}},{}],28:[function(e,t,n){n.Service=e(29)},{29:29}],29:[function(e,t,n){t.exports=i;var r=e(35);function i(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,i,o);if(!a.rpcImpl)return setTimeout((function(){s(Error("already ended"))}),0),undefined$1;try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null===n)return a.end(!0),undefined$1;if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}))}catch(e){return a.emit("error",e,t),setTimeout((function(){s(e)}),0),undefined$1}},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(e,t,n){t.exports=a;var r=e(21);((a.prototype=Object.create(r.prototype)).constructor=a).className="Service";var i=e(20),o=e(33),s=e(28);function a(e,t){r.call(this,e,t),this.methods={},this._methodsArray=null}function u(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var n=new a(e,t.options);if(t.methods)for(var r=Object.keys(t.methods),o=0;o<r.length;++o)n.add(i.fromJSON(r[o],t.methods[r[o]]));return t.nested&&n.addJSON(t.nested),n.comment=t.comment,n},a.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||undefined$1,"methods",r.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||undefined$1,"comment",n?this.comment:undefined$1])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=o.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||r.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return r.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof i?(this.methods[e.name]=e,e.parent=this,u(this)):r.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof i){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,u(this)}return r.prototype.remove.call(this,e)},a.prototype.create=function(e,t,n){for(var r,i=new s.Service(e,t,n),a=0;a<this.methodsArray.length;++a){var u=o.lcFirst((r=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[u]=o.codegen(["r","c"],o.isReserved(u)?u+"_":u)("return this.rpcCall(m,q,s,r,c)")({m:r,q:r.resolvedRequestType.ctor,s:r.resolvedResponseType.ctor})}return i}},{20:20,21:21,28:28,33:33}],31:[function(e,t,n){t.exports=v;var r=e(21);((v.prototype=Object.create(r.prototype)).constructor=v).className="Type";var i=e(14),o=e(23),s=e(15),a=e(18),u=e(30),l=e(19),f=e(24),c=e(38),h=e(33),p=e(13),d=e(12),y=e(36),g=e(11),m=e(37);function v(e,t){r.call(this,e,t),this.fields={},this.oneofs=undefined$1,this.extensions=undefined$1,this.reserved=undefined$1,this.group=undefined$1,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var n=this.fields[e[t]],r=n.id;if(this._fieldsById[r])throw Error("duplicate id "+r+" in "+this);this._fieldsById[r]=n}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=h.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=h.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof l||((e.prototype=new l).constructor=e,h.merge(e.prototype,t)),e.$type=e.prototype.$type=this,h.merge(e,l,!0),this._ctor=e;for(var n=0;n<this.fieldsArray.length;++n)this._fieldsArray[n].resolve();var r={};for(n=0;n<this.oneofsArray.length;++n)r[this._oneofsArray[n].resolve().name]={get:h.oneOfGetter(this._oneofsArray[n].oneof),set:h.oneOfSetter(this._oneofsArray[n].oneof)};n&&Object.defineProperties(e.prototype,r)}}}),v.generateConstructor=function(e){for(var t,n=h.codegen(["p"],e.name),r=0;r<e.fieldsArray.length;++r)(t=e._fieldsArray[r]).map?n("this%s={}",h.safeProp(t.name)):t.repeated&&n("this%s=[]",h.safeProp(t.name));return n("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(e,t){var n=new v(e,t.options);n.extensions=t.extensions,n.reserved=t.reserved;for(var l=Object.keys(t.fields),f=0;f<l.length;++f)n.add((void 0!==t.fields[l[f]].keyType?a.fromJSON:s.fromJSON)(l[f],t.fields[l[f]]));if(t.oneofs)for(l=Object.keys(t.oneofs),f=0;f<l.length;++f)n.add(o.fromJSON(l[f],t.oneofs[l[f]]));if(t.nested)for(l=Object.keys(t.nested),f=0;f<l.length;++f){var c=t.nested[l[f]];n.add((c.id!==undefined$1?s.fromJSON:c.fields!==undefined$1?v.fromJSON:c.values!==undefined$1?i.fromJSON:c.methods!==undefined$1?u.fromJSON:r.fromJSON)(l[f],c))}return t.extensions&&t.extensions.length&&(n.extensions=t.extensions),t.reserved&&t.reserved.length&&(n.reserved=t.reserved),t.group&&(n.group=!0),t.comment&&(n.comment=t.comment),n},v.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return h.toObject(["options",t&&t.options||undefined$1,"oneofs",r.arrayToJSON(this.oneofsArray,e),"fields",r.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:undefined$1,"reserved",this.reserved&&this.reserved.length?this.reserved:undefined$1,"group",this.group||undefined$1,"nested",t&&t.nested||undefined$1,"comment",n?this.comment:undefined$1])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var n=this.oneofsArray;for(t=0;t<n.length;)n[t++].resolve();return r.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof s&&e.extend===undefined$1){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof o?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):r.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof s&&e.extend===undefined$1){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof o){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return r.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return r.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return r.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],n=0;n<this.fieldsArray.length;++n)t.push(this._fieldsArray[n].resolve().resolvedType);this.encode=p(this)({Writer:c,types:t,util:h}),this.decode=d(this)({Reader:f,types:t,util:h}),this.verify=y(this)({types:t,util:h}),this.fromObject=g.fromObject(this)({types:t,util:h}),this.toObject=g.toObject(this)({types:t,util:h});var r=m[e];if(r){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=r.fromObject.bind(i),i.toObject=this.toObject,this.toObject=r.toObject.bind(i)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof f||(e=f.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){h.decorateType(t,e)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,36:36,37:37,38:38}],32:[function(e,t,n){var r=n,i=e(33),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var n=0,r={};for(t|=0;n<e.length;)r[o[n+t]]=e[n++];return r}r.basic=s([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),r.defaults=s([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),r.long=s([0,0,0,1,1],7),r.mapKey=s([0,0,0,5,5,0,0,0,1,1,0,2],2),r.packed=s([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(e,t,n){var r,i,o=t.exports=e(35),s=e(27);o.codegen=e(3),o.fetch=e(5),o.path=e(8),o.fs=o.inquire("fs"),o.toArray=function(e){if(e){for(var t=Object.keys(e),n=new Array(t.length),r=0;r<t.length;)n[r]=e[t[r++]];return n}return[]},o.toObject=function(e){for(var t={},n=0;n<e.length;){var r=e[n++],i=e[n++];i!==undefined$1&&(t[r]=i)}return t};var a=/\\/g,u=/"/g;o.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},o.safeProp=function(e){return!/^[$\w_]+$/.test(e)||o.isReserved(e)?'["'+e.replace(a,"\\\\").replace(u,'\\"')+'"]':"."+e},o.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var l=/_([a-z])/g;o.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(l,(function(e,t){return t.toUpperCase()}))},o.compareFieldsById=function(e,t){return e.id-t.id},o.decorateType=function(t,n){if(t.$type)return n&&t.$type.name!==n&&(o.decorateRoot.remove(t.$type),t.$type.name=n,o.decorateRoot.add(t.$type)),t.$type;r||(r=e(31));var i=new r(n||t.name);return o.decorateRoot.add(i),i.ctor=t,Object.defineProperty(t,"$type",{value:i,enumerable:!1}),Object.defineProperty(t.prototype,"$type",{value:i,enumerable:!1}),i};var f=0;o.decorateEnum=function(t){if(t.$type)return t.$type;i||(i=e(14));var n=new i("Enum"+f++,t);return o.decorateRoot.add(n),Object.defineProperty(t,"$type",{value:n,enumerable:!1}),n},o.setProperty=function(e,t,n){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,n,r){var i=n.shift();if(n.length>0)t[i]=e(t[i]||{},n,r);else{var o=t[i];o&&(r=[].concat(o).concat(r)),t[i]=r}return t}(e,t=t.split("."),n)},Object.defineProperty(o,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(e(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,5:5,8:8}],34:[function(e,t,n){t.exports=i;var r=e(35);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},{35:35}],35:[function(e,t,n){var r=n;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)e[r[i]]!==undefined$1&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=e(1),r.base64=e(2),r.EventEmitter=e(4),r.float=e(6),r.inquire=e(7),r.utf8=e(10),r.pool=e(9),r.LongBits=e(34),r.isNode=Boolean(void 0!==commonjsGlobal&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),r.global=r.isNode&&commonjsGlobal||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&this[e[n]]!==undefined$1&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(e,t,n){t.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),n=e.oneofsArray,r={};n.length&&t("var p={}");for(var u=0;u<e.fieldsArray.length;++u){var l=e._fieldsArray[u].resolve(),f="m"+i.safeProp(l.name);if(l.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",f,l.name),l.map)t("if(!util.isObject(%s))",f)("return%j",o(l,"object"))("var k=Object.keys(%s)",f)("for(var i=0;i<k.length;++i){"),a(t,l,"k[i]"),s(t,l,u,f+"[k[i]]")("}");else if(l.repeated)t("if(!Array.isArray(%s))",f)("return%j",o(l,"array"))("for(var i=0;i<%s.length;++i){",f),s(t,l,u,f+"[i]")("}");else{if(l.partOf){var c=i.safeProp(l.partOf.name);1===r[l.partOf.name]&&t("if(p%s===1)",c)("return%j",l.partOf.name+": multiple values"),r[l.partOf.name]=1,t("p%s=1",c)}s(t,l,u,f)}l.optional&&t("}")}return t("return null")};var r=e(14),i=e(33);function o(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function s(e,t,n,i){if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(%s){",i)("default:")("return%j",o(t,"enum value"));for(var s=Object.keys(t.resolvedType.values),a=0;a<s.length;++a)e("case %i:",t.resolvedType.values[s[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",n,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",o(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",o(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",o(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",o(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",o(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",o(t,"buffer"))}return e}function a(e,t,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",o(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",o(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",o(t,"boolean key"))}return e}},{14:14,33:33}],37:[function(e,t,n){var r=n,i=e(19);r[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),n=this.lookup(t);if(n){var r="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return-1===r.indexOf("/")&&(r="/"+r),this.create({type_url:r,value:n.encode(n.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var n="",r="";if(t&&t.json&&e.type_url&&e.value){r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var o=this.lookup(r);o&&(e=o.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var s=e.$type.toObject(e,t);return""===n&&(n="type.googleapis.com/"),r=n+("."===e.$type.fullName[0]?e.$type.fullName.substr(1):e.$type.fullName),s["@type"]=r,s}return this.toObject(e,t)}}},{19:19}],38:[function(e,t,n){t.exports=c;var r,i=e(35),o=i.LongBits,s=i.base64,a=i.utf8;function u(e,t,n){this.fn=e,this.len=t,this.next=undefined$1,this.val=n}function l(){}function f(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new u(l,0,0),this.tail=this.head,this.states=null}var h=function(){return i.Buffer?function(){return(c.create=function(){return new r})()}:function(){return new c}};function p(e,t,n){t[n]=255&e}function d(e,t){this.len=e,this.next=undefined$1,this.val=t}function y(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function g(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}c.create=h(),c.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(c.alloc=i.pool(c.alloc,i.Array.prototype.subarray)),c.prototype._push=function(e,t,n){return this.tail=this.tail.next=new u(e,t,n),this.len+=t,this},d.prototype=Object.create(u.prototype),d.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(y,10,o.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=o.from(e);return this._push(y,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(y,t.length(),t)},c.prototype.bool=function(e){return this._push(p,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};c.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(p,1,0);if(i.isString(e)){var n=c.alloc(t=s.length(e));s.decode(e,n,0),e=n}return this.uint32(t)._push(m,t,e)},c.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(p,1,0)},c.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new u(l,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(l,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},c._configure=function(e){r=e,c.create=h(),r._configure()}},{35:35}],39:[function(e,t,n){t.exports=o;var r=e(38);(o.prototype=Object.create(r.prototype)).constructor=o;var i=e(35);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},{35:35,38:38}]},{},[16])})()})),long_1=createCommonjsModule((function(e,t){"undefined"!=typeof self&&self,e.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t){function n(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function r(e){return!0===(e&&e.__isLong__)}function i(e,t){var n,r,i;return t?(i=0<=(e>>>=0)&&e<256)&&(r=c[e])?r:(n=s(e,(0|e)<0?-1:0,!0),i&&(c[e]=n),n):(i=-128<=(e|=0)&&e<128)&&(r=f[e])?r:(n=s(e,e<0?-1:0,!1),i&&(f[e]=n),n)}function o(e,t){if(isNaN(e))return t?v:m;if(t){if(e<0)return v;if(e>=d)return T}else{if(e<=-y)return k;if(e+1>=y)return O}return e<0?o(-e,t).neg():s(e%p|0,e/p|0,t)}function s(e,t,r){return new n(e,t,r)}function a(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return a(e.substring(1),t,n).neg();for(var i=o(h(n,8)),s=m,u=0;u<e.length;u+=8){var l=Math.min(8,e.length-u),f=parseInt(e.substring(u,u+l),n);if(l<8){var c=o(h(n,l));s=s.mul(c).add(o(f))}else s=(s=s.mul(i)).add(o(f))}return s.unsigned=t,s}function u(e,t){return"number"==typeof e?o(e,t):"string"==typeof e?a(e,t):s(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}
|
|
9
|
-
/**
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright 2009 The Closure Library Authors.
|
|
12
|
-
* Copyright 2020 Daniel Wirtz / The long.js Contributors.
|
|
13
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
14
|
-
*/e.exports=n;var l=null;try{l=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=r;var f={},c={};n.fromInt=i,n.fromNumber=o,n.fromBits=s;var h=Math.pow;n.fromString=a,n.fromValue=u;var p=4294967296,d=p*p,y=d/2,g=i(1<<24),m=i(0);n.ZERO=m;var v=i(0,!0);n.UZERO=v;var b=i(1);n.ONE=b;var w=i(1,!0);n.UONE=w;var S=i(-1);n.NEG_ONE=S;var O=s(-1,2147483647,!1);n.MAX_VALUE=O;var T=s(-1,-1,!0);n.MAX_UNSIGNED_VALUE=T;var k=s(0,-2147483648,!1);n.MIN_VALUE=k;var _=n.prototype;_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},_.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(k)){var t=o(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=o(h(e,6),this.unsigned),s=this,a="";;){var u=s.div(i),l=(s.sub(u.mul(i)).toInt()>>>0).toString(e);if((s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(k)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},_.isZero=function(){return 0===this.high&&0===this.low},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return 1==(1&this.low)},_.isEven=function(){return 0==(1&this.low)},_.equals=function(e){return r(e)||(e=u(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},_.eq=_.equals,_.notEquals=function(e){return!this.eq(e)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(e){return this.comp(e)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(e){return this.comp(e)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(e){return this.comp(e)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(e){return this.comp(e)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(e){if(r(e)||(e=u(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(k)?k:this.not().add(b)},_.neg=_.negate,_.add=function(e){r(e)||(e=u(e));var t=this.high>>>16,n=65535&this.high,i=this.low>>>16,o=65535&this.low,a=e.high>>>16,l=65535&e.high,f=e.low>>>16,c=0,h=0,p=0,d=0;return p+=(d+=o+(65535&e.low))>>>16,h+=(p+=i+f)>>>16,c+=(h+=n+l)>>>16,c+=t+a,s((p&=65535)<<16|(d&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},_.subtract=function(e){return r(e)||(e=u(e)),this.add(e.neg())},_.sub=_.subtract,_.multiply=function(e){if(this.isZero())return m;if(r(e)||(e=u(e)),l)return s(l.mul(this.low,this.high,e.low,e.high),l.get_high(),this.unsigned);if(e.isZero())return m;if(this.eq(k))return e.isOdd()?k:m;if(e.eq(k))return this.isOdd()?k:m;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(g)&&e.lt(g))return o(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,i=this.low>>>16,a=65535&this.low,f=e.high>>>16,c=65535&e.high,h=e.low>>>16,p=65535&e.low,d=0,y=0,v=0,b=0;return v+=(b+=a*p)>>>16,y+=(v+=i*p)>>>16,v&=65535,y+=(v+=a*h)>>>16,d+=(y+=n*p)>>>16,y&=65535,d+=(y+=i*h)>>>16,y&=65535,d+=(y+=a*c)>>>16,d+=t*p+n*h+i*c+a*f,s((v&=65535)<<16|(b&=65535),(d&=65535)<<16|(y&=65535),this.unsigned)},_.mul=_.multiply,_.divide=function(e){if(r(e)||(e=u(e)),e.isZero())throw Error("division by zero");if(l)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?s((this.unsigned?l.div_u:l.div_s)(this.low,this.high,e.low,e.high),l.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:m;var t,n,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return w;i=v}else{if(this.eq(k))return e.eq(b)||e.eq(S)?k:e.eq(k)?b:(t=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?b:S:(n=this.sub(e.mul(t)),i=t.add(n.div(e)));if(e.eq(k))return this.unsigned?v:m;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=m}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(t)/Math.LN2),f=a<=48?1:h(2,a-48),c=o(t),p=c.mul(e);p.isNegative()||p.gt(n);)p=(c=o(t-=f,this.unsigned)).mul(e);c.isZero()&&(c=b),i=i.add(c),n=n.sub(p)}return i},_.div=_.divide,_.modulo=function(e){return r(e)||(e=u(e)),l?s((this.unsigned?l.rem_u:l.rem_s)(this.low,this.high,e.low,e.high),l.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return s(~this.low,~this.high,this.unsigned)},_.and=function(e){return r(e)||(e=u(e)),s(this.low&e.low,this.high&e.high,this.unsigned)},_.or=function(e){return r(e)||(e=u(e)),s(this.low|e.low,this.high|e.high,this.unsigned)},_.xor=function(e){return r(e)||(e=u(e)),s(this.low^e.low,this.high^e.high,this.unsigned)},_.shiftLeft=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):s(0,this.low<<e-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):s(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):s(32===e?this.high:this.high>>>e-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.rotateLeft=function(e){var t;return r(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?s(this.high,this.low,this.unsigned):e<32?(t=32-e,s(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),s(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},_.rotl=_.rotateLeft,_.rotateRight=function(e){var t;return r(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?s(this.high,this.low,this.unsigned):e<32?(t=32-e,s(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),s(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},_.rotr=_.rotateRight,_.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},_.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},_.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}}])})),naiveFallback=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")},global$1=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return naiveFallback()}try{return __global__||naiveFallback()}finally{delete Object.prototype.__global__}}(),_from="websocket@^1.0.34",_id="websocket@1.0.34",_inBundle=!1,_integrity="sha1-K9wmAsCL8sgiU7cwZVwO99yrMRE=",_location="/websocket",_phantomChildren={},_requested={type:"range",registry:!0,raw:"websocket@^1.0.34",name:"websocket",escapedName:"websocket",rawSpec:"^1.0.34",saveSpec:null,fetchSpec:"^1.0.34"},_requiredBy=["/"],_resolved="http://registry.npm.sdp.nd/websocket/download/websocket-1.0.34.tgz",_shasum="2bdc2602c08bf2c82253b730655c0ef7dcab3111",_spec="websocket@^1.0.34",_where="C:\\NDDevProjects\\web-im-push",author={name:"Brian McKelvey",email:"theturtle32@gmail.com",url:"https://github.com/theturtle32"},browser$1="lib/browser.js",bugs={url:"https://github.com/theturtle32/WebSocket-Node/issues"},bundleDependencies=!1,config={verbose:!1},contributors=[{name:"I帽aki Baz Castillo",email:"ibc@aliax.net",url:"http://dev.sipdoc.net"}],dependencies={bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},deprecated=!1,description="Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",devDependencies={"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4",jshint:"^2.0.0","jshint-stylish":"^2.2.1",tape:"^4.9.1"},directories={lib:"./lib"},engines={node:">=4.0.0"},homepage="https://github.com/theturtle32/WebSocket-Node",keywords=["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],license="Apache-2.0",main="index",name="websocket",repository={type:"git",url:"git+https://github.com/theturtle32/WebSocket-Node.git"},scripts={gulp:"gulp",test:"tape test/unit/*.js"},version$1="1.0.34",require$$0={_from:_from,_id:_id,_inBundle:_inBundle,_integrity:_integrity,_location:_location,_phantomChildren:_phantomChildren,_requested:_requested,_requiredBy:_requiredBy,_resolved:_resolved,_shasum:_shasum,_spec:_spec,_where:_where,author:author,browser:browser$1,bugs:bugs,bundleDependencies:bundleDependencies,config:config,contributors:contributors,dependencies:dependencies,deprecated:deprecated,description:description,devDependencies:devDependencies,directories:directories,engines:engines,homepage:homepage,keywords:keywords,license:license,main:main,name:name,repository:repository,scripts:scripts,version:version$1},version=require$$0.version,_globalThis;if("object"==typeof globalThis)_globalThis=globalThis;else try{_globalThis=global$1}catch(e){}finally{if(_globalThis||"undefined"==typeof window||(_globalThis=window),!_globalThis)throw new Error("Could not determine global this")}var NativeWebSocket=_globalThis.WebSocket||_globalThis.MozWebSocket;function W3CWebSocket(e,t){return t?new NativeWebSocket(e,t):new NativeWebSocket(e)}NativeWebSocket&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(W3CWebSocket,e,{get:function(){return NativeWebSocket[e]}})}));var browser={w3cwebsocket:NativeWebSocket?W3CWebSocket:null,version:version};function appendBuffer(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer}function stringToUint8Array(e,t){if(void 0===t&&(t={stream:!1}),t.stream)throw new Error("Failed to encode: the 'stream' option is unsupported.");for(var n=0,r=e.length,i=0,o=Math.max(32,r+(r>>1)+7),s=new Uint8Array(o>>3<<3);n<r;){var a=e.charCodeAt(n++);if(a>=55296&&a<=56319){if(n<r){var u=e.charCodeAt(n);56320==(64512&u)&&(++n,a=((1023&a)<<10)+(1023&u)+65536)}if(a>=55296&&a<=56319)continue}if(i+4>s.length){o+=8,o=(o*=1+n/e.length*2)>>3<<3;var l=new Uint8Array(o);l.set(s),s=l}if(0!=(4294967168&a)){if(0==(4294965248&a))s[i++]=a>>6&31|192;else if(0==(4294901760&a))s[i++]=a>>12&15|224,s[i++]=a>>6&63|128;else{if(0!=(4292870144&a))continue;s[i++]=a>>18&7|240,s[i++]=a>>12&63|128,s[i++]=a>>6&63|128}s[i++]=63&a|128}else s[i++]=a}return s.slice(0,i)}function getExploreInfo(){var e,t={},n=navigator.userAgent.toLowerCase();return(e=n.match(/rv:([\d.]+)\) like gecko/))||(e=n.match(/msie ([\d\.]+)/))?t.ie=e[1]:(e=n.match(/edge\/([\d\.]+)/))?t.edge=e[1]:(e=n.match(/firefox\/([\d\.]+)/))?t.firefox=e[1]:(e=n.match(/(?:opera|opr).([\d\.]+)/))?t.opera=e[1]:(e=n.match(/chrome\/([\d\.]+)/))?t.chrome=e[1]:(e=n.match(/version\/([\d\.]+).*safari/))&&(t.safari=e[1]),t.ie?"IE: "+t.ie:t.edge?"EDGE: "+t.edge:t.firefox?"Firefox: "+t.firefox:t.chrome?"Chrome: "+t.chrome:t.opera?"Opera: "+t.opera:t.safari?"Safari: "+t.safari:"Unkonwn"}function functionName(e){var t=e.toString();return t=(t=t.substr("function ".length)).substr(0,t.indexOf("("))}"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n},writable:!0,configurable:!0}),Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(){return new Uint8Array(this).subarray(this.arguments)});var pushProtoRoot=protobuf.Root.fromJSON(proto.nested.push);protobuf.util.Long=long_1,protobuf.configure();var pushProto=proto.nested.push.nested,MethodID=pushProto.MethodID.values,sdkVer="2.0.16",CmdUniqueFlag={Logining:1,Alias:2},CmdPriority={Lowest:1,Low:2,Normal:3,High:4,Highest:5},SessionStatus={Uninitialized:0,Initialized:1,Logining:2,Logined:3,Relogining:4,SessionClosed:5,KickedOff:6},PshStorageType={SessionStorage:0,LocalStorage:1};function logPrefix(){return"[PSH] "+(new Date).toLocaleTimeString()+">"}function localDevTokenKey(e){return"PSHDevToken_"+e.url+"|"+e.appId+"|"+e.uuid}function loadLocalDevToken(e,t){var n;return"undefined"!=typeof window&&(t==PshStorageType.LocalStorage?window.localStorage&&(n=window.localStorage.getItem(localDevTokenKey(e))):window.sessionStorage&&(n=window.sessionStorage.getItem(localDevTokenKey(e)))),console.debug(logPrefix(),"load storage. devToken="+n),n}function storeLocalDevToken(e,t,n){t&&0!==t.length&&"undefined"!=typeof window&&(n==PshStorageType.LocalStorage?window.localStorage&&window.localStorage.setItem(localDevTokenKey(e),t):window.sessionStorage&&window.sessionStorage.setItem(localDevTokenKey(e),t))}function PshWSSession(){var e={socket:null,reqSeq:1,recvBuffer:new ArrayBuffer(0),retryTimer:null,retryIntervalSecond:10,retryIntervalMaxSecond:30,retryCount:0,deviceToken:null,loginSession:null,autoRelogin:!0,loginSucceeded:!1,status:SessionStatus.Uninitialized,lastAliveTime:(new Date).getTime(),heartIntervalTimer:null,maxIdleCount:3,pendingRequestCmds:[],maxCmdsPendingCount:10,loginSucceededListener:null,newMsgListeners:[],defCfg:{url:null,appId:null,uuid:null,heartbeatIntervalSecond:50,cleanSession:!0},config:{},alias:null,subcribedTopics:new Map,error:function(e){console.warn(logPrefix(),"error: "+e)},updateStatus:function(t){t==SessionStatus.Relogining?e.status!=SessionStatus.Logining&&(e.status=t):e.status=t,console.log(logPrefix(),Object.keys(SessionStatus).find((function(t){return SessionStatus[t]===e.status})),"("+e.status+")")},startRetry:function(){if(e.updateStatus(SessionStatus.Relogining),!e.retryTimer){e.retryTimer=setTimeout((function t(){++e.retryCount,console.debug(logPrefix(),"retry push ("+e.retryCount+") ..."),e.reconnect(),e.retryTimer&&(clearTimeout(e.retryTimer),e.retryTimer=setTimeout(t,1e3*Math.min(e.retryIntervalSecond*e.retryCount,e.retryIntervalMaxSecond)))}),1e3*e.retryIntervalSecond)}},stopRetry:function(){e.retryTimer&&(clearTimeout(e.retryTimer),e.retryTimer=null,e.retryCount=0)},sendData:function(t,n){if(e.socket){var r=new Uint8Array(8+(n?n.byteLength:0));if(r[0]=72,r[1]=80,r[2]=0,r[3]=t,n){var i=new Uint32Array(1);i[0]=n.byteLength;var o=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);r.set(o,4),r.set(n,8)}try{e.socket.send(r)}catch(e){}}},sendHeartBeat:function(){e.socket&&(console.debug(logPrefix(),"send heartbeat"),e.sendData(pushProto.OP.values.OP_HEARTBEAT))},sendHeartBeatAck:function(){e.socket&&(console.debug(logPrefix(),"send heartbeat ack"),e.sendData(pushProto.OP.values.OP_HEARTBEAT_ACK))},startHeartbeat:function(){e.stopHeartbeat();var t=1e3*e.config.heartbeatIntervalSecond;e.heartIntervalTimer=setInterval((function(){var n=(new Date).getTime();e.maxIdleCount&&n-e.lastAliveTime>(1+e.maxIdleCount)*t?(console.warn("heart check failed!"),e.clearSocket()):(e.sendHeartBeat(),e.flushRequestCommands())}),t)},stopHeartbeat:function(){e.heartIntervalTimer&&(clearInterval(e.heartIntervalTimer),e.heartIntervalTimer=null)},makeRequestCommand:function(t,n,r,i){var o=i?e.reqSeq++:0,s={methodId:t,seq:o,data:n},a=pushProtoRoot.lookupType("RequestMsg"),u={msgs:[a.encode(a.create(s)).finish()]},l=pushProtoRoot.lookupType("Body");return{seq:o,methodId:t,data:l.encode(l.create(u)).finish(),callback:"function"==typeof i?i:null,respType:r}},addRequestCommand:function(t,n,r,i,o,s){if(o)for(var a=0,u=e.pendingRequestCmds.length;a<u;a++)e.pendingRequestCmds[a]&&e.pendingRequestCmds[a].uniqueFlag==o&&(e.pendingRequestCmds[a]=null);if((h=e.makeRequestCommand(t,n,r,i)).uniqueFlag=o,h.priority=s||CmdPriority.Normal,o==CmdUniqueFlag.Logining?e.pendingRequestCmds.unshift(h):e.pendingRequestCmds.push(h),(u=e.pendingRequestCmds.length)>e.maxCmdsPendingCount){e.removeExpiredCommands();var l=0,f=CmdPriority.Highest,c=null;for(a=0;a<u;a++){var h;(h=e.pendingRequestCmds[a])&&!h.uniqueFlag&&h.priority<f&&(f=h.priority,c=h.callback,l=a)}e.pendingRequestCmds[l]=null,c&&c(-1)}return e.pendingRequestCmds=e.pendingRequestCmds.filter((function(e){return e})),e.flushRequestCommands(),h},responseCommand:function(t){var n=t.seq;0==t.errCode?console.debug(logPrefix(),"rsp << seq="+n+", code="+t.errCode):console.warn(logPrefix(),"rsp << seq="+n+", code="+t.errCode+", msg="+t.errMsg);for(var r=0,i=e.pendingRequestCmds.length;r<i;r++)if(e.pendingRequestCmds[r]&&e.pendingRequestCmds[r].seq==n){var o=e.pendingRequestCmds[r].callback,s=e.pendingRequestCmds[r].respType;if(e.pendingRequestCmds.splice(r,1),o){var a=null;if(s&&!(a=s.decode(t.data))){e.error("proto deserialize failed! seq="+n),o(-1,null,t.errMsg);continue}o(t.errCode,a,t.errMsg)}break}e.flushRequestCommands()},resetRequestCommandsStatus:function(){for(var t=0,n=e.pendingRequestCmds.length;t<n;t++)e.pendingRequestCmds[t]&&(e.pendingRequestCmds[t].sent=!1)},removeExpiredCommands:function(){for(var t=(new Date).getTime(),n=0,r=e.pendingRequestCmds.length;n<r;n++)if(e.pendingRequestCmds[n]){var i=e.pendingRequestCmds[n].expireTime;if(i>0&&i<t){var o=e.pendingRequestCmds[n].callback;e.pendingRequestCmds[n]=null,o&&o(-1)}}e.pendingRequestCmds=e.pendingRequestCmds.filter((function(e){return e}))},flushRequestCommands:function(t){if(e.socket&&e.socket.readyState===e.socket.OPEN){e.removeExpiredCommands();for(var n=0,r=0,i=e.pendingRequestCmds.length;r<i;r++)if(e.pendingRequestCmds[r]){if(t&&++n>t)return;e.status!=SessionStatus.Logined&&e.pendingRequestCmds[r].uniqueFlag!=CmdUniqueFlag.Logining||(e.pendingRequestCmds[r].sent||(e.sendRequestCommand(e.pendingRequestCmds[r]),e.pendingRequestCmds[r].sent=!0),e.pendingRequestCmds[r].seq||(e.pendingRequestCmds[r]=null))}e.pendingRequestCmds=e.pendingRequestCmds.filter((function(e){return e}))}},clearRequestCommands:function(){e.pendingRequestCmds.length=0},sendRequestCommand:function(t){e.socket&&(console.debug(logPrefix(),"req >> seq="+t.seq+", method="+Object.keys(MethodID).find((function(e){return MethodID[e]===t.methodId}))+" ("+t.methodId+")"),e.sendData(pushProto.OP.values.OP_REQUEST,t.data))},recoverSessionState:function(){e.clearRequestCommands(),e.alias&&e.alias.length>0&&this.callSetAliasMethod(e.alias);var t=[],n=[];e.subcribedTopics.forEach((function(e,r){0==e?t.push(r):n.push(r)})),t.length>0&&this.callSubscribeMethod(t,0),n.length>0&&this.callSubscribeMethod(n,1)},callCmd:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];(t=this[e]).call.apply(t,[this].concat(r))},callRegisterDeviceMethod:function(t){var n={appId:e.config.appId,devInfo:{platform:pushProto.PshPlatform.values.Platform_WEB,uuid:e.config.uuid}},r=pushProtoRoot.lookupType("RegisterDeviceReq"),i=r.encode(r.create(n)).finish();e.addRequestCommand(MethodID.METHOD_REGISTER_DEVICE,i,pushProtoRoot.lookupType("RegisterDeviceResp"),t,CmdUniqueFlag.Logining)},callReloginMethod:function(t){var n={appId:e.config.appId,devToken:e.deviceToken},r=pushProtoRoot.lookupType("ReloginReq"),i=r.encode(r.create(n)).finish();e.addRequestCommand(MethodID.METHOD_RELOGIN,i,pushProtoRoot.lookupType("ReloginResp"),t,CmdUniqueFlag.Logining)},callLoginMethod:function(t){var n={appId:e.config.appId,devToken:e.deviceToken,platform:pushProto.PshPlatform.values.Platform_WEB,sdkVer:sdkVer,sdkDesc:e.config.sdkDesc};e.config.cleanSession&&(n.serverOptions={options:{}},n.serverOptions.options[pushProto.LoginReq.nested.ServerOptions.values.CLEAN_SESSION]=1);var r=pushProtoRoot.lookupType("LoginReq"),i=r.encode(r.create(n)).finish();e.addRequestCommand(MethodID.METHOD_LOGIN,i,pushProtoRoot.lookupType("LoginResp"),t,CmdUniqueFlag.Logining)},callLogoutMethod:function(t){this.clearRequestCommands();var n=pushProtoRoot.lookupType("LogoutReq"),r=n.encode(n.create({})).finish();e.addRequestCommand(MethodID.METHOD_LOOUT,r,null,t,CmdUniqueFlag.Logining)},callAckMsgMethod:function(t,n,r){var i={msgIds:t,broadcastMsgIds:n},o=pushProtoRoot.lookupType("AckMsgReq"),s=o.encode(o.create(i)).finish();e.addRequestCommand(MethodID.METHOD_ACKMSG,s,null,r)},callSetAliasMethod:function(t,n){e.alias=t;var r={alias:t},i=pushProtoRoot.lookupType("SetAliasReq"),o=i.encode(i.create(r)).finish();console.debug("set alias:",r),e.addRequestCommand(MethodID.METHOD_SET_ALIAS,o,null,void 0===n||n,CmdUniqueFlag.Alias)},callClearAliasMethod:function(t){e.alias=null;var n=pushProtoRoot.lookupType("ClearAliasReq"),r=n.encode(n.create({})).finish();console.debug("clear alias"),e.addRequestCommand(MethodID.METHOD_CLEAR_ALIAS,r,null,void 0===t||t,CmdUniqueFlag.Alias)},callSubscribeMethod:function(t,n,r){var i={topicFilters:{}};if(n|=0,Array.isArray(t))for(var o=0,s=t.length;o<s;o++)e.subcribedTopics.set(t[o],n),i.topicFilters[t[o]]=n;else e.subcribedTopics.set(t,n),i.topicFilters[t]=n;console.debug("subscribe:",i);var a=pushProtoRoot.lookupType("SubscribeReq"),u=a.encode(a.create(i)).finish();e.addRequestCommand(MethodID.METHOD_SUBSCRIBE,u,null,void 0===r||r)},callUnsubscribeMethod:function(t,n){var r={topicFilters:[]};if(Array.isArray(t))for(var i=0,o=t.length;i<o;i++)e.subcribedTopics.delete(t[i]),r.topicFilters.push(t[i]);else e.subcribedTopics.delete(t),r.topicFilters.push(t);console.debug("unsubscribe:",r);var s=pushProtoRoot.lookupType("UnsubscribeReq"),a=s.encode(s.create(r)).finish();e.addRequestCommand(MethodID.METHOD_UNSUBSCRIBE,a,null,void 0===n||n)},callUnsubscribeAllMethod:function(t){e.subcribedTopics.clear();var n=pushProtoRoot.lookupType("UnsubscribeAllReq"),r=n.encode(n.create({})).finish();console.debug("unsubscribe all"),e.addRequestCommand(MethodID.METHOD_UNSUBSCRIBE_ALL,r,null,void 0===t||t)},callPublishMethod:function(t,n,r,i,o){var s=stringToUint8Array(n),a=0;if(void 0!==snappyjs&&s.length>100){var u=snappyjs.compress(s);s.length>u.length&&(a=pushProto.PshMsgData.nested.Compression.values.SNAPPY,s=u)}var l={compression:a,flag:r,ttl:i,topic:t,content:s},f=pushProtoRoot.lookupType("PublishReq"),c=f.encode(f.create(l)).finish(),h=15&r,p=e.addRequestCommand(MethodID.METHOD_PUBLISH,c,null,o,null,0==h?CmdPriority.Lowest:CmdPriority.Low);i>0&&(p.expireTime=(new Date).getTime()+1e3*i)},callSendUpstreamMsgMethod:function(t,n,r,i,o,s){var a={clientMsgToken:t,ttl:n,contentType:r,content:i,extraHeaders:o},u=pushProtoRoot.lookupType("SendUpstreamMsgReq"),l=u.encode(u.create(a)).finish(),f=e.addRequestCommand(MethodID.METHOD_SEND_UPSTREAM_MSG,l,null,s,null,CmdPriority.Low);n>0&&(f.expireTime=(new Date).getTime()+1e3*n)},init:function(t){Object.assign(e.config,e.defCfg,t),e.config.appId||(e.config.appId=t.appid),delete e.config.appid,e.config.heartbeatIntervalSecond||(e.config.heartbeatIntervalSecond=120),e.config.heartbeatIntervalSecond=Math.max(e.config.heartbeatIntervalSecond,10),e.config.sdkDesc||(e.config.sdkDesc=getExploreInfo()),console.debug(logPrefix(),"config:",JSON.stringify(e.config),"ver:",sdkVer),e.deviceToken=e.config.deviceToken},clearSocket:function(){if(e.socket){try{e.socket.close()}catch(e){}e.socket.onopen=null,e.socket.onclose=null,e.socket.onmessage=null,e.socket.onerror=null,e.socket=null}},reconnect:function(){if(e.config.url&&0!==e.config.url.length)if(e.config.appId&&0!==e.config.appId.length){e.clearSocket(),e.resetRequestCommandsStatus(),e.recvBuffer=new ArrayBuffer(0),e.autoRelogin=!0,console.log(logPrefix(),"connect to "+e.config.url);try{var t=browser.w3cwebsocket;e.socket=new t(e.config.url,"protobuf"),e.socket.onopen=e.onConnected,e.socket.onclose=e.onDisconnect,e.socket.onmessage=function(t){var n=new FileReader;n.readAsArrayBuffer(t.data),n.onload=function(){for(e.lastAliveTime=(new Date).getTime(),e.recvBuffer=appendBuffer(e.recvBuffer,new Uint8Array(n.result));e.processInputData(););}},e.socket.onerror=function(t){e.error(t)}}catch(e){console.error(e)}}else e.error("appId is empty!");else e.error("url is empty!")},stop:function(){e.autoRelogin=!1,e.loginSession=null,e.stopRetry(),e.stopHeartbeat(),e.clearRequestCommands(),e.callLogoutMethod(),e.clearSocket()},onConnected:function(){console.debug(logPrefix(),"connected"),e.deviceToken&&0!=e.deviceToken.length||(e.deviceToken=loadLocalDevToken(e.config,PshStorageType.SessionStorage));var t=function(t,n){if(t)e.loginSession=null;else{e.stopRetry(),e.startHeartbeat();var r=e.loginSession;e.loginSession=n.session,e.updateStatus(SessionStatus.Logined),console.debug(logPrefix(),"deviceToken="+e.deviceToken+", session="+e.loginSession),e.loginSucceeded||(e.loginSucceeded=!0,e.loginSucceededListener&&e.loginSucceededListener()),e.loginSession!=r&&e.recoverSessionState(),e.flushRequestCommands()}};e.deviceToken&&0!==e.deviceToken.length?e.loginSession&&e.loginSession.length>0?e.callReloginMethod(t):e.callLoginMethod(t):e.callRegisterDeviceMethod((function(n,r){n||(e.deviceToken=r.devToken,storeLocalDevToken(e.config,e.deviceToken,PshStorageType.SessionStorage),e.callLoginMethod(t))}))},onDisconnect:function(t){console.warn(logPrefix(),"disconnected!",t.code,t.reason,"session="+e.loginSession),e.socket=null,e.stopHeartbeat(),e.resetRequestCommandsStatus(),e.autoRelogin?e.startRetry():(e.stopRetry(),e.updateStatus(SessionStatus.SessionClosed))},processInputData:function(){var t=e.recvBuffer;if(t.byteLength<8)return!1;var n=new Uint8Array(t);if(72!=n[0]||80!=n[1])return console.warn(logPrefix(),"recv invalid data!"),e.recvBuffer=new ArrayBuffer(0),!1;var r=n[3],i=new Uint32Array(t,4,1)[0];if(8+i>t.byteLength)return!1;if(e.recvBuffer=t.slice(8+i),t=new Uint8Array(t,8,i),r==pushProto.OP.values.OP_HEARTBEAT)console.debug(logPrefix(),"recv heartbeat"),e.sendHeartBeatAck();else if(r==pushProto.OP.values.OP_HEARTBEAT_ACK)console.debug(logPrefix(),"recv heartbeat ack");else if(i>0){var o=pushProtoRoot.lookup("Body").decode(t).msgs;if(r==pushProto.OP.values.OP_REQUEST)for(var s=pushProtoRoot.lookup("RequestMsg"),a=0;a<o.length;++a){var u=s.decode(o[a]);u&&e.onNotification(u)}else if(r==pushProto.OP.values.OP_RESPONSE){var l=pushProtoRoot.lookup("ResponseMsg");for(a=0;a<o.length;++a)var f=l.decode(o[a]);f&&e.responseCommand(f)}}return!0},onNotification:function(t){var n=t.methodId;if(console.debug(logPrefix(),"noti << method="+Object.keys(MethodID).find((function(e){return MethodID[e]===n}))+" ("+n+")"),n==MethodID.METHOD_NEWMSG_NOTIFY){var r=pushProtoRoot.lookup("NewMsgNoti").decode(t.data);if(!r)return;for(var i=r.msgs,o=[],s=[],a=0;a<i.length;++a){var u=pushProtoRoot.lookup("PshDispatchedMsg").decode(i[a]);if(u){var l=new long_1(u.msgId.low,u.msgId.high,u.msgId.unsigned),f=15&u.flag,c=u.topic;console.debug(logPrefix(),"new message: topic="+c+", msg_id="+l+(u.useBroadcastInbox?" bc":"")+" qos="+f),0!=l&&0!=f&&(u.useBroadcastInbox?s.push(l):o.push(l));var h,p=pushProtoRoot.lookup("PshMsgData").decode(u.msgData);if(p)if(h=p.compression==pushProto.PshMsgData.nested.Compression.values.SNAPPY?snappyjs.uncompress(p.content):p.content,e.newMsgListeners){var d={topic:c,contentType:p.contentType,contentData:h,extraFields:p.extraFields};try{d.content=(new TextDecoder).decode(h)}catch(e){}for(a=0;a<e.newMsgListeners.length;++a)e.newMsgListeners[a](d)}}}(o.length||s.length)&&(console.debug(logPrefix(),"ack: "+o+" "+s),e.callAckMsgMethod(o,s))}else n==MethodID.METHOD_SESSION_REPLACED_NOTIFY?(e.error("session replaced!"),e.autoRelogin=!1,e.stopRetry(),e.stopHeartbeat(),e.updateStatus(SessionStatus.KickedOff)):n==MethodID.METHOD_SESSION_BROKEN_NOTIFY&&(e.warn("session broken!"),e.clearSocket())},addNewMsgListener:function(t){for(var n=0;n<e.newMsgListeners.length;n++)if(t==e.newMsgListeners[n]||functionName(t)==functionName(e.newMsgListeners[n].name))return;e.newMsgListeners.push(t)},removeNewMsgListener:function(t){var n=e.newMsgListeners.indexOf(t);-1!==n&&e.newMsgListeners.splice(n,1)}};this.connect=function(t){if(t){if(e.status!=SessionStatus.Uninitialized)return void e.error("already initialized!");e.init(t),e.updateStatus(SessionStatus.Initialized)}return e.stop(),e.updateStatus(SessionStatus.Logining),e.reconnect(),this},this.session=function(){return e}}function PushCli(){this.wsSession=null,this.onLogined=null,this.onNewMessage=null}PushCli.prototype.currentScriptPath=function(){if("undefined"!=typeof document){var e=document.querySelectorAll("script[src]");return e[e.length-1].src}}(),PushCli.prototype.defCfg={},PushCli.prototype.open=function(e,t){var n=this,r={};Object.assign(r,n.defCfg,e),n.config=r,console.log(logPrefix(),"PushCli open. config:",n.config),!n.config.disableSharedWorker&&"undefined"!=typeof window&&window.SharedWorker&&(t&&0!==t.length||(t=this.currentScriptPath),console.log(logPrefix(),"worker url: ",t),n.worker=new SharedWorker(t),n.worker.onerror=function(e){console.warn(logPrefix(),"worker error:",e,"path="+t)},n.worker.port.onmessage=function(e){var t=e.data[0],r=e.data.length>1?e.data[1]:null;"onLogined"==t&&(r&&r.deviceToken&&r.deviceToken.length>0&&(console.log(logPrefix(),"logined",r.deviceToken),storeLocalDevToken(n.config,r.deviceToken,PshStorageType.LocalStorage)),n.onLogined&&n.onLogined()),"newMsgNoti"==t&&(console.log(logPrefix(),"new message.","topic="+r.topic),n.procNewMessage(r))},n.config.deviceToken=loadLocalDevToken(n.config,PshStorageType.LocalStorage),n.worker.port.postMessage(["start",n.config]),setInterval((function(){n.worker.port.postMessage(["heart"])}),1e3)),n.worker||(n.wsSession=new PshWSSession,n.wsSession.loginSucceededListener=n.onLogined,n.wsSession.connect(n.config),n.wsSession.session().addNewMsgListener((function(e){n.procNewMessage(e)})))},PushCli.prototype.close=function(){var e=this;e.worker?e.worker.port.postMessage(["stop"]):e.wsSession.session().stop()},PushCli.prototype.procNewMessage=function(e){if(this.onNewMessage)try{this.onNewMessage(e)}catch(e){console.warn(logPrefix(),e)}},PushCli.prototype.callCmd=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i;this.worker?this.worker.port.postMessage(["cmd",e,n]):(i=this.wsSession.session()).callCmd.apply(i,[e].concat(n))},PushCli.prototype.setAlias=function(e){this.callCmd.apply(this,["callSetAliasMethod"].concat(Array.prototype.slice.call(arguments)))},PushCli.prototype.subscribe=function(e,t){this.callCmd.apply(this,["callSubscribeMethod"].concat(Array.prototype.slice.call(arguments)))},PushCli.prototype.unsubscribe=function(e){this.callCmd.apply(this,["callUnsubscribeMethod"].concat(Array.prototype.slice.call(arguments)))},PushCli.prototype.unsubscribeAll=function(){this.callCmd.apply(this,["callUnsubscribeAllMethod"].concat(Array.prototype.slice.call(arguments)))},PushCli.prototype.publish=function(e){this.callCmd("callPublishMethod",e.topic,e.content,e.flag,e.ttl)},PushCli.prototype.sendUpstream=function(e){this.callCmd("callSendUpstreamMsgMethod",e.clientMsgToken,e.ttl,e.contentType,e.content,e.extraHeaders)},"undefined"==typeof window||window.ndiot_push||(window.ndiot_push=new PushCli);var pshPortsPool=[];function pshCheckPorts(){for(var e=(new Date).getTime(),t=0;t<pshPortsPool.length;++t)e-pshPortsPool[t].lastAlive>1e4&&(pshPortsPool[t]=null);pshPortsPool=pshPortsPool.filter((function(e){return e}))}function pshFindSeesion(e){for(var t=0;t<pshPortsPool.length;++t)if(pshPortsPool[t].appId===e&&pshPortsPool[t].wsSession)return pshPortsPool[t].wsSession;return null}function pshAddPort(e){e.lastAlive=(new Date).getTime(),pshCheckPorts(),-1===pshPortsPool.indexOf(e)&&pshPortsPool.push(e)}function pshBroadcast(e,t){pshPortsPool.forEach((function(n){n.appId==e&&n.postMessage(t)}))}function XXPush(){this.pushCli=null,this.notificationListeners=[]}return"undefined"!=typeof onconnect&&(onconnect=function(e){var t=e.ports[0];pshAddPort(t),t.onmessage=function(e){var n=e.data[0],r=e.data.length>1?e.data[1]:null,i=e.data.length>2?e.data[2]:null;if("heart"!=n){console.debug("worker:",n,r,i);try{if("start"===n){console.log("start",o);var o=r,s=o.appId;if(t.appId&&t.appId!=s&&(t.wsSession=null),!t.wsSession){var a=pshFindSeesion(s);a||((a=new PshWSSession).session().loginSucceededListener=function(){pshBroadcast(s,["onLogined",{deviceToken:a.session().deviceToken}])},a.connect(o),a.session().addNewMsgListener((function(e){pshBroadcast(s,["newMsgNoti",e])}))),t.appId=s,t.wsSession=a}}else if(t.wsSession)if("stop"===n)t.wsSession=null;else if("cmd"===n){var u;(u=t.wsSession.session()).callCmd.apply(u,[r].concat(i))}}catch(e){console.warn(e)}}else pshAddPort(t)}}),XXPush.prototype.init=function(e){return console.warn(logPrefix(),"xx_push was deprecated!!! use ndiot_push instead."),this.userCfg=e,this.pushCli=new PushCli,this.pushCli.onNewMessage=function(e){if(this.notificationListeners&&this.notificationListeners.length>0)try{var t=e.extraFields,n=new Array,r=0;for(var i in t)n[r]=new Array,n[r][0]=i,n[r][1]=t[i],r++;var o={ex:n,getEntryList:function(){return this.ex}};for(r=0;r<this.notificationListeners.length;++r)this.notificationListeners[r](e.contentData,o)}catch(e){console.warn(logPrefix(),e)}},this},XXPush.prototype.connect=function(){this.pushCli.open(this.userCfg),this.loginCallback&&this.loginCallback()},XXPush.prototype.subscribe=function(e,t,n){this.pushCli.subscribe(e,t),n&&n(0)},XXPush.prototype.unSubscribe=function(e,t){this.pushCli.unsubscribe(e),t&&t(0)},XXPush.prototype.unSubscribeAll=function(e){this.pushCli.unSubscribeAll(),e&&e(0)},XXPush.prototype.setAlias=function(e,t){this.pushCli.setAlias(e),t&&t(0)},XXPush.prototype.publish=function(e,t,n,r){this.pushCli.publish({topic:e,content:t,qos:n}),r&&r(0)},XXPush.prototype.sendUpstreamMsg=function(e,t,n,r,i){this.pushCli.sendUpstream({clientMsgToken:e,ttl:t,contentType:n,content:r}),i&&i(0)},XXPush.prototype.sendUpstreamMsgWithHeader=function(e,t,n,r,i,o){this.pushCli.sendUpstream({clientMsgToken:e,ttl:t,contentType:n,content:r,extraHeaders:i}),o&&o(0)},XXPush.prototype.setNotificationListener=function(e){this.notificationListeners.push(e)},"undefined"==typeof window||window.xx_push||(window.xx_push=new XXPush),PushCli}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).webImPush=t()}(this,(function(){"use strict";var WORD_MASK=[0,255,65535,16777215,4294967295];function copyBytes$1(e,t,n,r,i){var o;for(o=0;o<i;o++)n[r+o]=e[t+o]}function selfCopyBytes(e,t,n,r){var i;for(i=0;i<r;i++)e[t+i]=e[t-n+i]}function SnappyDecompressor$1(e){this.array=e,this.pos=0}SnappyDecompressor$1.prototype.readUncompressedLength=function(){for(var e,t,n=0,r=0;r<32&&this.pos<this.array.length;){if(e=this.array[this.pos],this.pos+=1,(t=127&e)<<r>>>r!==t)return-1;if(n|=t<<r,e<128)return n;r+=7}return-1},SnappyDecompressor$1.prototype.uncompressToBuffer=function(e){for(var t,n,r,i,o=this.array,s=o.length,a=this.pos,u=0;a<o.length;)if(t=o[a],a+=1,0==(3&t)){if((n=1+(t>>>2))>60){if(a+3>=s)return!1;r=n-60,n=1+((n=o[a]+(o[a+1]<<8)+(o[a+2]<<16)+(o[a+3]<<24))&WORD_MASK[r]),a+=r}if(a+n>s)return!1;copyBytes$1(o,a,e,u,n),a+=n,u+=n}else{switch(3&t){case 1:n=4+(t>>>2&7),i=o[a]+(t>>>5<<8),a+=1;break;case 2:if(a+1>=s)return!1;n=1+(t>>>2),i=o[a]+(o[a+1]<<8),a+=2;break;case 3:if(a+3>=s)return!1;n=1+(t>>>2),i=o[a]+(o[a+1]<<8)+(o[a+2]<<16)+(o[a+3]<<24),a+=4}if(0===i||i>u)return!1;selfCopyBytes(e,u,i,n),u+=n}return!0};var SnappyDecompressor_1=SnappyDecompressor$1,snappy_decompressor={SnappyDecompressor:SnappyDecompressor_1},BLOCK_LOG=16,BLOCK_SIZE=1<<BLOCK_LOG,MAX_HASH_TABLE_BITS=14,globalHashTables=new Array(MAX_HASH_TABLE_BITS+1);function hashFunc(e,t){return 506832829*e>>>t}function load32(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24)}function equals32(e,t,n){return e[t]===e[n]&&e[t+1]===e[n+1]&&e[t+2]===e[n+2]&&e[t+3]===e[n+3]}function copyBytes(e,t,n,r,i){var o;for(o=0;o<i;o++)n[r+o]=e[t+o]}function emitLiteral(e,t,n,r,i){return n<=60?(r[i]=n-1<<2,i+=1):n<256?(r[i]=240,r[i+1]=n-1,i+=2):(r[i]=244,r[i+1]=n-1&255,r[i+2]=n-1>>>8,i+=3),copyBytes(e,t,r,i,n),i+n}function emitCopyLessThan64(e,t,n,r){return r<12&&n<2048?(e[t]=1+(r-4<<2)+(n>>>8<<5),e[t+1]=255&n,t+2):(e[t]=2+(r-1<<2),e[t+1]=255&n,e[t+2]=n>>>8,t+3)}function emitCopy(e,t,n,r){for(;r>=68;)t=emitCopyLessThan64(e,t,n,64),r-=64;return r>64&&(t=emitCopyLessThan64(e,t,n,60),r-=60),emitCopyLessThan64(e,t,n,r)}function compressFragment(e,t,n,r,i){for(var o=1;1<<o<=n&&o<=MAX_HASH_TABLE_BITS;)o+=1;var s=32-(o-=1);void 0===globalHashTables[o]&&(globalHashTables[o]=new Uint16Array(1<<o));var a,u=globalHashTables[o];for(a=0;a<u.length;a++)u[a]=0;var l,f,c,h,p,d,y,g,m,v,b=t+n,w=t,S=t,O=!0;if(n>=15)for(l=b-15,c=hashFunc(load32(e,t+=1),s);O;){d=32,h=t;do{if(f=c,y=d>>>5,d+=1,h=(t=h)+y,t>l){O=!1;break}c=hashFunc(load32(e,h),s),p=w+u[f],u[f]=t-w}while(!equals32(e,t,p));if(!O)break;i=emitLiteral(e,S,t-S,r,i);do{for(g=t,m=4;t+m<b&&e[t+m]===e[p+m];)m+=1;if(t+=m,i=emitCopy(r,i,g-p,m),S=t,t>=l){O=!1;break}u[hashFunc(load32(e,t-1),s)]=t-1-w,p=w+u[v=hashFunc(load32(e,t),s)],u[v]=t-w}while(equals32(e,t,p));if(!O)break;c=hashFunc(load32(e,t+=1),s)}return S<b&&(i=emitLiteral(e,S,b-S,r,i)),i}function putVarint(e,t,n){do{t[n]=127&e,(e>>>=7)>0&&(t[n]+=128),n+=1}while(e>0);return n}function SnappyCompressor$1(e){this.array=e}SnappyCompressor$1.prototype.maxCompressedLength=function(){var e=this.array.length;return 32+e+Math.floor(e/6)},SnappyCompressor$1.prototype.compressToBuffer=function(e){var t,n=this.array,r=n.length,i=0,o=0;for(o=putVarint(r,e,o);i<r;)o=compressFragment(n,i,t=Math.min(r-i,BLOCK_SIZE),e,o),i+=t;return o};var SnappyCompressor_1=SnappyCompressor$1,snappy_compressor={SnappyCompressor:SnappyCompressor_1};function isNode(){return"object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node}function isUint8Array(e){return e instanceof Uint8Array&&(!isNode()||!Buffer.isBuffer(e))}function isArrayBuffer(e){return e instanceof ArrayBuffer}function isBuffer(e){return!!isNode()&&Buffer.isBuffer(e)}var SnappyDecompressor=snappy_decompressor.SnappyDecompressor,SnappyCompressor=snappy_compressor.SnappyCompressor,TYPE_ERROR_MSG="Argument compressed must be type of ArrayBuffer, Buffer, or Uint8Array";function uncompress(e){if(!isUint8Array(e)&&!isArrayBuffer(e)&&!isBuffer(e))throw new TypeError(TYPE_ERROR_MSG);var t=!1,n=!1;isUint8Array(e)?t=!0:isArrayBuffer(e)&&(n=!0,e=new Uint8Array(e));var r,i,o=new SnappyDecompressor(e),s=o.readUncompressedLength();if(-1===s)throw new Error("Invalid Snappy bitstream");if(t){if(r=new Uint8Array(s),!o.uncompressToBuffer(r))throw new Error("Invalid Snappy bitstream")}else if(n){if(r=new ArrayBuffer(s),i=new Uint8Array(r),!o.uncompressToBuffer(i))throw new Error("Invalid Snappy bitstream")}else if(r=Buffer.alloc(s),!o.uncompressToBuffer(r))throw new Error("Invalid Snappy bitstream");return r}function compress(e){if(!isUint8Array(e)&&!isArrayBuffer(e)&&!isBuffer(e))throw new TypeError(TYPE_ERROR_MSG);var t=!1,n=!1;isUint8Array(e)?t=!0:isArrayBuffer(e)&&(n=!0,e=new Uint8Array(e));var r,i,o,s=new SnappyCompressor(e),a=s.maxCompressedLength();return t?(r=new Uint8Array(a),o=s.compressToBuffer(r)):n?(r=new ArrayBuffer(a),i=new Uint8Array(r),o=s.compressToBuffer(i)):(r=Buffer.alloc(a),o=s.compressToBuffer(r)),r.slice(0,o)}var uncompress_1=uncompress,compress_1=compress,snappyjs={uncompress:uncompress_1,compress:compress_1},proto={nested:{push:{nested:{Errors:{values:{EC_RPC_OK:0,EC_RPC_PARSE_ERROR:-32700,EC_RPC_INVALID_REQUEST:-32600,EC_RPC_METHOD_NOT_FOUND:-32601,EC_RPC_INVALID_PARAMS:-32602,EC_RPC_INTERNAL_ERROR:-32603,EC_RPC_NO_PERMISSION:-32604,EC_RPC_REQUEST_TIMEOUT:-32605,EC_RPC_APPLICATION_ERROR:-32500,EC_RPC_TRANSPORT_ERROR:-32300}},OP:{values:{OP_NOOP:0,OP_REQUEST:1,OP_RESPONSE:2,OP_HEARTBEAT:3,OP_HEARTBEAT_ACK:4,OP_PING:10,OP_PONG:11,OP_ADDR:12}},RequestMsg:{fields:{methodId:{type:"sint32",id:1},seq:{type:"uint32",id:2},data:{type:"bytes",id:10}}},ResponseMsg:{fields:{seq:{type:"uint32",id:1},errCode:{type:"sint32",id:3},errMsg:{type:"string",id:4},data:{type:"bytes",id:10}}},Body:{fields:{crypto:{type:"Crypto",id:1},msgs:{rule:"repeated",type:"bytes",id:10}},nested:{Crypto:{values:{NONE:0,TEA:1}}}},PshMessageType:{values:{MessageType_Notification:0,MessageType_Message:1}},PshPlatform:{values:{Platform_Unknown:0,Platform_Android:1,Platform_iOS:2,Platform_WP:4,Platform_WEB:8,Platform_PC:16,Platform_Chrome:32,Platform_WeiXin:128}},PshMsgData:{fields:{msgType:{type:"PshMessageType",id:1},compression:{type:"Compression",id:2},msgTime:{type:"uint64",id:3},contentType:{type:"string",id:10},content:{type:"bytes",id:11},extraFields:{keyType:"string",type:"string",id:20}},nested:{Compression:{values:{NONE:0,SNAPPY:1}}}},PshDispatchedMsg:{fields:{msgId:{type:"uint64",id:2},msgTime:{type:"uint64",id:3},senderUid:{type:"string",id:4},flag:{type:"uint32",id:5},clientMsgToken:{type:"string",id:7},topic:{type:"string",id:18},msgData:{type:"bytes",id:20},ttl:{type:"uint64",id:30},useBroadcastInbox:{type:"bool",id:31}}},MethodID:{values:{METHOD_NONE:0,METHOD_LOGIN:1,METHOD_LOGOUT:2,METHOD_RELOGIN:3,METHOD_REGISTER_DEVICE:4,METHOD_ACKMSG:17,METHOD_SET_ALIAS:56,METHOD_CLEAR_ALIAS:57,METHOD_SUBSCRIBE:64,METHOD_UNSUBSCRIBE:65,METHOD_UNSUBSCRIBE_ALL:66,METHOD_PUBLISH:68,METHOD_SEND_UPSTREAM_MSG:80,METHOD_NEWMSG_NOTIFY:4096,METHOD_SESSION_BROKEN_NOTIFY:4368,METHOD_SESSION_REPLACED_NOTIFY:4369}},RegisterDeviceReq:{fields:{devInfo:{type:"DevInfo",id:1},appId:{type:"string",id:2}},nested:{DevInfo:{fields:{platform:{type:"int32",id:2},uuid:{type:"string",id:20}}}}},RegisterDeviceResp:{fields:{devToken:{type:"string",id:1}}},LoginReq:{fields:{appId:{type:"string",id:1},devToken:{type:"string",id:2},lastMsgId:{type:"uint64",id:3},sdkVer:{type:"string",id:7},sdkDesc:{type:"string",id:9},cryptoKey:{type:"bytes",id:10},platform:{type:"int32",id:20},serverOptions:{type:"ServerOptions",id:50},appKeyHash:{type:"string",id:100}},nested:{ServerOptions:{values:{UNSET:0,CLEAN_SESSION:5},fields:{options:{keyType:"int32",type:"int32",id:1}}}}},LoginResp:{fields:{session:{type:"string",id:5}}},ReloginReq:{fields:{appId:{type:"string",id:1},devToken:{type:"string",id:2},session:{type:"string",id:5},cryptoKey:{type:"string",id:10},appKeyHash:{type:"string",id:100}}},ReloginResp:{fields:{session:{type:"string",id:5}}},LogoutReq:{fields:{}},AckMsgReq:{fields:{msgIds:{rule:"repeated",type:"uint64",id:1},broadcastMsgIds:{rule:"repeated",type:"uint64",id:2}}},SetAliasReq:{fields:{alias:{type:"string",id:1}}},ClearAliasReq:{fields:{}},NewMsgNoti:{fields:{msgs:{rule:"repeated",type:"bytes",id:10}}},SubscribeReq:{fields:{topicFilters:{keyType:"string",type:"int32",id:1}}},UnsubscribeReq:{fields:{topicFilters:{rule:"repeated",type:"string",id:1}}},UnsubscribeAllReq:{fields:{}},PublishReq:{fields:{topic:{type:"string",id:1},content:{type:"bytes",id:2},clientMsgToken:{type:"string",id:7},flag:{type:"int32",id:10},ttl:{type:"uint64",id:11},compression:{type:"uint32",id:20}}},PublishResp:{fields:{msgId:{type:"uint64",id:1}}},SendUpstreamMsgReq:{fields:{clientMsgToken:{type:"string",id:1},ttl:{type:"uint64",id:2},contentType:{type:"string",id:10},content:{type:"string",id:11},extraHeaders:{keyType:"string",type:"string",id:20}}}}}}},commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return commonjsRequire(e,null==t?n.path:t)}},n.exports),n.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var protobuf=createCommonjsModule((function(module){
|
|
2
|
+
/*!
|
|
3
|
+
* protobuf.js v6.11.0 (c) 2016, daniel wirtz
|
|
4
|
+
* compiled thu, 29 apr 2021 02:20:44 utc
|
|
5
|
+
* licensed under the bsd-3-clause license
|
|
6
|
+
* see: https://github.com/dcodeio/protobuf.js for details
|
|
7
|
+
*/
|
|
8
|
+
(function(undefined$1){!function(e,t,n){var r=function n(r){var i=t[r];return i||e[r][0].call(i=t[r]={exports:{}},n,i,i.exports),i.exports}(n[0]);r.util.global.protobuf=r,"function"==typeof undefined$1&&undefined$1.amd&&undefined$1(["long"],(function(e){return e&&e.isLong&&(r.util.Long=e,r.configure()),r})),module&&module.exports&&(module.exports=r)}({1:[function(e,t,n){t.exports=function(e,t){var n=new Array(arguments.length-1),r=0,i=2,o=!0;for(;i<arguments.length;)n[r++]=arguments[i++];return new Promise((function(i,s){n[r]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];i.apply(null,t)}};try{e.apply(t||null,n)}catch(e){o&&(o=!1,s(e))}}))}},{}],2:[function(e,t,n){var r=n;r.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var i=new Array(64),o=new Array(123),s=0;s<64;)o[i[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(e,t,n){for(var r,o=null,s=[],a=0,u=0;t<n;){var l=e[t++];switch(u){case 0:s[a++]=i[l>>2],r=(3&l)<<4,u=1;break;case 1:s[a++]=i[r|l>>4],r=(15&l)<<2,u=2;break;case 2:s[a++]=i[r|l>>6],s[a++]=i[63&l],u=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return u&&(s[a++]=i[r],s[a++]=61,1===u&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var a="invalid encoding";r.decode=function(e,t,n){for(var r,i=n,s=0,u=0;u<e.length;){var l=e.charCodeAt(u++);if(61===l&&s>1)break;if((l=o[l])===undefined$1)throw Error(a);switch(s){case 0:r=l,s=1;break;case 1:t[n++]=r<<2|(48&l)>>4,r=l,s=2;break;case 2:t[n++]=(15&r)<<4|(60&l)>>2,r=l,s=3;break;case 3:t[n++]=(3&r)<<6|l,s=0}}if(1===s)throw Error(a);return n-i},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},{}],3:[function(e,t,n){function r(e,t){"string"==typeof e&&(t=e,e=undefined$1);var n=[];function i(e){if("string"!=typeof e){var t=o();if(r.verbose&&console.log("codegen: "+t),t="return "+t,e){for(var s=Object.keys(e),a=new Array(s.length+1),u=new Array(s.length),l=0;l<s.length;)a[l]=s[l],u[l]=e[s[l++]];return a[l]=t,Function.apply(null,a).apply(null,u)}return Function(t)()}for(var f=new Array(arguments.length-1),c=0;c<f.length;)f[c]=arguments[++c];if(c=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var n=f[c++];switch(t){case"d":case"f":return String(Number(n));case"i":return String(Math.floor(n));case"j":return JSON.stringify(n);case"s":return String(n)}return"%"})),c!==f.length)throw Error("parameter count mismatch");return n.push(e),i}function o(r){return"function "+(r||t||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return i.toString=o,i}t.exports=r,r.verbose=!1},{}],4:[function(e,t,n){function r(){this._listeners={}}t.exports=r,r.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},r.prototype.off=function(e,t){if(e===undefined$1)this._listeners={};else if(t===undefined$1)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},r.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}},{}],5:[function(e,t,n){t.exports=o;var r=e(1),i=e(7)("fs");function o(e,t,n){return"function"==typeof t?(n=t,t={}):t||(t={}),n?!t.xhr&&i&&i.readFile?i.readFile(e,(function(r,i){return r&&"undefined"!=typeof XMLHttpRequest?o.xhr(e,t,n):r?n(r):n(null,t.binary?i:i.toString("utf8"))})):o.xhr(e,t,n):r(o,this,e,t)}o.xhr=function(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4!==r.readyState)return undefined$1;if(0!==r.status&&200!==r.status)return n(Error("status "+r.status));if(t.binary){var e=r.response;if(!e){e=[];for(var i=0;i<r.responseText.length;++i)e.push(255&r.responseText.charCodeAt(i))}return n(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return n(null,r.responseText)},t.binary&&("overrideMimeType"in r&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.responseType="arraybuffer"),r.open("GET",e),r.send()}},{1:1,7:7}],6:[function(e,t,n){function r(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function o(e,r,i){t[0]=e,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function a(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?i:o,e.writeFloatBE=r?o:i,e.readFloatLE=r?s:a,e.readFloatBE=r?a:s}():function(){function t(e,t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,r)}}function n(e,t,n){var r=e(t,n),i=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,o),e.readFloatLE=n.bind(null,s),e.readFloatBE=n.bind(null,a)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function a(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:o,e.writeDoubleBE=r?o:i,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,n,r,i,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,i,o+t),e(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))e(0,i,o+t),e(2146959360,i,o+n);else if(r>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+n);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+n);else{var u=Math.floor(Math.log(r)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(a=r*Math.pow(2,-u))>>>0,i,o+t),e((s<<31|u+1023<<20|1048576*a&1048575)>>>0,i,o+n)}}}function n(e,t,n,r,i){var o=e(r,i+t),s=e(r,i+n),a=2*(s>>31)+1,u=s>>>20&2047,l=4294967296*(1048575&s)+o;return 2047===u?l?NaN:a*(1/0):0===u?5e-324*a*l:a*Math.pow(2,u-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,o,4,0),e.readDoubleLE=n.bind(null,s,0,4),e.readDoubleBE=n.bind(null,a,4,0)}(),e}function i(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function o(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function s(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}t.exports=r(r)},{}],7:[function(require,module,exports){function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],8:[function(e,t,n){var r=n,i=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},o=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=i(e),r="";n&&(r=t.shift()+"/");for(var o=0;o<t.length;)".."===t[o]?o>0&&".."!==t[o-1]?t.splice(--o,2):n?t.splice(o,1):++o:"."===t[o]?t.splice(o,1):++o;return r+t.join("/")};r.resolve=function(e,t,n){return n||(t=o(t)),i(t)?t:(n||(e=o(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?o(e+"/"+t):t)}},{}],9:[function(e,t,n){t.exports=function(e,t,n){var r=n||8192,i=r>>>1,o=null,s=r;return function(n){if(n<1||n>i)return e(n);s+n>r&&(o=e(r),s=0);var a=t.call(o,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},{}],10:[function(e,t,n){var r=n;r.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},r.read=function(e,t,n){if(n-t<1)return"";for(var r,i=null,o=[],s=0;t<n;)(r=e[t++])<128?o[s++]=r:r>191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},r.write=function(e,t,n){for(var r,i,o=n,s=0;s<e.length;++s)(r=e.charCodeAt(s))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&i),++s,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}},{}],11:[function(e,t,n){var r=n,i=e(14),o=e(33);function s(e,t,n,r){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",r);for(var o=t.resolvedType.values,s=Object.keys(o),a=0;a<s.length;++a)t.repeated&&o[s[a]]===t.typeDefault&&e("default:"),e("case%j:",s[a])("case %i:",o[s[a]])("m%s=%j",r,o[s[a]])("break");e("}")}else e('if(typeof d%s!=="object")',r)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",r,n,r);else{var u=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",r,r);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",r,r);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",r,r);break;case"uint64":u=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",r,r,u)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,u?"true":"");break;case"bytes":e('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length)",r)("m%s=d%s",r,r);break;case"string":e("m%s=String(d%s)",r,r);break;case"bool":e("m%s=Boolean(d%s)",r,r)}}return e}function a(e,t,n,r){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",r,n,r,r):e("d%s=types[%i].toObject(m%s,o)",r,n,r);else{var o=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",r,r,r,r,o?"true":"",r);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",r,r,r,r,r);break;default:e("d%s=m%s",r,r)}}return e}r.fromObject=function(e){var t=e.fieldsArray,n=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return n("return new this.ctor");n("var m=new this.ctor");for(var r=0;r<t.length;++r){var a=t[r].resolve(),u=o.safeProp(a.name);a.map?(n("if(d%s){",u)('if(typeof d%s!=="object")',u)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",u)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",u),s(n,a,r,u+"[ks[i]]")("}")("}")):a.repeated?(n("if(d%s){",u)("if(!Array.isArray(d%s))",u)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",u)("for(var i=0;i<d%s.length;++i){",u),s(n,a,r,u+"[i]")("}")("}")):(a.resolvedType instanceof i||n("if(d%s!=null){",u),s(n,a,r,u),a.resolvedType instanceof i||n("}"))}return n("return m")},r.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);if(!t.length)return o.codegen()("return {}");for(var n=o.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),r=[],s=[],u=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?r:t[l].map?s:u).push(t[l]);if(r.length){for(n("if(o.arrays||o.defaults){"),l=0;l<r.length;++l)n("d%s=[]",o.safeProp(r[l].name));n("}")}if(s.length){for(n("if(o.objects||o.defaults){"),l=0;l<s.length;++l)n("d%s={}",o.safeProp(s[l].name));n("}")}if(u.length){for(n("if(o.defaults){"),l=0;l<u.length;++l){var f=u[l],c=o.safeProp(f.name);if(f.resolvedType instanceof i)n("d%s=o.enums===String?%j:%j",c,f.resolvedType.valuesById[f.typeDefault],f.typeDefault);else if(f.long)n("if(util.Long){")("var n=new util.Long(%i,%i,%j)",f.typeDefault.low,f.typeDefault.high,f.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",c)("}else")("d%s=o.longs===String?%j:%i",c,f.typeDefault.toString(),f.typeDefault.toNumber());else if(f.bytes){var h="["+Array.prototype.slice.call(f.typeDefault).join(",")+"]";n("if(o.bytes===String)d%s=%j",c,String.fromCharCode.apply(String,f.typeDefault))("else{")("d%s=%s",c,h)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",c,c)("}")}else n("d%s=%j",c,f.typeDefault)}n("}")}var p=!1;for(l=0;l<t.length;++l){f=t[l];var d=e._fieldsArray.indexOf(f);c=o.safeProp(f.name);f.map?(p||(p=!0,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",c,c)("d%s={}",c)("for(var j=0;j<ks2.length;++j){"),a(n,f,d,c+"[ks2[j]]")("}")):f.repeated?(n("if(m%s&&m%s.length){",c,c)("d%s=[]",c)("for(var j=0;j<m%s.length;++j){",c),a(n,f,d,c+"[j]")("}")):(n("if(m%s!=null&&m.hasOwnProperty(%j)){",c,f.name),a(n,f,d,c),f.partOf&&n("if(o.oneofs)")("d%s=%j",o.safeProp(f.partOf.name),f.name)),n("}")}return n("return d")}},{14:14,33:33}],12:[function(e,t,n){t.exports=function(e){var t=o.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var n=0;n<e.fieldsArray.length;++n){var a=e._fieldsArray[n].resolve(),u=a.resolvedType instanceof r?"int32":a.type,l="m"+o.safeProp(a.name);t("case %i:",a.id),a.map?(t("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),i.defaults[a.keyType]!==undefined$1?t("k=%j",i.defaults[a.keyType]):t("k=null"),i.defaults[u]!==undefined$1?t("value=%j",i.defaults[u]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),i.basic[u]===undefined$1?t("value=types[%i].decode(r,r.uint32())",n):t("value=r.%s()",u),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),i.long[a.keyType]!==undefined$1?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),i.packed[u]!==undefined$1&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,u)("}else"),i.basic[u]===undefined$1?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,n):t("%s.push(r.%s())",l,u)):i.basic[u]===undefined$1?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,n):t("%s=r.%s()",l,u),t("break")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),n=0;n<e._fieldsArray.length;++n){var f=e._fieldsArray[n];f.required&&t("if(!m.hasOwnProperty(%j))",f.name)("throw util.ProtocolError(%j,{instance:m})",s(f))}return t("return m")};var r=e(14),i=e(32),o=e(33);function s(e){return"missing required '"+e.name+"'"}},{14:14,32:32,33:33}],13:[function(e,t,n){t.exports=function(e){for(var t,n=o.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(o.compareFieldsById),u=0;u<a.length;++u){var l=a[u].resolve(),f=e._fieldsArray.indexOf(l),c=l.resolvedType instanceof r?"int32":l.type,h=i.basic[c];t="m"+o.safeProp(l.name),l.map?(n("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|i.mapKey[l.keyType],l.keyType),h===undefined$1?n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",f,t):n(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|h,c,t),n("}")("}")):l.repeated?(n("if(%s!=null&&%s.length){",t,t),l.packed&&i.packed[c]!==undefined$1?n("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",c,t)("w.ldelim()"):(n("for(var i=0;i<%s.length;++i)",t),h===undefined$1?s(n,l,f,t+"[i]"):n("w.uint32(%i).%s(%s[i])",(l.id<<3|h)>>>0,c,t)),n("}")):(l.optional&&n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),h===undefined$1?s(n,l,f,t):n("w.uint32(%i).%s(%s)",(l.id<<3|h)>>>0,c,t))}return n("return w")};var r=e(14),i=e(32),o=e(33);function s(e,t,n,r){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",n,r,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",n,r,(t.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(e,t,n){t.exports=s;var r=e(22);((s.prototype=Object.create(r.prototype)).constructor=s).className="Enum";var i=e(21),o=e(33);function s(e,t,n,i,o){if(r.call(this,e,n),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=o||{},this.reserved=undefined$1,t)for(var s=Object.keys(t),a=0;a<s.length;++a)"number"==typeof t[s[a]]&&(this.valuesById[this.values[s[a]]=t[s[a]]]=s[a])}s.fromJSON=function(e,t){var n=new s(e,t.values,t.options,t.comment,t.comments);return n.reserved=t.reserved,n},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:undefined$1,"comment",t?this.comment:undefined$1,"comments",t?this.comments:undefined$1])},s.prototype.add=function(e,t,n){if(!o.isString(e))throw TypeError("name must be a string");if(!o.isInteger(t))throw TypeError("id must be an integer");if(this.values[e]!==undefined$1)throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(this.valuesById[t]!==undefined$1){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=n||null,this},s.prototype.remove=function(e){if(!o.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},s.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},s.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)}},{21:21,22:22,33:33}],15:[function(e,t,n){t.exports=l;var r=e(22);((l.prototype=Object.create(r.prototype)).constructor=l).className="Field";var i,o=e(14),s=e(32),a=e(33),u=/^required|optional|repeated$/;function l(e,t,n,i,o,l,f){if(a.isObject(i)?(f=o,l=i,i=o=undefined$1):a.isObject(o)&&(f=l,l=o,o=undefined$1),r.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(n))throw TypeError("type must be a string");if(i!==undefined$1&&!u.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(o!==undefined$1&&!a.isString(o))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:undefined$1,this.type=n,this.id=t,this.extend=o||undefined$1,this.required="required"===i,this.optional=!this.required,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&s.long[n]!==undefined$1,this.bytes="bytes"===n,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=f}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,n){return"packed"===e&&(this._packed=null),r.prototype.setOption.call(this,e,t,n)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||undefined$1,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:undefined$1])},l.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=s.defaults[this.type])===undefined$1&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(this.options.packed===undefined$1||!this.resolvedType||this.resolvedType instanceof o)||delete this.options.packed,Object.keys(this.options).length||(this.options=undefined$1)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),r.prototype.resolve.call(this)},l.d=function(e,t,n,r){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(i,o){a.decorateType(i.constructor).add(new l(o,e,t,n,{default:r}))}},l._configure=function(e){i=e}},{14:14,22:22,32:32,33:33}],16:[function(e,t,n){var r=t.exports=e(17);r.build="light",r.load=function(e,t,n){return"function"==typeof t?(n=t,t=new r.Root):t||(t=new r.Root),t.load(e,n)},r.loadSync=function(e,t){return t||(t=new r.Root),t.loadSync(e)},r.encoder=e(13),r.decoder=e(12),r.verifier=e(36),r.converter=e(11),r.ReflectionObject=e(22),r.Namespace=e(21),r.Root=e(26),r.Enum=e(14),r.Type=e(31),r.Field=e(15),r.OneOf=e(23),r.MapField=e(18),r.Service=e(30),r.Method=e(20),r.Message=e(19),r.wrappers=e(37),r.types=e(32),r.util=e(33),r.ReflectionObject._configure(r.Root),r.Namespace._configure(r.Type,r.Service,r.Enum),r.Root._configure(r.Type),r.Field._configure(r.Type)},{11:11,12:12,13:13,14:14,15:15,17:17,18:18,19:19,20:20,21:21,22:22,23:23,26:26,30:30,31:31,32:32,33:33,36:36,37:37}],17:[function(e,t,n){var r=n;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=e(38),r.BufferWriter=e(39),r.Reader=e(24),r.BufferReader=e(25),r.util=e(35),r.rpc=e(28),r.roots=e(27),r.configure=i,i()},{24:24,25:25,27:27,28:28,35:35,38:38,39:39}],18:[function(e,t,n){t.exports=s;var r=e(15);((s.prototype=Object.create(r.prototype)).constructor=s).className="MapField";var i=e(32),o=e(33);function s(e,t,n,i,s,a){if(r.call(this,e,t,i,undefined$1,undefined$1,s,a),!o.isString(n))throw TypeError("keyType must be a string");this.keyType=n,this.resolvedKeyType=null,this.map=!0}s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:undefined$1])},s.prototype.resolve=function(){if(this.resolved)return this;if(i.mapKey[this.keyType]===undefined$1)throw Error("invalid key type: "+this.keyType);return r.prototype.resolve.call(this)},s.d=function(e,t,n){return"function"==typeof n?n=o.decorateType(n).name:n&&"object"==typeof n&&(n=o.decorateEnum(n).name),function(r,i){o.decorateType(r.constructor).add(new s(i,e,t,n))}}},{15:15,32:32,33:33}],19:[function(e,t,n){t.exports=i;var r=e(35);function i(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)this[t[n]]=e[t[n]]}i.create=function(e){return this.$type.create(e)},i.encode=function(e,t){return this.$type.encode(e,t)},i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},i.decode=function(e){return this.$type.decode(e)},i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},i.verify=function(e){return this.$type.verify(e)},i.fromObject=function(e){return this.$type.fromObject(e)},i.toObject=function(e,t){return this.$type.toObject(e,t)},i.prototype.toJSON=function(){return this.$type.toObject(this,r.toJSONOptions)}},{35:35}],20:[function(e,t,n){t.exports=o;var r=e(22);((o.prototype=Object.create(r.prototype)).constructor=o).className="Method";var i=e(33);function o(e,t,n,o,s,a,u,l,f){if(i.isObject(s)?(u=s,s=a=undefined$1):i.isObject(a)&&(u=a,a=undefined$1),t!==undefined$1&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(n))throw TypeError("requestType must be a string");if(!i.isString(o))throw TypeError("responseType must be a string");r.call(this,e,u),this.type=t||"rpc",this.requestType=n,this.requestStream=!!s||undefined$1,this.responseType=o,this.responseStream=!!a||undefined$1,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=f}o.fromJSON=function(e,t){return new o(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||undefined$1,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:undefined$1,"parsedOptions",this.parsedOptions])},o.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),r.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(e,t,n){t.exports=f;var r=e(22);((f.prototype=Object.create(r.prototype)).constructor=f).className="Namespace";var i,o,s,a=e(15),u=e(33);function l(e,t){if(!e||!e.length)return undefined$1;for(var n={},r=0;r<e.length;++r)n[e[r].name]=e[r].toJSON(t);return n}function f(e,t){r.call(this,e,t),this.nested=undefined$1,this._nestedArray=null}function c(e){return e._nestedArray=null,e}f.fromJSON=function(e,t){return new f(e,t.options).addJSON(t.nested)},f.arrayToJSON=l,f.isReservedId=function(e,t){if(e)for(var n=0;n<e.length;++n)if("string"!=typeof e[n]&&e[n][0]<=t&&e[n][1]>t)return!0;return!1},f.isReservedName=function(e,t){if(e)for(var n=0;n<e.length;++n)if(e[n]===t)return!0;return!1},Object.defineProperty(f.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=u.toArray(this.nested))}}),f.prototype.toJSON=function(e){return u.toObject(["options",this.options,"nested",l(this.nestedArray,e)])},f.prototype.addJSON=function(e){if(e)for(var t,n=Object.keys(e),r=0;r<n.length;++r)t=e[n[r]],this.add((t.fields!==undefined$1?i.fromJSON:t.values!==undefined$1?s.fromJSON:t.methods!==undefined$1?o.fromJSON:t.id!==undefined$1?a.fromJSON:f.fromJSON)(n[r],t));return this},f.prototype.get=function(e){return this.nested&&this.nested[e]||null},f.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof s)return this.nested[e].values;throw Error("no such enum: "+e)},f.prototype.add=function(e){if(!(e instanceof a&&e.extend!==undefined$1||e instanceof i||e instanceof s||e instanceof o||e instanceof f))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof f&&e instanceof f)||t instanceof i||t instanceof o)throw Error("duplicate name '"+e.name+"' in "+this);for(var n=t.nestedArray,r=0;r<n.length;++r)e.add(n[r]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),c(this)},f.prototype.remove=function(e){if(!(e instanceof r))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=undefined$1),e.onRemove(this),c(this)},f.prototype.define=function(e,t){if(u.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var n=this;e.length>0;){var r=e.shift();if(n.nested&&n.nested[r]){if(!((n=n.nested[r])instanceof f))throw Error("path conflicts with non-namespace objects")}else n.add(n=new f(r))}return t&&n.addJSON(t),n},f.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof f?e[t++].resolveAll():e[t++].resolve();return this.resolve()},f.prototype.lookup=function(e,t,n){if("boolean"==typeof t?(n=t,t=undefined$1):t&&!Array.isArray(t)&&(t=[t]),u.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var r=this.get(e[0]);if(r){if(1===e.length){if(!t||t.indexOf(r.constructor)>-1)return r}else if(r instanceof f&&(r=r.lookup(e.slice(1),t,!0)))return r}else for(var i=0;i<this.nestedArray.length;++i)if(this._nestedArray[i]instanceof f&&(r=this._nestedArray[i].lookup(e,t,!0)))return r;return null===this.parent||n?null:this.parent.lookup(e,t)},f.prototype.lookupType=function(e){var t=this.lookup(e,[i]);if(!t)throw Error("no such type: "+e);return t},f.prototype.lookupEnum=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},f.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[i,s]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},f.prototype.lookupService=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},f._configure=function(e,t,n){i=e,o=t,s=n}},{15:15,22:22,33:33}],22:[function(e,t,n){t.exports=o,o.className="ReflectionObject";var r,i=e(33);function o(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(o.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),o.prototype.toJSON=function(){throw Error()},o.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof r&&t._handleAdd(this)},o.prototype.onRemove=function(e){var t=e.root;t instanceof r&&t._handleRemove(this),this.parent=null,this.resolved=!1},o.prototype.resolve=function(){return this.resolved||this.root instanceof r&&(this.resolved=!0),this},o.prototype.getOption=function(e){return this.options?this.options[e]:undefined$1},o.prototype.setOption=function(e,t,n){return n&&this.options&&this.options[e]!==undefined$1||((this.options||(this.options={}))[e]=t),this},o.prototype.setParsedOption=function(e,t,n){this.parsedOptions||(this.parsedOptions=[]);var r=this.parsedOptions;if(n){var o=r.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(o){var s=o[e];i.setProperty(s,n,t)}else(o={})[e]=i.setProperty({},n,t),r.push(o)}else{var a={};a[e]=t,r.push(a)}return this},o.prototype.setOptions=function(e,t){if(e)for(var n=Object.keys(e),r=0;r<n.length;++r)this.setOption(n[r],e[n[r]],t);return this},o.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},o._configure=function(e){r=e}},{33:33}],23:[function(e,t,n){t.exports=s;var r=e(22);((s.prototype=Object.create(r.prototype)).constructor=s).className="OneOf";var i=e(15),o=e(33);function s(e,t,n,i){if(Array.isArray(t)||(n=t,t=undefined$1),r.call(this,e,n),t!==undefined$1&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}s.fromJSON=function(e,t){return new s(e,t.oneof,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:undefined$1])},s.prototype.add=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},s.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){r.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var n=e.get(this.oneof[t]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}a(this)},s.prototype.onRemove=function(e){for(var t,n=0;n<this.fieldsArray.length;++n)(t=this.fieldsArray[n]).parent&&t.parent.remove(t);r.prototype.onRemove.call(this,e)},s.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,n){o.decorateType(t.constructor).add(new s(n,e)),Object.defineProperty(t,n,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}}},{15:15,22:22,33:33}],24:[function(e,t,n){t.exports=u;var r,i=e(35),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}var l,f="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")},c=function(){return i.Buffer?function(e){return(u.create=function(e){return i.Buffer.isBuffer(e)?new r(e):f(e)})(e)}:f};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw a(this,8);return new o(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}u.create=c(),u.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,u.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return l}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|p(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},u.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},u._configure=function(e){r=e,u.create=c(),r._configure();var t=i.Long?"toLong":"toNumber";i.merge(u.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return d.call(this)[t](!0)},sfixed64:function(){return d.call(this)[t](!1)}})}},{35:35}],25:[function(e,t,n){t.exports=o;var r=e(24);(o.prototype=Object.create(r.prototype)).constructor=o;var i=e(35);function o(e){r.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},{24:24,35:35}],26:[function(e,t,n){t.exports=c;var r=e(21);((c.prototype=Object.create(r.prototype)).constructor=c).className="Root";var i,o,s,a=e(15),u=e(14),l=e(23),f=e(33);function c(e){r.call(this,"",e),this.deferred=[],this.files=[]}function h(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=f.path.resolve,c.prototype.fetch=f.fetch,c.prototype.load=function e(t,n,r){"function"==typeof n&&(r=n,n=undefined$1);var i=this;if(!r)return f.asPromise(e,i,t,n);var a=r===h;function u(e,t){if(r){var n=r;if(r=null,a)throw e;n(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var n=e.substring(t);if(n in s)return n}return null}function c(e,t){try{if(f.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),f.isString(t)){o.filename=e;var r,s=o(t,i,n),c=0;if(s.imports)for(;c<s.imports.length;++c)(r=l(s.imports[c])||i.resolvePath(e,s.imports[c]))&&p(r);if(s.weakImports)for(c=0;c<s.weakImports.length;++c)(r=l(s.weakImports[c])||i.resolvePath(e,s.weakImports[c]))&&p(r,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}a||d||u(null,i)}function p(e,t){if(!(i.files.indexOf(e)>-1))if(i.files.push(e),e in s)a?c(e,s[e]):(++d,setTimeout((function(){--d,c(e,s[e])})));else if(a){var n;try{n=f.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||u(e))}c(e,n)}else++d,i.fetch(e,(function(n,o){--d,r&&(n?t?d||u(null,i):u(n):c(e,o))}))}var d=0;f.isString(t)&&(t=[t]);for(var y,g=0;g<t.length;++g)(y=i.resolvePath("",t[g]))&&p(y);return a?i:(d||u(null,i),undefined$1)},c.prototype.loadSync=function(e,t){if(!f.isNode)throw Error("not supported");return this.load(e,t,h)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return r.prototype.resolveAll.call(this)};var p=/^[A-Z]/;function d(e,t){var n=t.parent.lookup(t.extend);if(n){var r=new a(t.fullName,t.id,t.type,t.rule,undefined$1,t.options);return r.declaringField=t,t.extensionField=r,n.add(r),!0}return!1}c.prototype._handleAdd=function(e){if(e instanceof a)e.extend===undefined$1||e.extensionField||d(0,e)||this.deferred.push(e);else if(e instanceof u)p.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof l)){if(e instanceof i)for(var t=0;t<this.deferred.length;)d(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);p.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(e){if(e instanceof a){if(e.extend!==undefined$1)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof u)p.test(e.name)&&delete e.parent[e.name];else if(e instanceof r){for(var n=0;n<e.nestedArray.length;++n)this._handleRemove(e._nestedArray[n]);p.test(e.name)&&delete e.parent[e.name]}},c._configure=function(e,t,n){i=e,o=t,s=n}},{14:14,15:15,21:21,23:23,33:33}],27:[function(e,t,n){t.exports={}},{}],28:[function(e,t,n){n.Service=e(29)},{29:29}],29:[function(e,t,n){t.exports=i;var r=e(35);function i(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,i,o);if(!a.rpcImpl)return setTimeout((function(){s(Error("already ended"))}),0),undefined$1;try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null===n)return a.end(!0),undefined$1;if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}))}catch(e){return a.emit("error",e,t),setTimeout((function(){s(e)}),0),undefined$1}},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(e,t,n){t.exports=a;var r=e(21);((a.prototype=Object.create(r.prototype)).constructor=a).className="Service";var i=e(20),o=e(33),s=e(28);function a(e,t){r.call(this,e,t),this.methods={},this._methodsArray=null}function u(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var n=new a(e,t.options);if(t.methods)for(var r=Object.keys(t.methods),o=0;o<r.length;++o)n.add(i.fromJSON(r[o],t.methods[r[o]]));return t.nested&&n.addJSON(t.nested),n.comment=t.comment,n},a.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||undefined$1,"methods",r.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||undefined$1,"comment",n?this.comment:undefined$1])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=o.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||r.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return r.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof i?(this.methods[e.name]=e,e.parent=this,u(this)):r.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof i){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,u(this)}return r.prototype.remove.call(this,e)},a.prototype.create=function(e,t,n){for(var r,i=new s.Service(e,t,n),a=0;a<this.methodsArray.length;++a){var u=o.lcFirst((r=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[u]=o.codegen(["r","c"],o.isReserved(u)?u+"_":u)("return this.rpcCall(m,q,s,r,c)")({m:r,q:r.resolvedRequestType.ctor,s:r.resolvedResponseType.ctor})}return i}},{20:20,21:21,28:28,33:33}],31:[function(e,t,n){t.exports=v;var r=e(21);((v.prototype=Object.create(r.prototype)).constructor=v).className="Type";var i=e(14),o=e(23),s=e(15),a=e(18),u=e(30),l=e(19),f=e(24),c=e(38),h=e(33),p=e(13),d=e(12),y=e(36),g=e(11),m=e(37);function v(e,t){r.call(this,e,t),this.fields={},this.oneofs=undefined$1,this.extensions=undefined$1,this.reserved=undefined$1,this.group=undefined$1,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var n=this.fields[e[t]],r=n.id;if(this._fieldsById[r])throw Error("duplicate id "+r+" in "+this);this._fieldsById[r]=n}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=h.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=h.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof l||((e.prototype=new l).constructor=e,h.merge(e.prototype,t)),e.$type=e.prototype.$type=this,h.merge(e,l,!0),this._ctor=e;for(var n=0;n<this.fieldsArray.length;++n)this._fieldsArray[n].resolve();var r={};for(n=0;n<this.oneofsArray.length;++n)r[this._oneofsArray[n].resolve().name]={get:h.oneOfGetter(this._oneofsArray[n].oneof),set:h.oneOfSetter(this._oneofsArray[n].oneof)};n&&Object.defineProperties(e.prototype,r)}}}),v.generateConstructor=function(e){for(var t,n=h.codegen(["p"],e.name),r=0;r<e.fieldsArray.length;++r)(t=e._fieldsArray[r]).map?n("this%s={}",h.safeProp(t.name)):t.repeated&&n("this%s=[]",h.safeProp(t.name));return n("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(e,t){var n=new v(e,t.options);n.extensions=t.extensions,n.reserved=t.reserved;for(var l=Object.keys(t.fields),f=0;f<l.length;++f)n.add((void 0!==t.fields[l[f]].keyType?a.fromJSON:s.fromJSON)(l[f],t.fields[l[f]]));if(t.oneofs)for(l=Object.keys(t.oneofs),f=0;f<l.length;++f)n.add(o.fromJSON(l[f],t.oneofs[l[f]]));if(t.nested)for(l=Object.keys(t.nested),f=0;f<l.length;++f){var c=t.nested[l[f]];n.add((c.id!==undefined$1?s.fromJSON:c.fields!==undefined$1?v.fromJSON:c.values!==undefined$1?i.fromJSON:c.methods!==undefined$1?u.fromJSON:r.fromJSON)(l[f],c))}return t.extensions&&t.extensions.length&&(n.extensions=t.extensions),t.reserved&&t.reserved.length&&(n.reserved=t.reserved),t.group&&(n.group=!0),t.comment&&(n.comment=t.comment),n},v.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return h.toObject(["options",t&&t.options||undefined$1,"oneofs",r.arrayToJSON(this.oneofsArray,e),"fields",r.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:undefined$1,"reserved",this.reserved&&this.reserved.length?this.reserved:undefined$1,"group",this.group||undefined$1,"nested",t&&t.nested||undefined$1,"comment",n?this.comment:undefined$1])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var n=this.oneofsArray;for(t=0;t<n.length;)n[t++].resolve();return r.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof s&&e.extend===undefined$1){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof o?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):r.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof s&&e.extend===undefined$1){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof o){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return r.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return r.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return r.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],n=0;n<this.fieldsArray.length;++n)t.push(this._fieldsArray[n].resolve().resolvedType);this.encode=p(this)({Writer:c,types:t,util:h}),this.decode=d(this)({Reader:f,types:t,util:h}),this.verify=y(this)({types:t,util:h}),this.fromObject=g.fromObject(this)({types:t,util:h}),this.toObject=g.toObject(this)({types:t,util:h});var r=m[e];if(r){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=r.fromObject.bind(i),i.toObject=this.toObject,this.toObject=r.toObject.bind(i)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof f||(e=f.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){h.decorateType(t,e)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,36:36,37:37,38:38}],32:[function(e,t,n){var r=n,i=e(33),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var n=0,r={};for(t|=0;n<e.length;)r[o[n+t]]=e[n++];return r}r.basic=s([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),r.defaults=s([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),r.long=s([0,0,0,1,1],7),r.mapKey=s([0,0,0,5,5,0,0,0,1,1,0,2],2),r.packed=s([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(e,t,n){var r,i,o=t.exports=e(35),s=e(27);o.codegen=e(3),o.fetch=e(5),o.path=e(8),o.fs=o.inquire("fs"),o.toArray=function(e){if(e){for(var t=Object.keys(e),n=new Array(t.length),r=0;r<t.length;)n[r]=e[t[r++]];return n}return[]},o.toObject=function(e){for(var t={},n=0;n<e.length;){var r=e[n++],i=e[n++];i!==undefined$1&&(t[r]=i)}return t};var a=/\\/g,u=/"/g;o.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},o.safeProp=function(e){return!/^[$\w_]+$/.test(e)||o.isReserved(e)?'["'+e.replace(a,"\\\\").replace(u,'\\"')+'"]':"."+e},o.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var l=/_([a-z])/g;o.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(l,(function(e,t){return t.toUpperCase()}))},o.compareFieldsById=function(e,t){return e.id-t.id},o.decorateType=function(t,n){if(t.$type)return n&&t.$type.name!==n&&(o.decorateRoot.remove(t.$type),t.$type.name=n,o.decorateRoot.add(t.$type)),t.$type;r||(r=e(31));var i=new r(n||t.name);return o.decorateRoot.add(i),i.ctor=t,Object.defineProperty(t,"$type",{value:i,enumerable:!1}),Object.defineProperty(t.prototype,"$type",{value:i,enumerable:!1}),i};var f=0;o.decorateEnum=function(t){if(t.$type)return t.$type;i||(i=e(14));var n=new i("Enum"+f++,t);return o.decorateRoot.add(n),Object.defineProperty(t,"$type",{value:n,enumerable:!1}),n},o.setProperty=function(e,t,n){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,n,r){var i=n.shift();if(n.length>0)t[i]=e(t[i]||{},n,r);else{var o=t[i];o&&(r=[].concat(o).concat(r)),t[i]=r}return t}(e,t=t.split("."),n)},Object.defineProperty(o,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(e(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,5:5,8:8}],34:[function(e,t,n){t.exports=i;var r=e(35);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},{35:35}],35:[function(e,t,n){var r=n;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)e[r[i]]!==undefined$1&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=e(1),r.base64=e(2),r.EventEmitter=e(4),r.float=e(6),r.inquire=e(7),r.utf8=e(10),r.pool=e(9),r.LongBits=e(34),r.isNode=Boolean(void 0!==commonjsGlobal&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),r.global=r.isNode&&commonjsGlobal||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&this[e[n]]!==undefined$1&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(e,t,n){t.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),n=e.oneofsArray,r={};n.length&&t("var p={}");for(var u=0;u<e.fieldsArray.length;++u){var l=e._fieldsArray[u].resolve(),f="m"+i.safeProp(l.name);if(l.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",f,l.name),l.map)t("if(!util.isObject(%s))",f)("return%j",o(l,"object"))("var k=Object.keys(%s)",f)("for(var i=0;i<k.length;++i){"),a(t,l,"k[i]"),s(t,l,u,f+"[k[i]]")("}");else if(l.repeated)t("if(!Array.isArray(%s))",f)("return%j",o(l,"array"))("for(var i=0;i<%s.length;++i){",f),s(t,l,u,f+"[i]")("}");else{if(l.partOf){var c=i.safeProp(l.partOf.name);1===r[l.partOf.name]&&t("if(p%s===1)",c)("return%j",l.partOf.name+": multiple values"),r[l.partOf.name]=1,t("p%s=1",c)}s(t,l,u,f)}l.optional&&t("}")}return t("return null")};var r=e(14),i=e(33);function o(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function s(e,t,n,i){if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(%s){",i)("default:")("return%j",o(t,"enum value"));for(var s=Object.keys(t.resolvedType.values),a=0;a<s.length;++a)e("case %i:",t.resolvedType.values[s[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",n,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",o(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",o(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",o(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",o(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",o(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",o(t,"buffer"))}return e}function a(e,t,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",o(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",o(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",o(t,"boolean key"))}return e}},{14:14,33:33}],37:[function(e,t,n){var r=n,i=e(19);r[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),n=this.lookup(t);if(n){var r="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return-1===r.indexOf("/")&&(r="/"+r),this.create({type_url:r,value:n.encode(n.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var n="",r="";if(t&&t.json&&e.type_url&&e.value){r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var o=this.lookup(r);o&&(e=o.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var s=e.$type.toObject(e,t);return""===n&&(n="type.googleapis.com/"),r=n+("."===e.$type.fullName[0]?e.$type.fullName.substr(1):e.$type.fullName),s["@type"]=r,s}return this.toObject(e,t)}}},{19:19}],38:[function(e,t,n){t.exports=c;var r,i=e(35),o=i.LongBits,s=i.base64,a=i.utf8;function u(e,t,n){this.fn=e,this.len=t,this.next=undefined$1,this.val=n}function l(){}function f(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new u(l,0,0),this.tail=this.head,this.states=null}var h=function(){return i.Buffer?function(){return(c.create=function(){return new r})()}:function(){return new c}};function p(e,t,n){t[n]=255&e}function d(e,t){this.len=e,this.next=undefined$1,this.val=t}function y(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function g(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}c.create=h(),c.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(c.alloc=i.pool(c.alloc,i.Array.prototype.subarray)),c.prototype._push=function(e,t,n){return this.tail=this.tail.next=new u(e,t,n),this.len+=t,this},d.prototype=Object.create(u.prototype),d.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(y,10,o.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=o.from(e);return this._push(y,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(y,t.length(),t)},c.prototype.bool=function(e){return this._push(p,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};c.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(p,1,0);if(i.isString(e)){var n=c.alloc(t=s.length(e));s.decode(e,n,0),e=n}return this.uint32(t)._push(m,t,e)},c.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(p,1,0)},c.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new u(l,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(l,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},c._configure=function(e){r=e,c.create=h(),r._configure()}},{35:35}],39:[function(e,t,n){t.exports=o;var r=e(38);(o.prototype=Object.create(r.prototype)).constructor=o;var i=e(35);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},{35:35,38:38}]},{},[16])})()})),long_1=createCommonjsModule((function(e,t){"undefined"!=typeof self&&self,e.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t){function n(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function r(e){return!0===(e&&e.__isLong__)}function i(e,t){var n,r,i;return t?(i=0<=(e>>>=0)&&e<256)&&(r=c[e])?r:(n=s(e,(0|e)<0?-1:0,!0),i&&(c[e]=n),n):(i=-128<=(e|=0)&&e<128)&&(r=f[e])?r:(n=s(e,e<0?-1:0,!1),i&&(f[e]=n),n)}function o(e,t){if(isNaN(e))return t?v:m;if(t){if(e<0)return v;if(e>=d)return T}else{if(e<=-y)return k;if(e+1>=y)return O}return e<0?o(-e,t).neg():s(e%p|0,e/p|0,t)}function s(e,t,r){return new n(e,t,r)}function a(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return a(e.substring(1),t,n).neg();for(var i=o(h(n,8)),s=m,u=0;u<e.length;u+=8){var l=Math.min(8,e.length-u),f=parseInt(e.substring(u,u+l),n);if(l<8){var c=o(h(n,l));s=s.mul(c).add(o(f))}else s=(s=s.mul(i)).add(o(f))}return s.unsigned=t,s}function u(e,t){return"number"==typeof e?o(e,t):"string"==typeof e?a(e,t):s(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}
|
|
9
|
+
/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2009 The Closure Library Authors.
|
|
12
|
+
* Copyright 2020 Daniel Wirtz / The long.js Contributors.
|
|
13
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
*/e.exports=n;var l=null;try{l=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=r;var f={},c={};n.fromInt=i,n.fromNumber=o,n.fromBits=s;var h=Math.pow;n.fromString=a,n.fromValue=u;var p=4294967296,d=p*p,y=d/2,g=i(1<<24),m=i(0);n.ZERO=m;var v=i(0,!0);n.UZERO=v;var b=i(1);n.ONE=b;var w=i(1,!0);n.UONE=w;var S=i(-1);n.NEG_ONE=S;var O=s(-1,2147483647,!1);n.MAX_VALUE=O;var T=s(-1,-1,!0);n.MAX_UNSIGNED_VALUE=T;var k=s(0,-2147483648,!1);n.MIN_VALUE=k;var _=n.prototype;_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},_.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(k)){var t=o(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=o(h(e,6),this.unsigned),s=this,a="";;){var u=s.div(i),l=(s.sub(u.mul(i)).toInt()>>>0).toString(e);if((s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(k)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},_.isZero=function(){return 0===this.high&&0===this.low},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return 1==(1&this.low)},_.isEven=function(){return 0==(1&this.low)},_.equals=function(e){return r(e)||(e=u(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},_.eq=_.equals,_.notEquals=function(e){return!this.eq(e)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(e){return this.comp(e)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(e){return this.comp(e)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(e){return this.comp(e)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(e){return this.comp(e)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(e){if(r(e)||(e=u(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(k)?k:this.not().add(b)},_.neg=_.negate,_.add=function(e){r(e)||(e=u(e));var t=this.high>>>16,n=65535&this.high,i=this.low>>>16,o=65535&this.low,a=e.high>>>16,l=65535&e.high,f=e.low>>>16,c=0,h=0,p=0,d=0;return p+=(d+=o+(65535&e.low))>>>16,h+=(p+=i+f)>>>16,c+=(h+=n+l)>>>16,c+=t+a,s((p&=65535)<<16|(d&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},_.subtract=function(e){return r(e)||(e=u(e)),this.add(e.neg())},_.sub=_.subtract,_.multiply=function(e){if(this.isZero())return m;if(r(e)||(e=u(e)),l)return s(l.mul(this.low,this.high,e.low,e.high),l.get_high(),this.unsigned);if(e.isZero())return m;if(this.eq(k))return e.isOdd()?k:m;if(e.eq(k))return this.isOdd()?k:m;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(g)&&e.lt(g))return o(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,i=this.low>>>16,a=65535&this.low,f=e.high>>>16,c=65535&e.high,h=e.low>>>16,p=65535&e.low,d=0,y=0,v=0,b=0;return v+=(b+=a*p)>>>16,y+=(v+=i*p)>>>16,v&=65535,y+=(v+=a*h)>>>16,d+=(y+=n*p)>>>16,y&=65535,d+=(y+=i*h)>>>16,y&=65535,d+=(y+=a*c)>>>16,d+=t*p+n*h+i*c+a*f,s((v&=65535)<<16|(b&=65535),(d&=65535)<<16|(y&=65535),this.unsigned)},_.mul=_.multiply,_.divide=function(e){if(r(e)||(e=u(e)),e.isZero())throw Error("division by zero");if(l)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?s((this.unsigned?l.div_u:l.div_s)(this.low,this.high,e.low,e.high),l.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:m;var t,n,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return w;i=v}else{if(this.eq(k))return e.eq(b)||e.eq(S)?k:e.eq(k)?b:(t=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?b:S:(n=this.sub(e.mul(t)),i=t.add(n.div(e)));if(e.eq(k))return this.unsigned?v:m;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=m}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(t)/Math.LN2),f=a<=48?1:h(2,a-48),c=o(t),p=c.mul(e);p.isNegative()||p.gt(n);)p=(c=o(t-=f,this.unsigned)).mul(e);c.isZero()&&(c=b),i=i.add(c),n=n.sub(p)}return i},_.div=_.divide,_.modulo=function(e){return r(e)||(e=u(e)),l?s((this.unsigned?l.rem_u:l.rem_s)(this.low,this.high,e.low,e.high),l.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return s(~this.low,~this.high,this.unsigned)},_.and=function(e){return r(e)||(e=u(e)),s(this.low&e.low,this.high&e.high,this.unsigned)},_.or=function(e){return r(e)||(e=u(e)),s(this.low|e.low,this.high|e.high,this.unsigned)},_.xor=function(e){return r(e)||(e=u(e)),s(this.low^e.low,this.high^e.high,this.unsigned)},_.shiftLeft=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):s(0,this.low<<e-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):s(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(e){return r(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):s(32===e?this.high:this.high>>>e-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.rotateLeft=function(e){var t;return r(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?s(this.high,this.low,this.unsigned):e<32?(t=32-e,s(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),s(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},_.rotl=_.rotateLeft,_.rotateRight=function(e){var t;return r(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?s(this.high,this.low,this.unsigned):e<32?(t=32-e,s(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),s(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},_.rotr=_.rotateRight,_.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},_.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},_.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}}])})),naiveFallback=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")},global$1=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return naiveFallback()}try{return __global__||naiveFallback()}finally{delete Object.prototype.__global__}}(),_from="websocket@^1.0.34",_id="websocket@1.0.34",_inBundle=!1,_integrity="sha1-K9wmAsCL8sgiU7cwZVwO99yrMRE=",_location="/websocket",_phantomChildren={},_requested={type:"range",registry:!0,raw:"websocket@^1.0.34",name:"websocket",escapedName:"websocket",rawSpec:"^1.0.34",saveSpec:null,fetchSpec:"^1.0.34"},_requiredBy=["/"],_resolved="http://registry.npm.sdp.nd/websocket/download/websocket-1.0.34.tgz",_shasum="2bdc2602c08bf2c82253b730655c0ef7dcab3111",_spec="websocket@^1.0.34",_where="C:\\NDDevProjects\\web-im-push",author={name:"Brian McKelvey",email:"theturtle32@gmail.com",url:"https://github.com/theturtle32"},browser$1="lib/browser.js",bugs={url:"https://github.com/theturtle32/WebSocket-Node/issues"},bundleDependencies=!1,config={verbose:!1},contributors=[{name:"I帽aki Baz Castillo",email:"ibc@aliax.net",url:"http://dev.sipdoc.net"}],dependencies={bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},deprecated=!1,description="Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",devDependencies={"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4",jshint:"^2.0.0","jshint-stylish":"^2.2.1",tape:"^4.9.1"},directories={lib:"./lib"},engines={node:">=4.0.0"},homepage="https://github.com/theturtle32/WebSocket-Node",keywords=["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],license="Apache-2.0",main="index",name="websocket",repository={type:"git",url:"git+https://github.com/theturtle32/WebSocket-Node.git"},scripts={gulp:"gulp",test:"tape test/unit/*.js"},version$1="1.0.34",require$$0={_from:_from,_id:_id,_inBundle:_inBundle,_integrity:_integrity,_location:_location,_phantomChildren:_phantomChildren,_requested:_requested,_requiredBy:_requiredBy,_resolved:_resolved,_shasum:_shasum,_spec:_spec,_where:_where,author:author,browser:browser$1,bugs:bugs,bundleDependencies:bundleDependencies,config:config,contributors:contributors,dependencies:dependencies,deprecated:deprecated,description:description,devDependencies:devDependencies,directories:directories,engines:engines,homepage:homepage,keywords:keywords,license:license,main:main,name:name,repository:repository,scripts:scripts,version:version$1},version=require$$0.version,_globalThis;if("object"==typeof globalThis)_globalThis=globalThis;else try{_globalThis=global$1}catch(e){}finally{if(_globalThis||"undefined"==typeof window||(_globalThis=window),!_globalThis)throw new Error("Could not determine global this")}var NativeWebSocket=_globalThis.WebSocket||_globalThis.MozWebSocket;function W3CWebSocket(e,t){return t?new NativeWebSocket(e,t):new NativeWebSocket(e)}NativeWebSocket&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(W3CWebSocket,e,{get:function(){return NativeWebSocket[e]}})}));var browser={w3cwebsocket:NativeWebSocket?W3CWebSocket:null,version:version};function appendBuffer(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer}function stringToUint8Array(e,t){if(void 0===t&&(t={stream:!1}),t.stream)throw new Error("Failed to encode: the 'stream' option is unsupported.");for(var n=0,r=e.length,i=0,o=Math.max(32,r+(r>>1)+7),s=new Uint8Array(o>>3<<3);n<r;){var a=e.charCodeAt(n++);if(a>=55296&&a<=56319){if(n<r){var u=e.charCodeAt(n);56320==(64512&u)&&(++n,a=((1023&a)<<10)+(1023&u)+65536)}if(a>=55296&&a<=56319)continue}if(i+4>s.length){o+=8,o=(o*=1+n/e.length*2)>>3<<3;var l=new Uint8Array(o);l.set(s),s=l}if(0!=(4294967168&a)){if(0==(4294965248&a))s[i++]=a>>6&31|192;else if(0==(4294901760&a))s[i++]=a>>12&15|224,s[i++]=a>>6&63|128;else{if(0!=(4292870144&a))continue;s[i++]=a>>18&7|240,s[i++]=a>>12&63|128,s[i++]=a>>6&63|128}s[i++]=63&a|128}else s[i++]=a}return s.slice(0,i)}function getExploreInfo(){var e,t={},n=navigator.userAgent.toLowerCase();return(e=n.match(/rv:([\d.]+)\) like gecko/))||(e=n.match(/msie ([\d\.]+)/))?t.ie=e[1]:(e=n.match(/edge\/([\d\.]+)/))?t.edge=e[1]:(e=n.match(/firefox\/([\d\.]+)/))?t.firefox=e[1]:(e=n.match(/(?:opera|opr).([\d\.]+)/))?t.opera=e[1]:(e=n.match(/chrome\/([\d\.]+)/))?t.chrome=e[1]:(e=n.match(/version\/([\d\.]+).*safari/))&&(t.safari=e[1]),t.ie?"IE: "+t.ie:t.edge?"EDGE: "+t.edge:t.firefox?"Firefox: "+t.firefox:t.chrome?"Chrome: "+t.chrome:t.opera?"Opera: "+t.opera:t.safari?"Safari: "+t.safari:"Unkonwn"}function functionName(e){var t=e.toString();return t=(t=t.substr("function ".length)).substr(0,t.indexOf("("))}"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n},writable:!0,configurable:!0}),Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(){return new Uint8Array(this).subarray(this.arguments)});var pushProtoRoot=protobuf.Root.fromJSON(proto.nested.push);protobuf.util.Long=long_1,protobuf.configure();var pushProto=proto.nested.push.nested,MethodID=pushProto.MethodID.values,sdkVer="2.0.16",CmdUniqueFlag={Logining:1,Alias:2},CmdPriority={Lowest:1,Low:2,Normal:3,High:4,Highest:5},SessionStatus={Uninitialized:0,Initialized:1,Logining:2,Logined:3,Relogining:4,SessionClosed:5,KickedOff:6},PshStorageType={SessionStorage:0,LocalStorage:1};function logPrefix(){return"[PSH] "+(new Date).toLocaleTimeString()+">"}function localDevTokenKey(e){return"PSHDevToken_"+e.url+"|"+e.appId+"|"+e.uuid}function loadLocalDevToken(e,t){var n;return"undefined"!=typeof window&&(t==PshStorageType.LocalStorage?window.localStorage&&(n=window.localStorage.getItem(localDevTokenKey(e))):window.sessionStorage&&(n=window.sessionStorage.getItem(localDevTokenKey(e)))),console.debug(logPrefix(),"load storage. devToken="+n),n}function storeLocalDevToken(e,t,n){t&&0!==t.length&&"undefined"!=typeof window&&(n==PshStorageType.LocalStorage?window.localStorage&&window.localStorage.setItem(localDevTokenKey(e),t):window.sessionStorage&&window.sessionStorage.setItem(localDevTokenKey(e),t))}function PshWSSession(){var e={socket:null,reqSeq:1,recvBuffer:new ArrayBuffer(0),retryTimer:null,retryIntervalSecond:10,retryIntervalMaxSecond:30,retryCount:0,deviceToken:null,loginSession:null,autoRelogin:!0,loginSucceeded:!1,status:SessionStatus.Uninitialized,lastAliveTime:(new Date).getTime(),heartIntervalTimer:null,maxIdleCount:3,pendingRequestCmds:[],maxCmdsPendingCount:10,loginSucceededListener:null,newMsgListeners:[],defCfg:{url:null,appId:null,uuid:null,heartbeatIntervalSecond:50,cleanSession:!0},config:{},alias:null,subcribedTopics:new Map,error:function(e){console.warn(logPrefix(),"error: "+e)},updateStatus:function(t){t==SessionStatus.Relogining?e.status!=SessionStatus.Logining&&(e.status=t):e.status=t,console.log(logPrefix(),Object.keys(SessionStatus).find((function(t){return SessionStatus[t]===e.status})),"("+e.status+")")},startRetry:function(){if(e.updateStatus(SessionStatus.Relogining),!e.retryTimer){e.retryTimer=setTimeout((function t(){++e.retryCount,console.debug(logPrefix(),"retry push ("+e.retryCount+") ..."),e.reconnect(),e.retryTimer&&(clearTimeout(e.retryTimer),e.retryTimer=setTimeout(t,1e3*Math.min(e.retryIntervalSecond*e.retryCount,e.retryIntervalMaxSecond)))}),1e3*e.retryIntervalSecond)}},stopRetry:function(){e.retryTimer&&(clearTimeout(e.retryTimer),e.retryTimer=null,e.retryCount=0)},sendData:function(t,n){if(e.socket){var r=new Uint8Array(8+(n?n.byteLength:0));if(r[0]=72,r[1]=80,r[2]=0,r[3]=t,n){var i=new Uint32Array(1);i[0]=n.byteLength;var o=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);r.set(o,4),r.set(n,8)}try{e.socket.send(r)}catch(e){}}},sendHeartBeat:function(){e.socket&&(console.debug(logPrefix(),"send heartbeat"),e.sendData(pushProto.OP.values.OP_HEARTBEAT))},sendHeartBeatAck:function(){e.socket&&(console.debug(logPrefix(),"send heartbeat ack"),e.sendData(pushProto.OP.values.OP_HEARTBEAT_ACK))},startHeartbeat:function(){e.stopHeartbeat();var t=1e3*e.config.heartbeatIntervalSecond;e.heartIntervalTimer=setInterval((function(){var n=(new Date).getTime();e.maxIdleCount&&n-e.lastAliveTime>(1+e.maxIdleCount)*t?(console.warn("heart check failed!"),e.clearSocket()):(e.sendHeartBeat(),e.flushRequestCommands())}),t)},stopHeartbeat:function(){e.heartIntervalTimer&&(clearInterval(e.heartIntervalTimer),e.heartIntervalTimer=null)},makeRequestCommand:function(t,n,r,i){var o=i?e.reqSeq++:0,s={methodId:t,seq:o,data:n},a=pushProtoRoot.lookupType("RequestMsg"),u={msgs:[a.encode(a.create(s)).finish()]},l=pushProtoRoot.lookupType("Body");return{seq:o,methodId:t,data:l.encode(l.create(u)).finish(),callback:"function"==typeof i?i:null,respType:r}},addRequestCommand:function(t,n,r,i,o,s){if(o)for(var a=0,u=e.pendingRequestCmds.length;a<u;a++)e.pendingRequestCmds[a]&&e.pendingRequestCmds[a].uniqueFlag==o&&(e.pendingRequestCmds[a]=null);if((h=e.makeRequestCommand(t,n,r,i)).uniqueFlag=o,h.priority=s||CmdPriority.Normal,o==CmdUniqueFlag.Logining?e.pendingRequestCmds.unshift(h):e.pendingRequestCmds.push(h),(u=e.pendingRequestCmds.length)>e.maxCmdsPendingCount){e.removeExpiredCommands();var l=0,f=CmdPriority.Highest,c=null;for(a=0;a<u;a++){var h;(h=e.pendingRequestCmds[a])&&!h.uniqueFlag&&h.priority<f&&(f=h.priority,c=h.callback,l=a)}e.pendingRequestCmds[l]=null,c&&c(-1)}return e.pendingRequestCmds=e.pendingRequestCmds.filter((function(e){return e})),e.flushRequestCommands(),h},responseCommand:function(t){var n=t.seq;0==t.errCode?console.debug(logPrefix(),"rsp << seq="+n+", code="+t.errCode):console.warn(logPrefix(),"rsp << seq="+n+", code="+t.errCode+", msg="+t.errMsg);for(var r=0,i=e.pendingRequestCmds.length;r<i;r++)if(e.pendingRequestCmds[r]&&e.pendingRequestCmds[r].seq==n){var o=e.pendingRequestCmds[r].callback,s=e.pendingRequestCmds[r].respType;if(e.pendingRequestCmds.splice(r,1),o){var a=null;if(s&&!(a=s.decode(t.data))){e.error("proto deserialize failed! seq="+n),o(-1,null,t.errMsg);continue}o(t.errCode,a,t.errMsg)}break}e.flushRequestCommands()},resetRequestCommandsStatus:function(){for(var t=0,n=e.pendingRequestCmds.length;t<n;t++)e.pendingRequestCmds[t]&&(e.pendingRequestCmds[t].sent=!1)},removeExpiredCommands:function(){for(var t=(new Date).getTime(),n=0,r=e.pendingRequestCmds.length;n<r;n++)if(e.pendingRequestCmds[n]){var i=e.pendingRequestCmds[n].expireTime;if(i>0&&i<t){var o=e.pendingRequestCmds[n].callback;e.pendingRequestCmds[n]=null,o&&o(-1)}}e.pendingRequestCmds=e.pendingRequestCmds.filter((function(e){return e}))},flushRequestCommands:function(t){if(e.socket&&e.socket.readyState===e.socket.OPEN){e.removeExpiredCommands();for(var n=0,r=0,i=e.pendingRequestCmds.length;r<i;r++)if(e.pendingRequestCmds[r]){if(t&&++n>t)return;e.status!=SessionStatus.Logined&&e.pendingRequestCmds[r].uniqueFlag!=CmdUniqueFlag.Logining||(e.pendingRequestCmds[r].sent||(e.sendRequestCommand(e.pendingRequestCmds[r]),e.pendingRequestCmds[r].sent=!0),e.pendingRequestCmds[r].seq||(e.pendingRequestCmds[r]=null))}e.pendingRequestCmds=e.pendingRequestCmds.filter((function(e){return e}))}},clearRequestCommands:function(){e.pendingRequestCmds.length=0},sendRequestCommand:function(t){e.socket&&(console.debug(logPrefix(),"req >> seq="+t.seq+", method="+Object.keys(MethodID).find((function(e){return MethodID[e]===t.methodId}))+" ("+t.methodId+")"),e.sendData(pushProto.OP.values.OP_REQUEST,t.data))},recoverSessionState:function(){e.clearRequestCommands(),e.alias&&e.alias.length>0&&this.callSetAliasMethod(e.alias);var t=[],n=[];e.subcribedTopics.forEach((function(e,r){0==e?t.push(r):n.push(r)})),t.length>0&&this.callSubscribeMethod(t,0),n.length>0&&this.callSubscribeMethod(n,1)},callCmd:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];(t=this[e]).call.apply(t,[this].concat(r))},callRegisterDeviceMethod:function(t){var n={appId:e.config.appId,devInfo:{platform:pushProto.PshPlatform.values.Platform_WEB,uuid:e.config.uuid}},r=pushProtoRoot.lookupType("RegisterDeviceReq"),i=r.encode(r.create(n)).finish();e.addRequestCommand(MethodID.METHOD_REGISTER_DEVICE,i,pushProtoRoot.lookupType("RegisterDeviceResp"),t,CmdUniqueFlag.Logining)},callReloginMethod:function(t){var n={appId:e.config.appId,devToken:e.deviceToken},r=pushProtoRoot.lookupType("ReloginReq"),i=r.encode(r.create(n)).finish();e.addRequestCommand(MethodID.METHOD_RELOGIN,i,pushProtoRoot.lookupType("ReloginResp"),t,CmdUniqueFlag.Logining)},callLoginMethod:function(t){var n={appId:e.config.appId,devToken:e.deviceToken,platform:pushProto.PshPlatform.values.Platform_WEB,sdkVer:sdkVer,sdkDesc:e.config.sdkDesc};e.config.cleanSession&&(n.serverOptions={options:{}},n.serverOptions.options[pushProto.LoginReq.nested.ServerOptions.values.CLEAN_SESSION]=1);var r=pushProtoRoot.lookupType("LoginReq"),i=r.encode(r.create(n)).finish();e.addRequestCommand(MethodID.METHOD_LOGIN,i,pushProtoRoot.lookupType("LoginResp"),t,CmdUniqueFlag.Logining)},callLogoutMethod:function(t){this.clearRequestCommands();var n=pushProtoRoot.lookupType("LogoutReq"),r=n.encode(n.create({})).finish();e.addRequestCommand(MethodID.METHOD_LOOUT,r,null,t,CmdUniqueFlag.Logining)},callAckMsgMethod:function(t,n,r){var i={msgIds:t,broadcastMsgIds:n},o=pushProtoRoot.lookupType("AckMsgReq"),s=o.encode(o.create(i)).finish();e.addRequestCommand(MethodID.METHOD_ACKMSG,s,null,r)},callSetAliasMethod:function(t,n){e.alias=t;var r={alias:t},i=pushProtoRoot.lookupType("SetAliasReq"),o=i.encode(i.create(r)).finish();console.debug("set alias:",r),e.addRequestCommand(MethodID.METHOD_SET_ALIAS,o,null,void 0===n||n,CmdUniqueFlag.Alias)},callClearAliasMethod:function(t){e.alias=null;var n=pushProtoRoot.lookupType("ClearAliasReq"),r=n.encode(n.create({})).finish();console.debug("clear alias"),e.addRequestCommand(MethodID.METHOD_CLEAR_ALIAS,r,null,void 0===t||t,CmdUniqueFlag.Alias)},callSubscribeMethod:function(t,n,r){var i={topicFilters:{}};if(n|=0,Array.isArray(t))for(var o=0,s=t.length;o<s;o++)e.subcribedTopics.set(t[o],n),i.topicFilters[t[o]]=n;else e.subcribedTopics.set(t,n),i.topicFilters[t]=n;console.debug("subscribe:",i);var a=pushProtoRoot.lookupType("SubscribeReq"),u=a.encode(a.create(i)).finish();e.addRequestCommand(MethodID.METHOD_SUBSCRIBE,u,null,void 0===r||r)},callUnsubscribeMethod:function(t,n){var r={topicFilters:[]};if(Array.isArray(t))for(var i=0,o=t.length;i<o;i++)e.subcribedTopics.delete(t[i]),r.topicFilters.push(t[i]);else e.subcribedTopics.delete(t),r.topicFilters.push(t);console.debug("unsubscribe:",r);var s=pushProtoRoot.lookupType("UnsubscribeReq"),a=s.encode(s.create(r)).finish();e.addRequestCommand(MethodID.METHOD_UNSUBSCRIBE,a,null,void 0===n||n)},callUnsubscribeAllMethod:function(t){e.subcribedTopics.clear();var n=pushProtoRoot.lookupType("UnsubscribeAllReq"),r=n.encode(n.create({})).finish();console.debug("unsubscribe all"),e.addRequestCommand(MethodID.METHOD_UNSUBSCRIBE_ALL,r,null,void 0===t||t)},callPublishMethod:function(t,n,r,i,o){var s=stringToUint8Array(n),a=0;if(void 0!==snappyjs&&s.length>100){var u=snappyjs.compress(s);s.length>u.length&&(a=pushProto.PshMsgData.nested.Compression.values.SNAPPY,s=u)}var l={compression:a,flag:r,ttl:i,topic:t,content:s},f=pushProtoRoot.lookupType("PublishReq"),c=f.encode(f.create(l)).finish(),h=15&r,p=e.addRequestCommand(MethodID.METHOD_PUBLISH,c,null,o,null,0==h?CmdPriority.Lowest:CmdPriority.Low);i>0&&(p.expireTime=(new Date).getTime()+1e3*i)},callSendUpstreamMsgMethod:function(t,n,r,i,o,s){var a={clientMsgToken:t,ttl:n,contentType:r,content:i,extraHeaders:o},u=pushProtoRoot.lookupType("SendUpstreamMsgReq"),l=u.encode(u.create(a)).finish(),f=e.addRequestCommand(MethodID.METHOD_SEND_UPSTREAM_MSG,l,null,s,null,CmdPriority.Low);n>0&&(f.expireTime=(new Date).getTime()+1e3*n)},init:function(t){Object.assign(e.config,e.defCfg,t),e.config.appId||(e.config.appId=t.appid),delete e.config.appid,e.config.heartbeatIntervalSecond||(e.config.heartbeatIntervalSecond=120),e.config.heartbeatIntervalSecond=Math.max(e.config.heartbeatIntervalSecond,10),e.config.sdkDesc||(e.config.sdkDesc=getExploreInfo()),console.debug(logPrefix(),"config:",JSON.stringify(e.config),"ver:",sdkVer),e.deviceToken=e.config.deviceToken},clearSocket:function(){if(e.socket){try{e.socket.close()}catch(e){}e.socket.onopen=null,e.socket.onclose=null,e.socket.onmessage=null,e.socket.onerror=null,e.socket=null}},reconnect:function(){if(e.config.url&&0!==e.config.url.length)if(e.config.appId&&0!==e.config.appId.length){e.clearSocket(),e.resetRequestCommandsStatus(),e.recvBuffer=new ArrayBuffer(0),e.autoRelogin=!0,console.log(logPrefix(),"connect to "+e.config.url);try{var t=browser.w3cwebsocket;e.socket=new t(e.config.url,"protobuf"),e.socket.onopen=e.onConnected,e.socket.onclose=e.onDisconnect,e.socket.onmessage=function(t){var n=new FileReader;n.readAsArrayBuffer(t.data),n.onload=function(){for(e.lastAliveTime=(new Date).getTime(),e.recvBuffer=appendBuffer(e.recvBuffer,new Uint8Array(n.result));e.processInputData(););}},e.socket.onerror=function(t){e.error(t)}}catch(e){console.error(e)}}else e.error("appId is empty!");else e.error("url is empty!")},stop:function(){e.autoRelogin=!1,e.loginSession=null,e.stopRetry(),e.stopHeartbeat(),e.clearRequestCommands(),e.callLogoutMethod(),e.clearSocket()},onConnected:function(){console.debug(logPrefix(),"connected"),e.deviceToken&&0!=e.deviceToken.length||(e.deviceToken=loadLocalDevToken(e.config,PshStorageType.SessionStorage));var t=function(t,n){if(t)e.loginSession=null;else{e.stopRetry(),e.startHeartbeat();var r=e.loginSession;e.loginSession=n.session,e.updateStatus(SessionStatus.Logined),console.debug(logPrefix(),"deviceToken="+e.deviceToken+", session="+e.loginSession),e.loginSucceeded||(e.loginSucceeded=!0,e.loginSucceededListener&&e.loginSucceededListener()),e.loginSession!=r&&e.recoverSessionState(),e.flushRequestCommands()}};e.deviceToken&&0!==e.deviceToken.length?e.loginSession&&e.loginSession.length>0?e.callReloginMethod(t):e.callLoginMethod(t):e.callRegisterDeviceMethod((function(n,r){n||(e.deviceToken=r.devToken,storeLocalDevToken(e.config,e.deviceToken,PshStorageType.SessionStorage),e.callLoginMethod(t))}))},onDisconnect:function(t){console.warn(logPrefix(),"disconnected!",t.code,t.reason,"session="+e.loginSession),e.socket=null,e.stopHeartbeat(),e.resetRequestCommandsStatus(),e.autoRelogin?e.startRetry():(e.stopRetry(),e.updateStatus(SessionStatus.SessionClosed))},processInputData:function(){var t=e.recvBuffer;if(t.byteLength<8)return!1;var n=new Uint8Array(t);if(72!=n[0]||80!=n[1])return console.warn(logPrefix(),"recv invalid data!"),e.recvBuffer=new ArrayBuffer(0),!1;var r=n[3],i=new Uint32Array(t,4,1)[0];if(8+i>t.byteLength)return!1;if(e.recvBuffer=t.slice(8+i),t=new Uint8Array(t,8,i),r==pushProto.OP.values.OP_HEARTBEAT)console.debug(logPrefix(),"recv heartbeat"),e.sendHeartBeatAck();else if(r==pushProto.OP.values.OP_HEARTBEAT_ACK)console.debug(logPrefix(),"recv heartbeat ack");else if(i>0){var o=pushProtoRoot.lookup("Body").decode(t).msgs;if(r==pushProto.OP.values.OP_REQUEST)for(var s=pushProtoRoot.lookup("RequestMsg"),a=0;a<o.length;++a){var u=s.decode(o[a]);u&&e.onNotification(u)}else if(r==pushProto.OP.values.OP_RESPONSE){var l=pushProtoRoot.lookup("ResponseMsg");for(a=0;a<o.length;++a)var f=l.decode(o[a]);f&&e.responseCommand(f)}}return!0},onNotification:function(t){var n=t.methodId;if(console.debug(logPrefix(),"noti << method="+Object.keys(MethodID).find((function(e){return MethodID[e]===n}))+" ("+n+")"),n==MethodID.METHOD_NEWMSG_NOTIFY){var r=pushProtoRoot.lookup("NewMsgNoti").decode(t.data);if(!r)return;for(var i=r.msgs,o=[],s=[],a=0;a<i.length;++a){var u=pushProtoRoot.lookup("PshDispatchedMsg").decode(i[a]);if(u){var l=new long_1(u.msgId.low,u.msgId.high,u.msgId.unsigned),f=15&u.flag,c=u.topic;console.debug(logPrefix(),"new message: topic="+c+", msg_id="+l+(u.useBroadcastInbox?" bc":"")+" qos="+f),0!=l&&0!=f&&(u.useBroadcastInbox?s.push(l):o.push(l));var h,p=pushProtoRoot.lookup("PshMsgData").decode(u.msgData);if(p)if(h=p.compression==pushProto.PshMsgData.nested.Compression.values.SNAPPY?snappyjs.uncompress(p.content):p.content,e.newMsgListeners){var d={topic:c,contentType:p.contentType,contentData:h,extraFields:p.extraFields};try{d.content=(new TextDecoder).decode(h)}catch(e){}for(a=0;a<e.newMsgListeners.length;++a)e.newMsgListeners[a](d)}}}(o.length||s.length)&&(console.debug(logPrefix(),"ack: "+o+" "+s),e.callAckMsgMethod(o,s))}else n==MethodID.METHOD_SESSION_REPLACED_NOTIFY?(e.error("session replaced!"),e.autoRelogin=!1,e.stopRetry(),e.stopHeartbeat(),e.updateStatus(SessionStatus.KickedOff)):n==MethodID.METHOD_SESSION_BROKEN_NOTIFY&&(e.warn("session broken!"),e.clearSocket())},addNewMsgListener:function(t){for(var n=0;n<e.newMsgListeners.length;n++)if(t==e.newMsgListeners[n]||functionName(t)==functionName(e.newMsgListeners[n].name))return;e.newMsgListeners.push(t)},removeNewMsgListener:function(t){var n=e.newMsgListeners.indexOf(t);-1!==n&&e.newMsgListeners.splice(n,1)}};this.connect=function(t){if(t){if(e.status!=SessionStatus.Uninitialized)return void e.error("already initialized!");e.init(t),e.updateStatus(SessionStatus.Initialized)}return e.stop(),e.updateStatus(SessionStatus.Logining),e.reconnect(),this},this.session=function(){return e}}function PushCli(){this.wsSession=null,this.onLogined=null,this.onNewMessage=null}PushCli.prototype.currentScriptPath=function(){if("undefined"!=typeof document){var e=document.querySelectorAll("script[src]");return e[e.length-1].src}}(),PushCli.prototype.defCfg={},PushCli.prototype.open=function(e,t){var n=this,r={};Object.assign(r,n.defCfg,e),n.config=r,console.log(logPrefix(),"PushCli open. config:",n.config),!n.config.disableSharedWorker&&"undefined"!=typeof window&&window.SharedWorker&&(t&&0!==t.length||(t=this.currentScriptPath),console.log(logPrefix(),"worker url: ",t),n.worker=new SharedWorker(t),n.worker.onerror=function(e){console.warn(logPrefix(),"worker error:",e,"path="+t)},n.worker.port.onmessage=function(e){var t=e.data[0],r=e.data.length>1?e.data[1]:null;"onLogined"==t&&(r&&r.deviceToken&&r.deviceToken.length>0&&(console.log(logPrefix(),"logined",r.deviceToken),storeLocalDevToken(n.config,r.deviceToken,PshStorageType.LocalStorage)),n.onLogined&&n.onLogined()),"newMsgNoti"==t&&(console.log(logPrefix(),"new message.","topic="+r.topic),n.procNewMessage(r))},n.config.deviceToken=loadLocalDevToken(n.config,PshStorageType.LocalStorage),n.worker.port.postMessage(["start",n.config]),setInterval((function(){n.worker.port.postMessage(["heart"])}),1e3)),n.worker||(n.wsSession=new PshWSSession,n.wsSession.loginSucceededListener=n.onLogined,n.wsSession.connect(n.config),n.wsSession.session().addNewMsgListener((function(e){n.procNewMessage(e)})))},PushCli.prototype.close=function(){var e=this;e.worker?e.worker.port.postMessage(["stop"]):e.wsSession.session().stop()},PushCli.prototype.procNewMessage=function(e){if(this.onNewMessage)try{this.onNewMessage(e)}catch(e){console.warn(logPrefix(),e)}},PushCli.prototype.callCmd=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i;this.worker?this.worker.port.postMessage(["cmd",e,n]):(i=this.wsSession.session()).callCmd.apply(i,[e].concat(n))},PushCli.prototype.setAlias=function(e){this.callCmd.apply(this,["callSetAliasMethod"].concat(Array.prototype.slice.call(arguments)))},PushCli.prototype.subscribe=function(e,t){this.callCmd.apply(this,["callSubscribeMethod"].concat(Array.prototype.slice.call(arguments)))},PushCli.prototype.unsubscribe=function(e){this.callCmd.apply(this,["callUnsubscribeMethod"].concat(Array.prototype.slice.call(arguments)))},PushCli.prototype.unsubscribeAll=function(){this.callCmd.apply(this,["callUnsubscribeAllMethod"].concat(Array.prototype.slice.call(arguments)))},PushCli.prototype.publish=function(e){this.callCmd("callPublishMethod",e.topic,e.content,e.flag,e.ttl)},PushCli.prototype.sendUpstream=function(e){this.callCmd("callSendUpstreamMsgMethod",e.clientMsgToken,e.ttl,e.contentType,e.content,e.extraHeaders)},"undefined"==typeof window||window.ndiot_push||(window.ndiot_push=new PushCli);var pshPortsPool=[];function pshCheckPorts(){for(var e=(new Date).getTime(),t=0;t<pshPortsPool.length;++t)e-pshPortsPool[t].lastAlive>1e4&&(pshPortsPool[t]=null);pshPortsPool=pshPortsPool.filter((function(e){return e}))}function pshFindSeesion(e){for(var t=0;t<pshPortsPool.length;++t)if(pshPortsPool[t].appId===e&&pshPortsPool[t].wsSession)return pshPortsPool[t].wsSession;return null}function pshAddPort(e){e.lastAlive=(new Date).getTime(),pshCheckPorts(),-1===pshPortsPool.indexOf(e)&&pshPortsPool.push(e)}function pshBroadcast(e,t){pshPortsPool.forEach((function(n){n.appId==e&&n.postMessage(t)}))}function XXPush(){this.pushCli=null,this.notificationListeners=[]}return"undefined"!=typeof onconnect&&(onconnect=function(e){var t=e.ports[0];pshAddPort(t),t.onmessage=function(e){var n=e.data[0],r=e.data.length>1?e.data[1]:null,i=e.data.length>2?e.data[2]:null;if("heart"!=n){console.debug("worker:",n,r,i);try{if("start"===n){console.log("start",o);var o=r,s=o.appId;if(t.appId&&t.appId!=s&&(t.wsSession=null),!t.wsSession){var a=pshFindSeesion(s);a||((a=new PshWSSession).session().loginSucceededListener=function(){pshBroadcast(s,["onLogined",{deviceToken:a.session().deviceToken}])},a.connect(o),a.session().addNewMsgListener((function(e){pshBroadcast(s,["newMsgNoti",e])}))),t.appId=s,t.wsSession=a}}else if(t.wsSession)if("stop"===n)t.wsSession=null;else if("cmd"===n){var u;(u=t.wsSession.session()).callCmd.apply(u,[r].concat(i))}}catch(e){console.warn(e)}}else pshAddPort(t)}}),XXPush.prototype.init=function(e){return console.warn(logPrefix(),"xx_push was deprecated!!! use ndiot_push instead."),this.userCfg=e,this.pushCli=new PushCli,this.pushCli.onNewMessage=function(e){if(this.notificationListeners&&this.notificationListeners.length>0)try{var t=e.extraFields,n=new Array,r=0;for(var i in t)n[r]=new Array,n[r][0]=i,n[r][1]=t[i],r++;var o={ex:n,getEntryList:function(){return this.ex}};for(r=0;r<this.notificationListeners.length;++r)this.notificationListeners[r](e.contentData,o)}catch(e){console.warn(logPrefix(),e)}},this},XXPush.prototype.connect=function(){this.pushCli.open(this.userCfg),this.loginCallback&&this.loginCallback()},XXPush.prototype.subscribe=function(e,t,n){this.pushCli.subscribe(e,t),n&&n(0)},XXPush.prototype.unSubscribe=function(e,t){this.pushCli.unsubscribe(e),t&&t(0)},XXPush.prototype.unSubscribeAll=function(e){this.pushCli.unSubscribeAll(),e&&e(0)},XXPush.prototype.setAlias=function(e,t){this.pushCli.setAlias(e),t&&t(0)},XXPush.prototype.publish=function(e,t,n,r){this.pushCli.publish({topic:e,content:t,qos:n}),r&&r(0)},XXPush.prototype.sendUpstreamMsg=function(e,t,n,r,i){this.pushCli.sendUpstream({clientMsgToken:e,ttl:t,contentType:n,content:r}),i&&i(0)},XXPush.prototype.sendUpstreamMsgWithHeader=function(e,t,n,r,i,o){this.pushCli.sendUpstream({clientMsgToken:e,ttl:t,contentType:n,content:r,extraHeaders:i}),o&&o(0)},XXPush.prototype.setNotificationListener=function(e){this.notificationListeners.push(e)},"undefined"==typeof window||window.xx_push||(window.xx_push=new XXPush),PushCli}));
|