@abtnode/webapp 1.17.7-beta-20251230-041316-624cafaf → 1.17.7-beta-20251230-120126-2836fe04
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/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/dist/assets/{AdapterDayjs-BBi3P2IC.js → AdapterDayjs-D4yhIBjp.js} +1 -1
- package/dist/assets/{Add-DBDPvM2L.js → Add-BqehlncY.js} +1 -1
- package/dist/assets/ArrowDropDown-Cc-RKnnq.js +1 -0
- package/dist/assets/{Autocomplete-6CVDh-bw.js → Autocomplete-DQwU_oez.js} +1 -1
- package/dist/assets/{Breadcrumbs-CIhr-IBH.js → Breadcrumbs-DWjoGi7V.js} +1 -1
- package/dist/assets/{ButtonGroup-Um1mBtyg.js → ButtonGroup-CiscHb2s.js} +1 -1
- package/dist/assets/{CSSTransition-BcU1vShi.js → CSSTransition-R4tGAk7r.js} +1 -1
- package/dist/assets/{CallMerge-CqN4JiFM.js → CallMerge-BeazH3jg.js} +1 -1
- package/dist/assets/{CardContent-C16B5Bpa.js → CardContent-C5NwNVow.js} +1 -1
- package/dist/assets/{ChevronLeft-Ds4qWfjb.js → ChevronLeft-BaZj3l6K.js} +1 -1
- package/dist/assets/{ChevronRight-BFqUOmvp.js → ChevronRight-CpLm1bKY.js} +1 -1
- package/dist/assets/{Clear-L4-iFi83.js → Clear-siFOH-um.js} +1 -1
- package/dist/assets/{Delete-DVp4fJb1.js → Delete-8zGU1uok.js} +1 -1
- package/dist/assets/{DeleteOutline-CDxyWfLx.js → DeleteOutline-BiwjsR6p.js} +1 -1
- package/dist/assets/{Done-D7TYY_5X.js → Done-DzBppTPg.js} +1 -1
- package/dist/assets/{Edit-DYn1CF5Y.js → Edit-CKpLr219.js} +1 -1
- package/dist/assets/{ErrorOutline-By74cLGJ.js → ErrorOutline-B0v25XAB.js} +1 -1
- package/dist/assets/{FilterList-Czj4Os71.js → FilterList-Be5ZzrNM.js} +1 -1
- package/dist/assets/{Google-DZPfsfDE.js → Google-BB2TEIzp.js} +1 -1
- package/dist/assets/{HelpOutline-DS85eUTc.js → HelpOutline-D4ZrboH1.js} +1 -1
- package/dist/assets/{KeyboardArrowDown-C53dgTNk.js → KeyboardArrowDown-DdCuxSq1.js} +1 -1
- package/dist/assets/{Launch-l1uaKrAG.js → Launch-BiV6tbTp.js} +1 -1
- package/dist/assets/{Link-Bs8vi6ND.js → Link-Cogxu9aB.js} +1 -1
- package/dist/assets/{ListItemButton-KbcDtzXD.js → ListItemButton-C9pXyehQ.js} +1 -1
- package/dist/assets/{ListSubheader-C-Lxj5FB.js → ListSubheader-I1pRAfr2.js} +1 -1
- package/dist/assets/{LoadingButton-CZNIV9Ok.js → LoadingButton-BCz99YbN.js} +1 -1
- package/dist/assets/{MoreVert-DaM6pG5s.js → MoreVert-BOGr0n7e.js} +1 -1
- package/dist/assets/{OpenInNew-BQeSMHR-.js → OpenInNew-CCra_7I0.js} +1 -1
- package/dist/assets/{Refresh-BJnu5a0L.js → Refresh-EilcFp8b.js} +1 -1
- package/dist/assets/{Replay-BV6q004T.js → Replay-N-tBrT6I.js} +1 -1
- package/dist/assets/{Search-CApGhXwm.js → Search-BwAHZ5GK.js} +1 -1
- package/dist/assets/{Stepper-B2_oAcOZ.js → Stepper-Bn1MKAsJ.js} +1 -1
- package/dist/assets/TableSearch-BFj05c9C.js +51 -0
- package/dist/assets/{ToggleButtonGroup-t3tLzS74.js → ToggleButtonGroup-npFh1mr6.js} +1 -1
- package/dist/assets/{UnfoldMore-D2Y42T3n.js → UnfoldMore-DVoycFqc.js} +1 -1
- package/dist/assets/{Verified-QiB22jgm.js → Verified-CWEd1DVE.js} +1 -1
- package/dist/assets/{VerifiedUser-kPobsDlg.js → VerifiedUser-CigB8Fdv.js} +1 -1
- package/dist/assets/{ViewList-Ceb1JHIv.js → ViewList-D7TqVQ4P.js} +1 -1
- package/dist/assets/{_createAggregator-g-PBWDTI.js → _createAggregator-CQ-mLfMP.js} +1 -1
- package/dist/assets/{actions-BCMsejAj.js → actions-CDHomwcW.js} +2 -2
- package/dist/assets/{actions-Dp-VL6XB.js → actions-GoWYDb6F.js} +1 -1
- package/dist/assets/{agreement-Bun3wUY-.js → agreement-BhNIuQec.js} +3 -3
- package/dist/assets/api-CSBvUv9A.js +1 -0
- package/dist/assets/{appearance-yP6FtjZ0.js → appearance-Bux4sdxO.js} +1 -1
- package/dist/assets/{audit-logs-bPLYn_cc.js → audit-logs-CpckHt6s.js} +1 -1
- package/dist/assets/{base-chart-BZha7l7D.js → base-chart-CxDa_CaZ.js} +1 -1
- package/dist/assets/{blocklet-Nw4kpsVs.js → blocklet-D4otp8nH.js} +1 -1
- package/dist/assets/{chain-WdOor_5_.js → chain-CfwM2JWo.js} +1 -1
- package/dist/assets/{click-to-copy-DjkhfhsV.js → click-to-copy-CcQkmf0B.js} +1 -1
- package/dist/assets/cloneDeep-B3VWXnFc.js +1 -0
- package/dist/assets/{config-navigation-Pdv-g1jO.js → config-navigation-DVGyxdD_.js} +3 -3
- package/dist/assets/{connect-to-D2aJnmIt.js → connect-to-CbHwvZLx.js} +3 -3
- package/dist/assets/{cssMode-CbVfvomN.js → cssMode-CtObRSSW.js} +1 -1
- package/dist/assets/{delete-confirm-DCHvoTQs.js → delete-confirm-DfVCfmx_.js} +1 -1
- package/dist/assets/{depsEqual-LiU_ATMs.js → depsEqual-BF3eoqLy.js} +1 -1
- package/dist/assets/{detail-B-lIb4O1.js → detail-DYfAWDl1.js} +3 -3
- package/dist/assets/domains-CC4Opwi7.js +28 -0
- package/dist/assets/{download-DHuOHOVu.js → download-scJq5nd3.js} +1 -1
- package/dist/assets/{edit.svg-D0_FvYeH.js → edit.svg-BgAMrWjM.js} +1 -1
- package/dist/assets/emotion-cache.browser.esm-DyzCXqsA.js +1 -0
- package/dist/assets/engine-KybwGdMh.js +1 -0
- package/dist/assets/{freemarker2-Dbd2dz2J.js → freemarker2-D5TW5Eft.js} +1 -1
- package/dist/assets/{get-safe-url-DDm_hPj1.js → get-safe-url-HOLWsAs0.js} +1 -1
- package/dist/assets/getValidReactChildren-Ck9KmKnh.js +1 -0
- package/dist/assets/{graphqlMode-BNREvohj.js → graphqlMode-Bblq7qR7.js} +2 -2
- package/dist/assets/{handlebars-Ce_TkpEQ.js → handlebars-WxLGbhWH.js} +1 -1
- package/dist/assets/{html-CUmDiv7k.js → html-DuZCuVkX.js} +1 -1
- package/dist/assets/{html-title-D3mv3IQk.js → html-title-CifiMfjt.js} +1 -1
- package/dist/assets/{htmlMode-Ca_TsxJH.js → htmlMode-0w5arQMe.js} +1 -1
- package/dist/assets/{iframe-Dt-xbP5x.js → iframe-Dq0hkTrq.js} +1 -1
- package/dist/assets/{index-B2WmX6Fx.js → index-B24ZOg0s.js} +8 -8
- package/dist/assets/{index-C8CmKnU4.js → index-B3lwT4Ol.js} +2 -2
- package/dist/assets/{index-CTWQgRaZ.js → index-BD7A3_Da.js} +1 -1
- package/dist/assets/{index-BLI3C2o7.js → index-BGcMePQ8.js} +1 -1
- package/dist/assets/{index-CAA1AdyJ.js → index-BPA__Xw6.js} +2 -2
- package/dist/assets/index-BcmOVFqY.js +1 -0
- package/dist/assets/index-BnXKKyQZ.js +155 -0
- package/dist/assets/{index-CQogNORn.js → index-C8Yc1xhR.js} +13 -13
- package/dist/assets/{index-B11n09kE.js → index-C9Doh9s3.js} +1 -1
- package/dist/assets/{index-CODEE-RB.js → index-CFu4UTTj.js} +1 -1
- package/dist/assets/{index-D0-rZXcm.js → index-CGzi7zV_.js} +1 -1
- package/dist/assets/{index-Ci1hoD9j.js → index-CH_WzJ6f.js} +2 -2
- package/dist/assets/{index-WbuPRmjd.js → index-CIAqUMHH.js} +1 -1
- package/dist/assets/{index-IWOqJkOB.js → index-CNVrqxCI.js} +1 -1
- package/dist/assets/{index-BHAdZ1FZ.js → index-COhyQV8C.js} +2 -2
- package/dist/assets/{index-DT5BIL2_.js → index-CXTibO7-.js} +1 -1
- package/dist/assets/{index-umVLVZjs.js → index-CbKLDJsb.js} +1 -1
- package/dist/assets/{index-Dtkcfmzb.js → index-Ci0V4E2u.js} +11 -11
- package/dist/assets/{index-DtJVzdtH.js → index-CrQaw0BF.js} +2 -2
- package/dist/assets/{index-2VA5XrmO.js → index-Cs8W6nmK.js} +11 -11
- package/dist/assets/index-CzQzijaC.js +1 -0
- package/dist/assets/index-D2gNdot7.js +79 -0
- package/dist/assets/{index-CQYzPG_n.js → index-D57ncOaj.js} +1 -1
- package/dist/assets/{index-CypG4Dbq.js → index-D93jIJAg.js} +1 -1
- package/dist/assets/{index-jT3H-jhB.js → index-DAMZQWKn.js} +1 -1
- package/dist/assets/index-DBJqSNjU.js +1 -0
- package/dist/assets/{index-CvZItgju.js → index-DDG-ZEI-.js} +1 -1
- package/dist/assets/{index-BQNKAwfZ.js → index-DN9WepcN.js} +1 -1
- package/dist/assets/{index-B0O0JwRT.js → index-DPs8sVol.js} +1 -1
- package/dist/assets/index-DVOJBn33.js +20 -0
- package/dist/assets/{index-CR1U7OM5.js → index-DWm5KlVP.js} +1 -1
- package/dist/assets/{index-CdxsHt3r.js → index-DYW_sHYx.js} +3 -3
- package/dist/assets/index-DhXU_Vz9.js +1 -0
- package/dist/assets/{index-KI2LGzUW.js → index-DidKpbc0.js} +1 -1
- package/dist/assets/{index-z-tbDeE3.js → index-DyIPXbau.js} +1 -1
- package/dist/assets/{index-Dt9htCod.js → index-DzQWOvtr.js} +3 -3
- package/dist/assets/{index-CADLzzXJ.js → index-OtVuze_0.js} +3 -3
- package/dist/assets/{index-DJ9zSKl1.js → index-ZCO60mrW.js} +1 -1
- package/dist/assets/{index-CL2N86sI.js → index-_-mWQ6ov.js} +12 -12
- package/dist/assets/{index-DQItZ4UM.js → index-b78VjA-Y.js} +1 -1
- package/dist/assets/{index-BxX_nqnW.js → index-nvPO7sCa.js} +2 -2
- package/dist/assets/{index-kRFEBldM.js → index-rsjiYKAZ.js} +2 -2
- package/dist/assets/{index-D319vBae.js → index-wIt3UxPD.js} +9 -9
- package/dist/assets/{index-BsjY45Cd.js → index-yQeeHJJ2.js} +1 -1
- package/dist/assets/{index.esm-Zck39Kvz.js → index.esm-B06DCVM7.js} +1 -1
- package/dist/assets/install-from-url-B0gehZWB.js +1 -0
- package/dist/assets/{invitation-4F28SRYz.js → invitation-DjNwS-Ha.js} +3 -3
- package/dist/assets/{is-path-prefix-equal-BJMXSv43.js → is-path-prefix-equal-Dr7EUhi7.js} +1 -1
- package/dist/assets/{item-C1JxTPT2.js → item-Bojg28Ma.js} +6 -6
- package/dist/assets/{javascript-B0m7UVIe.js → javascript-xUySVVaa.js} +1 -1
- package/dist/assets/{jsonMode-CgwGbFre.js → jsonMode-aXjE405B.js} +1 -1
- package/dist/assets/{liquid-BZyWy1Tr.js → liquid-CqO0loMD.js} +1 -1
- package/dist/assets/{list-header-BZRIF_iO.js → list-header-D5a_5edu.js} +1 -1
- package/dist/assets/{lock.svg-Ba4McgFD.js → lock.svg-Bnm1mppT.js} +1 -1
- package/dist/assets/{log-BFB-zvPt.js → log-Dh6sGyEk.js} +1 -1
- package/dist/assets/{lottie-react.esm-CGSms1Pf.js → lottie-react.esm-uLWIPZ8N.js} +1 -1
- package/dist/assets/{mdx-BRVCuIrx.js → mdx-gAWRd386.js} +1 -1
- package/dist/assets/{memory-B2j_d87p.js → memory-BwHtkqHB.js} +1 -1
- package/dist/assets/{metric-DpvjSsZq.js → metric-Q_9BNbHj.js} +1 -1
- package/dist/assets/omit-DeumLxdH.js +1 -0
- package/dist/assets/overview-DZjSoaFM.js +13 -0
- package/dist/assets/{permission-DTFazP7s.js → permission-B8q324ya.js} +1 -1
- package/dist/assets/{preference-DYVCo0KF.js → preference-DjOBLR-v.js} +6 -6
- package/dist/assets/{python-B-wSNZ_T.js → python-DnlpLwjq.js} +1 -1
- package/dist/assets/{raf-schd.esm-B7_MlDzu.js → raf-schd.esm-B2LNukSh.js} +1 -1
- package/dist/assets/{razor-BR_HjGgi.js → razor-JAsAlMne.js} +1 -1
- package/dist/assets/{rotate-session-key-Bz5QE7gB.js → rotate-session-key-BFiVoa6I.js} +1 -1
- package/dist/assets/{runtime-DM0B8rA4.js → runtime-BB_E-r_A.js} +1 -1
- package/dist/assets/schema-DC2ou5i0.js +1 -0
- package/dist/assets/sdk-DZJdUnPV.js +1 -0
- package/dist/assets/{service-DkoTQaTk.js → service-DLwgL4rt.js} +1 -1
- package/dist/assets/{shorten-label-BR48Ofqe.js → shorten-label-CybgQDYs.js} +1 -1
- package/dist/assets/{simple-select-D38wTw_o.js → simple-select-DJn1UT5H.js} +1 -1
- package/dist/assets/{spaces-YFYDpL5l.js → spaces-DBXblECR.js} +1 -1
- package/dist/assets/{status-B_ZSV6JY.js → status-CW0QYGeF.js} +1 -1
- package/dist/assets/{status-BTCwUhiG.js → status-DG36cpK9.js} +1 -1
- package/dist/assets/{switch-control-Fq47wOrt.js → switch-control-Bzy_oqas.js} +1 -1
- package/dist/assets/{table-icons-DYQRHdVu.js → table-icons-DKoPQwjv.js} +1 -1
- package/dist/assets/{team-DKJfzzKD.js → team-DLwXXgYX.js} +1 -1
- package/dist/assets/{toLower-62VYhzjn.js → toLower-CXuGXHcC.js} +1 -1
- package/dist/assets/toUpper-DN59t43l.js +1 -0
- package/dist/assets/traffic-DSdpsMku.js +1 -0
- package/dist/assets/{tsMode-CxSxmJBQ.js → tsMode-Dh0Ri32L.js} +1 -1
- package/dist/assets/{typescript-Dnu6Xv3U.js → typescript-D316NgIh.js} +1 -1
- package/dist/assets/{url-evaluation-Cf4MPEtF.js → url-evaluation-DMCBEvQj.js} +1 -1
- package/dist/assets/{url-join-P8kMCiOB.js → url-join-DoFkjCNr.js} +1 -1
- package/dist/assets/{use-mobile-BnTDQjTV.js → use-mobile-BGG1Yti5.js} +1 -1
- package/dist/assets/{use-mobile-D1KGwOlr.js → use-mobile-DqSNKVo1.js} +1 -1
- package/dist/assets/{useAsync-SwSlukzF.js → useAsync-ByRujkOO.js} +1 -1
- package/dist/assets/{useAsyncRetry-BQEwzyM4.js → useAsyncRetry-CLcTront.js} +1 -1
- package/dist/assets/{useLocalStorage-41az-hAK.js → useLocalStorage-DjnxkTrj.js} +1 -1
- package/dist/assets/{useThemeProps-Cw6i_sME.js → useThemeProps-CFIloaX5.js} +1 -1
- package/dist/assets/{util-C9NPDRP-.js → util-DvscRj0S.js} +1 -1
- package/dist/assets/{wait-container-GLOlfScg.js → wait-container-BPFMrDUL.js} +3 -3
- package/dist/assets/{without-wallet-rfYvx_29.js → without-wallet-D2bQnWJt.js} +1 -1
- package/dist/assets/wrap-locale-BbIFvnmJ.js +1 -0
- package/dist/assets/{xml-D06mM15g.js → xml-BGgxhX96.js} +1 -1
- package/dist/assets/{yaml-DrMeEOdm.js → yaml-9hmveKGV.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/ArrowDropDown-CqYw-eY9.js +0 -1
- package/dist/assets/TableSearch-CKjIHAce.js +0 -51
- package/dist/assets/api-DDSUcMPT.js +0 -1
- package/dist/assets/cloneDeep-Bl8wZyrm.js +0 -1
- package/dist/assets/domains-CeCMQUBm.js +0 -28
- package/dist/assets/emotion-cache.browser.esm-D1-P5QGD.js +0 -1
- package/dist/assets/engine-D8Acg7DY.js +0 -1
- package/dist/assets/getValidReactChildren-DpcxJbs9.js +0 -1
- package/dist/assets/index-2lzs7bat.js +0 -1
- package/dist/assets/index-BPuMob2k.js +0 -1
- package/dist/assets/index-Be8ehpQE.js +0 -1
- package/dist/assets/index-CKHOafPq.js +0 -79
- package/dist/assets/index-CaDcvTD7.js +0 -155
- package/dist/assets/index-DdYx-VNK.js +0 -1
- package/dist/assets/index-DjQqmpzQ.js +0 -20
- package/dist/assets/install-from-url-BXftFn4t.js +0 -1
- package/dist/assets/omit-CyTnrDNo.js +0 -1
- package/dist/assets/overview-DkMLRtwO.js +0 -13
- package/dist/assets/schema-BKPaewSy.js +0 -1
- package/dist/assets/sdk-CXClyXm7.js +0 -1
- package/dist/assets/toUpper-CBmQ5f7q.js +0 -1
- package/dist/assets/traffic-Dh_MwZxy.js +0 -1
- package/dist/assets/wrap-locale-C-Q-ES8F.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aF as Ve,j as e,bo as ht,r as x,bE as Q,bg as H,H as q,aH as E,g as gt,o as d,h as ee,au as xt,N as bt,J as N,T as Y,V as X,eP as ke,O as Fe,it as Ge,bk as Re,aV as Te,R as Ie,bB as Ce,b4 as He,b2 as Ee,C as Ye,f as Qe,f1 as Xe,aP as Ae,W as yt,at as Je,iu as Ze,v as De,f3 as et,br as be,fK as tt,dE as jt,s as ae,ag as pe,G as qe,av as St,iv as vt,iw as Ct,$ as Nt,ix as wt,iy as Rt,iz as Tt,iA as It,M as Et,by as st,E as At,I as Dt,P as Ot,S as Lt,Q as Ue,iB as kt}from"./index-DtJVzdtH.js";import{d as Ft,H as nt,g as Pt}from"./index-IWOqJkOB.js";import{S as me}from"./shorten-label-BR48Ofqe.js";import{v as at}from"./index-jT3H-jhB.js";import{T as _t}from"./html-title-D3mv3IQk.js";import{R as Pe}from"./Replay-BV6q004T.js";import{R as Bt}from"./Refresh-BJnu5a0L.js";import{D as zt,g as Wt}from"./traffic-Dh_MwZxy.js";import"./FilterList-Czj4Os71.js";import"./CSSTransition-BcU1vShi.js";import"./emotion-cache.browser.esm-D1-P5QGD.js";import"./index-CR1U7OM5.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-LiU_ATMs.js";import"./TableSearch-CKjIHAce.js";import"./Search-CApGhXwm.js";import"./Clear-L4-iFi83.js";import"./MoreVert-DaM6pG5s.js";import"./iframe-Dt-xbP5x.js";import"./ChevronLeft-Ds4qWfjb.js";import"./ChevronRight-BFqUOmvp.js";import"./index-DBii9-f-.js";import"./base-chart-BZha7l7D.js";import"./index-B0O0JwRT.js";import"./AdapterDayjs-BBi3P2IC.js";import"./useThemeProps-Cw6i_sME.js";import"./visuallyHidden-Dan1xhjv.js";const Mt=Ve(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"})),Kt=Ve(e.jsx("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),it=x.createContext({}),{Provider:Ht,Consumer:Ks}=it;function qt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=ht(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Q(()=>s.meta?.did,[s]),[y,v]=x.useState([]),[P,F]=x.useState({}),w=Q(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return F(se),b(Z.list),S(Z.paging),Z.list}catch(D){return q.error(D.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw q.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const J={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:y,getReceivers:V,inService:r,teamDid:h};return e.jsx(Ht,{value:{notificationRecords:J},children:t})}function _e(){const{notificationRecords:t}=x.useContext(it);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(gt,{type:Ut[t],children:t})}const $t=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ot(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:xt(i,s)}):"",S=$t(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],rt=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},lt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Vt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:rt(t),enabled:n}},Gt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:lt(t),enabled:n}},Yt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Qt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Xt=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],xe=(t=[])=>{const s=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},Jt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},je=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Zt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ct=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(bt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=X();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Y,{children:[s,": "]}),t.map(l=>{const b=ot(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ge,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(y=>y!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=X(),m=ot(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=X(),r=H().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[He(t[0],n)," - ",He(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Wt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=X();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Ft.TableFilterList,{...s,ItemComponent:t})})]})}function Me({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Me.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const es=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];dt.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function dt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=X(),[i,l]=x.useState(es),[b,m]=x.useState(!0),S=(y,v)=>{v.checked=y.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=y=>{y.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ge,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(y=>e.jsx(Te,{control:e.jsx(Ie,{checked:y.checked,onChange:v=>S(v,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:y=>m(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Ye,{size:16}),r("common.confirm")]})]})]})}ut.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function ut({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=X(),l=Qe(),b=x.useMemo(()=>Xe(l,ct()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:y,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),M=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,J]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:tt(c.receiverUser.avatar,h,S)}}));U(o),J(a.paging),F(!1)}catch(a){q.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],K=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await y(o);return c?a==="wallet"?Yt(c):a==="email"?Vt(v,c):a==="pushKit"?Gt(v,c):a==="webhook"?Qt(c):!0:!1},[y,v]),Ne=x.useCallback(a=>Xt(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},j=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await j(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await j(["webhook"],[a.receiver],c,o)}catch(C){q.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Jt(o,c)>=4){q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const K=await oe(c,o.receiver);await ge(1),$({channel:c,result:K}),(typeof K=="boolean"&&K||jt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(K){q.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=Q(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Je,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(yt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>R(K,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(Ze,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),mt=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(Bt,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ss,{children:e.jsxs(et,{theme:b,children:[e.jsx(nt,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:Z,options:se,customButtons:mt,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Me,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ee,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ns,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(Kt,{}):e.jsx(Ye,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(Mt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(dt,{loading:n,onCancel:u,onConfirm:I})})]})})})}const ts=x.memo(ut),ss=ae.div`
|
|
1
|
+
import{aG as Ve,j as e,bo as ht,r as x,bE as Q,bg as H,H as q,aI as E,g as gt,o as d,h as ee,av as xt,Q as bt,K as N,T as Y,V as X,eP as ke,R as Fe,it as Ge,bk as Re,aV as Te,Y as Ie,bB as Ce,b4 as He,b2 as Ee,C as Ye,f as Qe,f1 as Xe,aQ as Ae,W as yt,au as Je,iu as Ze,v as De,f3 as et,br as be,fK as tt,dE as jt,s as ae,ah as pe,G as qe,aw as St,iv as vt,iw as Ct,$ as Nt,ix as wt,iy as Rt,iz as Tt,iA as It,P as Et,by as st,E as At,M as Dt,S as Ot,U as Lt,X as Ue,iB as kt}from"./index-CrQaw0BF.js";import{d as Ft,H as nt,g as Pt}from"./index-CNVrqxCI.js";import{S as me}from"./shorten-label-CybgQDYs.js";import{v as at}from"./index-DAMZQWKn.js";import{T as _t}from"./html-title-CifiMfjt.js";import{R as Pe}from"./Replay-N-tBrT6I.js";import{R as Bt}from"./Refresh-EilcFp8b.js";import{D as zt,g as Wt}from"./traffic-DSdpsMku.js";import"./FilterList-Be5ZzrNM.js";import"./CSSTransition-R4tGAk7r.js";import"./emotion-cache.browser.esm-DyzCXqsA.js";import"./index-DWm5KlVP.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BF3eoqLy.js";import"./TableSearch-BFj05c9C.js";import"./Search-BwAHZ5GK.js";import"./Clear-siFOH-um.js";import"./MoreVert-BOGr0n7e.js";import"./iframe-Dq0hkTrq.js";import"./ChevronLeft-BaZj3l6K.js";import"./ChevronRight-CpLm1bKY.js";import"./index-DBii9-f-.js";import"./base-chart-CxDa_CaZ.js";import"./index-DPs8sVol.js";import"./AdapterDayjs-D4yhIBjp.js";import"./useThemeProps-CFIloaX5.js";import"./visuallyHidden-Dan1xhjv.js";const Mt=Ve(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"})),Kt=Ve(e.jsx("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),it=x.createContext({}),{Provider:Ht,Consumer:Ks}=it;function qt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=ht(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Q(()=>s.meta?.did,[s]),[y,v]=x.useState([]),[P,F]=x.useState({}),w=Q(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return F(se),b(Z.list),S(Z.paging),Z.list}catch(D){return q.error(D.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw q.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const J={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:y,getReceivers:V,inService:r,teamDid:h};return e.jsx(Ht,{value:{notificationRecords:J},children:t})}function _e(){const{notificationRecords:t}=x.useContext(it);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(gt,{type:Ut[t],children:t})}const $t=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ot(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:xt(i,s)}):"",S=$t(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],rt=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},lt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Vt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:rt(t),enabled:n}},Gt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:lt(t),enabled:n}},Yt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Qt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Xt=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],xe=(t=[])=>{const s=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},Jt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},je=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Zt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ct=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(bt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=X();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Y,{children:[s,": "]}),t.map(l=>{const b=ot(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ge,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(y=>y!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=X(),m=ot(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=X(),r=H().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[He(t[0],n)," - ",He(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Wt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=X();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Ft.TableFilterList,{...s,ItemComponent:t})})]})}function Me({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Me.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const es=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];dt.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function dt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=X(),[i,l]=x.useState(es),[b,m]=x.useState(!0),S=(y,v)=>{v.checked=y.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=y=>{y.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ge,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(y=>e.jsx(Te,{control:e.jsx(Ie,{checked:y.checked,onChange:v=>S(v,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:y=>m(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Ye,{size:16}),r("common.confirm")]})]})]})}ut.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function ut({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=X(),l=Qe(),b=x.useMemo(()=>Xe(l,ct()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:y,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),M=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,J]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:tt(c.receiverUser.avatar,h,S)}}));U(o),J(a.paging),F(!1)}catch(a){q.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],K=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await y(o);return c?a==="wallet"?Yt(c):a==="email"?Vt(v,c):a==="pushKit"?Gt(v,c):a==="webhook"?Qt(c):!0:!1},[y,v]),Ne=x.useCallback(a=>Xt(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},j=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await j(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await j(["webhook"],[a.receiver],c,o)}catch(C){q.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Jt(o,c)>=4){q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const K=await oe(c,o.receiver);await ge(1),$({channel:c,result:K}),(typeof K=="boolean"&&K||jt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(K){q.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=Q(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Je,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(yt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>R(K,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(Ze,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),mt=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(Bt,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ss,{children:e.jsxs(et,{theme:b,children:[e.jsx(nt,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:Z,options:se,customButtons:mt,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Me,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ee,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ns,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(Kt,{}):e.jsx(Ye,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(Mt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(dt,{loading:n,onCancel:u,onConfirm:I})})]})})})}const ts=x.memo(ut),ss=ae.div`
|
|
2
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bf as v,r as at}from"./index-DtJVzdtH.js";var he=e=>e.type==="checkbox",ue=e=>e instanceof Date,$=e=>e==null;const _t=e=>typeof e=="object";var P=e=>!$(e)&&!Array.isArray(e)&&_t(e)&&!ue(e),ht=e=>P(e)&&e.target?he(e.target)?e.target.checked:e.target.value:e,Nt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mt=(e,r)=>e.has(Nt(r)),Bt=e=>{const r=e.constructor&&e.constructor.prototype;return P(r)&&r.hasOwnProperty("isPrototypeOf")},je=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function T(e){let r;const t=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(e instanceof Set)r=new Set(e);else if(!(je&&(e instanceof Blob||i))&&(t||P(e)))if(r=t?[]:{},!t&&!Bt(e))r=e;else for(const n in e)e.hasOwnProperty(n)&&(r[n]=T(e[n]));else return e;return r}var Se=e=>/^\w*$/.test(e),U=e=>e===void 0,we=e=>Array.isArray(e)?e.filter(Boolean):[],Ke=e=>we(e.replace(/["|']|\]/g,"").split(/\.|\[/)),c=(e,r,t)=>{if(!r||!P(e))return t;const i=(Se(r)?[r]:Ke(r)).reduce((n,l)=>$(n)?n:n[l],e);return U(i)||i===e?U(e[r])?t:e[r]:i},Q=e=>typeof e=="boolean",E=(e,r,t)=>{let i=-1;const n=Se(r)?[r]:Ke(r),l=n.length,f=l-1;for(;++i<l;){const d=n[i];let b=t;if(i!==f){const x=e[d];b=P(x)||Array.isArray(x)?x:isNaN(+n[i+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;e[d]=b,e=e[d]}};const Fe={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},vt=v.createContext(null);vt.displayName="HookFormContext";const ke=()=>v.useContext(vt);var bt=(e,r,t,i=!0)=>{const n={defaultValues:r._defaultValues};for(const l in e)Object.defineProperty(n,l,{get:()=>{const f=l;return r._proxyFormState[f]!==Z.all&&(r._proxyFormState[f]=!i||Z.all),t&&(t[f]=!0),e[f]}});return n};const De=typeof window<"u"?at.useLayoutEffect:at.useEffect;function Pt(e){const r=ke(),{control:t=r.control,disabled:i,name:n,exact:l}=e||{},[f,d]=v.useState(t._formState),b=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return De(()=>t._subscribe({name:n,formState:b.current,exact:l,callback:x=>{!i&&d({...t._formState,...x})}}),[n,i,l]),v.useEffect(()=>{b.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>bt(f,t,b.current,!1),[f,t])}var se=e=>typeof e=="string",Ft=(e,r,t,i,n)=>se(e)?(i&&r.watch.add(e),c(t,e,n)):Array.isArray(e)?e.map(l=>(i&&r.watch.add(l),c(t,l))):(i&&(r.watchAll=!0),t);function Wt(e){const r=ke(),{control:t=r.control,name:i,defaultValue:n,disabled:l,exact:f}=e||{},d=v.useRef(n),[b,x]=v.useState(t._getWatch(i,d.current));return De(()=>t._subscribe({name:i,formState:{values:!0},exact:f,callback:D=>!l&&x(Ft(i,t._names,D.values||t._formValues,!1,d.current))}),[i,t,l,f]),v.useEffect(()=>t._removeUnmounted()),b}function qt(e){const r=ke(),{name:t,disabled:i,control:n=r.control,shouldUnregister:l}=e,f=mt(n._names.array,t),d=Wt({control:n,name:t,defaultValue:c(n._formValues,t,c(n._defaultValues,t,e.defaultValue)),exact:!0}),b=Pt({control:n,name:t,exact:!0}),x=v.useRef(e),D=v.useRef(n.register(t,{...e.rules,value:d,...Q(e.disabled)?{disabled:e.disabled}:{}})),C=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!c(b.errors,t)},isDirty:{enumerable:!0,get:()=>!!c(b.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!c(b.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!c(b.validatingFields,t)},error:{enumerable:!0,get:()=>c(b.errors,t)}}),[b,t]),F=v.useCallback(L=>D.current.onChange({target:{value:ht(L),name:t},type:Fe.CHANGE}),[t]),M=v.useCallback(()=>D.current.onBlur({target:{value:c(n._formValues,t),name:t},type:Fe.BLUR}),[t,n._formValues]),z=v.useCallback(L=>{const ee=c(n._fields,t);ee&&L&&(ee._f.ref={focus:()=>L.focus&&L.focus(),select:()=>L.select&&L.select(),setCustomValidity:V=>L.setCustomValidity(V),reportValidity:()=>L.reportValidity()})},[n._fields,t]),R=v.useMemo(()=>({name:t,value:d,...Q(i)||b.disabled?{disabled:b.disabled||i}:{},onChange:F,onBlur:M,ref:z}),[t,i,b.disabled,F,M,z,d]);return v.useEffect(()=>{const L=n._options.shouldUnregister||l;n.register(t,{...x.current.rules,...Q(x.current.disabled)?{disabled:x.current.disabled}:{}});const ee=(V,G)=>{const W=c(n._fields,V);W&&W._f&&(W._f.mount=G)};if(ee(t,!0),L){const V=T(c(n._options.defaultValues,t));E(n._defaultValues,t,V),U(c(n._formValues,t))&&E(n._formValues,t,V)}return!f&&n.register(t),()=>{(f?L&&!n._state.action:L)?n.unregister(t):ee(t,!1)}},[t,n,f,l]),v.useEffect(()=>{n._setDisabledField({disabled:i,name:t})},[i,t,n]),v.useMemo(()=>({field:R,formState:b,fieldState:C}),[R,b,C])}const ar=e=>e.render(qt(e));var Ht=(e,r,t,i,n)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[i]:n||!0}}:{},K=e=>Array.isArray(e)?e:[e],nt=()=>{let e=[];return{get observers(){return e},next:n=>{for(const l of e)l.next&&l.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(l=>l!==n)}}),unsubscribe:()=>{e=[]}}},qe=e=>$(e)||!_t(e);function le(e,r,t=new WeakSet){if(qe(e)||qe(r))return e===r;if(ue(e)&&ue(r))return e.getTime()===r.getTime();const i=Object.keys(e),n=Object.keys(r);if(i.length!==n.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const l of i){const f=e[l];if(!n.includes(l))return!1;if(l!=="ref"){const d=r[l];if(ue(f)&&ue(d)||P(f)&&P(d)||Array.isArray(f)&&Array.isArray(d)?!le(f,d,t):f!==d)return!1}}return!0}var H=e=>P(e)&&!Object.keys(e).length,ze=e=>e.type==="file",te=e=>typeof e=="function",Ve=e=>{if(!je)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Vt=e=>e.type==="select-multiple",Ge=e=>e.type==="radio",$t=e=>Ge(e)||he(e),Me=e=>Ve(e)&&e.isConnected;function jt(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=U(e)?i++:e[r[i++]];return e}function Kt(e){for(const r in e)if(e.hasOwnProperty(r)&&!U(e[r]))return!1;return!0}function B(e,r){const t=Array.isArray(r)?r:Se(r)?[r]:Ke(r),i=t.length===1?e:jt(e,t),n=t.length-1,l=t[n];return i&&delete i[l],n!==0&&(P(i)&&H(i)||Array.isArray(i)&&Kt(i))&&B(e,t.slice(0,-1)),e}var At=e=>{for(const r in e)if(te(e[r]))return!0;return!1};function Ae(e,r={}){const t=Array.isArray(e);if(P(e)||t)for(const i in e)Array.isArray(e[i])||P(e[i])&&!At(e[i])?(r[i]=Array.isArray(e[i])?[]:{},Ae(e[i],r[i])):$(e[i])||(r[i]=!0);return r}function xt(e,r,t){const i=Array.isArray(e);if(P(e)||i)for(const n in e)Array.isArray(e[n])||P(e[n])&&!At(e[n])?U(r)||qe(t[n])?t[n]=Array.isArray(e[n])?Ae(e[n],[]):{...Ae(e[n])}:xt(e[n],$(r)?{}:r[n],t[n]):t[n]=!le(e[n],r[n]);return t}var ge=(e,r)=>xt(e,r,Ae(r));const lt={value:!1,isValid:!1},ut={value:!0,isValid:!0};var St=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?ut:{value:e[0].value,isValid:!0}:ut:lt}return lt},wt=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>U(e)?e:r?e===""?NaN:e&&+e:t&&se(e)?new Date(e):i?i(e):e;const ot={isValid:!1,value:null};var kt=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,ot):ot;function ct(e){const r=e.ref;return ze(r)?r.files:Ge(r)?kt(e.refs).value:Vt(r)?[...r.selectedOptions].map(({value:t})=>t):he(r)?St(e.refs).value:wt(U(r.value)?e.ref.value:r.value,e)}var zt=(e,r,t,i)=>{const n={};for(const l of e){const f=c(r,l);f&&E(n,l,f._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:i}},xe=e=>e instanceof RegExp,_e=e=>U(e)?e:xe(e)?e.source:P(e)?xe(e.value)?e.value.source:e.value:e,de=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const dt="AsyncFunction";var Gt=e=>!!e&&!!e.validate&&!!(te(e.validate)&&e.validate.constructor.name===dt||P(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===dt)),Yt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),He=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const fe=(e,r,t,i)=>{for(const n of t||Object.keys(e)){const l=c(e,n);if(l){const{_f:f,...d}=l;if(f){if(f.refs&&f.refs[0]&&r(f.refs[0],n)&&!i)return!0;if(f.ref&&r(f.ref,f.name)&&!i)return!0;if(fe(d,r))break}else if(P(d)&&fe(d,r))break}}};function ft(e,r,t){const i=c(e,t);if(i||Se(t))return{error:i,name:t};const n=t.split(".");for(;n.length;){const l=n.join("."),f=c(r,l),d=c(e,l);if(f&&!Array.isArray(f)&&t!==l)return{name:t};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};n.pop()}return{name:t}}var Jt=(e,r,t,i)=>{t(e);const{name:n,...l}=e;return H(l)||Object.keys(l).length>=Object.keys(r).length||Object.keys(l).find(f=>r[f]===(!i||Z.all))},Qt=(e,r,t)=>!e||!r||e===r||K(e).some(i=>i&&(t?i===r:i.startsWith(r)||r.startsWith(i))),Xt=(e,r,t,i,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(r||e):(t?i.isOnBlur:n.isOnBlur)?!e:(t?i.isOnChange:n.isOnChange)?e:!0,Zt=(e,r)=>!we(c(e,r)).length&&B(e,r),Dt=(e,r,t)=>{const i=K(c(e,t));return E(i,"root",r[t]),E(e,t,i),e},be=e=>se(e);function yt(e,r,t="validate"){if(be(e)||Array.isArray(e)&&e.every(be)||Q(e)&&!e)return{type:t,message:be(e)?e:"",ref:r}}var ce=e=>P(e)&&!xe(e)?e:{value:e,message:""},$e=async(e,r,t,i,n,l)=>{const{ref:f,refs:d,required:b,maxLength:x,minLength:D,min:C,max:F,pattern:M,validate:z,name:R,valueAsNumber:L,mount:ee}=e._f,V=c(t,R);if(!ee||r.has(R))return{};const G=d?d[0]:f,W=w=>{n&&G.reportValidity&&(G.setCustomValidity(Q(w)?"":w||""),G.reportValidity())},I={},m=Ge(f),h=he(f),A=m||h,S=(L||ze(f))&&U(f.value)&&U(V)||Ve(f)&&f.value===""||V===""||Array.isArray(V)&&!V.length,Y=Ht.bind(null,R,i,I),J=(w,p,N,q=ie.maxLength,j=ie.minLength)=>{const re=w?p:N;I[R]={type:w?q:j,message:re,ref:f,...Y(w?q:j,re)}};if(l?!Array.isArray(V)||!V.length:b&&(!A&&(S||$(V))||Q(V)&&!V||h&&!St(d).isValid||m&&!kt(d).isValid)){const{value:w,message:p}=be(b)?{value:!!b,message:b}:ce(b);if(w&&(I[R]={type:ie.required,message:p,ref:G,...Y(ie.required,p)},!i))return W(p),I}if(!S&&(!$(C)||!$(F))){let w,p;const N=ce(F),q=ce(C);if(!$(V)&&!isNaN(V)){const j=f.valueAsNumber||V&&+V;$(N.value)||(w=j>N.value),$(q.value)||(p=j<q.value)}else{const j=f.valueAsDate||new Date(V),re=me=>new Date(new Date().toDateString()+" "+me),ye=f.type=="time",oe=f.type=="week";se(N.value)&&V&&(w=ye?re(V)>re(N.value):oe?V>N.value:j>new Date(N.value)),se(q.value)&&V&&(p=ye?re(V)<re(q.value):oe?V<q.value:j<new Date(q.value))}if((w||p)&&(J(!!w,N.message,q.message,ie.max,ie.min),!i))return W(I[R].message),I}if((x||D)&&!S&&(se(V)||l&&Array.isArray(V))){const w=ce(x),p=ce(D),N=!$(w.value)&&V.length>+w.value,q=!$(p.value)&&V.length<+p.value;if((N||q)&&(J(N,w.message,p.message),!i))return W(I[R].message),I}if(M&&!S&&se(V)){const{value:w,message:p}=ce(M);if(xe(w)&&!V.match(w)&&(I[R]={type:ie.pattern,message:p,ref:f,...Y(ie.pattern,p)},!i))return W(p),I}if(z){if(te(z)){const w=await z(V,t),p=yt(w,G);if(p&&(I[R]={...p,...Y(ie.validate,p.message)},!i))return W(p.message),I}else if(P(z)){let w={};for(const p in z){if(!H(w)&&!i)break;const N=yt(await z[p](V,t),G,p);N&&(w={...N,...Y(p,N.message)},W(N.message),i&&(I[R]=w))}if(!H(w)&&(I[R]={ref:G,...w},!i))return I}}return W(!0),I};const er={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function tr(e={}){let r={...er,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:te(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1};const i={};let n=P(r.defaultValues)||P(r.values)?T(r.defaultValues||r.values)||{}:{},l=r.shouldUnregister?{}:T(n),f={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,x=0;const D={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let C={...D};const F={array:nt(),state:nt()},M=r.criteriaMode===Z.all,z=s=>a=>{clearTimeout(x),x=setTimeout(s,a)},R=async s=>{if(!r.disabled&&(D.isValid||C.isValid||s)){const a=r.resolver?H((await h()).errors):await S(i,!0);a!==t.isValid&&F.state.next({isValid:a})}},L=(s,a)=>{!r.disabled&&(D.isValidating||D.validatingFields||C.isValidating||C.validatingFields)&&((s||Array.from(d.mount)).forEach(u=>{u&&(a?E(t.validatingFields,u,a):B(t.validatingFields,u))}),F.state.next({validatingFields:t.validatingFields,isValidating:!H(t.validatingFields)}))},ee=(s,a=[],u,g,y=!0,o=!0)=>{if(g&&u&&!r.disabled){if(f.action=!0,o&&Array.isArray(c(i,s))){const _=u(c(i,s),g.argA,g.argB);y&&E(i,s,_)}if(o&&Array.isArray(c(t.errors,s))){const _=u(c(t.errors,s),g.argA,g.argB);y&&E(t.errors,s,_),Zt(t.errors,s)}if((D.touchedFields||C.touchedFields)&&o&&Array.isArray(c(t.touchedFields,s))){const _=u(c(t.touchedFields,s),g.argA,g.argB);y&&E(t.touchedFields,s,_)}(D.dirtyFields||C.dirtyFields)&&(t.dirtyFields=ge(n,l)),F.state.next({name:s,isDirty:J(s,a),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else E(l,s,a)},V=(s,a)=>{E(t.errors,s,a),F.state.next({errors:t.errors})},G=s=>{t.errors=s,F.state.next({errors:t.errors,isValid:!1})},W=(s,a,u,g)=>{const y=c(i,s);if(y){const o=c(l,s,U(u)?c(n,s):u);U(o)||g&&g.defaultChecked||a?E(l,s,a?o:ct(y._f)):N(s,o),f.mount&&R()}},I=(s,a,u,g,y)=>{let o=!1,_=!1;const k={name:s};if(!r.disabled){if(!u||g){(D.isDirty||C.isDirty)&&(_=t.isDirty,t.isDirty=k.isDirty=J(),o=_!==k.isDirty);const O=le(c(n,s),a);_=!!c(t.dirtyFields,s),O?B(t.dirtyFields,s):E(t.dirtyFields,s,!0),k.dirtyFields=t.dirtyFields,o=o||(D.dirtyFields||C.dirtyFields)&&_!==!O}if(u){const O=c(t.touchedFields,s);O||(E(t.touchedFields,s,u),k.touchedFields=t.touchedFields,o=o||(D.touchedFields||C.touchedFields)&&O!==u)}o&&y&&F.state.next(k)}return o?k:{}},m=(s,a,u,g)=>{const y=c(t.errors,s),o=(D.isValid||C.isValid)&&Q(a)&&t.isValid!==a;if(r.delayError&&u?(b=z(()=>V(s,u)),b(r.delayError)):(clearTimeout(x),b=null,u?E(t.errors,s,u):B(t.errors,s)),(u?!le(y,u):y)||!H(g)||o){const _={...g,...o&&Q(a)?{isValid:a}:{},errors:t.errors,name:s};t={...t,..._},F.state.next(_)}},h=async s=>{L(s,!0);const a=await r.resolver(l,r.context,zt(s||d.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return L(s),a},A=async s=>{const{errors:a}=await h(s);if(s)for(const u of s){const g=c(a,u);g?E(t.errors,u,g):B(t.errors,u)}else t.errors=a;return a},S=async(s,a,u={valid:!0})=>{for(const g in s){const y=s[g];if(y){const{_f:o,..._}=y;if(o){const k=d.array.has(o.name),O=y._f&&Gt(y._f);O&&D.validatingFields&&L([g],!0);const X=await $e(y,d.disabled,l,M,r.shouldUseNativeValidation&&!a,k);if(O&&D.validatingFields&&L([g]),X[o.name]&&(u.valid=!1,a))break;!a&&(c(X,o.name)?k?Dt(t.errors,X,o.name):E(t.errors,o.name,X[o.name]):B(t.errors,o.name))}!H(_)&&await S(_,a,u)}}return u.valid},Y=()=>{for(const s of d.unMount){const a=c(i,s);a&&(a._f.refs?a._f.refs.every(u=>!Me(u)):!Me(a._f.ref))&&Ee(s)}d.unMount=new Set},J=(s,a)=>!r.disabled&&(s&&a&&E(l,s,a),!le(me(),n)),w=(s,a,u)=>Ft(s,d,{...f.mount?l:U(a)?n:se(s)?{[s]:a}:a},u,a),p=s=>we(c(f.mount?l:n,s,r.shouldUnregister?c(n,s,[]):[])),N=(s,a,u={})=>{const g=c(i,s);let y=a;if(g){const o=g._f;o&&(!o.disabled&&E(l,s,wt(a,o)),y=Ve(o.ref)&&$(a)?"":a,Vt(o.ref)?[...o.ref.options].forEach(_=>_.selected=y.includes(_.value)):o.refs?he(o.ref)?o.refs.forEach(_=>{(!_.defaultChecked||!_.disabled)&&(Array.isArray(y)?_.checked=!!y.find(k=>k===_.value):_.checked=y===_.value||!!y)}):o.refs.forEach(_=>_.checked=_.value===y):ze(o.ref)?o.ref.value="":(o.ref.value=y,o.ref.type||F.state.next({name:s,values:T(l)})))}(u.shouldDirty||u.shouldTouch)&&I(s,y,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&oe(s)},q=(s,a,u)=>{for(const g in a){if(!a.hasOwnProperty(g))return;const y=a[g],o=s+"."+g,_=c(i,o);(d.array.has(s)||P(y)||_&&!_._f)&&!ue(y)?q(o,y,u):N(o,y,u)}},j=(s,a,u={})=>{const g=c(i,s),y=d.array.has(s),o=T(a);E(l,s,o),y?(F.array.next({name:s,values:T(l)}),(D.isDirty||D.dirtyFields||C.isDirty||C.dirtyFields)&&u.shouldDirty&&F.state.next({name:s,dirtyFields:ge(n,l),isDirty:J(s,o)})):g&&!g._f&&!$(o)?q(s,o,u):N(s,o,u),He(s,d)&&F.state.next({...t}),F.state.next({name:f.mount?s:void 0,values:T(l)})},re=async s=>{f.mount=!0;const a=s.target;let u=a.name,g=!0;const y=c(i,u),o=O=>{g=Number.isNaN(O)||ue(O)&&isNaN(O.getTime())||le(O,c(l,u,O))},_=de(r.mode),k=de(r.reValidateMode);if(y){let O,X;const ve=a.type?ct(y._f):ht(s),ae=s.type===Fe.BLUR||s.type===Fe.FOCUS_OUT,Lt=!Yt(y._f)&&!r.resolver&&!c(t.errors,u)&&!y._f.deps||Xt(ae,c(t.touchedFields,u),t.isSubmitted,k,_),Oe=He(u,d,ae);E(l,u,ve),ae?(y._f.onBlur&&y._f.onBlur(s),b&&b(0)):y._f.onChange&&y._f.onChange(s);const Ue=I(u,ve,ae),Tt=!H(Ue)||Oe;if(!ae&&F.state.next({name:u,type:s.type,values:T(l)}),Lt)return(D.isValid||C.isValid)&&(r.mode==="onBlur"?ae&&R():ae||R()),Tt&&F.state.next({name:u,...Oe?{}:Ue});if(!ae&&Oe&&F.state.next({...t}),r.resolver){const{errors:st}=await h([u]);if(o(ve),g){const It=ft(t.errors,i,u),it=ft(st,i,It.name||u);O=it.error,u=it.name,X=H(st)}}else L([u],!0),O=(await $e(y,d.disabled,l,M,r.shouldUseNativeValidation))[u],L([u]),o(ve),g&&(O?X=!1:(D.isValid||C.isValid)&&(X=await S(i,!0)));g&&(y._f.deps&&oe(y._f.deps),m(u,X,O,Ue))}},ye=(s,a)=>{if(c(t.errors,a)&&s.focus)return s.focus(),1},oe=async(s,a={})=>{let u,g;const y=K(s);if(r.resolver){const o=await A(U(s)?s:y);u=H(o),g=s?!y.some(_=>c(o,_)):u}else s?(g=(await Promise.all(y.map(async o=>{const _=c(i,o);return await S(_&&_._f?{[o]:_}:_)}))).every(Boolean),!(!g&&!t.isValid)&&R()):g=u=await S(i);return F.state.next({...!se(s)||(D.isValid||C.isValid)&&u!==t.isValid?{}:{name:s},...r.resolver||!s?{isValid:u}:{},errors:t.errors}),a.shouldFocus&&!g&&fe(i,ye,s?y:d.mount),g},me=s=>{const a={...f.mount?l:n};return U(s)?a:se(s)?c(a,s):s.map(u=>c(a,u))},Ye=(s,a)=>({invalid:!!c((a||t).errors,s),isDirty:!!c((a||t).dirtyFields,s),error:c((a||t).errors,s),isValidating:!!c(t.validatingFields,s),isTouched:!!c((a||t).touchedFields,s)}),Et=s=>{s&&K(s).forEach(a=>B(t.errors,a)),F.state.next({errors:s?t.errors:{}})},Je=(s,a,u)=>{const g=(c(i,s,{_f:{}})._f||{}).ref,y=c(t.errors,s)||{},{ref:o,message:_,type:k,...O}=y;E(t.errors,s,{...O,...a,ref:g}),F.state.next({name:s,errors:t.errors,isValid:!1}),u&&u.shouldFocus&&g&&g.focus&&g.focus()},pt=(s,a)=>te(s)?F.state.subscribe({next:u=>s(w(void 0,a),u)}):w(s,a,!0),Qe=s=>F.state.subscribe({next:a=>{Qt(s.name,a.name,s.exact)&&Jt(a,s.formState||D,Rt,s.reRenderRoot)&&s.callback({values:{...l},...t,...a})}}).unsubscribe,Ct=s=>(f.mount=!0,C={...C,...s.formState},Qe({...s,formState:C})),Ee=(s,a={})=>{for(const u of s?K(s):d.mount)d.mount.delete(u),d.array.delete(u),a.keepValue||(B(i,u),B(l,u)),!a.keepError&&B(t.errors,u),!a.keepDirty&&B(t.dirtyFields,u),!a.keepTouched&&B(t.touchedFields,u),!a.keepIsValidating&&B(t.validatingFields,u),!r.shouldUnregister&&!a.keepDefaultValue&&B(n,u);F.state.next({values:T(l)}),F.state.next({...t,...a.keepDirty?{isDirty:J()}:{}}),!a.keepIsValid&&R()},Xe=({disabled:s,name:a})=>{(Q(s)&&f.mount||s||d.disabled.has(a))&&(s?d.disabled.add(a):d.disabled.delete(a))},pe=(s,a={})=>{let u=c(i,s);const g=Q(a.disabled)||Q(r.disabled);return E(i,s,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),u?Xe({disabled:Q(a.disabled)?a.disabled:r.disabled,name:s}):W(s,!0,a.value),{...g?{disabled:a.disabled||r.disabled}:{},...r.progressive?{required:!!a.required,min:_e(a.min),max:_e(a.max),minLength:_e(a.minLength),maxLength:_e(a.maxLength),pattern:_e(a.pattern)}:{},name:s,onChange:re,onBlur:re,ref:y=>{if(y){pe(s,a),u=c(i,s);const o=U(y.value)&&y.querySelectorAll&&y.querySelectorAll("input,select,textarea")[0]||y,_=$t(o),k=u._f.refs||[];if(_?k.find(O=>O===o):o===u._f.ref)return;E(i,s,{_f:{...u._f,..._?{refs:[...k.filter(Me),o,...Array.isArray(c(n,s))?[{}]:[]],ref:{type:o.type,name:s}}:{ref:o}}}),W(s,!1,void 0,o)}else u=c(i,s,{}),u._f&&(u._f.mount=!1),(r.shouldUnregister||a.shouldUnregister)&&!(mt(d.array,s)&&f.action)&&d.unMount.add(s)}}},Ce=()=>r.shouldFocusError&&fe(i,ye,d.mount),Ot=s=>{Q(s)&&(F.state.next({disabled:s}),fe(i,(a,u)=>{const g=c(i,u);g&&(a.disabled=g._f.disabled||s,Array.isArray(g._f.refs)&&g._f.refs.forEach(y=>{y.disabled=g._f.disabled||s}))},0,!1))},Ze=(s,a)=>async u=>{let g;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let y=T(l);if(F.state.next({isSubmitting:!0}),r.resolver){const{errors:o,values:_}=await h();t.errors=o,y=T(_)}else await S(i);if(d.disabled.size)for(const o of d.disabled)B(y,o);if(B(t.errors,"root"),H(t.errors)){F.state.next({errors:{}});try{await s(y,u)}catch(o){g=o}}else a&&await a({...t.errors},u),Ce(),setTimeout(Ce);if(F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:H(t.errors)&&!g,submitCount:t.submitCount+1,errors:t.errors}),g)throw g},Ut=(s,a={})=>{c(i,s)&&(U(a.defaultValue)?j(s,T(c(n,s))):(j(s,a.defaultValue),E(n,s,T(a.defaultValue))),a.keepTouched||B(t.touchedFields,s),a.keepDirty||(B(t.dirtyFields,s),t.isDirty=a.defaultValue?J(s,T(c(n,s))):J()),a.keepError||(B(t.errors,s),D.isValid&&R()),F.state.next({...t}))},et=(s,a={})=>{const u=s?T(s):n,g=T(u),y=H(s),o=y?n:g;if(a.keepDefaultValues||(n=u),!a.keepValues){if(a.keepDirtyValues){const _=new Set([...d.mount,...Object.keys(ge(n,l))]);for(const k of Array.from(_))c(t.dirtyFields,k)?E(o,k,c(l,k)):j(k,c(o,k))}else{if(je&&U(s))for(const _ of d.mount){const k=c(i,_);if(k&&k._f){const O=Array.isArray(k._f.refs)?k._f.refs[0]:k._f.ref;if(Ve(O)){const X=O.closest("form");if(X){X.reset();break}}}}for(const _ of d.mount){const k=c(o,_,c(n,_));U(k)||(E(o,_,k),j(_,c(o,_)))}}l=T(o),F.array.next({values:{...o}}),F.state.next({values:{...o}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!D.isValid||!!a.keepIsValid||!!a.keepDirtyValues,f.watch=!!r.shouldUnregister,F.state.next({submitCount:a.keepSubmitCount?t.submitCount:0,isDirty:y?!1:a.keepDirty?t.isDirty:!!(a.keepDefaultValues&&!le(s,n)),isSubmitted:a.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:y?{}:a.keepDirtyValues?a.keepDefaultValues&&l?ge(n,l):t.dirtyFields:a.keepDefaultValues&&s?ge(n,s):a.keepDirty?t.dirtyFields:{},touchedFields:a.keepTouched?t.touchedFields:{},errors:a.keepErrors?t.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},tt=(s,a)=>et(te(s)?s(l):s,a),Mt=(s,a={})=>{const u=c(i,s),g=u&&u._f;if(g){const y=g.refs?g.refs[0]:g.ref;y.focus&&(y.focus(),a.shouldSelect&&te(y.select)&&y.select())}},Rt=s=>{t={...t,...s}},rt={control:{register:pe,unregister:Ee,getFieldState:Ye,handleSubmit:Ze,setError:Je,_subscribe:Qe,_runSchema:h,_focusError:Ce,_getWatch:w,_getDirty:J,_setValid:R,_setFieldArray:ee,_setDisabledField:Xe,_setErrors:G,_getFieldArray:p,_reset:et,_resetDefaultValues:()=>te(r.defaultValues)&&r.defaultValues().then(s=>{tt(s,r.resetOptions),F.state.next({isLoading:!1})}),_removeUnmounted:Y,_disableForm:Ot,_subjects:F,_proxyFormState:D,get _fields(){return i},get _formValues(){return l},get _state(){return f},set _state(s){f=s},get _defaultValues(){return n},get _names(){return d},set _names(s){d=s},get _formState(){return t},get _options(){return r},set _options(s){r={...r,...s}}},subscribe:Ct,trigger:oe,register:pe,handleSubmit:Ze,watch:pt,setValue:j,getValues:me,reset:tt,resetField:Ut,clearErrors:Et,unregister:Ee,setError:Je,setFocus:Mt,getFieldState:Ye};return{...rt,formControl:rt}}var ne=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const t=(Math.random()*16+e)%16|0;return(r=="x"?t:t&3|8).toString(16)})},Re=(e,r,t={})=>t.shouldFocus||U(t.shouldFocus)?t.focusName||`${e}.${U(t.focusIndex)?r:t.focusIndex}.`:"",Le=(e,r)=>[...e,...K(r)],Te=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ie(e,r,t){return[...e.slice(0,r),...K(t),...e.slice(r)]}var Ne=(e,r,t)=>Array.isArray(e)?(U(e[t])&&(e[t]=void 0),e.splice(t,0,e.splice(r,1)[0]),e):[],Be=(e,r)=>[...K(r),...K(e)];function rr(e,r){let t=0;const i=[...e];for(const n of r)i.splice(n-t,1),t++;return we(i).length?i:[]}var Pe=(e,r)=>U(r)?[]:rr(e,K(r).sort((t,i)=>t-i)),We=(e,r,t)=>{[e[r],e[t]]=[e[t],e[r]]},gt=(e,r,t)=>(e[r]=t,e);function nr(e){const r=ke(),{control:t=r.control,name:i,keyName:n="id",shouldUnregister:l,rules:f}=e,[d,b]=v.useState(t._getFieldArray(i)),x=v.useRef(t._getFieldArray(i).map(ne)),D=v.useRef(d),C=v.useRef(i),F=v.useRef(!1);C.current=i,D.current=d,t._names.array.add(i),f&&t.register(i,f),De(()=>t._subjects.array.subscribe({next:({values:m,name:h})=>{if(h===C.current||!h){const A=c(m,C.current);Array.isArray(A)&&(b(A),x.current=A.map(ne))}}}).unsubscribe,[t]);const M=v.useCallback(m=>{F.current=!0,t._setFieldArray(i,m)},[t,i]),z=(m,h)=>{const A=K(T(m)),S=Le(t._getFieldArray(i),A);t._names.focus=Re(i,S.length-1,h),x.current=Le(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Le,{argA:Te(m)})},R=(m,h)=>{const A=K(T(m)),S=Be(t._getFieldArray(i),A);t._names.focus=Re(i,0,h),x.current=Be(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Be,{argA:Te(m)})},L=m=>{const h=Pe(t._getFieldArray(i),m);x.current=Pe(x.current,m),M(h),b(h),!Array.isArray(c(t._fields,i))&&E(t._fields,i,void 0),t._setFieldArray(i,h,Pe,{argA:m})},ee=(m,h,A)=>{const S=K(T(h)),Y=Ie(t._getFieldArray(i),m,S);t._names.focus=Re(i,m,A),x.current=Ie(x.current,m,S.map(ne)),M(Y),b(Y),t._setFieldArray(i,Y,Ie,{argA:m,argB:Te(h)})},V=(m,h)=>{const A=t._getFieldArray(i);We(A,m,h),We(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,We,{argA:m,argB:h},!1)},G=(m,h)=>{const A=t._getFieldArray(i);Ne(A,m,h),Ne(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,Ne,{argA:m,argB:h},!1)},W=(m,h)=>{const A=T(h),S=gt(t._getFieldArray(i),m,A);x.current=[...S].map((Y,J)=>!Y||J===m?ne():x.current[J]),M(S),b([...S]),t._setFieldArray(i,S,gt,{argA:m,argB:A},!0,!1)},I=m=>{const h=K(T(m));x.current=h.map(ne),M([...h]),b([...h]),t._setFieldArray(i,[...h],A=>A,{},!0,!1)};return v.useEffect(()=>{if(t._state.action=!1,He(i,t._names)&&t._subjects.state.next({...t._formState}),F.current&&(!de(t._options.mode).isOnSubmit||t._formState.isSubmitted)&&!de(t._options.reValidateMode).isOnSubmit)if(t._options.resolver)t._runSchema([i]).then(m=>{const h=c(m.errors,i),A=c(t._formState.errors,i);(A?!h&&A.type||h&&(A.type!==h.type||A.message!==h.message):h&&h.type)&&(h?E(t._formState.errors,i,h):B(t._formState.errors,i),t._subjects.state.next({errors:t._formState.errors}))});else{const m=c(t._fields,i);m&&m._f&&!(de(t._options.reValidateMode).isOnSubmit&&de(t._options.mode).isOnSubmit)&&$e(m,t._names.disabled,t._formValues,t._options.criteriaMode===Z.all,t._options.shouldUseNativeValidation,!0).then(h=>!H(h)&&t._subjects.state.next({errors:Dt(t._formState.errors,h,i)}))}t._subjects.state.next({name:i,values:T(t._formValues)}),t._names.focus&&fe(t._fields,(m,h)=>{if(t._names.focus&&h.startsWith(t._names.focus)&&m.focus)return m.focus(),1}),t._names.focus="",t._setValid(),F.current=!1},[d,i,t]),v.useEffect(()=>(!c(t._formValues,i)&&t._setFieldArray(i),()=>{const m=(h,A)=>{const S=c(t._fields,h);S&&S._f&&(S._f.mount=A)};t._options.shouldUnregister||l?t.unregister(i):m(i,!1)}),[i,t,n,l]),{swap:v.useCallback(V,[M,i,t]),move:v.useCallback(G,[M,i,t]),prepend:v.useCallback(R,[M,i,t]),append:v.useCallback(z,[M,i,t]),remove:v.useCallback(L,[M,i,t]),insert:v.useCallback(ee,[M,i,t]),update:v.useCallback(W,[M,i,t]),replace:v.useCallback(I,[M,i,t]),fields:v.useMemo(()=>d.map((m,h)=>({...m,[n]:x.current[h]||ne()})),[d,n])}}function lr(e={}){const r=v.useRef(void 0),t=v.useRef(void 0),[i,n]=v.useState({isDirty:!1,isValidating:!1,isLoading:te(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:te(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:i},e.defaultValues&&!te(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:f,...d}=tr(e);r.current={...d,formState:i}}const l=r.current.control;return l._options=e,De(()=>{const f=l._subscribe({formState:l._proxyFormState,callback:()=>n({...l._formState}),reRenderRoot:!0});return n(d=>({...d,isReady:!0})),l._formState.isReady=!0,f},[l]),v.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),v.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),v.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),v.useEffect(()=>{if(l._proxyFormState.isDirty){const f=l._getDirty();f!==i.isDirty&&l._subjects.state.next({isDirty:f})}},[l,i.isDirty]),v.useEffect(()=>{e.values&&!le(e.values,t.current)?(l._reset(e.values,l._options.resetOptions),t.current=e.values,n(f=>({...f}))):l._resetDefaultValues()},[l,e.values]),v.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),r.current.formState=bt(i,l),r.current}export{ar as C,Wt as a,nr as b,lr as u};
|
|
1
|
+
import{bf as v,r as at}from"./index-CrQaw0BF.js";var he=e=>e.type==="checkbox",ue=e=>e instanceof Date,$=e=>e==null;const _t=e=>typeof e=="object";var P=e=>!$(e)&&!Array.isArray(e)&&_t(e)&&!ue(e),ht=e=>P(e)&&e.target?he(e.target)?e.target.checked:e.target.value:e,Nt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mt=(e,r)=>e.has(Nt(r)),Bt=e=>{const r=e.constructor&&e.constructor.prototype;return P(r)&&r.hasOwnProperty("isPrototypeOf")},je=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function T(e){let r;const t=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(e instanceof Set)r=new Set(e);else if(!(je&&(e instanceof Blob||i))&&(t||P(e)))if(r=t?[]:{},!t&&!Bt(e))r=e;else for(const n in e)e.hasOwnProperty(n)&&(r[n]=T(e[n]));else return e;return r}var Se=e=>/^\w*$/.test(e),U=e=>e===void 0,we=e=>Array.isArray(e)?e.filter(Boolean):[],Ke=e=>we(e.replace(/["|']|\]/g,"").split(/\.|\[/)),c=(e,r,t)=>{if(!r||!P(e))return t;const i=(Se(r)?[r]:Ke(r)).reduce((n,l)=>$(n)?n:n[l],e);return U(i)||i===e?U(e[r])?t:e[r]:i},Q=e=>typeof e=="boolean",E=(e,r,t)=>{let i=-1;const n=Se(r)?[r]:Ke(r),l=n.length,f=l-1;for(;++i<l;){const d=n[i];let b=t;if(i!==f){const x=e[d];b=P(x)||Array.isArray(x)?x:isNaN(+n[i+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;e[d]=b,e=e[d]}};const Fe={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},vt=v.createContext(null);vt.displayName="HookFormContext";const ke=()=>v.useContext(vt);var bt=(e,r,t,i=!0)=>{const n={defaultValues:r._defaultValues};for(const l in e)Object.defineProperty(n,l,{get:()=>{const f=l;return r._proxyFormState[f]!==Z.all&&(r._proxyFormState[f]=!i||Z.all),t&&(t[f]=!0),e[f]}});return n};const De=typeof window<"u"?at.useLayoutEffect:at.useEffect;function Pt(e){const r=ke(),{control:t=r.control,disabled:i,name:n,exact:l}=e||{},[f,d]=v.useState(t._formState),b=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return De(()=>t._subscribe({name:n,formState:b.current,exact:l,callback:x=>{!i&&d({...t._formState,...x})}}),[n,i,l]),v.useEffect(()=>{b.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>bt(f,t,b.current,!1),[f,t])}var se=e=>typeof e=="string",Ft=(e,r,t,i,n)=>se(e)?(i&&r.watch.add(e),c(t,e,n)):Array.isArray(e)?e.map(l=>(i&&r.watch.add(l),c(t,l))):(i&&(r.watchAll=!0),t);function Wt(e){const r=ke(),{control:t=r.control,name:i,defaultValue:n,disabled:l,exact:f}=e||{},d=v.useRef(n),[b,x]=v.useState(t._getWatch(i,d.current));return De(()=>t._subscribe({name:i,formState:{values:!0},exact:f,callback:D=>!l&&x(Ft(i,t._names,D.values||t._formValues,!1,d.current))}),[i,t,l,f]),v.useEffect(()=>t._removeUnmounted()),b}function qt(e){const r=ke(),{name:t,disabled:i,control:n=r.control,shouldUnregister:l}=e,f=mt(n._names.array,t),d=Wt({control:n,name:t,defaultValue:c(n._formValues,t,c(n._defaultValues,t,e.defaultValue)),exact:!0}),b=Pt({control:n,name:t,exact:!0}),x=v.useRef(e),D=v.useRef(n.register(t,{...e.rules,value:d,...Q(e.disabled)?{disabled:e.disabled}:{}})),C=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!c(b.errors,t)},isDirty:{enumerable:!0,get:()=>!!c(b.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!c(b.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!c(b.validatingFields,t)},error:{enumerable:!0,get:()=>c(b.errors,t)}}),[b,t]),F=v.useCallback(L=>D.current.onChange({target:{value:ht(L),name:t},type:Fe.CHANGE}),[t]),M=v.useCallback(()=>D.current.onBlur({target:{value:c(n._formValues,t),name:t},type:Fe.BLUR}),[t,n._formValues]),z=v.useCallback(L=>{const ee=c(n._fields,t);ee&&L&&(ee._f.ref={focus:()=>L.focus&&L.focus(),select:()=>L.select&&L.select(),setCustomValidity:V=>L.setCustomValidity(V),reportValidity:()=>L.reportValidity()})},[n._fields,t]),R=v.useMemo(()=>({name:t,value:d,...Q(i)||b.disabled?{disabled:b.disabled||i}:{},onChange:F,onBlur:M,ref:z}),[t,i,b.disabled,F,M,z,d]);return v.useEffect(()=>{const L=n._options.shouldUnregister||l;n.register(t,{...x.current.rules,...Q(x.current.disabled)?{disabled:x.current.disabled}:{}});const ee=(V,G)=>{const W=c(n._fields,V);W&&W._f&&(W._f.mount=G)};if(ee(t,!0),L){const V=T(c(n._options.defaultValues,t));E(n._defaultValues,t,V),U(c(n._formValues,t))&&E(n._formValues,t,V)}return!f&&n.register(t),()=>{(f?L&&!n._state.action:L)?n.unregister(t):ee(t,!1)}},[t,n,f,l]),v.useEffect(()=>{n._setDisabledField({disabled:i,name:t})},[i,t,n]),v.useMemo(()=>({field:R,formState:b,fieldState:C}),[R,b,C])}const ar=e=>e.render(qt(e));var Ht=(e,r,t,i,n)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[i]:n||!0}}:{},K=e=>Array.isArray(e)?e:[e],nt=()=>{let e=[];return{get observers(){return e},next:n=>{for(const l of e)l.next&&l.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(l=>l!==n)}}),unsubscribe:()=>{e=[]}}},qe=e=>$(e)||!_t(e);function le(e,r,t=new WeakSet){if(qe(e)||qe(r))return e===r;if(ue(e)&&ue(r))return e.getTime()===r.getTime();const i=Object.keys(e),n=Object.keys(r);if(i.length!==n.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const l of i){const f=e[l];if(!n.includes(l))return!1;if(l!=="ref"){const d=r[l];if(ue(f)&&ue(d)||P(f)&&P(d)||Array.isArray(f)&&Array.isArray(d)?!le(f,d,t):f!==d)return!1}}return!0}var H=e=>P(e)&&!Object.keys(e).length,ze=e=>e.type==="file",te=e=>typeof e=="function",Ve=e=>{if(!je)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Vt=e=>e.type==="select-multiple",Ge=e=>e.type==="radio",$t=e=>Ge(e)||he(e),Me=e=>Ve(e)&&e.isConnected;function jt(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=U(e)?i++:e[r[i++]];return e}function Kt(e){for(const r in e)if(e.hasOwnProperty(r)&&!U(e[r]))return!1;return!0}function B(e,r){const t=Array.isArray(r)?r:Se(r)?[r]:Ke(r),i=t.length===1?e:jt(e,t),n=t.length-1,l=t[n];return i&&delete i[l],n!==0&&(P(i)&&H(i)||Array.isArray(i)&&Kt(i))&&B(e,t.slice(0,-1)),e}var At=e=>{for(const r in e)if(te(e[r]))return!0;return!1};function Ae(e,r={}){const t=Array.isArray(e);if(P(e)||t)for(const i in e)Array.isArray(e[i])||P(e[i])&&!At(e[i])?(r[i]=Array.isArray(e[i])?[]:{},Ae(e[i],r[i])):$(e[i])||(r[i]=!0);return r}function xt(e,r,t){const i=Array.isArray(e);if(P(e)||i)for(const n in e)Array.isArray(e[n])||P(e[n])&&!At(e[n])?U(r)||qe(t[n])?t[n]=Array.isArray(e[n])?Ae(e[n],[]):{...Ae(e[n])}:xt(e[n],$(r)?{}:r[n],t[n]):t[n]=!le(e[n],r[n]);return t}var ge=(e,r)=>xt(e,r,Ae(r));const lt={value:!1,isValid:!1},ut={value:!0,isValid:!0};var St=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?ut:{value:e[0].value,isValid:!0}:ut:lt}return lt},wt=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>U(e)?e:r?e===""?NaN:e&&+e:t&&se(e)?new Date(e):i?i(e):e;const ot={isValid:!1,value:null};var kt=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,ot):ot;function ct(e){const r=e.ref;return ze(r)?r.files:Ge(r)?kt(e.refs).value:Vt(r)?[...r.selectedOptions].map(({value:t})=>t):he(r)?St(e.refs).value:wt(U(r.value)?e.ref.value:r.value,e)}var zt=(e,r,t,i)=>{const n={};for(const l of e){const f=c(r,l);f&&E(n,l,f._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:i}},xe=e=>e instanceof RegExp,_e=e=>U(e)?e:xe(e)?e.source:P(e)?xe(e.value)?e.value.source:e.value:e,de=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const dt="AsyncFunction";var Gt=e=>!!e&&!!e.validate&&!!(te(e.validate)&&e.validate.constructor.name===dt||P(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===dt)),Yt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),He=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const fe=(e,r,t,i)=>{for(const n of t||Object.keys(e)){const l=c(e,n);if(l){const{_f:f,...d}=l;if(f){if(f.refs&&f.refs[0]&&r(f.refs[0],n)&&!i)return!0;if(f.ref&&r(f.ref,f.name)&&!i)return!0;if(fe(d,r))break}else if(P(d)&&fe(d,r))break}}};function ft(e,r,t){const i=c(e,t);if(i||Se(t))return{error:i,name:t};const n=t.split(".");for(;n.length;){const l=n.join("."),f=c(r,l),d=c(e,l);if(f&&!Array.isArray(f)&&t!==l)return{name:t};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};n.pop()}return{name:t}}var Jt=(e,r,t,i)=>{t(e);const{name:n,...l}=e;return H(l)||Object.keys(l).length>=Object.keys(r).length||Object.keys(l).find(f=>r[f]===(!i||Z.all))},Qt=(e,r,t)=>!e||!r||e===r||K(e).some(i=>i&&(t?i===r:i.startsWith(r)||r.startsWith(i))),Xt=(e,r,t,i,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(r||e):(t?i.isOnBlur:n.isOnBlur)?!e:(t?i.isOnChange:n.isOnChange)?e:!0,Zt=(e,r)=>!we(c(e,r)).length&&B(e,r),Dt=(e,r,t)=>{const i=K(c(e,t));return E(i,"root",r[t]),E(e,t,i),e},be=e=>se(e);function yt(e,r,t="validate"){if(be(e)||Array.isArray(e)&&e.every(be)||Q(e)&&!e)return{type:t,message:be(e)?e:"",ref:r}}var ce=e=>P(e)&&!xe(e)?e:{value:e,message:""},$e=async(e,r,t,i,n,l)=>{const{ref:f,refs:d,required:b,maxLength:x,minLength:D,min:C,max:F,pattern:M,validate:z,name:R,valueAsNumber:L,mount:ee}=e._f,V=c(t,R);if(!ee||r.has(R))return{};const G=d?d[0]:f,W=w=>{n&&G.reportValidity&&(G.setCustomValidity(Q(w)?"":w||""),G.reportValidity())},I={},m=Ge(f),h=he(f),A=m||h,S=(L||ze(f))&&U(f.value)&&U(V)||Ve(f)&&f.value===""||V===""||Array.isArray(V)&&!V.length,Y=Ht.bind(null,R,i,I),J=(w,p,N,q=ie.maxLength,j=ie.minLength)=>{const re=w?p:N;I[R]={type:w?q:j,message:re,ref:f,...Y(w?q:j,re)}};if(l?!Array.isArray(V)||!V.length:b&&(!A&&(S||$(V))||Q(V)&&!V||h&&!St(d).isValid||m&&!kt(d).isValid)){const{value:w,message:p}=be(b)?{value:!!b,message:b}:ce(b);if(w&&(I[R]={type:ie.required,message:p,ref:G,...Y(ie.required,p)},!i))return W(p),I}if(!S&&(!$(C)||!$(F))){let w,p;const N=ce(F),q=ce(C);if(!$(V)&&!isNaN(V)){const j=f.valueAsNumber||V&&+V;$(N.value)||(w=j>N.value),$(q.value)||(p=j<q.value)}else{const j=f.valueAsDate||new Date(V),re=me=>new Date(new Date().toDateString()+" "+me),ye=f.type=="time",oe=f.type=="week";se(N.value)&&V&&(w=ye?re(V)>re(N.value):oe?V>N.value:j>new Date(N.value)),se(q.value)&&V&&(p=ye?re(V)<re(q.value):oe?V<q.value:j<new Date(q.value))}if((w||p)&&(J(!!w,N.message,q.message,ie.max,ie.min),!i))return W(I[R].message),I}if((x||D)&&!S&&(se(V)||l&&Array.isArray(V))){const w=ce(x),p=ce(D),N=!$(w.value)&&V.length>+w.value,q=!$(p.value)&&V.length<+p.value;if((N||q)&&(J(N,w.message,p.message),!i))return W(I[R].message),I}if(M&&!S&&se(V)){const{value:w,message:p}=ce(M);if(xe(w)&&!V.match(w)&&(I[R]={type:ie.pattern,message:p,ref:f,...Y(ie.pattern,p)},!i))return W(p),I}if(z){if(te(z)){const w=await z(V,t),p=yt(w,G);if(p&&(I[R]={...p,...Y(ie.validate,p.message)},!i))return W(p.message),I}else if(P(z)){let w={};for(const p in z){if(!H(w)&&!i)break;const N=yt(await z[p](V,t),G,p);N&&(w={...N,...Y(p,N.message)},W(N.message),i&&(I[R]=w))}if(!H(w)&&(I[R]={ref:G,...w},!i))return I}}return W(!0),I};const er={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function tr(e={}){let r={...er,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:te(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1};const i={};let n=P(r.defaultValues)||P(r.values)?T(r.defaultValues||r.values)||{}:{},l=r.shouldUnregister?{}:T(n),f={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,x=0;const D={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let C={...D};const F={array:nt(),state:nt()},M=r.criteriaMode===Z.all,z=s=>a=>{clearTimeout(x),x=setTimeout(s,a)},R=async s=>{if(!r.disabled&&(D.isValid||C.isValid||s)){const a=r.resolver?H((await h()).errors):await S(i,!0);a!==t.isValid&&F.state.next({isValid:a})}},L=(s,a)=>{!r.disabled&&(D.isValidating||D.validatingFields||C.isValidating||C.validatingFields)&&((s||Array.from(d.mount)).forEach(u=>{u&&(a?E(t.validatingFields,u,a):B(t.validatingFields,u))}),F.state.next({validatingFields:t.validatingFields,isValidating:!H(t.validatingFields)}))},ee=(s,a=[],u,g,y=!0,o=!0)=>{if(g&&u&&!r.disabled){if(f.action=!0,o&&Array.isArray(c(i,s))){const _=u(c(i,s),g.argA,g.argB);y&&E(i,s,_)}if(o&&Array.isArray(c(t.errors,s))){const _=u(c(t.errors,s),g.argA,g.argB);y&&E(t.errors,s,_),Zt(t.errors,s)}if((D.touchedFields||C.touchedFields)&&o&&Array.isArray(c(t.touchedFields,s))){const _=u(c(t.touchedFields,s),g.argA,g.argB);y&&E(t.touchedFields,s,_)}(D.dirtyFields||C.dirtyFields)&&(t.dirtyFields=ge(n,l)),F.state.next({name:s,isDirty:J(s,a),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else E(l,s,a)},V=(s,a)=>{E(t.errors,s,a),F.state.next({errors:t.errors})},G=s=>{t.errors=s,F.state.next({errors:t.errors,isValid:!1})},W=(s,a,u,g)=>{const y=c(i,s);if(y){const o=c(l,s,U(u)?c(n,s):u);U(o)||g&&g.defaultChecked||a?E(l,s,a?o:ct(y._f)):N(s,o),f.mount&&R()}},I=(s,a,u,g,y)=>{let o=!1,_=!1;const k={name:s};if(!r.disabled){if(!u||g){(D.isDirty||C.isDirty)&&(_=t.isDirty,t.isDirty=k.isDirty=J(),o=_!==k.isDirty);const O=le(c(n,s),a);_=!!c(t.dirtyFields,s),O?B(t.dirtyFields,s):E(t.dirtyFields,s,!0),k.dirtyFields=t.dirtyFields,o=o||(D.dirtyFields||C.dirtyFields)&&_!==!O}if(u){const O=c(t.touchedFields,s);O||(E(t.touchedFields,s,u),k.touchedFields=t.touchedFields,o=o||(D.touchedFields||C.touchedFields)&&O!==u)}o&&y&&F.state.next(k)}return o?k:{}},m=(s,a,u,g)=>{const y=c(t.errors,s),o=(D.isValid||C.isValid)&&Q(a)&&t.isValid!==a;if(r.delayError&&u?(b=z(()=>V(s,u)),b(r.delayError)):(clearTimeout(x),b=null,u?E(t.errors,s,u):B(t.errors,s)),(u?!le(y,u):y)||!H(g)||o){const _={...g,...o&&Q(a)?{isValid:a}:{},errors:t.errors,name:s};t={...t,..._},F.state.next(_)}},h=async s=>{L(s,!0);const a=await r.resolver(l,r.context,zt(s||d.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return L(s),a},A=async s=>{const{errors:a}=await h(s);if(s)for(const u of s){const g=c(a,u);g?E(t.errors,u,g):B(t.errors,u)}else t.errors=a;return a},S=async(s,a,u={valid:!0})=>{for(const g in s){const y=s[g];if(y){const{_f:o,..._}=y;if(o){const k=d.array.has(o.name),O=y._f&&Gt(y._f);O&&D.validatingFields&&L([g],!0);const X=await $e(y,d.disabled,l,M,r.shouldUseNativeValidation&&!a,k);if(O&&D.validatingFields&&L([g]),X[o.name]&&(u.valid=!1,a))break;!a&&(c(X,o.name)?k?Dt(t.errors,X,o.name):E(t.errors,o.name,X[o.name]):B(t.errors,o.name))}!H(_)&&await S(_,a,u)}}return u.valid},Y=()=>{for(const s of d.unMount){const a=c(i,s);a&&(a._f.refs?a._f.refs.every(u=>!Me(u)):!Me(a._f.ref))&&Ee(s)}d.unMount=new Set},J=(s,a)=>!r.disabled&&(s&&a&&E(l,s,a),!le(me(),n)),w=(s,a,u)=>Ft(s,d,{...f.mount?l:U(a)?n:se(s)?{[s]:a}:a},u,a),p=s=>we(c(f.mount?l:n,s,r.shouldUnregister?c(n,s,[]):[])),N=(s,a,u={})=>{const g=c(i,s);let y=a;if(g){const o=g._f;o&&(!o.disabled&&E(l,s,wt(a,o)),y=Ve(o.ref)&&$(a)?"":a,Vt(o.ref)?[...o.ref.options].forEach(_=>_.selected=y.includes(_.value)):o.refs?he(o.ref)?o.refs.forEach(_=>{(!_.defaultChecked||!_.disabled)&&(Array.isArray(y)?_.checked=!!y.find(k=>k===_.value):_.checked=y===_.value||!!y)}):o.refs.forEach(_=>_.checked=_.value===y):ze(o.ref)?o.ref.value="":(o.ref.value=y,o.ref.type||F.state.next({name:s,values:T(l)})))}(u.shouldDirty||u.shouldTouch)&&I(s,y,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&oe(s)},q=(s,a,u)=>{for(const g in a){if(!a.hasOwnProperty(g))return;const y=a[g],o=s+"."+g,_=c(i,o);(d.array.has(s)||P(y)||_&&!_._f)&&!ue(y)?q(o,y,u):N(o,y,u)}},j=(s,a,u={})=>{const g=c(i,s),y=d.array.has(s),o=T(a);E(l,s,o),y?(F.array.next({name:s,values:T(l)}),(D.isDirty||D.dirtyFields||C.isDirty||C.dirtyFields)&&u.shouldDirty&&F.state.next({name:s,dirtyFields:ge(n,l),isDirty:J(s,o)})):g&&!g._f&&!$(o)?q(s,o,u):N(s,o,u),He(s,d)&&F.state.next({...t}),F.state.next({name:f.mount?s:void 0,values:T(l)})},re=async s=>{f.mount=!0;const a=s.target;let u=a.name,g=!0;const y=c(i,u),o=O=>{g=Number.isNaN(O)||ue(O)&&isNaN(O.getTime())||le(O,c(l,u,O))},_=de(r.mode),k=de(r.reValidateMode);if(y){let O,X;const ve=a.type?ct(y._f):ht(s),ae=s.type===Fe.BLUR||s.type===Fe.FOCUS_OUT,Lt=!Yt(y._f)&&!r.resolver&&!c(t.errors,u)&&!y._f.deps||Xt(ae,c(t.touchedFields,u),t.isSubmitted,k,_),Oe=He(u,d,ae);E(l,u,ve),ae?(y._f.onBlur&&y._f.onBlur(s),b&&b(0)):y._f.onChange&&y._f.onChange(s);const Ue=I(u,ve,ae),Tt=!H(Ue)||Oe;if(!ae&&F.state.next({name:u,type:s.type,values:T(l)}),Lt)return(D.isValid||C.isValid)&&(r.mode==="onBlur"?ae&&R():ae||R()),Tt&&F.state.next({name:u,...Oe?{}:Ue});if(!ae&&Oe&&F.state.next({...t}),r.resolver){const{errors:st}=await h([u]);if(o(ve),g){const It=ft(t.errors,i,u),it=ft(st,i,It.name||u);O=it.error,u=it.name,X=H(st)}}else L([u],!0),O=(await $e(y,d.disabled,l,M,r.shouldUseNativeValidation))[u],L([u]),o(ve),g&&(O?X=!1:(D.isValid||C.isValid)&&(X=await S(i,!0)));g&&(y._f.deps&&oe(y._f.deps),m(u,X,O,Ue))}},ye=(s,a)=>{if(c(t.errors,a)&&s.focus)return s.focus(),1},oe=async(s,a={})=>{let u,g;const y=K(s);if(r.resolver){const o=await A(U(s)?s:y);u=H(o),g=s?!y.some(_=>c(o,_)):u}else s?(g=(await Promise.all(y.map(async o=>{const _=c(i,o);return await S(_&&_._f?{[o]:_}:_)}))).every(Boolean),!(!g&&!t.isValid)&&R()):g=u=await S(i);return F.state.next({...!se(s)||(D.isValid||C.isValid)&&u!==t.isValid?{}:{name:s},...r.resolver||!s?{isValid:u}:{},errors:t.errors}),a.shouldFocus&&!g&&fe(i,ye,s?y:d.mount),g},me=s=>{const a={...f.mount?l:n};return U(s)?a:se(s)?c(a,s):s.map(u=>c(a,u))},Ye=(s,a)=>({invalid:!!c((a||t).errors,s),isDirty:!!c((a||t).dirtyFields,s),error:c((a||t).errors,s),isValidating:!!c(t.validatingFields,s),isTouched:!!c((a||t).touchedFields,s)}),Et=s=>{s&&K(s).forEach(a=>B(t.errors,a)),F.state.next({errors:s?t.errors:{}})},Je=(s,a,u)=>{const g=(c(i,s,{_f:{}})._f||{}).ref,y=c(t.errors,s)||{},{ref:o,message:_,type:k,...O}=y;E(t.errors,s,{...O,...a,ref:g}),F.state.next({name:s,errors:t.errors,isValid:!1}),u&&u.shouldFocus&&g&&g.focus&&g.focus()},pt=(s,a)=>te(s)?F.state.subscribe({next:u=>s(w(void 0,a),u)}):w(s,a,!0),Qe=s=>F.state.subscribe({next:a=>{Qt(s.name,a.name,s.exact)&&Jt(a,s.formState||D,Rt,s.reRenderRoot)&&s.callback({values:{...l},...t,...a})}}).unsubscribe,Ct=s=>(f.mount=!0,C={...C,...s.formState},Qe({...s,formState:C})),Ee=(s,a={})=>{for(const u of s?K(s):d.mount)d.mount.delete(u),d.array.delete(u),a.keepValue||(B(i,u),B(l,u)),!a.keepError&&B(t.errors,u),!a.keepDirty&&B(t.dirtyFields,u),!a.keepTouched&&B(t.touchedFields,u),!a.keepIsValidating&&B(t.validatingFields,u),!r.shouldUnregister&&!a.keepDefaultValue&&B(n,u);F.state.next({values:T(l)}),F.state.next({...t,...a.keepDirty?{isDirty:J()}:{}}),!a.keepIsValid&&R()},Xe=({disabled:s,name:a})=>{(Q(s)&&f.mount||s||d.disabled.has(a))&&(s?d.disabled.add(a):d.disabled.delete(a))},pe=(s,a={})=>{let u=c(i,s);const g=Q(a.disabled)||Q(r.disabled);return E(i,s,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),u?Xe({disabled:Q(a.disabled)?a.disabled:r.disabled,name:s}):W(s,!0,a.value),{...g?{disabled:a.disabled||r.disabled}:{},...r.progressive?{required:!!a.required,min:_e(a.min),max:_e(a.max),minLength:_e(a.minLength),maxLength:_e(a.maxLength),pattern:_e(a.pattern)}:{},name:s,onChange:re,onBlur:re,ref:y=>{if(y){pe(s,a),u=c(i,s);const o=U(y.value)&&y.querySelectorAll&&y.querySelectorAll("input,select,textarea")[0]||y,_=$t(o),k=u._f.refs||[];if(_?k.find(O=>O===o):o===u._f.ref)return;E(i,s,{_f:{...u._f,..._?{refs:[...k.filter(Me),o,...Array.isArray(c(n,s))?[{}]:[]],ref:{type:o.type,name:s}}:{ref:o}}}),W(s,!1,void 0,o)}else u=c(i,s,{}),u._f&&(u._f.mount=!1),(r.shouldUnregister||a.shouldUnregister)&&!(mt(d.array,s)&&f.action)&&d.unMount.add(s)}}},Ce=()=>r.shouldFocusError&&fe(i,ye,d.mount),Ot=s=>{Q(s)&&(F.state.next({disabled:s}),fe(i,(a,u)=>{const g=c(i,u);g&&(a.disabled=g._f.disabled||s,Array.isArray(g._f.refs)&&g._f.refs.forEach(y=>{y.disabled=g._f.disabled||s}))},0,!1))},Ze=(s,a)=>async u=>{let g;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let y=T(l);if(F.state.next({isSubmitting:!0}),r.resolver){const{errors:o,values:_}=await h();t.errors=o,y=T(_)}else await S(i);if(d.disabled.size)for(const o of d.disabled)B(y,o);if(B(t.errors,"root"),H(t.errors)){F.state.next({errors:{}});try{await s(y,u)}catch(o){g=o}}else a&&await a({...t.errors},u),Ce(),setTimeout(Ce);if(F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:H(t.errors)&&!g,submitCount:t.submitCount+1,errors:t.errors}),g)throw g},Ut=(s,a={})=>{c(i,s)&&(U(a.defaultValue)?j(s,T(c(n,s))):(j(s,a.defaultValue),E(n,s,T(a.defaultValue))),a.keepTouched||B(t.touchedFields,s),a.keepDirty||(B(t.dirtyFields,s),t.isDirty=a.defaultValue?J(s,T(c(n,s))):J()),a.keepError||(B(t.errors,s),D.isValid&&R()),F.state.next({...t}))},et=(s,a={})=>{const u=s?T(s):n,g=T(u),y=H(s),o=y?n:g;if(a.keepDefaultValues||(n=u),!a.keepValues){if(a.keepDirtyValues){const _=new Set([...d.mount,...Object.keys(ge(n,l))]);for(const k of Array.from(_))c(t.dirtyFields,k)?E(o,k,c(l,k)):j(k,c(o,k))}else{if(je&&U(s))for(const _ of d.mount){const k=c(i,_);if(k&&k._f){const O=Array.isArray(k._f.refs)?k._f.refs[0]:k._f.ref;if(Ve(O)){const X=O.closest("form");if(X){X.reset();break}}}}for(const _ of d.mount){const k=c(o,_,c(n,_));U(k)||(E(o,_,k),j(_,c(o,_)))}}l=T(o),F.array.next({values:{...o}}),F.state.next({values:{...o}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!D.isValid||!!a.keepIsValid||!!a.keepDirtyValues,f.watch=!!r.shouldUnregister,F.state.next({submitCount:a.keepSubmitCount?t.submitCount:0,isDirty:y?!1:a.keepDirty?t.isDirty:!!(a.keepDefaultValues&&!le(s,n)),isSubmitted:a.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:y?{}:a.keepDirtyValues?a.keepDefaultValues&&l?ge(n,l):t.dirtyFields:a.keepDefaultValues&&s?ge(n,s):a.keepDirty?t.dirtyFields:{},touchedFields:a.keepTouched?t.touchedFields:{},errors:a.keepErrors?t.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},tt=(s,a)=>et(te(s)?s(l):s,a),Mt=(s,a={})=>{const u=c(i,s),g=u&&u._f;if(g){const y=g.refs?g.refs[0]:g.ref;y.focus&&(y.focus(),a.shouldSelect&&te(y.select)&&y.select())}},Rt=s=>{t={...t,...s}},rt={control:{register:pe,unregister:Ee,getFieldState:Ye,handleSubmit:Ze,setError:Je,_subscribe:Qe,_runSchema:h,_focusError:Ce,_getWatch:w,_getDirty:J,_setValid:R,_setFieldArray:ee,_setDisabledField:Xe,_setErrors:G,_getFieldArray:p,_reset:et,_resetDefaultValues:()=>te(r.defaultValues)&&r.defaultValues().then(s=>{tt(s,r.resetOptions),F.state.next({isLoading:!1})}),_removeUnmounted:Y,_disableForm:Ot,_subjects:F,_proxyFormState:D,get _fields(){return i},get _formValues(){return l},get _state(){return f},set _state(s){f=s},get _defaultValues(){return n},get _names(){return d},set _names(s){d=s},get _formState(){return t},get _options(){return r},set _options(s){r={...r,...s}}},subscribe:Ct,trigger:oe,register:pe,handleSubmit:Ze,watch:pt,setValue:j,getValues:me,reset:tt,resetField:Ut,clearErrors:Et,unregister:Ee,setError:Je,setFocus:Mt,getFieldState:Ye};return{...rt,formControl:rt}}var ne=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const t=(Math.random()*16+e)%16|0;return(r=="x"?t:t&3|8).toString(16)})},Re=(e,r,t={})=>t.shouldFocus||U(t.shouldFocus)?t.focusName||`${e}.${U(t.focusIndex)?r:t.focusIndex}.`:"",Le=(e,r)=>[...e,...K(r)],Te=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ie(e,r,t){return[...e.slice(0,r),...K(t),...e.slice(r)]}var Ne=(e,r,t)=>Array.isArray(e)?(U(e[t])&&(e[t]=void 0),e.splice(t,0,e.splice(r,1)[0]),e):[],Be=(e,r)=>[...K(r),...K(e)];function rr(e,r){let t=0;const i=[...e];for(const n of r)i.splice(n-t,1),t++;return we(i).length?i:[]}var Pe=(e,r)=>U(r)?[]:rr(e,K(r).sort((t,i)=>t-i)),We=(e,r,t)=>{[e[r],e[t]]=[e[t],e[r]]},gt=(e,r,t)=>(e[r]=t,e);function nr(e){const r=ke(),{control:t=r.control,name:i,keyName:n="id",shouldUnregister:l,rules:f}=e,[d,b]=v.useState(t._getFieldArray(i)),x=v.useRef(t._getFieldArray(i).map(ne)),D=v.useRef(d),C=v.useRef(i),F=v.useRef(!1);C.current=i,D.current=d,t._names.array.add(i),f&&t.register(i,f),De(()=>t._subjects.array.subscribe({next:({values:m,name:h})=>{if(h===C.current||!h){const A=c(m,C.current);Array.isArray(A)&&(b(A),x.current=A.map(ne))}}}).unsubscribe,[t]);const M=v.useCallback(m=>{F.current=!0,t._setFieldArray(i,m)},[t,i]),z=(m,h)=>{const A=K(T(m)),S=Le(t._getFieldArray(i),A);t._names.focus=Re(i,S.length-1,h),x.current=Le(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Le,{argA:Te(m)})},R=(m,h)=>{const A=K(T(m)),S=Be(t._getFieldArray(i),A);t._names.focus=Re(i,0,h),x.current=Be(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Be,{argA:Te(m)})},L=m=>{const h=Pe(t._getFieldArray(i),m);x.current=Pe(x.current,m),M(h),b(h),!Array.isArray(c(t._fields,i))&&E(t._fields,i,void 0),t._setFieldArray(i,h,Pe,{argA:m})},ee=(m,h,A)=>{const S=K(T(h)),Y=Ie(t._getFieldArray(i),m,S);t._names.focus=Re(i,m,A),x.current=Ie(x.current,m,S.map(ne)),M(Y),b(Y),t._setFieldArray(i,Y,Ie,{argA:m,argB:Te(h)})},V=(m,h)=>{const A=t._getFieldArray(i);We(A,m,h),We(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,We,{argA:m,argB:h},!1)},G=(m,h)=>{const A=t._getFieldArray(i);Ne(A,m,h),Ne(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,Ne,{argA:m,argB:h},!1)},W=(m,h)=>{const A=T(h),S=gt(t._getFieldArray(i),m,A);x.current=[...S].map((Y,J)=>!Y||J===m?ne():x.current[J]),M(S),b([...S]),t._setFieldArray(i,S,gt,{argA:m,argB:A},!0,!1)},I=m=>{const h=K(T(m));x.current=h.map(ne),M([...h]),b([...h]),t._setFieldArray(i,[...h],A=>A,{},!0,!1)};return v.useEffect(()=>{if(t._state.action=!1,He(i,t._names)&&t._subjects.state.next({...t._formState}),F.current&&(!de(t._options.mode).isOnSubmit||t._formState.isSubmitted)&&!de(t._options.reValidateMode).isOnSubmit)if(t._options.resolver)t._runSchema([i]).then(m=>{const h=c(m.errors,i),A=c(t._formState.errors,i);(A?!h&&A.type||h&&(A.type!==h.type||A.message!==h.message):h&&h.type)&&(h?E(t._formState.errors,i,h):B(t._formState.errors,i),t._subjects.state.next({errors:t._formState.errors}))});else{const m=c(t._fields,i);m&&m._f&&!(de(t._options.reValidateMode).isOnSubmit&&de(t._options.mode).isOnSubmit)&&$e(m,t._names.disabled,t._formValues,t._options.criteriaMode===Z.all,t._options.shouldUseNativeValidation,!0).then(h=>!H(h)&&t._subjects.state.next({errors:Dt(t._formState.errors,h,i)}))}t._subjects.state.next({name:i,values:T(t._formValues)}),t._names.focus&&fe(t._fields,(m,h)=>{if(t._names.focus&&h.startsWith(t._names.focus)&&m.focus)return m.focus(),1}),t._names.focus="",t._setValid(),F.current=!1},[d,i,t]),v.useEffect(()=>(!c(t._formValues,i)&&t._setFieldArray(i),()=>{const m=(h,A)=>{const S=c(t._fields,h);S&&S._f&&(S._f.mount=A)};t._options.shouldUnregister||l?t.unregister(i):m(i,!1)}),[i,t,n,l]),{swap:v.useCallback(V,[M,i,t]),move:v.useCallback(G,[M,i,t]),prepend:v.useCallback(R,[M,i,t]),append:v.useCallback(z,[M,i,t]),remove:v.useCallback(L,[M,i,t]),insert:v.useCallback(ee,[M,i,t]),update:v.useCallback(W,[M,i,t]),replace:v.useCallback(I,[M,i,t]),fields:v.useMemo(()=>d.map((m,h)=>({...m,[n]:x.current[h]||ne()})),[d,n])}}function lr(e={}){const r=v.useRef(void 0),t=v.useRef(void 0),[i,n]=v.useState({isDirty:!1,isValidating:!1,isLoading:te(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:te(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:i},e.defaultValues&&!te(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:f,...d}=tr(e);r.current={...d,formState:i}}const l=r.current.control;return l._options=e,De(()=>{const f=l._subscribe({formState:l._proxyFormState,callback:()=>n({...l._formState}),reRenderRoot:!0});return n(d=>({...d,isReady:!0})),l._formState.isReady=!0,f},[l]),v.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),v.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),v.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),v.useEffect(()=>{if(l._proxyFormState.isDirty){const f=l._getDirty();f!==i.isDirty&&l._subjects.state.next({isDirty:f})}},[l,i.isDirty]),v.useEffect(()=>{e.values&&!le(e.values,t.current)?(l._reset(e.values,l._options.resetOptions),t.current=e.values,n(f=>({...f}))):l._resetDefaultValues()},[l,e.values]),v.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),r.current.formState=bt(i,l),r.current}export{ar as C,Wt as a,nr as b,lr as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j,o as L,dF as Pt,dG as Ot,dH as Lt,K as dt,dI as Tt,r as I,bf as Dt,a9 as Nt,a5 as qt,aa as Mt,bj as Wt,bo as $t,n as Bt,V as Ft,cN as Gt,cP as Ht,bD as Kt,y as et,i as Vt,W as zt,F as Yt,H as Jt,_ as rt,T as Xt,t as Qt,$ as Zt,D as kt,Z as te,v as it,C as nt,w as ee,z as re}from"./index-CrQaw0BF.js";import{W as ie}from"./status-CW0QYGeF.js";import{r as gt,a as ne,W as se}from"./without-wallet-D2bQnWJt.js";import{r as oe}from"./cloneDeep-B3VWXnFc.js";import{u as vt}from"./useLocalStorage-DjnxkTrj.js";import{v as st}from"./index-DAMZQWKn.js";import{D as ae}from"./Delete-8zGU1uok.js";import{A as le}from"./Autocomplete-DQwU_oez.js";import{L as ce}from"./ListItemButton-C9pXyehQ.js";import{S as ue,a as he,b as fe}from"./Stepper-Bn1MKAsJ.js";function pe({mode:o,...p}){return o==="development"?j.jsx(ie,{type:"primary",...p,children:"DEV"}):null}pe.propTypes={mode:L.string.isRequired};var T={},F={exports:{}},V={exports:{}},ot;function yt(){if(ot)return V.exports;ot=1;var o=V.exports={github:{protocols:["git","http","git+ssh","git+https","ssh","https"],domain:"github.com",treepath:"tree",filetemplate:"https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",bugstemplate:"https://{domain}/{user}/{project}/issues",gittemplate:"git://{auth@}{domain}/{user}/{project}.git{#committish}",tarballtemplate:"https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"},bitbucket:{protocols:["git+ssh","git+https","ssh","https"],domain:"bitbucket.org",treepath:"src",tarballtemplate:"https://{domain}/{user}/{project}/get/{committish}.tar.gz"},gitlab:{protocols:["git+ssh","git+https","ssh","https"],domain:"gitlab.com",treepath:"tree",bugstemplate:"https://{domain}/{user}/{project}/issues",httpstemplate:"git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",tarballtemplate:"https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",pathmatch:/^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/},gist:{protocols:["git","git+ssh","git+https","ssh","https"],domain:"gist.github.com",pathmatch:/^[/](?:([^/]+)[/])?([a-z0-9]{7,})(?:[.]git)?$/,filetemplate:"https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",bugstemplate:"https://{domain}/{project}",gittemplate:"git://{domain}/{project}.git{#committish}",sshtemplate:"git@{domain}:/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{project}.git{#committish}",browsetemplate:"https://{domain}/{project}{/committish}",browsefiletemplate:"https://{domain}/{project}{/committish}{#path}",docstemplate:"https://{domain}/{project}{/committish}",httpstemplate:"git+https://{domain}/{project}.git{#committish}",shortcuttemplate:"{type}:{project}{#committish}",pathtemplate:"{project}{#committish}",tarballtemplate:"https://codeload.github.com/gist/{project}/tar.gz/{committish}",hashformat:function(u){return"file-"+m(u)}}},p={sshtemplate:"git@{domain}:{user}/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{user}/{project}.git{#committish}",browsetemplate:"https://{domain}/{user}/{project}{/tree/committish}",browsefiletemplate:"https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",docstemplate:"https://{domain}/{user}/{project}{/tree/committish}#readme",httpstemplate:"git+https://{auth@}{domain}/{user}/{project}.git{#committish}",filetemplate:"https://{domain}/{user}/{project}/raw/{committish}/{path}",shortcuttemplate:"{type}:{user}/{project}{#committish}",pathtemplate:"{user}/{project}{#committish}",pathmatch:/^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,hashformat:m};Object.keys(o).forEach(function(u){Object.keys(p).forEach(function(h){o[u][h]||(o[u][h]=p[h])}),o[u].protocols_re=RegExp("^("+o[u].protocols.map(function(h){return h.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function m(u){return u.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}return V.exports}var z,at;function me(){if(at)return z;at=1;var o=yt(),p=Object.assign||function(h,t){if(t===null||typeof t!="object")return h;const r=Object.keys(t);let i=r.length;for(;i--;)h[r[i]]=t[r[i]];return h};z=m;function m(u,h,t,r,i,n,a){var x=this;x.type=u,Object.keys(o[u]).forEach(function(C){x[C]=o[u][C]}),x.user=h,x.auth=t,x.project=r,x.committish=i,x.default=n,x.opts=a||{}}return m.prototype.hash=function(){return this.committish?"#"+this.committish:""},m.prototype._fill=function(u,h){if(u){var t=p({},h);t.path=t.path?t.path.replace(/^[/]+/g,""):"",h=p(p({},this.opts),h);var r=this;Object.keys(this).forEach(function(c){r[c]!=null&&t[c]==null&&(t[c]=r[c])});var i=t.auth,n=t.committish,a=t.fragment,x=t.path,C=t.project;Object.keys(t).forEach(function(c){var _=t[c];(c==="path"||c==="project")&&typeof _=="string"?t[c]=_.split("/").map(function(S){return encodeURIComponent(S)}).join("/"):c!=="domain"&&(t[c]=encodeURIComponent(_))}),t["auth@"]=i?i+"@":"",t["#fragment"]=a?"#"+this.hashformat(a):"",t.fragment=t.fragment?t.fragment:"",t["#path"]=x?"#"+this.hashformat(x):"",t["/path"]=t.path?"/"+t.path:"",t.projectPath=C.split("/").map(encodeURIComponent).join("/"),h.noCommittish?(t["#committish"]="",t["/tree/committish"]="",t["/committish"]="",t.committish=""):(t["#committish"]=n?"#"+n:"",t["/tree/committish"]=t.committish?"/"+t.treepath+"/"+t.committish:"",t["/committish"]=t.committish?"/"+t.committish:"",t.committish=t.committish||"master");var g=u;return Object.keys(t).forEach(function(c){g=g.replace(new RegExp("[{]"+c+"[}]","g"),t[c])}),h.noGitPlus?g.replace(/^git[+]/,""):g}},m.prototype.ssh=function(u){return this._fill(this.sshtemplate,u)},m.prototype.sshurl=function(u){return this._fill(this.sshurltemplate,u)},m.prototype.browse=function(u,h,t){return typeof u=="string"?(typeof h!="string"&&(t=h,h=null),this._fill(this.browsefiletemplate,p({fragment:h,path:u},t))):this._fill(this.browsetemplate,u)},m.prototype.docs=function(u){return this._fill(this.docstemplate,u)},m.prototype.bugs=function(u){return this._fill(this.bugstemplate,u)},m.prototype.https=function(u){return this._fill(this.httpstemplate,u)},m.prototype.git=function(u){return this._fill(this.gittemplate,u)},m.prototype.shortcut=function(u){return this._fill(this.shortcuttemplate,u)},m.prototype.path=function(u){return this._fill(this.pathtemplate,u)},m.prototype.tarball=function(u){var h=p({},u,{noCommittish:!1});return this._fill(this.tarballtemplate,h)},m.prototype.file=function(u,h){return this._fill(this.filetemplate,p({path:u},h))},m.prototype.getDefaultRepresentation=function(){return this.default},m.prototype.toString=function(u){return this.default&&typeof this[this.default]=="function"?this[this.default](u):this.sshurl(u)},z}var Y,lt;function de(){return lt||(lt=1,Y=function(o){o.prototype[Symbol.iterator]=function*(){for(let p=this.head;p;p=p.next)yield p.value}}),Y}var J,ct;function ge(){if(ct)return J;ct=1,J=o,o.Node=h,o.create=o;function o(t){var r=this;if(r instanceof o||(r=new o),r.tail=null,r.head=null,r.length=0,t&&typeof t.forEach=="function")t.forEach(function(a){r.push(a)});else if(arguments.length>0)for(var i=0,n=arguments.length;i<n;i++)r.push(arguments[i]);return r}o.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var r=t.next,i=t.prev;return r&&(r.prev=i),i&&(i.next=r),t===this.head&&(this.head=r),t===this.tail&&(this.tail=i),t.list.length--,t.next=null,t.prev=null,t.list=null,r},o.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var r=this.head;t.list=this,t.next=r,r&&(r.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},o.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var r=this.tail;t.list=this,t.prev=r,r&&(r.next=t),this.tail=t,this.head||(this.head=t),this.length++}},o.prototype.push=function(){for(var t=0,r=arguments.length;t<r;t++)m(this,arguments[t]);return this.length},o.prototype.unshift=function(){for(var t=0,r=arguments.length;t<r;t++)u(this,arguments[t]);return this.length},o.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},o.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},o.prototype.forEach=function(t,r){r=r||this;for(var i=this.head,n=0;i!==null;n++)t.call(r,i.value,n,this),i=i.next},o.prototype.forEachReverse=function(t,r){r=r||this;for(var i=this.tail,n=this.length-1;i!==null;n--)t.call(r,i.value,n,this),i=i.prev},o.prototype.get=function(t){for(var r=0,i=this.head;i!==null&&r<t;r++)i=i.next;if(r===t&&i!==null)return i.value},o.prototype.getReverse=function(t){for(var r=0,i=this.tail;i!==null&&r<t;r++)i=i.prev;if(r===t&&i!==null)return i.value},o.prototype.map=function(t,r){r=r||this;for(var i=new o,n=this.head;n!==null;)i.push(t.call(r,n.value,this)),n=n.next;return i},o.prototype.mapReverse=function(t,r){r=r||this;for(var i=new o,n=this.tail;n!==null;)i.push(t.call(r,n.value,this)),n=n.prev;return i},o.prototype.reduce=function(t,r){var i,n=this.head;if(arguments.length>1)i=r;else if(this.head)n=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=0;n!==null;a++)i=t(i,n.value,a),n=n.next;return i},o.prototype.reduceReverse=function(t,r){var i,n=this.tail;if(arguments.length>1)i=r;else if(this.tail)n=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=this.length-1;n!==null;a--)i=t(i,n.value,a),n=n.prev;return i},o.prototype.toArray=function(){for(var t=new Array(this.length),r=0,i=this.head;i!==null;r++)t[r]=i.value,i=i.next;return t},o.prototype.toArrayReverse=function(){for(var t=new Array(this.length),r=0,i=this.tail;i!==null;r++)t[r]=i.value,i=i.prev;return t},o.prototype.slice=function(t,r){r=r||this.length,r<0&&(r+=this.length),t=t||0,t<0&&(t+=this.length);var i=new o;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=0,a=this.head;a!==null&&n<t;n++)a=a.next;for(;a!==null&&n<r;n++,a=a.next)i.push(a.value);return i},o.prototype.sliceReverse=function(t,r){r=r||this.length,r<0&&(r+=this.length),t=t||0,t<0&&(t+=this.length);var i=new o;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=this.length,a=this.tail;a!==null&&n>r;n--)a=a.prev;for(;a!==null&&n>t;n--,a=a.prev)i.push(a.value);return i},o.prototype.splice=function(t,r,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,a=this.head;a!==null&&n<t;n++)a=a.next;for(var x=[],n=0;a&&n<r;n++)x.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var n=0;n<i.length;n++)a=p(this,a,i[n]);return x},o.prototype.reverse=function(){for(var t=this.head,r=this.tail,i=t;i!==null;i=i.prev){var n=i.prev;i.prev=i.next,i.next=n}return this.head=r,this.tail=t,this};function p(t,r,i){var n=r===t.head?new h(i,null,r,t):new h(i,r,r.next,t);return n.next===null&&(t.tail=n),n.prev===null&&(t.head=n),t.length++,n}function m(t,r){t.tail=new h(r,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function u(t,r){t.head=new h(r,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function h(t,r,i,n){if(!(this instanceof h))return new h(t,r,i,n);this.list=n,this.value=t,r?(r.next=this,this.prev=r):this.prev=null,i?(i.prev=this,this.next=i):this.next=null}try{de()(o)}catch{}return J}var X,ut;function ve(){if(ut)return X;ut=1;const o=ge(),p=Symbol("max"),m=Symbol("length"),u=Symbol("lengthCalculator"),h=Symbol("allowStale"),t=Symbol("maxAge"),r=Symbol("dispose"),i=Symbol("noDisposeOnSet"),n=Symbol("lruList"),a=Symbol("cache"),x=Symbol("updateAgeOnGet"),C=()=>1;class g{constructor(s){if(typeof s=="number"&&(s={max:s}),s||(s={}),s.max&&(typeof s.max!="number"||s.max<0))throw new TypeError("max must be a non-negative number");this[p]=s.max||1/0;const e=s.length||C;if(this[u]=typeof e!="function"?C:e,this[h]=s.stale||!1,s.maxAge&&typeof s.maxAge!="number")throw new TypeError("maxAge must be a number");this[t]=s.maxAge||0,this[r]=s.dispose,this[i]=s.noDisposeOnSet||!1,this[x]=s.updateAgeOnGet||!1,this.reset()}set max(s){if(typeof s!="number"||s<0)throw new TypeError("max must be a non-negative number");this[p]=s||1/0,S(this)}get max(){return this[p]}set allowStale(s){this[h]=!!s}get allowStale(){return this[h]}set maxAge(s){if(typeof s!="number")throw new TypeError("maxAge must be a non-negative number");this[t]=s,S(this)}get maxAge(){return this[t]}set lengthCalculator(s){typeof s!="function"&&(s=C),s!==this[u]&&(this[u]=s,this[m]=0,this[n].forEach(e=>{e.length=this[u](e.value,e.key),this[m]+=e.length})),S(this)}get lengthCalculator(){return this[u]}get length(){return this[m]}get itemCount(){return this[n].length}rforEach(s,e){e=e||this;for(let l=this[n].tail;l!==null;){const f=l.prev;U(this,s,l,e),l=f}}forEach(s,e){e=e||this;for(let l=this[n].head;l!==null;){const f=l.next;U(this,s,l,e),l=f}}keys(){return this[n].toArray().map(s=>s.key)}values(){return this[n].toArray().map(s=>s.value)}reset(){this[r]&&this[n]&&this[n].length&&this[n].forEach(s=>this[r](s.key,s.value)),this[a]=new Map,this[n]=new o,this[m]=0}dump(){return this[n].map(s=>_(this,s)?!1:{k:s.key,v:s.value,e:s.now+(s.maxAge||0)}).toArray().filter(s=>s)}dumpLru(){return this[n]}set(s,e,l){if(l=l||this[t],l&&typeof l!="number")throw new TypeError("maxAge must be a number");const f=l?Date.now():0,y=this[u](e,s);if(this[a].has(s)){if(y>this[p])return w(this,this[a].get(s)),!1;const A=this[a].get(s).value;return this[r]&&(this[i]||this[r](s,A.value)),A.now=f,A.maxAge=l,A.value=e,this[m]+=y-A.length,A.length=y,this.get(s),S(this),!0}const b=new R(s,e,y,f,l);return b.length>this[p]?(this[r]&&this[r](s,e),!1):(this[m]+=b.length,this[n].unshift(b),this[a].set(s,this[n].head),S(this),!0)}has(s){if(!this[a].has(s))return!1;const e=this[a].get(s).value;return!_(this,e)}get(s){return c(this,s,!0)}peek(s){return c(this,s,!1)}pop(){const s=this[n].tail;return s?(w(this,s),s.value):null}del(s){w(this,this[a].get(s))}load(s){this.reset();const e=Date.now();for(let l=s.length-1;l>=0;l--){const f=s[l],y=f.e||0;if(y===0)this.set(f.k,f.v);else{const b=y-e;b>0&&this.set(f.k,f.v,b)}}}prune(){this[a].forEach((s,e)=>c(this,e,!1))}}const c=(v,s,e)=>{const l=v[a].get(s);if(l){const f=l.value;if(_(v,f)){if(w(v,l),!v[h])return}else e&&(v[x]&&(l.value.now=Date.now()),v[n].unshiftNode(l));return f.value}},_=(v,s)=>{if(!s||!s.maxAge&&!v[t])return!1;const e=Date.now()-s.now;return s.maxAge?e>s.maxAge:v[t]&&e>v[t]},S=v=>{if(v[m]>v[p])for(let s=v[n].tail;v[m]>v[p]&&s!==null;){const e=s.prev;w(v,s),s=e}},w=(v,s)=>{if(s){const e=s.value;v[r]&&v[r](e.key,e.value),v[m]-=e.length,v[a].delete(e.key),v[n].removeNode(s)}};class R{constructor(s,e,l,f,y){this.key=s,this.value=e,this.length=l,this.now=f,this.maxAge=y||0}}const U=(v,s,e,l)=>{let f=e.value;_(v,f)&&(w(v,e),v[h]||(f=void 0)),f&&s.call(l,f.value,f.key,v)};return X=g,X}var ht;function ye(){if(ht)return F.exports;ht=1;var o=Pt,p=yt(),m=F.exports=me(),u=ve(),h=new u({max:1e3}),t={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function r(g){return t[g]||g.slice(0,-1)}var i={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};F.exports.fromUrl=function(g,c){if(typeof g=="string"){var _=g+JSON.stringify(c||{});return h.has(_)||h.set(_,n(g,c)),h.get(_)}};function n(g,c){if(!(g==null||g==="")){var _=x(a(g)?"github:"+g:g),S=C(_),w=_.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),R=Object.keys(p).map(function(U){try{var v=p[U],s=null;S.auth&&i[S.protocol]&&(s=S.auth);var e=S.hash?decodeURIComponent(S.hash.substr(1)):null,l=null,f=null,y=null;if(w&&w[1]===U)l=w[2]&&decodeURIComponent(w[2]),f=decodeURIComponent(w[3].replace(/\.git$/,"")),y="shortcut";else{if(S.host&&S.host!==v.domain&&S.host.replace(/^www[.]/,"")!==v.domain||!v.protocols_re.test(S.protocol)||!S.path)return;var b=v.pathmatch,E=S.path.match(b);if(!E)return;E[1]!==null&&E[1]!==void 0&&(l=decodeURIComponent(E[1].replace(/^:/,""))),f=decodeURIComponent(E[2]),y=r(S.protocol)}return new m(U,l,s,f,e,y,c)}catch(A){if(!(A instanceof URIError))throw A}}).filter(function(U){return U});if(R.length===1)return R[0]}}function a(g){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(g)}function x(g){var c=o.parse(g);return c.protocol==="gist:"&&c.host&&!c.path?c.protocol+"/"+c.host:g}function C(g){var c=g.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!c){var _=o.parse(g);if(_.auth){const w=g.match(/[^@]+@[^:/]+/);if(w){var S=new o.URL(w[0]);_.auth=S.username||"",S.password&&(_.auth+=":"+S.password)}}return _}return{protocol:"git+ssh:",slashes:!0,auth:c[1],host:c[2],port:null,hostname:c[2],hash:c[4],search:null,query:null,pathname:"/"+c[3],path:"/"+c[3],href:"git+ssh://"+c[1]+"@"+c[2]+"/"+c[3]+(c[4]||"")}}return F.exports}var N={},O={},ft;function xe(){if(ft)return O;ft=1;var o=O&&O.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(O,"__esModule",{value:!0}),O.setService=O.findService=O.getDefaultServiceConfig=O.getServiceConfig=void 0;const p=o(oe),m=gt(),u={},h=a=>{u[a.name]={validate:a.schema.validate.bind(a.schema),defaultConfig:a.default}};O.setService=h,h({name:"auth",schema:m.authConfigSchema,default:{}});const t=a=>{if(!a)throw new Error("service name should not be empty");const x=u[a];if(!x)throw new Error(`service ${a} does not exist`);return x},r=(a,x,{validate:C}={})=>{const g=t(a),c=(0,p.default)(x||{}),{value:_,error:S}=g.validate(c);if(C&&S)throw new Error(`Invalid blocklet service config: ${S.details.map(w=>w.message).join(", ")}`);return _};O.getServiceConfig=r;const i=a=>{const{defaultConfig:x}=t(a);return x};O.getDefaultServiceConfig=i;const n=(a,x)=>{const C=[x];return(a||[]).find(g=>C.includes(g.name))};return O.findService=n,O.default={getServiceConfig:r,getDefaultServiceConfig:i,findService:n,setService:h},O}var pt;function be(){if(pt)return N;pt=1,Object.defineProperty(N,"__esModule",{value:!0}),N.fixAndValidateService=N.validateMeta=void 0;const o=gt(),p=xe(),m=h=>(!h.interfaces||!h.interfaces.length||h.interfaces.forEach(t=>{t.services&&t.services.length&&t.services.forEach(r=>{r.config=(0,p.getServiceConfig)(r.name,r.config,{validate:!0})})}),h);N.fixAndValidateService=m;const u=(h,{ensureFiles:t=!1,ensureDist:r=!1,ensureComponentStore:i=!0,ensureName:n=!1,skipValidateDidName:a=!1,schemaOptions:x={}}={})=>{const C=(0,o.createBlockletSchema)(null,{ensureFiles:t,ensureDist:r,ensureComponentStore:i,ensureName:n,skipValidateDidName:a,...x}),{value:g,error:c}=C.validate(h);if(c)throw new Error(`Invalid blocklet meta: ${c.details.map(_=>_.message).join(", ")}`);return g};return N.validateMeta=u,N.default=u,N}var mt;function je(){return mt||(mt=1,function(o){var p=T&&T.__createBinding||(Object.create?function(e,l,f,y){y===void 0&&(y=f);var b=Object.getOwnPropertyDescriptor(l,f);(!b||("get"in b?!l.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return l[f]}}),Object.defineProperty(e,y,b)}:function(e,l,f,y){y===void 0&&(y=f),e[y]=l[f]}),m=T&&T.__setModuleDefault||(Object.create?function(e,l){Object.defineProperty(e,"default",{enumerable:!0,value:l})}:function(e,l){e.default=l}),u=T&&T.__importStar||function(){var e=function(l){return e=Object.getOwnPropertyNames||function(f){var y=[];for(var b in f)Object.prototype.hasOwnProperty.call(f,b)&&(y[y.length]=b);return y},e(l)};return function(l){if(l&&l.__esModule)return l;var f={};if(l!=null)for(var y=e(l),b=0;b<y.length;b++)y[b]!=="default"&&p(f,l,y[b]);return m(f,l),f}}(),h=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.fixService=o.fixInterfaces=o.parsePerson=o.formatPerson=o.fixName=o.fixTags=o.fixPerson=o.fixKeywords=o.fixFiles=o.fixRepository=o.fixRequired=void 0;const t=h(Ot),r=u(ye()),i=Lt(),n=be();Object.defineProperty(o,"fixService",{enumerable:!0,get:function(){return n.fixAndValidateService}});const a=ne(),x=(e,l)=>{e.description||(e.description=`Blocklet from ${l}`),e.version||(e.version=i.BLOCKLET_DEFAULT_VERSION)};o.fixRequired=x;const C=e=>{if(e.repository&&(typeof e.repository=="string"&&(e.repository={type:"git",url:e.repository}),e.repository.url)){const l=r.fromUrl(e.repository.url);l&&(e.repository.url=l.getDefaultRepresentation()==="shortcut"?l.https():l.toString())}};o.fixRepository=C;const g=e=>{Array.isArray(e.files)?e.files&&(e.files=e.files.filter(l=>!(!l||typeof l!="string"))):delete e.files};o.fixFiles=g;const c=e=>{typeof e.keywords=="string"&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?delete e.keywords:e.keywords&&(e.keywords=e.keywords.filter(l=>!(typeof l!="string"||!l)))};o.fixKeywords=c;const _=e=>{typeof e.tags=="string"&&(e.tags=e.tags.split(/,\s+/)),e.tags&&!Array.isArray(e.tags)?delete e.tags:e.tags&&(e.tags=e.tags.filter(l=>!(typeof l!="string"||!l)))};o.fixTags=_;const S=(e,l)=>(e.author&&(e.author=l(e.author)),["maintainers","contributors"].forEach(f=>{Array.isArray(e[f])&&(e[f]=e[f].map(l))}),e),w=e=>{if(!e)return"";if(typeof e=="string")return e;const l=e.name||"",f=e.url||e.web,y=f?` (${f})`:"",b=e.email||e.mail,E=b?` <${b}>`:"";return l+E+y};o.formatPerson=w;const R=e=>{if(typeof e!="string")return e;const l=e.match(/^([^(<]+)/),f=e.match(/\(([^)]+)\)/),y=e.match(/<([^>]+)>/),b={};return l&&l[0].trim()&&(b.name=l[0].trim()),y&&([,b.email]=y),f&&([,b.url]=f),b};o.parsePerson=R;const U=e=>(S(e,w),S(e,R),e);o.fixPerson=U;const v=(e,l=!0)=>{if(Array.isArray(e.interfaces)||(e.interfaces=[]),e.interfaces.length)return e.interfaces.forEach(E=>{E.type===i.BLOCKLET_INTERFACE_TYPE_WEB&&(E.protocol="http")}),e;const y=(0,t.default)(e,"capabilities.dynamicPathPrefix",!0)?i.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",b=({type:E="web",name:A,path:W="/",protocol:G="http",port:B=i.BLOCKLET_DEFAULT_PORT_NAME})=>{e.interfaces.push({type:E,name:A,path:W,prefix:y,port:B,protocol:G})};return[i.BLOCKLET_INTERFACE_PUBLIC].forEach(E=>{e[E]&&b({name:E,path:e[E]})}),Array.isArray(e.exposeServices)&&e.exposeServices.forEach(E=>{b({type:"service",name:E.protocol,protocol:E.protocol,port:{internal:`BLOCKLET_${E.protocol}_PORT`.toUpperCase(),external:E.port}})}),l&&(delete e.publicUrl,delete e.adminUrl,delete e.configUrl,delete e.docUrl,delete e.exposeServices,e.capabilities&&delete e.capabilities.dynamicPathPrefix),e};o.fixInterfaces=v;const s=e=>{const{did:l}=e;try{(0,a.validateNewDid)(l),e.name=l}catch{}return e};o.fixName=s,o.default={fixRequired:x,fixRepository:C,fixFiles:g,fixKeywords:c,fixPerson:U,fixTags:_,fixName:s,formatPerson:w,parsePerson:R,fixInterfaces:v,fixService:n.fixAndValidateService}}(T)),T}var Se=je();function xt({owner:o,locale:p}){return j.jsxs(dt,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.fullName,o.did?j.jsx(Tt,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:o.did,compact:!0,size:14,locale:p}):null]})}xt.propTypes={owner:L.object.isRequired,locale:L.string.isRequired};const _e="install-blocklet-from-URL",bt=()=>{const[o,p]=vt(_e,"[]",{raw:!0}),m=h=>{const t=h.trim(),r=JSON.parse(o),i=r.findIndex(n=>n===t);i!==0&&(i>0&&r.splice(i,1),r.length>=10&&r.splice(9),r.unshift(t),p(JSON.stringify(r)))},u=h=>{if(!h)return;const t=JSON.parse(o),r=h.trim(),i=t.findIndex(n=>n===r);i>-1&&(t.splice(i,1),p(JSON.stringify(t)))};return{urls:o?JSON.parse(o):[],addUrlRecord:m,removeUrlRecord:u}};function jt({value:o="",onValueChange:p=()=>{},children:m=null,helperText:u=""}){const{urls:h,removeUrlRecord:t}=bt(),r=(i,n)=>{i.preventDefault(),i.stopPropagation(),t(n)};return j.jsxs(dt,{children:[j.jsx(le,{freeSolo:!0,options:h,inputValue:o,onInputChange:(i,n)=>{p(n)},disableClearable:!0,popupIcon:null,renderInput:i=>Dt.cloneElement(m,{...i}),renderOption:(i,n)=>I.createElement(Nt,{...i,key:n,secondaryAction:j.jsx(qt,{edge:"end","aria-label":"delete",onClick:a=>r(a,n),children:j.jsx(ae,{})})},j.jsx(ce,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:j.jsx(Mt,{primary:n,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),j.jsx(Wt,{style:{margin:0},children:u})]})}jt.propTypes={onValueChange:L.func,children:L.node,value:L.string,helperText:L.string};function Ee({defaultUrl:o="",onCancel:p,onSuccess:m,onError:u=()=>{},mode:h="install",handleText:t={}}){const{api:r}=$t(),{api:i,session:n}=Bt(),[a,x]=I.useState(!1),[C,g]=I.useState(""),{t:c,locale:_}=Ft(),S={dist:{}},{encryptKey:w}=Gt(),[R,U]=I.useState(o),[v,s]=I.useState(o?1:0),[e,l]=I.useState(S),[f,y]=I.useState(!1),[b,E]=I.useState(""),[A]=vt("instant-blocklet-install",!1),[W,G]=I.useState({}),B=h==="component",H=B?!0:!o,{addUrlRecord:St}=bt(),$=I.useMemo(()=>(n.user?.connectedAccounts||[]).some(D=>D.provider===Ht.WALLET),[n.user]),Q=I.useMemo(()=>{let d=R.trim();return!d.startsWith("https://")&&!d.startsWith("http://")&&!d.startsWith("file://")&&(d=`file://${d}`),d},[R]),K=async()=>{l(S),g(null),x(!0);const d=Q;try{const P=decodeURIComponent(d);try{new URL(P)}catch{throw new Error("Invalid URL")}const{meta:D,inStore:It,registryUrl:Ut}=await r.getBlockletMetaFromUrl({input:{url:P}});l(D),G({inStore:It,registryUrl:Ut,inputUrl:d}),St(d)}catch(P){console.error(P);const D=`Blocklet Install failed: ${rt(P)}`;g(D),u(P)}finally{x(!1)}},_t=()=>{if(B){m({meta:e,...W}),p();return}if(A){x(!0),y(!0);return}const d=et(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=re(d,{blocklet_meta_url:decodeURIComponent(Q.trim()),from:"url"})},Z=()=>{x(!1),y(!1),m({meta:e,...W}),p()},Et=()=>{x(!1),y(!1)};I.useEffect(()=>{o&&K()},[o]);const M=I.useMemo(()=>({title:e.title,wt:Kt(e),blockletMetaUrl:decodeURIComponent(R.trim())}),[e,R]),k=I.useCallback(async()=>{if($||A){E("");return}const d=new URL(window.location.href);d.pathname=et(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),d.searchParams.set("_ek_",w),Object.keys(M).forEach(D=>{d.searchParams.set(D,M[D])});const{data:P}=await i.get(d.href);P.url?E(P.url):E("")},[$,M,i,w,A]);I.useEffect(()=>{k()},[k]);const wt=I.useMemo(()=>$&&b?{...M,nw:b,skipMigrateAccount:!0}:M,[M,b,$]),Ct=[{name:c("common.name"),value:Vt.getDisplayName({meta:e},!0)},{name:c("common.version"),value:e.version},{name:c("common.did"),value:e.did?j.jsx(zt,{did:e.did}):null},{name:c("common.author"),value:e.owner?j.jsx(xt,{owner:e.owner,locale:_}):Se.formatPerson(e.author)},{name:c("blocklet.dist.downloadLink"),value:e.dist.tarball}],Rt=()=>a?j.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:j.jsx(nt,{})}):e.did?j.jsx("div",{style:{paddingLeft:"10%"},children:Ct.map(d=>d.name===c("common.did")?j.jsx(st,{valueComponent:"div",nameWidth:120,name:d.name,nameFormatter:()=>c("common.did"),children:d.value},d.name):j.jsx(st,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.name))}):null,At=Yt(async()=>{let d=e.title;n.user&&(d=`${n.user.fullName}'s ${e.title}`);try{Z(),await r.launchBlockletWithoutWallet({input:{title:d,blockletMetaUrl:decodeURIComponent(R.trim()),type:"store",storeUrl:W.registryUrl,onlyRequired:!0}})}catch(P){console.error("launchBlockletWithoutWallet error:",P),Jt.error(rt(P),{autoHideDuration:3e3})}}),tt=[{label:c("blocklet.fromUrl.step0"),body:j.jsx(Xt,{component:"div",children:j.jsx(jt,{style:{marginBottom:32},value:R,helperText:c("blocklet.fromUrl.description"),onValueChange:d=>{g(null),U(d)},children:j.jsx(Qt,{label:c("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:R,onChange:d=>{g(null),U(d.target.value)},disabled:a,onKeyPress:d=>{d.key==="Enter"&&(d.preventDefault(),K(),s(1))}})})}),cancel:c("common.cancel"),confirm:c("common.next"),onCancel:p,onConfirm:()=>{K(),s(1)}},{label:c("blocklet.fromUrl.step1"),body:Rt(),cancel:c(H?"common.pre":"common.cancel"),confirm:t?.confirm||c("blocklet.fromUrl.confirm"),onCancel:()=>{H?s(d=>d-1):p()},onConfirm:()=>{_t()}}],q=tt[v];return j.jsxs(j.Fragment,{children:[j.jsxs(Zt,{title:t?.title||c("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>q.onCancel(),showCloseButton:v===0,disableEscapeKeyDown:!0,open:!0,actions:j.jsxs(j.Fragment,{children:[q.cancel&&j.jsx(it,{onClick:d=>{d.stopPropagation(),g(null),q.onCancel()},color:"inherit",children:q.cancel||c("common.cancel")}),j.jsxs(it,{onClick:d=>{d.stopPropagation(),q.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a||!R||C,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[a&&v===0&&j.jsx(nt,{size:16}),q.confirm]})]}),children:[H&&j.jsx(ue,{alternativeLabel:!0,activeStep:v,children:tt.map(({label:d})=>j.jsx(he,{children:j.jsx(fe,{children:d})},d))}),j.jsx(kt,{component:"div",style:{marginTop:24},children:q.body}),!!C&&j.jsx(te,{severity:"error",style:{width:"100%",marginTop:8},children:C})]}),e&&f&&j.jsx(ee,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!$&&!A?"bind-wallet":"launch-free-blocklet-by-session",checkFn:i.get,checkTimeout:5*60*1e3,onSuccess:Z,extraParams:wt,messages:{title:c("setup.keyPair.title"),scan:c("setup.keyPair.scan"),confirm:c("setup.keyPair.confirm"),success:c("setup.keyPair.success")},onClose:Et,customItems:A?[]:[j.jsx(se,{onClick:At})]})]})}Ee.propTypes={defaultUrl:L.string,onCancel:L.func.isRequired,onSuccess:L.func.isRequired,onError:L.func,mode:L.oneOf(["install","component"]),handleText:L.object};export{pe as B,Ee as I,xt as a,Se as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aG as L,j as i,r as u,p as T,bg as H,$ as M,s as v,o as s,v as D,K as y,c_ as E,V as w,n as A,aQ as q,c$ as U,cD as F,F as j,y as O,d0 as V,aI as W,d1 as Y,d2 as k,d3 as I,au as B,b8 as K,cw as G,C as J,b9 as Q}from"./index-CrQaw0BF.js";import{p as X}from"./index-rsjiYKAZ.js";import{N as Z}from"./index-DyIPXbau.js";import{b as ee}from"./sdk-DZJdUnPV.js";import{w as ie}from"./wrap-locale-BbIFvnmJ.js";const se=L(i.jsx("path",{d:"M19 3H4.99c-1.11 0-1.98.89-1.98 2L3 19c0 1.1.88 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.11-.9-2-2-2m0 12h-4c0 1.66-1.35 3-3 3s-3-1.34-3-3H4.99V5H19z"}));function P({invitation:e,createPassportSvg:n,passportColor:c="auto"}){const[p,r]=u.useState(!1),{t:l}=u.useContext(T),t=u.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),d=u.useMemo(()=>n({title:t,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:H(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,t]),m=u.useCallback(()=>{r(!0)},[]),o=u.useCallback(()=>{r(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(te,{children:i.jsxs("div",{className:"invite-passport__card",onClick:m,children:[!!e.display&&i.jsx(Z,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:d}})]})}),i.jsx(M,{open:p,title:l("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:o,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(x=>i.jsx("li",{style:{listStyle:"circle"},children:x.description},x.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(se,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:l("invite.emptyPermission")})]})})]})}P.propTypes={invitation:s.object.isRequired,createPassportSvg:s.func.isRequired,passportColor:s.string};const te=v.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
max-width: 350px;
|
|
4
4
|
margin: 30px auto;
|
|
@@ -132,7 +132,7 @@ import{aF as L,j as i,r as u,p as T,bg as H,$ as M,s as v,o as s,v as D,J as y,c
|
|
|
132
132
|
.invite-user__link {
|
|
133
133
|
color: ${({theme:e})=>e.palette.primary.main};
|
|
134
134
|
}
|
|
135
|
-
`;function S({invitation:e,type:n="inviter"}){const{t:c}=w(),p=u.useMemo(()=>c("invite.success",{dapp:"{{dapp}}"}),[c]),r=k(e.info.chainHost,e.inviter.did,"account"),l=n==="receiver"?e.receiver:e.inviter,t=I(p,{name(){return r?i.jsx("a",{target:"_blank",href:r,className:"invite-user__link",rel:"noreferrer",children:l.fullName},"name"):l.fullName},dapp(){return i.jsx("a",{target:"_blank",href:e.info.url,className:"invite-user__link",rel:"noreferrer",children:e.info.name},"dapp")}});return i.jsxs(ae,{children:[i.jsx(y,{sx:{pt:1,color:"success.main"},children:i.jsx(
|
|
135
|
+
`;function S({invitation:e,type:n="inviter"}){const{t:c}=w(),p=u.useMemo(()=>c("invite.success",{dapp:"{{dapp}}"}),[c]),r=k(e.info.chainHost,e.inviter.did,"account"),l=n==="receiver"?e.receiver:e.inviter,t=I(p,{name(){return r?i.jsx("a",{target:"_blank",href:r,className:"invite-user__link",rel:"noreferrer",children:l.fullName},"name"):l.fullName},dapp(){return i.jsx("a",{target:"_blank",href:e.info.url,className:"invite-user__link",rel:"noreferrer",children:e.info.name},"dapp")}});return i.jsxs(ae,{children:[i.jsx(y,{sx:{pt:1,color:"success.main"},children:i.jsx(K,{style:{fontSize:80}})}),i.jsx("div",{className:"invite-user__message",children:t})]})}S.propTypes={invitation:s.object.isRequired,type:s.oneOf(["inviter","receiver"])};const ae=v.div`
|
|
136
136
|
display: flex;
|
|
137
137
|
flex-direction: column;
|
|
138
138
|
justify-content: center;
|
|
@@ -155,7 +155,7 @@ import{aF as L,j as i,r as u,p as T,bg as H,$ as M,s as v,o as s,v as D,J as y,c
|
|
|
155
155
|
.invite-user__link {
|
|
156
156
|
color: ${({theme:e})=>e.palette.primary.main};
|
|
157
157
|
}
|
|
158
|
-
`;function z({getDataFn:e,passportColor:n="auto",createPassportSvg:c,onLoginSuccess:p=()=>{},checkFn:r,onReceive:l=null,inService:t=!1,action:d="invite",status:m=""}){const o=
|
|
158
|
+
`;function z({getDataFn:e,passportColor:n="auto",createPassportSvg:c,onLoginSuccess:p=()=>{},checkFn:r,onReceive:l=null,inService:t=!1,action:d="invite",status:m=""}){const o=G(e),x=u.useMemo(()=>o?.data?.orgId||"",[o?.data?.orgId]);if(o?.loading)return i.jsx(J,{});if(o?.error)return i.jsx(X,{status:"404",title:o?.error?.response?.data,description:""});const a=m==="success"||o?.data?.status==="success",h=a?S:R,_=a?N:C;return i.jsx(ce,{className:"page-invite__wrapper",children:o?.data?i.jsxs(y,{className:"page-invite__card",children:[i.jsx(h,{invitation:o.data}),i.jsx(P,{invitation:o.data,action:d,createPassportSvg:c,passportColor:n}),i.jsx(_,{invitation:o.data,action:d,onLogin:p,checkFn:r,onReceive:l,inService:t,orgId:x})]}):null})}z.propTypes={getDataFn:s.func.isRequired,checkFn:s.func.isRequired,createPassportSvg:s.func.isRequired,onLoginSuccess:s.func,onReceive:s.func,passportColor:s.string,inService:s.bool,action:s.oneOf(["invite","issue-passpor"]),status:s.oneOf(["success",""])};const ce=Q(y)`
|
|
159
159
|
max-width: 460px;
|
|
160
160
|
max-height: 650px;
|
|
161
161
|
min-height: 450px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fD as P,be as s}from"./index-
|
|
1
|
+
import{fD as P,be as s}from"./index-CrQaw0BF.js";var r,e;function f(){if(e)return r;e=1;const a=P();return r=(i,t)=>a(i)===a(t),r}var u=f();const x=s(u);export{x as i};
|