@tachybase/module-message 1.3.22 → 1.3.24
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/dist/client/index.js +4 -4
- package/dist/externalVersion.js +6 -5
- package/dist/node_modules/@alicloud/dysmsapi20170525/package.json +1 -1
- package/dist/node_modules/@alicloud/openapi-client/package.json +1 -1
- package/dist/node_modules/@alicloud/tea-util/package.json +1 -1
- package/dist/node_modules/tencentcloud-sdk-nodejs/package.json +1 -1
- package/dist/node_modules/ws/index.js +1 -1
- package/dist/node_modules/ws/lib/permessage-deflate.js +14 -0
- package/dist/node_modules/ws/lib/sender.js +1 -1
- package/dist/node_modules/ws/lib/stream.js +2 -0
- package/dist/node_modules/ws/lib/websocket-server.js +14 -4
- package/dist/node_modules/ws/lib/websocket.js +1 -1
- package/dist/node_modules/ws/package.json +1 -1
- package/package.json +9 -8
package/dist/client/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(d,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("@tego/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("antd"),require("@tachybase/module-workflow/client"),require("lodash"),require("@ant-design/icons"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tego/client","react/jsx-runtime","react","@tachybase/schema","antd","@tachybase/module-workflow/client","lodash","@ant-design/icons","react-router-dom"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d["@tachybase/module-message"]={},d["@tachybase/client"],d["@tego/client"],d.jsxRuntime,d.react,d["@tachybase/schema"],d.antd,d["@tachybase/module-workflow"],d.lodash,d["@ant-design/icons"],d["react-router-dom"]))})(this,function(d,e,x,r,g,I,M,C,v,T,W){"use strict";var ut=Object.defineProperty,xt=Object.defineProperties;var gt=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var ht=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable;var Q=(d,e,x)=>e in d?ut(d,e,{enumerable:!0,configurable:!0,writable:!0,value:x}):d[e]=x,f=(d,e)=>{for(var x in e||(e={}))ht.call(e,x)&&Q(d,x,e[x]);if(Z)for(var x of Z(e))yt.call(e,x)&&Q(d,x,e[x]);return d},A=(d,e)=>xt(d,gt(e));var u=(d,e,x)=>new Promise((r,g)=>{var I=v=>{try{C(x.next(v))}catch(T){g(T)}},M=v=>{try{C(x.throw(v))}catch(T){g(T)}},C=v=>v.done?r(v.value):Promise.resolve(v.value).then(I,M);C((x=x.apply(d,e)).next())});const L="message-instruction",h="message",ee="messages",te="messages-update-badge-count",oe="site-message",ne="sms",se=({children:t})=>{const o=e.useApp(),n=e.useCompile(),s=e.usePlugin(D),a=g.useMemo(()=>Array.from(s.channels.getValues()),[s]).map(i=>{var p,l;return i.send||((l=(p=i.useAction)==null?void 0:p.call(i))==null?void 0:l.send)}).filter(Boolean);return g.useEffect(()=>{I.autorun(()=>{if(o.ws.connected){const i={type:"signIn",payload:{token:o.apiClient.auth.getToken()}};o.ws.send(JSON.stringify(i))}})},[]),g.useEffect(()=>{o.ws.on("message",i=>{const p=JSON.parse(i.data);if((p==null?void 0:p.type)===ee){const l=p.payload.message,m=n(l.title),b=n(l.content),w={title:m,content:b};a.forEach(S=>S==null?void 0:S(w))}})},[]),r.jsx(r.Fragment,{children:t})};class B{}const E=()=>{const{i18n:t}=e.useApp();return{t:(n,s={})=>t.t(n,f({ns:[h,"core"]},s))}},y=t=>e.tval(t,{ns:[h,"core"]});function N(t){return e.i18n.t(t,{ns:[h,"core"]})}const z=oe;class re extends B{constructor(){super(...arguments),this.name=z,this.title=N("In-App Notifications")}useAction(){const o=e.useApp();return{send:s=>{const{title:c,content:a}=s;o.notification.info({key:c,message:`${c}${a?":"+a:""}`,duration:10})}}}}class ae extends e.Plugin{load(){return u(this,null,function*(){this.app.pm.get(D).registerChannel(z,re)})}}const K=ne;class ie extends B{constructor(){super(...arguments),this.name=K,this.title=N("Text Message Alerts")}}class ce extends e.Plugin{load(){return u(this,null,function*(){this.app.pm.get(D).registerChannel(K,ie)})}}class pe extends e.Plugin{afterAdd(){return u(this,null,function*(){yield this.app.pm.add(ae),yield this.app.pm.add(ce)})}load(){return u(this,null,function*(){this.app.use(se)})}}const _="messages_providers",V={dumpRules:{group:"third-party"},name:_,shared:!0,fields:[{type:"string",name:"id",primaryKey:!0,interface:"input",uiSchema:{title:'{{t("ID")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Title")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Provider type", { ns: "${h}" })}}`,type:"string","x-component":"Select",required:!0,enum:[{label:`{{t("Aliyun SMS", { ns: "${h}" })}}`,value:"sms-aliyun"},{label:`{{t("Tencent SMS", { ns: "${h}" })}}`,value:"sms-tencent"}]}},{type:"jsonb",name:"options"},{type:"radio",name:"default",interface:"checkbox",uiSchema:{title:'{{t("Default")}}',type:"boolean","x-component":"Checkbox"}}]},le={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":`${_}:update`,"x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:V},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"}}}},id:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},options:{type:"object","x-component":"ProviderOptions"},default:{"x-component":"CollectionField","x-decorator":"FormItem"}}}}}}}}},de={type:"void",name:"NotificationProviders","x-component":M.Card,"x-component-props":{bordered:!1},properties:{tableCard:{type:"void",name:"tableCard","x-decorator":"TableBlockProvider","x-decorator-props":{collection:V,action:"list",params:{pageSize:50,sort:["-default","id"],appends:[]}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-designer":"Action.Designer","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(t){const o=e.useActionContext();return e.useRequest(()=>Promise.resolve({data:{name:`s_${I.uid()}`}}),A(f({},t),{refreshDeps:[o.visible]}))}},title:'{{t("Add new")}}',properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateDatabaseConnectionAction","x-component-props":{type:"primary"}}}},id:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t("Identifier for program usage. Support letters, numbers and underscores, must start with an letter.")}}'},title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"ProviderOptions"},default:{"x-component":"CollectionField","x-decorator":"FormItem"}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-use-decorator-props":"useTableBlockDecoratorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{id:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{id:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{default:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:le,delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}},me={type:"object",properties:{accessKeyId:{title:`{{t("Access Key ID", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},accessKeySecret:{title:`{{t("Access Key Secret", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password"},endpoint:{title:`{{t("Endpoint", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},sign:{title:`{{t("Sign", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},template:{title:`{{t("Template code", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},ue={type:"object",properties:{secretId:{title:`{{t("Secret Id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},secretKey:{title:`{{t("Secret Key", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password"},region:{title:`{{t("Region", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},endpoint:{title:`{{t("Endpoint", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"sms.tencentcloudapi.com"},SignName:{title:`{{t("Sign name", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},SmsSdkAppId:{title:`{{t("Sms sdk app id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},TemplateId:{title:`{{t("Template Id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},O=new x.Registry,q="sms-aliyun",xe="sms-tencent";O.register(q,me),O.register(xe,ue);const ge=q,he=I.observer(t=>{const o=I.useForm(),n=I.useField(),[s,c]=g.useState(new I.Schema({}));return g.useEffect(()=>{o.clearFormGraph("options.*"),c(new I.Schema(O.get(o.values.type)||{}))},[o.values.type]),r.jsx(x.FormLayout,{layout:"vertical",children:r.jsx(I.RecursionField,{basePath:n.address,onlyRenderProperties:!0,schema:s},o.values.type||ge)})},{displayName:"ProviderOptions"}),ye=()=>r.jsx(e.ExtendCollectionsProvider,{collections:[V],children:r.jsx(e.SchemaComponent,{schema:de,components:{ProviderOptions:he}})}),Ce="notification-providers";class Se extends e.Plugin{load(){return u(this,null,function*(){this.app.systemSettingsManager.add(`system-services.${Ce}`,{icon:"CheckCircleOutlined",title:`{{t("Notification providers", { ns: "${h}" })}}`,aclSnippet:"pm.message.providers",Component:ye})})}}const fe=()=>{const t=e.usePlugin(D),o=Array.from(t.channels.getValues());return r.jsx(M.Card,{children:o.map(n=>r.jsx(be,{channel:n},n.name))})},be=t=>{var w,S;const{channel:o}=t,{name:n,title:s}=o,c=e.useAPIClient(),{t:a}=E(),{message:i}=M.App.useApp(),p=e.useCurrentUserContext(),l=((S=(w=p==null?void 0:p.data)==null?void 0:w.data)==null?void 0:S.subPrefs)||{},m=l[n]||{},b=P=>u(null,null,function*(){var X;const R=yield c.resource("users").updateProfile({values:{subPrefs:A(f({},l),{[n]:{enable:P}})}});R.status===200&&i.success(a("Edited successfully")),p.mutate({data:f(f({},(X=p==null?void 0:p.data)==null?void 0:X.data),R.data.data[0])})});return r.jsxs("p",{children:[s,r.jsx(M.Switch,{checked:m.enable,onChange:b})]})};class we extends e.Plugin{load(){return u(this,null,function*(){this.userSettingsManager.add("sub-manager",{title:N("Subscription management"),icon:"BellOutlined",Component:fe})})}}class ve extends e.Plugin{afterAdd(){return u(this,null,function*(){yield this.app.pm.add(pe),yield this.app.pm.add(Se),yield this.app.pm.add(we)})}}const Ae=()=>{var l;const{workflow:t}=C.useFlowContext(),[o,n]=e.parseCollectionName((l=t.config)==null?void 0:l.collection),s=e.useSchemaInitializerItem(),{insert:c}=e.useSchemaInitializer(),{getTemplateSchemaByMode:a}=e.useSchemaTemplateManager(),i=e.useRecordCollectionDataSourceItems("FormItem"),p=b=>u(null,[b],function*({item:m}){const w=m.template?yield a(m):null,S=e.createReadPrettyFormBlockSchema({actionInitializers:null,resource:n,collection:n,dataSource:o,template:w,settings:"blockSettings:details"});v.unset(S,["x-acl-action","x-acl-action-props"]);const[P]=Object.keys(S.properties);v.set(S.properties[P],"x-use-component-props","usePropsShowDetail"),c(S)});return r.jsx(e.SchemaInitializerItem,A(f({},s),{onClick:p,items:i}))};function Ie(){var p;const t=e.usePlugin(C),{workflow:o}=C.useFlowContext(),n=C.useTrigger(),s=C.useContextNode(),c=C.useAvailableUpstreams(s),a=[(p=n.useInitializers)==null?void 0:p.call(n,o.config)].filter(Boolean),i=c.map(l=>{var b;const m=t.instructions.get(l.type);return(b=m==null?void 0:m.useInitializers)==null?void 0:b.call(m,l)}).filter(Boolean);return[...a,...i.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "workflow" })}}',children:i}]:[]].filter(Boolean)}const Me=({app:t})=>{const n=t.schemaInitializerManager.get("page:addBlock").items;return new e.SchemaInitializer({name:"InitializerBlockMessage",title:"{{t('Add block')}}",wrap:e.gridRowColWrap,items:[{name:"messageCard",type:"itemGroup",title:y("Trigger data"),children:[{name:"detail",type:"item",title:'{{t("Details")}}',Component:Ae}]},{name:"dataBlocks",type:"itemGroup",title:y("Workflow Data blocks"),checkChildrenLength:!0,useChildren:Ie},...n]})};class ke extends e.Plugin{load(){return u(this,null,function*(){const o=Me({app:this.app});this.app.schemaInitializerManager.add(o)})}}function Pe(t){const{value:o,onChange:n}=t,s=e.useAPIClient(),c=g.useCallback(p=>{},[]),{data:a,loading:i}=e.useRequest(()=>u(null,null,function*(){return yield Te({srcId:o,onChange:n,apiClient:s})}));return{schemaData:a,loading:i,handleSchemaChange:c}}function Te(s){return u(this,arguments,function*({srcId:t,onChange:o,apiClient:n}){const c=t!=null?t:x.uid(),a=De(c);if(t){const i=yield Ne({apiClient:n,srcId:t});if(i["x-uid"]===t)return i}else yield Fe({apiClient:n,schema:a}),o(c);return a})}function De(t){return{type:"void",name:t,"x-uid":t,"x-component":"Grid","x-initializer":"InitializerBlockMessage",properties:{}}}function Ne(n){return u(this,arguments,function*({apiClient:t,srcId:o}){var a;const{data:s}=yield t.request({url:`uiSchemas:getJsonSchema/${o}`});return(a=s.data)!=null?a:{}})}function Fe(n){return u(this,arguments,function*({apiClient:t,schema:o}){yield t.resource("uiSchemas").insert({values:o})})}const Be=t=>{const{schemaData:o,loading:n,handleSchemaChange:s}=Pe(t);return n?r.jsx(M.Spin,{}):r.jsx(e.SchemaComponent,{schema:o,scope:{usePropsShowDetail:()=>({})},memoized:!0,onChange:s})},Ee={actionStyle:e.css`
|
|
1
|
+
(function(d,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("@tego/client"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("antd"),require("@tachybase/module-workflow/client"),require("lodash"),require("dayjs"),require("@ant-design/icons"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tego/client","react/jsx-runtime","react","@tachybase/schema","antd","@tachybase/module-workflow/client","lodash","dayjs","@ant-design/icons","react-router-dom"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d["@tachybase/module-message"]={},d["@tachybase/client"],d["@tego/client"],d.jsxRuntime,d.react,d["@tachybase/schema"],d.antd,d["@tachybase/module-workflow"],d.lodash,d.dayjs,d["@ant-design/icons"],d["react-router-dom"]))})(this,function(d,e,x,r,g,I,M,C,v,T,W,ee){"use strict";var xt=Object.defineProperty,gt=Object.defineProperties;var ht=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var yt=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable;var Q=(d,e,x)=>e in d?xt(d,e,{enumerable:!0,configurable:!0,writable:!0,value:x}):d[e]=x,f=(d,e)=>{for(var x in e||(e={}))yt.call(e,x)&&Q(d,x,e[x]);if(Z)for(var x of Z(e))Ct.call(e,x)&&Q(d,x,e[x]);return d},A=(d,e)=>gt(d,ht(e));var u=(d,e,x)=>new Promise((r,g)=>{var I=v=>{try{C(x.next(v))}catch(T){g(T)}},M=v=>{try{C(x.throw(v))}catch(T){g(T)}},C=v=>v.done?r(v.value):Promise.resolve(v.value).then(I,M);C((x=x.apply(d,e)).next())});const L="message-instruction",h="message",te="messages",oe="messages-update-badge-count",ne="site-message",se="sms",re=({children:t})=>{const o=e.useApp(),n=e.useCompile(),s=e.usePlugin(D),a=g.useMemo(()=>Array.from(s.channels.getValues()),[s]).map(i=>{var p,l;return i.send||((l=(p=i.useAction)==null?void 0:p.call(i))==null?void 0:l.send)}).filter(Boolean);return g.useEffect(()=>{I.autorun(()=>{if(o.ws.connected){const i={type:"signIn",payload:{token:o.apiClient.auth.getToken()}};o.ws.send(JSON.stringify(i))}})},[]),g.useEffect(()=>{o.ws.on("message",i=>{const p=JSON.parse(i.data);if((p==null?void 0:p.type)===te){const l=p.payload.message,m=n(l.title),b=n(l.content),w={title:m,content:b};a.forEach(S=>S==null?void 0:S(w))}})},[]),r.jsx(r.Fragment,{children:t})};class B{}const E=()=>{const{i18n:t}=e.useApp();return{t:(n,s={})=>t.t(n,f({ns:[h,"core"]},s))}},y=t=>e.tval(t,{ns:[h,"core"]});function N(t){return e.i18n.t(t,{ns:[h,"core"]})}const z=ne;class ae extends B{constructor(){super(...arguments),this.name=z,this.title=N("In-App Notifications")}useAction(){const o=e.useApp();return{send:s=>{const{title:c,content:a}=s;o.notification.info({key:c,message:`${c}${a?":"+a:""}`,duration:10})}}}}class ie extends e.Plugin{load(){return u(this,null,function*(){this.app.pm.get(D).registerChannel(z,ae)})}}const K=se;class ce extends B{constructor(){super(...arguments),this.name=K,this.title=N("Text Message Alerts")}}class pe extends e.Plugin{load(){return u(this,null,function*(){this.app.pm.get(D).registerChannel(K,ce)})}}class le extends e.Plugin{afterAdd(){return u(this,null,function*(){yield this.app.pm.add(ie),yield this.app.pm.add(pe)})}load(){return u(this,null,function*(){this.app.use(re)})}}const _="messages_providers",V={dumpRules:{group:"third-party"},name:_,shared:!0,fields:[{type:"string",name:"id",primaryKey:!0,interface:"input",uiSchema:{title:'{{t("ID")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Title")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Provider type", { ns: "${h}" })}}`,type:"string","x-component":"Select",required:!0,enum:[{label:`{{t("Aliyun SMS", { ns: "${h}" })}}`,value:"sms-aliyun"},{label:`{{t("Tencent SMS", { ns: "${h}" })}}`,value:"sms-tencent"}]}},{type:"jsonb",name:"options"},{type:"radio",name:"default",interface:"checkbox",uiSchema:{title:'{{t("Default")}}',type:"boolean","x-component":"Checkbox"}}]},de={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":`${_}:update`,"x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:V},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary"}}}},id:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},options:{type:"object","x-component":"ProviderOptions"},default:{"x-component":"CollectionField","x-decorator":"FormItem"}}}}}}}}},me={type:"void",name:"NotificationProviders","x-component":M.Card,"x-component-props":{bordered:!1},properties:{tableCard:{type:"void",name:"tableCard","x-decorator":"TableBlockProvider","x-decorator-props":{collection:V,action:"list",params:{pageSize:50,sort:["-default","id"],appends:[]}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-designer":"Filter.Action.Designer","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-designer":"Action.Designer","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(t){const o=e.useActionContext();return e.useRequest(()=>Promise.resolve({data:{name:`s_${I.uid()}`}}),A(f({},t),{refreshDeps:[o.visible]}))}},title:'{{t("Add new")}}',properties:{actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:24}},properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateDatabaseConnectionAction","x-component-props":{type:"primary"}}}},id:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t("Identifier for program usage. Support letters, numbers and underscores, must start with an letter.")}}'},title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"ProviderOptions"},default:{"x-component":"CollectionField","x-decorator":"FormItem"}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-use-decorator-props":"useTableBlockDecoratorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{id:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{id:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{default:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:de,delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}}}},ue={type:"object",properties:{accessKeyId:{title:`{{t("Access Key ID", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},accessKeySecret:{title:`{{t("Access Key Secret", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password"},endpoint:{title:`{{t("Endpoint", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},sign:{title:`{{t("Sign", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},template:{title:`{{t("Template code", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},xe={type:"object",properties:{secretId:{title:`{{t("Secret Id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},secretKey:{title:`{{t("Secret Key", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password"},region:{title:`{{t("Region", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},endpoint:{title:`{{t("Endpoint", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"sms.tencentcloudapi.com"},SignName:{title:`{{t("Sign name", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},SmsSdkAppId:{title:`{{t("Sms sdk app id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"},TemplateId:{title:`{{t("Template Id", { ns: "${h}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},O=new x.Registry,q="sms-aliyun",ge="sms-tencent";O.register(q,ue),O.register(ge,xe);const he=q,ye=I.observer(t=>{const o=I.useForm(),n=I.useField(),[s,c]=g.useState(new I.Schema({}));return g.useEffect(()=>{o.clearFormGraph("options.*"),c(new I.Schema(O.get(o.values.type)||{}))},[o.values.type]),r.jsx(x.FormLayout,{layout:"vertical",children:r.jsx(I.RecursionField,{basePath:n.address,onlyRenderProperties:!0,schema:s},o.values.type||he)})},{displayName:"ProviderOptions"}),Ce=()=>r.jsx(e.ExtendCollectionsProvider,{collections:[V],children:r.jsx(e.SchemaComponent,{schema:me,components:{ProviderOptions:ye}})}),Se="notification-providers";class fe extends e.Plugin{load(){return u(this,null,function*(){this.app.systemSettingsManager.add(`system-services.${Se}`,{icon:"CheckCircleOutlined",title:`{{t("Notification providers", { ns: "${h}" })}}`,aclSnippet:"pm.message.providers",Component:Ce})})}}const be=()=>{const t=e.usePlugin(D),o=Array.from(t.channels.getValues());return r.jsx(M.Card,{children:o.map(n=>r.jsx(we,{channel:n},n.name))})},we=t=>{var w,S;const{channel:o}=t,{name:n,title:s}=o,c=e.useAPIClient(),{t:a}=E(),{message:i}=M.App.useApp(),p=e.useCurrentUserContext(),l=((S=(w=p==null?void 0:p.data)==null?void 0:w.data)==null?void 0:S.subPrefs)||{},m=l[n]||{},b=P=>u(null,null,function*(){var X;const R=yield c.resource("users").updateProfile({values:{subPrefs:A(f({},l),{[n]:{enable:P}})}});R.status===200&&i.success(a("Edited successfully")),p.mutate({data:f(f({},(X=p==null?void 0:p.data)==null?void 0:X.data),R.data.data[0])})});return r.jsxs("p",{children:[s,r.jsx(M.Switch,{checked:m.enable,onChange:b})]})};class ve extends e.Plugin{load(){return u(this,null,function*(){this.userSettingsManager.add("sub-manager",{title:N("Subscription management"),icon:"BellOutlined",Component:be})})}}class Ae extends e.Plugin{afterAdd(){return u(this,null,function*(){yield this.app.pm.add(le),yield this.app.pm.add(fe),yield this.app.pm.add(ve)})}}const Ie=()=>{var l;const{workflow:t}=C.useFlowContext(),[o,n]=e.parseCollectionName((l=t.config)==null?void 0:l.collection),s=e.useSchemaInitializerItem(),{insert:c}=e.useSchemaInitializer(),{getTemplateSchemaByMode:a}=e.useSchemaTemplateManager(),i=e.useRecordCollectionDataSourceItems("FormItem"),p=b=>u(null,[b],function*({item:m}){const w=m.template?yield a(m):null,S=e.createReadPrettyFormBlockSchema({actionInitializers:null,resource:n,collection:n,dataSource:o,template:w,settings:"blockSettings:details"});v.unset(S,["x-acl-action","x-acl-action-props"]);const[P]=Object.keys(S.properties);v.set(S.properties[P],"x-use-component-props","usePropsShowDetail"),c(S)});return r.jsx(e.SchemaInitializerItem,A(f({},s),{onClick:p,items:i}))};function Me(){var p;const t=e.usePlugin(C),{workflow:o}=C.useFlowContext(),n=C.useTrigger(),s=C.useContextNode(),c=C.useAvailableUpstreams(s),a=[(p=n.useInitializers)==null?void 0:p.call(n,o.config)].filter(Boolean),i=c.map(l=>{var b;const m=t.instructions.get(l.type);return(b=m==null?void 0:m.useInitializers)==null?void 0:b.call(m,l)}).filter(Boolean);return[...a,...i.length?[{name:"nodes",type:"subMenu",title:'{{t("Node result", { ns: "workflow" })}}',children:i}]:[]].filter(Boolean)}const ke=({app:t})=>{const n=t.schemaInitializerManager.get("page:addBlock").items;return new e.SchemaInitializer({name:"InitializerBlockMessage",title:"{{t('Add block')}}",wrap:e.gridRowColWrap,items:[{name:"messageCard",type:"itemGroup",title:y("Trigger data"),children:[{name:"detail",type:"item",title:'{{t("Details")}}',Component:Ie}]},{name:"dataBlocks",type:"itemGroup",title:y("Workflow Data blocks"),checkChildrenLength:!0,useChildren:Me},...n]})};class Pe extends e.Plugin{load(){return u(this,null,function*(){const o=ke({app:this.app});this.app.schemaInitializerManager.add(o)})}}function Te(t){const{value:o,onChange:n}=t,s=e.useAPIClient(),c=g.useCallback(p=>{},[]),{data:a,loading:i}=e.useRequest(()=>u(null,null,function*(){return yield De({srcId:o,onChange:n,apiClient:s})}));return{schemaData:a,loading:i,handleSchemaChange:c}}function De(s){return u(this,arguments,function*({srcId:t,onChange:o,apiClient:n}){const c=t!=null?t:x.uid(),a=Ne(c);if(t){const i=yield Fe({apiClient:n,srcId:t});if(i["x-uid"]===t)return i}else yield Be({apiClient:n,schema:a}),o(c);return a})}function Ne(t){return{type:"void",name:t,"x-uid":t,"x-component":"Grid","x-initializer":"InitializerBlockMessage",properties:{}}}function Fe(n){return u(this,arguments,function*({apiClient:t,srcId:o}){var a;const{data:s}=yield t.request({url:`uiSchemas:getJsonSchema/${o}`});return(a=s.data)!=null?a:{}})}function Be(n){return u(this,arguments,function*({apiClient:t,schema:o}){yield t.resource("uiSchemas").insert({values:o})})}const Ee=t=>{const{schemaData:o,loading:n,handleSchemaChange:s}=Te(t);return n?r.jsx(M.Spin,{}):r.jsx(e.SchemaComponent,{schema:o,scope:{usePropsShowDetail:()=>({})},memoized:!0,onChange:s})},Ve={actionStyle:e.css`
|
|
2
2
|
.ant-drawer-body {
|
|
3
3
|
background: var(--tb-box-bg);
|
|
4
4
|
}
|
|
5
|
-
`},
|
|
5
|
+
`},Oe={name:"drawer",type:"void",title:y("The interface of show message detail"),"x-component":"Action.Drawer","x-component-props":{className:Ve.actionStyle},properties:{showMessageDetail:{type:"string","x-component":"ViewMessageDetail"}}},$=()=>{const t=g.useContext(e.SchemaComponentContext),[,o]=g.useState(x.uid()),{workflow:n}=C.useFlowContext(),s=g.useMemo(()=>A(f({},t),{reset:()=>{},refresh:()=>{o(x.uid())},designable:!n.executed}),[t,n.executed]);return r.jsx(e.SchemaComponentContext.Provider,{value:s,children:r.jsx(e.SchemaComponent,{schema:Oe,components:{ViewMessageDetail:Ee}})})};e.createStyles({});const j={ArrayItemsStyle:e.css`
|
|
6
6
|
&[disabled] {
|
|
7
7
|
> .ant-formily-array-base-addition {
|
|
8
8
|
display: none;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
> .ant-space-item:nth-child(2) {
|
|
20
20
|
flex-grow: 1;
|
|
21
21
|
}
|
|
22
|
-
`};class
|
|
22
|
+
`};class Le extends C.Instruction{constructor(){super(...arguments),this.title=y("Site Messages"),this.type=L,this.group=C.BuiltinGroupType.EXTENDED,this.icon="SiteMessage",this.color="#1eca0a",this.description=y("In the workflow, notification messages can be viewed by the notified person in the notification center."),this.components={ArrayItems:x.ArrayItems,SelectNotifiedPerson:C.SelectNotifiedPerson,AdditionNotifiedPerson:C.AdditionNotifiedPerson,ConfigButtonMessage:C.ConfigButtonMessage,WorkflowVariableCodeMirror:C.WorkflowVariableCodeMirror,MessageDetail:$,ViewShowMessage:$},this.fieldset={notifiedPerson:{type:"array",title:y("The Notified Person"),required:!0,"x-decorator":"FormItem","x-component":"ArrayItems","x-component-props":{className:j.ArrayItemsStyle},items:{type:"void","x-component":"Space","x-component-props":{className:j.SpaceStyle},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},input:{type:"string","x-decorator":"FormItem","x-component":"SelectNotifiedPerson"},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{add:{type:"void",title:y("Add Notified Person"),"x-component":"AdditionNotifiedPerson"}}},title:{type:"string",title:y("Title"),required:!0,"x-decorator":"FormItem","x-component":"WorkflowVariableCodeMirror","x-component-props":{changeOnSelect:!0,height:100,options:U()}},content:{type:"string",title:y("Content"),"x-decorator":"FormItem","x-component":"WorkflowVariableCodeMirror","x-component-props":{changeOnSelect:!0,options:U()}},showMessageDetail:{type:"void",title:y("Show message detail"),"x-decorator":"FormItem","x-component":"ConfigButtonMessage",properties:{showNoticeDetail:{type:"void","x-component":"ViewShowMessage"}}}}}useCurrentFormVariables(o,n){const s=e.useCompile(),{key:c}=o,{fieldNames:a}=n;return Object.entries(this.fieldset).map(([l,m])=>({[a.label]:s(m==null?void 0:m.title)||l,[a.value]:`${l}`}))}}function U(){return[{label:y("Message variables"),value:"$messageVariables",children:[{label:y("The Notified Person"),value:"notifiedPerson",children:[{label:'{{t("Nickname")}}',value:"nickname"}]}]}]}class ze extends e.Plugin{afterAdd(){return u(this,null,function*(){yield this.app.pm.add(Pe)})}load(){return u(this,null,function*(){this.pm.get(C).registerInstruction(L,Le)})}}const k=t=>`{{t("${t}", ${JSON.stringify({ns:[h,"core"]})})}}`,F="messages",Ke={dumpRules:"required",name:F,title:k("Site Messages"),sortable:!0,createdBy:!0,updatedBy:!0,logging:!0,fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,interface:"id"},{name:"createdAt",interface:"createdAt",type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0}},{name:"title",interface:"input",type:"string",allowNull:!1,unique:!1,uiSchema:{type:"string",title:k("Title"),"x-component":"Input",required:!0}},{name:"content",interface:"input",type:"string",allowNull:!1,unique:!1,uiSchema:{type:"string",title:k("Content"),"x-component":"Input",required:!0}},{name:"collectionName",interface:"input",type:"string"},{name:"dataKey",type:"string",interface:"input"},{name:"jsonContent",interface:"input",type:"jsonb",uiSchema:{type:"array",title:k("Content"),"x-component":"ShowJsonContent","x-component-props":{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}},{type:"jsonb",name:"snapshot",defaultValue:{}},{name:"read",type:"boolean",interface:"checkbox",defaultValue:!1,description:k("Read"),uiSchema:{"x-component-props":{showUnchecked:!0},type:"boolean","x-component":"Checkbox",title:k("Read")}},{name:"userId",type:"bigInt",interface:"integer",isForeignKey:!0,uiSchema:{type:"number",title:"userId","x-component":"InputNumber","x-read-pretty":!0}},{name:"user",foreignKey:"userId",onDelete:"CASCADE",type:"belongsTo",interface:"m2o",uiSchema:{"x-component":"AssociationField","x-component-props":{multiple:!1,fieldNames:{label:"id",value:"id"}},title:k("User")},target:"users",targetKey:"id"},{name:"schema",type:"belongsTo",target:"uiSchemas",targetKey:"x-uid",foreignKey:"schemaName",constraints:!1}]},_e=t=>{const{collection:o,params:n={filter:{}},action:s="list",children:c}=t,a=e.useCollectionRecordData(),i={collection:o,resource:o,action:s,params:A(f({pageSize:20,sort:["-createdAt"]},n),{filter:a!=null&&a.id?f({dataKey:`${a.id}`},n.filter):f({},n.filter)}),rowKey:"id",showIndex:!0,dragSort:!1};return r.jsx(e.ExtendCollectionsProvider,{collections:[Ke],children:r.jsx(e.TableBlockProvider,A(f({name:o},i),{children:c}))})};function qe(t){const{onClick:o}=t,n=e.useAPIClient(),{refresh:s}=e.useDataBlockRequest(),c=e.useCollectionRecordData(),{id:a,read:i}=c,p=()=>u(null,null,function*(){o==null||o(),a&&!i&&(yield n.resource("messages").update({filter:{id:a},values:{read:!0}}),s())});return A(f({},t),{onClick:p})}const G=g.createContext(null),$e=G.Provider;function je(){return g.useContext(G)}function Ue(){const{snapshot:t}=je(),{form:o}=e.useFormBlockContext();return g.useEffect(()=>{o.setValues(t||{})},[o,t]),{form:o}}const Ge=t=>{const{record:o}=t,n=e.useSchemaComponentContext(),{schemaName:s}=o,[c,a]=g.useState({}),i={filterByTk:{}},{run:p}=e.useRequest({resource:o==null?void 0:o.collectionName,action:"get",params:i},{manual:!0,onSuccess(l){a(l.data||{})}});return g.useEffect(()=>{o!=null&&o.dataKey&&!Object.keys(c).length&&(i.filterByTk=o.dataKey,p())},[o]),(Object.keys(c).length||!o.dataKey)&&r.jsx(e.RecordProvider,{record:f({record:o},c),children:r.jsx($e,{value:o,children:r.jsx(e.SchemaComponentContext.Provider,{value:A(f({},n),{designable:!1}),children:r.jsx(e.RemoteSchemaComponent,{uid:s,noForm:!0})})})})},He=t=>{const{record:o}=t;return{name:`view-${o.id}`,type:"void",title:'{{t("View", {"ns":["messages","client"]})}}',"x-action":"view","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer"},"x-use-component-props":"usePropsCheckLink",properties:{drawer:{type:"void",title:'{{t("View record", {"ns":["messages","client"]})}}',"x-component":"Action.Drawer","x-component-props":{className:"tb-action-popup"},properties:{checkContent:{type:"void","x-component":"ViewCheckContent","x-component-props":{record:o}}}}}}},Je=()=>{const t=e.useCollectionRecordData(),o=He({record:t});return r.jsx(e.SchemaComponent,{schema:o,components:{ViewCheckContent:Ge},scope:{usePropsCheckLink:qe,usePropsShowDetail:Ue}})},Ye=e.createStyles(({css:t})=>({columnShowJSON:t`
|
|
23
23
|
text-align: left;
|
|
24
24
|
.json-item {
|
|
25
25
|
display: flex;
|
|
@@ -41,4 +41,4 @@
|
|
|
41
41
|
text-overflow: ellipsis;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
`})),
|
|
44
|
+
`})),Re=t=>{const{value:o}=t,n=e.useCollectionRecordData(),s=e.useCollectionManager(),c=e.useCompile(),{styles:a}=Ye(),{collectionName:i}=n,p=g.useMemo(()=>Object.entries(o||{}).map(([l,m])=>{var S,P;const b=s.getCollectionField(`${i}.${l}`),w=Object.prototype.toString.call(m)==="[object Object]"?m==null?void 0:m.name:m;return Ze(w)?{label:c(((S=b==null?void 0:b.uiSchema)==null?void 0:S.title)||l),value:Qe(w)}:{label:c(((P=b==null?void 0:b.uiSchema)==null?void 0:P.title)||l),value:w}}),[]);return r.jsx("div",{className:a.columnShowJSON,children:p.map(l=>r.jsxs("div",{className:"json-item",children:[r.jsxs("div",{className:"item-label",children:[`${l.label}:`," "]}),r.jsx("div",{className:"item-value",children:l.value})]},l.label))})},Xe=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function Ze(t=""){return Xe.test(t)}function Qe(t){return T.utc(t).local().format("YYYY-MM-DD HH:mm:ss")}const We=()=>{const{t}=E(),o=e.useCollectionRecordData(),{schemaName:n}=o||{},s=`${location.origin}/r/${n}`;return r.jsx("a",{href:s,target:"_blank",children:t("External link")})},et=t=>{const{record:o}=t;return{name:`delete-${o.id}`,type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-action-settings":{triggerWorkflows:[]},"x-decorator":"ACLActionProvider"}},tt=t=>{const o=e.useCollectionRecordData(),n=et({record:o});return r.jsx(e.SchemaComponent,{schema:n})},ot={type:"void",name:"schemaTableMessages",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-component-props":{icon:"FilterOutlined"},"x-use-component-props":"useFilterActionProps","x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"},"x-align":"right"},delete:{type:"void",title:'{{ t("Delete") }}',"x-action":"destroy","x-component":"Action","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0},"x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-acl-action":"messages:destroy","x-align":"right"},setHaveReaded:{type:"void",title:y("Mark as read"),"x-action":"customize:bulkUpdate","x-action-settings":{assignedValues:{read:!0},updateMode:"selected",onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Updated successfully")}}'}},"x-component":"Action","x-use-component-props":"useCustomizeBulkUpdateActionProps","x-component-props":{icon:"InboxOutlined"},"x-align":"right"},setAllHaveReaded:{type:"void",title:y("Mark all as read"),"x-component":"Action","x-use-component-props":"useCustomizeBulkUpdateActionProps","x-component-props":{icon:"InboxOutlined"},"x-action":"customize:bulkUpdate","x-action-settings":{assignedValues:{read:!0},updateMode:"all",onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Updated successfully")}}'}},"x-align":"right"}}},table:{type:"array","x-component":"TableV2","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},"x-use-component-props":"useTableBlockProps",properties:{actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:50,align:"center"},"x-designer":"TableV2.ActionColumnDesigner","x-initializer":"MessageTable:configureItemActions",properties:{actionList:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{checkLink:{"x-component":"ViewCheckLink"},delete:{"x-component":"ViewDeleteLink"}}}}},read:{type:"void",title:y("Read"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20,align:"center"},properties:{read:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{showUnchecked:!0}}}},createdAt:{type:"void",title:y("Created at"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{createdAt:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},title:{type:"void",title:y("Title"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},content:{type:"void",title:y("Content"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{content:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},jsonContent:{type:"void",title:y("Summary"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:350,align:"center"},properties:{jsonContent:{type:"string","x-component":"ColumnShowJSON"}}},url:{type:"void",title:y("URL"),"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:100,align:"center"},properties:{url:{type:"string","x-component":"ColumnShowURL"}}}}}}},nt=()=>r.jsx(e.SchemaComponent,{schema:ot,components:{ViewCheckLink:Je,ViewDeleteLink:tt,ColumnShowURL:We,ColumnShowJSON:Re}}),H=t=>{const{params:o}=t||{};return{type:"void",name:"message-table","x-uid":"message-table","x-decorator":"Messages-ProviderCollectionMessages","x-decorator-props":{collection:F,action:"list",params:o},"x-component":"CardItem","x-acl-action":"messages:list","x-toolbar":"BlockSchemaToolbar","x-settings":"blockSettings:table",properties:{block:{type:"void","x-component":"Messages-ViewTableMessages"}}}},st=()=>{const t=e.useSchemaInitializerItem(),{insert:o}=e.useSchemaInitializer(),n=()=>{const s=H();o(s)};return r.jsx(e.SchemaInitializerItem,A(f({},t),{onClick:n}))},J="otherBlocks.messages",Y={name:"messageBlock",type:"item",title:e.tval("Site Messages"),icon:"BellOutlined",Component:"Messages-ViewBlockInitItem",collection:F,params:{appends:[]}};class rt extends e.Plugin{load(){return u(this,null,function*(){this.app.addComponents({"Messages-ViewBlockInitItem":st}),this.app.schemaInitializerManager.get("page:addBlock").add(J,Y),this.app.schemaInitializerManager.get("popup:common:addBlock").add(J,Y)})}}const at=t=>{const o=H(t);return r.jsx(e.SchemaComponent,{memoized:!0,schema:o})},it={type:"void",properties:{page:{type:"void","x-component":"Page",title:N("Site Messages"),properties:{messages:{type:"void","x-component":"ViewTableMessagesWrapper"}}}}},ct=()=>{const t=e.useSchemaComponentContext();return r.jsx(e.SchemaComponentContext.Provider,{value:A(f({},t),{designable:!1}),children:r.jsx(e.SchemaComponent,{schema:it,components:{ViewTableMessagesWrapper:at}})})};class pt extends e.Plugin{load(){return u(this,null,function*(){this.addRouters()})}addRouters(){this.app.router.add("app.messages",{path:"messages",Component:ct})}}function lt(t=0){var l;const o=e.useAPIClient(),n=e.useCurrentUserContext(),s=(l=n==null?void 0:n.data)==null?void 0:l.data,[c,a]=g.useState(t),i=()=>u(null,null,function*(){var w,S;const m=yield o.request({resource:F,action:"count",params:{filter:{read:!1,userId:s==null?void 0:s.id}}}),b=(S=(w=m==null?void 0:m.data)==null?void 0:w.data)!=null?S:0;a(b)}),p=g.useMemo(()=>v.debounce(i,300),[i]);return e.useNoticeSub(oe,()=>{p()}),g.useEffect(()=>{i()},[]),{badgeCount:c}}const dt=()=>{const t=ee.useNavigate(),{token:o}=e.useToken(),{t:n}=E(),{badgeCount:s}=lt(),c=()=>t("/admin/messages");return r.jsx(M.Tooltip,{title:n("Site Messages"),children:r.jsx(M.Badge,{count:s,overflowCount:99,offset:["-10%","40%"],size:"small",children:r.jsx(M.Button,{icon:r.jsx(W.BellOutlined,{style:{color:o.colorTextHeaderMenu}}),title:n("Site Messages"),onClick:c})})})},mt=t=>r.jsx(e.PinnedPluginListProvider,{items:{nl:{order:220,component:"NotificationLink",pin:!0,isPublic:!0,belongTo:"pinnedmenu"}},children:r.jsx(e.SchemaComponentOptions,{components:{NotificationLink:dt},children:t.children})});class ut extends e.Plugin{afterAdd(){return u(this,null,function*(){this.app.use(mt),yield this.app.pm.add(pt),yield this.app.pm.add(rt)})}load(){return u(this,null,function*(){this.app.addComponents({"Messages-ProviderCollectionMessages":_e,"Messages-ViewTableMessages":nt}),this.app.addScopes({useSubmit:()=>({run(){return u(this,null,function*(){})}})})})}}class D extends e.Plugin{constructor(){super(...arguments),this.channels=new x.Registry}registerChannel(o,n){if(typeof n=="function")this.channels.register(o,new n);else if(n instanceof B)this.channels.register(o,n);else throw new TypeError("invalid channel type to register")}afterAdd(){return u(this,null,function*(){yield this.app.pm.add(Ae),yield this.app.pm.add(ze),yield this.app.pm.add(ut)})}}d.default=D,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.3.
|
|
3
|
-
"@tego/client": "1.3.
|
|
4
|
-
"@tego/server": "1.3.
|
|
5
|
-
"@tachybase/module-workflow": "1.3.
|
|
2
|
+
"@tachybase/client": "1.3.24",
|
|
3
|
+
"@tego/client": "1.3.49",
|
|
4
|
+
"@tego/server": "1.3.49",
|
|
5
|
+
"@tachybase/module-workflow": "1.3.24",
|
|
6
6
|
"react": "18.3.1",
|
|
7
|
-
"@tachybase/schema": "1.3.
|
|
7
|
+
"@tachybase/schema": "1.3.49",
|
|
8
8
|
"antd": "5.22.5",
|
|
9
9
|
"lodash": "4.17.21",
|
|
10
|
+
"dayjs": "1.11.13",
|
|
10
11
|
"@ant-design/icons": "5.6.1",
|
|
11
12
|
"react-router-dom": "6.28.1",
|
|
12
13
|
"ahooks": "3.9.0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alicloud/dysmsapi20170525","version":"2.0.24","description":"","main":"dist/client.js","scripts":{"test":"mocha --reporter spec --timeout 3000 test/*.test.js","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Alibaba Cloud SDK","license":"Apache-2.0","devDependencies":{"@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.7","@alicloud/openapi-client":"^0.4.4","@alicloud/openapi-util":"^0.3.1","@alicloud/endpoint-util":"^0.0.1"},"files":["dist","src"],"_lastModified":"2025-
|
|
1
|
+
{"name":"@alicloud/dysmsapi20170525","version":"2.0.24","description":"","main":"dist/client.js","scripts":{"test":"mocha --reporter spec --timeout 3000 test/*.test.js","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Alibaba Cloud SDK","license":"Apache-2.0","devDependencies":{"@types/node":"^12.12.26","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"^1.4.7","@alicloud/openapi-client":"^0.4.4","@alicloud/openapi-util":"^0.3.1","@alicloud/endpoint-util":"^0.0.1"},"files":["dist","src"],"_lastModified":"2025-08-03T23:10:49.337Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alicloud/openapi-client","version":"0.4.15","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts --timeout=10000","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/mocha":"^5.2.7","mocha":"^6.2.0","@types/node":"^18.0.0","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^10.0.0","typescript":"^5.6.0","@alicloud/gateway-pop":"0.0.6"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"1.4.9","@alicloud/credentials":"^2.4.2","@alicloud/openapi-util":"^0.3.2","@alicloud/gateway-spi":"^0.0.8","@alicloud/tea-xml":"0.0.3"},"files":["dist","src"],"repository":"git@github.com:aliyun/darabonba-openapi.git","_lastModified":"2025-
|
|
1
|
+
{"name":"@alicloud/openapi-client","version":"0.4.15","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts --timeout=10000","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/mocha":"^5.2.7","mocha":"^6.2.0","@types/node":"^18.0.0","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^10.0.0","typescript":"^5.6.0","@alicloud/gateway-pop":"0.0.6"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"1.4.9","@alicloud/credentials":"^2.4.2","@alicloud/openapi-util":"^0.3.2","@alicloud/gateway-spi":"^0.0.8","@alicloud/tea-xml":"0.0.3"},"files":["dist","src"],"repository":"git@github.com:aliyun/darabonba-openapi.git","_lastModified":"2025-08-03T23:10:49.926Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alicloud/tea-util","version":"1.4.9","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Jackson Tian","license":"Apache-2.0","devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^12.12.26","mocha":"^7.0.1","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.5.1","kitx":"^2.0.0"},"files":["dist","src"],"repository":"git@github.com:aliyun/tea-util.git","_lastModified":"2025-
|
|
1
|
+
{"name":"@alicloud/tea-util","version":"1.4.9","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Jackson Tian","license":"Apache-2.0","devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^12.12.26","mocha":"^7.0.1","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.5.1","kitx":"^2.0.0"},"files":["dist","src"],"repository":"git@github.com:aliyun/tea-util.git","_lastModified":"2025-08-03T23:10:50.050Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"tencentcloud-sdk-nodejs","version":"4.0.996","description":"腾讯云 API NODEJS SDK","main":"tencentcloud/index.js","scripts":{"test":"mocha -t 10000","build":"tsc","prettier":"prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'"},"engines":{"node":">=10"},"keywords":["tencentcloudapi","tencentcloud","qcloud","sdk","js","nodejs"],"author":"tencentcloudapi","license":"Apache-2.0","dependencies":{"form-data":"^3.0.0","get-stream":"^6.0.0","https-proxy-agent":"^5.0.0","is-stream":"^2.0.0","json-bigint":"^1.0.0","node-fetch":"^2.2.0","tslib":"1.13.0","uuid":"^9.0.1"},"directories":{"example":"examples","lib":"lib"},"repository":{"type":"git","url":"https://github.com/tencentcloud/tencentcloud-sdk-nodejs"},"devDependencies":{"@types/form-data":"^2.5.0","@types/json-bigint":"^1.0.1","@types/node":"^14.0.26","@types/node-fetch":"^2.5.7","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","babel-eslint":"^10.0.2","chai":"^4.2.0","eslint":"^6.8.0","eslint-plugin-react":"^7.17.0","mocha":"^8.1.1","prettier":"^2.3.0","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2025-
|
|
1
|
+
{"name":"tencentcloud-sdk-nodejs","version":"4.0.996","description":"腾讯云 API NODEJS SDK","main":"tencentcloud/index.js","scripts":{"test":"mocha -t 10000","build":"tsc","prettier":"prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'"},"engines":{"node":">=10"},"keywords":["tencentcloudapi","tencentcloud","qcloud","sdk","js","nodejs"],"author":"tencentcloudapi","license":"Apache-2.0","dependencies":{"form-data":"^3.0.0","get-stream":"^6.0.0","https-proxy-agent":"^5.0.0","is-stream":"^2.0.0","json-bigint":"^1.0.0","node-fetch":"^2.2.0","tslib":"1.13.0","uuid":"^9.0.1"},"directories":{"example":"examples","lib":"lib"},"repository":{"type":"git","url":"https://github.com/tencentcloud/tencentcloud-sdk-nodejs"},"devDependencies":{"@types/form-data":"^2.5.0","@types/json-bigint":"^1.0.1","@types/node":"^14.0.26","@types/node-fetch":"^2.5.7","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","babel-eslint":"^10.0.2","chai":"^4.2.0","eslint":"^6.8.0","eslint-plugin-react":"^7.17.0","mocha":"^8.1.1","prettier":"^2.3.0","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2025-08-03T23:10:53.820Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var __webpack_modules__={99:function(e,t,s){"use strict";const r=s(12);r.createWebSocketStream=s(391);r.Server=s(186);r.Receiver=s(198);r.Sender=s(994);r.WebSocket=r;r.WebSocketServer=r.Server;e.exports=r},914:function(e,t,s){"use strict";const{EMPTY_BUFFER:r}=s(190);const n=Buffer[Symbol.species];function concat(e,t){if(e.length===0)return r;if(e.length===1)return e[0];const s=Buffer.allocUnsafe(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];s.set(r,i);i+=r.length}if(i<t){return new n(s.buffer,s.byteOffset,i)}return s}function _mask(e,t,s,r,n){for(let i=0;i<n;i++){s[r+i]=e[i]^t[i&3]}}function _unmask(e,t){for(let s=0;s<e.length;s++){e[s]^=t[s&3]}}function toArrayBuffer(e){if(e.length===e.buffer.byteLength){return e.buffer}return e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function toBuffer(e){toBuffer.readOnly=true;if(Buffer.isBuffer(e))return e;let t;if(e instanceof ArrayBuffer){t=new n(e)}else if(ArrayBuffer.isView(e)){t=new n(e.buffer,e.byteOffset,e.byteLength)}else{t=Buffer.from(e);toBuffer.readOnly=false}return t}e.exports={concat:concat,mask:_mask,toArrayBuffer:toArrayBuffer,toBuffer:toBuffer,unmask:_unmask};if(!process.env.WS_NO_BUFFER_UTIL){try{const t=s(653);e.exports.mask=function(e,s,r,n,i){if(i<48)_mask(e,s,r,n,i);else t.mask(e,s,r,n,i)};e.exports.unmask=function(e,s){if(e.length<32)_unmask(e,s);else t.unmask(e,s)}}catch(e){}}},190:function(e){"use strict";const t=["nodebuffer","arraybuffer","fragments"];const s=typeof Blob!=="undefined";if(s)t.push("blob");e.exports={BINARY_TYPES:t,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:s,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},789:function(e,t,s){"use strict";const{kForOnEventAttribute:r,kListener:n}=s(190);const i=Symbol("kCode");const o=Symbol("kData");const a=Symbol("kError");const c=Symbol("kMessage");const l=Symbol("kReason");const f=Symbol("kTarget");const h=Symbol("kType");const u=Symbol("kWasClean");class Event{constructor(e){this[f]=null;this[h]=e}get target(){return this[f]}get type(){return this[h]}}Object.defineProperty(Event.prototype,"target",{enumerable:true});Object.defineProperty(Event.prototype,"type",{enumerable:true});class CloseEvent extends Event{constructor(e,t={}){super(e);this[i]=t.code===undefined?0:t.code;this[l]=t.reason===undefined?"":t.reason;this[u]=t.wasClean===undefined?false:t.wasClean}get code(){return this[i]}get reason(){return this[l]}get wasClean(){return this[u]}}Object.defineProperty(CloseEvent.prototype,"code",{enumerable:true});Object.defineProperty(CloseEvent.prototype,"reason",{enumerable:true});Object.defineProperty(CloseEvent.prototype,"wasClean",{enumerable:true});class ErrorEvent extends Event{constructor(e,t={}){super(e);this[a]=t.error===undefined?null:t.error;this[c]=t.message===undefined?"":t.message}get error(){return this[a]}get message(){return this[c]}}Object.defineProperty(ErrorEvent.prototype,"error",{enumerable:true});Object.defineProperty(ErrorEvent.prototype,"message",{enumerable:true});class MessageEvent extends Event{constructor(e,t={}){super(e);this[o]=t.data===undefined?null:t.data}get data(){return this[o]}}Object.defineProperty(MessageEvent.prototype,"data",{enumerable:true});const d={addEventListener(e,t,s={}){for(const i of this.listeners(e)){if(!s[r]&&i[n]===t&&!i[r]){return}}let i;if(e==="message"){i=function onMessage(e,s){const r=new MessageEvent("message",{data:s?e:e.toString()});r[f]=this;callListener(t,this,r)}}else if(e==="close"){i=function onClose(e,s){const r=new CloseEvent("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[f]=this;callListener(t,this,r)}}else if(e==="error"){i=function onError(e){const s=new ErrorEvent("error",{error:e,message:e.message});s[f]=this;callListener(t,this,s)}}else if(e==="open"){i=function onOpen(){const e=new Event("open");e[f]=this;callListener(t,this,e)}}else{return}i[r]=!!s[r];i[n]=t;if(s.once){this.once(e,i)}else{this.on(e,i)}},removeEventListener(e,t){for(const s of this.listeners(e)){if(s[n]===t&&!s[r]){this.removeListener(e,s);break}}}};e.exports={CloseEvent:CloseEvent,ErrorEvent:ErrorEvent,Event:Event,EventTarget:d,MessageEvent:MessageEvent};function callListener(e,t,s){if(typeof e==="object"&&e.handleEvent){e.handleEvent.call(e,s)}else{e.call(t,s)}}},966:function(e,t,s){"use strict";const{tokenChars:r}=s(408);function push(e,t,s){if(e[t]===undefined)e[t]=[s];else e[t].push(s)}function parse(e){const t=Object.create(null);let s=Object.create(null);let n=false;let i=false;let o=false;let a;let c;let l=-1;let f=-1;let h=-1;let u=0;for(;u<e.length;u++){f=e.charCodeAt(u);if(a===undefined){if(h===-1&&r[f]===1){if(l===-1)l=u}else if(u!==0&&(f===32||f===9)){if(h===-1&&l!==-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;const r=e.slice(l,h);if(f===44){push(t,r,s);s=Object.create(null)}else{a=r}l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else if(c===undefined){if(h===-1&&r[f]===1){if(l===-1)l=u}else if(f===32||f===9){if(h===-1&&l!==-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;push(s,e.slice(l,h),true);if(f===44){push(t,a,s);s=Object.create(null);a=undefined}l=h=-1}else if(f===61&&l!==-1&&h===-1){c=e.slice(l,u);l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else{if(i){if(r[f]!==1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(l===-1)l=u;else if(!n)n=true;i=false}else if(o){if(r[f]===1){if(l===-1)l=u}else if(f===34&&l!==-1){o=false;h=u}else if(f===92){i=true}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else if(f===34&&e.charCodeAt(u-1)===61){o=true}else if(h===-1&&r[f]===1){if(l===-1)l=u}else if(l!==-1&&(f===32||f===9)){if(h===-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;let r=e.slice(l,h);if(n){r=r.replace(/\\/g,"");n=false}push(s,c,r);if(f===44){push(t,a,s);s=Object.create(null);a=undefined}c=undefined;l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}}if(l===-1||o||f===32||f===9){throw new SyntaxError("Unexpected end of input")}if(h===-1)h=u;const d=e.slice(l,h);if(a===undefined){push(t,d,s)}else{if(c===undefined){push(s,d,true)}else if(n){push(s,c,d.replace(/\\/g,""))}else{push(s,c,d)}push(t,a,s)}return t}function format(e){return Object.keys(e).map((t=>{let s=e[t];if(!Array.isArray(s))s=[s];return s.map((e=>[t].concat(Object.keys(e).map((t=>{let s=e[t];if(!Array.isArray(s))s=[s];return s.map((e=>e===true?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")}e.exports={format:format,parse:parse}},207:function(e){"use strict";const t=Symbol("kDone");const s=Symbol("kRun");class Limiter{constructor(e){this[t]=()=>{this.pending--;this[s]()};this.concurrency=e||Infinity;this.jobs=[];this.pending=0}add(e){this.jobs.push(e);this[s]()}[s](){if(this.pending===this.concurrency)return;if(this.jobs.length){const e=this.jobs.shift();this.pending++;e(this[t])}}}e.exports=Limiter},843:function(e,t,s){"use strict";const r=s(106);const n=s(914);const i=s(207);const{kStatusCode:o}=s(190);const a=Buffer[Symbol.species];const c=Buffer.from([0,0,255,255]);const l=Symbol("permessage-deflate");const f=Symbol("total-length");const h=Symbol("callback");const u=Symbol("buffers");const d=Symbol("error");let _;class PerMessageDeflate{constructor(e,t,s){this._maxPayload=s|0;this._options=e||{};this._threshold=this._options.threshold!==undefined?this._options.threshold:1024;this._isServer=!!t;this._deflate=null;this._inflate=null;this.params=null;if(!_){const e=this._options.concurrencyLimit!==undefined?this._options.concurrencyLimit:10;_=new i(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};if(this._options.serverNoContextTakeover){e.server_no_context_takeover=true}if(this._options.clientNoContextTakeover){e.client_no_context_takeover=true}if(this._options.serverMaxWindowBits){e.server_max_window_bits=this._options.serverMaxWindowBits}if(this._options.clientMaxWindowBits){e.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits==null){e.client_max_window_bits=true}return e}accept(e){e=this.normalizeParams(e);this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e);return this.params}cleanup(){if(this._inflate){this._inflate.close();this._inflate=null}if(this._deflate){const e=this._deflate[h];this._deflate.close();this._deflate=null;if(e){e(new Error("The deflate stream was closed while data was being processed"))}}}acceptAsServer(e){const t=this._options;const s=e.find((e=>{if(t.serverNoContextTakeover===false&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===false||typeof t.serverMaxWindowBits==="number"&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==="number"&&!e.client_max_window_bits){return false}return true}));if(!s){throw new Error("None of the extension offers can be accepted")}if(t.serverNoContextTakeover){s.server_no_context_takeover=true}if(t.clientNoContextTakeover){s.client_no_context_takeover=true}if(typeof t.serverMaxWindowBits==="number"){s.server_max_window_bits=t.serverMaxWindowBits}if(typeof t.clientMaxWindowBits==="number"){s.client_max_window_bits=t.clientMaxWindowBits}else if(s.client_max_window_bits===true||t.clientMaxWindowBits===false){delete s.client_max_window_bits}return s}acceptAsClient(e){const t=e[0];if(this._options.clientNoContextTakeover===false&&t.client_no_context_takeover){throw new Error('Unexpected parameter "client_no_context_takeover"')}if(!t.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number"){t.client_max_window_bits=this._options.clientMaxWindowBits}}else if(this._options.clientMaxWindowBits===false||typeof this._options.clientMaxWindowBits==="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits){throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}return t}normalizeParams(e){e.forEach((e=>{Object.keys(e).forEach((t=>{let s=e[t];if(s.length>1){throw new Error(`Parameter "${t}" must have only a single value`)}s=s[0];if(t==="client_max_window_bits"){if(s!==true){const e=+s;if(!Number.isInteger(e)||e<8||e>15){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}s=e}else if(!this._isServer){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}}else if(t==="server_max_window_bits"){const e=+s;if(!Number.isInteger(e)||e<8||e>15){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}s=e}else if(t==="client_no_context_takeover"||t==="server_no_context_takeover"){if(s!==true){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}}else{throw new Error(`Unknown parameter "${t}"`)}e[t]=s}))}));return e}decompress(e,t,s){_.add((r=>{this._decompress(e,t,((e,t)=>{r();s(e,t)}))}))}compress(e,t,s){_.add((r=>{this._compress(e,t,((e,t)=>{r();s(e,t)}))}))}_decompress(e,t,s){const i=this._isServer?"client":"server";if(!this._inflate){const e=`${i}_max_window_bits`;const t=typeof this.params[e]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t});this._inflate[l]=this;this._inflate[f]=0;this._inflate[u]=[];this._inflate.on("error",inflateOnError);this._inflate.on("data",inflateOnData)}this._inflate[h]=s;this._inflate.write(e);if(t)this._inflate.write(c);this._inflate.flush((()=>{const e=this._inflate[d];if(e){this._inflate.close();this._inflate=null;s(e);return}const r=n.concat(this._inflate[u],this._inflate[f]);if(this._inflate._readableState.endEmitted){this._inflate.close();this._inflate=null}else{this._inflate[f]=0;this._inflate[u]=[];if(t&&this.params[`${i}_no_context_takeover`]){this._inflate.reset()}}s(null,r)}))}_compress(e,t,s){const i=this._isServer?"server":"client";if(!this._deflate){const e=`${i}_max_window_bits`;const t=typeof this.params[e]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t});this._deflate[f]=0;this._deflate[u]=[];this._deflate.on("data",deflateOnData)}this._deflate[h]=s;this._deflate.write(e);this._deflate.flush(r.Z_SYNC_FLUSH,(()=>{if(!this._deflate){return}let e=n.concat(this._deflate[u],this._deflate[f]);if(t){e=new a(e.buffer,e.byteOffset,e.length-4)}this._deflate[h]=null;this._deflate[f]=0;this._deflate[u]=[];if(t&&this.params[`${i}_no_context_takeover`]){this._deflate.reset()}s(null,e)}))}}e.exports=PerMessageDeflate;function deflateOnData(e){this[u].push(e);this[f]+=e.length}function inflateOnData(e){this[f]+=e.length;if(this[l]._maxPayload<1||this[f]<=this[l]._maxPayload){this[u].push(e);return}this[d]=new RangeError("Max payload size exceeded");this[d].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";this[d][o]=1009;this.removeListener("data",inflateOnData);this.reset()}function inflateOnError(e){this[l]._inflate=null;e[o]=1007;this[h](e)}},198:function(e,t,s){"use strict";const{Writable:r}=s(203);const n=s(843);const{BINARY_TYPES:i,EMPTY_BUFFER:o,kStatusCode:a,kWebSocket:c}=s(190);const{concat:l,toArrayBuffer:f,unmask:h}=s(914);const{isValidStatusCode:u,isValidUTF8:d}=s(408);const _=Buffer[Symbol.species];const p=0;const m=1;const b=2;const S=3;const y=4;const k=5;const g=6;class Receiver extends r{constructor(e={}){super();this._allowSynchronousEvents=e.allowSynchronousEvents!==undefined?e.allowSynchronousEvents:true;this._binaryType=e.binaryType||i[0];this._extensions=e.extensions||{};this._isServer=!!e.isServer;this._maxPayload=e.maxPayload|0;this._skipUTF8Validation=!!e.skipUTF8Validation;this[c]=undefined;this._bufferedBytes=0;this._buffers=[];this._compressed=false;this._payloadLength=0;this._mask=undefined;this._fragmented=0;this._masked=false;this._fin=false;this._opcode=0;this._totalPayloadLength=0;this._messageLength=0;this._fragments=[];this._errored=false;this._loop=false;this._state=p}_write(e,t,s){if(this._opcode===8&&this._state==p)return s();this._bufferedBytes+=e.length;this._buffers.push(e);this.startLoop(s)}consume(e){this._bufferedBytes-=e;if(e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];this._buffers[0]=new _(t.buffer,t.byteOffset+e,t.length-e);return new _(t.buffer,t.byteOffset,e)}const t=Buffer.allocUnsafe(e);do{const s=this._buffers[0];const r=t.length-e;if(e>=s.length){t.set(this._buffers.shift(),r)}else{t.set(new Uint8Array(s.buffer,s.byteOffset,e),r);this._buffers[0]=new _(s.buffer,s.byteOffset+e,s.length-e)}e-=s.length}while(e>0);return t}startLoop(e){this._loop=true;do{switch(this._state){case p:this.getInfo(e);break;case m:this.getPayloadLength16(e);break;case b:this.getPayloadLength64(e);break;case S:this.getMask();break;case y:this.getData(e);break;case k:case g:this._loop=false;return}}while(this._loop);if(!this._errored)e()}getInfo(e){if(this._bufferedBytes<2){this._loop=false;return}const t=this.consume(2);if((t[0]&48)!==0){const t=this.createError(RangeError,"RSV2 and RSV3 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(t);return}const s=(t[0]&64)===64;if(s&&!this._extensions[n.extensionName]){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}this._fin=(t[0]&128)===128;this._opcode=t[0]&15;this._payloadLength=t[1]&127;if(this._opcode===0){if(s){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}if(!this._fragmented){const t=this.createError(RangeError,"invalid opcode 0",true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){const t=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}this._compressed=s}else if(this._opcode>7&&this._opcode<11){if(!this._fin){const t=this.createError(RangeError,"FIN must be set",true,1002,"WS_ERR_EXPECTED_FIN");e(t);return}if(s){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){const t=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,true,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(t);return}}else{const t=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;this._masked=(t[1]&128)===128;if(this._isServer){if(!this._masked){const t=this.createError(RangeError,"MASK must be set",true,1002,"WS_ERR_EXPECTED_MASK");e(t);return}}else if(this._masked){const t=this.createError(RangeError,"MASK must be clear",true,1002,"WS_ERR_UNEXPECTED_MASK");e(t);return}if(this._payloadLength===126)this._state=m;else if(this._payloadLength===127)this._state=b;else this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=false;return}this._payloadLength=this.consume(2).readUInt16BE(0);this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=false;return}const t=this.consume(8);const s=t.readUInt32BE(0);if(s>Math.pow(2,53-32)-1){const t=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",false,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(t);return}this._payloadLength=s*Math.pow(2,32)+t.readUInt32BE(4);this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8){this._totalPayloadLength+=this._payloadLength;if(this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){const t=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}}if(this._masked)this._state=S;else this._state=y}getMask(){if(this._bufferedBytes<4){this._loop=false;return}this._mask=this.consume(4);this._state=y}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=false;return}t=this.consume(this._payloadLength);if(this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0){h(t,this._mask)}}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=k;this.decompress(t,e);return}if(t.length){this._messageLength=this._totalPayloadLength;this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){const s=this._extensions[n.extensionName];s.decompress(e,this._fin,((e,s)=>{if(e)return t(e);if(s.length){this._messageLength+=s.length;if(this._messageLength>this._maxPayload&&this._maxPayload>0){const e=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(e);return}this._fragments.push(s)}this.dataMessage(t);if(this._state===p)this.startLoop(t)}))}dataMessage(e){if(!this._fin){this._state=p;return}const t=this._messageLength;const s=this._fragments;this._totalPayloadLength=0;this._messageLength=0;this._fragmented=0;this._fragments=[];if(this._opcode===2){let r;if(this._binaryType==="nodebuffer"){r=l(s,t)}else if(this._binaryType==="arraybuffer"){r=f(l(s,t))}else if(this._binaryType==="blob"){r=new Blob(s)}else{r=s}if(this._allowSynchronousEvents){this.emit("message",r,true);this._state=p}else{this._state=g;setImmediate((()=>{this.emit("message",r,true);this._state=p;this.startLoop(e)}))}}else{const r=l(s,t);if(!this._skipUTF8Validation&&!d(r)){const t=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");e(t);return}if(this._state===k||this._allowSynchronousEvents){this.emit("message",r,false);this._state=p}else{this._state=g;setImmediate((()=>{this.emit("message",r,false);this._state=p;this.startLoop(e)}))}}}controlMessage(e,t){if(this._opcode===8){if(e.length===0){this._loop=false;this.emit("conclude",1005,o);this.end()}else{const s=e.readUInt16BE(0);if(!u(s)){const e=this.createError(RangeError,`invalid status code ${s}`,true,1002,"WS_ERR_INVALID_CLOSE_CODE");t(e);return}const r=new _(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!d(r)){const e=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");t(e);return}this._loop=false;this.emit("conclude",s,r);this.end()}this._state=p;return}if(this._allowSynchronousEvents){this.emit(this._opcode===9?"ping":"pong",e);this._state=p}else{this._state=g;setImmediate((()=>{this.emit(this._opcode===9?"ping":"pong",e);this._state=p;this.startLoop(t)}))}}createError(e,t,s,r,n){this._loop=false;this._errored=true;const i=new e(s?`Invalid WebSocket frame: ${t}`:t);Error.captureStackTrace(i,this.createError);i.code=n;i[a]=r;return i}}e.exports=Receiver},994:function(e,t,s){"use strict";const{Duplex:r}=s(203);const{randomFillSync:n}=s(982);const i=s(843);const{EMPTY_BUFFER:o,kWebSocket:a,NOOP:c}=s(190);const{isBlob:l,isValidStatusCode:f}=s(408);const{mask:h,toBuffer:u}=s(914);const d=Symbol("kByteLength");const _=Buffer.alloc(4);const p=8*1024;let m;let b=p;const S=0;const y=1;const k=2;class Sender{constructor(e,t,s){this._extensions=t||{};if(s){this._generateMask=s;this._maskBuffer=Buffer.alloc(4)}this._socket=e;this._firstFragment=true;this._compress=false;this._bufferedBytes=0;this._queue=[];this._state=S;this.onerror=c;this[a]=undefined}static frame(e,t){let s;let r=false;let i=2;let o=false;if(t.mask){s=t.maskBuffer||_;if(t.generateMask){t.generateMask(s)}else{if(b===p){if(m===undefined){m=Buffer.alloc(p)}n(m,0,p);b=0}s[0]=m[b++];s[1]=m[b++];s[2]=m[b++];s[3]=m[b++]}o=(s[0]|s[1]|s[2]|s[3])===0;i=6}let a;if(typeof e==="string"){if((!t.mask||o)&&t[d]!==undefined){a=t[d]}else{e=Buffer.from(e);a=e.length}}else{a=e.length;r=t.mask&&t.readOnly&&!o}let c=a;if(a>=65536){i+=8;c=127}else if(a>125){i+=2;c=126}const l=Buffer.allocUnsafe(r?a+i:i);l[0]=t.fin?t.opcode|128:t.opcode;if(t.rsv1)l[0]|=64;l[1]=c;if(c===126){l.writeUInt16BE(a,2)}else if(c===127){l[2]=l[3]=0;l.writeUIntBE(a,4,6)}if(!t.mask)return[l,e];l[1]|=128;l[i-4]=s[0];l[i-3]=s[1];l[i-2]=s[2];l[i-1]=s[3];if(o)return[l,e];if(r){h(e,s,l,i,a);return[l]}h(e,s,e,0,a);return[l,e]}close(e,t,s,r){let n;if(e===undefined){n=o}else if(typeof e!=="number"||!f(e)){throw new TypeError("First argument must be a valid error code number")}else if(t===undefined||!t.length){n=Buffer.allocUnsafe(2);n.writeUInt16BE(e,0)}else{const s=Buffer.byteLength(t);if(s>123){throw new RangeError("The message must not be greater than 123 bytes")}n=Buffer.allocUnsafe(2+s);n.writeUInt16BE(e,0);if(typeof t==="string"){n.write(t,2)}else{n.set(t,2)}}const i={[d]:n.length,fin:true,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:false,rsv1:false};if(this._state!==S){this.enqueue([this.dispatch,n,false,i,r])}else{this.sendFrame(Sender.frame(n,i),r)}}ping(e,t,s){let r;let n;if(typeof e==="string"){r=Buffer.byteLength(e);n=false}else if(l(e)){r=e.size;n=false}else{e=u(e);r=e.length;n=u.readOnly}if(r>125){throw new RangeError("The data size must not be greater than 125 bytes")}const i={[d]:r,fin:true,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:false};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,false,i,s])}else{this.getBlobData(e,false,i,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,false,i,s])}else{this.sendFrame(Sender.frame(e,i),s)}}pong(e,t,s){let r;let n;if(typeof e==="string"){r=Buffer.byteLength(e);n=false}else if(l(e)){r=e.size;n=false}else{e=u(e);r=e.length;n=u.readOnly}if(r>125){throw new RangeError("The data size must not be greater than 125 bytes")}const i={[d]:r,fin:true,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:false};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,false,i,s])}else{this.getBlobData(e,false,i,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,false,i,s])}else{this.sendFrame(Sender.frame(e,i),s)}}send(e,t,s){const r=this._extensions[i.extensionName];let n=t.binary?2:1;let o=t.compress;let a;let c;if(typeof e==="string"){a=Buffer.byteLength(e);c=false}else if(l(e)){a=e.size;c=false}else{e=u(e);a=e.length;c=u.readOnly}if(this._firstFragment){this._firstFragment=false;if(o&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]){o=a>=r._threshold}this._compress=o}else{o=false;n=0}if(t.fin)this._firstFragment=true;const f={[d]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,this._compress,f,s])}else{this.getBlobData(e,this._compress,f,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,this._compress,f,s])}else{this.dispatch(e,this._compress,f,s)}}getBlobData(e,t,s,r){this._bufferedBytes+=s[d];this._state=k;e.arrayBuffer().then((e=>{if(this._socket.destroyed){const e=new Error("The socket was closed while the blob was being read");process.nextTick(callCallbacks,this,e,r);return}this._bufferedBytes-=s[d];const n=u(e);if(!t){this._state=S;this.sendFrame(Sender.frame(n,s),r);this.dequeue()}else{this.dispatch(n,t,s,r)}})).catch((e=>{process.nextTick(onError,this,e,r)}))}dispatch(e,t,s,r){if(!t){this.sendFrame(Sender.frame(e,s),r);return}const n=this._extensions[i.extensionName];this._bufferedBytes+=s[d];this._state=y;n.compress(e,s.fin,((e,t)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");callCallbacks(this,e,r);return}this._bufferedBytes-=s[d];this._state=S;s.readOnly=false;this.sendFrame(Sender.frame(t,s),r);this.dequeue()}))}dequeue(){while(this._state===S&&this._queue.length){const e=this._queue.shift();this._bufferedBytes-=e[3][d];Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][d];this._queue.push(e)}sendFrame(e,t){if(e.length===2){this._socket.cork();this._socket.write(e[0]);this._socket.write(e[1],t);this._socket.uncork()}else{this._socket.write(e[0],t)}}}e.exports=Sender;function callCallbacks(e,t,s){if(typeof s==="function")s(t);for(let s=0;s<e._queue.length;s++){const r=e._queue[s];const n=r[r.length-1];if(typeof n==="function")n(t)}}function onError(e,t,s){callCallbacks(e,t,s);e.onerror(t)}},391:function(e,t,s){"use strict";const{Duplex:r}=s(203);function emitClose(e){e.emit("close")}function duplexOnEnd(){if(!this.destroyed&&this._writableState.finished){this.destroy()}}function duplexOnError(e){this.removeListener("error",duplexOnError);this.destroy();if(this.listenerCount("error")===0){this.emit("error",e)}}function createWebSocketStream(e,t){let s=true;const n=new r({...t,autoDestroy:false,emitClose:false,objectMode:false,writableObjectMode:false});e.on("message",(function message(t,s){const r=!s&&n._readableState.objectMode?t.toString():t;if(!n.push(r))e.pause()}));e.once("error",(function error(e){if(n.destroyed)return;s=false;n.destroy(e)}));e.once("close",(function close(){if(n.destroyed)return;n.push(null)}));n._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t);process.nextTick(emitClose,n);return}let i=false;e.once("error",(function error(e){i=true;r(e)}));e.once("close",(function close(){if(!i)r(t);process.nextTick(emitClose,n)}));if(s)e.terminate()};n._final=function(t){if(e.readyState===e.CONNECTING){e.once("open",(function open(){n._final(t)}));return}if(e._socket===null)return;if(e._socket._writableState.finished){t();if(n._readableState.endEmitted)n.destroy()}else{e._socket.once("finish",(function finish(){t()}));e.close()}};n._read=function(){if(e.isPaused)e.resume()};n._write=function(t,s,r){if(e.readyState===e.CONNECTING){e.once("open",(function open(){n._write(t,s,r)}));return}e.send(t,r)};n.on("end",duplexOnEnd);n.on("error",duplexOnError);return n}e.exports=createWebSocketStream},189:function(e,t,s){"use strict";const{tokenChars:r}=s(408);function parse(e){const t=new Set;let s=-1;let n=-1;let i=0;for(i;i<e.length;i++){const o=e.charCodeAt(i);if(n===-1&&r[o]===1){if(s===-1)s=i}else if(i!==0&&(o===32||o===9)){if(n===-1&&s!==-1)n=i}else if(o===44){if(s===-1){throw new SyntaxError(`Unexpected character at index ${i}`)}if(n===-1)n=i;const r=e.slice(s,n);if(t.has(r)){throw new SyntaxError(`The "${r}" subprotocol is duplicated`)}t.add(r);s=n=-1}else{throw new SyntaxError(`Unexpected character at index ${i}`)}}if(s===-1||n!==-1){throw new SyntaxError("Unexpected end of input")}const o=e.slice(s,i);if(t.has(o)){throw new SyntaxError(`The "${o}" subprotocol is duplicated`)}t.add(o);return t}e.exports={parse:parse}},408:function(e,t,s){"use strict";const{isUtf8:r}=s(181);const{hasBlob:n}=s(190);const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function isValidStatusCode(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function _isValidUTF8(e){const t=e.length;let s=0;while(s<t){if((e[s]&128)===0){s++}else if((e[s]&224)===192){if(s+1===t||(e[s+1]&192)!==128||(e[s]&254)===192){return false}s+=2}else if((e[s]&240)===224){if(s+2>=t||(e[s+1]&192)!==128||(e[s+2]&192)!==128||e[s]===224&&(e[s+1]&224)===128||e[s]===237&&(e[s+1]&224)===160){return false}s+=3}else if((e[s]&248)===240){if(s+3>=t||(e[s+1]&192)!==128||(e[s+2]&192)!==128||(e[s+3]&192)!==128||e[s]===240&&(e[s+1]&240)===128||e[s]===244&&e[s+1]>143||e[s]>244){return false}s+=4}else{return false}}return true}function isBlob(e){return n&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}e.exports={isBlob:isBlob,isValidStatusCode:isValidStatusCode,isValidUTF8:_isValidUTF8,tokenChars:i};if(r){e.exports.isValidUTF8=function(e){return e.length<24?_isValidUTF8(e):r(e)}}else if(!process.env.WS_NO_UTF_8_VALIDATE){try{const t=s(4);e.exports.isValidUTF8=function(e){return e.length<32?_isValidUTF8(e):t(e)}}catch(e){}}},186:function(e,t,s){"use strict";const r=s(434);const n=s(611);const{Duplex:i}=s(203);const{createHash:o}=s(982);const a=s(966);const c=s(843);const l=s(189);const f=s(12);const{GUID:h,kWebSocket:u}=s(190);const d=/^[+/0-9A-Za-z]{22}==$/;const _=0;const p=1;const m=2;class WebSocketServer extends r{constructor(e,t){super();e={allowSynchronousEvents:true,autoPong:true,maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:false,handleProtocols:null,clientTracking:true,verifyClient:null,noServer:false,backlog:null,server:null,host:null,path:null,port:null,WebSocket:f,...e};if(e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer){throw new TypeError('One and only one of the "port", "server", or "noServer" options '+"must be specified")}if(e.port!=null){this._server=n.createServer(((e,t)=>{const s=n.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"});t.end(s)}));this._server.listen(e.port,e.host,e.backlog,t)}else if(e.server){this._server=e.server}if(this._server){const e=this.emit.bind(this,"connection");this._removeListeners=addListeners(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}if(e.perMessageDeflate===true)e.perMessageDeflate={};if(e.clientTracking){this.clients=new Set;this._shouldEmitClose=false}this.options=e;this._state=_}address(){if(this.options.noServer){throw new Error('The server is operating in "noServer" mode')}if(!this._server)return null;return this._server.address()}close(e){if(this._state===m){if(e){this.once("close",(()=>{e(new Error("The server is not running"))}))}process.nextTick(emitClose,this);return}if(e)this.once("close",e);if(this._state===p)return;this._state=p;if(this.options.noServer||this.options.server){if(this._server){this._removeListeners();this._removeListeners=this._server=null}if(this.clients){if(!this.clients.size){process.nextTick(emitClose,this)}else{this._shouldEmitClose=true}}else{process.nextTick(emitClose,this)}}else{const e=this._server;this._removeListeners();this._removeListeners=this._server=null;e.close((()=>{emitClose(this)}))}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");const s=t!==-1?e.url.slice(0,t):e.url;if(s!==this.options.path)return false}return true}handleUpgrade(e,t,s,r){t.on("error",socketOnError);const n=e.headers["sec-websocket-key"];const i=e.headers.upgrade;const o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){const s="Invalid HTTP method";abortHandshakeOrEmitwsClientError(this,e,t,405,s);return}if(i===undefined||i.toLowerCase()!=="websocket"){const s="Invalid Upgrade header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(n===undefined||!d.test(n)){const s="Missing or invalid Sec-WebSocket-Key header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(o!==8&&o!==13){const s="Missing or invalid Sec-WebSocket-Version header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(!this.shouldHandle(e)){abortHandshake(t,400);return}const f=e.headers["sec-websocket-protocol"];let h=new Set;if(f!==undefined){try{h=l.parse(f)}catch(s){const r="Invalid Sec-WebSocket-Protocol header";abortHandshakeOrEmitwsClientError(this,e,t,400,r);return}}const u=e.headers["sec-websocket-extensions"];const _={};if(this.options.perMessageDeflate&&u!==undefined){const s=new c(this.options.perMessageDeflate,true,this.options.maxPayload);try{const e=a.parse(u);if(e[c.extensionName]){s.accept(e[c.extensionName]);_[c.extensionName]=s}}catch(s){const r="Invalid or unacceptable Sec-WebSocket-Extensions header";abortHandshakeOrEmitwsClientError(this,e,t,400,r);return}}if(this.options.verifyClient){const i={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(i,((i,o,a,c)=>{if(!i){return abortHandshake(t,o||401,a,c)}this.completeUpgrade(_,n,h,e,t,s,r)}));return}if(!this.options.verifyClient(i))return abortHandshake(t,401)}this.completeUpgrade(_,n,h,e,t,s,r)}completeUpgrade(e,t,s,r,n,i,l){if(!n.readable||!n.writable)return n.destroy();if(n[u]){throw new Error("server.handleUpgrade() was called more than once with the same "+"socket, possibly due to a misconfiguration")}if(this._state>_)return abortHandshake(n,503);const f=o("sha1").update(t+h).digest("base64");const d=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${f}`];const p=new this.options.WebSocket(null,undefined,this.options);if(s.size){const e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;if(e){d.push(`Sec-WebSocket-Protocol: ${e}`);p._protocol=e}}if(e[c.extensionName]){const t=e[c.extensionName].params;const s=a.format({[c.extensionName]:[t]});d.push(`Sec-WebSocket-Extensions: ${s}`);p._extensions=e}this.emit("headers",d,r);n.write(d.concat("\r\n").join("\r\n"));n.removeListener("error",socketOnError);p.setSocket(n,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation});if(this.clients){this.clients.add(p);p.on("close",(()=>{this.clients.delete(p);if(this._shouldEmitClose&&!this.clients.size){process.nextTick(emitClose,this)}}))}l(p,r)}}e.exports=WebSocketServer;function addListeners(e,t){for(const s of Object.keys(t))e.on(s,t[s]);return function removeListeners(){for(const s of Object.keys(t)){e.removeListener(s,t[s])}}}function emitClose(e){e._state=m;e.emit("close")}function socketOnError(){this.destroy()}function abortHandshake(e,t,s,r){s=s||n.STATUS_CODES[t];r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r};e.once("finish",e.destroy);e.end(`HTTP/1.1 ${t} ${n.STATUS_CODES[t]}\r\n`+Object.keys(r).map((e=>`${e}: ${r[e]}`)).join("\r\n")+"\r\n\r\n"+s)}function abortHandshakeOrEmitwsClientError(e,t,s,r,n){if(e.listenerCount("wsClientError")){const r=new Error(n);Error.captureStackTrace(r,abortHandshakeOrEmitwsClientError);e.emit("wsClientError",r,s,t)}else{abortHandshake(s,r,n)}}},12:function(e,t,s){"use strict";const r=s(434);const n=s(692);const i=s(611);const o=s(278);const a=s(756);const{randomBytes:c,createHash:l}=s(982);const{Duplex:f,Readable:h}=s(203);const{URL:u}=s(16);const d=s(843);const _=s(198);const p=s(994);const{isBlob:m}=s(408);const{BINARY_TYPES:b,EMPTY_BUFFER:S,GUID:y,kForOnEventAttribute:k,kListener:g,kStatusCode:E,kWebSocket:w,NOOP:v}=s(190);const{EventTarget:{addEventListener:x,removeEventListener:O}}=s(789);const{format:C,parse:T}=s(966);const{toBuffer:L}=s(914);const N=30*1e3;const P=Symbol("kAborted");const W=[8,13];const B=["CONNECTING","OPEN","CLOSING","CLOSED"];const R=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class WebSocket extends r{constructor(e,t,s){super();this._binaryType=b[0];this._closeCode=1006;this._closeFrameReceived=false;this._closeFrameSent=false;this._closeMessage=S;this._closeTimer=null;this._errorEmitted=false;this._extensions={};this._paused=false;this._protocol="";this._readyState=WebSocket.CONNECTING;this._receiver=null;this._sender=null;this._socket=null;if(e!==null){this._bufferedAmount=0;this._isServer=false;this._redirects=0;if(t===undefined){t=[]}else if(!Array.isArray(t)){if(typeof t==="object"&&t!==null){s=t;t=[]}else{t=[t]}}initAsClient(this,e,t,s)}else{this._autoPong=s.autoPong;this._isServer=true}}get binaryType(){return this._binaryType}set binaryType(e){if(!b.includes(e))return;this._binaryType=e;if(this._receiver)this._receiver._binaryType=e}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,s){const r=new _({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});const n=new p(e,this._extensions,s.generateMask);this._receiver=r;this._sender=n;this._socket=e;r[w]=this;n[w]=this;e[w]=this;r.on("conclude",receiverOnConclude);r.on("drain",receiverOnDrain);r.on("error",receiverOnError);r.on("message",receiverOnMessage);r.on("ping",receiverOnPing);r.on("pong",receiverOnPong);n.onerror=senderOnError;if(e.setTimeout)e.setTimeout(0);if(e.setNoDelay)e.setNoDelay();if(t.length>0)e.unshift(t);e.on("close",socketOnClose);e.on("data",socketOnData);e.on("end",socketOnEnd);e.on("error",socketOnError);this._readyState=WebSocket.OPEN;this.emit("open")}emitClose(){if(!this._socket){this._readyState=WebSocket.CLOSED;this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[d.extensionName]){this._extensions[d.extensionName].cleanup()}this._receiver.removeAllListeners();this._readyState=WebSocket.CLOSED;this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState===WebSocket.CLOSED)return;if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";abortHandshake(this,this._req,e);return}if(this.readyState===WebSocket.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)){this._socket.end()}return}this._readyState=WebSocket.CLOSING;this._sender.close(e,t,!this._isServer,(e=>{if(e)return;this._closeFrameSent=true;if(this._closeFrameReceived||this._receiver._writableState.errorEmitted){this._socket.end()}}));setCloseTimer(this)}pause(){if(this.readyState===WebSocket.CONNECTING||this.readyState===WebSocket.CLOSED){return}this._paused=true;this._socket.pause()}ping(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof e==="function"){s=e;e=t=undefined}else if(typeof t==="function"){s=t;t=undefined}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}if(t===undefined)t=!this._isServer;this._sender.ping(e||S,t,s)}pong(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof e==="function"){s=e;e=t=undefined}else if(typeof t==="function"){s=t;t=undefined}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}if(t===undefined)t=!this._isServer;this._sender.pong(e||S,t,s)}resume(){if(this.readyState===WebSocket.CONNECTING||this.readyState===WebSocket.CLOSED){return}this._paused=false;if(!this._receiver._writableState.needDrain)this._socket.resume()}send(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof t==="function"){s=t;t={}}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}const r={binary:typeof e!=="string",mask:!this._isServer,compress:true,fin:true,...t};if(!this._extensions[d.extensionName]){r.compress=false}this._sender.send(e||S,r,s)}terminate(){if(this.readyState===WebSocket.CLOSED)return;if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";abortHandshake(this,this._req,e);return}if(this._socket){this._readyState=WebSocket.CLOSING;this._socket.destroy()}}}Object.defineProperty(WebSocket,"CONNECTING",{enumerable:true,value:B.indexOf("CONNECTING")});Object.defineProperty(WebSocket.prototype,"CONNECTING",{enumerable:true,value:B.indexOf("CONNECTING")});Object.defineProperty(WebSocket,"OPEN",{enumerable:true,value:B.indexOf("OPEN")});Object.defineProperty(WebSocket.prototype,"OPEN",{enumerable:true,value:B.indexOf("OPEN")});Object.defineProperty(WebSocket,"CLOSING",{enumerable:true,value:B.indexOf("CLOSING")});Object.defineProperty(WebSocket.prototype,"CLOSING",{enumerable:true,value:B.indexOf("CLOSING")});Object.defineProperty(WebSocket,"CLOSED",{enumerable:true,value:B.indexOf("CLOSED")});Object.defineProperty(WebSocket.prototype,"CLOSED",{enumerable:true,value:B.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(WebSocket.prototype,e,{enumerable:true})}));["open","error","close","message"].forEach((e=>{Object.defineProperty(WebSocket.prototype,`on${e}`,{enumerable:true,get(){for(const t of this.listeners(e)){if(t[k])return t[g]}return null},set(t){for(const t of this.listeners(e)){if(t[k]){this.removeListener(e,t);break}}if(typeof t!=="function")return;this.addEventListener(e,t,{[k]:true})}})}));WebSocket.prototype.addEventListener=x;WebSocket.prototype.removeEventListener=O;e.exports=WebSocket;function initAsClient(e,t,s,r){const o={allowSynchronousEvents:true,autoPong:true,protocolVersion:W[1],maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:true,followRedirects:false,maxRedirects:10,...r,socketPath:undefined,hostname:undefined,protocol:undefined,timeout:undefined,method:"GET",host:undefined,path:undefined,port:undefined};e._autoPong=o.autoPong;if(!W.includes(o.protocolVersion)){throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} `+`(supported versions: ${W.join(", ")})`)}let a;if(t instanceof u){a=t}else{try{a=new u(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}}if(a.protocol==="http:"){a.protocol="ws:"}else if(a.protocol==="https:"){a.protocol="wss:"}e._url=a.href;const f=a.protocol==="wss:";const h=a.protocol==="ws+unix:";let _;if(a.protocol!=="ws:"&&!f&&!h){_='The URL\'s protocol must be one of "ws:", "wss:", '+'"http:", "https", or "ws+unix:"'}else if(h&&!a.pathname){_="The URL's pathname is empty"}else if(a.hash){_="The URL contains a fragment identifier"}if(_){const t=new SyntaxError(_);if(e._redirects===0){throw t}else{emitErrorAndClose(e,t);return}}const p=f?443:80;const m=c(16).toString("base64");const b=f?n.request:i.request;const S=new Set;let k;o.createConnection=o.createConnection||(f?tlsConnect:netConnect);o.defaultPort=o.defaultPort||p;o.port=a.port||p;o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname;o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket"};o.path=a.pathname+a.search;o.timeout=o.handshakeTimeout;if(o.perMessageDeflate){k=new d(o.perMessageDeflate!==true?o.perMessageDeflate:{},false,o.maxPayload);o.headers["Sec-WebSocket-Extensions"]=C({[d.extensionName]:k.offer()})}if(s.length){for(const e of s){if(typeof e!=="string"||!R.test(e)||S.has(e)){throw new SyntaxError("An invalid or duplicated subprotocol was specified")}S.add(e)}o.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(o.origin){if(o.protocolVersion<13){o.headers["Sec-WebSocket-Origin"]=o.origin}else{o.headers.Origin=o.origin}}if(a.username||a.password){o.auth=`${a.username}:${a.password}`}if(h){const e=o.path.split(":");o.socketPath=e[0];o.path=e[1]}let g;if(o.followRedirects){if(e._redirects===0){e._originalIpc=h;e._originalSecure=f;e._originalHostOrSocketPath=h?o.socketPath:a.host;const t=r&&r.headers;r={...r,headers:{}};if(t){for(const[e,s]of Object.entries(t)){r.headers[e.toLowerCase()]=s}}}else if(e.listenerCount("redirect")===0){const t=h?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:false:e._originalIpc?false:a.host===e._originalHostOrSocketPath;if(!t||e._originalSecure&&!f){delete o.headers.authorization;delete o.headers.cookie;if(!t)delete o.headers.host;o.auth=undefined}}if(o.auth&&!r.headers.authorization){r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")}g=e._req=b(o);if(e._redirects){e.emit("redirect",e.url,g)}}else{g=e._req=b(o)}if(o.timeout){g.on("timeout",(()=>{abortHandshake(e,g,"Opening handshake has timed out")}))}g.on("error",(t=>{if(g===null||g[P])return;g=e._req=null;emitErrorAndClose(e,t)}));g.on("response",(n=>{const i=n.headers.location;const a=n.statusCode;if(i&&o.followRedirects&&a>=300&&a<400){if(++e._redirects>o.maxRedirects){abortHandshake(e,g,"Maximum redirects exceeded");return}g.abort();let n;try{n=new u(i,t)}catch(t){const s=new SyntaxError(`Invalid URL: ${i}`);emitErrorAndClose(e,s);return}initAsClient(e,n,s,r)}else if(!e.emit("unexpected-response",g,n)){abortHandshake(e,g,`Unexpected server response: ${n.statusCode}`)}}));g.on("upgrade",((t,s,r)=>{e.emit("upgrade",t);if(e.readyState!==WebSocket.CONNECTING)return;g=e._req=null;const n=t.headers.upgrade;if(n===undefined||n.toLowerCase()!=="websocket"){abortHandshake(e,s,"Invalid Upgrade header");return}const i=l("sha1").update(m+y).digest("base64");if(t.headers["sec-websocket-accept"]!==i){abortHandshake(e,s,"Invalid Sec-WebSocket-Accept header");return}const a=t.headers["sec-websocket-protocol"];let c;if(a!==undefined){if(!S.size){c="Server sent a subprotocol but none was requested"}else if(!S.has(a)){c="Server sent an invalid subprotocol"}}else if(S.size){c="Server sent no subprotocol"}if(c){abortHandshake(e,s,c);return}if(a)e._protocol=a;const f=t.headers["sec-websocket-extensions"];if(f!==undefined){if(!k){const t="Server sent a Sec-WebSocket-Extensions header but no extension "+"was requested";abortHandshake(e,s,t);return}let t;try{t=T(f)}catch(t){const r="Invalid Sec-WebSocket-Extensions header";abortHandshake(e,s,r);return}const r=Object.keys(t);if(r.length!==1||r[0]!==d.extensionName){const t="Server indicated an extension that was not requested";abortHandshake(e,s,t);return}try{k.accept(t[d.extensionName])}catch(t){const r="Invalid Sec-WebSocket-Extensions header";abortHandshake(e,s,r);return}e._extensions[d.extensionName]=k}e.setSocket(s,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}));if(o.finishRequest){o.finishRequest(g,e)}else{g.end()}}function emitErrorAndClose(e,t){e._readyState=WebSocket.CLOSING;e._errorEmitted=true;e.emit("error",t);e.emitClose()}function netConnect(e){e.path=e.socketPath;return o.connect(e)}function tlsConnect(e){e.path=undefined;if(!e.servername&&e.servername!==""){e.servername=o.isIP(e.host)?"":e.host}return a.connect(e)}function abortHandshake(e,t,s){e._readyState=WebSocket.CLOSING;const r=new Error(s);Error.captureStackTrace(r,abortHandshake);if(t.setHeader){t[P]=true;t.abort();if(t.socket&&!t.socket.destroyed){t.socket.destroy()}process.nextTick(emitErrorAndClose,e,r)}else{t.destroy(r);t.once("error",e.emit.bind(e,"error"));t.once("close",e.emitClose.bind(e))}}function sendAfterClose(e,t,s){if(t){const s=m(t)?t.size:L(t).length;if(e._socket)e._sender._bufferedBytes+=s;else e._bufferedAmount+=s}if(s){const t=new Error(`WebSocket is not open: readyState ${e.readyState} `+`(${B[e.readyState]})`);process.nextTick(s,t)}}function receiverOnConclude(e,t){const s=this[w];s._closeFrameReceived=true;s._closeMessage=t;s._closeCode=e;if(s._socket[w]===undefined)return;s._socket.removeListener("data",socketOnData);process.nextTick(resume,s._socket);if(e===1005)s.close();else s.close(e,t)}function receiverOnDrain(){const e=this[w];if(!e.isPaused)e._socket.resume()}function receiverOnError(e){const t=this[w];if(t._socket[w]!==undefined){t._socket.removeListener("data",socketOnData);process.nextTick(resume,t._socket);t.close(e[E])}if(!t._errorEmitted){t._errorEmitted=true;t.emit("error",e)}}function receiverOnFinish(){this[w].emitClose()}function receiverOnMessage(e,t){this[w].emit("message",e,t)}function receiverOnPing(e){const t=this[w];if(t._autoPong)t.pong(e,!this._isServer,v);t.emit("ping",e)}function receiverOnPong(e){this[w].emit("pong",e)}function resume(e){e.resume()}function senderOnError(e){const t=this[w];if(t.readyState===WebSocket.CLOSED)return;if(t.readyState===WebSocket.OPEN){t._readyState=WebSocket.CLOSING;setCloseTimer(t)}this._socket.end();if(!t._errorEmitted){t._errorEmitted=true;t.emit("error",e)}}function setCloseTimer(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),N)}function socketOnClose(){const e=this[w];this.removeListener("close",socketOnClose);this.removeListener("data",socketOnData);this.removeListener("end",socketOnEnd);e._readyState=WebSocket.CLOSING;let t;if(!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&(t=e._socket.read())!==null){e._receiver.write(t)}e._receiver.end();this[w]=undefined;clearTimeout(e._closeTimer);if(e._receiver._writableState.finished||e._receiver._writableState.errorEmitted){e.emitClose()}else{e._receiver.on("error",receiverOnFinish);e._receiver.on("finish",receiverOnFinish)}}function socketOnData(e){if(!this[w]._receiver.write(e)){this.pause()}}function socketOnEnd(){const e=this[w];e._readyState=WebSocket.CLOSING;e._receiver.end();this.end()}function socketOnError(){const e=this[w];this.removeListener("error",socketOnError);this.on("error",v);if(e){e._readyState=WebSocket.CLOSING;this.destroy()}}},653:function(module){module.exports=eval("require")("bufferutil")},4:function(module){module.exports=eval("require")("utf-8-validate")},181:function(e){"use strict";e.exports=require("buffer")},982:function(e){"use strict";e.exports=require("crypto")},434:function(e){"use strict";e.exports=require("events")},611:function(e){"use strict";e.exports=require("http")},692:function(e){"use strict";e.exports=require("https")},278:function(e){"use strict";e.exports=require("net")},203:function(e){"use strict";e.exports=require("stream")},756:function(e){"use strict";e.exports=require("tls")},16:function(e){"use strict";e.exports=require("url")},106:function(e){"use strict";e.exports=require("zlib")}};var __webpack_module_cache__={};function __nccwpck_require__(e){var t=__webpack_module_cache__[e];if(t!==undefined){return t.exports}var s=__webpack_module_cache__[e]={exports:{}};var r=true;try{__webpack_modules__[e](s,s.exports,__nccwpck_require__);r=false}finally{if(r)delete __webpack_module_cache__[e]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__=__nccwpck_require__(99);module.exports=__webpack_exports__})();
|
|
1
|
+
(function(){var __webpack_modules__={110:function(e,t,s){"use strict";const r=s(933);r.createWebSocketStream=s(368);r.Server=s(637);r.Receiver=s(761);r.Sender=s(161);r.WebSocket=r;r.WebSocketServer=r.Server;e.exports=r},767:function(e,t,s){"use strict";const{EMPTY_BUFFER:r}=s(899);const n=Buffer[Symbol.species];function concat(e,t){if(e.length===0)return r;if(e.length===1)return e[0];const s=Buffer.allocUnsafe(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];s.set(r,i);i+=r.length}if(i<t){return new n(s.buffer,s.byteOffset,i)}return s}function _mask(e,t,s,r,n){for(let i=0;i<n;i++){s[r+i]=e[i]^t[i&3]}}function _unmask(e,t){for(let s=0;s<e.length;s++){e[s]^=t[s&3]}}function toArrayBuffer(e){if(e.length===e.buffer.byteLength){return e.buffer}return e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function toBuffer(e){toBuffer.readOnly=true;if(Buffer.isBuffer(e))return e;let t;if(e instanceof ArrayBuffer){t=new n(e)}else if(ArrayBuffer.isView(e)){t=new n(e.buffer,e.byteOffset,e.byteLength)}else{t=Buffer.from(e);toBuffer.readOnly=false}return t}e.exports={concat:concat,mask:_mask,toArrayBuffer:toArrayBuffer,toBuffer:toBuffer,unmask:_unmask};if(!process.env.WS_NO_BUFFER_UTIL){try{const t=s(653);e.exports.mask=function(e,s,r,n,i){if(i<48)_mask(e,s,r,n,i);else t.mask(e,s,r,n,i)};e.exports.unmask=function(e,s){if(e.length<32)_unmask(e,s);else t.unmask(e,s)}}catch(e){}}},899:function(e){"use strict";const t=["nodebuffer","arraybuffer","fragments"];const s=typeof Blob!=="undefined";if(s)t.push("blob");e.exports={BINARY_TYPES:t,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:s,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},350:function(e,t,s){"use strict";const{kForOnEventAttribute:r,kListener:n}=s(899);const i=Symbol("kCode");const o=Symbol("kData");const a=Symbol("kError");const c=Symbol("kMessage");const l=Symbol("kReason");const f=Symbol("kTarget");const h=Symbol("kType");const u=Symbol("kWasClean");class Event{constructor(e){this[f]=null;this[h]=e}get target(){return this[f]}get type(){return this[h]}}Object.defineProperty(Event.prototype,"target",{enumerable:true});Object.defineProperty(Event.prototype,"type",{enumerable:true});class CloseEvent extends Event{constructor(e,t={}){super(e);this[i]=t.code===undefined?0:t.code;this[l]=t.reason===undefined?"":t.reason;this[u]=t.wasClean===undefined?false:t.wasClean}get code(){return this[i]}get reason(){return this[l]}get wasClean(){return this[u]}}Object.defineProperty(CloseEvent.prototype,"code",{enumerable:true});Object.defineProperty(CloseEvent.prototype,"reason",{enumerable:true});Object.defineProperty(CloseEvent.prototype,"wasClean",{enumerable:true});class ErrorEvent extends Event{constructor(e,t={}){super(e);this[a]=t.error===undefined?null:t.error;this[c]=t.message===undefined?"":t.message}get error(){return this[a]}get message(){return this[c]}}Object.defineProperty(ErrorEvent.prototype,"error",{enumerable:true});Object.defineProperty(ErrorEvent.prototype,"message",{enumerable:true});class MessageEvent extends Event{constructor(e,t={}){super(e);this[o]=t.data===undefined?null:t.data}get data(){return this[o]}}Object.defineProperty(MessageEvent.prototype,"data",{enumerable:true});const d={addEventListener(e,t,s={}){for(const i of this.listeners(e)){if(!s[r]&&i[n]===t&&!i[r]){return}}let i;if(e==="message"){i=function onMessage(e,s){const r=new MessageEvent("message",{data:s?e:e.toString()});r[f]=this;callListener(t,this,r)}}else if(e==="close"){i=function onClose(e,s){const r=new CloseEvent("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[f]=this;callListener(t,this,r)}}else if(e==="error"){i=function onError(e){const s=new ErrorEvent("error",{error:e,message:e.message});s[f]=this;callListener(t,this,s)}}else if(e==="open"){i=function onOpen(){const e=new Event("open");e[f]=this;callListener(t,this,e)}}else{return}i[r]=!!s[r];i[n]=t;if(s.once){this.once(e,i)}else{this.on(e,i)}},removeEventListener(e,t){for(const s of this.listeners(e)){if(s[n]===t&&!s[r]){this.removeListener(e,s);break}}}};e.exports={CloseEvent:CloseEvent,ErrorEvent:ErrorEvent,Event:Event,EventTarget:d,MessageEvent:MessageEvent};function callListener(e,t,s){if(typeof e==="object"&&e.handleEvent){e.handleEvent.call(e,s)}else{e.call(t,s)}}},579:function(e,t,s){"use strict";const{tokenChars:r}=s(371);function push(e,t,s){if(e[t]===undefined)e[t]=[s];else e[t].push(s)}function parse(e){const t=Object.create(null);let s=Object.create(null);let n=false;let i=false;let o=false;let a;let c;let l=-1;let f=-1;let h=-1;let u=0;for(;u<e.length;u++){f=e.charCodeAt(u);if(a===undefined){if(h===-1&&r[f]===1){if(l===-1)l=u}else if(u!==0&&(f===32||f===9)){if(h===-1&&l!==-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;const r=e.slice(l,h);if(f===44){push(t,r,s);s=Object.create(null)}else{a=r}l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else if(c===undefined){if(h===-1&&r[f]===1){if(l===-1)l=u}else if(f===32||f===9){if(h===-1&&l!==-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;push(s,e.slice(l,h),true);if(f===44){push(t,a,s);s=Object.create(null);a=undefined}l=h=-1}else if(f===61&&l!==-1&&h===-1){c=e.slice(l,u);l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else{if(i){if(r[f]!==1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(l===-1)l=u;else if(!n)n=true;i=false}else if(o){if(r[f]===1){if(l===-1)l=u}else if(f===34&&l!==-1){o=false;h=u}else if(f===92){i=true}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else if(f===34&&e.charCodeAt(u-1)===61){o=true}else if(h===-1&&r[f]===1){if(l===-1)l=u}else if(l!==-1&&(f===32||f===9)){if(h===-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;let r=e.slice(l,h);if(n){r=r.replace(/\\/g,"");n=false}push(s,c,r);if(f===44){push(t,a,s);s=Object.create(null);a=undefined}c=undefined;l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}}if(l===-1||o||f===32||f===9){throw new SyntaxError("Unexpected end of input")}if(h===-1)h=u;const d=e.slice(l,h);if(a===undefined){push(t,d,s)}else{if(c===undefined){push(s,d,true)}else if(n){push(s,c,d.replace(/\\/g,""))}else{push(s,c,d)}push(t,a,s)}return t}function format(e){return Object.keys(e).map((t=>{let s=e[t];if(!Array.isArray(s))s=[s];return s.map((e=>[t].concat(Object.keys(e).map((t=>{let s=e[t];if(!Array.isArray(s))s=[s];return s.map((e=>e===true?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")}e.exports={format:format,parse:parse}},26:function(e){"use strict";const t=Symbol("kDone");const s=Symbol("kRun");class Limiter{constructor(e){this[t]=()=>{this.pending--;this[s]()};this.concurrency=e||Infinity;this.jobs=[];this.pending=0}add(e){this.jobs.push(e);this[s]()}[s](){if(this.pending===this.concurrency)return;if(this.jobs.length){const e=this.jobs.shift();this.pending++;e(this[t])}}}e.exports=Limiter},548:function(e,t,s){"use strict";const r=s(106);const n=s(767);const i=s(26);const{kStatusCode:o}=s(899);const a=Buffer[Symbol.species];const c=Buffer.from([0,0,255,255]);const l=Symbol("permessage-deflate");const f=Symbol("total-length");const h=Symbol("callback");const u=Symbol("buffers");const d=Symbol("error");let _;class PerMessageDeflate{constructor(e,t,s){this._maxPayload=s|0;this._options=e||{};this._threshold=this._options.threshold!==undefined?this._options.threshold:1024;this._isServer=!!t;this._deflate=null;this._inflate=null;this.params=null;if(!_){const e=this._options.concurrencyLimit!==undefined?this._options.concurrencyLimit:10;_=new i(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};if(this._options.serverNoContextTakeover){e.server_no_context_takeover=true}if(this._options.clientNoContextTakeover){e.client_no_context_takeover=true}if(this._options.serverMaxWindowBits){e.server_max_window_bits=this._options.serverMaxWindowBits}if(this._options.clientMaxWindowBits){e.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits==null){e.client_max_window_bits=true}return e}accept(e){e=this.normalizeParams(e);this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e);return this.params}cleanup(){if(this._inflate){this._inflate.close();this._inflate=null}if(this._deflate){const e=this._deflate[h];this._deflate.close();this._deflate=null;if(e){e(new Error("The deflate stream was closed while data was being processed"))}}}acceptAsServer(e){const t=this._options;const s=e.find((e=>{if(t.serverNoContextTakeover===false&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===false||typeof t.serverMaxWindowBits==="number"&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==="number"&&!e.client_max_window_bits){return false}return true}));if(!s){throw new Error("None of the extension offers can be accepted")}if(t.serverNoContextTakeover){s.server_no_context_takeover=true}if(t.clientNoContextTakeover){s.client_no_context_takeover=true}if(typeof t.serverMaxWindowBits==="number"){s.server_max_window_bits=t.serverMaxWindowBits}if(typeof t.clientMaxWindowBits==="number"){s.client_max_window_bits=t.clientMaxWindowBits}else if(s.client_max_window_bits===true||t.clientMaxWindowBits===false){delete s.client_max_window_bits}return s}acceptAsClient(e){const t=e[0];if(this._options.clientNoContextTakeover===false&&t.client_no_context_takeover){throw new Error('Unexpected parameter "client_no_context_takeover"')}if(!t.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number"){t.client_max_window_bits=this._options.clientMaxWindowBits}}else if(this._options.clientMaxWindowBits===false||typeof this._options.clientMaxWindowBits==="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits){throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}return t}normalizeParams(e){e.forEach((e=>{Object.keys(e).forEach((t=>{let s=e[t];if(s.length>1){throw new Error(`Parameter "${t}" must have only a single value`)}s=s[0];if(t==="client_max_window_bits"){if(s!==true){const e=+s;if(!Number.isInteger(e)||e<8||e>15){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}s=e}else if(!this._isServer){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}}else if(t==="server_max_window_bits"){const e=+s;if(!Number.isInteger(e)||e<8||e>15){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}s=e}else if(t==="client_no_context_takeover"||t==="server_no_context_takeover"){if(s!==true){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}}else{throw new Error(`Unknown parameter "${t}"`)}e[t]=s}))}));return e}decompress(e,t,s){_.add((r=>{this._decompress(e,t,((e,t)=>{r();s(e,t)}))}))}compress(e,t,s){_.add((r=>{this._compress(e,t,((e,t)=>{r();s(e,t)}))}))}_decompress(e,t,s){const i=this._isServer?"client":"server";if(!this._inflate){const e=`${i}_max_window_bits`;const t=typeof this.params[e]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t});this._inflate[l]=this;this._inflate[f]=0;this._inflate[u]=[];this._inflate.on("error",inflateOnError);this._inflate.on("data",inflateOnData)}this._inflate[h]=s;this._inflate.write(e);if(t)this._inflate.write(c);this._inflate.flush((()=>{const e=this._inflate[d];if(e){this._inflate.close();this._inflate=null;s(e);return}const r=n.concat(this._inflate[u],this._inflate[f]);if(this._inflate._readableState.endEmitted){this._inflate.close();this._inflate=null}else{this._inflate[f]=0;this._inflate[u]=[];if(t&&this.params[`${i}_no_context_takeover`]){this._inflate.reset()}}s(null,r)}))}_compress(e,t,s){const i=this._isServer?"server":"client";if(!this._deflate){const e=`${i}_max_window_bits`;const t=typeof this.params[e]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t});this._deflate[f]=0;this._deflate[u]=[];this._deflate.on("data",deflateOnData)}this._deflate[h]=s;this._deflate.write(e);this._deflate.flush(r.Z_SYNC_FLUSH,(()=>{if(!this._deflate){return}let e=n.concat(this._deflate[u],this._deflate[f]);if(t){e=new a(e.buffer,e.byteOffset,e.length-4)}this._deflate[h]=null;this._deflate[f]=0;this._deflate[u]=[];if(t&&this.params[`${i}_no_context_takeover`]){this._deflate.reset()}s(null,e)}))}}e.exports=PerMessageDeflate;function deflateOnData(e){this[u].push(e);this[f]+=e.length}function inflateOnData(e){this[f]+=e.length;if(this[l]._maxPayload<1||this[f]<=this[l]._maxPayload){this[u].push(e);return}this[d]=new RangeError("Max payload size exceeded");this[d].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";this[d][o]=1009;this.removeListener("data",inflateOnData);this.reset()}function inflateOnError(e){this[l]._inflate=null;if(this[d]){this[h](this[d]);return}e[o]=1007;this[h](e)}},761:function(e,t,s){"use strict";const{Writable:r}=s(203);const n=s(548);const{BINARY_TYPES:i,EMPTY_BUFFER:o,kStatusCode:a,kWebSocket:c}=s(899);const{concat:l,toArrayBuffer:f,unmask:h}=s(767);const{isValidStatusCode:u,isValidUTF8:d}=s(371);const _=Buffer[Symbol.species];const p=0;const m=1;const b=2;const S=3;const y=4;const k=5;const g=6;class Receiver extends r{constructor(e={}){super();this._allowSynchronousEvents=e.allowSynchronousEvents!==undefined?e.allowSynchronousEvents:true;this._binaryType=e.binaryType||i[0];this._extensions=e.extensions||{};this._isServer=!!e.isServer;this._maxPayload=e.maxPayload|0;this._skipUTF8Validation=!!e.skipUTF8Validation;this[c]=undefined;this._bufferedBytes=0;this._buffers=[];this._compressed=false;this._payloadLength=0;this._mask=undefined;this._fragmented=0;this._masked=false;this._fin=false;this._opcode=0;this._totalPayloadLength=0;this._messageLength=0;this._fragments=[];this._errored=false;this._loop=false;this._state=p}_write(e,t,s){if(this._opcode===8&&this._state==p)return s();this._bufferedBytes+=e.length;this._buffers.push(e);this.startLoop(s)}consume(e){this._bufferedBytes-=e;if(e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];this._buffers[0]=new _(t.buffer,t.byteOffset+e,t.length-e);return new _(t.buffer,t.byteOffset,e)}const t=Buffer.allocUnsafe(e);do{const s=this._buffers[0];const r=t.length-e;if(e>=s.length){t.set(this._buffers.shift(),r)}else{t.set(new Uint8Array(s.buffer,s.byteOffset,e),r);this._buffers[0]=new _(s.buffer,s.byteOffset+e,s.length-e)}e-=s.length}while(e>0);return t}startLoop(e){this._loop=true;do{switch(this._state){case p:this.getInfo(e);break;case m:this.getPayloadLength16(e);break;case b:this.getPayloadLength64(e);break;case S:this.getMask();break;case y:this.getData(e);break;case k:case g:this._loop=false;return}}while(this._loop);if(!this._errored)e()}getInfo(e){if(this._bufferedBytes<2){this._loop=false;return}const t=this.consume(2);if((t[0]&48)!==0){const t=this.createError(RangeError,"RSV2 and RSV3 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(t);return}const s=(t[0]&64)===64;if(s&&!this._extensions[n.extensionName]){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}this._fin=(t[0]&128)===128;this._opcode=t[0]&15;this._payloadLength=t[1]&127;if(this._opcode===0){if(s){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}if(!this._fragmented){const t=this.createError(RangeError,"invalid opcode 0",true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){const t=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}this._compressed=s}else if(this._opcode>7&&this._opcode<11){if(!this._fin){const t=this.createError(RangeError,"FIN must be set",true,1002,"WS_ERR_EXPECTED_FIN");e(t);return}if(s){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){const t=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,true,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(t);return}}else{const t=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;this._masked=(t[1]&128)===128;if(this._isServer){if(!this._masked){const t=this.createError(RangeError,"MASK must be set",true,1002,"WS_ERR_EXPECTED_MASK");e(t);return}}else if(this._masked){const t=this.createError(RangeError,"MASK must be clear",true,1002,"WS_ERR_UNEXPECTED_MASK");e(t);return}if(this._payloadLength===126)this._state=m;else if(this._payloadLength===127)this._state=b;else this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=false;return}this._payloadLength=this.consume(2).readUInt16BE(0);this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=false;return}const t=this.consume(8);const s=t.readUInt32BE(0);if(s>Math.pow(2,53-32)-1){const t=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",false,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(t);return}this._payloadLength=s*Math.pow(2,32)+t.readUInt32BE(4);this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8){this._totalPayloadLength+=this._payloadLength;if(this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){const t=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}}if(this._masked)this._state=S;else this._state=y}getMask(){if(this._bufferedBytes<4){this._loop=false;return}this._mask=this.consume(4);this._state=y}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=false;return}t=this.consume(this._payloadLength);if(this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0){h(t,this._mask)}}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=k;this.decompress(t,e);return}if(t.length){this._messageLength=this._totalPayloadLength;this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){const s=this._extensions[n.extensionName];s.decompress(e,this._fin,((e,s)=>{if(e)return t(e);if(s.length){this._messageLength+=s.length;if(this._messageLength>this._maxPayload&&this._maxPayload>0){const e=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(e);return}this._fragments.push(s)}this.dataMessage(t);if(this._state===p)this.startLoop(t)}))}dataMessage(e){if(!this._fin){this._state=p;return}const t=this._messageLength;const s=this._fragments;this._totalPayloadLength=0;this._messageLength=0;this._fragmented=0;this._fragments=[];if(this._opcode===2){let r;if(this._binaryType==="nodebuffer"){r=l(s,t)}else if(this._binaryType==="arraybuffer"){r=f(l(s,t))}else if(this._binaryType==="blob"){r=new Blob(s)}else{r=s}if(this._allowSynchronousEvents){this.emit("message",r,true);this._state=p}else{this._state=g;setImmediate((()=>{this.emit("message",r,true);this._state=p;this.startLoop(e)}))}}else{const r=l(s,t);if(!this._skipUTF8Validation&&!d(r)){const t=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");e(t);return}if(this._state===k||this._allowSynchronousEvents){this.emit("message",r,false);this._state=p}else{this._state=g;setImmediate((()=>{this.emit("message",r,false);this._state=p;this.startLoop(e)}))}}}controlMessage(e,t){if(this._opcode===8){if(e.length===0){this._loop=false;this.emit("conclude",1005,o);this.end()}else{const s=e.readUInt16BE(0);if(!u(s)){const e=this.createError(RangeError,`invalid status code ${s}`,true,1002,"WS_ERR_INVALID_CLOSE_CODE");t(e);return}const r=new _(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!d(r)){const e=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");t(e);return}this._loop=false;this.emit("conclude",s,r);this.end()}this._state=p;return}if(this._allowSynchronousEvents){this.emit(this._opcode===9?"ping":"pong",e);this._state=p}else{this._state=g;setImmediate((()=>{this.emit(this._opcode===9?"ping":"pong",e);this._state=p;this.startLoop(t)}))}}createError(e,t,s,r,n){this._loop=false;this._errored=true;const i=new e(s?`Invalid WebSocket frame: ${t}`:t);Error.captureStackTrace(i,this.createError);i.code=n;i[a]=r;return i}}e.exports=Receiver},161:function(e,t,s){"use strict";const{Duplex:r}=s(203);const{randomFillSync:n}=s(982);const i=s(548);const{EMPTY_BUFFER:o,kWebSocket:a,NOOP:c}=s(899);const{isBlob:l,isValidStatusCode:f}=s(371);const{mask:h,toBuffer:u}=s(767);const d=Symbol("kByteLength");const _=Buffer.alloc(4);const p=8*1024;let m;let b=p;const S=0;const y=1;const k=2;class Sender{constructor(e,t,s){this._extensions=t||{};if(s){this._generateMask=s;this._maskBuffer=Buffer.alloc(4)}this._socket=e;this._firstFragment=true;this._compress=false;this._bufferedBytes=0;this._queue=[];this._state=S;this.onerror=c;this[a]=undefined}static frame(e,t){let s;let r=false;let i=2;let o=false;if(t.mask){s=t.maskBuffer||_;if(t.generateMask){t.generateMask(s)}else{if(b===p){if(m===undefined){m=Buffer.alloc(p)}n(m,0,p);b=0}s[0]=m[b++];s[1]=m[b++];s[2]=m[b++];s[3]=m[b++]}o=(s[0]|s[1]|s[2]|s[3])===0;i=6}let a;if(typeof e==="string"){if((!t.mask||o)&&t[d]!==undefined){a=t[d]}else{e=Buffer.from(e);a=e.length}}else{a=e.length;r=t.mask&&t.readOnly&&!o}let c=a;if(a>=65536){i+=8;c=127}else if(a>125){i+=2;c=126}const l=Buffer.allocUnsafe(r?a+i:i);l[0]=t.fin?t.opcode|128:t.opcode;if(t.rsv1)l[0]|=64;l[1]=c;if(c===126){l.writeUInt16BE(a,2)}else if(c===127){l[2]=l[3]=0;l.writeUIntBE(a,4,6)}if(!t.mask)return[l,e];l[1]|=128;l[i-4]=s[0];l[i-3]=s[1];l[i-2]=s[2];l[i-1]=s[3];if(o)return[l,e];if(r){h(e,s,l,i,a);return[l]}h(e,s,e,0,a);return[l,e]}close(e,t,s,r){let n;if(e===undefined){n=o}else if(typeof e!=="number"||!f(e)){throw new TypeError("First argument must be a valid error code number")}else if(t===undefined||!t.length){n=Buffer.allocUnsafe(2);n.writeUInt16BE(e,0)}else{const s=Buffer.byteLength(t);if(s>123){throw new RangeError("The message must not be greater than 123 bytes")}n=Buffer.allocUnsafe(2+s);n.writeUInt16BE(e,0);if(typeof t==="string"){n.write(t,2)}else{n.set(t,2)}}const i={[d]:n.length,fin:true,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:false,rsv1:false};if(this._state!==S){this.enqueue([this.dispatch,n,false,i,r])}else{this.sendFrame(Sender.frame(n,i),r)}}ping(e,t,s){let r;let n;if(typeof e==="string"){r=Buffer.byteLength(e);n=false}else if(l(e)){r=e.size;n=false}else{e=u(e);r=e.length;n=u.readOnly}if(r>125){throw new RangeError("The data size must not be greater than 125 bytes")}const i={[d]:r,fin:true,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:false};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,false,i,s])}else{this.getBlobData(e,false,i,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,false,i,s])}else{this.sendFrame(Sender.frame(e,i),s)}}pong(e,t,s){let r;let n;if(typeof e==="string"){r=Buffer.byteLength(e);n=false}else if(l(e)){r=e.size;n=false}else{e=u(e);r=e.length;n=u.readOnly}if(r>125){throw new RangeError("The data size must not be greater than 125 bytes")}const i={[d]:r,fin:true,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:false};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,false,i,s])}else{this.getBlobData(e,false,i,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,false,i,s])}else{this.sendFrame(Sender.frame(e,i),s)}}send(e,t,s){const r=this._extensions[i.extensionName];let n=t.binary?2:1;let o=t.compress;let a;let c;if(typeof e==="string"){a=Buffer.byteLength(e);c=false}else if(l(e)){a=e.size;c=false}else{e=u(e);a=e.length;c=u.readOnly}if(this._firstFragment){this._firstFragment=false;if(o&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]){o=a>=r._threshold}this._compress=o}else{o=false;n=0}if(t.fin)this._firstFragment=true;const f={[d]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,this._compress,f,s])}else{this.getBlobData(e,this._compress,f,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,this._compress,f,s])}else{this.dispatch(e,this._compress,f,s)}}getBlobData(e,t,s,r){this._bufferedBytes+=s[d];this._state=k;e.arrayBuffer().then((e=>{if(this._socket.destroyed){const e=new Error("The socket was closed while the blob was being read");process.nextTick(callCallbacks,this,e,r);return}this._bufferedBytes-=s[d];const n=u(e);if(!t){this._state=S;this.sendFrame(Sender.frame(n,s),r);this.dequeue()}else{this.dispatch(n,t,s,r)}})).catch((e=>{process.nextTick(onError,this,e,r)}))}dispatch(e,t,s,r){if(!t){this.sendFrame(Sender.frame(e,s),r);return}const n=this._extensions[i.extensionName];this._bufferedBytes+=s[d];this._state=y;n.compress(e,s.fin,((e,t)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");callCallbacks(this,e,r);return}this._bufferedBytes-=s[d];this._state=S;s.readOnly=false;this.sendFrame(Sender.frame(t,s),r);this.dequeue()}))}dequeue(){while(this._state===S&&this._queue.length){const e=this._queue.shift();this._bufferedBytes-=e[3][d];Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][d];this._queue.push(e)}sendFrame(e,t){if(e.length===2){this._socket.cork();this._socket.write(e[0]);this._socket.write(e[1],t);this._socket.uncork()}else{this._socket.write(e[0],t)}}}e.exports=Sender;function callCallbacks(e,t,s){if(typeof s==="function")s(t);for(let s=0;s<e._queue.length;s++){const r=e._queue[s];const n=r[r.length-1];if(typeof n==="function")n(t)}}function onError(e,t,s){callCallbacks(e,t,s);e.onerror(t)}},368:function(e,t,s){"use strict";const r=s(933);const{Duplex:n}=s(203);function emitClose(e){e.emit("close")}function duplexOnEnd(){if(!this.destroyed&&this._writableState.finished){this.destroy()}}function duplexOnError(e){this.removeListener("error",duplexOnError);this.destroy();if(this.listenerCount("error")===0){this.emit("error",e)}}function createWebSocketStream(e,t){let s=true;const r=new n({...t,autoDestroy:false,emitClose:false,objectMode:false,writableObjectMode:false});e.on("message",(function message(t,s){const n=!s&&r._readableState.objectMode?t.toString():t;if(!r.push(n))e.pause()}));e.once("error",(function error(e){if(r.destroyed)return;s=false;r.destroy(e)}));e.once("close",(function close(){if(r.destroyed)return;r.push(null)}));r._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t);process.nextTick(emitClose,r);return}let i=false;e.once("error",(function error(e){i=true;n(e)}));e.once("close",(function close(){if(!i)n(t);process.nextTick(emitClose,r)}));if(s)e.terminate()};r._final=function(t){if(e.readyState===e.CONNECTING){e.once("open",(function open(){r._final(t)}));return}if(e._socket===null)return;if(e._socket._writableState.finished){t();if(r._readableState.endEmitted)r.destroy()}else{e._socket.once("finish",(function finish(){t()}));e.close()}};r._read=function(){if(e.isPaused)e.resume()};r._write=function(t,s,n){if(e.readyState===e.CONNECTING){e.once("open",(function open(){r._write(t,s,n)}));return}e.send(t,n)};r.on("end",duplexOnEnd);r.on("error",duplexOnError);return r}e.exports=createWebSocketStream},624:function(e,t,s){"use strict";const{tokenChars:r}=s(371);function parse(e){const t=new Set;let s=-1;let n=-1;let i=0;for(i;i<e.length;i++){const o=e.charCodeAt(i);if(n===-1&&r[o]===1){if(s===-1)s=i}else if(i!==0&&(o===32||o===9)){if(n===-1&&s!==-1)n=i}else if(o===44){if(s===-1){throw new SyntaxError(`Unexpected character at index ${i}`)}if(n===-1)n=i;const r=e.slice(s,n);if(t.has(r)){throw new SyntaxError(`The "${r}" subprotocol is duplicated`)}t.add(r);s=n=-1}else{throw new SyntaxError(`Unexpected character at index ${i}`)}}if(s===-1||n!==-1){throw new SyntaxError("Unexpected end of input")}const o=e.slice(s,i);if(t.has(o)){throw new SyntaxError(`The "${o}" subprotocol is duplicated`)}t.add(o);return t}e.exports={parse:parse}},371:function(e,t,s){"use strict";const{isUtf8:r}=s(181);const{hasBlob:n}=s(899);const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function isValidStatusCode(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function _isValidUTF8(e){const t=e.length;let s=0;while(s<t){if((e[s]&128)===0){s++}else if((e[s]&224)===192){if(s+1===t||(e[s+1]&192)!==128||(e[s]&254)===192){return false}s+=2}else if((e[s]&240)===224){if(s+2>=t||(e[s+1]&192)!==128||(e[s+2]&192)!==128||e[s]===224&&(e[s+1]&224)===128||e[s]===237&&(e[s+1]&224)===160){return false}s+=3}else if((e[s]&248)===240){if(s+3>=t||(e[s+1]&192)!==128||(e[s+2]&192)!==128||(e[s+3]&192)!==128||e[s]===240&&(e[s+1]&240)===128||e[s]===244&&e[s+1]>143||e[s]>244){return false}s+=4}else{return false}}return true}function isBlob(e){return n&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}e.exports={isBlob:isBlob,isValidStatusCode:isValidStatusCode,isValidUTF8:_isValidUTF8,tokenChars:i};if(r){e.exports.isValidUTF8=function(e){return e.length<24?_isValidUTF8(e):r(e)}}else if(!process.env.WS_NO_UTF_8_VALIDATE){try{const t=s(4);e.exports.isValidUTF8=function(e){return e.length<32?_isValidUTF8(e):t(e)}}catch(e){}}},637:function(e,t,s){"use strict";const r=s(434);const n=s(611);const{Duplex:i}=s(203);const{createHash:o}=s(982);const a=s(579);const c=s(548);const l=s(624);const f=s(933);const{GUID:h,kWebSocket:u}=s(899);const d=/^[+/0-9A-Za-z]{22}==$/;const _=0;const p=1;const m=2;class WebSocketServer extends r{constructor(e,t){super();e={allowSynchronousEvents:true,autoPong:true,maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:false,handleProtocols:null,clientTracking:true,verifyClient:null,noServer:false,backlog:null,server:null,host:null,path:null,port:null,WebSocket:f,...e};if(e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer){throw new TypeError('One and only one of the "port", "server", or "noServer" options '+"must be specified")}if(e.port!=null){this._server=n.createServer(((e,t)=>{const s=n.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"});t.end(s)}));this._server.listen(e.port,e.host,e.backlog,t)}else if(e.server){this._server=e.server}if(this._server){const e=this.emit.bind(this,"connection");this._removeListeners=addListeners(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}if(e.perMessageDeflate===true)e.perMessageDeflate={};if(e.clientTracking){this.clients=new Set;this._shouldEmitClose=false}this.options=e;this._state=_}address(){if(this.options.noServer){throw new Error('The server is operating in "noServer" mode')}if(!this._server)return null;return this._server.address()}close(e){if(this._state===m){if(e){this.once("close",(()=>{e(new Error("The server is not running"))}))}process.nextTick(emitClose,this);return}if(e)this.once("close",e);if(this._state===p)return;this._state=p;if(this.options.noServer||this.options.server){if(this._server){this._removeListeners();this._removeListeners=this._server=null}if(this.clients){if(!this.clients.size){process.nextTick(emitClose,this)}else{this._shouldEmitClose=true}}else{process.nextTick(emitClose,this)}}else{const e=this._server;this._removeListeners();this._removeListeners=this._server=null;e.close((()=>{emitClose(this)}))}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");const s=t!==-1?e.url.slice(0,t):e.url;if(s!==this.options.path)return false}return true}handleUpgrade(e,t,s,r){t.on("error",socketOnError);const n=e.headers["sec-websocket-key"];const i=e.headers.upgrade;const o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){const s="Invalid HTTP method";abortHandshakeOrEmitwsClientError(this,e,t,405,s);return}if(i===undefined||i.toLowerCase()!=="websocket"){const s="Invalid Upgrade header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(n===undefined||!d.test(n)){const s="Missing or invalid Sec-WebSocket-Key header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(o!==13&&o!==8){const s="Missing or invalid Sec-WebSocket-Version header";abortHandshakeOrEmitwsClientError(this,e,t,400,s,{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){abortHandshake(t,400);return}const f=e.headers["sec-websocket-protocol"];let h=new Set;if(f!==undefined){try{h=l.parse(f)}catch(s){const r="Invalid Sec-WebSocket-Protocol header";abortHandshakeOrEmitwsClientError(this,e,t,400,r);return}}const u=e.headers["sec-websocket-extensions"];const _={};if(this.options.perMessageDeflate&&u!==undefined){const s=new c(this.options.perMessageDeflate,true,this.options.maxPayload);try{const e=a.parse(u);if(e[c.extensionName]){s.accept(e[c.extensionName]);_[c.extensionName]=s}}catch(s){const r="Invalid or unacceptable Sec-WebSocket-Extensions header";abortHandshakeOrEmitwsClientError(this,e,t,400,r);return}}if(this.options.verifyClient){const i={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(i,((i,o,a,c)=>{if(!i){return abortHandshake(t,o||401,a,c)}this.completeUpgrade(_,n,h,e,t,s,r)}));return}if(!this.options.verifyClient(i))return abortHandshake(t,401)}this.completeUpgrade(_,n,h,e,t,s,r)}completeUpgrade(e,t,s,r,n,i,l){if(!n.readable||!n.writable)return n.destroy();if(n[u]){throw new Error("server.handleUpgrade() was called more than once with the same "+"socket, possibly due to a misconfiguration")}if(this._state>_)return abortHandshake(n,503);const f=o("sha1").update(t+h).digest("base64");const d=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${f}`];const p=new this.options.WebSocket(null,undefined,this.options);if(s.size){const e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;if(e){d.push(`Sec-WebSocket-Protocol: ${e}`);p._protocol=e}}if(e[c.extensionName]){const t=e[c.extensionName].params;const s=a.format({[c.extensionName]:[t]});d.push(`Sec-WebSocket-Extensions: ${s}`);p._extensions=e}this.emit("headers",d,r);n.write(d.concat("\r\n").join("\r\n"));n.removeListener("error",socketOnError);p.setSocket(n,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation});if(this.clients){this.clients.add(p);p.on("close",(()=>{this.clients.delete(p);if(this._shouldEmitClose&&!this.clients.size){process.nextTick(emitClose,this)}}))}l(p,r)}}e.exports=WebSocketServer;function addListeners(e,t){for(const s of Object.keys(t))e.on(s,t[s]);return function removeListeners(){for(const s of Object.keys(t)){e.removeListener(s,t[s])}}}function emitClose(e){e._state=m;e.emit("close")}function socketOnError(){this.destroy()}function abortHandshake(e,t,s,r){s=s||n.STATUS_CODES[t];r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r};e.once("finish",e.destroy);e.end(`HTTP/1.1 ${t} ${n.STATUS_CODES[t]}\r\n`+Object.keys(r).map((e=>`${e}: ${r[e]}`)).join("\r\n")+"\r\n\r\n"+s)}function abortHandshakeOrEmitwsClientError(e,t,s,r,n,i){if(e.listenerCount("wsClientError")){const r=new Error(n);Error.captureStackTrace(r,abortHandshakeOrEmitwsClientError);e.emit("wsClientError",r,s,t)}else{abortHandshake(s,r,n,i)}}},933:function(e,t,s){"use strict";const r=s(434);const n=s(692);const i=s(611);const o=s(278);const a=s(756);const{randomBytes:c,createHash:l}=s(982);const{Duplex:f,Readable:h}=s(203);const{URL:u}=s(16);const d=s(548);const _=s(761);const p=s(161);const{isBlob:m}=s(371);const{BINARY_TYPES:b,EMPTY_BUFFER:S,GUID:y,kForOnEventAttribute:k,kListener:g,kStatusCode:E,kWebSocket:w,NOOP:v}=s(899);const{EventTarget:{addEventListener:x,removeEventListener:O}}=s(350);const{format:C,parse:T}=s(579);const{toBuffer:L}=s(767);const N=30*1e3;const W=Symbol("kAborted");const P=[8,13];const B=["CONNECTING","OPEN","CLOSING","CLOSED"];const R=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class WebSocket extends r{constructor(e,t,s){super();this._binaryType=b[0];this._closeCode=1006;this._closeFrameReceived=false;this._closeFrameSent=false;this._closeMessage=S;this._closeTimer=null;this._errorEmitted=false;this._extensions={};this._paused=false;this._protocol="";this._readyState=WebSocket.CONNECTING;this._receiver=null;this._sender=null;this._socket=null;if(e!==null){this._bufferedAmount=0;this._isServer=false;this._redirects=0;if(t===undefined){t=[]}else if(!Array.isArray(t)){if(typeof t==="object"&&t!==null){s=t;t=[]}else{t=[t]}}initAsClient(this,e,t,s)}else{this._autoPong=s.autoPong;this._isServer=true}}get binaryType(){return this._binaryType}set binaryType(e){if(!b.includes(e))return;this._binaryType=e;if(this._receiver)this._receiver._binaryType=e}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,s){const r=new _({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});const n=new p(e,this._extensions,s.generateMask);this._receiver=r;this._sender=n;this._socket=e;r[w]=this;n[w]=this;e[w]=this;r.on("conclude",receiverOnConclude);r.on("drain",receiverOnDrain);r.on("error",receiverOnError);r.on("message",receiverOnMessage);r.on("ping",receiverOnPing);r.on("pong",receiverOnPong);n.onerror=senderOnError;if(e.setTimeout)e.setTimeout(0);if(e.setNoDelay)e.setNoDelay();if(t.length>0)e.unshift(t);e.on("close",socketOnClose);e.on("data",socketOnData);e.on("end",socketOnEnd);e.on("error",socketOnError);this._readyState=WebSocket.OPEN;this.emit("open")}emitClose(){if(!this._socket){this._readyState=WebSocket.CLOSED;this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[d.extensionName]){this._extensions[d.extensionName].cleanup()}this._receiver.removeAllListeners();this._readyState=WebSocket.CLOSED;this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState===WebSocket.CLOSED)return;if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";abortHandshake(this,this._req,e);return}if(this.readyState===WebSocket.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)){this._socket.end()}return}this._readyState=WebSocket.CLOSING;this._sender.close(e,t,!this._isServer,(e=>{if(e)return;this._closeFrameSent=true;if(this._closeFrameReceived||this._receiver._writableState.errorEmitted){this._socket.end()}}));setCloseTimer(this)}pause(){if(this.readyState===WebSocket.CONNECTING||this.readyState===WebSocket.CLOSED){return}this._paused=true;this._socket.pause()}ping(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof e==="function"){s=e;e=t=undefined}else if(typeof t==="function"){s=t;t=undefined}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}if(t===undefined)t=!this._isServer;this._sender.ping(e||S,t,s)}pong(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof e==="function"){s=e;e=t=undefined}else if(typeof t==="function"){s=t;t=undefined}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}if(t===undefined)t=!this._isServer;this._sender.pong(e||S,t,s)}resume(){if(this.readyState===WebSocket.CONNECTING||this.readyState===WebSocket.CLOSED){return}this._paused=false;if(!this._receiver._writableState.needDrain)this._socket.resume()}send(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof t==="function"){s=t;t={}}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}const r={binary:typeof e!=="string",mask:!this._isServer,compress:true,fin:true,...t};if(!this._extensions[d.extensionName]){r.compress=false}this._sender.send(e||S,r,s)}terminate(){if(this.readyState===WebSocket.CLOSED)return;if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";abortHandshake(this,this._req,e);return}if(this._socket){this._readyState=WebSocket.CLOSING;this._socket.destroy()}}}Object.defineProperty(WebSocket,"CONNECTING",{enumerable:true,value:B.indexOf("CONNECTING")});Object.defineProperty(WebSocket.prototype,"CONNECTING",{enumerable:true,value:B.indexOf("CONNECTING")});Object.defineProperty(WebSocket,"OPEN",{enumerable:true,value:B.indexOf("OPEN")});Object.defineProperty(WebSocket.prototype,"OPEN",{enumerable:true,value:B.indexOf("OPEN")});Object.defineProperty(WebSocket,"CLOSING",{enumerable:true,value:B.indexOf("CLOSING")});Object.defineProperty(WebSocket.prototype,"CLOSING",{enumerable:true,value:B.indexOf("CLOSING")});Object.defineProperty(WebSocket,"CLOSED",{enumerable:true,value:B.indexOf("CLOSED")});Object.defineProperty(WebSocket.prototype,"CLOSED",{enumerable:true,value:B.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(WebSocket.prototype,e,{enumerable:true})}));["open","error","close","message"].forEach((e=>{Object.defineProperty(WebSocket.prototype,`on${e}`,{enumerable:true,get(){for(const t of this.listeners(e)){if(t[k])return t[g]}return null},set(t){for(const t of this.listeners(e)){if(t[k]){this.removeListener(e,t);break}}if(typeof t!=="function")return;this.addEventListener(e,t,{[k]:true})}})}));WebSocket.prototype.addEventListener=x;WebSocket.prototype.removeEventListener=O;e.exports=WebSocket;function initAsClient(e,t,s,r){const o={allowSynchronousEvents:true,autoPong:true,protocolVersion:P[1],maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:true,followRedirects:false,maxRedirects:10,...r,socketPath:undefined,hostname:undefined,protocol:undefined,timeout:undefined,method:"GET",host:undefined,path:undefined,port:undefined};e._autoPong=o.autoPong;if(!P.includes(o.protocolVersion)){throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} `+`(supported versions: ${P.join(", ")})`)}let a;if(t instanceof u){a=t}else{try{a=new u(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}}if(a.protocol==="http:"){a.protocol="ws:"}else if(a.protocol==="https:"){a.protocol="wss:"}e._url=a.href;const f=a.protocol==="wss:";const h=a.protocol==="ws+unix:";let _;if(a.protocol!=="ws:"&&!f&&!h){_='The URL\'s protocol must be one of "ws:", "wss:", '+'"http:", "https:", or "ws+unix:"'}else if(h&&!a.pathname){_="The URL's pathname is empty"}else if(a.hash){_="The URL contains a fragment identifier"}if(_){const t=new SyntaxError(_);if(e._redirects===0){throw t}else{emitErrorAndClose(e,t);return}}const p=f?443:80;const m=c(16).toString("base64");const b=f?n.request:i.request;const S=new Set;let k;o.createConnection=o.createConnection||(f?tlsConnect:netConnect);o.defaultPort=o.defaultPort||p;o.port=a.port||p;o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname;o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket"};o.path=a.pathname+a.search;o.timeout=o.handshakeTimeout;if(o.perMessageDeflate){k=new d(o.perMessageDeflate!==true?o.perMessageDeflate:{},false,o.maxPayload);o.headers["Sec-WebSocket-Extensions"]=C({[d.extensionName]:k.offer()})}if(s.length){for(const e of s){if(typeof e!=="string"||!R.test(e)||S.has(e)){throw new SyntaxError("An invalid or duplicated subprotocol was specified")}S.add(e)}o.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(o.origin){if(o.protocolVersion<13){o.headers["Sec-WebSocket-Origin"]=o.origin}else{o.headers.Origin=o.origin}}if(a.username||a.password){o.auth=`${a.username}:${a.password}`}if(h){const e=o.path.split(":");o.socketPath=e[0];o.path=e[1]}let g;if(o.followRedirects){if(e._redirects===0){e._originalIpc=h;e._originalSecure=f;e._originalHostOrSocketPath=h?o.socketPath:a.host;const t=r&&r.headers;r={...r,headers:{}};if(t){for(const[e,s]of Object.entries(t)){r.headers[e.toLowerCase()]=s}}}else if(e.listenerCount("redirect")===0){const t=h?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:false:e._originalIpc?false:a.host===e._originalHostOrSocketPath;if(!t||e._originalSecure&&!f){delete o.headers.authorization;delete o.headers.cookie;if(!t)delete o.headers.host;o.auth=undefined}}if(o.auth&&!r.headers.authorization){r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")}g=e._req=b(o);if(e._redirects){e.emit("redirect",e.url,g)}}else{g=e._req=b(o)}if(o.timeout){g.on("timeout",(()=>{abortHandshake(e,g,"Opening handshake has timed out")}))}g.on("error",(t=>{if(g===null||g[W])return;g=e._req=null;emitErrorAndClose(e,t)}));g.on("response",(n=>{const i=n.headers.location;const a=n.statusCode;if(i&&o.followRedirects&&a>=300&&a<400){if(++e._redirects>o.maxRedirects){abortHandshake(e,g,"Maximum redirects exceeded");return}g.abort();let n;try{n=new u(i,t)}catch(t){const s=new SyntaxError(`Invalid URL: ${i}`);emitErrorAndClose(e,s);return}initAsClient(e,n,s,r)}else if(!e.emit("unexpected-response",g,n)){abortHandshake(e,g,`Unexpected server response: ${n.statusCode}`)}}));g.on("upgrade",((t,s,r)=>{e.emit("upgrade",t);if(e.readyState!==WebSocket.CONNECTING)return;g=e._req=null;const n=t.headers.upgrade;if(n===undefined||n.toLowerCase()!=="websocket"){abortHandshake(e,s,"Invalid Upgrade header");return}const i=l("sha1").update(m+y).digest("base64");if(t.headers["sec-websocket-accept"]!==i){abortHandshake(e,s,"Invalid Sec-WebSocket-Accept header");return}const a=t.headers["sec-websocket-protocol"];let c;if(a!==undefined){if(!S.size){c="Server sent a subprotocol but none was requested"}else if(!S.has(a)){c="Server sent an invalid subprotocol"}}else if(S.size){c="Server sent no subprotocol"}if(c){abortHandshake(e,s,c);return}if(a)e._protocol=a;const f=t.headers["sec-websocket-extensions"];if(f!==undefined){if(!k){const t="Server sent a Sec-WebSocket-Extensions header but no extension "+"was requested";abortHandshake(e,s,t);return}let t;try{t=T(f)}catch(t){const r="Invalid Sec-WebSocket-Extensions header";abortHandshake(e,s,r);return}const r=Object.keys(t);if(r.length!==1||r[0]!==d.extensionName){const t="Server indicated an extension that was not requested";abortHandshake(e,s,t);return}try{k.accept(t[d.extensionName])}catch(t){const r="Invalid Sec-WebSocket-Extensions header";abortHandshake(e,s,r);return}e._extensions[d.extensionName]=k}e.setSocket(s,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}));if(o.finishRequest){o.finishRequest(g,e)}else{g.end()}}function emitErrorAndClose(e,t){e._readyState=WebSocket.CLOSING;e._errorEmitted=true;e.emit("error",t);e.emitClose()}function netConnect(e){e.path=e.socketPath;return o.connect(e)}function tlsConnect(e){e.path=undefined;if(!e.servername&&e.servername!==""){e.servername=o.isIP(e.host)?"":e.host}return a.connect(e)}function abortHandshake(e,t,s){e._readyState=WebSocket.CLOSING;const r=new Error(s);Error.captureStackTrace(r,abortHandshake);if(t.setHeader){t[W]=true;t.abort();if(t.socket&&!t.socket.destroyed){t.socket.destroy()}process.nextTick(emitErrorAndClose,e,r)}else{t.destroy(r);t.once("error",e.emit.bind(e,"error"));t.once("close",e.emitClose.bind(e))}}function sendAfterClose(e,t,s){if(t){const s=m(t)?t.size:L(t).length;if(e._socket)e._sender._bufferedBytes+=s;else e._bufferedAmount+=s}if(s){const t=new Error(`WebSocket is not open: readyState ${e.readyState} `+`(${B[e.readyState]})`);process.nextTick(s,t)}}function receiverOnConclude(e,t){const s=this[w];s._closeFrameReceived=true;s._closeMessage=t;s._closeCode=e;if(s._socket[w]===undefined)return;s._socket.removeListener("data",socketOnData);process.nextTick(resume,s._socket);if(e===1005)s.close();else s.close(e,t)}function receiverOnDrain(){const e=this[w];if(!e.isPaused)e._socket.resume()}function receiverOnError(e){const t=this[w];if(t._socket[w]!==undefined){t._socket.removeListener("data",socketOnData);process.nextTick(resume,t._socket);t.close(e[E])}if(!t._errorEmitted){t._errorEmitted=true;t.emit("error",e)}}function receiverOnFinish(){this[w].emitClose()}function receiverOnMessage(e,t){this[w].emit("message",e,t)}function receiverOnPing(e){const t=this[w];if(t._autoPong)t.pong(e,!this._isServer,v);t.emit("ping",e)}function receiverOnPong(e){this[w].emit("pong",e)}function resume(e){e.resume()}function senderOnError(e){const t=this[w];if(t.readyState===WebSocket.CLOSED)return;if(t.readyState===WebSocket.OPEN){t._readyState=WebSocket.CLOSING;setCloseTimer(t)}this._socket.end();if(!t._errorEmitted){t._errorEmitted=true;t.emit("error",e)}}function setCloseTimer(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),N)}function socketOnClose(){const e=this[w];this.removeListener("close",socketOnClose);this.removeListener("data",socketOnData);this.removeListener("end",socketOnEnd);e._readyState=WebSocket.CLOSING;let t;if(!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&(t=e._socket.read())!==null){e._receiver.write(t)}e._receiver.end();this[w]=undefined;clearTimeout(e._closeTimer);if(e._receiver._writableState.finished||e._receiver._writableState.errorEmitted){e.emitClose()}else{e._receiver.on("error",receiverOnFinish);e._receiver.on("finish",receiverOnFinish)}}function socketOnData(e){if(!this[w]._receiver.write(e)){this.pause()}}function socketOnEnd(){const e=this[w];e._readyState=WebSocket.CLOSING;e._receiver.end();this.end()}function socketOnError(){const e=this[w];this.removeListener("error",socketOnError);this.on("error",v);if(e){e._readyState=WebSocket.CLOSING;this.destroy()}}},653:function(module){module.exports=eval("require")("bufferutil")},4:function(module){module.exports=eval("require")("utf-8-validate")},181:function(e){"use strict";e.exports=require("buffer")},982:function(e){"use strict";e.exports=require("crypto")},434:function(e){"use strict";e.exports=require("events")},611:function(e){"use strict";e.exports=require("http")},692:function(e){"use strict";e.exports=require("https")},278:function(e){"use strict";e.exports=require("net")},203:function(e){"use strict";e.exports=require("stream")},756:function(e){"use strict";e.exports=require("tls")},16:function(e){"use strict";e.exports=require("url")},106:function(e){"use strict";e.exports=require("zlib")}};var __webpack_module_cache__={};function __nccwpck_require__(e){var t=__webpack_module_cache__[e];if(t!==undefined){return t.exports}var s=__webpack_module_cache__[e]={exports:{}};var r=true;try{__webpack_modules__[e](s,s.exports,__nccwpck_require__);r=false}finally{if(r)delete __webpack_module_cache__[e]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__=__nccwpck_require__(110);module.exports=__webpack_exports__})();
|
|
@@ -494,6 +494,14 @@ function inflateOnData(chunk) {
|
|
|
494
494
|
this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH';
|
|
495
495
|
this[kError][kStatusCode] = 1009;
|
|
496
496
|
this.removeListener('data', inflateOnData);
|
|
497
|
+
|
|
498
|
+
//
|
|
499
|
+
// The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the
|
|
500
|
+
// fact that in Node.js versions prior to 13.10.0, the callback for
|
|
501
|
+
// `zlib.flush()` is not called if `zlib.close()` is used. Utilizing
|
|
502
|
+
// `zlib.reset()` ensures that either the callback is invoked or an error is
|
|
503
|
+
// emitted.
|
|
504
|
+
//
|
|
497
505
|
this.reset();
|
|
498
506
|
}
|
|
499
507
|
|
|
@@ -509,6 +517,12 @@ function inflateOnError(err) {
|
|
|
509
517
|
// closed when an error is emitted.
|
|
510
518
|
//
|
|
511
519
|
this[kPerMessageDeflate]._inflate = null;
|
|
520
|
+
|
|
521
|
+
if (this[kError]) {
|
|
522
|
+
this[kCallback](this[kError]);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
|
|
512
526
|
err[kStatusCode] = 1007;
|
|
513
527
|
this[kCallback](err);
|
|
514
528
|
}
|
|
@@ -256,9 +256,11 @@ class WebSocketServer extends EventEmitter {
|
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
if (version !==
|
|
259
|
+
if (version !== 13 && version !== 8) {
|
|
260
260
|
const message = 'Missing or invalid Sec-WebSocket-Version header';
|
|
261
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
261
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
262
|
+
'Sec-WebSocket-Version': '13, 8'
|
|
263
|
+
});
|
|
262
264
|
return;
|
|
263
265
|
}
|
|
264
266
|
|
|
@@ -526,15 +528,23 @@ function abortHandshake(socket, code, message, headers) {
|
|
|
526
528
|
* @param {Duplex} socket The socket of the upgrade request
|
|
527
529
|
* @param {Number} code The HTTP response status code
|
|
528
530
|
* @param {String} message The HTTP response body
|
|
531
|
+
* @param {Object} [headers] The HTTP response headers
|
|
529
532
|
* @private
|
|
530
533
|
*/
|
|
531
|
-
function abortHandshakeOrEmitwsClientError(
|
|
534
|
+
function abortHandshakeOrEmitwsClientError(
|
|
535
|
+
server,
|
|
536
|
+
req,
|
|
537
|
+
socket,
|
|
538
|
+
code,
|
|
539
|
+
message,
|
|
540
|
+
headers
|
|
541
|
+
) {
|
|
532
542
|
if (server.listenerCount('wsClientError')) {
|
|
533
543
|
const err = new Error(message);
|
|
534
544
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
535
545
|
|
|
536
546
|
server.emit('wsClientError', err, socket, req);
|
|
537
547
|
} else {
|
|
538
|
-
abortHandshake(socket, code, message);
|
|
548
|
+
abortHandshake(socket, code, message, headers);
|
|
539
549
|
}
|
|
540
550
|
}
|
|
@@ -708,7 +708,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
708
708
|
if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {
|
|
709
709
|
invalidUrlMessage =
|
|
710
710
|
'The URL\'s protocol must be one of "ws:", "wss:", ' +
|
|
711
|
-
'"http:", "https", or "ws+unix:"';
|
|
711
|
+
'"http:", "https:", or "ws+unix:"';
|
|
712
712
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
713
713
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
714
714
|
} else if (parsedUrl.hash) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ws","version":"8.18.
|
|
1
|
+
{"name":"ws","version":"8.18.3","description":"Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js","keywords":["HyBi","Push","RFC-6455","WebSocket","WebSockets","real-time"],"homepage":"https://github.com/websockets/ws","bugs":"https://github.com/websockets/ws/issues","repository":{"type":"git","url":"git+https://github.com/websockets/ws.git"},"author":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)","license":"MIT","main":"index.js","exports":{".":{"browser":"./browser.js","import":"./wrapper.mjs","require":"./index.js"},"./package.json":"./package.json"},"browser":"browser.js","engines":{"node":">=10.0.0"},"files":["browser.js","index.js","lib/*.js","wrapper.mjs"],"scripts":{"test":"nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js","integration":"mocha --throw-deprecation test/*.integration.js","lint":"eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""},"peerDependencies":{"bufferutil":"^4.0.1","utf-8-validate":">=5.0.2"},"peerDependenciesMeta":{"bufferutil":{"optional":true},"utf-8-validate":{"optional":true}},"devDependencies":{"benchmark":"^2.1.4","bufferutil":"^4.0.1","eslint":"^9.0.0","eslint-config-prettier":"^10.0.1","eslint-plugin-prettier":"^5.0.0","globals":"^16.0.0","mocha":"^8.4.0","nyc":"^15.0.0","prettier":"^3.0.0","utf-8-validate":"^6.0.0"},"_lastModified":"2025-08-03T23:10:48.516Z"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-message",
|
|
3
3
|
"displayName": "Message",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.24",
|
|
5
5
|
"description": "Send messages to users.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"System management"
|
|
@@ -13,20 +13,21 @@
|
|
|
13
13
|
"@alicloud/openapi-client": "0.4.15",
|
|
14
14
|
"@alicloud/tea-util": "1.4.9",
|
|
15
15
|
"@ant-design/icons": "^5.6.1",
|
|
16
|
-
"@tachybase/schema": "^1.3.
|
|
17
|
-
"@tachybase/test": "^1.3.
|
|
18
|
-
"@tego/client": "^1.3.
|
|
19
|
-
"@tego/server": "^1.3.
|
|
16
|
+
"@tachybase/schema": "^1.3.49",
|
|
17
|
+
"@tachybase/test": "^1.3.49",
|
|
18
|
+
"@tego/client": "^1.3.49",
|
|
19
|
+
"@tego/server": "^1.3.49",
|
|
20
20
|
"ahooks": "^3.9.0",
|
|
21
21
|
"antd": "5.22.5",
|
|
22
|
+
"dayjs": "^1.11.13",
|
|
22
23
|
"jsonwebtoken": "^8.5.1",
|
|
23
24
|
"lodash": "4.17.21",
|
|
24
25
|
"react-i18next": "15.2.0",
|
|
25
26
|
"react-router-dom": "6.28.1",
|
|
26
27
|
"tencentcloud-sdk-nodejs": "^4.0.996",
|
|
27
|
-
"ws": "^8.18.
|
|
28
|
-
"@tachybase/client": "1.3.
|
|
29
|
-
"@tachybase/module-workflow": "1.3.
|
|
28
|
+
"ws": "^8.18.3",
|
|
29
|
+
"@tachybase/client": "1.3.24",
|
|
30
|
+
"@tachybase/module-workflow": "1.3.24"
|
|
30
31
|
},
|
|
31
32
|
"description.zh-CN": "用于给用户发送消息",
|
|
32
33
|
"displayName.zh-CN": "消息通知",
|