appmax-client-vue3 5.2.0 → 5.3.0
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/AD-Ct_GVBfr-CaStLW_k.js +16 -0
- package/dist/AE-DiMVenwy-tCTBvWe6.js +16 -0
- package/dist/AF-DOrptOkS-BmkyHvvj.js +16 -0
- package/dist/AG-CzBMAtom-D-66qnRc.js +16 -0
- package/dist/AI-A2DnDGPS-Dg512PMR.js +16 -0
- package/dist/AL-BcGdPXjJ-Bse0WaNl.js +16 -0
- package/dist/AM-BC_r4gTd-CwLrLRNv.js +16 -0
- package/dist/AO-D6GK49nd-Co2jpv3h.js +16 -0
- package/dist/AQ-Eeziry42-FtHCrg2s.js +16 -0
- package/dist/AR-AbqVWszQ-CaGnmEsq.js +16 -0
- package/dist/AS-BWe_Gq8Z-Zhb2HXh0.js +16 -0
- package/dist/AT-b5CS9jSt-BqHe13jU.js +16 -0
- package/dist/AU-BUbOyX6Q-Cwz_khdC.js +16 -0
- package/dist/AW-CjVdJTYe-ZUsokcck.js +16 -0
- package/dist/AX-lNtwEmw2-Dy9QA5HY.js +16 -0
- package/dist/AZ-f8zSo9ut-CcitZSPQ.js +16 -0
- package/dist/AmBulletLegend-DstrWLHh.js +23 -0
- package/dist/AmCardV3-CvAuzYKv.js +22 -0
- package/dist/AmChip.vue_vue_type_script_setup_true_lang-DwJkCLRa-CdRQ3GS8.js +36 -0
- package/dist/AmDoughnutChartAdapted-QLoXpn7p.js +203 -0
- package/dist/AmEmptyState.vue_vue_type_script_setup_true_lang-DQUtvLdp.js +86 -0
- package/dist/AmFilterLevelDateSelect-BbVyzCa5-C9zkiCrI.js +40 -0
- package/dist/AmFilterLevelMultiSelectFilter-CPxxHU90-6Bal9nfk.js +46 -0
- package/dist/AmFilterLevelSelectFilter-Be3LFJno-DKALXaAC.js +63 -0
- package/dist/AmHelper.vue_vue_type_script_setup_true_lang-4vSpYa8P-BtpOAA4k.js +53 -0
- package/dist/AmLayoutFeedbackState-DgVo0rnP.js +48 -0
- package/dist/AmLayoutInnerData-IGTuxHhv.js +162 -0
- package/dist/AmModalV3-BSFquZzV.js +105 -0
- package/dist/AmOutlineCard-Bh8HAYte.js +25 -0
- package/dist/AmSkeleton-DX-AHvYt.js +35 -0
- package/dist/AmText-DuhStQJl.js +33 -0
- package/dist/AmTooltip.vue_vue_type_script_setup_true_lang-DvhTZs1v-CqeiBRES.js +64 -0
- package/dist/ApiService-B3jVHavv.js +11 -0
- package/dist/AppInstallationConfirmationPasswordModal-BOF-9KaG.js +535 -0
- package/dist/AppstoreAppView-B2BxH21R.js +315 -0
- package/dist/AppstoreHomeView-DjR3b3-J.js +1372 -0
- package/dist/BA-BfV7_7RP-BdL-YBIn.js +16 -0
- package/dist/BB-CC4768VM-DaL9pDMN.js +16 -0
- package/dist/BD-YQdTTbhg-BQyxu_9R.js +16 -0
- package/dist/BE-DUYoRyei-DpJQ3hHy.js +16 -0
- package/dist/BF-XZRLkaHX-C3qRHBUu.js +16 -0
- package/dist/BG-BAb8lAFP-63_NJKKy.js +16 -0
- package/dist/BH-C1LTB8Fj-D8uOJTUm.js +16 -0
- package/dist/BI-RjDfMipp-qNw1z0qs.js +16 -0
- package/dist/BJ-DAv61IMB-cvPel-Hp.js +16 -0
- package/dist/BL-CFW4iaQd-H-KSh3w4.js +16 -0
- package/dist/BM-DuK3dA1G-7cDLbFk6.js +16 -0
- package/dist/BN-BXHGopan-CoK5d1B-.js +16 -0
- package/dist/BO-CzuoErsx-BwuVGxDz.js +16 -0
- package/dist/BQ-BO-BlM1Uin3-Wp7h7_3_.js +16 -0
- package/dist/BQ-SA-BninfeHy-Dw0dplW0.js +16 -0
- package/dist/BQ-SE-tq-mCvpl-C7srOYC-.js +16 -0
- package/dist/BR-B1GEJ05L-BJ0PpIzF.js +16 -0
- package/dist/BS-MeULPH4e-D4IYZOTt.js +16 -0
- package/dist/BT-BCfQJS6a-BZkfMc1e.js +16 -0
- package/dist/BV-CfaYWvM--CG2OAdaE.js +16 -0
- package/dist/BW-jYbPMHhQ-CrYLVBMy.js +16 -0
- package/dist/BY-Ddffd2rT-h3e_T0Uk.js +16 -0
- package/dist/BZ-B7mGW2Jg-Cyx3A98h.js +16 -0
- package/dist/BankAccountCrossborderNew.page-z7cf0fZ-.js +152 -0
- package/dist/BankAccountList.page-Bb_-uvJo.js +331 -0
- package/dist/BankAccountNew.page-CYEg36AR.js +982 -0
- package/dist/CA-CHl-cqJL-Sopn-DxS.js +16 -0
- package/dist/CC-DSLZRwFz-CvnNDfSA.js +16 -0
- package/dist/CD-D4NJYkQm-tPDpXO_x.js +16 -0
- package/dist/CF-DoxRpaA9-DYz3x3QQ.js +16 -0
- package/dist/CG-Auzp6pC_-iEFNEAku.js +16 -0
- package/dist/CH-B5eEo1aL-VT_h1RLs.js +16 -0
- package/dist/CI-DFfmdeVw-BHQav5jU.js +16 -0
- package/dist/CK-CKWUhjXV-DpcbT2qQ.js +16 -0
- package/dist/CL-Di6p-p6X-Ceth7dQ5.js +16 -0
- package/dist/CM-B0ht31e3-DM2BO4iG.js +16 -0
- package/dist/CN-CKHlOciI-C79iDXKj.js +16 -0
- package/dist/CO-GBUkcePt-DYr9-6sc.js +16 -0
- package/dist/CR-Daw5JsjF-CAqSphgR.js +16 -0
- package/dist/CU-CVOkcTvR-CxlGsYxa.js +16 -0
- package/dist/CV-cyPoze-o-BuswS9gP.js +16 -0
- package/dist/CW-Bt-Pwg4j-ac61xZns.js +16 -0
- package/dist/CX-uhIZlYzy-DEb0ElOd.js +16 -0
- package/dist/CY-un4rgwPX-jmfQJBaR.js +16 -0
- package/dist/CZ-equ-r4iN-BVL3PxDO.js +16 -0
- package/dist/CashoutAntecipateContent-Cq-gMS19.js +42 -0
- package/dist/ChargebackAnalytics-DnSRAUko.js +1701 -0
- package/dist/ChargebackDetail-DWGlvfod.js +3469 -0
- package/dist/ChargebackRate-DxLt0toi.js +77 -0
- package/dist/ChatPlayground.page-Da2uFY-m.js +508 -0
- package/dist/ConfirmationModal-EylgN11q.js +105 -0
- package/dist/Create.page-CzW9XkZg.js +1390 -0
- package/dist/CreatePaymentLink-DJPu_ENI.js +856 -0
- package/dist/DE-zx7UmJ-V-GjA5JR8X.js +16 -0
- package/dist/DJ-BN1kIFYT-BtgGTOlG.js +16 -0
- package/dist/DK-CrXXNH_h-Hdv1p-Yl.js +16 -0
- package/dist/DM-B4nVdNww-WeIqwyT6.js +16 -0
- package/dist/DO-C7-NF2JD-DRx8vt5n.js +16 -0
- package/dist/DZ-DSDLbNRb-DMwoHVBX.js +16 -0
- package/dist/DashboardAmountDetailsContent-CQ-l97ge.js +65 -0
- package/dist/DashboardApprovalRateDetails.vue_vue_type_style_index_0_lang-Cwi-8ldS.js +151 -0
- package/dist/DashboardApprovalRateInternationalContent-RSoNAXpn.js +19 -0
- package/dist/DashboardApprovalRateNationalContent-TBbAp4mZ.js +74 -0
- package/dist/DashboardCarouselContent-BvbmOGny.js +958 -0
- package/dist/DashboardDetailsContent-D8qqE8NN.js +58 -0
- package/dist/DashboardHome-DcSd_sLw.js +4247 -0
- package/dist/DetailSubscriptionRecurring-Ck8BxMA0.js +1296 -0
- package/dist/EC-C_bjTYWm-YuMlndYO.js +16 -0
- package/dist/EE-CQIjuoWO-DhCi_TVZ.js +16 -0
- package/dist/EG-Bs_BHfVR-B388uNdK.js +16 -0
- package/dist/EH-CnWam84F-BKgLTrFQ.js +16 -0
- package/dist/ER-Dcl4hJzq-MUR_QObd.js +16 -0
- package/dist/ES-Bpj2gAdj-DWCeAQQm.js +16 -0
- package/dist/ET-Dm3q0Ruz-x0Ua9KYE.js +16 -0
- package/dist/ExternalPendenciesList-BW6TYzMr.js +651 -0
- package/dist/FI-DCqfJeiQ-BC1JCNYj.js +16 -0
- package/dist/FJ-C6UrGUgI-B4OIBFDT.js +16 -0
- package/dist/FK-CAaec31K-pnF7YgM5.js +16 -0
- package/dist/FM-Cf2SIJ7h-CkvupLPI.js +16 -0
- package/dist/FO-DBb4psBV-DzXasrMo.js +16 -0
- package/dist/FR-CFW4iaQd-WoFZn18c.js +16 -0
- package/dist/FeatureFlagsPage-CYg6J-vI.js +271 -0
- package/dist/GA-D3NTxgTl-Ce12c-Gh.js +16 -0
- package/dist/GB-ENG-Cmkg6Zq8-D-7RcnKp.js +16 -0
- package/dist/GB-NIR-DKszcfHi-DcJN3tpX.js +16 -0
- package/dist/GB-SCT-BiivwJ71-mmaRyYhm.js +16 -0
- package/dist/GB-UKM-DgMBd3ib-DwcwUE2k.js +16 -0
- package/dist/GB-WLS-DLoDy9iv-B8gkEuyr.js +16 -0
- package/dist/GD-Bs1d4We7-C69NY5nw.js +16 -0
- package/dist/GE-DXG9iLk5-SM2PP-gD.js +16 -0
- package/dist/GF-B20s5gtx-tr9ACYwX.js +16 -0
- package/dist/GG-BAyrpIoO-DSP4ZOie.js +16 -0
- package/dist/GH-v3jh5r1X-CRHQ3Ma2.js +16 -0
- package/dist/GI-D39Krd4s-C9JThhoK.js +16 -0
- package/dist/GL-BDd_W5AU-CQSMqKk5.js +16 -0
- package/dist/GM-BNEHspzj-Qkzz8Yu-.js +16 -0
- package/dist/GN-DdIZ0X6d-BBodEZ-s.js +16 -0
- package/dist/GP-CFW4iaQd-CHmgkd4I.js +16 -0
- package/dist/GQ-CC3X6AMz-uos6zBOY.js +16 -0
- package/dist/GR-C_0rusTd-DZiAPLMj.js +16 -0
- package/dist/GS-Db5l22a1-DssKbveE.js +16 -0
- package/dist/GT-BhbkqUft-xAecItKL.js +16 -0
- package/dist/GU-C0HeItm1-BzjoGZgQ.js +16 -0
- package/dist/GW-BjLM1vg--CdxD8wcr.js +16 -0
- package/dist/GY-BreBVlhN-CaJvoDCO.js +16 -0
- package/dist/HK-BZn9ZQGS-C457d4F2.js +16 -0
- package/dist/HM-BUbOyX6Q-CLBk1jj_.js +16 -0
- package/dist/HN-D4wujIPC-ByFwLuyN.js +16 -0
- package/dist/HR-Jhi3QQ9F-R0Q9G7Dl.js +16 -0
- package/dist/HT-MMjMjr-R-DJqczBfG.js +16 -0
- package/dist/HU-CN5KmQ7F-BMSoySu7.js +16 -0
- package/dist/Home-D301DiRv.js +997 -0
- package/dist/ID-hVVUTKNG-NMgRTTKz.js +16 -0
- package/dist/IE-WN_vdKcS-CI2md1tn.js +16 -0
- package/dist/IL-D5Wr_Xxh-BS72ISQt.js +16 -0
- package/dist/IM-B-putc0k-BfQmY1DJ.js +16 -0
- package/dist/IN-CK40zbQD-DwVA29nH.js +16 -0
- package/dist/IO-CdvLck7D-Bl3C2KQX.js +16 -0
- package/dist/IQ-f_9wyurt-DOHVQFYp.js +16 -0
- package/dist/IR-B0yfWttH-CZr45QN8.js +16 -0
- package/dist/IS-Dvf-XQTq-0Znat9Zb.js +16 -0
- package/dist/IT-uY7cjdFI-Dcbr_e74.js +16 -0
- package/dist/ImportTrackingCode-DAlmud1r.js +1007 -0
- package/dist/InternalCompanyIssuesDetail-Su4iQ5m2.js +862 -0
- package/dist/InternalCompanyList-CScqADt6.js +351 -0
- package/dist/InternalPendencyDetail-DCbf9LQg.js +717 -0
- package/dist/JE-C95tN_VG-B5Xj8jgS.js +16 -0
- package/dist/JM-zOuEwaB3-DiuBUb9s.js +16 -0
- package/dist/JO-Cq88rrOD-DP8iQAIr.js +16 -0
- package/dist/JP-5evXgWxq-CgEKt8gb.js +16 -0
- package/dist/KE-PHx0d97Z-DSWNNmho.js +16 -0
- package/dist/KG-DT4JnieX-Dbeh3ZZI.js +16 -0
- package/dist/KH-ChwV2WTT-B4Y3-iZC.js +16 -0
- package/dist/KI-D212g4Lh-w_20L0YH.js +16 -0
- package/dist/KM-mPVp7AKS-BHby2dxn.js +16 -0
- package/dist/KN-AdXLXICN-BiGASaOj.js +16 -0
- package/dist/KP-CC6UIrEF-CP20ieVp.js +16 -0
- package/dist/KR-BtnmWR6C-C0dDL6Ve.js +16 -0
- package/dist/KW-gqahWVaw-BqhJm4OD.js +16 -0
- package/dist/KY-DjIb70VQ-Bncija55.js +16 -0
- package/dist/KZ-C_fRihiO-Cbn-kjVJ.js +16 -0
- package/dist/LA-KIULJHAb-fTYBTK5g.js +16 -0
- package/dist/LB-CrF8WJiI-DI7H-r3S.js +16 -0
- package/dist/LC-DGiHXm5V-DNEX3-3Y.js +16 -0
- package/dist/LI-BwB0b8M1-hrCqoKtE.js +16 -0
- package/dist/LK-BOC44ZgS-BH-XfQ_1.js +16 -0
- package/dist/LR-CWjRlWOZ-XxlG4mc2.js +16 -0
- package/dist/LS-B_EgU3p5-CgkfriyJ.js +16 -0
- package/dist/LT-BPyPiVx2-DaCLvoE_.js +16 -0
- package/dist/LU-B-De6aB--CckczOJE.js +16 -0
- package/dist/LV-D2Ewe3XC-DDPD_q1q.js +16 -0
- package/dist/LY-D1TSt6YI-9XTFLfBg.js +16 -0
- package/dist/MA-QY5gm-vM-C_l3Y1N8.js +16 -0
- package/dist/MC-BjlCjfCP-BeOUJYdd.js +16 -0
- package/dist/MD-rh-6rlSt-CVl8QTAX.js +16 -0
- package/dist/ME-D1euo0V2-BzJAg76l.js +16 -0
- package/dist/MF-CFW4iaQd-Dr98U_U5.js +16 -0
- package/dist/MG-ONnxn_5g-BfvgFZZ9.js +16 -0
- package/dist/MH-B8oC_VMS-U-nkoPu-.js +16 -0
- package/dist/MK-ByjICisj-N4uaO5oy.js +16 -0
- package/dist/ML-CKVAuhox-BM6xmuIc.js +16 -0
- package/dist/MM-doJuUjVT-C_JmyN5w.js +16 -0
- package/dist/MN-BFP303GE-C1rvBqSP.js +16 -0
- package/dist/MO-Dp4PTSYU-kyR7HBDr.js +16 -0
- package/dist/MP-CqKsnjHV-DBeLVhCr.js +16 -0
- package/dist/MQ-CFW4iaQd-BBzNZCzM.js +16 -0
- package/dist/MR-D73q_PiY-Dr9a8pXj.js +16 -0
- package/dist/MS-qhjKl9TO-dxLlZb6H.js +16 -0
- package/dist/MT-CZjbs1U--B8L8tsvP.js +16 -0
- package/dist/MU-D0EQOl0S-BEKNB4G5.js +16 -0
- package/dist/MV-BtwHRTMn-DSYCHyEu.js +16 -0
- package/dist/MW-CVnAR98j-CsZvY0fT.js +16 -0
- package/dist/MX-C7vXnCDY-68nUrmm-.js +16 -0
- package/dist/MY-DJcgH_o3-Rz7Flv8G.js +16 -0
- package/dist/MZ-BbLwl9DA-DD-QupDU.js +16 -0
- package/dist/Max.page-BMYP80uT.js +599 -0
- package/dist/MostSoldCountries-BjhcmqGq.js +22 -0
- package/dist/NA-5FKNjRGT-CAA1_Hgu.js +16 -0
- package/dist/NC-CFW4iaQd-DVUQLoua.js +16 -0
- package/dist/NE-DpLZJa7D-mzZy_4Or.js +16 -0
- package/dist/NF-BT-wIfwf-DPC24K_6.js +16 -0
- package/dist/NG-BAiR_q0H-B9RQy7ar.js +16 -0
- package/dist/NI-DylPDojG-CsBZH5SV.js +16 -0
- package/dist/NL-iozeFKPM-BwxBNUBx.js +16 -0
- package/dist/NO-CfaYWvM--BhWTKjt4.js +16 -0
- package/dist/NP-BGR_ZaqA-BVQ13apt.js +16 -0
- package/dist/NR-DHGW5Y3Q-C1RwTnYY.js +16 -0
- package/dist/NU-CcpcSx_x-DjIqYrh_.js +16 -0
- package/dist/NZ-DDYt6DcJ-BTbrY2Lw.js +16 -0
- package/dist/OM-D6hiar1r-DSeIRb1R.js +16 -0
- package/dist/OrderStatus.vue_vue_type_script_setup_true_lang-DXUW8AdF.js +760 -0
- package/dist/OrderStatusChip-I8Ovjofk.js +30 -0
- package/dist/Orders.page-CT1ereGs.js +1636 -0
- package/dist/OrdersChartDataContent-P9ZwDFSk.js +221 -0
- package/dist/OrdersDetails.page-adhYTD6K.js +6158 -0
- package/dist/PA-Bi2blxjJ-Qw1aRIPv.js +16 -0
- package/dist/PE-D4DjQOlP-CTKuYHjF.js +16 -0
- package/dist/PF-DmOSfnYB-BWo8KA4y.js +16 -0
- package/dist/PG-DeOlZ7TA-BWZs4i0n.js +16 -0
- package/dist/PH-Dv4KdxU--nXdLeWuM.js +16 -0
- package/dist/PK-CRhM95F8-BhHcfiV_.js +16 -0
- package/dist/PL-BIdMQAtx-DNUOP-2d.js +16 -0
- package/dist/PM-BDa53dEz-d07qnvHW.js +16 -0
- package/dist/PN-Csu7Dufn-CTIyXohB.js +16 -0
- package/dist/PR-C_Acdbc_-DhGl5oJn.js +16 -0
- package/dist/PS-Dmg0ofZr-COK3SHRG.js +16 -0
- package/dist/PT-Bsck4nv8-DQoPwGd3.js +16 -0
- package/dist/PW-CBMqjpxh-rSYk8aO5.js +16 -0
- package/dist/PY-Be6zNh15-D1X8WUB5.js +16 -0
- package/dist/PaymentsLinks-CFPKROvV.js +675 -0
- package/dist/QA-CZmcW85r-C1Gb5K9z.js +16 -0
- package/dist/RE-CFW4iaQd-rwFpznHW.js +16 -0
- package/dist/RO-6H4O-gQF-DJvJibiK.js +16 -0
- package/dist/RS-DM7vMnHL-CBuTT3rz.js +16 -0
- package/dist/RU-HqKQeTq2-Dizu2SMe.js +16 -0
- package/dist/RW-DkH4VhfP-CWbS-vET.js +16 -0
- package/dist/RecurringSubscription-BEx2B2XE.js +548 -0
- package/dist/RecurringSubscriptionDashView-atocoByq.js +2012 -0
- package/dist/RiskPendenciesInternalService-BBHWbN4-.js +145 -0
- package/dist/SA-C2hBi4Lh-DCL5aN5-.js +16 -0
- package/dist/SB-CBu9QLGP-D9B9wKmz.js +16 -0
- package/dist/SC-CR6esM-V-fqCr3Jyq.js +16 -0
- package/dist/SD-VCXqBHrW-DDbZT37n.js +16 -0
- package/dist/SE-DbI0jJm9-DVcivSZO.js +16 -0
- package/dist/SG-DgprfMyV-BDUWsq4l.js +16 -0
- package/dist/SH-qhjKl9TO-Bl8en86i.js +16 -0
- package/dist/SI-C3dA03Yk-D2WHErHA.js +16 -0
- package/dist/SJ-CfaYWvM--Bp_NKPBl.js +16 -0
- package/dist/SK-CxbHN7aU-DKQ4qHfX.js +16 -0
- package/dist/SL-GXAaRXng-GwmYhJ0s.js +16 -0
- package/dist/SM-B2SteTdO-C6b_vY_6.js +16 -0
- package/dist/SN-B7Q__Lx_-BYvzYfWV.js +16 -0
- package/dist/SO-Bnd5-U9z-DQ_F_pTO.js +16 -0
- package/dist/SR-BHMDOkL2-Dn-I0CT7.js +16 -0
- package/dist/SS-CsTgWca1-f3OCNgII.js +16 -0
- package/dist/ST-DLqO0boT-CeWK06Yf.js +16 -0
- package/dist/SV-DNZizmQg-CSb_YEih.js +16 -0
- package/dist/SX-DWuXjLwS-dVwG2yoU.js +16 -0
- package/dist/SY-DeOQEBum-CJVsRgU4.js +16 -0
- package/dist/SZ-Bhe0qU5K-DTkQDbeD.js +16 -0
- package/dist/SalesRecovery-BuIzJn-h.js +594 -0
- package/dist/SalesRecoveryIA-Cuu3Xg9q.js +199 -0
- package/dist/SendCustomerRefundLinkPage-Bi56887G.js +137 -0
- package/dist/StatusDescriptionModal-CEN31dzB.js +60 -0
- package/dist/StatusTag.vue_vue_type_script_setup_true_lang-C8bGbrfT.js +28 -0
- package/dist/TC-D5HTaKiF-BYhsLbxl.js +16 -0
- package/dist/TD-DyIWvaGg-Ci4tDDuh.js +16 -0
- package/dist/TF-BRsv64iE-B5ScBl27.js +16 -0
- package/dist/TG-OhNa5jmt-C4ovC_x-.js +16 -0
- package/dist/TH-F_ODV0JW-BnPh3pSL.js +16 -0
- package/dist/TJ-BFkbbSmN-CMoMFPPY.js +16 -0
- package/dist/TK-Ct75yy7V-DsK9v85a.js +16 -0
- package/dist/TL-BzqVkHGw-Dd_V6o1b.js +16 -0
- package/dist/TM-CCAvd8qV-BE2w-MAc.js +16 -0
- package/dist/TN-CmYqbPEz-DwfQDWGH.js +16 -0
- package/dist/TO-BQQk9Xq_-Dql8D3aJ.js +16 -0
- package/dist/TR-_MKkCnUV-DZHmDVjb.js +16 -0
- package/dist/TT-DoRURl1c-Zqwc-0uX.js +16 -0
- package/dist/TV-Dt8uZCP4-CFOSZisa.js +16 -0
- package/dist/TW-CvHugvex-Bh47syym.js +16 -0
- package/dist/TZ-RbwBgiwb-rZG2FPOp.js +16 -0
- package/dist/TopSellingProductsContent-BE475tEv.js +80 -0
- package/dist/UA-BiXHPMqV-BAkCMh9p.js +16 -0
- package/dist/UG--it_LhSj-CIGgbAm6.js +16 -0
- package/dist/UM-BFcTdeDD-DnP9wCfe.js +16 -0
- package/dist/US-BFcTdeDD-DnP9wCfe.js +16 -0
- package/dist/UY-C26Ndi4P-CbGycLdL.js +16 -0
- package/dist/UZ-BK5ADwFW-iI0GFQKg.js +16 -0
- package/dist/UserIndicationsPage-Cc8PG2O-.js +723 -0
- package/dist/VA-Cpq1n4yW-r-enLBDw.js +16 -0
- package/dist/VC-D1Fjbog5-B64uuAFf.js +16 -0
- package/dist/VE-CeM-hea7-BerEIOab.js +16 -0
- package/dist/VG-qhjKl9TO-CV1YKc5Z.js +16 -0
- package/dist/VI-C-kcu42_-B82uqBQt.js +16 -0
- package/dist/VN-2yoryeK1-CUe-vfY5.js +16 -0
- package/dist/VU-CkLlsgzP-DKzGi2NO.js +16 -0
- package/dist/WF-BDa53dEz-C__M9f1z.js +16 -0
- package/dist/WS-CNi2O6Qm-BJ5CRXiK.js +16 -0
- package/dist/WithdrawAdvance-BCY0rX5F.js +17 -0
- package/dist/WithdrawBankAccountStore-BsaoATPX.js +283 -0
- package/dist/WithdrawBlocked-uZne9iC2.js +133 -0
- package/dist/WithdrawCompanyStore-DSIZaZtK.js +80 -0
- package/dist/WithdrawGuaranteeExtract-JtGsMnyI.js +994 -0
- package/dist/WithdrawHome-CBV7fYyi.js +2448 -0
- package/dist/WithdrawHome-CIWM1hhk.js +1843 -0
- package/dist/WithdrawInternational-YL9Juj5y.js +17 -0
- package/dist/WithdrawMaxStore-DWRS9twI.js +772 -0
- package/dist/WithdrawNegativeCompany.vue_vue_type_script_setup_true_lang-DsBRkO3V.js +530 -0
- package/dist/WithdrawNoAccountWarning-C8BguS5P.js +233 -0
- package/dist/WithdrawPermissionGuard-BxOUmo1a.js +338 -0
- package/dist/WithdrawRequest-C-fVrk1K.js +944 -0
- package/dist/WithdrawRequest-DDIdDgj3.js +17 -0
- package/dist/WithdrawRequestDetail-Cx_wfzoO.js +284 -0
- package/dist/WithdrawRequestLayout.vue_vue_type_script_setup_true_lang-CI0njJiS.js +936 -0
- package/dist/YE-DxPZysMs-3mNmsFUd.js +16 -0
- package/dist/YT-BMJJ1U_T-nkoVJpQy.js +16 -0
- package/dist/ZA-BjQXS8mc-DGVz4X6v.js +16 -0
- package/dist/ZM-Dw0PmMTO-D6TOtwai.js +16 -0
- package/dist/ZW-D0UStZMr-C2clkAxs.js +16 -0
- package/dist/affiliate-Bgt9fadK-DfFhWGPV.js +22 -0
- package/dist/amex-CvNwRHhS-DCjNeDxN.js +16 -0
- package/dist/api-BxbRn45X.js +11 -0
- package/dist/apple_pay-DtsAzVjF-dnQnjBbc.js +20 -0
- package/dist/archive-CFoPOir7-CzMKAOQU.js +18 -0
- package/dist/aura-D1VyKb6w-Bp5DPiqn.js +23 -0
- package/dist/boleto-BQZRi0Q5-BuL3qQcM.js +18 -0
- package/dist/box-DNrK38w2-2wYKsV2K.js +20 -0
- package/dist/cart-p5jccB8o-B39MikQX.js +15 -0
- package/dist/cash-FZcelZV1-bad0tlFO.js +20 -0
- package/dist/chart-YJ27XOr3-BNpTQG41.js +22 -0
- package/dist/chat.page-rqBTjKL8.js +424 -0
- package/dist/credit_card-CGrPYCJP-BkQ1N-Ne.js +15 -0
- package/dist/csv-CYa6aPS5-DwXPZNzo.js +18 -0
- package/dist/dayjs.min-Dbcbl_Kc.js +282 -0
- package/dist/diners-CN_1suUM-CljVbeo-.js +26 -0
- package/dist/discover-vVTOFEvv-e8508vu7.js +22 -0
- package/dist/ds-appmax-v322-CytdpjPz.js +52 -0
- package/dist/ds-appmax-v327-CvnIjV6A.js +69 -0
- package/dist/ds-appmax-v330-C0uO9nF3.js +48 -0
- package/dist/ds-appmax-v335-QfNLVACK.js +278 -0
- package/dist/elo-BaNbqhYS-Djn2c-2s.js +15 -0
- package/dist/gear-BHOWpd7b-BBHum57T.js +18 -0
- package/dist/grid-B7I0mWry-BcnIfla2.js +18 -0
- package/dist/hipercard-DBsszwxC-X7ss0HjX.js +22 -0
- package/dist/index-B-PM3l6N.js +21 -0
- package/dist/index-BE295cOU.js +1204 -0
- package/dist/index-BW2oS8WN.js +21 -0
- package/dist/index-BeFonkDD.js +35 -0
- package/dist/index-Bp5qyvnE.js +83 -0
- package/dist/index-BpUuFotl.js +219 -0
- package/dist/index-BvAQmXZP.js +776 -0
- package/dist/index-CGekfbUR.js +217 -0
- package/dist/index-CSKAyAVf.js +1790 -0
- package/dist/index-CaVBT9Ak.js +275 -0
- package/dist/index-Cb0-K19b.js +681 -0
- package/dist/index-CpYBypmE.js +62 -0
- package/dist/index-D3MzM8KL.js +169 -0
- package/dist/index-D657cl8P.js +534 -0
- package/dist/index-D7yHZETo.js +409 -0
- package/dist/index-DKtXOlMC.js +117 -0
- package/dist/index-DOMGbnWd.js +92 -0
- package/dist/index-DW7Uy9lQ.js +1567 -0
- package/dist/index-DX86NWJM.js +200 -0
- package/dist/index-DZOFps7n.js +721 -0
- package/dist/index-DdlEDiGn.js +4133 -0
- package/dist/index-DiNMjeFz.js +11 -0
- package/dist/index-Difu87AE.js +67 -0
- package/dist/index-Dpeb_nR8.js +106 -0
- package/dist/index-Dqri1A-W.js +219 -0
- package/dist/index-DziJ4EWw.js +11240 -0
- package/dist/index-c1F4Whl4.js +332 -0
- package/dist/index-l1nHicUF.js +18 -0
- package/dist/index-uo8pXrXD.js +230 -0
- package/dist/index.page-BVhmKT0x.js +737 -0
- package/dist/index.page-T-g3q-3y.js +827 -0
- package/dist/index.page-kyUveHrU.js +165 -0
- package/dist/infos-8KGPLXoE-DETDfcOj.js +18 -0
- package/dist/integrations-UOltVEyj-D3b11_Dy.js +19 -0
- package/dist/logs-Ce3fZY0v-1saXbpV4.js +28 -0
- package/dist/maestro-BMomgHxO-Cn-KdK8u.js +27 -0
- package/dist/main-CJqq8LV_.js +106860 -0
- package/dist/main.js +1 -1
- package/dist/mastercard-5I-dcOVV-SVeECO9Z.js +30 -0
- package/dist/max_brand-Crj-SFUw-pdUkLtNn.js +29 -0
- package/dist/max_brand_active-BIkS5qkP-B8nADOMv.js +27 -0
- package/dist/max_brand_negative-BxvdIegN-B2T8V0sP.js +30 -0
- package/dist/max_brand_white-DdKi2YVX-B9c-Ke0i.js +29 -0
- package/dist/menu.page-Bb-361wx.js +274 -0
- package/dist/money-DZpB5eTf-8B_Ym89Z.js +19 -0
- package/dist/notification-DMezLtAj-DzfHWtsY.js +18 -0
- package/dist/paypal-DMYjfEw0-CoDp9MaS.js +15 -0
- package/dist/pix-DXdX91yj-BlHT604u.js +22 -0
- package/dist/pix_outline-D_xXXgCN-ChvjdFG9.js +16 -0
- package/dist/pix_white-CcVsnEF2-C-tHR6Ug.js +24 -0
- package/dist/pusher-BeXZm-KF.js +4010 -0
- package/dist/shield-DS-Xf4WH-Cvzgo1bU.js +15 -0
- package/dist/solid_help-DNaqfgoc-q4g44ePe.js +20 -0
- package/dist/solid_home-BDUiJDVY-CMjtmsil.js +18 -0
- package/dist/solid_leaderboard-DtqK7q9Y-55ihqI9p.js +18 -0
- package/dist/solid_store-Cfv6o4b8-BsKmNGdP.js +18 -0
- package/dist/ticket_icon-DwvyLm7c-iv7Jadui.js +22 -0
- package/dist/usePendingMessage-CMe39stE.js +191 -0
- package/dist/useQueryFilter-CWrCnTci.js +93 -0
- package/dist/useRecurringTable-bBcF6Br_.js +160 -0
- package/dist/user-BRpwqYx8-BIYr3X--.js +18 -0
- package/dist/validateURL.helper-BNTy-ybB.js +126 -0
- package/dist/visa-tPjWcMbi-DSzJKiVY.js +18 -0
- package/package.json +1 -1
- package/dist/AD-Ct_GVBfr-StkZNwKG.js +0 -16
- package/dist/AE-DiMVenwy-DxJiXpGV.js +0 -16
- package/dist/AF-DOrptOkS-XegbzW-w.js +0 -16
- package/dist/AG-CzBMAtom-3SnT-5Uu.js +0 -16
- package/dist/AI-A2DnDGPS-CRjXjwoJ.js +0 -16
- package/dist/AL-BcGdPXjJ-a6zDxVMc.js +0 -16
- package/dist/AM-BC_r4gTd-D4MMWySB.js +0 -16
- package/dist/AO-D6GK49nd-CRMJFOm-.js +0 -16
- package/dist/AQ-Eeziry42-iwkWssf1.js +0 -16
- package/dist/AR-AbqVWszQ-BLrhhG4H.js +0 -16
- package/dist/AS-BWe_Gq8Z-CGYxjZdZ.js +0 -16
- package/dist/AT-b5CS9jSt-jCk4CN1Q.js +0 -16
- package/dist/AU-BUbOyX6Q-_oWZ4t5s.js +0 -16
- package/dist/AW-CjVdJTYe-BUkLY2f-.js +0 -16
- package/dist/AX-lNtwEmw2-Dyvu77aH.js +0 -16
- package/dist/AZ-f8zSo9ut-08cW-_Ne.js +0 -16
- package/dist/AmBulletLegend-TLfX-igU.js +0 -23
- package/dist/AmCardV3-Lq-pDk8I.js +0 -22
- package/dist/AmChip.vue_vue_type_script_setup_true_lang-DwJkCLRa-CWW7FYuq.js +0 -36
- package/dist/AmDoughnutChartAdapted-Sc1PXFRp.js +0 -203
- package/dist/AmEmptyState.vue_vue_type_script_setup_true_lang-CK5ScPbD.js +0 -86
- package/dist/AmFilterLevelDateSelect-BbVyzCa5-DhLqJYa3.js +0 -40
- package/dist/AmFilterLevelMultiSelectFilter-CPxxHU90-n7ZDlDFc.js +0 -46
- package/dist/AmFilterLevelSelectFilter-Be3LFJno-CSgyEEl4.js +0 -63
- package/dist/AmHelper.vue_vue_type_script_setup_true_lang-4vSpYa8P-eMwsOwkH.js +0 -53
- package/dist/AmLayoutFeedbackState-Dmk2iK7m.js +0 -48
- package/dist/AmLayoutInnerData-jknggN9g.js +0 -162
- package/dist/AmModalV3-SnC7z-f1.js +0 -105
- package/dist/AmOutlineCard-TsZMM0uk.js +0 -25
- package/dist/AmSkeleton-CvModGAs.js +0 -35
- package/dist/AmText-Ix8DK3Xq.js +0 -33
- package/dist/AmTooltip.vue_vue_type_script_setup_true_lang-DvhTZs1v-CudRZsqY.js +0 -64
- package/dist/ApiService-DRzbmsKC.js +0 -11
- package/dist/AppInstallationConfirmationPasswordModal-J4K4jdAF.js +0 -535
- package/dist/AppstoreAppView-CiuQGC__.js +0 -315
- package/dist/AppstoreHomeView-BVTYPaA7.js +0 -1372
- package/dist/BA-BfV7_7RP-BmWvA7Az.js +0 -16
- package/dist/BB-CC4768VM-BrSXHBwy.js +0 -16
- package/dist/BD-YQdTTbhg-CsC8onAg.js +0 -16
- package/dist/BE-DUYoRyei-Cir1ALU_.js +0 -16
- package/dist/BF-XZRLkaHX-DjkqOK_I.js +0 -16
- package/dist/BG-BAb8lAFP-iIReheFM.js +0 -16
- package/dist/BH-C1LTB8Fj-C7u05hot.js +0 -16
- package/dist/BI-RjDfMipp-B6ky4VmW.js +0 -16
- package/dist/BJ-DAv61IMB-CZQvrwne.js +0 -16
- package/dist/BL-CFW4iaQd-vZjnKF5I.js +0 -16
- package/dist/BM-DuK3dA1G-CoDTQ8M1.js +0 -16
- package/dist/BN-BXHGopan-BsZXW4-r.js +0 -16
- package/dist/BO-CzuoErsx-Bp8LCvZk.js +0 -16
- package/dist/BQ-BO-BlM1Uin3-BH3lwALm.js +0 -16
- package/dist/BQ-SA-BninfeHy-5BXY4Pjt.js +0 -16
- package/dist/BQ-SE-tq-mCvpl-D2PYuSfE.js +0 -16
- package/dist/BR-B1GEJ05L-R3viz22_.js +0 -16
- package/dist/BS-MeULPH4e-CtTP5gDM.js +0 -16
- package/dist/BT-BCfQJS6a-DX6wGh8L.js +0 -16
- package/dist/BV-CfaYWvM--DBvI1GXv.js +0 -16
- package/dist/BW-jYbPMHhQ-DY6P1xlK.js +0 -16
- package/dist/BY-Ddffd2rT-COy4OMfV.js +0 -16
- package/dist/BZ-B7mGW2Jg-DaMlt_nO.js +0 -16
- package/dist/BankAccountCrossborderNew.page-DUwRE4gI.js +0 -152
- package/dist/BankAccountList.page-BSDHYGub.js +0 -331
- package/dist/BankAccountNew.page-C21O0_jS.js +0 -982
- package/dist/CA-CHl-cqJL-BtpvOOcu.js +0 -16
- package/dist/CC-DSLZRwFz-DDnxA_BE.js +0 -16
- package/dist/CD-D4NJYkQm-DQ6messd.js +0 -16
- package/dist/CF-DoxRpaA9-BTYIt_Vx.js +0 -16
- package/dist/CG-Auzp6pC_-BhNbuOmx.js +0 -16
- package/dist/CH-B5eEo1aL-5DHkWvgz.js +0 -16
- package/dist/CI-DFfmdeVw-jXEKQCoa.js +0 -16
- package/dist/CK-CKWUhjXV-DpYhyfzy.js +0 -16
- package/dist/CL-Di6p-p6X-CS-iO5wu.js +0 -16
- package/dist/CM-B0ht31e3-C_nJbzMB.js +0 -16
- package/dist/CN-CKHlOciI-KVe2Eb8p.js +0 -16
- package/dist/CO-GBUkcePt-T2c6qTQs.js +0 -16
- package/dist/CR-Daw5JsjF-CxEK9f-r.js +0 -16
- package/dist/CU-CVOkcTvR-Ch6PPqDZ.js +0 -16
- package/dist/CV-cyPoze-o-VEDXWOox.js +0 -16
- package/dist/CW-Bt-Pwg4j-koWsygmq.js +0 -16
- package/dist/CX-uhIZlYzy-CLgj3zMe.js +0 -16
- package/dist/CY-un4rgwPX-BCZvAZao.js +0 -16
- package/dist/CZ-equ-r4iN-lt0FzSxo.js +0 -16
- package/dist/CashoutAntecipateContent-SfCGolcD.js +0 -42
- package/dist/ChargebackAnalytics-DMevdeDv.js +0 -1701
- package/dist/ChargebackDetail-2d1DN7U0.js +0 -3469
- package/dist/ChargebackRate-7Uy-H1DI.js +0 -77
- package/dist/ChatPlayground.page-CO4jfzTo.js +0 -508
- package/dist/ConfirmationModal-CF_U-frW.js +0 -105
- package/dist/Create.page-DPbBOsj8.js +0 -1390
- package/dist/CreatePaymentLink-DSyQYfVP.js +0 -856
- package/dist/DE-zx7UmJ-V-DeXIS-VO.js +0 -16
- package/dist/DJ-BN1kIFYT-C5T2N2HN.js +0 -16
- package/dist/DK-CrXXNH_h-B5zm5lvp.js +0 -16
- package/dist/DM-B4nVdNww-NQlqLUyy.js +0 -16
- package/dist/DO-C7-NF2JD-BLUIGfTI.js +0 -16
- package/dist/DZ-DSDLbNRb-w7_Desad.js +0 -16
- package/dist/DashboardAmountDetailsContent-DsRKiy13.js +0 -65
- package/dist/DashboardApprovalRateDetails.vue_vue_type_style_index_0_lang-W9oze5aE.js +0 -151
- package/dist/DashboardApprovalRateInternationalContent-DwZ_iCPM.js +0 -19
- package/dist/DashboardApprovalRateNationalContent-DPTDddWe.js +0 -74
- package/dist/DashboardCarouselContent-2fwlwNaA.js +0 -958
- package/dist/DashboardDetailsContent-DOaBSX6C.js +0 -58
- package/dist/DashboardHome-BWUDE46A.js +0 -4247
- package/dist/DetailSubscriptionRecurring-BwhVWSFe.js +0 -1296
- package/dist/EC-C_bjTYWm-CkIPnXtp.js +0 -16
- package/dist/EE-CQIjuoWO-eJzWYuFv.js +0 -16
- package/dist/EG-Bs_BHfVR-BUc-7Y5M.js +0 -16
- package/dist/EH-CnWam84F-BfLD5WtO.js +0 -16
- package/dist/ER-Dcl4hJzq-Cdnfo4Bc.js +0 -16
- package/dist/ES-Bpj2gAdj-CUZuk00J.js +0 -16
- package/dist/ET-Dm3q0Ruz-Xp4Kooq8.js +0 -16
- package/dist/ExternalPendenciesList-DaK1hoWT.js +0 -651
- package/dist/FI-DCqfJeiQ-Dg65w44y.js +0 -16
- package/dist/FJ-C6UrGUgI-BmqTBfls.js +0 -16
- package/dist/FK-CAaec31K-uu8TXGVh.js +0 -16
- package/dist/FM-Cf2SIJ7h-CjnhxBFa.js +0 -16
- package/dist/FO-DBb4psBV-B5mQD8--.js +0 -16
- package/dist/FR-CFW4iaQd-DcZT61H2.js +0 -16
- package/dist/FeatureFlagsPage-CBsbRl6D.js +0 -271
- package/dist/GA-D3NTxgTl-D2YIwQmr.js +0 -16
- package/dist/GB-ENG-Cmkg6Zq8-CAQ7T31R.js +0 -16
- package/dist/GB-NIR-DKszcfHi-BFFEYwvB.js +0 -16
- package/dist/GB-SCT-BiivwJ71-CxDx6od6.js +0 -16
- package/dist/GB-UKM-DgMBd3ib-CieAaPe1.js +0 -16
- package/dist/GB-WLS-DLoDy9iv-DMFfCAzk.js +0 -16
- package/dist/GD-Bs1d4We7-C-0qWGiJ.js +0 -16
- package/dist/GE-DXG9iLk5-lkTA9W--.js +0 -16
- package/dist/GF-B20s5gtx-BdEJtlYi.js +0 -16
- package/dist/GG-BAyrpIoO-CEp4nlb4.js +0 -16
- package/dist/GH-v3jh5r1X-sEdkkQNp.js +0 -16
- package/dist/GI-D39Krd4s-DFnkEJH8.js +0 -16
- package/dist/GL-BDd_W5AU-Bxy42WRY.js +0 -16
- package/dist/GM-BNEHspzj-Xqe99wsg.js +0 -16
- package/dist/GN-DdIZ0X6d-DUxQZuSu.js +0 -16
- package/dist/GP-CFW4iaQd-DOzMIWUU.js +0 -16
- package/dist/GQ-CC3X6AMz-6icEgnXe.js +0 -16
- package/dist/GR-C_0rusTd-mIM3xNh0.js +0 -16
- package/dist/GS-Db5l22a1-CdrX2Y5A.js +0 -16
- package/dist/GT-BhbkqUft-K3nNsWBc.js +0 -16
- package/dist/GU-C0HeItm1-D5xOZvA1.js +0 -16
- package/dist/GW-BjLM1vg--Cc2TkCJW.js +0 -16
- package/dist/GY-BreBVlhN-CRsMuRPu.js +0 -16
- package/dist/HK-BZn9ZQGS-i1VD08IL.js +0 -16
- package/dist/HM-BUbOyX6Q-CU-q_zyK.js +0 -16
- package/dist/HN-D4wujIPC-KAMhtxSX.js +0 -16
- package/dist/HR-Jhi3QQ9F-DFlEUgwE.js +0 -16
- package/dist/HT-MMjMjr-R-BqgEZJlK.js +0 -16
- package/dist/HU-CN5KmQ7F-DpYWZQce.js +0 -16
- package/dist/Home-w0zEZPLM.js +0 -997
- package/dist/ID-hVVUTKNG-DenQFi4u.js +0 -16
- package/dist/IE-WN_vdKcS-DmakqYH_.js +0 -16
- package/dist/IL-D5Wr_Xxh-DR1JQJAG.js +0 -16
- package/dist/IM-B-putc0k-BrB5mOrT.js +0 -16
- package/dist/IN-CK40zbQD-Cd_SCL4Q.js +0 -16
- package/dist/IO-CdvLck7D-B8cB7w_l.js +0 -16
- package/dist/IQ-f_9wyurt-Cn0ZuRNc.js +0 -16
- package/dist/IR-B0yfWttH-CI8EW92A.js +0 -16
- package/dist/IS-Dvf-XQTq-sfzt_VIB.js +0 -16
- package/dist/IT-uY7cjdFI-BdmhxsvZ.js +0 -16
- package/dist/ImportTrackingCode-Cwki8VEu.js +0 -1007
- package/dist/InternalCompanyIssuesDetail-BTFa349q.js +0 -862
- package/dist/InternalCompanyList-RZqevqas.js +0 -351
- package/dist/InternalPendencyDetail-Bi_kiYAJ.js +0 -717
- package/dist/JE-C95tN_VG-BM1b2jWY.js +0 -16
- package/dist/JM-zOuEwaB3-DakMHpsR.js +0 -16
- package/dist/JO-Cq88rrOD-Cz8lW1sE.js +0 -16
- package/dist/JP-5evXgWxq-CzBr_SVP.js +0 -16
- package/dist/KE-PHx0d97Z-DVzS4EC1.js +0 -16
- package/dist/KG-DT4JnieX-wDEt1dH0.js +0 -16
- package/dist/KH-ChwV2WTT-l5DkNXqr.js +0 -16
- package/dist/KI-D212g4Lh-Q_UgITmW.js +0 -16
- package/dist/KM-mPVp7AKS-BzQctsLg.js +0 -16
- package/dist/KN-AdXLXICN-Dz28lwO2.js +0 -16
- package/dist/KP-CC6UIrEF-DThiWjzQ.js +0 -16
- package/dist/KR-BtnmWR6C-CR6fjMs0.js +0 -16
- package/dist/KW-gqahWVaw-BkPvGzS_.js +0 -16
- package/dist/KY-DjIb70VQ-UuqAEB55.js +0 -16
- package/dist/KZ-C_fRihiO-B_za94A_.js +0 -16
- package/dist/LA-KIULJHAb-BPkxBWgt.js +0 -16
- package/dist/LB-CrF8WJiI-BdKdWg13.js +0 -16
- package/dist/LC-DGiHXm5V-CkJUFxuV.js +0 -16
- package/dist/LI-BwB0b8M1-BfCwQGk-.js +0 -16
- package/dist/LK-BOC44ZgS-BF3UITew.js +0 -16
- package/dist/LR-CWjRlWOZ-NgX1jbDo.js +0 -16
- package/dist/LS-B_EgU3p5-BPTRxTGe.js +0 -16
- package/dist/LT-BPyPiVx2-E20bXXtS.js +0 -16
- package/dist/LU-B-De6aB--CmvB2fVr.js +0 -16
- package/dist/LV-D2Ewe3XC-B1zMor1e.js +0 -16
- package/dist/LY-D1TSt6YI-bpysz8fH.js +0 -16
- package/dist/MA-QY5gm-vM-CsAOe4dd.js +0 -16
- package/dist/MC-BjlCjfCP-BNZJn2aT.js +0 -16
- package/dist/MD-rh-6rlSt-Bt22Bm16.js +0 -16
- package/dist/ME-D1euo0V2-Cf03c9AO.js +0 -16
- package/dist/MF-CFW4iaQd-9BRJjN4v.js +0 -16
- package/dist/MG-ONnxn_5g-CXZ-2z9e.js +0 -16
- package/dist/MH-B8oC_VMS-Dz9UrfiW.js +0 -16
- package/dist/MK-ByjICisj-COt2IDzo.js +0 -16
- package/dist/ML-CKVAuhox-Cp9dFrhj.js +0 -16
- package/dist/MM-doJuUjVT-BucIUrC-.js +0 -16
- package/dist/MN-BFP303GE-DYme6HEg.js +0 -16
- package/dist/MO-Dp4PTSYU-xjOpJPAh.js +0 -16
- package/dist/MP-CqKsnjHV-ChPYn2wP.js +0 -16
- package/dist/MQ-CFW4iaQd-DToalkVz.js +0 -16
- package/dist/MR-D73q_PiY-CYTp9zgT.js +0 -16
- package/dist/MS-qhjKl9TO-EYVm0-3d.js +0 -16
- package/dist/MT-CZjbs1U--CYxNYkeO.js +0 -16
- package/dist/MU-D0EQOl0S-DJ4m7oVM.js +0 -16
- package/dist/MV-BtwHRTMn-tJRMar24.js +0 -16
- package/dist/MW-CVnAR98j-C2m-9Drd.js +0 -16
- package/dist/MX-C7vXnCDY-BOFNqu0o.js +0 -16
- package/dist/MY-DJcgH_o3-D4O6580m.js +0 -16
- package/dist/MZ-BbLwl9DA-CdsWcHp4.js +0 -16
- package/dist/Max.page-ChNsHLUy.js +0 -599
- package/dist/MostSoldCountries-CX3vbXrx.js +0 -22
- package/dist/NA-5FKNjRGT-jKJ6qgWe.js +0 -16
- package/dist/NC-CFW4iaQd-ByYw5Ypb.js +0 -16
- package/dist/NE-DpLZJa7D-C65mma0D.js +0 -16
- package/dist/NF-BT-wIfwf-BzyXhqwy.js +0 -16
- package/dist/NG-BAiR_q0H-Cb8DUYFq.js +0 -16
- package/dist/NI-DylPDojG-D7w7ZfJ6.js +0 -16
- package/dist/NL-iozeFKPM-Cmjh0elD.js +0 -16
- package/dist/NO-CfaYWvM--CVbeIcbk.js +0 -16
- package/dist/NP-BGR_ZaqA-BImMeiCD.js +0 -16
- package/dist/NR-DHGW5Y3Q-C07PCDYH.js +0 -16
- package/dist/NU-CcpcSx_x-CYx4Kp7G.js +0 -16
- package/dist/NZ-DDYt6DcJ-Cif-Kw1W.js +0 -16
- package/dist/OM-D6hiar1r-4gACbfUf.js +0 -16
- package/dist/OrderStatus.vue_vue_type_script_setup_true_lang-BbJIJmF8.js +0 -760
- package/dist/OrderStatusChip-Cds7Y7LK.js +0 -30
- package/dist/Orders.page-BtraAP-w.js +0 -1636
- package/dist/OrdersChartDataContent-8rFRC_RD.js +0 -221
- package/dist/OrdersDetails.page-BNevKFTI.js +0 -6158
- package/dist/PA-Bi2blxjJ-EvrqyGIe.js +0 -16
- package/dist/PE-D4DjQOlP-DpBNRnfU.js +0 -16
- package/dist/PF-DmOSfnYB-tINNWwnc.js +0 -16
- package/dist/PG-DeOlZ7TA-SBQflY15.js +0 -16
- package/dist/PH-Dv4KdxU--DR0uWmjE.js +0 -16
- package/dist/PK-CRhM95F8-B-JTqeWR.js +0 -16
- package/dist/PL-BIdMQAtx-DdwoxqMc.js +0 -16
- package/dist/PM-BDa53dEz-Z8n5-v2E.js +0 -16
- package/dist/PN-Csu7Dufn-Djck72yV.js +0 -16
- package/dist/PR-C_Acdbc_-BMguztAs.js +0 -16
- package/dist/PS-Dmg0ofZr-DHluTVpa.js +0 -16
- package/dist/PT-Bsck4nv8-CKdXVXaH.js +0 -16
- package/dist/PW-CBMqjpxh-C6TlBXby.js +0 -16
- package/dist/PY-Be6zNh15-Dvds5o_H.js +0 -16
- package/dist/PaymentsLinks-B30T5Q-g.js +0 -675
- package/dist/QA-CZmcW85r-De7cr0fM.js +0 -16
- package/dist/RE-CFW4iaQd-Ts9mumW3.js +0 -16
- package/dist/RO-6H4O-gQF-DlgiGUnn.js +0 -16
- package/dist/RS-DM7vMnHL-C0Ig11Dy.js +0 -16
- package/dist/RU-HqKQeTq2-Dakt9zzw.js +0 -16
- package/dist/RW-DkH4VhfP-djhs6njt.js +0 -16
- package/dist/RecurringSubscription-CbXWwUXZ.js +0 -548
- package/dist/RecurringSubscriptionDashView-DCLHpkB5.js +0 -2012
- package/dist/RiskPendenciesInternalService-CIkqWsf1.js +0 -145
- package/dist/SA-C2hBi4Lh-CEMgfmhc.js +0 -16
- package/dist/SB-CBu9QLGP-xJhpee_b.js +0 -16
- package/dist/SC-CR6esM-V-CjE9cQu2.js +0 -16
- package/dist/SD-VCXqBHrW-AGD4JnfB.js +0 -16
- package/dist/SE-DbI0jJm9-7a1GWcRl.js +0 -16
- package/dist/SG-DgprfMyV-BkfCZ_qU.js +0 -16
- package/dist/SH-qhjKl9TO-CvKK803k.js +0 -16
- package/dist/SI-C3dA03Yk-Bbg9awoo.js +0 -16
- package/dist/SJ-CfaYWvM--BOTuOUXE.js +0 -16
- package/dist/SK-CxbHN7aU-B-SPe9-l.js +0 -16
- package/dist/SL-GXAaRXng-DWdJyCQp.js +0 -16
- package/dist/SM-B2SteTdO-DutV2C0n.js +0 -16
- package/dist/SN-B7Q__Lx_-DCrQvK0i.js +0 -16
- package/dist/SO-Bnd5-U9z-D7i2PmVP.js +0 -16
- package/dist/SR-BHMDOkL2-DF_csy-l.js +0 -16
- package/dist/SS-CsTgWca1-B1BO_mMW.js +0 -16
- package/dist/ST-DLqO0boT-CSHITGDi.js +0 -16
- package/dist/SV-DNZizmQg-oXtH8Qo0.js +0 -16
- package/dist/SX-DWuXjLwS-BVmitxTF.js +0 -16
- package/dist/SY-DeOQEBum-Z56UhCsj.js +0 -16
- package/dist/SZ-Bhe0qU5K-BcbdfEaj.js +0 -16
- package/dist/SalesRecovery-rSlU4lBQ.js +0 -594
- package/dist/SalesRecoveryIA-BpZzq0Vs.js +0 -199
- package/dist/SendCustomerRefundLinkPage-w7W2n7-k.js +0 -137
- package/dist/StatusDescriptionModal-BY_a33a6.js +0 -60
- package/dist/StatusTag.vue_vue_type_script_setup_true_lang-DncPsF1g.js +0 -28
- package/dist/TC-D5HTaKiF-CTS2rJXb.js +0 -16
- package/dist/TD-DyIWvaGg-MZHpuz-U.js +0 -16
- package/dist/TF-BRsv64iE-C2_DF6G-.js +0 -16
- package/dist/TG-OhNa5jmt-BYGtjBEn.js +0 -16
- package/dist/TH-F_ODV0JW-BKdbGGvG.js +0 -16
- package/dist/TJ-BFkbbSmN-OjycTQth.js +0 -16
- package/dist/TK-Ct75yy7V-D37cowKt.js +0 -16
- package/dist/TL-BzqVkHGw-BHUqs5iR.js +0 -16
- package/dist/TM-CCAvd8qV-DJhm6ozi.js +0 -16
- package/dist/TN-CmYqbPEz-DG69dHnw.js +0 -16
- package/dist/TO-BQQk9Xq_-B8H_cU7r.js +0 -16
- package/dist/TR-_MKkCnUV-Ce8wrpJl.js +0 -16
- package/dist/TT-DoRURl1c-CqqJJH8i.js +0 -16
- package/dist/TV-Dt8uZCP4-CZ10Z60G.js +0 -16
- package/dist/TW-CvHugvex-CjuFIYLC.js +0 -16
- package/dist/TZ-RbwBgiwb-DN4WP_pA.js +0 -16
- package/dist/TopSellingProductsContent-B4dMSJOf.js +0 -80
- package/dist/UA-BiXHPMqV-D9Q0BnEU.js +0 -16
- package/dist/UG--it_LhSj-DVs7EoOP.js +0 -16
- package/dist/UM-BFcTdeDD-C2lQ620l.js +0 -16
- package/dist/US-BFcTdeDD-C2lQ620l.js +0 -16
- package/dist/UY-C26Ndi4P-BjClgfOW.js +0 -16
- package/dist/UZ-BK5ADwFW-DELXMWtL.js +0 -16
- package/dist/UserIndicationsPage-D5biAnZg.js +0 -723
- package/dist/VA-Cpq1n4yW-BexKS0bf.js +0 -16
- package/dist/VC-D1Fjbog5-BW8vaqSu.js +0 -16
- package/dist/VE-CeM-hea7-DZOWIOL5.js +0 -16
- package/dist/VG-qhjKl9TO-WsxCZhFN.js +0 -16
- package/dist/VI-C-kcu42_-DT17Uhx1.js +0 -16
- package/dist/VN-2yoryeK1-DeZyduWc.js +0 -16
- package/dist/VU-CkLlsgzP-DEOXeeOV.js +0 -16
- package/dist/WF-BDa53dEz-CXGhtx-6.js +0 -16
- package/dist/WS-CNi2O6Qm-CRGlGEFW.js +0 -16
- package/dist/WithdrawAdvance-Dqgu7kEr.js +0 -17
- package/dist/WithdrawBankAccountStore-CG3n2xu4.js +0 -283
- package/dist/WithdrawBlocked-CYHm42m2.js +0 -133
- package/dist/WithdrawCompanyStore-Ce2bG9Yf.js +0 -80
- package/dist/WithdrawGuaranteeExtract-DANbCSJl.js +0 -994
- package/dist/WithdrawHome-CYfRTuDN.js +0 -1843
- package/dist/WithdrawHome-N7nxIpRo.js +0 -2448
- package/dist/WithdrawInternational-CCGb0go1.js +0 -17
- package/dist/WithdrawMaxStore-Dwa--YNG.js +0 -772
- package/dist/WithdrawNegativeCompany.vue_vue_type_script_setup_true_lang-CngvT-dM.js +0 -530
- package/dist/WithdrawNoAccountWarning-Bh2JLj6D.js +0 -233
- package/dist/WithdrawPermissionGuard-ByGCCs5c.js +0 -338
- package/dist/WithdrawRequest-DT2sn05r.js +0 -944
- package/dist/WithdrawRequest-DY_JlRRv.js +0 -17
- package/dist/WithdrawRequestDetail-B6aA7mvt.js +0 -284
- package/dist/WithdrawRequestLayout.vue_vue_type_script_setup_true_lang-BMgmOd3V.js +0 -936
- package/dist/YE-DxPZysMs-hp44jVzE.js +0 -16
- package/dist/YT-BMJJ1U_T--VLywbnY.js +0 -16
- package/dist/ZA-BjQXS8mc-jYojguAB.js +0 -16
- package/dist/ZM-Dw0PmMTO-DxJT8_H6.js +0 -16
- package/dist/ZW-D0UStZMr-CdsJJWqf.js +0 -16
- package/dist/affiliate-Bgt9fadK-DVa1p2Ax.js +0 -22
- package/dist/amex-CvNwRHhS-D7QA0ot0.js +0 -16
- package/dist/api-BXmQVd1G.js +0 -11
- package/dist/apple_pay-DtsAzVjF-B7P96imw.js +0 -20
- package/dist/archive-CFoPOir7-BqaAZDzV.js +0 -18
- package/dist/aura-D1VyKb6w-Dh2s6DM6.js +0 -23
- package/dist/boleto-BQZRi0Q5-Uqd1V5oX.js +0 -18
- package/dist/box-DNrK38w2-BPc8uAtv.js +0 -20
- package/dist/cart-p5jccB8o-Dk4jWhkE.js +0 -15
- package/dist/cash-FZcelZV1-BbEVmp6V.js +0 -20
- package/dist/chart-YJ27XOr3-_WmeeRjk.js +0 -22
- package/dist/chat.page-SnZZL-fu.js +0 -424
- package/dist/credit_card-CGrPYCJP-Dv3LRPJa.js +0 -15
- package/dist/csv-CYa6aPS5-r3Sm58wj.js +0 -18
- package/dist/dayjs.min-Da92Laf1.js +0 -282
- package/dist/diners-CN_1suUM-ByIzOVLB.js +0 -26
- package/dist/discover-vVTOFEvv-kW1bABpz.js +0 -22
- package/dist/ds-appmax-v322-DKdELPv0.js +0 -52
- package/dist/ds-appmax-v327-D_Ngcqh7.js +0 -69
- package/dist/ds-appmax-v330-BSYYSV8c.js +0 -48
- package/dist/ds-appmax-v335-DlWYejCt.js +0 -278
- package/dist/elo-BaNbqhYS-BL5vqnG1.js +0 -15
- package/dist/gear-BHOWpd7b-BXY-eNB8.js +0 -18
- package/dist/grid-B7I0mWry-6Fw-n1cc.js +0 -18
- package/dist/hipercard-DBsszwxC-CxTNMODi.js +0 -22
- package/dist/index-0erj0q9D.js +0 -106
- package/dist/index-5IxPxMNJ.js +0 -721
- package/dist/index-6YMHy5G2.js +0 -117
- package/dist/index-9BO81TgH.js +0 -200
- package/dist/index-B9ST15pA.js +0 -219
- package/dist/index-BA4Xl2x9.js +0 -21
- package/dist/index-BJqiiqE8.js +0 -18
- package/dist/index-BQAOXvOU.js +0 -409
- package/dist/index-BlfKgrZo.js +0 -681
- package/dist/index-BnJQRIjy.js +0 -1567
- package/dist/index-BwWFp7ZG.js +0 -83
- package/dist/index-CI3ydT1C.js +0 -62
- package/dist/index-CLX_IUEF.js +0 -332
- package/dist/index-CQBs9Ilw.js +0 -219
- package/dist/index-CuIL96-m.js +0 -230
- package/dist/index-CxvFaCZh.js +0 -1790
- package/dist/index-D079H_tW.js +0 -67
- package/dist/index-D8vz1ACh.js +0 -1204
- package/dist/index-DEQ5vo-Z.js +0 -169
- package/dist/index-DPZR8RXN.js +0 -11
- package/dist/index-DWqYaXlT.js +0 -92
- package/dist/index-D_ZU71du.js +0 -217
- package/dist/index-DrC8NJmf.js +0 -11240
- package/dist/index-FoTemvuc.js +0 -35
- package/dist/index-VHrwEDUR.js +0 -4133
- package/dist/index-VethgG0j.js +0 -21
- package/dist/index-WGpB5fbm.js +0 -534
- package/dist/index-Zc4sTzsf.js +0 -275
- package/dist/index-v9F6Flhh.js +0 -776
- package/dist/index.page-BNy_Hhbx.js +0 -165
- package/dist/index.page-CpvA2mnU.js +0 -737
- package/dist/index.page-DibEmry6.js +0 -827
- package/dist/infos-8KGPLXoE-CIlMJOwI.js +0 -18
- package/dist/integrations-UOltVEyj-BJ_hoiYF.js +0 -19
- package/dist/logs-Ce3fZY0v-BnG_9gF8.js +0 -28
- package/dist/maestro-BMomgHxO-DQUi6dYg.js +0 -27
- package/dist/main-B6czt4K3.js +0 -106858
- package/dist/mastercard-5I-dcOVV-dTf8yRon.js +0 -30
- package/dist/max_brand-Crj-SFUw-BxyRxraT.js +0 -29
- package/dist/max_brand_active-BIkS5qkP-DrWBa4Uz.js +0 -27
- package/dist/max_brand_negative-BxvdIegN-BIpVXAwH.js +0 -30
- package/dist/max_brand_white-DdKi2YVX-07zrB9Wd.js +0 -29
- package/dist/menu.page-C1f1VZ8V.js +0 -274
- package/dist/money-DZpB5eTf-D6BDmOZ7.js +0 -19
- package/dist/notification-DMezLtAj-DztcvB1_.js +0 -18
- package/dist/paypal-DMYjfEw0-D9u0bFsI.js +0 -15
- package/dist/pix-DXdX91yj-B8magsA0.js +0 -22
- package/dist/pix_outline-D_xXXgCN-D0MAR0H3.js +0 -16
- package/dist/pix_white-CcVsnEF2-y3M5kTGL.js +0 -24
- package/dist/pusher-Ctw2IJ_B.js +0 -4010
- package/dist/shield-DS-Xf4WH-CBSNQhR3.js +0 -15
- package/dist/solid_help-DNaqfgoc-D_TryZm4.js +0 -20
- package/dist/solid_home-BDUiJDVY-mXhot9z0.js +0 -18
- package/dist/solid_leaderboard-DtqK7q9Y-Di6Yx0Sk.js +0 -18
- package/dist/solid_store-Cfv6o4b8-BWBVlfl_.js +0 -18
- package/dist/ticket_icon-DwvyLm7c-Cql3ePbM.js +0 -22
- package/dist/usePendingMessage-B3Zd8A-q.js +0 -191
- package/dist/useQueryFilter-Co3MS7ew.js +0 -93
- package/dist/useRecurringTable-DjuqnEEK.js +0 -160
- package/dist/user-BRpwqYx8-rhpaCbxY.js +0 -18
- package/dist/validateURL.helper-CYNyNkTD.js +0 -126
- package/dist/visa-tPjWcMbi-BnoQ5R40.js +0 -18
|
@@ -0,0 +1,4010 @@
|
|
|
1
|
+
import { aN as getDefaultExportFromCjs } from "./main-CJqq8LV_.js";
|
|
2
|
+
var pusher = { exports: {} };
|
|
3
|
+
/*!
|
|
4
|
+
* Pusher JavaScript Library v8.4.0-rc2
|
|
5
|
+
* https://pusher.com/
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2020, Pusher
|
|
8
|
+
* Released under the MIT licence.
|
|
9
|
+
*/
|
|
10
|
+
(function(module, exports) {
|
|
11
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
12
|
+
module.exports = factory();
|
|
13
|
+
})(window, function() {
|
|
14
|
+
return (
|
|
15
|
+
/******/
|
|
16
|
+
function(modules) {
|
|
17
|
+
var installedModules = {};
|
|
18
|
+
function __webpack_require__(moduleId) {
|
|
19
|
+
if (installedModules[moduleId]) {
|
|
20
|
+
return installedModules[moduleId].exports;
|
|
21
|
+
}
|
|
22
|
+
var module2 = installedModules[moduleId] = {
|
|
23
|
+
/******/
|
|
24
|
+
i: moduleId,
|
|
25
|
+
/******/
|
|
26
|
+
l: false,
|
|
27
|
+
/******/
|
|
28
|
+
exports: {}
|
|
29
|
+
/******/
|
|
30
|
+
};
|
|
31
|
+
modules[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__);
|
|
32
|
+
module2.l = true;
|
|
33
|
+
return module2.exports;
|
|
34
|
+
}
|
|
35
|
+
__webpack_require__.m = modules;
|
|
36
|
+
__webpack_require__.c = installedModules;
|
|
37
|
+
__webpack_require__.d = function(exports2, name, getter) {
|
|
38
|
+
if (!__webpack_require__.o(exports2, name)) {
|
|
39
|
+
Object.defineProperty(exports2, name, { enumerable: true, get: getter });
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
__webpack_require__.r = function(exports2) {
|
|
43
|
+
if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
44
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
45
|
+
}
|
|
46
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
47
|
+
};
|
|
48
|
+
__webpack_require__.t = function(value, mode) {
|
|
49
|
+
if (mode & 1) value = __webpack_require__(value);
|
|
50
|
+
if (mode & 8) return value;
|
|
51
|
+
if (mode & 4 && typeof value === "object" && value && value.__esModule) return value;
|
|
52
|
+
var ns = /* @__PURE__ */ Object.create(null);
|
|
53
|
+
__webpack_require__.r(ns);
|
|
54
|
+
Object.defineProperty(ns, "default", { enumerable: true, value });
|
|
55
|
+
if (mode & 2 && typeof value != "string") for (var key in value) __webpack_require__.d(ns, key, (function(key2) {
|
|
56
|
+
return value[key2];
|
|
57
|
+
}).bind(null, key));
|
|
58
|
+
return ns;
|
|
59
|
+
};
|
|
60
|
+
__webpack_require__.n = function(module2) {
|
|
61
|
+
var getter = module2 && module2.__esModule ? (
|
|
62
|
+
/******/
|
|
63
|
+
function getDefault() {
|
|
64
|
+
return module2["default"];
|
|
65
|
+
}
|
|
66
|
+
) : (
|
|
67
|
+
/******/
|
|
68
|
+
function getModuleExports() {
|
|
69
|
+
return module2;
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
__webpack_require__.d(getter, "a", getter);
|
|
73
|
+
return getter;
|
|
74
|
+
};
|
|
75
|
+
__webpack_require__.o = function(object, property) {
|
|
76
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
|
77
|
+
};
|
|
78
|
+
__webpack_require__.p = "";
|
|
79
|
+
return __webpack_require__(__webpack_require__.s = 2);
|
|
80
|
+
}([
|
|
81
|
+
/* 0 */
|
|
82
|
+
/***/
|
|
83
|
+
function(module2, exports2, __webpack_require__) {
|
|
84
|
+
var __extends = this && this.__extends || /* @__PURE__ */ function() {
|
|
85
|
+
var extendStatics = function(d, b) {
|
|
86
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
87
|
+
d2.__proto__ = b2;
|
|
88
|
+
} || function(d2, b2) {
|
|
89
|
+
for (var p in b2) if (b2.hasOwnProperty(p)) d2[p] = b2[p];
|
|
90
|
+
};
|
|
91
|
+
return extendStatics(d, b);
|
|
92
|
+
};
|
|
93
|
+
return function(d, b) {
|
|
94
|
+
extendStatics(d, b);
|
|
95
|
+
function __() {
|
|
96
|
+
this.constructor = d;
|
|
97
|
+
}
|
|
98
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
99
|
+
};
|
|
100
|
+
}();
|
|
101
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
102
|
+
var INVALID_BYTE = 256;
|
|
103
|
+
var Coder = (
|
|
104
|
+
/** @class */
|
|
105
|
+
function() {
|
|
106
|
+
function Coder2(_paddingCharacter) {
|
|
107
|
+
if (_paddingCharacter === void 0) {
|
|
108
|
+
_paddingCharacter = "=";
|
|
109
|
+
}
|
|
110
|
+
this._paddingCharacter = _paddingCharacter;
|
|
111
|
+
}
|
|
112
|
+
Coder2.prototype.encodedLength = function(length) {
|
|
113
|
+
if (!this._paddingCharacter) {
|
|
114
|
+
return (length * 8 + 5) / 6 | 0;
|
|
115
|
+
}
|
|
116
|
+
return (length + 2) / 3 * 4 | 0;
|
|
117
|
+
};
|
|
118
|
+
Coder2.prototype.encode = function(data) {
|
|
119
|
+
var out = "";
|
|
120
|
+
var i = 0;
|
|
121
|
+
for (; i < data.length - 2; i += 3) {
|
|
122
|
+
var c = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
|
|
123
|
+
out += this._encodeByte(c >>> 3 * 6 & 63);
|
|
124
|
+
out += this._encodeByte(c >>> 2 * 6 & 63);
|
|
125
|
+
out += this._encodeByte(c >>> 1 * 6 & 63);
|
|
126
|
+
out += this._encodeByte(c >>> 0 * 6 & 63);
|
|
127
|
+
}
|
|
128
|
+
var left = data.length - i;
|
|
129
|
+
if (left > 0) {
|
|
130
|
+
var c = data[i] << 16 | (left === 2 ? data[i + 1] << 8 : 0);
|
|
131
|
+
out += this._encodeByte(c >>> 3 * 6 & 63);
|
|
132
|
+
out += this._encodeByte(c >>> 2 * 6 & 63);
|
|
133
|
+
if (left === 2) {
|
|
134
|
+
out += this._encodeByte(c >>> 1 * 6 & 63);
|
|
135
|
+
} else {
|
|
136
|
+
out += this._paddingCharacter || "";
|
|
137
|
+
}
|
|
138
|
+
out += this._paddingCharacter || "";
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
};
|
|
142
|
+
Coder2.prototype.maxDecodedLength = function(length) {
|
|
143
|
+
if (!this._paddingCharacter) {
|
|
144
|
+
return (length * 6 + 7) / 8 | 0;
|
|
145
|
+
}
|
|
146
|
+
return length / 4 * 3 | 0;
|
|
147
|
+
};
|
|
148
|
+
Coder2.prototype.decodedLength = function(s) {
|
|
149
|
+
return this.maxDecodedLength(s.length - this._getPaddingLength(s));
|
|
150
|
+
};
|
|
151
|
+
Coder2.prototype.decode = function(s) {
|
|
152
|
+
if (s.length === 0) {
|
|
153
|
+
return new Uint8Array(0);
|
|
154
|
+
}
|
|
155
|
+
var paddingLength = this._getPaddingLength(s);
|
|
156
|
+
var length = s.length - paddingLength;
|
|
157
|
+
var out = new Uint8Array(this.maxDecodedLength(length));
|
|
158
|
+
var op = 0;
|
|
159
|
+
var i = 0;
|
|
160
|
+
var haveBad = 0;
|
|
161
|
+
var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
|
|
162
|
+
for (; i < length - 4; i += 4) {
|
|
163
|
+
v0 = this._decodeChar(s.charCodeAt(i + 0));
|
|
164
|
+
v1 = this._decodeChar(s.charCodeAt(i + 1));
|
|
165
|
+
v2 = this._decodeChar(s.charCodeAt(i + 2));
|
|
166
|
+
v3 = this._decodeChar(s.charCodeAt(i + 3));
|
|
167
|
+
out[op++] = v0 << 2 | v1 >>> 4;
|
|
168
|
+
out[op++] = v1 << 4 | v2 >>> 2;
|
|
169
|
+
out[op++] = v2 << 6 | v3;
|
|
170
|
+
haveBad |= v0 & INVALID_BYTE;
|
|
171
|
+
haveBad |= v1 & INVALID_BYTE;
|
|
172
|
+
haveBad |= v2 & INVALID_BYTE;
|
|
173
|
+
haveBad |= v3 & INVALID_BYTE;
|
|
174
|
+
}
|
|
175
|
+
if (i < length - 1) {
|
|
176
|
+
v0 = this._decodeChar(s.charCodeAt(i));
|
|
177
|
+
v1 = this._decodeChar(s.charCodeAt(i + 1));
|
|
178
|
+
out[op++] = v0 << 2 | v1 >>> 4;
|
|
179
|
+
haveBad |= v0 & INVALID_BYTE;
|
|
180
|
+
haveBad |= v1 & INVALID_BYTE;
|
|
181
|
+
}
|
|
182
|
+
if (i < length - 2) {
|
|
183
|
+
v2 = this._decodeChar(s.charCodeAt(i + 2));
|
|
184
|
+
out[op++] = v1 << 4 | v2 >>> 2;
|
|
185
|
+
haveBad |= v2 & INVALID_BYTE;
|
|
186
|
+
}
|
|
187
|
+
if (i < length - 3) {
|
|
188
|
+
v3 = this._decodeChar(s.charCodeAt(i + 3));
|
|
189
|
+
out[op++] = v2 << 6 | v3;
|
|
190
|
+
haveBad |= v3 & INVALID_BYTE;
|
|
191
|
+
}
|
|
192
|
+
if (haveBad !== 0) {
|
|
193
|
+
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
};
|
|
197
|
+
Coder2.prototype._encodeByte = function(b) {
|
|
198
|
+
var result = b;
|
|
199
|
+
result += 65;
|
|
200
|
+
result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
|
|
201
|
+
result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
|
|
202
|
+
result += 61 - b >>> 8 & 52 - 48 - 62 + 43;
|
|
203
|
+
result += 62 - b >>> 8 & 62 - 43 - 63 + 47;
|
|
204
|
+
return String.fromCharCode(result);
|
|
205
|
+
};
|
|
206
|
+
Coder2.prototype._decodeChar = function(c) {
|
|
207
|
+
var result = INVALID_BYTE;
|
|
208
|
+
result += (42 - c & c - 44) >>> 8 & -256 + c - 43 + 62;
|
|
209
|
+
result += (46 - c & c - 48) >>> 8 & -256 + c - 47 + 63;
|
|
210
|
+
result += (47 - c & c - 58) >>> 8 & -256 + c - 48 + 52;
|
|
211
|
+
result += (64 - c & c - 91) >>> 8 & -256 + c - 65 + 0;
|
|
212
|
+
result += (96 - c & c - 123) >>> 8 & -256 + c - 97 + 26;
|
|
213
|
+
return result;
|
|
214
|
+
};
|
|
215
|
+
Coder2.prototype._getPaddingLength = function(s) {
|
|
216
|
+
var paddingLength = 0;
|
|
217
|
+
if (this._paddingCharacter) {
|
|
218
|
+
for (var i = s.length - 1; i >= 0; i--) {
|
|
219
|
+
if (s[i] !== this._paddingCharacter) {
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
paddingLength++;
|
|
223
|
+
}
|
|
224
|
+
if (s.length < 4 || paddingLength > 2) {
|
|
225
|
+
throw new Error("Base64Coder: incorrect padding");
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return paddingLength;
|
|
229
|
+
};
|
|
230
|
+
return Coder2;
|
|
231
|
+
}()
|
|
232
|
+
);
|
|
233
|
+
exports2.Coder = Coder;
|
|
234
|
+
var stdCoder = new Coder();
|
|
235
|
+
function encode(data) {
|
|
236
|
+
return stdCoder.encode(data);
|
|
237
|
+
}
|
|
238
|
+
exports2.encode = encode;
|
|
239
|
+
function decode(s) {
|
|
240
|
+
return stdCoder.decode(s);
|
|
241
|
+
}
|
|
242
|
+
exports2.decode = decode;
|
|
243
|
+
var URLSafeCoder = (
|
|
244
|
+
/** @class */
|
|
245
|
+
function(_super) {
|
|
246
|
+
__extends(URLSafeCoder2, _super);
|
|
247
|
+
function URLSafeCoder2() {
|
|
248
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
249
|
+
}
|
|
250
|
+
URLSafeCoder2.prototype._encodeByte = function(b) {
|
|
251
|
+
var result = b;
|
|
252
|
+
result += 65;
|
|
253
|
+
result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
|
|
254
|
+
result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
|
|
255
|
+
result += 61 - b >>> 8 & 52 - 48 - 62 + 45;
|
|
256
|
+
result += 62 - b >>> 8 & 62 - 45 - 63 + 95;
|
|
257
|
+
return String.fromCharCode(result);
|
|
258
|
+
};
|
|
259
|
+
URLSafeCoder2.prototype._decodeChar = function(c) {
|
|
260
|
+
var result = INVALID_BYTE;
|
|
261
|
+
result += (44 - c & c - 46) >>> 8 & -256 + c - 45 + 62;
|
|
262
|
+
result += (94 - c & c - 96) >>> 8 & -256 + c - 95 + 63;
|
|
263
|
+
result += (47 - c & c - 58) >>> 8 & -256 + c - 48 + 52;
|
|
264
|
+
result += (64 - c & c - 91) >>> 8 & -256 + c - 65 + 0;
|
|
265
|
+
result += (96 - c & c - 123) >>> 8 & -256 + c - 97 + 26;
|
|
266
|
+
return result;
|
|
267
|
+
};
|
|
268
|
+
return URLSafeCoder2;
|
|
269
|
+
}(Coder)
|
|
270
|
+
);
|
|
271
|
+
exports2.URLSafeCoder = URLSafeCoder;
|
|
272
|
+
var urlSafeCoder = new URLSafeCoder();
|
|
273
|
+
function encodeURLSafe(data) {
|
|
274
|
+
return urlSafeCoder.encode(data);
|
|
275
|
+
}
|
|
276
|
+
exports2.encodeURLSafe = encodeURLSafe;
|
|
277
|
+
function decodeURLSafe(s) {
|
|
278
|
+
return urlSafeCoder.decode(s);
|
|
279
|
+
}
|
|
280
|
+
exports2.decodeURLSafe = decodeURLSafe;
|
|
281
|
+
exports2.encodedLength = function(length) {
|
|
282
|
+
return stdCoder.encodedLength(length);
|
|
283
|
+
};
|
|
284
|
+
exports2.maxDecodedLength = function(length) {
|
|
285
|
+
return stdCoder.maxDecodedLength(length);
|
|
286
|
+
};
|
|
287
|
+
exports2.decodedLength = function(s) {
|
|
288
|
+
return stdCoder.decodedLength(s);
|
|
289
|
+
};
|
|
290
|
+
},
|
|
291
|
+
/* 1 */
|
|
292
|
+
/***/
|
|
293
|
+
function(module2, exports2, __webpack_require__) {
|
|
294
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
295
|
+
var INVALID_UTF16 = "utf8: invalid string";
|
|
296
|
+
var INVALID_UTF8 = "utf8: invalid source encoding";
|
|
297
|
+
function encode(s) {
|
|
298
|
+
var arr = new Uint8Array(encodedLength(s));
|
|
299
|
+
var pos = 0;
|
|
300
|
+
for (var i = 0; i < s.length; i++) {
|
|
301
|
+
var c = s.charCodeAt(i);
|
|
302
|
+
if (c < 128) {
|
|
303
|
+
arr[pos++] = c;
|
|
304
|
+
} else if (c < 2048) {
|
|
305
|
+
arr[pos++] = 192 | c >> 6;
|
|
306
|
+
arr[pos++] = 128 | c & 63;
|
|
307
|
+
} else if (c < 55296) {
|
|
308
|
+
arr[pos++] = 224 | c >> 12;
|
|
309
|
+
arr[pos++] = 128 | c >> 6 & 63;
|
|
310
|
+
arr[pos++] = 128 | c & 63;
|
|
311
|
+
} else {
|
|
312
|
+
i++;
|
|
313
|
+
c = (c & 1023) << 10;
|
|
314
|
+
c |= s.charCodeAt(i) & 1023;
|
|
315
|
+
c += 65536;
|
|
316
|
+
arr[pos++] = 240 | c >> 18;
|
|
317
|
+
arr[pos++] = 128 | c >> 12 & 63;
|
|
318
|
+
arr[pos++] = 128 | c >> 6 & 63;
|
|
319
|
+
arr[pos++] = 128 | c & 63;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return arr;
|
|
323
|
+
}
|
|
324
|
+
exports2.encode = encode;
|
|
325
|
+
function encodedLength(s) {
|
|
326
|
+
var result = 0;
|
|
327
|
+
for (var i = 0; i < s.length; i++) {
|
|
328
|
+
var c = s.charCodeAt(i);
|
|
329
|
+
if (c < 128) {
|
|
330
|
+
result += 1;
|
|
331
|
+
} else if (c < 2048) {
|
|
332
|
+
result += 2;
|
|
333
|
+
} else if (c < 55296) {
|
|
334
|
+
result += 3;
|
|
335
|
+
} else if (c <= 57343) {
|
|
336
|
+
if (i >= s.length - 1) {
|
|
337
|
+
throw new Error(INVALID_UTF16);
|
|
338
|
+
}
|
|
339
|
+
i++;
|
|
340
|
+
result += 4;
|
|
341
|
+
} else {
|
|
342
|
+
throw new Error(INVALID_UTF16);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
347
|
+
exports2.encodedLength = encodedLength;
|
|
348
|
+
function decode(arr) {
|
|
349
|
+
var chars = [];
|
|
350
|
+
for (var i = 0; i < arr.length; i++) {
|
|
351
|
+
var b = arr[i];
|
|
352
|
+
if (b & 128) {
|
|
353
|
+
var min = void 0;
|
|
354
|
+
if (b < 224) {
|
|
355
|
+
if (i >= arr.length) {
|
|
356
|
+
throw new Error(INVALID_UTF8);
|
|
357
|
+
}
|
|
358
|
+
var n1 = arr[++i];
|
|
359
|
+
if ((n1 & 192) !== 128) {
|
|
360
|
+
throw new Error(INVALID_UTF8);
|
|
361
|
+
}
|
|
362
|
+
b = (b & 31) << 6 | n1 & 63;
|
|
363
|
+
min = 128;
|
|
364
|
+
} else if (b < 240) {
|
|
365
|
+
if (i >= arr.length - 1) {
|
|
366
|
+
throw new Error(INVALID_UTF8);
|
|
367
|
+
}
|
|
368
|
+
var n1 = arr[++i];
|
|
369
|
+
var n2 = arr[++i];
|
|
370
|
+
if ((n1 & 192) !== 128 || (n2 & 192) !== 128) {
|
|
371
|
+
throw new Error(INVALID_UTF8);
|
|
372
|
+
}
|
|
373
|
+
b = (b & 15) << 12 | (n1 & 63) << 6 | n2 & 63;
|
|
374
|
+
min = 2048;
|
|
375
|
+
} else if (b < 248) {
|
|
376
|
+
if (i >= arr.length - 2) {
|
|
377
|
+
throw new Error(INVALID_UTF8);
|
|
378
|
+
}
|
|
379
|
+
var n1 = arr[++i];
|
|
380
|
+
var n2 = arr[++i];
|
|
381
|
+
var n3 = arr[++i];
|
|
382
|
+
if ((n1 & 192) !== 128 || (n2 & 192) !== 128 || (n3 & 192) !== 128) {
|
|
383
|
+
throw new Error(INVALID_UTF8);
|
|
384
|
+
}
|
|
385
|
+
b = (b & 15) << 18 | (n1 & 63) << 12 | (n2 & 63) << 6 | n3 & 63;
|
|
386
|
+
min = 65536;
|
|
387
|
+
} else {
|
|
388
|
+
throw new Error(INVALID_UTF8);
|
|
389
|
+
}
|
|
390
|
+
if (b < min || b >= 55296 && b <= 57343) {
|
|
391
|
+
throw new Error(INVALID_UTF8);
|
|
392
|
+
}
|
|
393
|
+
if (b >= 65536) {
|
|
394
|
+
if (b > 1114111) {
|
|
395
|
+
throw new Error(INVALID_UTF8);
|
|
396
|
+
}
|
|
397
|
+
b -= 65536;
|
|
398
|
+
chars.push(String.fromCharCode(55296 | b >> 10));
|
|
399
|
+
b = 56320 | b & 1023;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
chars.push(String.fromCharCode(b));
|
|
403
|
+
}
|
|
404
|
+
return chars.join("");
|
|
405
|
+
}
|
|
406
|
+
exports2.decode = decode;
|
|
407
|
+
},
|
|
408
|
+
/* 2 */
|
|
409
|
+
/***/
|
|
410
|
+
function(module2, exports2, __webpack_require__) {
|
|
411
|
+
module2.exports = __webpack_require__(3).default;
|
|
412
|
+
},
|
|
413
|
+
/* 3 */
|
|
414
|
+
/***/
|
|
415
|
+
function(module2, __webpack_exports__, __webpack_require__) {
|
|
416
|
+
__webpack_require__.r(__webpack_exports__);
|
|
417
|
+
class ScriptReceiverFactory {
|
|
418
|
+
constructor(prefix2, name) {
|
|
419
|
+
this.lastId = 0;
|
|
420
|
+
this.prefix = prefix2;
|
|
421
|
+
this.name = name;
|
|
422
|
+
}
|
|
423
|
+
create(callback) {
|
|
424
|
+
this.lastId++;
|
|
425
|
+
var number = this.lastId;
|
|
426
|
+
var id = this.prefix + number;
|
|
427
|
+
var name = this.name + "[" + number + "]";
|
|
428
|
+
var called = false;
|
|
429
|
+
var callbackWrapper = function() {
|
|
430
|
+
if (!called) {
|
|
431
|
+
callback.apply(null, arguments);
|
|
432
|
+
called = true;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
this[number] = callbackWrapper;
|
|
436
|
+
return { number, id, name, callback: callbackWrapper };
|
|
437
|
+
}
|
|
438
|
+
remove(receiver) {
|
|
439
|
+
delete this[receiver.number];
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
|
|
443
|
+
var Defaults = {
|
|
444
|
+
VERSION: "8.4.0-rc2",
|
|
445
|
+
PROTOCOL: 7,
|
|
446
|
+
wsPort: 80,
|
|
447
|
+
wssPort: 443,
|
|
448
|
+
wsPath: "",
|
|
449
|
+
httpHost: "sockjs.pusher.com",
|
|
450
|
+
httpPort: 80,
|
|
451
|
+
httpsPort: 443,
|
|
452
|
+
httpPath: "/pusher",
|
|
453
|
+
stats_host: "stats.pusher.com",
|
|
454
|
+
authEndpoint: "/pusher/auth",
|
|
455
|
+
authTransport: "ajax",
|
|
456
|
+
activityTimeout: 12e4,
|
|
457
|
+
pongTimeout: 3e4,
|
|
458
|
+
unavailableTimeout: 1e4,
|
|
459
|
+
userAuthentication: {
|
|
460
|
+
endpoint: "/pusher/user-auth",
|
|
461
|
+
transport: "ajax"
|
|
462
|
+
},
|
|
463
|
+
channelAuthorization: {
|
|
464
|
+
endpoint: "/pusher/auth",
|
|
465
|
+
transport: "ajax"
|
|
466
|
+
},
|
|
467
|
+
cdn_http: "http://js.pusher.com",
|
|
468
|
+
cdn_https: "https://js.pusher.com",
|
|
469
|
+
dependency_suffix: ""
|
|
470
|
+
};
|
|
471
|
+
var defaults = Defaults;
|
|
472
|
+
class dependency_loader_DependencyLoader {
|
|
473
|
+
constructor(options) {
|
|
474
|
+
this.options = options;
|
|
475
|
+
this.receivers = options.receivers || ScriptReceivers;
|
|
476
|
+
this.loading = {};
|
|
477
|
+
}
|
|
478
|
+
load(name, options, callback) {
|
|
479
|
+
var self = this;
|
|
480
|
+
if (self.loading[name] && self.loading[name].length > 0) {
|
|
481
|
+
self.loading[name].push(callback);
|
|
482
|
+
} else {
|
|
483
|
+
self.loading[name] = [callback];
|
|
484
|
+
var request = runtime.createScriptRequest(self.getPath(name, options));
|
|
485
|
+
var receiver = self.receivers.create(function(error) {
|
|
486
|
+
self.receivers.remove(receiver);
|
|
487
|
+
if (self.loading[name]) {
|
|
488
|
+
var callbacks = self.loading[name];
|
|
489
|
+
delete self.loading[name];
|
|
490
|
+
var successCallback = function(wasSuccessful) {
|
|
491
|
+
if (!wasSuccessful) {
|
|
492
|
+
request.cleanup();
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
for (var i = 0; i < callbacks.length; i++) {
|
|
496
|
+
callbacks[i](error, successCallback);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
request.send(receiver);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
getRoot(options) {
|
|
504
|
+
var cdn;
|
|
505
|
+
var protocol = runtime.getDocument().location.protocol;
|
|
506
|
+
if (options && options.useTLS || protocol === "https:") {
|
|
507
|
+
cdn = this.options.cdn_https;
|
|
508
|
+
} else {
|
|
509
|
+
cdn = this.options.cdn_http;
|
|
510
|
+
}
|
|
511
|
+
return cdn.replace(/\/*$/, "") + "/" + this.options.version;
|
|
512
|
+
}
|
|
513
|
+
getPath(name, options) {
|
|
514
|
+
return this.getRoot(options) + "/" + name + this.options.suffix + ".js";
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
|
|
518
|
+
var Dependencies = new dependency_loader_DependencyLoader({
|
|
519
|
+
cdn_http: defaults.cdn_http,
|
|
520
|
+
cdn_https: defaults.cdn_https,
|
|
521
|
+
version: defaults.VERSION,
|
|
522
|
+
suffix: defaults.dependency_suffix,
|
|
523
|
+
receivers: DependenciesReceivers
|
|
524
|
+
});
|
|
525
|
+
const urlStore = {
|
|
526
|
+
baseUrl: "https://pusher.com",
|
|
527
|
+
urls: {
|
|
528
|
+
authenticationEndpoint: {
|
|
529
|
+
path: "/docs/channels/server_api/authenticating_users"
|
|
530
|
+
},
|
|
531
|
+
authorizationEndpoint: {
|
|
532
|
+
path: "/docs/channels/server_api/authorizing-users/"
|
|
533
|
+
},
|
|
534
|
+
javascriptQuickStart: {
|
|
535
|
+
path: "/docs/javascript_quick_start"
|
|
536
|
+
},
|
|
537
|
+
triggeringClientEvents: {
|
|
538
|
+
path: "/docs/client_api_guide/client_events#trigger-events"
|
|
539
|
+
},
|
|
540
|
+
encryptedChannelSupport: {
|
|
541
|
+
fullUrl: "https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
const buildLogSuffix = function(key) {
|
|
546
|
+
const urlPrefix = "See:";
|
|
547
|
+
const urlObj = urlStore.urls[key];
|
|
548
|
+
if (!urlObj)
|
|
549
|
+
return "";
|
|
550
|
+
let url;
|
|
551
|
+
if (urlObj.fullUrl) {
|
|
552
|
+
url = urlObj.fullUrl;
|
|
553
|
+
} else if (urlObj.path) {
|
|
554
|
+
url = urlStore.baseUrl + urlObj.path;
|
|
555
|
+
}
|
|
556
|
+
if (!url)
|
|
557
|
+
return "";
|
|
558
|
+
return `${urlPrefix} ${url}`;
|
|
559
|
+
};
|
|
560
|
+
var url_store = { buildLogSuffix };
|
|
561
|
+
var AuthRequestType;
|
|
562
|
+
(function(AuthRequestType2) {
|
|
563
|
+
AuthRequestType2["UserAuthentication"] = "user-authentication";
|
|
564
|
+
AuthRequestType2["ChannelAuthorization"] = "channel-authorization";
|
|
565
|
+
})(AuthRequestType || (AuthRequestType = {}));
|
|
566
|
+
class BadEventName extends Error {
|
|
567
|
+
constructor(msg) {
|
|
568
|
+
super(msg);
|
|
569
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
class BadChannelName extends Error {
|
|
573
|
+
constructor(msg) {
|
|
574
|
+
super(msg);
|
|
575
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
class RequestTimedOut extends Error {
|
|
579
|
+
constructor(msg) {
|
|
580
|
+
super(msg);
|
|
581
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
class TransportPriorityTooLow extends Error {
|
|
585
|
+
constructor(msg) {
|
|
586
|
+
super(msg);
|
|
587
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
class TransportClosed extends Error {
|
|
591
|
+
constructor(msg) {
|
|
592
|
+
super(msg);
|
|
593
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
class UnsupportedFeature extends Error {
|
|
597
|
+
constructor(msg) {
|
|
598
|
+
super(msg);
|
|
599
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
class UnsupportedTransport extends Error {
|
|
603
|
+
constructor(msg) {
|
|
604
|
+
super(msg);
|
|
605
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
class UnsupportedStrategy extends Error {
|
|
609
|
+
constructor(msg) {
|
|
610
|
+
super(msg);
|
|
611
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
class HTTPAuthError extends Error {
|
|
615
|
+
constructor(status, msg) {
|
|
616
|
+
super(msg);
|
|
617
|
+
this.status = status;
|
|
618
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
const ajax = function(context, query, authOptions, authRequestType, callback) {
|
|
622
|
+
const xhr = runtime.createXHR();
|
|
623
|
+
xhr.open("POST", authOptions.endpoint, true);
|
|
624
|
+
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
625
|
+
for (var headerName in authOptions.headers) {
|
|
626
|
+
xhr.setRequestHeader(headerName, authOptions.headers[headerName]);
|
|
627
|
+
}
|
|
628
|
+
if (authOptions.headersProvider != null) {
|
|
629
|
+
let dynamicHeaders = authOptions.headersProvider();
|
|
630
|
+
for (var headerName in dynamicHeaders) {
|
|
631
|
+
xhr.setRequestHeader(headerName, dynamicHeaders[headerName]);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
xhr.onreadystatechange = function() {
|
|
635
|
+
if (xhr.readyState === 4) {
|
|
636
|
+
if (xhr.status === 200) {
|
|
637
|
+
let data;
|
|
638
|
+
let parsed = false;
|
|
639
|
+
try {
|
|
640
|
+
data = JSON.parse(xhr.responseText);
|
|
641
|
+
parsed = true;
|
|
642
|
+
} catch (e) {
|
|
643
|
+
callback(new HTTPAuthError(200, `JSON returned from ${authRequestType.toString()} endpoint was invalid, yet status code was 200. Data was: ${xhr.responseText}`), null);
|
|
644
|
+
}
|
|
645
|
+
if (parsed) {
|
|
646
|
+
callback(null, data);
|
|
647
|
+
}
|
|
648
|
+
} else {
|
|
649
|
+
let suffix = "";
|
|
650
|
+
switch (authRequestType) {
|
|
651
|
+
case AuthRequestType.UserAuthentication:
|
|
652
|
+
suffix = url_store.buildLogSuffix("authenticationEndpoint");
|
|
653
|
+
break;
|
|
654
|
+
case AuthRequestType.ChannelAuthorization:
|
|
655
|
+
suffix = `Clients must be authorized to join private or presence channels. ${url_store.buildLogSuffix("authorizationEndpoint")}`;
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
callback(new HTTPAuthError(xhr.status, `Unable to retrieve auth string from ${authRequestType.toString()} endpoint - received status: ${xhr.status} from ${authOptions.endpoint}. ${suffix}`), null);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
xhr.send(query);
|
|
663
|
+
return xhr;
|
|
664
|
+
};
|
|
665
|
+
var xhr_auth = ajax;
|
|
666
|
+
function encode(s) {
|
|
667
|
+
return btoa(utob(s));
|
|
668
|
+
}
|
|
669
|
+
var fromCharCode = String.fromCharCode;
|
|
670
|
+
var b64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
671
|
+
var cb_utob = function(c) {
|
|
672
|
+
var cc = c.charCodeAt(0);
|
|
673
|
+
return cc < 128 ? c : cc < 2048 ? fromCharCode(192 | cc >>> 6) + fromCharCode(128 | cc & 63) : fromCharCode(224 | cc >>> 12 & 15) + fromCharCode(128 | cc >>> 6 & 63) + fromCharCode(128 | cc & 63);
|
|
674
|
+
};
|
|
675
|
+
var utob = function(u) {
|
|
676
|
+
return u.replace(/[^\x00-\x7F]/g, cb_utob);
|
|
677
|
+
};
|
|
678
|
+
var cb_encode = function(ccc) {
|
|
679
|
+
var padlen = [0, 2, 1][ccc.length % 3];
|
|
680
|
+
var ord = ccc.charCodeAt(0) << 16 | (ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8 | (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
|
|
681
|
+
var chars = [
|
|
682
|
+
b64chars.charAt(ord >>> 18),
|
|
683
|
+
b64chars.charAt(ord >>> 12 & 63),
|
|
684
|
+
padlen >= 2 ? "=" : b64chars.charAt(ord >>> 6 & 63),
|
|
685
|
+
padlen >= 1 ? "=" : b64chars.charAt(ord & 63)
|
|
686
|
+
];
|
|
687
|
+
return chars.join("");
|
|
688
|
+
};
|
|
689
|
+
var btoa = window.btoa || function(b) {
|
|
690
|
+
return b.replace(/[\s\S]{1,3}/g, cb_encode);
|
|
691
|
+
};
|
|
692
|
+
class Timer {
|
|
693
|
+
constructor(set, clear, delay, callback) {
|
|
694
|
+
this.clear = clear;
|
|
695
|
+
this.timer = set(() => {
|
|
696
|
+
if (this.timer) {
|
|
697
|
+
this.timer = callback(this.timer);
|
|
698
|
+
}
|
|
699
|
+
}, delay);
|
|
700
|
+
}
|
|
701
|
+
isRunning() {
|
|
702
|
+
return this.timer !== null;
|
|
703
|
+
}
|
|
704
|
+
ensureAborted() {
|
|
705
|
+
if (this.timer) {
|
|
706
|
+
this.clear(this.timer);
|
|
707
|
+
this.timer = null;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
var abstract_timer = Timer;
|
|
712
|
+
function timers_clearTimeout(timer) {
|
|
713
|
+
window.clearTimeout(timer);
|
|
714
|
+
}
|
|
715
|
+
function timers_clearInterval(timer) {
|
|
716
|
+
window.clearInterval(timer);
|
|
717
|
+
}
|
|
718
|
+
class timers_OneOffTimer extends abstract_timer {
|
|
719
|
+
constructor(delay, callback) {
|
|
720
|
+
super(setTimeout, timers_clearTimeout, delay, function(timer) {
|
|
721
|
+
callback();
|
|
722
|
+
return null;
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
class timers_PeriodicTimer extends abstract_timer {
|
|
727
|
+
constructor(delay, callback) {
|
|
728
|
+
super(setInterval, timers_clearInterval, delay, function(timer) {
|
|
729
|
+
callback();
|
|
730
|
+
return timer;
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
var Util = {
|
|
735
|
+
now() {
|
|
736
|
+
if (Date.now) {
|
|
737
|
+
return Date.now();
|
|
738
|
+
} else {
|
|
739
|
+
return (/* @__PURE__ */ new Date()).valueOf();
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
defer(callback) {
|
|
743
|
+
return new timers_OneOffTimer(0, callback);
|
|
744
|
+
},
|
|
745
|
+
method(name, ...args) {
|
|
746
|
+
var boundArguments = Array.prototype.slice.call(arguments, 1);
|
|
747
|
+
return function(object) {
|
|
748
|
+
return object[name].apply(object, boundArguments.concat(arguments));
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
var util = Util;
|
|
753
|
+
function extend(target, ...sources) {
|
|
754
|
+
for (var i = 0; i < sources.length; i++) {
|
|
755
|
+
var extensions = sources[i];
|
|
756
|
+
for (var property in extensions) {
|
|
757
|
+
if (extensions[property] && extensions[property].constructor && extensions[property].constructor === Object) {
|
|
758
|
+
target[property] = extend(target[property] || {}, extensions[property]);
|
|
759
|
+
} else {
|
|
760
|
+
target[property] = extensions[property];
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
return target;
|
|
765
|
+
}
|
|
766
|
+
function stringify() {
|
|
767
|
+
var m = ["Pusher"];
|
|
768
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
769
|
+
if (typeof arguments[i] === "string") {
|
|
770
|
+
m.push(arguments[i]);
|
|
771
|
+
} else {
|
|
772
|
+
m.push(safeJSONStringify(arguments[i]));
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
return m.join(" : ");
|
|
776
|
+
}
|
|
777
|
+
function arrayIndexOf(array, item) {
|
|
778
|
+
var nativeIndexOf = Array.prototype.indexOf;
|
|
779
|
+
if (array === null) {
|
|
780
|
+
return -1;
|
|
781
|
+
}
|
|
782
|
+
if (nativeIndexOf && array.indexOf === nativeIndexOf) {
|
|
783
|
+
return array.indexOf(item);
|
|
784
|
+
}
|
|
785
|
+
for (var i = 0, l = array.length; i < l; i++) {
|
|
786
|
+
if (array[i] === item) {
|
|
787
|
+
return i;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
return -1;
|
|
791
|
+
}
|
|
792
|
+
function objectApply(object, f) {
|
|
793
|
+
for (var key in object) {
|
|
794
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
795
|
+
f(object[key], key, object);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
function keys(object) {
|
|
800
|
+
var keys2 = [];
|
|
801
|
+
objectApply(object, function(_, key) {
|
|
802
|
+
keys2.push(key);
|
|
803
|
+
});
|
|
804
|
+
return keys2;
|
|
805
|
+
}
|
|
806
|
+
function values(object) {
|
|
807
|
+
var values2 = [];
|
|
808
|
+
objectApply(object, function(value) {
|
|
809
|
+
values2.push(value);
|
|
810
|
+
});
|
|
811
|
+
return values2;
|
|
812
|
+
}
|
|
813
|
+
function apply(array, f, context) {
|
|
814
|
+
for (var i = 0; i < array.length; i++) {
|
|
815
|
+
f.call(context || window, array[i], i, array);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
function map(array, f) {
|
|
819
|
+
var result = [];
|
|
820
|
+
for (var i = 0; i < array.length; i++) {
|
|
821
|
+
result.push(f(array[i], i, array, result));
|
|
822
|
+
}
|
|
823
|
+
return result;
|
|
824
|
+
}
|
|
825
|
+
function mapObject(object, f) {
|
|
826
|
+
var result = {};
|
|
827
|
+
objectApply(object, function(value, key) {
|
|
828
|
+
result[key] = f(value);
|
|
829
|
+
});
|
|
830
|
+
return result;
|
|
831
|
+
}
|
|
832
|
+
function filter(array, test) {
|
|
833
|
+
test = test || function(value) {
|
|
834
|
+
return !!value;
|
|
835
|
+
};
|
|
836
|
+
var result = [];
|
|
837
|
+
for (var i = 0; i < array.length; i++) {
|
|
838
|
+
if (test(array[i], i, array, result)) {
|
|
839
|
+
result.push(array[i]);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return result;
|
|
843
|
+
}
|
|
844
|
+
function filterObject(object, test) {
|
|
845
|
+
var result = {};
|
|
846
|
+
objectApply(object, function(value, key) {
|
|
847
|
+
if (test && test(value, key, object, result) || Boolean(value)) {
|
|
848
|
+
result[key] = value;
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
return result;
|
|
852
|
+
}
|
|
853
|
+
function flatten(object) {
|
|
854
|
+
var result = [];
|
|
855
|
+
objectApply(object, function(value, key) {
|
|
856
|
+
result.push([key, value]);
|
|
857
|
+
});
|
|
858
|
+
return result;
|
|
859
|
+
}
|
|
860
|
+
function any(array, test) {
|
|
861
|
+
for (var i = 0; i < array.length; i++) {
|
|
862
|
+
if (test(array[i], i, array)) {
|
|
863
|
+
return true;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return false;
|
|
867
|
+
}
|
|
868
|
+
function collections_all(array, test) {
|
|
869
|
+
for (var i = 0; i < array.length; i++) {
|
|
870
|
+
if (!test(array[i], i, array)) {
|
|
871
|
+
return false;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
return true;
|
|
875
|
+
}
|
|
876
|
+
function encodeParamsObject(data) {
|
|
877
|
+
return mapObject(data, function(value) {
|
|
878
|
+
if (typeof value === "object") {
|
|
879
|
+
value = safeJSONStringify(value);
|
|
880
|
+
}
|
|
881
|
+
return encodeURIComponent(encode(value.toString()));
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
function buildQueryString(data) {
|
|
885
|
+
var params = filterObject(data, function(value) {
|
|
886
|
+
return value !== void 0;
|
|
887
|
+
});
|
|
888
|
+
var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
|
|
889
|
+
return query;
|
|
890
|
+
}
|
|
891
|
+
function decycleObject(object) {
|
|
892
|
+
var objects = [], paths = [];
|
|
893
|
+
return function derez(value, path) {
|
|
894
|
+
var i, name, nu;
|
|
895
|
+
switch (typeof value) {
|
|
896
|
+
case "object":
|
|
897
|
+
if (!value) {
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
900
|
+
for (i = 0; i < objects.length; i += 1) {
|
|
901
|
+
if (objects[i] === value) {
|
|
902
|
+
return { $ref: paths[i] };
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
objects.push(value);
|
|
906
|
+
paths.push(path);
|
|
907
|
+
if (Object.prototype.toString.apply(value) === "[object Array]") {
|
|
908
|
+
nu = [];
|
|
909
|
+
for (i = 0; i < value.length; i += 1) {
|
|
910
|
+
nu[i] = derez(value[i], path + "[" + i + "]");
|
|
911
|
+
}
|
|
912
|
+
} else {
|
|
913
|
+
nu = {};
|
|
914
|
+
for (name in value) {
|
|
915
|
+
if (Object.prototype.hasOwnProperty.call(value, name)) {
|
|
916
|
+
nu[name] = derez(value[name], path + "[" + JSON.stringify(name) + "]");
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return nu;
|
|
921
|
+
case "number":
|
|
922
|
+
case "string":
|
|
923
|
+
case "boolean":
|
|
924
|
+
return value;
|
|
925
|
+
}
|
|
926
|
+
}(object, "$");
|
|
927
|
+
}
|
|
928
|
+
function safeJSONStringify(source) {
|
|
929
|
+
try {
|
|
930
|
+
return JSON.stringify(source);
|
|
931
|
+
} catch (e) {
|
|
932
|
+
return JSON.stringify(decycleObject(source));
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
class logger_Logger {
|
|
936
|
+
constructor() {
|
|
937
|
+
this.globalLog = (message) => {
|
|
938
|
+
if (window.console && window.console.log) {
|
|
939
|
+
window.console.log(message);
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
debug(...args) {
|
|
944
|
+
this.log(this.globalLog, args);
|
|
945
|
+
}
|
|
946
|
+
warn(...args) {
|
|
947
|
+
this.log(this.globalLogWarn, args);
|
|
948
|
+
}
|
|
949
|
+
error(...args) {
|
|
950
|
+
this.log(this.globalLogError, args);
|
|
951
|
+
}
|
|
952
|
+
globalLogWarn(message) {
|
|
953
|
+
if (window.console && window.console.warn) {
|
|
954
|
+
window.console.warn(message);
|
|
955
|
+
} else {
|
|
956
|
+
this.globalLog(message);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
globalLogError(message) {
|
|
960
|
+
if (window.console && window.console.error) {
|
|
961
|
+
window.console.error(message);
|
|
962
|
+
} else {
|
|
963
|
+
this.globalLogWarn(message);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
log(defaultLoggingFunction, ...args) {
|
|
967
|
+
var message = stringify.apply(this, arguments);
|
|
968
|
+
if (core_pusher.log) {
|
|
969
|
+
core_pusher.log(message);
|
|
970
|
+
} else if (core_pusher.logToConsole) {
|
|
971
|
+
const log = defaultLoggingFunction.bind(this);
|
|
972
|
+
log(message);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
var logger = new logger_Logger();
|
|
977
|
+
var jsonp = function(context, query, authOptions, authRequestType, callback) {
|
|
978
|
+
if (authOptions.headers !== void 0 || authOptions.headersProvider != null) {
|
|
979
|
+
logger.warn(`To send headers with the ${authRequestType.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
980
|
+
}
|
|
981
|
+
var callbackName = context.nextAuthCallbackID.toString();
|
|
982
|
+
context.nextAuthCallbackID++;
|
|
983
|
+
var document2 = context.getDocument();
|
|
984
|
+
var script = document2.createElement("script");
|
|
985
|
+
context.auth_callbacks[callbackName] = function(data) {
|
|
986
|
+
callback(null, data);
|
|
987
|
+
};
|
|
988
|
+
var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
|
|
989
|
+
script.src = authOptions.endpoint + "?callback=" + encodeURIComponent(callback_name) + "&" + query;
|
|
990
|
+
var head = document2.getElementsByTagName("head")[0] || document2.documentElement;
|
|
991
|
+
head.insertBefore(script, head.firstChild);
|
|
992
|
+
};
|
|
993
|
+
var jsonp_auth = jsonp;
|
|
994
|
+
class ScriptRequest {
|
|
995
|
+
constructor(src) {
|
|
996
|
+
this.src = src;
|
|
997
|
+
}
|
|
998
|
+
send(receiver) {
|
|
999
|
+
var self = this;
|
|
1000
|
+
var errorString = "Error loading " + self.src;
|
|
1001
|
+
self.script = document.createElement("script");
|
|
1002
|
+
self.script.id = receiver.id;
|
|
1003
|
+
self.script.src = self.src;
|
|
1004
|
+
self.script.type = "text/javascript";
|
|
1005
|
+
self.script.charset = "UTF-8";
|
|
1006
|
+
if (self.script.addEventListener) {
|
|
1007
|
+
self.script.onerror = function() {
|
|
1008
|
+
receiver.callback(errorString);
|
|
1009
|
+
};
|
|
1010
|
+
self.script.onload = function() {
|
|
1011
|
+
receiver.callback(null);
|
|
1012
|
+
};
|
|
1013
|
+
} else {
|
|
1014
|
+
self.script.onreadystatechange = function() {
|
|
1015
|
+
if (self.script.readyState === "loaded" || self.script.readyState === "complete") {
|
|
1016
|
+
receiver.callback(null);
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
if (self.script.async === void 0 && document.attachEvent && /opera/i.test(navigator.userAgent)) {
|
|
1021
|
+
self.errorScript = document.createElement("script");
|
|
1022
|
+
self.errorScript.id = receiver.id + "_error";
|
|
1023
|
+
self.errorScript.text = receiver.name + "('" + errorString + "');";
|
|
1024
|
+
self.script.async = self.errorScript.async = false;
|
|
1025
|
+
} else {
|
|
1026
|
+
self.script.async = true;
|
|
1027
|
+
}
|
|
1028
|
+
var head = document.getElementsByTagName("head")[0];
|
|
1029
|
+
head.insertBefore(self.script, head.firstChild);
|
|
1030
|
+
if (self.errorScript) {
|
|
1031
|
+
head.insertBefore(self.errorScript, self.script.nextSibling);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
cleanup() {
|
|
1035
|
+
if (this.script) {
|
|
1036
|
+
this.script.onload = this.script.onerror = null;
|
|
1037
|
+
this.script.onreadystatechange = null;
|
|
1038
|
+
}
|
|
1039
|
+
if (this.script && this.script.parentNode) {
|
|
1040
|
+
this.script.parentNode.removeChild(this.script);
|
|
1041
|
+
}
|
|
1042
|
+
if (this.errorScript && this.errorScript.parentNode) {
|
|
1043
|
+
this.errorScript.parentNode.removeChild(this.errorScript);
|
|
1044
|
+
}
|
|
1045
|
+
this.script = null;
|
|
1046
|
+
this.errorScript = null;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
class jsonp_request_JSONPRequest {
|
|
1050
|
+
constructor(url, data) {
|
|
1051
|
+
this.url = url;
|
|
1052
|
+
this.data = data;
|
|
1053
|
+
}
|
|
1054
|
+
send(receiver) {
|
|
1055
|
+
if (this.request) {
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
var query = buildQueryString(this.data);
|
|
1059
|
+
var url = this.url + "/" + receiver.number + "?" + query;
|
|
1060
|
+
this.request = runtime.createScriptRequest(url);
|
|
1061
|
+
this.request.send(receiver);
|
|
1062
|
+
}
|
|
1063
|
+
cleanup() {
|
|
1064
|
+
if (this.request) {
|
|
1065
|
+
this.request.cleanup();
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
var getAgent = function(sender, useTLS) {
|
|
1070
|
+
return function(data, callback) {
|
|
1071
|
+
var scheme = "http" + (useTLS ? "s" : "") + "://";
|
|
1072
|
+
var url = scheme + (sender.host || sender.options.host) + sender.options.path;
|
|
1073
|
+
var request = runtime.createJSONPRequest(url, data);
|
|
1074
|
+
var receiver = runtime.ScriptReceivers.create(function(error, result) {
|
|
1075
|
+
ScriptReceivers.remove(receiver);
|
|
1076
|
+
request.cleanup();
|
|
1077
|
+
if (result && result.host) {
|
|
1078
|
+
sender.host = result.host;
|
|
1079
|
+
}
|
|
1080
|
+
if (callback) {
|
|
1081
|
+
callback(error, result);
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
request.send(receiver);
|
|
1085
|
+
};
|
|
1086
|
+
};
|
|
1087
|
+
var jsonp_timeline_jsonp = {
|
|
1088
|
+
name: "jsonp",
|
|
1089
|
+
getAgent
|
|
1090
|
+
};
|
|
1091
|
+
var jsonp_timeline = jsonp_timeline_jsonp;
|
|
1092
|
+
function getGenericURL(baseScheme, params, path) {
|
|
1093
|
+
var scheme = baseScheme + (params.useTLS ? "s" : "");
|
|
1094
|
+
var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
|
|
1095
|
+
return scheme + "://" + host + path;
|
|
1096
|
+
}
|
|
1097
|
+
function getGenericPath(key, queryString) {
|
|
1098
|
+
var path = "/app/" + key;
|
|
1099
|
+
var query = "?protocol=" + defaults.PROTOCOL + "&client=js&version=" + defaults.VERSION + (queryString ? "&" + queryString : "");
|
|
1100
|
+
return path + query;
|
|
1101
|
+
}
|
|
1102
|
+
var ws = {
|
|
1103
|
+
getInitial: function(key, params) {
|
|
1104
|
+
var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
|
|
1105
|
+
return getGenericURL("ws", params, path);
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
var http = {
|
|
1109
|
+
getInitial: function(key, params) {
|
|
1110
|
+
var path = (params.httpPath || "/pusher") + getGenericPath(key);
|
|
1111
|
+
return getGenericURL("http", params, path);
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
var sockjs = {
|
|
1115
|
+
getInitial: function(key, params) {
|
|
1116
|
+
return getGenericURL("http", params, params.httpPath || "/pusher");
|
|
1117
|
+
},
|
|
1118
|
+
getPath: function(key, params) {
|
|
1119
|
+
return getGenericPath(key);
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
class callback_registry_CallbackRegistry {
|
|
1123
|
+
constructor() {
|
|
1124
|
+
this._callbacks = {};
|
|
1125
|
+
}
|
|
1126
|
+
get(name) {
|
|
1127
|
+
return this._callbacks[prefix(name)];
|
|
1128
|
+
}
|
|
1129
|
+
add(name, callback, context) {
|
|
1130
|
+
var prefixedEventName = prefix(name);
|
|
1131
|
+
this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
|
|
1132
|
+
this._callbacks[prefixedEventName].push({
|
|
1133
|
+
fn: callback,
|
|
1134
|
+
context
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
remove(name, callback, context) {
|
|
1138
|
+
if (!name && !callback && !context) {
|
|
1139
|
+
this._callbacks = {};
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
var names = name ? [prefix(name)] : keys(this._callbacks);
|
|
1143
|
+
if (callback || context) {
|
|
1144
|
+
this.removeCallback(names, callback, context);
|
|
1145
|
+
} else {
|
|
1146
|
+
this.removeAllCallbacks(names);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
removeCallback(names, callback, context) {
|
|
1150
|
+
apply(names, function(name) {
|
|
1151
|
+
this._callbacks[name] = filter(this._callbacks[name] || [], function(binding) {
|
|
1152
|
+
return callback && callback !== binding.fn || context && context !== binding.context;
|
|
1153
|
+
});
|
|
1154
|
+
if (this._callbacks[name].length === 0) {
|
|
1155
|
+
delete this._callbacks[name];
|
|
1156
|
+
}
|
|
1157
|
+
}, this);
|
|
1158
|
+
}
|
|
1159
|
+
removeAllCallbacks(names) {
|
|
1160
|
+
apply(names, function(name) {
|
|
1161
|
+
delete this._callbacks[name];
|
|
1162
|
+
}, this);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
function prefix(name) {
|
|
1166
|
+
return "_" + name;
|
|
1167
|
+
}
|
|
1168
|
+
class dispatcher_Dispatcher {
|
|
1169
|
+
constructor(failThrough) {
|
|
1170
|
+
this.callbacks = new callback_registry_CallbackRegistry();
|
|
1171
|
+
this.global_callbacks = [];
|
|
1172
|
+
this.failThrough = failThrough;
|
|
1173
|
+
}
|
|
1174
|
+
bind(eventName, callback, context) {
|
|
1175
|
+
this.callbacks.add(eventName, callback, context);
|
|
1176
|
+
return this;
|
|
1177
|
+
}
|
|
1178
|
+
bind_global(callback) {
|
|
1179
|
+
this.global_callbacks.push(callback);
|
|
1180
|
+
return this;
|
|
1181
|
+
}
|
|
1182
|
+
unbind(eventName, callback, context) {
|
|
1183
|
+
this.callbacks.remove(eventName, callback, context);
|
|
1184
|
+
return this;
|
|
1185
|
+
}
|
|
1186
|
+
unbind_global(callback) {
|
|
1187
|
+
if (!callback) {
|
|
1188
|
+
this.global_callbacks = [];
|
|
1189
|
+
return this;
|
|
1190
|
+
}
|
|
1191
|
+
this.global_callbacks = filter(this.global_callbacks || [], (c) => c !== callback);
|
|
1192
|
+
return this;
|
|
1193
|
+
}
|
|
1194
|
+
unbind_all() {
|
|
1195
|
+
this.unbind();
|
|
1196
|
+
this.unbind_global();
|
|
1197
|
+
return this;
|
|
1198
|
+
}
|
|
1199
|
+
emit(eventName, data, metadata) {
|
|
1200
|
+
for (var i = 0; i < this.global_callbacks.length; i++) {
|
|
1201
|
+
this.global_callbacks[i](eventName, data);
|
|
1202
|
+
}
|
|
1203
|
+
var callbacks = this.callbacks.get(eventName);
|
|
1204
|
+
var args = [];
|
|
1205
|
+
if (metadata) {
|
|
1206
|
+
args.push(data, metadata);
|
|
1207
|
+
} else if (data) {
|
|
1208
|
+
args.push(data);
|
|
1209
|
+
}
|
|
1210
|
+
if (callbacks && callbacks.length > 0) {
|
|
1211
|
+
for (var i = 0; i < callbacks.length; i++) {
|
|
1212
|
+
callbacks[i].fn.apply(callbacks[i].context || window, args);
|
|
1213
|
+
}
|
|
1214
|
+
} else if (this.failThrough) {
|
|
1215
|
+
this.failThrough(eventName, data);
|
|
1216
|
+
}
|
|
1217
|
+
return this;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
class transport_connection_TransportConnection extends dispatcher_Dispatcher {
|
|
1221
|
+
constructor(hooks, name, priority, key, options) {
|
|
1222
|
+
super();
|
|
1223
|
+
this.initialize = runtime.transportConnectionInitializer;
|
|
1224
|
+
this.hooks = hooks;
|
|
1225
|
+
this.name = name;
|
|
1226
|
+
this.priority = priority;
|
|
1227
|
+
this.key = key;
|
|
1228
|
+
this.options = options;
|
|
1229
|
+
this.state = "new";
|
|
1230
|
+
this.timeline = options.timeline;
|
|
1231
|
+
this.activityTimeout = options.activityTimeout;
|
|
1232
|
+
this.id = this.timeline.generateUniqueID();
|
|
1233
|
+
}
|
|
1234
|
+
handlesActivityChecks() {
|
|
1235
|
+
return Boolean(this.hooks.handlesActivityChecks);
|
|
1236
|
+
}
|
|
1237
|
+
supportsPing() {
|
|
1238
|
+
return Boolean(this.hooks.supportsPing);
|
|
1239
|
+
}
|
|
1240
|
+
connect() {
|
|
1241
|
+
if (this.socket || this.state !== "initialized") {
|
|
1242
|
+
return false;
|
|
1243
|
+
}
|
|
1244
|
+
var url = this.hooks.urls.getInitial(this.key, this.options);
|
|
1245
|
+
try {
|
|
1246
|
+
this.socket = this.hooks.getSocket(url, this.options);
|
|
1247
|
+
} catch (e) {
|
|
1248
|
+
util.defer(() => {
|
|
1249
|
+
this.onError(e);
|
|
1250
|
+
this.changeState("closed");
|
|
1251
|
+
});
|
|
1252
|
+
return false;
|
|
1253
|
+
}
|
|
1254
|
+
this.bindListeners();
|
|
1255
|
+
logger.debug("Connecting", { transport: this.name, url });
|
|
1256
|
+
this.changeState("connecting");
|
|
1257
|
+
return true;
|
|
1258
|
+
}
|
|
1259
|
+
close() {
|
|
1260
|
+
if (this.socket) {
|
|
1261
|
+
this.socket.close();
|
|
1262
|
+
return true;
|
|
1263
|
+
} else {
|
|
1264
|
+
return false;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
send(data) {
|
|
1268
|
+
if (this.state === "open") {
|
|
1269
|
+
util.defer(() => {
|
|
1270
|
+
if (this.socket) {
|
|
1271
|
+
this.socket.send(data);
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
return true;
|
|
1275
|
+
} else {
|
|
1276
|
+
return false;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
ping() {
|
|
1280
|
+
if (this.state === "open" && this.supportsPing()) {
|
|
1281
|
+
this.socket.ping();
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
onOpen() {
|
|
1285
|
+
if (this.hooks.beforeOpen) {
|
|
1286
|
+
this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
|
|
1287
|
+
}
|
|
1288
|
+
this.changeState("open");
|
|
1289
|
+
this.socket.onopen = void 0;
|
|
1290
|
+
}
|
|
1291
|
+
onError(error) {
|
|
1292
|
+
this.emit("error", { type: "WebSocketError", error });
|
|
1293
|
+
this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
|
|
1294
|
+
}
|
|
1295
|
+
onClose(closeEvent) {
|
|
1296
|
+
if (closeEvent) {
|
|
1297
|
+
this.changeState("closed", {
|
|
1298
|
+
code: closeEvent.code,
|
|
1299
|
+
reason: closeEvent.reason,
|
|
1300
|
+
wasClean: closeEvent.wasClean
|
|
1301
|
+
});
|
|
1302
|
+
} else {
|
|
1303
|
+
this.changeState("closed");
|
|
1304
|
+
}
|
|
1305
|
+
this.unbindListeners();
|
|
1306
|
+
this.socket = void 0;
|
|
1307
|
+
}
|
|
1308
|
+
onMessage(message) {
|
|
1309
|
+
this.emit("message", message);
|
|
1310
|
+
}
|
|
1311
|
+
onActivity() {
|
|
1312
|
+
this.emit("activity");
|
|
1313
|
+
}
|
|
1314
|
+
bindListeners() {
|
|
1315
|
+
this.socket.onopen = () => {
|
|
1316
|
+
this.onOpen();
|
|
1317
|
+
};
|
|
1318
|
+
this.socket.onerror = (error) => {
|
|
1319
|
+
this.onError(error);
|
|
1320
|
+
};
|
|
1321
|
+
this.socket.onclose = (closeEvent) => {
|
|
1322
|
+
this.onClose(closeEvent);
|
|
1323
|
+
};
|
|
1324
|
+
this.socket.onmessage = (message) => {
|
|
1325
|
+
this.onMessage(message);
|
|
1326
|
+
};
|
|
1327
|
+
if (this.supportsPing()) {
|
|
1328
|
+
this.socket.onactivity = () => {
|
|
1329
|
+
this.onActivity();
|
|
1330
|
+
};
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
unbindListeners() {
|
|
1334
|
+
if (this.socket) {
|
|
1335
|
+
this.socket.onopen = void 0;
|
|
1336
|
+
this.socket.onerror = void 0;
|
|
1337
|
+
this.socket.onclose = void 0;
|
|
1338
|
+
this.socket.onmessage = void 0;
|
|
1339
|
+
if (this.supportsPing()) {
|
|
1340
|
+
this.socket.onactivity = void 0;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
changeState(state2, params) {
|
|
1345
|
+
this.state = state2;
|
|
1346
|
+
this.timeline.info(this.buildTimelineMessage({
|
|
1347
|
+
state: state2,
|
|
1348
|
+
params
|
|
1349
|
+
}));
|
|
1350
|
+
this.emit(state2, params);
|
|
1351
|
+
}
|
|
1352
|
+
buildTimelineMessage(message) {
|
|
1353
|
+
return extend({ cid: this.id }, message);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
class transport_Transport {
|
|
1357
|
+
constructor(hooks) {
|
|
1358
|
+
this.hooks = hooks;
|
|
1359
|
+
}
|
|
1360
|
+
isSupported(environment) {
|
|
1361
|
+
return this.hooks.isSupported(environment);
|
|
1362
|
+
}
|
|
1363
|
+
createConnection(name, priority, key, options) {
|
|
1364
|
+
return new transport_connection_TransportConnection(this.hooks, name, priority, key, options);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
var WSTransport = new transport_Transport({
|
|
1368
|
+
urls: ws,
|
|
1369
|
+
handlesActivityChecks: false,
|
|
1370
|
+
supportsPing: false,
|
|
1371
|
+
isInitialized: function() {
|
|
1372
|
+
return Boolean(runtime.getWebSocketAPI());
|
|
1373
|
+
},
|
|
1374
|
+
isSupported: function() {
|
|
1375
|
+
return Boolean(runtime.getWebSocketAPI());
|
|
1376
|
+
},
|
|
1377
|
+
getSocket: function(url) {
|
|
1378
|
+
return runtime.createWebSocket(url);
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
var httpConfiguration = {
|
|
1382
|
+
urls: http,
|
|
1383
|
+
handlesActivityChecks: false,
|
|
1384
|
+
supportsPing: true,
|
|
1385
|
+
isInitialized: function() {
|
|
1386
|
+
return true;
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
var streamingConfiguration = extend({
|
|
1390
|
+
getSocket: function(url) {
|
|
1391
|
+
return runtime.HTTPFactory.createStreamingSocket(url);
|
|
1392
|
+
}
|
|
1393
|
+
}, httpConfiguration);
|
|
1394
|
+
var pollingConfiguration = extend({
|
|
1395
|
+
getSocket: function(url) {
|
|
1396
|
+
return runtime.HTTPFactory.createPollingSocket(url);
|
|
1397
|
+
}
|
|
1398
|
+
}, httpConfiguration);
|
|
1399
|
+
var xhrConfiguration = {
|
|
1400
|
+
isSupported: function() {
|
|
1401
|
+
return runtime.isXHRSupported();
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
var XHRStreamingTransport = new transport_Transport(extend({}, streamingConfiguration, xhrConfiguration));
|
|
1405
|
+
var XHRPollingTransport = new transport_Transport(extend({}, pollingConfiguration, xhrConfiguration));
|
|
1406
|
+
var Transports = {
|
|
1407
|
+
ws: WSTransport,
|
|
1408
|
+
xhr_streaming: XHRStreamingTransport,
|
|
1409
|
+
xhr_polling: XHRPollingTransport
|
|
1410
|
+
};
|
|
1411
|
+
var transports = Transports;
|
|
1412
|
+
var SockJSTransport = new transport_Transport({
|
|
1413
|
+
file: "sockjs",
|
|
1414
|
+
urls: sockjs,
|
|
1415
|
+
handlesActivityChecks: true,
|
|
1416
|
+
supportsPing: false,
|
|
1417
|
+
isSupported: function() {
|
|
1418
|
+
return true;
|
|
1419
|
+
},
|
|
1420
|
+
isInitialized: function() {
|
|
1421
|
+
return window.SockJS !== void 0;
|
|
1422
|
+
},
|
|
1423
|
+
getSocket: function(url, options) {
|
|
1424
|
+
return new window.SockJS(url, null, {
|
|
1425
|
+
js_path: Dependencies.getPath("sockjs", {
|
|
1426
|
+
useTLS: options.useTLS
|
|
1427
|
+
}),
|
|
1428
|
+
ignore_null_origin: options.ignoreNullOrigin
|
|
1429
|
+
});
|
|
1430
|
+
},
|
|
1431
|
+
beforeOpen: function(socket, path) {
|
|
1432
|
+
socket.send(JSON.stringify({
|
|
1433
|
+
path
|
|
1434
|
+
}));
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
var xdrConfiguration = {
|
|
1438
|
+
isSupported: function(environment) {
|
|
1439
|
+
var yes = runtime.isXDRSupported(environment.useTLS);
|
|
1440
|
+
return yes;
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
var XDRStreamingTransport = new transport_Transport(extend({}, streamingConfiguration, xdrConfiguration));
|
|
1444
|
+
var XDRPollingTransport = new transport_Transport(extend({}, pollingConfiguration, xdrConfiguration));
|
|
1445
|
+
transports.xdr_streaming = XDRStreamingTransport;
|
|
1446
|
+
transports.xdr_polling = XDRPollingTransport;
|
|
1447
|
+
transports.sockjs = SockJSTransport;
|
|
1448
|
+
var transports_transports = transports;
|
|
1449
|
+
class net_info_NetInfo extends dispatcher_Dispatcher {
|
|
1450
|
+
constructor() {
|
|
1451
|
+
super();
|
|
1452
|
+
var self = this;
|
|
1453
|
+
if (window.addEventListener !== void 0) {
|
|
1454
|
+
window.addEventListener("online", function() {
|
|
1455
|
+
self.emit("online");
|
|
1456
|
+
}, false);
|
|
1457
|
+
window.addEventListener("offline", function() {
|
|
1458
|
+
self.emit("offline");
|
|
1459
|
+
}, false);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
isOnline() {
|
|
1463
|
+
if (window.navigator.onLine === void 0) {
|
|
1464
|
+
return true;
|
|
1465
|
+
} else {
|
|
1466
|
+
return window.navigator.onLine;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
var net_info_Network = new net_info_NetInfo();
|
|
1471
|
+
class assistant_to_the_transport_manager_AssistantToTheTransportManager {
|
|
1472
|
+
constructor(manager, transport, options) {
|
|
1473
|
+
this.manager = manager;
|
|
1474
|
+
this.transport = transport;
|
|
1475
|
+
this.minPingDelay = options.minPingDelay;
|
|
1476
|
+
this.maxPingDelay = options.maxPingDelay;
|
|
1477
|
+
this.pingDelay = void 0;
|
|
1478
|
+
}
|
|
1479
|
+
createConnection(name, priority, key, options) {
|
|
1480
|
+
options = extend({}, options, {
|
|
1481
|
+
activityTimeout: this.pingDelay
|
|
1482
|
+
});
|
|
1483
|
+
var connection = this.transport.createConnection(name, priority, key, options);
|
|
1484
|
+
var openTimestamp = null;
|
|
1485
|
+
var onOpen = function() {
|
|
1486
|
+
connection.unbind("open", onOpen);
|
|
1487
|
+
connection.bind("closed", onClosed);
|
|
1488
|
+
openTimestamp = util.now();
|
|
1489
|
+
};
|
|
1490
|
+
var onClosed = (closeEvent) => {
|
|
1491
|
+
connection.unbind("closed", onClosed);
|
|
1492
|
+
if (closeEvent.code === 1002 || closeEvent.code === 1003) {
|
|
1493
|
+
this.manager.reportDeath();
|
|
1494
|
+
} else if (!closeEvent.wasClean && openTimestamp) {
|
|
1495
|
+
var lifespan = util.now() - openTimestamp;
|
|
1496
|
+
if (lifespan < 2 * this.maxPingDelay) {
|
|
1497
|
+
this.manager.reportDeath();
|
|
1498
|
+
this.pingDelay = Math.max(lifespan / 2, this.minPingDelay);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
connection.bind("open", onOpen);
|
|
1503
|
+
return connection;
|
|
1504
|
+
}
|
|
1505
|
+
isSupported(environment) {
|
|
1506
|
+
return this.manager.isAlive() && this.transport.isSupported(environment);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
const Protocol = {
|
|
1510
|
+
decodeMessage: function(messageEvent) {
|
|
1511
|
+
try {
|
|
1512
|
+
var messageData = JSON.parse(messageEvent.data);
|
|
1513
|
+
var pusherEventData = messageData.data;
|
|
1514
|
+
if (typeof pusherEventData === "string") {
|
|
1515
|
+
try {
|
|
1516
|
+
pusherEventData = JSON.parse(messageData.data);
|
|
1517
|
+
} catch (e) {
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
var pusherEvent = {
|
|
1521
|
+
event: messageData.event,
|
|
1522
|
+
channel: messageData.channel,
|
|
1523
|
+
data: pusherEventData
|
|
1524
|
+
};
|
|
1525
|
+
if (messageData.user_id) {
|
|
1526
|
+
pusherEvent.user_id = messageData.user_id;
|
|
1527
|
+
}
|
|
1528
|
+
return pusherEvent;
|
|
1529
|
+
} catch (e) {
|
|
1530
|
+
throw { type: "MessageParseError", error: e, data: messageEvent.data };
|
|
1531
|
+
}
|
|
1532
|
+
},
|
|
1533
|
+
encodeMessage: function(event) {
|
|
1534
|
+
return JSON.stringify(event);
|
|
1535
|
+
},
|
|
1536
|
+
processHandshake: function(messageEvent) {
|
|
1537
|
+
var message = Protocol.decodeMessage(messageEvent);
|
|
1538
|
+
if (message.event === "pusher:connection_established") {
|
|
1539
|
+
if (!message.data.activity_timeout) {
|
|
1540
|
+
throw "No activity timeout specified in handshake";
|
|
1541
|
+
}
|
|
1542
|
+
return {
|
|
1543
|
+
action: "connected",
|
|
1544
|
+
id: message.data.socket_id,
|
|
1545
|
+
activityTimeout: message.data.activity_timeout * 1e3
|
|
1546
|
+
};
|
|
1547
|
+
} else if (message.event === "pusher:error") {
|
|
1548
|
+
return {
|
|
1549
|
+
action: this.getCloseAction(message.data),
|
|
1550
|
+
error: this.getCloseError(message.data)
|
|
1551
|
+
};
|
|
1552
|
+
} else {
|
|
1553
|
+
throw "Invalid handshake";
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
getCloseAction: function(closeEvent) {
|
|
1557
|
+
if (closeEvent.code < 4e3) {
|
|
1558
|
+
if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
|
|
1559
|
+
return "backoff";
|
|
1560
|
+
} else {
|
|
1561
|
+
return null;
|
|
1562
|
+
}
|
|
1563
|
+
} else if (closeEvent.code === 4e3) {
|
|
1564
|
+
return "tls_only";
|
|
1565
|
+
} else if (closeEvent.code < 4100) {
|
|
1566
|
+
return "refused";
|
|
1567
|
+
} else if (closeEvent.code < 4200) {
|
|
1568
|
+
return "backoff";
|
|
1569
|
+
} else if (closeEvent.code < 4300) {
|
|
1570
|
+
return "retry";
|
|
1571
|
+
} else {
|
|
1572
|
+
return "refused";
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
getCloseError: function(closeEvent) {
|
|
1576
|
+
if (closeEvent.code !== 1e3 && closeEvent.code !== 1001) {
|
|
1577
|
+
return {
|
|
1578
|
+
type: "PusherError",
|
|
1579
|
+
data: {
|
|
1580
|
+
code: closeEvent.code,
|
|
1581
|
+
message: closeEvent.reason || closeEvent.message
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
} else {
|
|
1585
|
+
return null;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
var protocol_protocol = Protocol;
|
|
1590
|
+
class connection_Connection extends dispatcher_Dispatcher {
|
|
1591
|
+
constructor(id, transport) {
|
|
1592
|
+
super();
|
|
1593
|
+
this.id = id;
|
|
1594
|
+
this.transport = transport;
|
|
1595
|
+
this.activityTimeout = transport.activityTimeout;
|
|
1596
|
+
this.bindListeners();
|
|
1597
|
+
}
|
|
1598
|
+
handlesActivityChecks() {
|
|
1599
|
+
return this.transport.handlesActivityChecks();
|
|
1600
|
+
}
|
|
1601
|
+
send(data) {
|
|
1602
|
+
return this.transport.send(data);
|
|
1603
|
+
}
|
|
1604
|
+
send_event(name, data, channel) {
|
|
1605
|
+
var event = { event: name, data };
|
|
1606
|
+
if (channel) {
|
|
1607
|
+
event.channel = channel;
|
|
1608
|
+
}
|
|
1609
|
+
logger.debug("Event sent", event);
|
|
1610
|
+
return this.send(protocol_protocol.encodeMessage(event));
|
|
1611
|
+
}
|
|
1612
|
+
ping() {
|
|
1613
|
+
if (this.transport.supportsPing()) {
|
|
1614
|
+
this.transport.ping();
|
|
1615
|
+
} else {
|
|
1616
|
+
this.send_event("pusher:ping", {});
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
close() {
|
|
1620
|
+
this.transport.close();
|
|
1621
|
+
}
|
|
1622
|
+
bindListeners() {
|
|
1623
|
+
var listeners = {
|
|
1624
|
+
message: (messageEvent) => {
|
|
1625
|
+
var pusherEvent;
|
|
1626
|
+
try {
|
|
1627
|
+
pusherEvent = protocol_protocol.decodeMessage(messageEvent);
|
|
1628
|
+
} catch (e) {
|
|
1629
|
+
this.emit("error", {
|
|
1630
|
+
type: "MessageParseError",
|
|
1631
|
+
error: e,
|
|
1632
|
+
data: messageEvent.data
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
if (pusherEvent !== void 0) {
|
|
1636
|
+
logger.debug("Event recd", pusherEvent);
|
|
1637
|
+
switch (pusherEvent.event) {
|
|
1638
|
+
case "pusher:error":
|
|
1639
|
+
this.emit("error", {
|
|
1640
|
+
type: "PusherError",
|
|
1641
|
+
data: pusherEvent.data
|
|
1642
|
+
});
|
|
1643
|
+
break;
|
|
1644
|
+
case "pusher:ping":
|
|
1645
|
+
this.emit("ping");
|
|
1646
|
+
break;
|
|
1647
|
+
case "pusher:pong":
|
|
1648
|
+
this.emit("pong");
|
|
1649
|
+
break;
|
|
1650
|
+
}
|
|
1651
|
+
this.emit("message", pusherEvent);
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
activity: () => {
|
|
1655
|
+
this.emit("activity");
|
|
1656
|
+
},
|
|
1657
|
+
error: (error) => {
|
|
1658
|
+
this.emit("error", error);
|
|
1659
|
+
},
|
|
1660
|
+
closed: (closeEvent) => {
|
|
1661
|
+
unbindListeners();
|
|
1662
|
+
if (closeEvent && closeEvent.code) {
|
|
1663
|
+
this.handleCloseEvent(closeEvent);
|
|
1664
|
+
}
|
|
1665
|
+
this.transport = null;
|
|
1666
|
+
this.emit("closed");
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1669
|
+
var unbindListeners = () => {
|
|
1670
|
+
objectApply(listeners, (listener, event) => {
|
|
1671
|
+
this.transport.unbind(event, listener);
|
|
1672
|
+
});
|
|
1673
|
+
};
|
|
1674
|
+
objectApply(listeners, (listener, event) => {
|
|
1675
|
+
this.transport.bind(event, listener);
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
handleCloseEvent(closeEvent) {
|
|
1679
|
+
var action = protocol_protocol.getCloseAction(closeEvent);
|
|
1680
|
+
var error = protocol_protocol.getCloseError(closeEvent);
|
|
1681
|
+
if (error) {
|
|
1682
|
+
this.emit("error", error);
|
|
1683
|
+
}
|
|
1684
|
+
if (action) {
|
|
1685
|
+
this.emit(action, { action, error });
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
class handshake_Handshake {
|
|
1690
|
+
constructor(transport, callback) {
|
|
1691
|
+
this.transport = transport;
|
|
1692
|
+
this.callback = callback;
|
|
1693
|
+
this.bindListeners();
|
|
1694
|
+
}
|
|
1695
|
+
close() {
|
|
1696
|
+
this.unbindListeners();
|
|
1697
|
+
this.transport.close();
|
|
1698
|
+
}
|
|
1699
|
+
bindListeners() {
|
|
1700
|
+
this.onMessage = (m) => {
|
|
1701
|
+
this.unbindListeners();
|
|
1702
|
+
var result;
|
|
1703
|
+
try {
|
|
1704
|
+
result = protocol_protocol.processHandshake(m);
|
|
1705
|
+
} catch (e) {
|
|
1706
|
+
this.finish("error", { error: e });
|
|
1707
|
+
this.transport.close();
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
if (result.action === "connected") {
|
|
1711
|
+
this.finish("connected", {
|
|
1712
|
+
connection: new connection_Connection(result.id, this.transport),
|
|
1713
|
+
activityTimeout: result.activityTimeout
|
|
1714
|
+
});
|
|
1715
|
+
} else {
|
|
1716
|
+
this.finish(result.action, { error: result.error });
|
|
1717
|
+
this.transport.close();
|
|
1718
|
+
}
|
|
1719
|
+
};
|
|
1720
|
+
this.onClosed = (closeEvent) => {
|
|
1721
|
+
this.unbindListeners();
|
|
1722
|
+
var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
|
|
1723
|
+
var error = protocol_protocol.getCloseError(closeEvent);
|
|
1724
|
+
this.finish(action, { error });
|
|
1725
|
+
};
|
|
1726
|
+
this.transport.bind("message", this.onMessage);
|
|
1727
|
+
this.transport.bind("closed", this.onClosed);
|
|
1728
|
+
}
|
|
1729
|
+
unbindListeners() {
|
|
1730
|
+
this.transport.unbind("message", this.onMessage);
|
|
1731
|
+
this.transport.unbind("closed", this.onClosed);
|
|
1732
|
+
}
|
|
1733
|
+
finish(action, params) {
|
|
1734
|
+
this.callback(extend({ transport: this.transport, action }, params));
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
class timeline_sender_TimelineSender {
|
|
1738
|
+
constructor(timeline, options) {
|
|
1739
|
+
this.timeline = timeline;
|
|
1740
|
+
this.options = options || {};
|
|
1741
|
+
}
|
|
1742
|
+
send(useTLS, callback) {
|
|
1743
|
+
if (this.timeline.isEmpty()) {
|
|
1744
|
+
return;
|
|
1745
|
+
}
|
|
1746
|
+
this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
class channel_Channel extends dispatcher_Dispatcher {
|
|
1750
|
+
constructor(name, pusher2) {
|
|
1751
|
+
super(function(event, data) {
|
|
1752
|
+
logger.debug("No callbacks on " + name + " for " + event);
|
|
1753
|
+
});
|
|
1754
|
+
this.name = name;
|
|
1755
|
+
this.pusher = pusher2;
|
|
1756
|
+
this.subscribed = false;
|
|
1757
|
+
this.subscriptionPending = false;
|
|
1758
|
+
this.subscriptionCancelled = false;
|
|
1759
|
+
}
|
|
1760
|
+
authorize(socketId, callback) {
|
|
1761
|
+
return callback(null, { auth: "" });
|
|
1762
|
+
}
|
|
1763
|
+
trigger(event, data) {
|
|
1764
|
+
if (event.indexOf("client-") !== 0) {
|
|
1765
|
+
throw new BadEventName("Event '" + event + "' does not start with 'client-'");
|
|
1766
|
+
}
|
|
1767
|
+
if (!this.subscribed) {
|
|
1768
|
+
var suffix = url_store.buildLogSuffix("triggeringClientEvents");
|
|
1769
|
+
logger.warn(`Client event triggered before channel 'subscription_succeeded' event . ${suffix}`);
|
|
1770
|
+
}
|
|
1771
|
+
return this.pusher.send_event(event, data, this.name);
|
|
1772
|
+
}
|
|
1773
|
+
disconnect() {
|
|
1774
|
+
this.subscribed = false;
|
|
1775
|
+
this.subscriptionPending = false;
|
|
1776
|
+
}
|
|
1777
|
+
handleEvent(event) {
|
|
1778
|
+
var eventName = event.event;
|
|
1779
|
+
var data = event.data;
|
|
1780
|
+
if (eventName === "pusher_internal:subscription_succeeded") {
|
|
1781
|
+
this.handleSubscriptionSucceededEvent(event);
|
|
1782
|
+
} else if (eventName === "pusher_internal:subscription_count") {
|
|
1783
|
+
this.handleSubscriptionCountEvent(event);
|
|
1784
|
+
} else if (eventName.indexOf("pusher_internal:") !== 0) {
|
|
1785
|
+
var metadata = {};
|
|
1786
|
+
this.emit(eventName, data, metadata);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
handleSubscriptionSucceededEvent(event) {
|
|
1790
|
+
this.subscriptionPending = false;
|
|
1791
|
+
this.subscribed = true;
|
|
1792
|
+
if (this.subscriptionCancelled) {
|
|
1793
|
+
this.pusher.unsubscribe(this.name);
|
|
1794
|
+
} else {
|
|
1795
|
+
this.emit("pusher:subscription_succeeded", event.data);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
handleSubscriptionCountEvent(event) {
|
|
1799
|
+
if (event.data.subscription_count) {
|
|
1800
|
+
this.subscriptionCount = event.data.subscription_count;
|
|
1801
|
+
}
|
|
1802
|
+
this.emit("pusher:subscription_count", event.data);
|
|
1803
|
+
}
|
|
1804
|
+
subscribe() {
|
|
1805
|
+
if (this.subscribed) {
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
this.subscriptionPending = true;
|
|
1809
|
+
this.subscriptionCancelled = false;
|
|
1810
|
+
this.authorize(this.pusher.connection.socket_id, (error, data) => {
|
|
1811
|
+
if (error) {
|
|
1812
|
+
this.subscriptionPending = false;
|
|
1813
|
+
logger.error(error.toString());
|
|
1814
|
+
this.emit("pusher:subscription_error", Object.assign({}, {
|
|
1815
|
+
type: "AuthError",
|
|
1816
|
+
error: error.message
|
|
1817
|
+
}, error instanceof HTTPAuthError ? { status: error.status } : {}));
|
|
1818
|
+
} else {
|
|
1819
|
+
this.pusher.send_event("pusher:subscribe", {
|
|
1820
|
+
auth: data.auth,
|
|
1821
|
+
channel_data: data.channel_data,
|
|
1822
|
+
channel: this.name
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
unsubscribe() {
|
|
1828
|
+
this.subscribed = false;
|
|
1829
|
+
this.pusher.send_event("pusher:unsubscribe", {
|
|
1830
|
+
channel: this.name
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
cancelSubscription() {
|
|
1834
|
+
this.subscriptionCancelled = true;
|
|
1835
|
+
}
|
|
1836
|
+
reinstateSubscription() {
|
|
1837
|
+
this.subscriptionCancelled = false;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
class private_channel_PrivateChannel extends channel_Channel {
|
|
1841
|
+
authorize(socketId, callback) {
|
|
1842
|
+
return this.pusher.config.channelAuthorizer({
|
|
1843
|
+
channelName: this.name,
|
|
1844
|
+
socketId
|
|
1845
|
+
}, callback);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
class members_Members {
|
|
1849
|
+
constructor() {
|
|
1850
|
+
this.reset();
|
|
1851
|
+
}
|
|
1852
|
+
get(id) {
|
|
1853
|
+
if (Object.prototype.hasOwnProperty.call(this.members, id)) {
|
|
1854
|
+
return {
|
|
1855
|
+
id,
|
|
1856
|
+
info: this.members[id]
|
|
1857
|
+
};
|
|
1858
|
+
} else {
|
|
1859
|
+
return null;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
each(callback) {
|
|
1863
|
+
objectApply(this.members, (member, id) => {
|
|
1864
|
+
callback(this.get(id));
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
setMyID(id) {
|
|
1868
|
+
this.myID = id;
|
|
1869
|
+
}
|
|
1870
|
+
onSubscription(subscriptionData) {
|
|
1871
|
+
this.members = subscriptionData.presence.hash;
|
|
1872
|
+
this.count = subscriptionData.presence.count;
|
|
1873
|
+
this.me = this.get(this.myID);
|
|
1874
|
+
}
|
|
1875
|
+
addMember(memberData) {
|
|
1876
|
+
if (this.get(memberData.user_id) === null) {
|
|
1877
|
+
this.count++;
|
|
1878
|
+
}
|
|
1879
|
+
this.members[memberData.user_id] = memberData.user_info;
|
|
1880
|
+
return this.get(memberData.user_id);
|
|
1881
|
+
}
|
|
1882
|
+
removeMember(memberData) {
|
|
1883
|
+
var member = this.get(memberData.user_id);
|
|
1884
|
+
if (member) {
|
|
1885
|
+
delete this.members[memberData.user_id];
|
|
1886
|
+
this.count--;
|
|
1887
|
+
}
|
|
1888
|
+
return member;
|
|
1889
|
+
}
|
|
1890
|
+
reset() {
|
|
1891
|
+
this.members = {};
|
|
1892
|
+
this.count = 0;
|
|
1893
|
+
this.myID = null;
|
|
1894
|
+
this.me = null;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
1898
|
+
function adopt(value) {
|
|
1899
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
1900
|
+
resolve(value);
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1904
|
+
function fulfilled(value) {
|
|
1905
|
+
try {
|
|
1906
|
+
step(generator.next(value));
|
|
1907
|
+
} catch (e) {
|
|
1908
|
+
reject(e);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
function rejected(value) {
|
|
1912
|
+
try {
|
|
1913
|
+
step(generator["throw"](value));
|
|
1914
|
+
} catch (e) {
|
|
1915
|
+
reject(e);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
function step(result) {
|
|
1919
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1920
|
+
}
|
|
1921
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1922
|
+
});
|
|
1923
|
+
};
|
|
1924
|
+
class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
|
|
1925
|
+
constructor(name, pusher2) {
|
|
1926
|
+
super(name, pusher2);
|
|
1927
|
+
this.members = new members_Members();
|
|
1928
|
+
}
|
|
1929
|
+
authorize(socketId, callback) {
|
|
1930
|
+
super.authorize(socketId, (error, authData) => __awaiter(this, void 0, void 0, function* () {
|
|
1931
|
+
if (!error) {
|
|
1932
|
+
authData = authData;
|
|
1933
|
+
if (authData.channel_data != null) {
|
|
1934
|
+
var channelData = JSON.parse(authData.channel_data);
|
|
1935
|
+
this.members.setMyID(channelData.user_id);
|
|
1936
|
+
} else {
|
|
1937
|
+
yield this.pusher.user.signinDonePromise;
|
|
1938
|
+
if (this.pusher.user.user_data != null) {
|
|
1939
|
+
this.members.setMyID(this.pusher.user.user_data.id);
|
|
1940
|
+
} else {
|
|
1941
|
+
let suffix = url_store.buildLogSuffix("authorizationEndpoint");
|
|
1942
|
+
logger.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${suffix}, or the user should be signed in.`);
|
|
1943
|
+
callback("Invalid auth response");
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
callback(error, authData);
|
|
1949
|
+
}));
|
|
1950
|
+
}
|
|
1951
|
+
handleEvent(event) {
|
|
1952
|
+
var eventName = event.event;
|
|
1953
|
+
if (eventName.indexOf("pusher_internal:") === 0) {
|
|
1954
|
+
this.handleInternalEvent(event);
|
|
1955
|
+
} else {
|
|
1956
|
+
var data = event.data;
|
|
1957
|
+
var metadata = {};
|
|
1958
|
+
if (event.user_id) {
|
|
1959
|
+
metadata.user_id = event.user_id;
|
|
1960
|
+
}
|
|
1961
|
+
this.emit(eventName, data, metadata);
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
handleInternalEvent(event) {
|
|
1965
|
+
var eventName = event.event;
|
|
1966
|
+
var data = event.data;
|
|
1967
|
+
switch (eventName) {
|
|
1968
|
+
case "pusher_internal:subscription_succeeded":
|
|
1969
|
+
this.handleSubscriptionSucceededEvent(event);
|
|
1970
|
+
break;
|
|
1971
|
+
case "pusher_internal:subscription_count":
|
|
1972
|
+
this.handleSubscriptionCountEvent(event);
|
|
1973
|
+
break;
|
|
1974
|
+
case "pusher_internal:member_added":
|
|
1975
|
+
var addedMember = this.members.addMember(data);
|
|
1976
|
+
this.emit("pusher:member_added", addedMember);
|
|
1977
|
+
break;
|
|
1978
|
+
case "pusher_internal:member_removed":
|
|
1979
|
+
var removedMember = this.members.removeMember(data);
|
|
1980
|
+
if (removedMember) {
|
|
1981
|
+
this.emit("pusher:member_removed", removedMember);
|
|
1982
|
+
}
|
|
1983
|
+
break;
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
handleSubscriptionSucceededEvent(event) {
|
|
1987
|
+
this.subscriptionPending = false;
|
|
1988
|
+
this.subscribed = true;
|
|
1989
|
+
if (this.subscriptionCancelled) {
|
|
1990
|
+
this.pusher.unsubscribe(this.name);
|
|
1991
|
+
} else {
|
|
1992
|
+
this.members.onSubscription(event.data);
|
|
1993
|
+
this.emit("pusher:subscription_succeeded", this.members);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
disconnect() {
|
|
1997
|
+
this.members.reset();
|
|
1998
|
+
super.disconnect();
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
var utf8 = __webpack_require__(1);
|
|
2002
|
+
var base64 = __webpack_require__(0);
|
|
2003
|
+
class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel {
|
|
2004
|
+
constructor(name, pusher2, nacl) {
|
|
2005
|
+
super(name, pusher2);
|
|
2006
|
+
this.key = null;
|
|
2007
|
+
this.nacl = nacl;
|
|
2008
|
+
}
|
|
2009
|
+
authorize(socketId, callback) {
|
|
2010
|
+
super.authorize(socketId, (error, authData) => {
|
|
2011
|
+
if (error) {
|
|
2012
|
+
callback(error, authData);
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
let sharedSecret = authData["shared_secret"];
|
|
2016
|
+
if (!sharedSecret) {
|
|
2017
|
+
callback(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2018
|
+
return;
|
|
2019
|
+
}
|
|
2020
|
+
this.key = Object(base64["decode"])(sharedSecret);
|
|
2021
|
+
delete authData["shared_secret"];
|
|
2022
|
+
callback(null, authData);
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
trigger(event, data) {
|
|
2026
|
+
throw new UnsupportedFeature("Client events are not currently supported for encrypted channels");
|
|
2027
|
+
}
|
|
2028
|
+
handleEvent(event) {
|
|
2029
|
+
var eventName = event.event;
|
|
2030
|
+
var data = event.data;
|
|
2031
|
+
if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
|
|
2032
|
+
super.handleEvent(event);
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
this.handleEncryptedEvent(eventName, data);
|
|
2036
|
+
}
|
|
2037
|
+
handleEncryptedEvent(event, data) {
|
|
2038
|
+
if (!this.key) {
|
|
2039
|
+
logger.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
if (!data.ciphertext || !data.nonce) {
|
|
2043
|
+
logger.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + data);
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
let cipherText = Object(base64["decode"])(data.ciphertext);
|
|
2047
|
+
if (cipherText.length < this.nacl.secretbox.overheadLength) {
|
|
2048
|
+
logger.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${cipherText.length}`);
|
|
2049
|
+
return;
|
|
2050
|
+
}
|
|
2051
|
+
let nonce = Object(base64["decode"])(data.nonce);
|
|
2052
|
+
if (nonce.length < this.nacl.secretbox.nonceLength) {
|
|
2053
|
+
logger.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${nonce.length}`);
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
let bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
|
|
2057
|
+
if (bytes === null) {
|
|
2058
|
+
logger.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...");
|
|
2059
|
+
this.authorize(this.pusher.connection.socket_id, (error, authData) => {
|
|
2060
|
+
if (error) {
|
|
2061
|
+
logger.error(`Failed to make a request to the authEndpoint: ${authData}. Unable to fetch new key, so dropping encrypted event`);
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
|
|
2065
|
+
if (bytes === null) {
|
|
2066
|
+
logger.error(`Failed to decrypt event with new key. Dropping encrypted event`);
|
|
2067
|
+
return;
|
|
2068
|
+
}
|
|
2069
|
+
this.emit(event, this.getDataToEmit(bytes));
|
|
2070
|
+
return;
|
|
2071
|
+
});
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
this.emit(event, this.getDataToEmit(bytes));
|
|
2075
|
+
}
|
|
2076
|
+
getDataToEmit(bytes) {
|
|
2077
|
+
let raw = Object(utf8["decode"])(bytes);
|
|
2078
|
+
try {
|
|
2079
|
+
return JSON.parse(raw);
|
|
2080
|
+
} catch (_a) {
|
|
2081
|
+
return raw;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
2086
|
+
constructor(key, options) {
|
|
2087
|
+
super();
|
|
2088
|
+
this.state = "initialized";
|
|
2089
|
+
this.connection = null;
|
|
2090
|
+
this.key = key;
|
|
2091
|
+
this.options = options;
|
|
2092
|
+
this.timeline = this.options.timeline;
|
|
2093
|
+
this.usingTLS = this.options.useTLS;
|
|
2094
|
+
this.errorCallbacks = this.buildErrorCallbacks();
|
|
2095
|
+
this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks);
|
|
2096
|
+
this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
2097
|
+
var Network = runtime.getNetwork();
|
|
2098
|
+
Network.bind("online", () => {
|
|
2099
|
+
this.timeline.info({ netinfo: "online" });
|
|
2100
|
+
if (this.state === "connecting" || this.state === "unavailable") {
|
|
2101
|
+
this.retryIn(0);
|
|
2102
|
+
}
|
|
2103
|
+
});
|
|
2104
|
+
Network.bind("offline", () => {
|
|
2105
|
+
this.timeline.info({ netinfo: "offline" });
|
|
2106
|
+
if (this.connection) {
|
|
2107
|
+
this.sendActivityCheck();
|
|
2108
|
+
}
|
|
2109
|
+
});
|
|
2110
|
+
this.updateStrategy();
|
|
2111
|
+
}
|
|
2112
|
+
switchCluster(key) {
|
|
2113
|
+
this.key = key;
|
|
2114
|
+
this.updateStrategy();
|
|
2115
|
+
this.retryIn(0);
|
|
2116
|
+
}
|
|
2117
|
+
connect() {
|
|
2118
|
+
if (this.connection || this.runner) {
|
|
2119
|
+
return;
|
|
2120
|
+
}
|
|
2121
|
+
if (!this.strategy.isSupported()) {
|
|
2122
|
+
this.updateState("failed");
|
|
2123
|
+
return;
|
|
2124
|
+
}
|
|
2125
|
+
this.updateState("connecting");
|
|
2126
|
+
this.startConnecting();
|
|
2127
|
+
this.setUnavailableTimer();
|
|
2128
|
+
}
|
|
2129
|
+
send(data) {
|
|
2130
|
+
if (this.connection) {
|
|
2131
|
+
return this.connection.send(data);
|
|
2132
|
+
} else {
|
|
2133
|
+
return false;
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
send_event(name, data, channel) {
|
|
2137
|
+
if (this.connection) {
|
|
2138
|
+
return this.connection.send_event(name, data, channel);
|
|
2139
|
+
} else {
|
|
2140
|
+
return false;
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
disconnect() {
|
|
2144
|
+
this.disconnectInternally();
|
|
2145
|
+
this.updateState("disconnected");
|
|
2146
|
+
}
|
|
2147
|
+
isUsingTLS() {
|
|
2148
|
+
return this.usingTLS;
|
|
2149
|
+
}
|
|
2150
|
+
startConnecting() {
|
|
2151
|
+
var callback = (error, handshake) => {
|
|
2152
|
+
if (error) {
|
|
2153
|
+
this.runner = this.strategy.connect(0, callback);
|
|
2154
|
+
} else {
|
|
2155
|
+
if (handshake.action === "error") {
|
|
2156
|
+
this.emit("error", {
|
|
2157
|
+
type: "HandshakeError",
|
|
2158
|
+
error: handshake.error
|
|
2159
|
+
});
|
|
2160
|
+
this.timeline.error({ handshakeError: handshake.error });
|
|
2161
|
+
} else {
|
|
2162
|
+
this.abortConnecting();
|
|
2163
|
+
this.handshakeCallbacks[handshake.action](handshake);
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
};
|
|
2167
|
+
this.runner = this.strategy.connect(0, callback);
|
|
2168
|
+
}
|
|
2169
|
+
abortConnecting() {
|
|
2170
|
+
if (this.runner) {
|
|
2171
|
+
this.runner.abort();
|
|
2172
|
+
this.runner = null;
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
disconnectInternally() {
|
|
2176
|
+
this.abortConnecting();
|
|
2177
|
+
this.clearRetryTimer();
|
|
2178
|
+
this.clearUnavailableTimer();
|
|
2179
|
+
if (this.connection) {
|
|
2180
|
+
var connection = this.abandonConnection();
|
|
2181
|
+
connection.close();
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
updateStrategy() {
|
|
2185
|
+
this.strategy = this.options.getStrategy({
|
|
2186
|
+
key: this.key,
|
|
2187
|
+
timeline: this.timeline,
|
|
2188
|
+
useTLS: this.usingTLS
|
|
2189
|
+
});
|
|
2190
|
+
}
|
|
2191
|
+
retryIn(delay) {
|
|
2192
|
+
this.timeline.info({ action: "retry", delay });
|
|
2193
|
+
if (delay > 0) {
|
|
2194
|
+
this.emit("connecting_in", Math.round(delay / 1e3));
|
|
2195
|
+
}
|
|
2196
|
+
this.retryTimer = new timers_OneOffTimer(delay || 0, () => {
|
|
2197
|
+
this.disconnectInternally();
|
|
2198
|
+
this.connect();
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
2201
|
+
clearRetryTimer() {
|
|
2202
|
+
if (this.retryTimer) {
|
|
2203
|
+
this.retryTimer.ensureAborted();
|
|
2204
|
+
this.retryTimer = null;
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
setUnavailableTimer() {
|
|
2208
|
+
this.unavailableTimer = new timers_OneOffTimer(this.options.unavailableTimeout, () => {
|
|
2209
|
+
this.updateState("unavailable");
|
|
2210
|
+
});
|
|
2211
|
+
}
|
|
2212
|
+
clearUnavailableTimer() {
|
|
2213
|
+
if (this.unavailableTimer) {
|
|
2214
|
+
this.unavailableTimer.ensureAborted();
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
sendActivityCheck() {
|
|
2218
|
+
this.stopActivityCheck();
|
|
2219
|
+
this.connection.ping();
|
|
2220
|
+
this.activityTimer = new timers_OneOffTimer(this.options.pongTimeout, () => {
|
|
2221
|
+
this.timeline.error({ pong_timed_out: this.options.pongTimeout });
|
|
2222
|
+
this.retryIn(0);
|
|
2223
|
+
});
|
|
2224
|
+
}
|
|
2225
|
+
resetActivityCheck() {
|
|
2226
|
+
this.stopActivityCheck();
|
|
2227
|
+
if (this.connection && !this.connection.handlesActivityChecks()) {
|
|
2228
|
+
this.activityTimer = new timers_OneOffTimer(this.activityTimeout, () => {
|
|
2229
|
+
this.sendActivityCheck();
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
stopActivityCheck() {
|
|
2234
|
+
if (this.activityTimer) {
|
|
2235
|
+
this.activityTimer.ensureAborted();
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
buildConnectionCallbacks(errorCallbacks) {
|
|
2239
|
+
return extend({}, errorCallbacks, {
|
|
2240
|
+
message: (message) => {
|
|
2241
|
+
this.resetActivityCheck();
|
|
2242
|
+
this.emit("message", message);
|
|
2243
|
+
},
|
|
2244
|
+
ping: () => {
|
|
2245
|
+
this.send_event("pusher:pong", {});
|
|
2246
|
+
},
|
|
2247
|
+
activity: () => {
|
|
2248
|
+
this.resetActivityCheck();
|
|
2249
|
+
},
|
|
2250
|
+
error: (error) => {
|
|
2251
|
+
this.emit("error", error);
|
|
2252
|
+
},
|
|
2253
|
+
closed: () => {
|
|
2254
|
+
this.abandonConnection();
|
|
2255
|
+
if (this.shouldRetry()) {
|
|
2256
|
+
this.retryIn(1e3);
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
buildHandshakeCallbacks(errorCallbacks) {
|
|
2262
|
+
return extend({}, errorCallbacks, {
|
|
2263
|
+
connected: (handshake) => {
|
|
2264
|
+
this.activityTimeout = Math.min(this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
|
|
2265
|
+
this.clearUnavailableTimer();
|
|
2266
|
+
this.setConnection(handshake.connection);
|
|
2267
|
+
this.socket_id = this.connection.id;
|
|
2268
|
+
this.updateState("connected", { socket_id: this.socket_id });
|
|
2269
|
+
}
|
|
2270
|
+
});
|
|
2271
|
+
}
|
|
2272
|
+
buildErrorCallbacks() {
|
|
2273
|
+
let withErrorEmitted = (callback) => {
|
|
2274
|
+
return (result) => {
|
|
2275
|
+
if (result.error) {
|
|
2276
|
+
this.emit("error", { type: "WebSocketError", error: result.error });
|
|
2277
|
+
}
|
|
2278
|
+
callback(result);
|
|
2279
|
+
};
|
|
2280
|
+
};
|
|
2281
|
+
return {
|
|
2282
|
+
tls_only: withErrorEmitted(() => {
|
|
2283
|
+
this.usingTLS = true;
|
|
2284
|
+
this.updateStrategy();
|
|
2285
|
+
this.retryIn(0);
|
|
2286
|
+
}),
|
|
2287
|
+
refused: withErrorEmitted(() => {
|
|
2288
|
+
this.disconnect();
|
|
2289
|
+
}),
|
|
2290
|
+
backoff: withErrorEmitted(() => {
|
|
2291
|
+
this.retryIn(1e3);
|
|
2292
|
+
}),
|
|
2293
|
+
retry: withErrorEmitted(() => {
|
|
2294
|
+
this.retryIn(0);
|
|
2295
|
+
})
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
setConnection(connection) {
|
|
2299
|
+
this.connection = connection;
|
|
2300
|
+
for (var event in this.connectionCallbacks) {
|
|
2301
|
+
this.connection.bind(event, this.connectionCallbacks[event]);
|
|
2302
|
+
}
|
|
2303
|
+
this.resetActivityCheck();
|
|
2304
|
+
}
|
|
2305
|
+
abandonConnection() {
|
|
2306
|
+
if (!this.connection) {
|
|
2307
|
+
return;
|
|
2308
|
+
}
|
|
2309
|
+
this.stopActivityCheck();
|
|
2310
|
+
for (var event in this.connectionCallbacks) {
|
|
2311
|
+
this.connection.unbind(event, this.connectionCallbacks[event]);
|
|
2312
|
+
}
|
|
2313
|
+
var connection = this.connection;
|
|
2314
|
+
this.connection = null;
|
|
2315
|
+
return connection;
|
|
2316
|
+
}
|
|
2317
|
+
updateState(newState, data) {
|
|
2318
|
+
var previousState = this.state;
|
|
2319
|
+
this.state = newState;
|
|
2320
|
+
if (previousState !== newState) {
|
|
2321
|
+
var newStateDescription = newState;
|
|
2322
|
+
if (newStateDescription === "connected") {
|
|
2323
|
+
newStateDescription += " with new socket ID " + data.socket_id;
|
|
2324
|
+
}
|
|
2325
|
+
logger.debug("State changed", previousState + " -> " + newStateDescription);
|
|
2326
|
+
this.timeline.info({ state: newState, params: data });
|
|
2327
|
+
this.emit("state_change", { previous: previousState, current: newState });
|
|
2328
|
+
this.emit(newState, data);
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
shouldRetry() {
|
|
2332
|
+
return this.state === "connecting" || this.state === "connected";
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
class channels_Channels {
|
|
2336
|
+
constructor() {
|
|
2337
|
+
this.channels = {};
|
|
2338
|
+
}
|
|
2339
|
+
add(name, pusher2) {
|
|
2340
|
+
if (!this.channels[name]) {
|
|
2341
|
+
this.channels[name] = createChannel(name, pusher2);
|
|
2342
|
+
}
|
|
2343
|
+
return this.channels[name];
|
|
2344
|
+
}
|
|
2345
|
+
all() {
|
|
2346
|
+
return values(this.channels);
|
|
2347
|
+
}
|
|
2348
|
+
find(name) {
|
|
2349
|
+
return this.channels[name];
|
|
2350
|
+
}
|
|
2351
|
+
remove(name) {
|
|
2352
|
+
var channel = this.channels[name];
|
|
2353
|
+
delete this.channels[name];
|
|
2354
|
+
return channel;
|
|
2355
|
+
}
|
|
2356
|
+
disconnect() {
|
|
2357
|
+
objectApply(this.channels, function(channel) {
|
|
2358
|
+
channel.disconnect();
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
function createChannel(name, pusher2) {
|
|
2363
|
+
if (name.indexOf("private-encrypted-") === 0) {
|
|
2364
|
+
if (pusher2.config.nacl) {
|
|
2365
|
+
return factory.createEncryptedChannel(name, pusher2, pusher2.config.nacl);
|
|
2366
|
+
}
|
|
2367
|
+
let errMsg = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available";
|
|
2368
|
+
let suffix = url_store.buildLogSuffix("encryptedChannelSupport");
|
|
2369
|
+
throw new UnsupportedFeature(`${errMsg}. ${suffix}`);
|
|
2370
|
+
} else if (name.indexOf("private-") === 0) {
|
|
2371
|
+
return factory.createPrivateChannel(name, pusher2);
|
|
2372
|
+
} else if (name.indexOf("presence-") === 0) {
|
|
2373
|
+
return factory.createPresenceChannel(name, pusher2);
|
|
2374
|
+
} else if (name.indexOf("#") === 0) {
|
|
2375
|
+
throw new BadChannelName('Cannot create a channel with name "' + name + '".');
|
|
2376
|
+
} else {
|
|
2377
|
+
return factory.createChannel(name, pusher2);
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
var Factory = {
|
|
2381
|
+
createChannels() {
|
|
2382
|
+
return new channels_Channels();
|
|
2383
|
+
},
|
|
2384
|
+
createConnectionManager(key, options) {
|
|
2385
|
+
return new connection_manager_ConnectionManager(key, options);
|
|
2386
|
+
},
|
|
2387
|
+
createChannel(name, pusher2) {
|
|
2388
|
+
return new channel_Channel(name, pusher2);
|
|
2389
|
+
},
|
|
2390
|
+
createPrivateChannel(name, pusher2) {
|
|
2391
|
+
return new private_channel_PrivateChannel(name, pusher2);
|
|
2392
|
+
},
|
|
2393
|
+
createPresenceChannel(name, pusher2) {
|
|
2394
|
+
return new presence_channel_PresenceChannel(name, pusher2);
|
|
2395
|
+
},
|
|
2396
|
+
createEncryptedChannel(name, pusher2, nacl) {
|
|
2397
|
+
return new encrypted_channel_EncryptedChannel(name, pusher2, nacl);
|
|
2398
|
+
},
|
|
2399
|
+
createTimelineSender(timeline, options) {
|
|
2400
|
+
return new timeline_sender_TimelineSender(timeline, options);
|
|
2401
|
+
},
|
|
2402
|
+
createHandshake(transport, callback) {
|
|
2403
|
+
return new handshake_Handshake(transport, callback);
|
|
2404
|
+
},
|
|
2405
|
+
createAssistantToTheTransportManager(manager, transport, options) {
|
|
2406
|
+
return new assistant_to_the_transport_manager_AssistantToTheTransportManager(manager, transport, options);
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
var factory = Factory;
|
|
2410
|
+
class transport_manager_TransportManager {
|
|
2411
|
+
constructor(options) {
|
|
2412
|
+
this.options = options || {};
|
|
2413
|
+
this.livesLeft = this.options.lives || Infinity;
|
|
2414
|
+
}
|
|
2415
|
+
getAssistant(transport) {
|
|
2416
|
+
return factory.createAssistantToTheTransportManager(this, transport, {
|
|
2417
|
+
minPingDelay: this.options.minPingDelay,
|
|
2418
|
+
maxPingDelay: this.options.maxPingDelay
|
|
2419
|
+
});
|
|
2420
|
+
}
|
|
2421
|
+
isAlive() {
|
|
2422
|
+
return this.livesLeft > 0;
|
|
2423
|
+
}
|
|
2424
|
+
reportDeath() {
|
|
2425
|
+
this.livesLeft -= 1;
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
class sequential_strategy_SequentialStrategy {
|
|
2429
|
+
constructor(strategies, options) {
|
|
2430
|
+
this.strategies = strategies;
|
|
2431
|
+
this.loop = Boolean(options.loop);
|
|
2432
|
+
this.failFast = Boolean(options.failFast);
|
|
2433
|
+
this.timeout = options.timeout;
|
|
2434
|
+
this.timeoutLimit = options.timeoutLimit;
|
|
2435
|
+
}
|
|
2436
|
+
isSupported() {
|
|
2437
|
+
return any(this.strategies, util.method("isSupported"));
|
|
2438
|
+
}
|
|
2439
|
+
connect(minPriority, callback) {
|
|
2440
|
+
var strategies = this.strategies;
|
|
2441
|
+
var current = 0;
|
|
2442
|
+
var timeout = this.timeout;
|
|
2443
|
+
var runner = null;
|
|
2444
|
+
var tryNextStrategy = (error, handshake) => {
|
|
2445
|
+
if (handshake) {
|
|
2446
|
+
callback(null, handshake);
|
|
2447
|
+
} else {
|
|
2448
|
+
current = current + 1;
|
|
2449
|
+
if (this.loop) {
|
|
2450
|
+
current = current % strategies.length;
|
|
2451
|
+
}
|
|
2452
|
+
if (current < strategies.length) {
|
|
2453
|
+
if (timeout) {
|
|
2454
|
+
timeout = timeout * 2;
|
|
2455
|
+
if (this.timeoutLimit) {
|
|
2456
|
+
timeout = Math.min(timeout, this.timeoutLimit);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
runner = this.tryStrategy(strategies[current], minPriority, { timeout, failFast: this.failFast }, tryNextStrategy);
|
|
2460
|
+
} else {
|
|
2461
|
+
callback(true);
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
};
|
|
2465
|
+
runner = this.tryStrategy(strategies[current], minPriority, { timeout, failFast: this.failFast }, tryNextStrategy);
|
|
2466
|
+
return {
|
|
2467
|
+
abort: function() {
|
|
2468
|
+
runner.abort();
|
|
2469
|
+
},
|
|
2470
|
+
forceMinPriority: function(p) {
|
|
2471
|
+
minPriority = p;
|
|
2472
|
+
if (runner) {
|
|
2473
|
+
runner.forceMinPriority(p);
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
};
|
|
2477
|
+
}
|
|
2478
|
+
tryStrategy(strategy, minPriority, options, callback) {
|
|
2479
|
+
var timer = null;
|
|
2480
|
+
var runner = null;
|
|
2481
|
+
if (options.timeout > 0) {
|
|
2482
|
+
timer = new timers_OneOffTimer(options.timeout, function() {
|
|
2483
|
+
runner.abort();
|
|
2484
|
+
callback(true);
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
runner = strategy.connect(minPriority, function(error, handshake) {
|
|
2488
|
+
if (error && timer && timer.isRunning() && !options.failFast) {
|
|
2489
|
+
return;
|
|
2490
|
+
}
|
|
2491
|
+
if (timer) {
|
|
2492
|
+
timer.ensureAborted();
|
|
2493
|
+
}
|
|
2494
|
+
callback(error, handshake);
|
|
2495
|
+
});
|
|
2496
|
+
return {
|
|
2497
|
+
abort: function() {
|
|
2498
|
+
if (timer) {
|
|
2499
|
+
timer.ensureAborted();
|
|
2500
|
+
}
|
|
2501
|
+
runner.abort();
|
|
2502
|
+
},
|
|
2503
|
+
forceMinPriority: function(p) {
|
|
2504
|
+
runner.forceMinPriority(p);
|
|
2505
|
+
}
|
|
2506
|
+
};
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
class best_connected_ever_strategy_BestConnectedEverStrategy {
|
|
2510
|
+
constructor(strategies) {
|
|
2511
|
+
this.strategies = strategies;
|
|
2512
|
+
}
|
|
2513
|
+
isSupported() {
|
|
2514
|
+
return any(this.strategies, util.method("isSupported"));
|
|
2515
|
+
}
|
|
2516
|
+
connect(minPriority, callback) {
|
|
2517
|
+
return connect(this.strategies, minPriority, function(i, runners) {
|
|
2518
|
+
return function(error, handshake) {
|
|
2519
|
+
runners[i].error = error;
|
|
2520
|
+
if (error) {
|
|
2521
|
+
if (allRunnersFailed(runners)) {
|
|
2522
|
+
callback(true);
|
|
2523
|
+
}
|
|
2524
|
+
return;
|
|
2525
|
+
}
|
|
2526
|
+
apply(runners, function(runner) {
|
|
2527
|
+
runner.forceMinPriority(handshake.transport.priority);
|
|
2528
|
+
});
|
|
2529
|
+
callback(null, handshake);
|
|
2530
|
+
};
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
function connect(strategies, minPriority, callbackBuilder) {
|
|
2535
|
+
var runners = map(strategies, function(strategy, i, _, rs) {
|
|
2536
|
+
return strategy.connect(minPriority, callbackBuilder(i, rs));
|
|
2537
|
+
});
|
|
2538
|
+
return {
|
|
2539
|
+
abort: function() {
|
|
2540
|
+
apply(runners, abortRunner);
|
|
2541
|
+
},
|
|
2542
|
+
forceMinPriority: function(p) {
|
|
2543
|
+
apply(runners, function(runner) {
|
|
2544
|
+
runner.forceMinPriority(p);
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
};
|
|
2548
|
+
}
|
|
2549
|
+
function allRunnersFailed(runners) {
|
|
2550
|
+
return collections_all(runners, function(runner) {
|
|
2551
|
+
return Boolean(runner.error);
|
|
2552
|
+
});
|
|
2553
|
+
}
|
|
2554
|
+
function abortRunner(runner) {
|
|
2555
|
+
if (!runner.error && !runner.aborted) {
|
|
2556
|
+
runner.abort();
|
|
2557
|
+
runner.aborted = true;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
class websocket_prioritized_cached_strategy_WebSocketPrioritizedCachedStrategy {
|
|
2561
|
+
constructor(strategy, transports2, options) {
|
|
2562
|
+
this.strategy = strategy;
|
|
2563
|
+
this.transports = transports2;
|
|
2564
|
+
this.ttl = options.ttl || 1800 * 1e3;
|
|
2565
|
+
this.usingTLS = options.useTLS;
|
|
2566
|
+
this.timeline = options.timeline;
|
|
2567
|
+
}
|
|
2568
|
+
isSupported() {
|
|
2569
|
+
return this.strategy.isSupported();
|
|
2570
|
+
}
|
|
2571
|
+
connect(minPriority, callback) {
|
|
2572
|
+
var usingTLS = this.usingTLS;
|
|
2573
|
+
var info = fetchTransportCache(usingTLS);
|
|
2574
|
+
var cacheSkipCount = info && info.cacheSkipCount ? info.cacheSkipCount : 0;
|
|
2575
|
+
var strategies = [this.strategy];
|
|
2576
|
+
if (info && info.timestamp + this.ttl >= util.now()) {
|
|
2577
|
+
var transport = this.transports[info.transport];
|
|
2578
|
+
if (transport) {
|
|
2579
|
+
if (["ws", "wss"].includes(info.transport) || cacheSkipCount > 3) {
|
|
2580
|
+
this.timeline.info({
|
|
2581
|
+
cached: true,
|
|
2582
|
+
transport: info.transport,
|
|
2583
|
+
latency: info.latency
|
|
2584
|
+
});
|
|
2585
|
+
strategies.push(new sequential_strategy_SequentialStrategy([transport], {
|
|
2586
|
+
timeout: info.latency * 2 + 1e3,
|
|
2587
|
+
failFast: true
|
|
2588
|
+
}));
|
|
2589
|
+
} else {
|
|
2590
|
+
cacheSkipCount++;
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
var startTimestamp = util.now();
|
|
2595
|
+
var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
|
|
2596
|
+
if (error) {
|
|
2597
|
+
flushTransportCache(usingTLS);
|
|
2598
|
+
if (strategies.length > 0) {
|
|
2599
|
+
startTimestamp = util.now();
|
|
2600
|
+
runner = strategies.pop().connect(minPriority, cb);
|
|
2601
|
+
} else {
|
|
2602
|
+
callback(error);
|
|
2603
|
+
}
|
|
2604
|
+
} else {
|
|
2605
|
+
storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp, cacheSkipCount);
|
|
2606
|
+
callback(null, handshake);
|
|
2607
|
+
}
|
|
2608
|
+
});
|
|
2609
|
+
return {
|
|
2610
|
+
abort: function() {
|
|
2611
|
+
runner.abort();
|
|
2612
|
+
},
|
|
2613
|
+
forceMinPriority: function(p) {
|
|
2614
|
+
minPriority = p;
|
|
2615
|
+
if (runner) {
|
|
2616
|
+
runner.forceMinPriority(p);
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
function getTransportCacheKey(usingTLS) {
|
|
2623
|
+
return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
|
|
2624
|
+
}
|
|
2625
|
+
function fetchTransportCache(usingTLS) {
|
|
2626
|
+
var storage = runtime.getLocalStorage();
|
|
2627
|
+
if (storage) {
|
|
2628
|
+
try {
|
|
2629
|
+
var serializedCache = storage[getTransportCacheKey(usingTLS)];
|
|
2630
|
+
if (serializedCache) {
|
|
2631
|
+
return JSON.parse(serializedCache);
|
|
2632
|
+
}
|
|
2633
|
+
} catch (e) {
|
|
2634
|
+
flushTransportCache(usingTLS);
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
return null;
|
|
2638
|
+
}
|
|
2639
|
+
function storeTransportCache(usingTLS, transport, latency, cacheSkipCount) {
|
|
2640
|
+
var storage = runtime.getLocalStorage();
|
|
2641
|
+
if (storage) {
|
|
2642
|
+
try {
|
|
2643
|
+
storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
|
|
2644
|
+
timestamp: util.now(),
|
|
2645
|
+
transport,
|
|
2646
|
+
latency,
|
|
2647
|
+
cacheSkipCount
|
|
2648
|
+
});
|
|
2649
|
+
} catch (e) {
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
function flushTransportCache(usingTLS) {
|
|
2654
|
+
var storage = runtime.getLocalStorage();
|
|
2655
|
+
if (storage) {
|
|
2656
|
+
try {
|
|
2657
|
+
delete storage[getTransportCacheKey(usingTLS)];
|
|
2658
|
+
} catch (e) {
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
class delayed_strategy_DelayedStrategy {
|
|
2663
|
+
constructor(strategy, { delay: number }) {
|
|
2664
|
+
this.strategy = strategy;
|
|
2665
|
+
this.options = { delay: number };
|
|
2666
|
+
}
|
|
2667
|
+
isSupported() {
|
|
2668
|
+
return this.strategy.isSupported();
|
|
2669
|
+
}
|
|
2670
|
+
connect(minPriority, callback) {
|
|
2671
|
+
var strategy = this.strategy;
|
|
2672
|
+
var runner;
|
|
2673
|
+
var timer = new timers_OneOffTimer(this.options.delay, function() {
|
|
2674
|
+
runner = strategy.connect(minPriority, callback);
|
|
2675
|
+
});
|
|
2676
|
+
return {
|
|
2677
|
+
abort: function() {
|
|
2678
|
+
timer.ensureAborted();
|
|
2679
|
+
if (runner) {
|
|
2680
|
+
runner.abort();
|
|
2681
|
+
}
|
|
2682
|
+
},
|
|
2683
|
+
forceMinPriority: function(p) {
|
|
2684
|
+
minPriority = p;
|
|
2685
|
+
if (runner) {
|
|
2686
|
+
runner.forceMinPriority(p);
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
class IfStrategy {
|
|
2693
|
+
constructor(test, trueBranch, falseBranch) {
|
|
2694
|
+
this.test = test;
|
|
2695
|
+
this.trueBranch = trueBranch;
|
|
2696
|
+
this.falseBranch = falseBranch;
|
|
2697
|
+
}
|
|
2698
|
+
isSupported() {
|
|
2699
|
+
var branch = this.test() ? this.trueBranch : this.falseBranch;
|
|
2700
|
+
return branch.isSupported();
|
|
2701
|
+
}
|
|
2702
|
+
connect(minPriority, callback) {
|
|
2703
|
+
var branch = this.test() ? this.trueBranch : this.falseBranch;
|
|
2704
|
+
return branch.connect(minPriority, callback);
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
class FirstConnectedStrategy {
|
|
2708
|
+
constructor(strategy) {
|
|
2709
|
+
this.strategy = strategy;
|
|
2710
|
+
}
|
|
2711
|
+
isSupported() {
|
|
2712
|
+
return this.strategy.isSupported();
|
|
2713
|
+
}
|
|
2714
|
+
connect(minPriority, callback) {
|
|
2715
|
+
var runner = this.strategy.connect(minPriority, function(error, handshake) {
|
|
2716
|
+
if (handshake) {
|
|
2717
|
+
runner.abort();
|
|
2718
|
+
}
|
|
2719
|
+
callback(error, handshake);
|
|
2720
|
+
});
|
|
2721
|
+
return runner;
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
function testSupportsStrategy(strategy) {
|
|
2725
|
+
return function() {
|
|
2726
|
+
return strategy.isSupported();
|
|
2727
|
+
};
|
|
2728
|
+
}
|
|
2729
|
+
var getDefaultStrategy = function(config, baseOptions, defineTransport) {
|
|
2730
|
+
var definedTransports = {};
|
|
2731
|
+
function defineTransportStrategy(name, type, priority, options, manager) {
|
|
2732
|
+
var transport = defineTransport(config, name, type, priority, options, manager);
|
|
2733
|
+
definedTransports[name] = transport;
|
|
2734
|
+
return transport;
|
|
2735
|
+
}
|
|
2736
|
+
var ws_options = Object.assign({}, baseOptions, {
|
|
2737
|
+
hostNonTLS: config.wsHost + ":" + config.wsPort,
|
|
2738
|
+
hostTLS: config.wsHost + ":" + config.wssPort,
|
|
2739
|
+
httpPath: config.wsPath
|
|
2740
|
+
});
|
|
2741
|
+
var wss_options = Object.assign({}, ws_options, {
|
|
2742
|
+
useTLS: true
|
|
2743
|
+
});
|
|
2744
|
+
var sockjs_options = Object.assign({}, baseOptions, {
|
|
2745
|
+
hostNonTLS: config.httpHost + ":" + config.httpPort,
|
|
2746
|
+
hostTLS: config.httpHost + ":" + config.httpsPort,
|
|
2747
|
+
httpPath: config.httpPath
|
|
2748
|
+
});
|
|
2749
|
+
var timeouts = {
|
|
2750
|
+
loop: true,
|
|
2751
|
+
timeout: 15e3,
|
|
2752
|
+
timeoutLimit: 6e4
|
|
2753
|
+
};
|
|
2754
|
+
var ws_manager = new transport_manager_TransportManager({
|
|
2755
|
+
minPingDelay: 1e4,
|
|
2756
|
+
maxPingDelay: config.activityTimeout
|
|
2757
|
+
});
|
|
2758
|
+
var streaming_manager = new transport_manager_TransportManager({
|
|
2759
|
+
lives: 2,
|
|
2760
|
+
minPingDelay: 1e4,
|
|
2761
|
+
maxPingDelay: config.activityTimeout
|
|
2762
|
+
});
|
|
2763
|
+
var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
|
|
2764
|
+
var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
|
|
2765
|
+
var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
|
|
2766
|
+
var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
|
|
2767
|
+
var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
|
|
2768
|
+
var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
|
|
2769
|
+
var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
|
|
2770
|
+
var ws_loop = new sequential_strategy_SequentialStrategy([ws_transport], timeouts);
|
|
2771
|
+
var wss_loop = new sequential_strategy_SequentialStrategy([wss_transport], timeouts);
|
|
2772
|
+
var sockjs_loop = new sequential_strategy_SequentialStrategy([sockjs_transport], timeouts);
|
|
2773
|
+
var streaming_loop = new sequential_strategy_SequentialStrategy([
|
|
2774
|
+
new IfStrategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)
|
|
2775
|
+
], timeouts);
|
|
2776
|
+
var polling_loop = new sequential_strategy_SequentialStrategy([
|
|
2777
|
+
new IfStrategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)
|
|
2778
|
+
], timeouts);
|
|
2779
|
+
var http_loop = new sequential_strategy_SequentialStrategy([
|
|
2780
|
+
new IfStrategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy_BestConnectedEverStrategy([
|
|
2781
|
+
streaming_loop,
|
|
2782
|
+
new delayed_strategy_DelayedStrategy(polling_loop, { delay: 4e3 })
|
|
2783
|
+
]), polling_loop)
|
|
2784
|
+
], timeouts);
|
|
2785
|
+
var http_fallback_loop = new IfStrategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
|
|
2786
|
+
var wsStrategy;
|
|
2787
|
+
if (baseOptions.useTLS) {
|
|
2788
|
+
wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
|
|
2789
|
+
ws_loop,
|
|
2790
|
+
new delayed_strategy_DelayedStrategy(http_fallback_loop, { delay: 2e3 })
|
|
2791
|
+
]);
|
|
2792
|
+
} else {
|
|
2793
|
+
wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
|
|
2794
|
+
ws_loop,
|
|
2795
|
+
new delayed_strategy_DelayedStrategy(wss_loop, { delay: 2e3 }),
|
|
2796
|
+
new delayed_strategy_DelayedStrategy(http_fallback_loop, { delay: 5e3 })
|
|
2797
|
+
]);
|
|
2798
|
+
}
|
|
2799
|
+
return new websocket_prioritized_cached_strategy_WebSocketPrioritizedCachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
|
|
2800
|
+
ttl: 18e5,
|
|
2801
|
+
timeline: baseOptions.timeline,
|
|
2802
|
+
useTLS: baseOptions.useTLS
|
|
2803
|
+
});
|
|
2804
|
+
};
|
|
2805
|
+
var default_strategy = getDefaultStrategy;
|
|
2806
|
+
var transport_connection_initializer = function() {
|
|
2807
|
+
var self = this;
|
|
2808
|
+
self.timeline.info(self.buildTimelineMessage({
|
|
2809
|
+
transport: self.name + (self.options.useTLS ? "s" : "")
|
|
2810
|
+
}));
|
|
2811
|
+
if (self.hooks.isInitialized()) {
|
|
2812
|
+
self.changeState("initialized");
|
|
2813
|
+
} else if (self.hooks.file) {
|
|
2814
|
+
self.changeState("initializing");
|
|
2815
|
+
Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function(error, callback) {
|
|
2816
|
+
if (self.hooks.isInitialized()) {
|
|
2817
|
+
self.changeState("initialized");
|
|
2818
|
+
callback(true);
|
|
2819
|
+
} else {
|
|
2820
|
+
if (error) {
|
|
2821
|
+
self.onError(error);
|
|
2822
|
+
}
|
|
2823
|
+
self.onClose();
|
|
2824
|
+
callback(false);
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
} else {
|
|
2828
|
+
self.onClose();
|
|
2829
|
+
}
|
|
2830
|
+
};
|
|
2831
|
+
var http_xdomain_request_hooks = {
|
|
2832
|
+
getRequest: function(socket) {
|
|
2833
|
+
var xdr = new window.XDomainRequest();
|
|
2834
|
+
xdr.ontimeout = function() {
|
|
2835
|
+
socket.emit("error", new RequestTimedOut());
|
|
2836
|
+
socket.close();
|
|
2837
|
+
};
|
|
2838
|
+
xdr.onerror = function(e) {
|
|
2839
|
+
socket.emit("error", e);
|
|
2840
|
+
socket.close();
|
|
2841
|
+
};
|
|
2842
|
+
xdr.onprogress = function() {
|
|
2843
|
+
if (xdr.responseText && xdr.responseText.length > 0) {
|
|
2844
|
+
socket.onChunk(200, xdr.responseText);
|
|
2845
|
+
}
|
|
2846
|
+
};
|
|
2847
|
+
xdr.onload = function() {
|
|
2848
|
+
if (xdr.responseText && xdr.responseText.length > 0) {
|
|
2849
|
+
socket.onChunk(200, xdr.responseText);
|
|
2850
|
+
}
|
|
2851
|
+
socket.emit("finished", 200);
|
|
2852
|
+
socket.close();
|
|
2853
|
+
};
|
|
2854
|
+
return xdr;
|
|
2855
|
+
},
|
|
2856
|
+
abortRequest: function(xdr) {
|
|
2857
|
+
xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
|
|
2858
|
+
xdr.abort();
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
var http_xdomain_request = http_xdomain_request_hooks;
|
|
2862
|
+
const MAX_BUFFER_LENGTH = 256 * 1024;
|
|
2863
|
+
class http_request_HTTPRequest extends dispatcher_Dispatcher {
|
|
2864
|
+
constructor(hooks, method, url) {
|
|
2865
|
+
super();
|
|
2866
|
+
this.hooks = hooks;
|
|
2867
|
+
this.method = method;
|
|
2868
|
+
this.url = url;
|
|
2869
|
+
}
|
|
2870
|
+
start(payload) {
|
|
2871
|
+
this.position = 0;
|
|
2872
|
+
this.xhr = this.hooks.getRequest(this);
|
|
2873
|
+
this.unloader = () => {
|
|
2874
|
+
this.close();
|
|
2875
|
+
};
|
|
2876
|
+
runtime.addUnloadListener(this.unloader);
|
|
2877
|
+
this.xhr.open(this.method, this.url, true);
|
|
2878
|
+
if (this.xhr.setRequestHeader) {
|
|
2879
|
+
this.xhr.setRequestHeader("Content-Type", "application/json");
|
|
2880
|
+
}
|
|
2881
|
+
this.xhr.send(payload);
|
|
2882
|
+
}
|
|
2883
|
+
close() {
|
|
2884
|
+
if (this.unloader) {
|
|
2885
|
+
runtime.removeUnloadListener(this.unloader);
|
|
2886
|
+
this.unloader = null;
|
|
2887
|
+
}
|
|
2888
|
+
if (this.xhr) {
|
|
2889
|
+
this.hooks.abortRequest(this.xhr);
|
|
2890
|
+
this.xhr = null;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
onChunk(status, data) {
|
|
2894
|
+
while (true) {
|
|
2895
|
+
var chunk = this.advanceBuffer(data);
|
|
2896
|
+
if (chunk) {
|
|
2897
|
+
this.emit("chunk", { status, data: chunk });
|
|
2898
|
+
} else {
|
|
2899
|
+
break;
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
if (this.isBufferTooLong(data)) {
|
|
2903
|
+
this.emit("buffer_too_long");
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
advanceBuffer(buffer) {
|
|
2907
|
+
var unreadData = buffer.slice(this.position);
|
|
2908
|
+
var endOfLinePosition = unreadData.indexOf("\n");
|
|
2909
|
+
if (endOfLinePosition !== -1) {
|
|
2910
|
+
this.position += endOfLinePosition + 1;
|
|
2911
|
+
return unreadData.slice(0, endOfLinePosition);
|
|
2912
|
+
} else {
|
|
2913
|
+
return null;
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
isBufferTooLong(buffer) {
|
|
2917
|
+
return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
var State;
|
|
2921
|
+
(function(State2) {
|
|
2922
|
+
State2[State2["CONNECTING"] = 0] = "CONNECTING";
|
|
2923
|
+
State2[State2["OPEN"] = 1] = "OPEN";
|
|
2924
|
+
State2[State2["CLOSED"] = 3] = "CLOSED";
|
|
2925
|
+
})(State || (State = {}));
|
|
2926
|
+
var state = State;
|
|
2927
|
+
var autoIncrement = 1;
|
|
2928
|
+
class http_socket_HTTPSocket {
|
|
2929
|
+
constructor(hooks, url) {
|
|
2930
|
+
this.hooks = hooks;
|
|
2931
|
+
this.session = randomNumber(1e3) + "/" + randomString(8);
|
|
2932
|
+
this.location = getLocation(url);
|
|
2933
|
+
this.readyState = state.CONNECTING;
|
|
2934
|
+
this.openStream();
|
|
2935
|
+
}
|
|
2936
|
+
send(payload) {
|
|
2937
|
+
return this.sendRaw(JSON.stringify([payload]));
|
|
2938
|
+
}
|
|
2939
|
+
ping() {
|
|
2940
|
+
this.hooks.sendHeartbeat(this);
|
|
2941
|
+
}
|
|
2942
|
+
close(code, reason) {
|
|
2943
|
+
this.onClose(code, reason, true);
|
|
2944
|
+
}
|
|
2945
|
+
sendRaw(payload) {
|
|
2946
|
+
if (this.readyState === state.OPEN) {
|
|
2947
|
+
try {
|
|
2948
|
+
runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
|
|
2949
|
+
return true;
|
|
2950
|
+
} catch (e) {
|
|
2951
|
+
return false;
|
|
2952
|
+
}
|
|
2953
|
+
} else {
|
|
2954
|
+
return false;
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
reconnect() {
|
|
2958
|
+
this.closeStream();
|
|
2959
|
+
this.openStream();
|
|
2960
|
+
}
|
|
2961
|
+
onClose(code, reason, wasClean) {
|
|
2962
|
+
this.closeStream();
|
|
2963
|
+
this.readyState = state.CLOSED;
|
|
2964
|
+
if (this.onclose) {
|
|
2965
|
+
this.onclose({
|
|
2966
|
+
code,
|
|
2967
|
+
reason,
|
|
2968
|
+
wasClean
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
onChunk(chunk) {
|
|
2973
|
+
if (chunk.status !== 200) {
|
|
2974
|
+
return;
|
|
2975
|
+
}
|
|
2976
|
+
if (this.readyState === state.OPEN) {
|
|
2977
|
+
this.onActivity();
|
|
2978
|
+
}
|
|
2979
|
+
var payload;
|
|
2980
|
+
var type = chunk.data.slice(0, 1);
|
|
2981
|
+
switch (type) {
|
|
2982
|
+
case "o":
|
|
2983
|
+
payload = JSON.parse(chunk.data.slice(1) || "{}");
|
|
2984
|
+
this.onOpen(payload);
|
|
2985
|
+
break;
|
|
2986
|
+
case "a":
|
|
2987
|
+
payload = JSON.parse(chunk.data.slice(1) || "[]");
|
|
2988
|
+
for (var i = 0; i < payload.length; i++) {
|
|
2989
|
+
this.onEvent(payload[i]);
|
|
2990
|
+
}
|
|
2991
|
+
break;
|
|
2992
|
+
case "m":
|
|
2993
|
+
payload = JSON.parse(chunk.data.slice(1) || "null");
|
|
2994
|
+
this.onEvent(payload);
|
|
2995
|
+
break;
|
|
2996
|
+
case "h":
|
|
2997
|
+
this.hooks.onHeartbeat(this);
|
|
2998
|
+
break;
|
|
2999
|
+
case "c":
|
|
3000
|
+
payload = JSON.parse(chunk.data.slice(1) || "[]");
|
|
3001
|
+
this.onClose(payload[0], payload[1], true);
|
|
3002
|
+
break;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
onOpen(options) {
|
|
3006
|
+
if (this.readyState === state.CONNECTING) {
|
|
3007
|
+
if (options && options.hostname) {
|
|
3008
|
+
this.location.base = replaceHost(this.location.base, options.hostname);
|
|
3009
|
+
}
|
|
3010
|
+
this.readyState = state.OPEN;
|
|
3011
|
+
if (this.onopen) {
|
|
3012
|
+
this.onopen();
|
|
3013
|
+
}
|
|
3014
|
+
} else {
|
|
3015
|
+
this.onClose(1006, "Server lost session", true);
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
onEvent(event) {
|
|
3019
|
+
if (this.readyState === state.OPEN && this.onmessage) {
|
|
3020
|
+
this.onmessage({ data: event });
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
onActivity() {
|
|
3024
|
+
if (this.onactivity) {
|
|
3025
|
+
this.onactivity();
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
onError(error) {
|
|
3029
|
+
if (this.onerror) {
|
|
3030
|
+
this.onerror(error);
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
openStream() {
|
|
3034
|
+
this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
|
|
3035
|
+
this.stream.bind("chunk", (chunk) => {
|
|
3036
|
+
this.onChunk(chunk);
|
|
3037
|
+
});
|
|
3038
|
+
this.stream.bind("finished", (status) => {
|
|
3039
|
+
this.hooks.onFinished(this, status);
|
|
3040
|
+
});
|
|
3041
|
+
this.stream.bind("buffer_too_long", () => {
|
|
3042
|
+
this.reconnect();
|
|
3043
|
+
});
|
|
3044
|
+
try {
|
|
3045
|
+
this.stream.start();
|
|
3046
|
+
} catch (error) {
|
|
3047
|
+
util.defer(() => {
|
|
3048
|
+
this.onError(error);
|
|
3049
|
+
this.onClose(1006, "Could not start streaming", false);
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
closeStream() {
|
|
3054
|
+
if (this.stream) {
|
|
3055
|
+
this.stream.unbind_all();
|
|
3056
|
+
this.stream.close();
|
|
3057
|
+
this.stream = null;
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
function getLocation(url) {
|
|
3062
|
+
var parts = /([^\?]*)\/*(\??.*)/.exec(url);
|
|
3063
|
+
return {
|
|
3064
|
+
base: parts[1],
|
|
3065
|
+
queryString: parts[2]
|
|
3066
|
+
};
|
|
3067
|
+
}
|
|
3068
|
+
function getSendURL(url, session) {
|
|
3069
|
+
return url.base + "/" + session + "/xhr_send";
|
|
3070
|
+
}
|
|
3071
|
+
function getUniqueURL(url) {
|
|
3072
|
+
var separator = url.indexOf("?") === -1 ? "?" : "&";
|
|
3073
|
+
return url + separator + "t=" + +/* @__PURE__ */ new Date() + "&n=" + autoIncrement++;
|
|
3074
|
+
}
|
|
3075
|
+
function replaceHost(url, hostname) {
|
|
3076
|
+
var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
|
|
3077
|
+
return urlParts[1] + hostname + urlParts[3];
|
|
3078
|
+
}
|
|
3079
|
+
function randomNumber(max) {
|
|
3080
|
+
return runtime.randomInt(max);
|
|
3081
|
+
}
|
|
3082
|
+
function randomString(length) {
|
|
3083
|
+
var result = [];
|
|
3084
|
+
for (var i = 0; i < length; i++) {
|
|
3085
|
+
result.push(randomNumber(32).toString(32));
|
|
3086
|
+
}
|
|
3087
|
+
return result.join("");
|
|
3088
|
+
}
|
|
3089
|
+
var http_socket = http_socket_HTTPSocket;
|
|
3090
|
+
var http_streaming_socket_hooks = {
|
|
3091
|
+
getReceiveURL: function(url, session) {
|
|
3092
|
+
return url.base + "/" + session + "/xhr_streaming" + url.queryString;
|
|
3093
|
+
},
|
|
3094
|
+
onHeartbeat: function(socket) {
|
|
3095
|
+
socket.sendRaw("[]");
|
|
3096
|
+
},
|
|
3097
|
+
sendHeartbeat: function(socket) {
|
|
3098
|
+
socket.sendRaw("[]");
|
|
3099
|
+
},
|
|
3100
|
+
onFinished: function(socket, status) {
|
|
3101
|
+
socket.onClose(1006, "Connection interrupted (" + status + ")", false);
|
|
3102
|
+
}
|
|
3103
|
+
};
|
|
3104
|
+
var http_streaming_socket = http_streaming_socket_hooks;
|
|
3105
|
+
var http_polling_socket_hooks = {
|
|
3106
|
+
getReceiveURL: function(url, session) {
|
|
3107
|
+
return url.base + "/" + session + "/xhr" + url.queryString;
|
|
3108
|
+
},
|
|
3109
|
+
onHeartbeat: function() {
|
|
3110
|
+
},
|
|
3111
|
+
sendHeartbeat: function(socket) {
|
|
3112
|
+
socket.sendRaw("[]");
|
|
3113
|
+
},
|
|
3114
|
+
onFinished: function(socket, status) {
|
|
3115
|
+
if (status === 200) {
|
|
3116
|
+
socket.reconnect();
|
|
3117
|
+
} else {
|
|
3118
|
+
socket.onClose(1006, "Connection interrupted (" + status + ")", false);
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
};
|
|
3122
|
+
var http_polling_socket = http_polling_socket_hooks;
|
|
3123
|
+
var http_xhr_request_hooks = {
|
|
3124
|
+
getRequest: function(socket) {
|
|
3125
|
+
var Constructor = runtime.getXHRAPI();
|
|
3126
|
+
var xhr = new Constructor();
|
|
3127
|
+
xhr.onreadystatechange = xhr.onprogress = function() {
|
|
3128
|
+
switch (xhr.readyState) {
|
|
3129
|
+
case 3:
|
|
3130
|
+
if (xhr.responseText && xhr.responseText.length > 0) {
|
|
3131
|
+
socket.onChunk(xhr.status, xhr.responseText);
|
|
3132
|
+
}
|
|
3133
|
+
break;
|
|
3134
|
+
case 4:
|
|
3135
|
+
if (xhr.responseText && xhr.responseText.length > 0) {
|
|
3136
|
+
socket.onChunk(xhr.status, xhr.responseText);
|
|
3137
|
+
}
|
|
3138
|
+
socket.emit("finished", xhr.status);
|
|
3139
|
+
socket.close();
|
|
3140
|
+
break;
|
|
3141
|
+
}
|
|
3142
|
+
};
|
|
3143
|
+
return xhr;
|
|
3144
|
+
},
|
|
3145
|
+
abortRequest: function(xhr) {
|
|
3146
|
+
xhr.onreadystatechange = null;
|
|
3147
|
+
xhr.abort();
|
|
3148
|
+
}
|
|
3149
|
+
};
|
|
3150
|
+
var http_xhr_request = http_xhr_request_hooks;
|
|
3151
|
+
var HTTP = {
|
|
3152
|
+
createStreamingSocket(url) {
|
|
3153
|
+
return this.createSocket(http_streaming_socket, url);
|
|
3154
|
+
},
|
|
3155
|
+
createPollingSocket(url) {
|
|
3156
|
+
return this.createSocket(http_polling_socket, url);
|
|
3157
|
+
},
|
|
3158
|
+
createSocket(hooks, url) {
|
|
3159
|
+
return new http_socket(hooks, url);
|
|
3160
|
+
},
|
|
3161
|
+
createXHR(method, url) {
|
|
3162
|
+
return this.createRequest(http_xhr_request, method, url);
|
|
3163
|
+
},
|
|
3164
|
+
createRequest(hooks, method, url) {
|
|
3165
|
+
return new http_request_HTTPRequest(hooks, method, url);
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3168
|
+
var http_http = HTTP;
|
|
3169
|
+
http_http.createXDR = function(method, url) {
|
|
3170
|
+
return this.createRequest(http_xdomain_request, method, url);
|
|
3171
|
+
};
|
|
3172
|
+
var web_http_http = http_http;
|
|
3173
|
+
var Runtime = {
|
|
3174
|
+
nextAuthCallbackID: 1,
|
|
3175
|
+
auth_callbacks: {},
|
|
3176
|
+
ScriptReceivers,
|
|
3177
|
+
DependenciesReceivers,
|
|
3178
|
+
getDefaultStrategy: default_strategy,
|
|
3179
|
+
Transports: transports_transports,
|
|
3180
|
+
transportConnectionInitializer: transport_connection_initializer,
|
|
3181
|
+
HTTPFactory: web_http_http,
|
|
3182
|
+
TimelineTransport: jsonp_timeline,
|
|
3183
|
+
getXHRAPI() {
|
|
3184
|
+
return window.XMLHttpRequest;
|
|
3185
|
+
},
|
|
3186
|
+
getWebSocketAPI() {
|
|
3187
|
+
return window.WebSocket || window.MozWebSocket;
|
|
3188
|
+
},
|
|
3189
|
+
setup(PusherClass) {
|
|
3190
|
+
window.Pusher = PusherClass;
|
|
3191
|
+
var initializeOnDocumentBody = () => {
|
|
3192
|
+
this.onDocumentBody(PusherClass.ready);
|
|
3193
|
+
};
|
|
3194
|
+
if (!window.JSON) {
|
|
3195
|
+
Dependencies.load("json2", {}, initializeOnDocumentBody);
|
|
3196
|
+
} else {
|
|
3197
|
+
initializeOnDocumentBody();
|
|
3198
|
+
}
|
|
3199
|
+
},
|
|
3200
|
+
getDocument() {
|
|
3201
|
+
return document;
|
|
3202
|
+
},
|
|
3203
|
+
getProtocol() {
|
|
3204
|
+
return this.getDocument().location.protocol;
|
|
3205
|
+
},
|
|
3206
|
+
getAuthorizers() {
|
|
3207
|
+
return { ajax: xhr_auth, jsonp: jsonp_auth };
|
|
3208
|
+
},
|
|
3209
|
+
onDocumentBody(callback) {
|
|
3210
|
+
if (document.body) {
|
|
3211
|
+
callback();
|
|
3212
|
+
} else {
|
|
3213
|
+
setTimeout(() => {
|
|
3214
|
+
this.onDocumentBody(callback);
|
|
3215
|
+
}, 0);
|
|
3216
|
+
}
|
|
3217
|
+
},
|
|
3218
|
+
createJSONPRequest(url, data) {
|
|
3219
|
+
return new jsonp_request_JSONPRequest(url, data);
|
|
3220
|
+
},
|
|
3221
|
+
createScriptRequest(src) {
|
|
3222
|
+
return new ScriptRequest(src);
|
|
3223
|
+
},
|
|
3224
|
+
getLocalStorage() {
|
|
3225
|
+
try {
|
|
3226
|
+
return window.localStorage;
|
|
3227
|
+
} catch (e) {
|
|
3228
|
+
return void 0;
|
|
3229
|
+
}
|
|
3230
|
+
},
|
|
3231
|
+
createXHR() {
|
|
3232
|
+
if (this.getXHRAPI()) {
|
|
3233
|
+
return this.createXMLHttpRequest();
|
|
3234
|
+
} else {
|
|
3235
|
+
return this.createMicrosoftXHR();
|
|
3236
|
+
}
|
|
3237
|
+
},
|
|
3238
|
+
createXMLHttpRequest() {
|
|
3239
|
+
var Constructor = this.getXHRAPI();
|
|
3240
|
+
return new Constructor();
|
|
3241
|
+
},
|
|
3242
|
+
createMicrosoftXHR() {
|
|
3243
|
+
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
3244
|
+
},
|
|
3245
|
+
getNetwork() {
|
|
3246
|
+
return net_info_Network;
|
|
3247
|
+
},
|
|
3248
|
+
createWebSocket(url) {
|
|
3249
|
+
var Constructor = this.getWebSocketAPI();
|
|
3250
|
+
return new Constructor(url);
|
|
3251
|
+
},
|
|
3252
|
+
createSocketRequest(method, url) {
|
|
3253
|
+
if (this.isXHRSupported()) {
|
|
3254
|
+
return this.HTTPFactory.createXHR(method, url);
|
|
3255
|
+
} else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
|
|
3256
|
+
return this.HTTPFactory.createXDR(method, url);
|
|
3257
|
+
} else {
|
|
3258
|
+
throw "Cross-origin HTTP requests are not supported";
|
|
3259
|
+
}
|
|
3260
|
+
},
|
|
3261
|
+
isXHRSupported() {
|
|
3262
|
+
var Constructor = this.getXHRAPI();
|
|
3263
|
+
return Boolean(Constructor) && new Constructor().withCredentials !== void 0;
|
|
3264
|
+
},
|
|
3265
|
+
isXDRSupported(useTLS) {
|
|
3266
|
+
var protocol = useTLS ? "https:" : "http:";
|
|
3267
|
+
var documentProtocol = this.getProtocol();
|
|
3268
|
+
return Boolean(window["XDomainRequest"]) && documentProtocol === protocol;
|
|
3269
|
+
},
|
|
3270
|
+
addUnloadListener(listener) {
|
|
3271
|
+
if (window.addEventListener !== void 0) {
|
|
3272
|
+
window.addEventListener("unload", listener, false);
|
|
3273
|
+
} else if (window.attachEvent !== void 0) {
|
|
3274
|
+
window.attachEvent("onunload", listener);
|
|
3275
|
+
}
|
|
3276
|
+
},
|
|
3277
|
+
removeUnloadListener(listener) {
|
|
3278
|
+
if (window.addEventListener !== void 0) {
|
|
3279
|
+
window.removeEventListener("unload", listener, false);
|
|
3280
|
+
} else if (window.detachEvent !== void 0) {
|
|
3281
|
+
window.detachEvent("onunload", listener);
|
|
3282
|
+
}
|
|
3283
|
+
},
|
|
3284
|
+
randomInt(max) {
|
|
3285
|
+
const random = function() {
|
|
3286
|
+
const crypto = window.crypto || window["msCrypto"];
|
|
3287
|
+
const random2 = crypto.getRandomValues(new Uint32Array(1))[0];
|
|
3288
|
+
return random2 / Math.pow(2, 32);
|
|
3289
|
+
};
|
|
3290
|
+
return Math.floor(random() * max);
|
|
3291
|
+
}
|
|
3292
|
+
};
|
|
3293
|
+
var runtime = Runtime;
|
|
3294
|
+
var TimelineLevel;
|
|
3295
|
+
(function(TimelineLevel2) {
|
|
3296
|
+
TimelineLevel2[TimelineLevel2["ERROR"] = 3] = "ERROR";
|
|
3297
|
+
TimelineLevel2[TimelineLevel2["INFO"] = 6] = "INFO";
|
|
3298
|
+
TimelineLevel2[TimelineLevel2["DEBUG"] = 7] = "DEBUG";
|
|
3299
|
+
})(TimelineLevel || (TimelineLevel = {}));
|
|
3300
|
+
var timeline_level = TimelineLevel;
|
|
3301
|
+
class timeline_Timeline {
|
|
3302
|
+
constructor(key, session, options) {
|
|
3303
|
+
this.key = key;
|
|
3304
|
+
this.session = session;
|
|
3305
|
+
this.events = [];
|
|
3306
|
+
this.options = options || {};
|
|
3307
|
+
this.sent = 0;
|
|
3308
|
+
this.uniqueID = 0;
|
|
3309
|
+
}
|
|
3310
|
+
log(level, event) {
|
|
3311
|
+
if (level <= this.options.level) {
|
|
3312
|
+
this.events.push(extend({}, event, { timestamp: util.now() }));
|
|
3313
|
+
if (this.options.limit && this.events.length > this.options.limit) {
|
|
3314
|
+
this.events.shift();
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
error(event) {
|
|
3319
|
+
this.log(timeline_level.ERROR, event);
|
|
3320
|
+
}
|
|
3321
|
+
info(event) {
|
|
3322
|
+
this.log(timeline_level.INFO, event);
|
|
3323
|
+
}
|
|
3324
|
+
debug(event) {
|
|
3325
|
+
this.log(timeline_level.DEBUG, event);
|
|
3326
|
+
}
|
|
3327
|
+
isEmpty() {
|
|
3328
|
+
return this.events.length === 0;
|
|
3329
|
+
}
|
|
3330
|
+
send(sendfn, callback) {
|
|
3331
|
+
var data = extend({
|
|
3332
|
+
session: this.session,
|
|
3333
|
+
bundle: this.sent + 1,
|
|
3334
|
+
key: this.key,
|
|
3335
|
+
lib: "js",
|
|
3336
|
+
version: this.options.version,
|
|
3337
|
+
cluster: this.options.cluster,
|
|
3338
|
+
features: this.options.features,
|
|
3339
|
+
timeline: this.events
|
|
3340
|
+
}, this.options.params);
|
|
3341
|
+
this.events = [];
|
|
3342
|
+
sendfn(data, (error, result) => {
|
|
3343
|
+
if (!error) {
|
|
3344
|
+
this.sent++;
|
|
3345
|
+
}
|
|
3346
|
+
if (callback) {
|
|
3347
|
+
callback(error, result);
|
|
3348
|
+
}
|
|
3349
|
+
});
|
|
3350
|
+
return true;
|
|
3351
|
+
}
|
|
3352
|
+
generateUniqueID() {
|
|
3353
|
+
this.uniqueID++;
|
|
3354
|
+
return this.uniqueID;
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
class transport_strategy_TransportStrategy {
|
|
3358
|
+
constructor(name, priority, transport, options) {
|
|
3359
|
+
this.name = name;
|
|
3360
|
+
this.priority = priority;
|
|
3361
|
+
this.transport = transport;
|
|
3362
|
+
this.options = options || {};
|
|
3363
|
+
}
|
|
3364
|
+
isSupported() {
|
|
3365
|
+
return this.transport.isSupported({
|
|
3366
|
+
useTLS: this.options.useTLS
|
|
3367
|
+
});
|
|
3368
|
+
}
|
|
3369
|
+
connect(minPriority, callback) {
|
|
3370
|
+
if (!this.isSupported()) {
|
|
3371
|
+
return failAttempt(new UnsupportedStrategy(), callback);
|
|
3372
|
+
} else if (this.priority < minPriority) {
|
|
3373
|
+
return failAttempt(new TransportPriorityTooLow(), callback);
|
|
3374
|
+
}
|
|
3375
|
+
var connected = false;
|
|
3376
|
+
var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
|
|
3377
|
+
var handshake = null;
|
|
3378
|
+
var onInitialized = function() {
|
|
3379
|
+
transport.unbind("initialized", onInitialized);
|
|
3380
|
+
transport.connect();
|
|
3381
|
+
};
|
|
3382
|
+
var onOpen = function() {
|
|
3383
|
+
handshake = factory.createHandshake(transport, function(result) {
|
|
3384
|
+
connected = true;
|
|
3385
|
+
unbindListeners();
|
|
3386
|
+
callback(null, result);
|
|
3387
|
+
});
|
|
3388
|
+
};
|
|
3389
|
+
var onError = function(error) {
|
|
3390
|
+
unbindListeners();
|
|
3391
|
+
callback(error);
|
|
3392
|
+
};
|
|
3393
|
+
var onClosed = function() {
|
|
3394
|
+
unbindListeners();
|
|
3395
|
+
var serializedTransport;
|
|
3396
|
+
serializedTransport = safeJSONStringify(transport);
|
|
3397
|
+
callback(new TransportClosed(serializedTransport));
|
|
3398
|
+
};
|
|
3399
|
+
var unbindListeners = function() {
|
|
3400
|
+
transport.unbind("initialized", onInitialized);
|
|
3401
|
+
transport.unbind("open", onOpen);
|
|
3402
|
+
transport.unbind("error", onError);
|
|
3403
|
+
transport.unbind("closed", onClosed);
|
|
3404
|
+
};
|
|
3405
|
+
transport.bind("initialized", onInitialized);
|
|
3406
|
+
transport.bind("open", onOpen);
|
|
3407
|
+
transport.bind("error", onError);
|
|
3408
|
+
transport.bind("closed", onClosed);
|
|
3409
|
+
transport.initialize();
|
|
3410
|
+
return {
|
|
3411
|
+
abort: () => {
|
|
3412
|
+
if (connected) {
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
unbindListeners();
|
|
3416
|
+
if (handshake) {
|
|
3417
|
+
handshake.close();
|
|
3418
|
+
} else {
|
|
3419
|
+
transport.close();
|
|
3420
|
+
}
|
|
3421
|
+
},
|
|
3422
|
+
forceMinPriority: (p) => {
|
|
3423
|
+
if (connected) {
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
if (this.priority < p) {
|
|
3427
|
+
if (handshake) {
|
|
3428
|
+
handshake.close();
|
|
3429
|
+
} else {
|
|
3430
|
+
transport.close();
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
};
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
function failAttempt(error, callback) {
|
|
3438
|
+
util.defer(function() {
|
|
3439
|
+
callback(error);
|
|
3440
|
+
});
|
|
3441
|
+
return {
|
|
3442
|
+
abort: function() {
|
|
3443
|
+
},
|
|
3444
|
+
forceMinPriority: function() {
|
|
3445
|
+
}
|
|
3446
|
+
};
|
|
3447
|
+
}
|
|
3448
|
+
const { Transports: strategy_builder_Transports } = runtime;
|
|
3449
|
+
var strategy_builder_defineTransport = function(config, name, type, priority, options, manager) {
|
|
3450
|
+
var transportClass = strategy_builder_Transports[type];
|
|
3451
|
+
if (!transportClass) {
|
|
3452
|
+
throw new UnsupportedTransport(type);
|
|
3453
|
+
}
|
|
3454
|
+
var enabled = (!config.enabledTransports || arrayIndexOf(config.enabledTransports, name) !== -1) && (!config.disabledTransports || arrayIndexOf(config.disabledTransports, name) === -1);
|
|
3455
|
+
var transport;
|
|
3456
|
+
if (enabled) {
|
|
3457
|
+
options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
|
|
3458
|
+
transport = new transport_strategy_TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
|
|
3459
|
+
} else {
|
|
3460
|
+
transport = strategy_builder_UnsupportedStrategy;
|
|
3461
|
+
}
|
|
3462
|
+
return transport;
|
|
3463
|
+
};
|
|
3464
|
+
var strategy_builder_UnsupportedStrategy = {
|
|
3465
|
+
isSupported: function() {
|
|
3466
|
+
return false;
|
|
3467
|
+
},
|
|
3468
|
+
connect: function(_, callback) {
|
|
3469
|
+
var deferred = util.defer(function() {
|
|
3470
|
+
callback(new UnsupportedStrategy());
|
|
3471
|
+
});
|
|
3472
|
+
return {
|
|
3473
|
+
abort: function() {
|
|
3474
|
+
deferred.ensureAborted();
|
|
3475
|
+
},
|
|
3476
|
+
forceMinPriority: function() {
|
|
3477
|
+
}
|
|
3478
|
+
};
|
|
3479
|
+
}
|
|
3480
|
+
};
|
|
3481
|
+
function validateOptions(options) {
|
|
3482
|
+
if (options == null) {
|
|
3483
|
+
throw "You must pass an options object";
|
|
3484
|
+
}
|
|
3485
|
+
if (options.cluster == null) {
|
|
3486
|
+
throw "Options object must provide a cluster";
|
|
3487
|
+
}
|
|
3488
|
+
if ("disableStats" in options) {
|
|
3489
|
+
logger.warn("The disableStats option is deprecated in favor of enableStats");
|
|
3490
|
+
}
|
|
3491
|
+
}
|
|
3492
|
+
const composeChannelQuery = (params, authOptions) => {
|
|
3493
|
+
var query = "socket_id=" + encodeURIComponent(params.socketId);
|
|
3494
|
+
for (var key in authOptions.params) {
|
|
3495
|
+
query += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(authOptions.params[key]);
|
|
3496
|
+
}
|
|
3497
|
+
if (authOptions.paramsProvider != null) {
|
|
3498
|
+
let dynamicParams = authOptions.paramsProvider();
|
|
3499
|
+
for (var key in dynamicParams) {
|
|
3500
|
+
query += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(dynamicParams[key]);
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
return query;
|
|
3504
|
+
};
|
|
3505
|
+
const UserAuthenticator = (authOptions) => {
|
|
3506
|
+
if (typeof runtime.getAuthorizers()[authOptions.transport] === "undefined") {
|
|
3507
|
+
throw `'${authOptions.transport}' is not a recognized auth transport`;
|
|
3508
|
+
}
|
|
3509
|
+
return (params, callback) => {
|
|
3510
|
+
const query = composeChannelQuery(params, authOptions);
|
|
3511
|
+
runtime.getAuthorizers()[authOptions.transport](runtime, query, authOptions, AuthRequestType.UserAuthentication, callback);
|
|
3512
|
+
};
|
|
3513
|
+
};
|
|
3514
|
+
var user_authenticator = UserAuthenticator;
|
|
3515
|
+
const channel_authorizer_composeChannelQuery = (params, authOptions) => {
|
|
3516
|
+
var query = "socket_id=" + encodeURIComponent(params.socketId);
|
|
3517
|
+
query += "&channel_name=" + encodeURIComponent(params.channelName);
|
|
3518
|
+
for (var key in authOptions.params) {
|
|
3519
|
+
query += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(authOptions.params[key]);
|
|
3520
|
+
}
|
|
3521
|
+
if (authOptions.paramsProvider != null) {
|
|
3522
|
+
let dynamicParams = authOptions.paramsProvider();
|
|
3523
|
+
for (var key in dynamicParams) {
|
|
3524
|
+
query += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(dynamicParams[key]);
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
return query;
|
|
3528
|
+
};
|
|
3529
|
+
const ChannelAuthorizer = (authOptions) => {
|
|
3530
|
+
if (typeof runtime.getAuthorizers()[authOptions.transport] === "undefined") {
|
|
3531
|
+
throw `'${authOptions.transport}' is not a recognized auth transport`;
|
|
3532
|
+
}
|
|
3533
|
+
return (params, callback) => {
|
|
3534
|
+
const query = channel_authorizer_composeChannelQuery(params, authOptions);
|
|
3535
|
+
runtime.getAuthorizers()[authOptions.transport](runtime, query, authOptions, AuthRequestType.ChannelAuthorization, callback);
|
|
3536
|
+
};
|
|
3537
|
+
};
|
|
3538
|
+
var channel_authorizer = ChannelAuthorizer;
|
|
3539
|
+
const ChannelAuthorizerProxy = (pusher2, authOptions, channelAuthorizerGenerator) => {
|
|
3540
|
+
const deprecatedAuthorizerOptions = {
|
|
3541
|
+
authTransport: authOptions.transport,
|
|
3542
|
+
authEndpoint: authOptions.endpoint,
|
|
3543
|
+
auth: {
|
|
3544
|
+
params: authOptions.params,
|
|
3545
|
+
headers: authOptions.headers
|
|
3546
|
+
}
|
|
3547
|
+
};
|
|
3548
|
+
return (params, callback) => {
|
|
3549
|
+
const channel = pusher2.channel(params.channelName);
|
|
3550
|
+
const channelAuthorizer = channelAuthorizerGenerator(channel, deprecatedAuthorizerOptions);
|
|
3551
|
+
channelAuthorizer.authorize(params.socketId, callback);
|
|
3552
|
+
};
|
|
3553
|
+
};
|
|
3554
|
+
function getConfig(opts, pusher2) {
|
|
3555
|
+
let config = {
|
|
3556
|
+
activityTimeout: opts.activityTimeout || defaults.activityTimeout,
|
|
3557
|
+
cluster: opts.cluster,
|
|
3558
|
+
httpPath: opts.httpPath || defaults.httpPath,
|
|
3559
|
+
httpPort: opts.httpPort || defaults.httpPort,
|
|
3560
|
+
httpsPort: opts.httpsPort || defaults.httpsPort,
|
|
3561
|
+
pongTimeout: opts.pongTimeout || defaults.pongTimeout,
|
|
3562
|
+
statsHost: opts.statsHost || defaults.stats_host,
|
|
3563
|
+
unavailableTimeout: opts.unavailableTimeout || defaults.unavailableTimeout,
|
|
3564
|
+
wsPath: opts.wsPath || defaults.wsPath,
|
|
3565
|
+
wsPort: opts.wsPort || defaults.wsPort,
|
|
3566
|
+
wssPort: opts.wssPort || defaults.wssPort,
|
|
3567
|
+
enableStats: getEnableStatsConfig(opts),
|
|
3568
|
+
httpHost: getHttpHost(opts),
|
|
3569
|
+
useTLS: shouldUseTLS(opts),
|
|
3570
|
+
wsHost: getWebsocketHost(opts),
|
|
3571
|
+
userAuthenticator: buildUserAuthenticator(opts),
|
|
3572
|
+
channelAuthorizer: buildChannelAuthorizer(opts, pusher2)
|
|
3573
|
+
};
|
|
3574
|
+
if ("disabledTransports" in opts)
|
|
3575
|
+
config.disabledTransports = opts.disabledTransports;
|
|
3576
|
+
if ("enabledTransports" in opts)
|
|
3577
|
+
config.enabledTransports = opts.enabledTransports;
|
|
3578
|
+
if ("ignoreNullOrigin" in opts)
|
|
3579
|
+
config.ignoreNullOrigin = opts.ignoreNullOrigin;
|
|
3580
|
+
if ("timelineParams" in opts)
|
|
3581
|
+
config.timelineParams = opts.timelineParams;
|
|
3582
|
+
if ("nacl" in opts) {
|
|
3583
|
+
config.nacl = opts.nacl;
|
|
3584
|
+
}
|
|
3585
|
+
return config;
|
|
3586
|
+
}
|
|
3587
|
+
function getHttpHost(opts) {
|
|
3588
|
+
if (opts.httpHost) {
|
|
3589
|
+
return opts.httpHost;
|
|
3590
|
+
}
|
|
3591
|
+
if (opts.cluster) {
|
|
3592
|
+
return `sockjs-${opts.cluster}.pusher.com`;
|
|
3593
|
+
}
|
|
3594
|
+
return defaults.httpHost;
|
|
3595
|
+
}
|
|
3596
|
+
function getWebsocketHost(opts) {
|
|
3597
|
+
if (opts.wsHost) {
|
|
3598
|
+
return opts.wsHost;
|
|
3599
|
+
}
|
|
3600
|
+
return getWebsocketHostFromCluster(opts.cluster);
|
|
3601
|
+
}
|
|
3602
|
+
function getWebsocketHostFromCluster(cluster) {
|
|
3603
|
+
return `ws-${cluster}.pusher.com`;
|
|
3604
|
+
}
|
|
3605
|
+
function shouldUseTLS(opts) {
|
|
3606
|
+
if (runtime.getProtocol() === "https:") {
|
|
3607
|
+
return true;
|
|
3608
|
+
} else if (opts.forceTLS === false) {
|
|
3609
|
+
return false;
|
|
3610
|
+
}
|
|
3611
|
+
return true;
|
|
3612
|
+
}
|
|
3613
|
+
function getEnableStatsConfig(opts) {
|
|
3614
|
+
if ("enableStats" in opts) {
|
|
3615
|
+
return opts.enableStats;
|
|
3616
|
+
}
|
|
3617
|
+
if ("disableStats" in opts) {
|
|
3618
|
+
return !opts.disableStats;
|
|
3619
|
+
}
|
|
3620
|
+
return false;
|
|
3621
|
+
}
|
|
3622
|
+
const hasCustomHandler = (auth) => {
|
|
3623
|
+
return "customHandler" in auth && auth["customHandler"] != null;
|
|
3624
|
+
};
|
|
3625
|
+
function buildUserAuthenticator(opts) {
|
|
3626
|
+
const userAuthentication = Object.assign(Object.assign({}, defaults.userAuthentication), opts.userAuthentication);
|
|
3627
|
+
if (hasCustomHandler(userAuthentication)) {
|
|
3628
|
+
return userAuthentication["customHandler"];
|
|
3629
|
+
}
|
|
3630
|
+
return user_authenticator(userAuthentication);
|
|
3631
|
+
}
|
|
3632
|
+
function buildChannelAuth(opts, pusher2) {
|
|
3633
|
+
let channelAuthorization;
|
|
3634
|
+
if ("channelAuthorization" in opts) {
|
|
3635
|
+
channelAuthorization = Object.assign(Object.assign({}, defaults.channelAuthorization), opts.channelAuthorization);
|
|
3636
|
+
} else {
|
|
3637
|
+
channelAuthorization = {
|
|
3638
|
+
transport: opts.authTransport || defaults.authTransport,
|
|
3639
|
+
endpoint: opts.authEndpoint || defaults.authEndpoint
|
|
3640
|
+
};
|
|
3641
|
+
if ("auth" in opts) {
|
|
3642
|
+
if ("params" in opts.auth)
|
|
3643
|
+
channelAuthorization.params = opts.auth.params;
|
|
3644
|
+
if ("headers" in opts.auth)
|
|
3645
|
+
channelAuthorization.headers = opts.auth.headers;
|
|
3646
|
+
}
|
|
3647
|
+
if ("authorizer" in opts) {
|
|
3648
|
+
return {
|
|
3649
|
+
customHandler: ChannelAuthorizerProxy(pusher2, channelAuthorization, opts.authorizer)
|
|
3650
|
+
};
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
return channelAuthorization;
|
|
3654
|
+
}
|
|
3655
|
+
function buildChannelAuthorizer(opts, pusher2) {
|
|
3656
|
+
const channelAuthorization = buildChannelAuth(opts, pusher2);
|
|
3657
|
+
if (hasCustomHandler(channelAuthorization)) {
|
|
3658
|
+
return channelAuthorization["customHandler"];
|
|
3659
|
+
}
|
|
3660
|
+
return channel_authorizer(channelAuthorization);
|
|
3661
|
+
}
|
|
3662
|
+
class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
|
|
3663
|
+
constructor(pusher2) {
|
|
3664
|
+
super(function(eventName, data) {
|
|
3665
|
+
logger.debug(`No callbacks on watchlist events for ${eventName}`);
|
|
3666
|
+
});
|
|
3667
|
+
this.pusher = pusher2;
|
|
3668
|
+
this.bindWatchlistInternalEvent();
|
|
3669
|
+
}
|
|
3670
|
+
handleEvent(pusherEvent) {
|
|
3671
|
+
pusherEvent.data.events.forEach((watchlistEvent) => {
|
|
3672
|
+
this.emit(watchlistEvent.name, watchlistEvent);
|
|
3673
|
+
});
|
|
3674
|
+
}
|
|
3675
|
+
bindWatchlistInternalEvent() {
|
|
3676
|
+
this.pusher.connection.bind("message", (pusherEvent) => {
|
|
3677
|
+
var eventName = pusherEvent.event;
|
|
3678
|
+
if (eventName === "pusher_internal:watchlist_events") {
|
|
3679
|
+
this.handleEvent(pusherEvent);
|
|
3680
|
+
}
|
|
3681
|
+
});
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
function flatPromise() {
|
|
3685
|
+
let resolve, reject;
|
|
3686
|
+
const promise = new Promise((res, rej) => {
|
|
3687
|
+
resolve = res;
|
|
3688
|
+
reject = rej;
|
|
3689
|
+
});
|
|
3690
|
+
return { promise, resolve, reject };
|
|
3691
|
+
}
|
|
3692
|
+
var flat_promise = flatPromise;
|
|
3693
|
+
class user_UserFacade extends dispatcher_Dispatcher {
|
|
3694
|
+
constructor(pusher2) {
|
|
3695
|
+
super(function(eventName, data) {
|
|
3696
|
+
logger.debug("No callbacks on user for " + eventName);
|
|
3697
|
+
});
|
|
3698
|
+
this.signin_requested = false;
|
|
3699
|
+
this.user_data = null;
|
|
3700
|
+
this.serverToUserChannel = null;
|
|
3701
|
+
this.signinDonePromise = null;
|
|
3702
|
+
this._signinDoneResolve = null;
|
|
3703
|
+
this._onAuthorize = (err, authData) => {
|
|
3704
|
+
if (err) {
|
|
3705
|
+
logger.warn(`Error during signin: ${err}`);
|
|
3706
|
+
this._cleanup();
|
|
3707
|
+
return;
|
|
3708
|
+
}
|
|
3709
|
+
this.pusher.send_event("pusher:signin", {
|
|
3710
|
+
auth: authData.auth,
|
|
3711
|
+
user_data: authData.user_data
|
|
3712
|
+
});
|
|
3713
|
+
};
|
|
3714
|
+
this.pusher = pusher2;
|
|
3715
|
+
this.pusher.connection.bind("state_change", ({ previous, current }) => {
|
|
3716
|
+
if (previous !== "connected" && current === "connected") {
|
|
3717
|
+
this._signin();
|
|
3718
|
+
}
|
|
3719
|
+
if (previous === "connected" && current !== "connected") {
|
|
3720
|
+
this._cleanup();
|
|
3721
|
+
this._newSigninPromiseIfNeeded();
|
|
3722
|
+
}
|
|
3723
|
+
});
|
|
3724
|
+
this.watchlist = new watchlist_WatchlistFacade(pusher2);
|
|
3725
|
+
this.pusher.connection.bind("message", (event) => {
|
|
3726
|
+
var eventName = event.event;
|
|
3727
|
+
if (eventName === "pusher:signin_success") {
|
|
3728
|
+
this._onSigninSuccess(event.data);
|
|
3729
|
+
}
|
|
3730
|
+
if (this.serverToUserChannel && this.serverToUserChannel.name === event.channel) {
|
|
3731
|
+
this.serverToUserChannel.handleEvent(event);
|
|
3732
|
+
}
|
|
3733
|
+
});
|
|
3734
|
+
}
|
|
3735
|
+
signin() {
|
|
3736
|
+
if (this.signin_requested) {
|
|
3737
|
+
return;
|
|
3738
|
+
}
|
|
3739
|
+
this.signin_requested = true;
|
|
3740
|
+
this._signin();
|
|
3741
|
+
}
|
|
3742
|
+
_signin() {
|
|
3743
|
+
if (!this.signin_requested) {
|
|
3744
|
+
return;
|
|
3745
|
+
}
|
|
3746
|
+
this._newSigninPromiseIfNeeded();
|
|
3747
|
+
if (this.pusher.connection.state !== "connected") {
|
|
3748
|
+
return;
|
|
3749
|
+
}
|
|
3750
|
+
this.pusher.config.userAuthenticator({
|
|
3751
|
+
socketId: this.pusher.connection.socket_id
|
|
3752
|
+
}, this._onAuthorize);
|
|
3753
|
+
}
|
|
3754
|
+
_onSigninSuccess(data) {
|
|
3755
|
+
try {
|
|
3756
|
+
this.user_data = JSON.parse(data.user_data);
|
|
3757
|
+
} catch (e) {
|
|
3758
|
+
logger.error(`Failed parsing user data after signin: ${data.user_data}`);
|
|
3759
|
+
this._cleanup();
|
|
3760
|
+
return;
|
|
3761
|
+
}
|
|
3762
|
+
if (typeof this.user_data.id !== "string" || this.user_data.id === "") {
|
|
3763
|
+
logger.error(`user_data doesn't contain an id. user_data: ${this.user_data}`);
|
|
3764
|
+
this._cleanup();
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3767
|
+
this._signinDoneResolve();
|
|
3768
|
+
this._subscribeChannels();
|
|
3769
|
+
}
|
|
3770
|
+
_subscribeChannels() {
|
|
3771
|
+
const ensure_subscribed = (channel) => {
|
|
3772
|
+
if (channel.subscriptionPending && channel.subscriptionCancelled) {
|
|
3773
|
+
channel.reinstateSubscription();
|
|
3774
|
+
} else if (!channel.subscriptionPending && this.pusher.connection.state === "connected") {
|
|
3775
|
+
channel.subscribe();
|
|
3776
|
+
}
|
|
3777
|
+
};
|
|
3778
|
+
this.serverToUserChannel = new channel_Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
|
|
3779
|
+
this.serverToUserChannel.bind_global((eventName, data) => {
|
|
3780
|
+
if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
|
|
3781
|
+
return;
|
|
3782
|
+
}
|
|
3783
|
+
this.emit(eventName, data);
|
|
3784
|
+
});
|
|
3785
|
+
ensure_subscribed(this.serverToUserChannel);
|
|
3786
|
+
}
|
|
3787
|
+
_cleanup() {
|
|
3788
|
+
this.user_data = null;
|
|
3789
|
+
if (this.serverToUserChannel) {
|
|
3790
|
+
this.serverToUserChannel.unbind_all();
|
|
3791
|
+
this.serverToUserChannel.disconnect();
|
|
3792
|
+
this.serverToUserChannel = null;
|
|
3793
|
+
}
|
|
3794
|
+
if (this.signin_requested) {
|
|
3795
|
+
this._signinDoneResolve();
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
_newSigninPromiseIfNeeded() {
|
|
3799
|
+
if (!this.signin_requested) {
|
|
3800
|
+
return;
|
|
3801
|
+
}
|
|
3802
|
+
if (this.signinDonePromise && !this.signinDonePromise.done) {
|
|
3803
|
+
return;
|
|
3804
|
+
}
|
|
3805
|
+
const { promise, resolve } = flat_promise();
|
|
3806
|
+
promise.done = false;
|
|
3807
|
+
const setDone = () => {
|
|
3808
|
+
promise.done = true;
|
|
3809
|
+
};
|
|
3810
|
+
promise.then(setDone).catch(setDone);
|
|
3811
|
+
this.signinDonePromise = promise;
|
|
3812
|
+
this._signinDoneResolve = resolve;
|
|
3813
|
+
}
|
|
3814
|
+
}
|
|
3815
|
+
class pusher_Pusher {
|
|
3816
|
+
static ready() {
|
|
3817
|
+
pusher_Pusher.isReady = true;
|
|
3818
|
+
for (var i = 0, l = pusher_Pusher.instances.length; i < l; i++) {
|
|
3819
|
+
pusher_Pusher.instances[i].connect();
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
static getClientFeatures() {
|
|
3823
|
+
return keys(filterObject({ ws: runtime.Transports.ws }, function(t) {
|
|
3824
|
+
return t.isSupported({});
|
|
3825
|
+
}));
|
|
3826
|
+
}
|
|
3827
|
+
constructor(app_key, options) {
|
|
3828
|
+
checkAppKey(app_key);
|
|
3829
|
+
validateOptions(options);
|
|
3830
|
+
this.key = app_key;
|
|
3831
|
+
this.options = options;
|
|
3832
|
+
this.config = getConfig(this.options, this);
|
|
3833
|
+
this.channels = factory.createChannels();
|
|
3834
|
+
this.global_emitter = new dispatcher_Dispatcher();
|
|
3835
|
+
this.sessionID = runtime.randomInt(1e9);
|
|
3836
|
+
this.timeline = new timeline_Timeline(this.key, this.sessionID, {
|
|
3837
|
+
cluster: this.config.cluster,
|
|
3838
|
+
features: pusher_Pusher.getClientFeatures(),
|
|
3839
|
+
params: this.config.timelineParams || {},
|
|
3840
|
+
limit: 50,
|
|
3841
|
+
level: timeline_level.INFO,
|
|
3842
|
+
version: defaults.VERSION
|
|
3843
|
+
});
|
|
3844
|
+
if (this.config.enableStats) {
|
|
3845
|
+
this.timelineSender = factory.createTimelineSender(this.timeline, {
|
|
3846
|
+
host: this.config.statsHost,
|
|
3847
|
+
path: "/timeline/v2/" + runtime.TimelineTransport.name
|
|
3848
|
+
});
|
|
3849
|
+
}
|
|
3850
|
+
var getStrategy = (options2) => {
|
|
3851
|
+
return runtime.getDefaultStrategy(this.config, options2, strategy_builder_defineTransport);
|
|
3852
|
+
};
|
|
3853
|
+
this.connection = factory.createConnectionManager(this.key, {
|
|
3854
|
+
getStrategy,
|
|
3855
|
+
timeline: this.timeline,
|
|
3856
|
+
activityTimeout: this.config.activityTimeout,
|
|
3857
|
+
pongTimeout: this.config.pongTimeout,
|
|
3858
|
+
unavailableTimeout: this.config.unavailableTimeout,
|
|
3859
|
+
useTLS: Boolean(this.config.useTLS)
|
|
3860
|
+
});
|
|
3861
|
+
this.connection.bind("connected", () => {
|
|
3862
|
+
this.subscribeAll();
|
|
3863
|
+
if (this.timelineSender) {
|
|
3864
|
+
this.timelineSender.send(this.connection.isUsingTLS());
|
|
3865
|
+
}
|
|
3866
|
+
});
|
|
3867
|
+
this.connection.bind("message", (event) => {
|
|
3868
|
+
var eventName = event.event;
|
|
3869
|
+
var internal = eventName.indexOf("pusher_internal:") === 0;
|
|
3870
|
+
if (event.channel) {
|
|
3871
|
+
var channel = this.channel(event.channel);
|
|
3872
|
+
if (channel) {
|
|
3873
|
+
channel.handleEvent(event);
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
if (!internal) {
|
|
3877
|
+
this.global_emitter.emit(event.event, event.data);
|
|
3878
|
+
}
|
|
3879
|
+
});
|
|
3880
|
+
this.connection.bind("connecting", () => {
|
|
3881
|
+
this.channels.disconnect();
|
|
3882
|
+
});
|
|
3883
|
+
this.connection.bind("disconnected", () => {
|
|
3884
|
+
this.channels.disconnect();
|
|
3885
|
+
});
|
|
3886
|
+
this.connection.bind("error", (err) => {
|
|
3887
|
+
logger.warn(err);
|
|
3888
|
+
});
|
|
3889
|
+
pusher_Pusher.instances.push(this);
|
|
3890
|
+
this.timeline.info({ instances: pusher_Pusher.instances.length });
|
|
3891
|
+
this.user = new user_UserFacade(this);
|
|
3892
|
+
if (pusher_Pusher.isReady) {
|
|
3893
|
+
this.connect();
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
switchCluster(options) {
|
|
3897
|
+
const { appKey, cluster } = options;
|
|
3898
|
+
this.key = appKey;
|
|
3899
|
+
this.options = Object.assign(Object.assign({}, this.options), { cluster });
|
|
3900
|
+
this.config = getConfig(this.options, this);
|
|
3901
|
+
this.connection.switchCluster(this.key);
|
|
3902
|
+
}
|
|
3903
|
+
channel(name) {
|
|
3904
|
+
return this.channels.find(name);
|
|
3905
|
+
}
|
|
3906
|
+
allChannels() {
|
|
3907
|
+
return this.channels.all();
|
|
3908
|
+
}
|
|
3909
|
+
connect() {
|
|
3910
|
+
this.connection.connect();
|
|
3911
|
+
if (this.timelineSender) {
|
|
3912
|
+
if (!this.timelineSenderTimer) {
|
|
3913
|
+
var usingTLS = this.connection.isUsingTLS();
|
|
3914
|
+
var timelineSender = this.timelineSender;
|
|
3915
|
+
this.timelineSenderTimer = new timers_PeriodicTimer(6e4, function() {
|
|
3916
|
+
timelineSender.send(usingTLS);
|
|
3917
|
+
});
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
disconnect() {
|
|
3922
|
+
this.connection.disconnect();
|
|
3923
|
+
if (this.timelineSenderTimer) {
|
|
3924
|
+
this.timelineSenderTimer.ensureAborted();
|
|
3925
|
+
this.timelineSenderTimer = null;
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
bind(event_name, callback, context) {
|
|
3929
|
+
this.global_emitter.bind(event_name, callback, context);
|
|
3930
|
+
return this;
|
|
3931
|
+
}
|
|
3932
|
+
unbind(event_name, callback, context) {
|
|
3933
|
+
this.global_emitter.unbind(event_name, callback, context);
|
|
3934
|
+
return this;
|
|
3935
|
+
}
|
|
3936
|
+
bind_global(callback) {
|
|
3937
|
+
this.global_emitter.bind_global(callback);
|
|
3938
|
+
return this;
|
|
3939
|
+
}
|
|
3940
|
+
unbind_global(callback) {
|
|
3941
|
+
this.global_emitter.unbind_global(callback);
|
|
3942
|
+
return this;
|
|
3943
|
+
}
|
|
3944
|
+
unbind_all(callback) {
|
|
3945
|
+
this.global_emitter.unbind_all();
|
|
3946
|
+
return this;
|
|
3947
|
+
}
|
|
3948
|
+
subscribeAll() {
|
|
3949
|
+
var channelName;
|
|
3950
|
+
for (channelName in this.channels.channels) {
|
|
3951
|
+
if (this.channels.channels.hasOwnProperty(channelName)) {
|
|
3952
|
+
this.subscribe(channelName);
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
subscribe(channel_name) {
|
|
3957
|
+
var channel = this.channels.add(channel_name, this);
|
|
3958
|
+
if (channel.subscriptionPending && channel.subscriptionCancelled) {
|
|
3959
|
+
channel.reinstateSubscription();
|
|
3960
|
+
} else if (!channel.subscriptionPending && this.connection.state === "connected") {
|
|
3961
|
+
channel.subscribe();
|
|
3962
|
+
}
|
|
3963
|
+
return channel;
|
|
3964
|
+
}
|
|
3965
|
+
unsubscribe(channel_name) {
|
|
3966
|
+
var channel = this.channels.find(channel_name);
|
|
3967
|
+
if (channel && channel.subscriptionPending) {
|
|
3968
|
+
channel.cancelSubscription();
|
|
3969
|
+
} else {
|
|
3970
|
+
channel = this.channels.remove(channel_name);
|
|
3971
|
+
if (channel && channel.subscribed) {
|
|
3972
|
+
channel.unsubscribe();
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3976
|
+
send_event(event_name, data, channel) {
|
|
3977
|
+
return this.connection.send_event(event_name, data, channel);
|
|
3978
|
+
}
|
|
3979
|
+
shouldUseTLS() {
|
|
3980
|
+
return this.config.useTLS;
|
|
3981
|
+
}
|
|
3982
|
+
signin() {
|
|
3983
|
+
this.user.signin();
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3986
|
+
pusher_Pusher.instances = [];
|
|
3987
|
+
pusher_Pusher.isReady = false;
|
|
3988
|
+
pusher_Pusher.logToConsole = false;
|
|
3989
|
+
pusher_Pusher.Runtime = runtime;
|
|
3990
|
+
pusher_Pusher.ScriptReceivers = runtime.ScriptReceivers;
|
|
3991
|
+
pusher_Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
|
|
3992
|
+
pusher_Pusher.auth_callbacks = runtime.auth_callbacks;
|
|
3993
|
+
var core_pusher = __webpack_exports__["default"] = pusher_Pusher;
|
|
3994
|
+
function checkAppKey(key) {
|
|
3995
|
+
if (key === null || key === void 0) {
|
|
3996
|
+
throw "You must pass your app key when you instantiate Pusher.";
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
runtime.setup(pusher_Pusher);
|
|
4000
|
+
}
|
|
4001
|
+
/******/
|
|
4002
|
+
])
|
|
4003
|
+
);
|
|
4004
|
+
});
|
|
4005
|
+
})(pusher);
|
|
4006
|
+
var pusherExports = pusher.exports;
|
|
4007
|
+
const Pusher = /* @__PURE__ */ getDefaultExportFromCjs(pusherExports);
|
|
4008
|
+
export {
|
|
4009
|
+
Pusher as P
|
|
4010
|
+
};
|