@abtnode/webapp 1.16.30-beta-5d9c2c41 → 1.16.30-beta-e7a90fb2
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/{Add-240wNjwq.js → Add-nimIss-R.js} +1 -1
- package/dist/assets/{ArrowDropDown-C_UcQOEh.js → ArrowDropDown-SDLo8AU6.js} +1 -1
- package/dist/assets/{Autocomplete-BcT7Oksd.js → Autocomplete-mLMpcAAZ.js} +1 -1
- package/dist/assets/{Breadcrumbs-6lYKQe5b.js → Breadcrumbs-Bt0YLDiP.js} +1 -1
- package/dist/assets/{ButtonGroup-D2VNVq8p.js → ButtonGroup-BIMC9S6K.js} +1 -1
- package/dist/assets/{CheckCircle-C3oHDZBR.js → CheckCircle-__Xpcyhc.js} +1 -1
- package/dist/assets/{ChevronLeft-CsFylH21.js → ChevronLeft-DFREsjdS.js} +1 -1
- package/dist/assets/{ChevronRight-DB27L3xw.js → ChevronRight-SbPIKwoC.js} +1 -1
- package/dist/assets/{Close-B0TqWuc9.js → Close-BpEmkp97.js} +1 -1
- package/dist/assets/{Delete-DmepPquU.js → Delete-B-wviuP1.js} +1 -1
- package/dist/assets/DeleteOutline-DU3a7Mie.js +1 -0
- package/dist/assets/DeleteOutline-Dy_sSwNK.js +1 -0
- package/dist/assets/{Done-DcWcwr60.js → Done-DEwehpwv.js} +1 -1
- package/dist/assets/{Edit-D1BvuH2M.js → Edit-DK6KZi0P.js} +1 -1
- package/dist/assets/{EditIcon-CDlQ1Y8-.js → EditIcon-FDN14b0G.js} +1 -1
- package/dist/assets/{ExpandMore-CK0-Eu1n.js → ExpandMore-CoMbEsJD.js} +1 -1
- package/dist/assets/{FilterList-Bw1ZqePf.js → FilterList-BSbt4VER.js} +1 -1
- package/dist/assets/{Google-DmQIUmmK.js → Google-DvvB9-RU.js} +1 -1
- package/dist/assets/{Https-CdebkXl3.js → Https-CHMUgx6-.js} +1 -1
- package/dist/assets/{InputAdornment-BRIOp0gH.js → InputAdornment-C_X3KhDA.js} +1 -1
- package/dist/assets/{InputLabel-C31crC9j.js → InputLabel-qD-ek4kX.js} +1 -1
- package/dist/assets/{LastPage-15pWD2wJ.js → LastPage-DRexSCl8.js} +1 -1
- package/dist/assets/{Launch-CMM_hnCO.js → Launch-CXTnJ_ZP.js} +1 -1
- package/dist/assets/{Link-C4-IDwJx.js → Link-BVKoqsek.js} +1 -1
- package/dist/assets/{LoadingButton-hwdCNe1X.js → LoadingButton-DHGZB25W.js} +1 -1
- package/dist/assets/{LockIcon-DGv96agC.js → LockIcon-DGE39kAx.js} +1 -1
- package/dist/assets/{Loop-B2Vl1OiI.js → Loop-DQi2cfGf.js} +1 -1
- package/dist/assets/{MoreHoriz-q-g-RPDL.js → MoreHoriz-BXgBR7_l.js} +1 -1
- package/dist/assets/{MoreVert-s3M1upT5.js → MoreVert-xXktVXrB.js} +1 -1
- package/dist/assets/{Pagination-B5dMIe8j.js → Pagination-DnPfWmf4.js} +1 -1
- package/dist/assets/{Public-CF6xMrln.js → Public-DZG9u5nc.js} +1 -1
- package/dist/assets/{SchemaReference.es-BLQMCHdi.js → SchemaReference.es-DknvTEzi.js} +1 -1
- package/dist/assets/{Search-B0peOjeQ.js → Search-D2g_vALD.js} +1 -1
- package/dist/assets/{Select-C--LsVoO.js → Select-DEE1eR0K.js} +1 -1
- package/dist/assets/{Skeleton-CaItownp.js → Skeleton-m_lkZ6lH.js} +1 -1
- package/dist/assets/{Slider-BA1jwO1h.js → Slider-CBmIjsNj.js} +1 -1
- package/dist/assets/{Stepper-BQ3ikYJX.js → Stepper-D4h3SXw3.js} +1 -1
- package/dist/assets/{TextField-D1TVUQl2.js → TextField-Cml5LlcX.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-CbsnXtMY.js → ToggleButtonGroup-DdMGIkJV.js} +1 -1
- package/dist/assets/{ViewList-C8_Q1ZaL.js → ViewList-Lg33z4FS.js} +1 -1
- package/dist/assets/{actions-DkIxbagz.js → actions-CCw2fiQZ.js} +1 -1
- package/dist/assets/actions-Rsfuoore.js +11 -0
- package/dist/assets/{agreement-DxK9sfKx.js → agreement-C2LFpgfH.js} +1 -1
- package/dist/assets/api-_ETsEoGC.js +1 -0
- package/dist/assets/{app-avatar-C7ZZG5lQ.js → app-avatar-Z0pI74yn.js} +1 -1
- package/dist/assets/{audit-logs-CrN9QYVu.js → audit-logs-CGjF68d3.js} +1 -1
- package/dist/assets/blocklet-D8qZlMLE.js +1 -0
- package/dist/assets/{brace-fold.es-Byk4OhlU.js → brace-fold.es-D-xxO9tk.js} +1 -1
- package/dist/assets/{bundle-avatar-BDTyLzjh.js → bundle-avatar-k-apmNe0.js} +1 -1
- package/dist/assets/{chart-BXerkWdt.js → chart-BHydpm-Q.js} +1 -1
- package/dist/assets/{click-to-copy-CK-Mkhd0.js → click-to-copy--CxmqZHP.js} +1 -1
- package/dist/assets/{closebrackets.es-CTZfsjeS.js → closebrackets.es-CV5tiUGf.js} +1 -1
- package/dist/assets/{codemirror.es-CosWD2iy.js → codemirror.es-BSwJ_jke.js} +1 -1
- package/dist/assets/{comment.es-DxS_C5_M.js → comment.es-CN939E1H.js} +1 -1
- package/dist/assets/{config-navigation-D8N_TmOY.js → config-navigation-BKucf5SM.js} +1 -1
- package/dist/assets/{delete-confirm-BKnCoOpO.js → delete-confirm-DOwYzFRf.js} +1 -1
- package/dist/assets/{detail-BmlatkjD.js → detail-BBO1G3ZP.js} +3 -3
- package/dist/assets/{dialog.es-Bg0EeV0q.js → dialog.es-K7-bZIzF.js} +1 -1
- package/dist/assets/{download-C0fC4yYB.js → download-D88K6-GQ.js} +1 -1
- package/dist/assets/{foldgutter.es-pqkwUOpu.js → foldgutter.es-DPSTEVXv.js} +1 -1
- package/dist/assets/getValidReactChildren-86LVJ_ka.js +1 -0
- package/dist/assets/{hint.es-EAu4kf7y.js → hint.es-DHTbet23.js} +1 -1
- package/dist/assets/{hint.es2-BFhwDvJp.js → hint.es2-DaSN5I8T.js} +1 -1
- package/dist/assets/{iframe-DCJ7N4jM.js → iframe-DjGjc5CU.js} +1 -1
- package/dist/assets/{index-DIrIbW6w.js → index-6hnZjYIo.js} +1 -1
- package/dist/assets/{index-BPY6z3Rs.js → index-AO3oCF1x.js} +3 -3
- package/dist/assets/{index-B4PWSsiR.js → index-BGI6bUJP.js} +1 -1
- package/dist/assets/{index-7fpoPAbz.js → index-BGXvULAc.js} +1 -1
- package/dist/assets/{index-CRLxFVWY.js → index-BHdqgom8.js} +4 -4
- package/dist/assets/{index-Ch9-jINY.js → index-BKhW6tEi.js} +1 -1
- package/dist/assets/{index-c1dR1RcA.js → index-BPHA36fg.js} +1 -1
- package/dist/assets/{index-C8xCbxUE.js → index-Blc0lQcO.js} +1 -1
- package/dist/assets/{index-CmFVyjgY.js → index-BsbdXNYr.js} +1 -1
- package/dist/assets/{index-CheSXyoA.js → index-C1KbWOak.js} +3 -3
- package/dist/assets/{index-CuOQXV32.js → index-C4Q4NeqR.js} +1 -1
- package/dist/assets/{index-BUnnmW1r.js → index-CAo0UcQ2.js} +1 -1
- package/dist/assets/{index-C1PiAS_Y.js → index-CBTLvRHC.js} +1 -1
- package/dist/assets/{index-BH1hVJpW.js → index-CE0mBRzM.js} +1 -1
- package/dist/assets/{index-nsaxnXRB.js → index-CF-WslF6.js} +1 -1
- package/dist/assets/{index-wRDZOUMs.js → index-CeV4jn0N.js} +1 -1
- package/dist/assets/{index-M9-_GBvS.js → index-CgsfYcwc.js} +1 -1
- package/dist/assets/{index-CIV9Tvzf.js → index-ChCCjycd.js} +1 -1
- package/dist/assets/{index-DnZQlEKp.js → index-Co3JrBLr.js} +1 -1
- package/dist/assets/{index-DxuvuH9i.js → index-Cpw6Ga8g.js} +1 -1
- package/dist/assets/index-CqrpWUFf.js +21 -0
- package/dist/assets/{index-BI-i5kKF.js → index-D-FCWV-1.js} +1 -1
- package/dist/assets/{index-D8KWuR1-.js → index-D3GDvQdK.js} +1 -1
- package/dist/assets/{index-BJXHdeeV.js → index-D3_NSRjd.js} +1 -1
- package/dist/assets/{index-B_FDrImE.js → index-DBP_eUf8.js} +1 -1
- package/dist/assets/{index-Cu-S2eZJ.js → index-DBjm0dlo.js} +1 -1
- package/dist/assets/{index-DqnDo97c.js → index-DGNm6YxS.js} +1 -1
- package/dist/assets/{index-BMfXnuvp.js → index-DKrhe0Pd.js} +1 -1
- package/dist/assets/index-DUXbXc9f.js +68 -0
- package/dist/assets/index-D_qCD-1x.js +80 -0
- package/dist/assets/{index-CZrhCkal.js → index-Daw6hKm4.js} +1 -1
- package/dist/assets/index-De9X8iTH.js +292 -0
- package/dist/assets/{index-DdIvdpgD.js → index-Dj8gJMNb.js} +1 -1
- package/dist/assets/{index-D9XZ1bG6.js → index-Dx95ER6O.js} +1 -1
- package/dist/assets/{index-qU6j-u6W.js → index-DxgXNSd2.js} +14 -14
- package/dist/assets/{index-de76ek1K.js → index-Mn9Cn8cU.js} +1 -1
- package/dist/assets/{index-BeN4ZgCH.js → index-TQDBcpeB.js} +1 -1
- package/dist/assets/{index-CGjwUKrb.js → index-ZTQq6T3W.js} +1 -1
- package/dist/assets/{index-CDRbsQoL.js → index-cqDbkK4O.js} +1 -1
- package/dist/assets/{index-DivETz-Z.js → index-f7aL1bUo.js} +5 -5
- package/dist/assets/{index-CDre3mnK.js → index-guvEPGrM.js} +3 -3
- package/dist/assets/{index-Cx3miQZ4.js → index-mgj182ld.js} +3 -2
- package/dist/assets/{index-ClZOvGLQ.js → index-o8JHOBc-.js} +1 -1
- package/dist/assets/{index-BvnS-7-1.js → index-wB3ekx1K.js} +1 -1
- package/dist/assets/{index.es-CZDnnfg-.js → index.es-39a3Nx9Z.js} +1 -1
- package/dist/assets/{index.esm-Dkpk3RMi.js → index.esm-VCHOqK12.js} +1 -1
- package/dist/assets/{info-addon.es-B1aKFVvv.js → info-addon.es-BC4uTAVC.js} +1 -1
- package/dist/assets/{info.es-DTXDBN9z.js → info.es-BOB5BDAa.js} +1 -1
- package/dist/assets/{install-from-url-DjctVTOl.js → install-from-url-BlpJ_JCL.js} +1 -1
- package/dist/assets/{invitation-DSdBJgkC.js → invitation-B9vV54jI.js} +1 -1
- package/dist/assets/{is-path-prefix-equal-C6zlDhVp.js → is-path-prefix-equal-5RuRfdDZ.js} +1 -1
- package/dist/assets/{isEqual-0cnx2qOS.js → isEqual-BMA5WXPh.js} +1 -1
- package/dist/assets/{item-Dln-w3Iq.js → item-BCjdddLT.js} +1 -1
- package/dist/assets/{javascript.es-DKea0oPd.js → javascript.es-CKHSRONz.js} +1 -1
- package/dist/assets/{jump-to-line.es-DmWSMR-E.js → jump-to-line.es-BGiUhkkZ.js} +1 -1
- package/dist/assets/{jump.es-CQGzFoAd.js → jump.es-jlQKmx9y.js} +1 -1
- package/dist/assets/{line-BIpTQfTJ.js → line-BQ1AqKfx.js} +3 -3
- package/dist/assets/{lint.es-BAY5Woc0.js → lint.es-Ccw618G7.js} +1 -1
- package/dist/assets/{lint.es2-C4O9zzDQ.js → lint.es2-EOTuUPIZ.js} +1 -1
- package/dist/assets/{lint.es3-q80vs6e3.js → lint.es3-DvHlvUn_.js} +1 -1
- package/dist/assets/{list-header-DuWvRnX_.js → list-header-RtdpLA8N.js} +1 -1
- package/dist/assets/{log-U-Oy1msj.js → log-C240GbUG.js} +1 -1
- package/dist/assets/{lottie-D0zUdkp5.js → lottie-DlriAay1.js} +1 -1
- package/dist/assets/{matchbrackets.es-B_OCWqIS.js → matchbrackets.es-C5JsbqKa.js} +1 -1
- package/dist/assets/{memory-CESYopLm.js → memory-DmcKHXq0.js} +1 -1
- package/dist/assets/{mode.es-DVfsqtAx.js → mode.es-mDILARJO.js} +1 -1
- package/dist/assets/{mode.es2-gg_0Yels.js → mode.es2-BBLB98Wl.js} +1 -1
- package/dist/assets/{mode.es3-CWCOwidy.js → mode.es3-Bp7C6PMW.js} +1 -1
- package/dist/assets/{onlineParser.es-CTZOlUJG.js → onlineParser.es-BoSRyIcT.js} +1 -1
- package/dist/assets/{overview-D7OPOkGE.js → overview-_Rxbv1NB.js} +1 -1
- package/dist/assets/{react-Blm3BSvE.js → react-DuJ5ZkKy.js} +16 -16
- package/dist/assets/{redux-CaV6uiOr.js → redux-B1Qumh5U.js} +1 -1
- package/dist/assets/{resource-dialog-Cbfivwvi.js → resource-dialog-WWRI08PV.js} +1 -1
- package/dist/assets/{runtime-BE0JWW3n.js → runtime-5oxnTidw.js} +1 -1
- package/dist/assets/{schema-BKkMgYH9.js → schema-5ne-6Bp4.js} +1 -1
- package/dist/assets/sdk-Go6IWQIY.js +1 -0
- package/dist/assets/{search.es-CGDd2k_t.js → search.es-R2FORdVe.js} +1 -1
- package/dist/assets/{searchcursor.es-xO-dGzm1.js → searchcursor.es-DO5Jf4gN.js} +1 -1
- package/dist/assets/service-VyIQYaE6.js +1 -0
- package/dist/assets/{shorten-label-CZVhjulh.js → shorten-label-CZlXdSOl.js} +1 -1
- package/dist/assets/{show-hint.es-opE1QlXT.js → show-hint.es-Bx2uNweg.js} +1 -1
- package/dist/assets/{slicedToArray-C3_toPJB.js → slicedToArray-Bg3ityWL.js} +1 -1
- package/dist/assets/{spaces-Swq2BNwF.js → spaces-fC9EAj53.js} +1 -1
- package/dist/assets/{status-dc380TH5.js → status-BXJ91n7W.js} +1 -1
- package/dist/assets/{sublime.es-Bw3Iznmf.js → sublime.es-DHZMehLW.js} +1 -1
- package/dist/assets/{switch-control-CcMPAAj7.js → switch-control-BuiDLx3e.js} +1 -1
- package/dist/assets/{table-icons-TmY--eR2.js → table-icons-bAAAjGK1.js} +2 -2
- package/dist/assets/{team-CBZV1UuS.js → team-QnBuJ2rq.js} +1 -1
- package/dist/assets/{toUpper-Bjz0AMGp.js → toUpper-CFRRtQH6.js} +1 -1
- package/dist/assets/{traffic-wydTjZWz.js → traffic-CNgUOmfv.js} +1 -1
- package/dist/assets/{url-evaluation-Oli2ZbAu.js → url-evaluation-BTdmiGRO.js} +1 -1
- package/dist/assets/{url-join-BPHLmPis.js → url-join-CiWL3EAW.js} +1 -1
- package/dist/assets/{use-blocklet-info-for-connect-did-spaces-DRjxN2RW.js → use-blocklet-info-for-connect-did-spaces-CMsH-TzL.js} +1 -1
- package/dist/assets/{useLocalStorage-DABDAbRI.js → useLocalStorage-D6Ii7-Uk.js} +1 -1
- package/dist/assets/{useThemeProps-Cqic-E0U.js → useThemeProps-BlrL4N8K.js} +1 -1
- package/dist/assets/{util-DMkhCe5T.js → util-DSMcrouF.js} +1 -1
- package/dist/assets/{wait-container-7MRBml26.js → wait-container-BRhHYdS-.js} +1 -1
- package/dist/assets/{withStyles-mttjYCTj.js → withStyles-CHrv3QJu.js} +1 -1
- package/dist/assets/{wrap-locale-Dy0OLcMz.js → wrap-locale-D-OFTljj.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +1 -1
- package/dist/assets/DeleteOutline-o5TFeql0.js +0 -1
- package/dist/assets/actions-Drufb-pQ.js +0 -11
- package/dist/assets/api-DOcnwqon.js +0 -1
- package/dist/assets/blocklet-DX4HGT6b.js +0 -1
- package/dist/assets/getValidReactChildren-Bwdvi5zb.js +0 -1
- package/dist/assets/index-6XBeHuD_.js +0 -292
- package/dist/assets/index-B8Hu4oNh.js +0 -80
- package/dist/assets/index-CGyIRwUl.js +0 -21
- package/dist/assets/index-HwE3ySwC.js +0 -68
- package/dist/assets/sdk-DM3m0pIz.js +0 -1
- package/dist/assets/service-CqEmzSuD.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
import{r as p,ci as X,cj as F,ck as O,cl as H,aK as q,aL as G,j as s,n as R,P as y,J,aO as Q,f as V,cm as K,y as I,Q as x,cd as Y,W as Z,B as M,m as D,O as ee,cn as te,bn as se,co as ae,cp as ne,u as oe,z as re,am as ie,bk as ce,ad as le}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Co3JrBLr.js","./index-BHdqgom8.js","./index-BEj64JY8.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as p,ci as X,cj as F,ck as O,cl as H,aK as q,aL as G,j as s,n as R,P as y,J,aO as Q,f as V,cm as K,y as I,Q as x,cd as Y,W as Z,B as M,m as D,O as ee,cn as te,bn as se,co as ae,cp as ne,u as oe,z as re,am as ie,bk as ce,ad as le}from"./index-BHdqgom8.js";import{d as pe}from"./CheckCircle-__Xpcyhc.js";import{d as de}from"./ViewList-Lg33z4FS.js";import{d as ue}from"./Done-DEwehpwv.js";import{w as me}from"./wrap-locale-D-OFTljj.js";import{S as fe,a as he,b as xe}from"./Stepper-D4h3SXw3.js";var S=function(e){if(!e)return 0;var r=H(e).valueOf()-Date.now();return r<0?0:r},ge=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},ve=function(e){e===void 0&&(e={});var r=e||{},l=r.leftTime,i=r.targetDate,d=r.interval,v=d===void 0?1e3:d,b=r.onEnd,g=p.useMemo(function(){return X(l)&&l>0?Date.now()+l:void 0},[l]),a="leftTime"in e?g:i,f=F(p.useState(function(){return S(a)}),2),h=f[0],u=f[1],n=O(b);p.useEffect(function(){if(!a){u(0);return}u(S(a));var w=setInterval(function(){var o,c=S(a);u(c),c===0&&(clearInterval(w),(o=n.current)===null||o===void 0||o.call(n))},v);return function(){return clearInterval(w)}},[a,v]);var j=p.useMemo(function(){return ge(h)},[h]);return[h,j]},k={},be=G;Object.defineProperty(k,"__esModule",{value:!0});var E=k.default=void 0,we=be(q()),je=s;E=k.default=(0,we.default)((0,je.jsx)("path",{d:"M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z"}),"GetApp");function T({list:e,width:r,height:l,cardSpace:i,onSelect:d,defaultIndex:v}){const[b,g]=p.useState(0),[a,f]=p.useState(0),h=p.useRef(null),u=o=>{if(o<0||o>e.length-1)return;g(o);const c=h.current.clientWidth;f(o*(r+i)-(c-r)/2+i*.5),d(o)};p.useEffect(()=>{u(v);const o=c=>c.preventDefault();h.current.addEventListener("touchmove",o,{passive:!1})},[]);let n;const j=o=>{n=o.touches[0].clientX},w=o=>{const c=o.changedTouches[0],P=n-c.clientX;Math.abs(P)>60&&(P>0?u(b+1):u(b-1))};return s.jsx(ye,{ref:h,onTouchStart:j,onTouchEnd:w,children:s.jsx("div",{className:"card-container",style:{transform:`translate(${-a}px, 0)`},children:e.map((o,c)=>s.jsx("div",{className:`card-item ${c===b?"selected":""}`,style:{width:r,height:l,margin:i/2},onClick:()=>u(c),children:s.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:o.src}})},o.id))})})}const ye=R.div`
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
mask-image: linear-gradient(to left, transparent, black 3%, black 97%, transparent);
|
|
5
5
|
overflow: hidden;
|
|
@@ -33,7 +33,7 @@ import{r as p,ci as X,cj as F,ck as O,cl as H,aK as q,aL as G,j as s,n as R,P as
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
`;T.propTypes={list:y.array,width:y.number,height:y.number,cardSpace:y.number,onSelect:y.func,defaultIndex:y.number};T.defaultProps={list:"",width:300,height:400,cardSpace:40,onSelect:()=>{},defaultIndex:0};const $=()=>{const{searchParams:e}=new URL(window.location.href);return e.get("fromWallet")==="1"};function Pe({icon:e,active:r,completed:l}){const i={1:s.jsx(de,{className:"step-icon"}),2:s.jsx(E,{className:"step-icon"}),3:s.jsx(ue,{className:"step-icon"})},d=["step-icon-w"];return r&&d.push("step-icon-w--active"),l&&d.push("step-icon-w--completed"),s.jsx("div",{className:d.join(" "),children:i[String(e)]})}function Se({SessionContext:e,webWalletUrl:r,createPassportSvg:l,passportColor:i,onLogin:d}){const{api:v,session:b}=p.useContext(e),g=J(t=>t.breakpoints.down("sm")),a=Q({user:null,passport:null,success:!1,activeStep:0}),f=p.useRef({sessionToken:"",refreshToken:""}),{setPassportId:h,clearPassportId:u}=ne(),{t:n,locale:j}=p.useContext(V),{wallet:w}=K(),[o,c]=p.useState(0),{searchParams:P}=new URL(window.location.href),C=()=>{a.activeStep++},W=t=>{a.user=t.user},A=()=>{C()},z=(t,m)=>{t!=null&&t.passportId&&h(t.passportId),t!=null&&t.sessionToken&&(f.current.sessionToken=m(t.sessionToken)),t!=null&&t.refreshToken&&(f.current.refreshToken=m(t.refreshToken)),a.success=!0,C()},U=()=>new Promise(t=>{try{b.logout(()=>{t()})}catch{t()}}),L=async()=>{if(w&&$()){se(()=>import("./index-
|
|
36
|
+
`;T.propTypes={list:y.array,width:y.number,height:y.number,cardSpace:y.number,onSelect:y.func,defaultIndex:y.number};T.defaultProps={list:"",width:300,height:400,cardSpace:40,onSelect:()=>{},defaultIndex:0};const $=()=>{const{searchParams:e}=new URL(window.location.href);return e.get("fromWallet")==="1"};function Pe({icon:e,active:r,completed:l}){const i={1:s.jsx(de,{className:"step-icon"}),2:s.jsx(E,{className:"step-icon"}),3:s.jsx(ue,{className:"step-icon"})},d=["step-icon-w"];return r&&d.push("step-icon-w--active"),l&&d.push("step-icon-w--completed"),s.jsx("div",{className:d.join(" "),children:i[String(e)]})}function Se({SessionContext:e,webWalletUrl:r,createPassportSvg:l,passportColor:i,onLogin:d}){const{api:v,session:b}=p.useContext(e),g=J(t=>t.breakpoints.down("sm")),a=Q({user:null,passport:null,success:!1,activeStep:0}),f=p.useRef({sessionToken:"",refreshToken:""}),{setPassportId:h,clearPassportId:u}=ne(),{t:n,locale:j}=p.useContext(V),{wallet:w}=K(),[o,c]=p.useState(0),{searchParams:P}=new URL(window.location.href),C=()=>{a.activeStep++},W=t=>{a.user=t.user},A=()=>{C()},z=(t,m)=>{t!=null&&t.passportId&&h(t.passportId),t!=null&&t.sessionToken&&(f.current.sessionToken=m(t.sessionToken)),t!=null&&t.refreshToken&&(f.current.refreshToken=m(t.refreshToken)),a.success=!0,C()},U=()=>new Promise(t=>{try{b.logout(()=>{t()})}catch{t()}}),L=async()=>{if(w&&$()){se(()=>import("./index-Co3JrBLr.js").then(m=>m.i),__vite__mapDeps([0,1,2]),import.meta.url).then(m=>{m.call("arcClosePage")});return}await U(),ae(d)&&d({sessionToken:f.current.sessionToken,refreshToken:f.current.refreshToken});const t=P.get("redirect");if(t){window.location.replace(t);return}u(),window.location.replace("/")},B=t=>{a.passport=t.target.value},[N]=ve({leftTime:o,onEnd:()=>{L()}}),_=[{label:n("lostPassport.selectPassport"),content:()=>a.user?s.jsxs(x,{className:"select-passport",children:[s.jsxs(x,{my:1,display:"flex",alignItems:"center",className:"user-info",children:[s.jsx(Y,{src:a.user.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),s.jsxs(x,{children:[s.jsx(x,{className:"name",children:a.user.fullName}),s.jsx(x,{className:"did",mt:1,children:s.jsx(Z,{responsive:!g,compact:g,did:a.user.did})})]})]}),s.jsx("div",{children:s.jsx(T,{width:g?180:230,height:g?240:306,cardSpace:24,list:a.user.passportTypes.map(t=>({src:l({title:t.title,issuer:t.issuer.name,issuerDid:t.issuer.id,ownerDid:a.user.did,ownerName:a.user.fullName,ownerAvatarUrl:a.user.avatar,preferredColor:i||"auto"}),name:t.title,id:t.id})),onSelect:t=>B({target:{value:a.user.passportTypes[t].name}}),defaultIndex:0})}),s.jsx(x,{textAlign:"center",children:s.jsx(M,{variant:"contained",color:"primary",onClick:()=>A(),disabled:!a.passport,children:n("common.next")})})]}):s.jsx(I,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-list",forceConnected:!1,autoConnect:!1,checkFn:v.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:W,locale:j,messages:{title:n("lostPassport.dialog.title"),scan:n("lostPassport.dialog.scan"),confirm:n("lostPassport.dialog.confirm"),success:n("lostPassport.dialog.success")}})},{label:n("lostPassport.receivePassport"),content:()=>{var m;const t={receiverDid:a.user.did,passportName:a.passport,teamDid:((m=window==null?void 0:window.blocklet)==null?void 0:m.did)||""};return s.jsx(I,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-issue",checkFn:v.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:z,locale:j,messages:{title:`${n("lostPassport.dialog.title")}`,scan:n("lostPassport.dialog.scan"),confirm:n("lostPassport.dialog.confirm"),success:n("lostPassport.dialog.success")},extraParams:t})}},{label:n("common.complete"),content:()=>(o===0&&c(3e3),s.jsxs(x,{textAlign:"center",children:[s.jsx(x,{mb:3,color:"success.main",children:s.jsx(pe,{style:{fontSize:60}})}),s.jsx(D,{component:"p",variant:"body1",className:"subheader",children:n("issuePassport.dialog.success")}),s.jsx(D,{component:"p",variant:"body2",color:"gray",children:w&&$()?n("issuePassport.dialog.autoClose",{seconds:Math.round(N/1e3)}):n("issuePassport.dialog.autoJump",{seconds:Math.round(N/1e3)})}),s.jsx(M,{style:{marginTop:40},variant:"contained",color:"primary",onClick:L,children:n("issuePassport.dialog.loginWithPassport")})]}))}];return s.jsx(ke,{children:s.jsxs("div",{className:"stepper",children:[s.jsx(fe,{className:"stepper-progress",alternativeLabel:!0,activeStep:a.activeStep,children:_.map(({label:t})=>s.jsx(he,{children:s.jsx(xe,{StepIconComponent:Pe,children:t})},t))}),s.jsx("div",{className:"stepper-content",children:_[a.activeStep].content()}),!a.success&&s.jsx(x,{textAlign:"center",fontSize:12,children:s.jsx(ee,{to:"/",style:{color:"#4598FA"},children:n("lostPassport.return")})})]})})}const ke=R(te)`
|
|
37
37
|
padding-top: 46px;
|
|
38
38
|
padding-bottom: 46px;
|
|
39
39
|
height: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bJ as Vc,j as h,P as E,n as D0,C as bM,r as V,eY as tb,cI as Cc,cN as qb,k as gz,g as rb,J as Qz,cx as Pc,$ as Fc,eZ as jc,dt as Yc,e7 as Ic,e8 as Uc,e_ as Hc,e$ as Kc,m as Qc,X as Jc,aK as $c,aL as Zc,f0 as MA,dw as wz,bb as bA,ds as zA,s as pA}from"./index-
|
|
1
|
+
import{bJ as Vc,j as h,P as E,n as D0,C as bM,r as V,eY as tb,cI as Cc,cN as qb,k as gz,g as rb,J as Qz,cx as Pc,$ as Fc,eZ as jc,dt as Yc,e7 as Ic,e8 as Uc,e_ as Hc,e$ as Kc,m as Qc,X as Jc,aK as $c,aL as Zc,f0 as MA,dw as wz,bb as bA,ds as zA,s as pA}from"./index-BHdqgom8.js";import{j as OA}from"./url-join-CiWL3EAW.js";import{S as h2}from"./Skeleton-m_lkZ6lH.js";import{C as oA}from"./Close-BpEmkp97.js";import{l as cA}from"./lottie-DlriAay1.js";const AA=Vc([h.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),h.jsx("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function nb({value:M,size:z,style:O,...o}){return h.jsxs(eA,{style:{width:z,height:z,...O},...o,children:[h.jsx(bM,{variant:"determinate",role:"progressbar",value:100,size:z,"aria-label":"decorative progress bar",thickness:10,style:{color:"#dddddd"}}),h.jsx(bM,{variant:"determinate",value:M,role:"progressbar",size:z,thickness:10,"aria-label":"main progress bar"})]})}nb.propTypes={value:E.number.isRequired,size:E.number,style:E.object};nb.defaultProps={size:10,style:{}};const eA=D0.span`
|
|
2
2
|
display: inline-block;
|
|
3
3
|
position: relative;
|
|
4
4
|
> * {
|
|
@@ -539,8 +539,9 @@ var o=O.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_
|
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
.layout-content {
|
|
542
|
+
width: 100%;
|
|
542
543
|
min-width: 0;
|
|
543
|
-
flex: 1;
|
|
544
|
+
flex-grow: 1;
|
|
544
545
|
height: 100%;
|
|
545
546
|
padding: 32px;
|
|
546
547
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r,U as u,j as e,dM as p,dN as I,dO as z,dP as O,P as o,ds as b,s as m,dQ as E}from"./index-
|
|
1
|
+
import{r,U as u,j as e,dM as p,dN as I,dO as z,dP as O,P as o,ds as b,s as m,dQ as E}from"./index-BHdqgom8.js";import{d as S}from"./ExpandMore-CoMbEsJD.js";import{B as v}from"./ButtonGroup-BIMC9S6K.js";function d(s){const{size:f,color:i,menu:a,children:l,variant:h,onClick:x,menuButtonProps:y,...g}=s,[j,c]=r.useState(!1),t=r.useRef(null),P=Array.isArray(a)?a.map((n,M)=>r.isValidElement(n)?n:r.createElement(u,{...n,key:M})):a,k=()=>{c(n=>!n)},B=n=>{t.current&&t.current.contains(n.target)||c(!1)},C=n=>{n.target.closest(".MuiMenuItem-root")&&c(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(A,{variant:h,size:f,color:i,ref:t,...g,children:[typeof l=="function"?l():e.jsx(p,{onClick:x,color:i,children:l}),e.jsx(p,{onClick:k,color:i,...y,"aria-label":"more functions",children:e.jsx(S,{})})]}),e.jsx(L,{open:j,anchorEl:t.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{children:e.jsx(z,{onClickAway:B,children:e.jsx(O,{onClick:C,children:P})})})})]})}d.propTypes={size:o.oneOf(["small","medium","large"]),color:o.oneOf(["primary","secondary","inherit"]),menu:o.oneOfType([o.node,o.array]),children:o.node,variant:o.oneOf(["outlined","contained"]),onClick:o.func,menuButtonProps:o.object};d.defaultProps={size:"medium",color:"primary",menu:[],children:null,variant:"contained",onClick:b,menuButtonProps:{}};d.Item=u;const A=m(v)`
|
|
2
2
|
> .MuiButtonBase-root:last-of-type {
|
|
3
3
|
min-width: 2em;
|
|
4
4
|
padding-left: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cN as P,dv as M,dw as E,dx as g,dy as Y,dz as N,dA as j}from"./index-
|
|
1
|
+
import{cN as P,dv as M,dw as E,dx as g,dy as Y,dz as N,dA as j}from"./index-BHdqgom8.js";import{a as X}from"./isEqual-BMA5WXPh.js";var V={},i={},d={},q=P&&P.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0});d.toStrictHex=d.toBytes=d.toBits=d.DID_PREFIX=void 0;const K=q(M),H=g,v="did:abt:";d.DID_PREFIX=v;const G=e=>{try{if((0,H.isHexStrict)(e))return E.from((0,H.stripHexPrefix)(e),"hex");let t=(0,H.fromBase58)(e.replace(v,""));for(;t.length<26;)t=E.concat([E.from([0]),t]);return t}catch(t){throw new Error(`Cannot convert DID string to byte array: ${t.message}`)}};d.toBytes=G;const J=(e,t)=>(0,K.default)((0,H.toBN)(e).toString(2),t,"0");d.toBits=J;const z=(e,t)=>{const s=e.replace(/^0x/i,"");return typeof t=="number"&&t%2===0?(0,K.default)(e,t,"0"):s.length%2===0?s:`0${s}`};d.toStrictHex=z;var A=P&&P.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});i.DidType=i.toChecksumAddress=i.isEthereumDid=i.isEthereumType=i.toTypeInfoStr=i.toTypeInfo=i.fromTypeInfo=i.DID_TYPE_ETHEREUM=i.DID_TYPE_ARCBLOCK=void 0;const m=g,b=A(Y),W=A(X),C=A(N),o=j,T=d,D={pk:"key",address:"encoding"},B={role:o.types.RoleType.ROLE_ACCOUNT,pk:o.types.KeyType.ED25519,hash:o.types.HashType.SHA3,address:o.types.EncodingType.BASE58};i.DID_TYPE_ARCBLOCK=B;const R={role:o.types.RoleType.ROLE_ACCOUNT,pk:o.types.KeyType.ETHEREUM,hash:o.types.HashType.KECCAK,address:o.types.EncodingType.BASE16};i.DID_TYPE_ETHEREUM=R;const w=e=>{const t=["pk","hash","address"];return(0,W.default)((0,C.default)(e,t),(0,C.default)(R,t))};i.isEthereumType=w;const F=e=>{const t=(0,m.toAddress)(e);return/^(0x)?[0-9a-f]{40}$/i.test(t)?/^(0x|0X)?[0-9a-f]{40}$/.test(t)||/^(0x|0X)?[0-9A-F]{40}$/.test(t)?!0:Q(t):!1};i.isEthereumDid=F;const Q=e=>{const t=e.replace(/^0x/i,""),s=o.Hasher.Keccak.hash256(t.toLowerCase()).replace(/^0x/i,"");for(let r=0;r<40;r++)if(parseInt(s[r],16)>7&&t[r].toUpperCase()!==t[r]||parseInt(s[r],16)<=7&&t[r].toLowerCase()!==t[r])return!1;return!0},Z=e=>{if(typeof e>"u")return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(e))throw new Error(`Given address "${e}" is not a valid Ethereum address.`);const t=e.toLowerCase().replace(/^0x/i,""),s=o.Hasher.Keccak.hash256(t).replace(/^0x/i,"");let r="0x";for(let n=0;n<t.length;n++)parseInt(s[n],16)>7?r+=t[n].toUpperCase():r+=t[n];return r};i.toChecksumAddress=Z;function k(e={}){let t={};["default","arcblock"].includes(e)?t=B:["eth","ethereum"].includes(e)?t=R:t={...B,...e};const{role:s,pk:r,hash:n,address:u}=t;Object.keys(t).forEach(l=>{const _=(0,b.default)(`${D[l]||l}Type`);if(Object.values(o.types[_]).includes(t[l])===!1)throw new Error(`Unsupported ${l} type: ${t[l]}`)});const p={role:s,pk:r,hash:n,address:u};return w(p)===!1&&[o.types.RoleType.ROLE_NODE,o.types.RoleType.ROLE_VALIDATOR,o.types.RoleType.ROLE_TETHER,o.types.RoleType.ROLE_SWAP].includes(p.role)&&(p.hash=o.types.HashType.SHA2),p}i.DidType=k;k.toJSON=e=>Object.keys(e).reduce((t,s)=>{const r=(0,b.default)(`${D[s]||s}Type`),n=Object.keys(o.types[r]),u=Object.values(o.types[r]);return t[s]=n[u.indexOf(e[s])],t},{});k.fromJSON=e=>Object.keys(e).reduce((t,s)=>{const r=(0,b.default)(`${D[s]||s}Type`),n=Object.keys(o.types[r]),u=Object.values(o.types[r]);return t[s]=u[n.indexOf(e[s])],t},{});const x=e=>{const t=k(e),s=(0,T.toBits)(t.role,6),r=(0,T.toBits)(t.pk,5),n=(0,T.toBits)(t.hash,5),u=`${s}${r}${n}`,p=(0,m.stripHexPrefix)((0,m.numberToHex)(parseInt(u,2)));return(0,T.toStrictHex)(p,4)};i.fromTypeInfo=x;const L=e=>{let t={};try{if(F(e))t=R;else{const r=(0,T.toBytes)(e).slice(0,2),n=(0,T.toStrictHex)(E.from(r).toString("hex")),u=(0,T.toBits)(new m.BN(n,16),16),p=u.slice(0,6),l=u.slice(6,11),_=u.slice(11,16);t={role:parseInt(p,2),pk:parseInt(l,2),hash:parseInt(_,2),address:(0,m.isHex)((0,m.toAddress)(e))?o.types.EncodingType.BASE16:o.types.EncodingType.BASE58}}return Object.keys(t).forEach(s=>{Object.values(o.types[`${(0,b.default)(D[s]||s)}Type`]).includes(t[s])===!1&&delete t[s]}),t}catch{return t}};i.toTypeInfo=L;const ee=e=>{const t=L(e);return Object.keys(t).reduce((s,r)=>{const n=o.types[`${(0,b.default)(D[r]||r)}Type`];return s[r]=Object.keys(n).find(u=>n[u]===t[r]),s},{})};i.toTypeInfoStr=ee;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DID_TYPE_ETHEREUM=e.DID_TYPE_ARCBLOCK=e.DID_PREFIX=e.DidType=e.fromTypeInfo=e.toTypeInfoStr=e.toTypeInfo=e.isEthereumType=e.isEthereumDid=e.isValid=e.isFromPublicKey=e.toDid=e.toAddress=e.fromHash=e.fromPublicKeyHash=e.fromPublicKey=e.fromSecretKey=e.toStrictHex=e.types=void 0;const t=j;Object.defineProperty(e,"types",{enumerable:!0,get:function(){return t.types}});const s=g;Object.defineProperty(e,"toAddress",{enumerable:!0,get:function(){return s.toAddress}}),Object.defineProperty(e,"toDid",{enumerable:!0,get:function(){return s.toDid}});const r=i;Object.defineProperty(e,"DidType",{enumerable:!0,get:function(){return r.DidType}}),Object.defineProperty(e,"DID_TYPE_ARCBLOCK",{enumerable:!0,get:function(){return r.DID_TYPE_ARCBLOCK}}),Object.defineProperty(e,"DID_TYPE_ETHEREUM",{enumerable:!0,get:function(){return r.DID_TYPE_ETHEREUM}}),Object.defineProperty(e,"fromTypeInfo",{enumerable:!0,get:function(){return r.fromTypeInfo}}),Object.defineProperty(e,"isEthereumDid",{enumerable:!0,get:function(){return r.isEthereumDid}}),Object.defineProperty(e,"isEthereumType",{enumerable:!0,get:function(){return r.isEthereumType}}),Object.defineProperty(e,"toTypeInfo",{enumerable:!0,get:function(){return r.toTypeInfo}}),Object.defineProperty(e,"toTypeInfoStr",{enumerable:!0,get:function(){return r.toTypeInfoStr}});const n=d;Object.defineProperty(e,"DID_PREFIX",{enumerable:!0,get:function(){return n.DID_PREFIX}}),Object.defineProperty(e,"toStrictHex",{enumerable:!0,get:function(){return n.toStrictHex}});const u=(y,a)=>{const c=(0,r.DidType)(a),f=(0,t.getSigner)(c.pk).getPublicKey(y);return p(f.indexOf("0x")===0?f:`0x${f}`,c)};e.fromSecretKey=u;const p=(y,a)=>{const c=(0,r.DidType)(a),h=(0,t.getHasher)(c.hash)(y,1);return l(h,c)};e.fromPublicKey=p;const l=(y,a)=>{const c=(0,r.DidType)(a),f=(0,s.stripHexPrefix)(y).slice(0,40),h=(0,t.getHasher)(c.hash),I=(0,r.fromTypeInfo)(c),S=(0,s.stripHexPrefix)(h(`0x${I}${f}`,1)).slice(0,8),O=`0x${I}${f}${S}`;return(0,r.isEthereumType)(c)?(0,r.toChecksumAddress)(`0x${y.slice(-40)}`):c.address===t.types.EncodingType.BASE58?(0,s.toBase58)(O):O};e.fromPublicKeyHash=l;const _=(y,a=t.types.RoleType.ROLE_ACCOUNT)=>{const c=Object.keys(t.types.RoleType),f=Object.values(t.types.RoleType);if(f.indexOf(a)===-1)throw new Error(`Unsupported role type ${a} when gen ddi from hash`);const h=(0,r.DidType)({role:t.types.RoleType[c[f.indexOf(a)]]});return l(y,h)};e.fromHash=_;const U=(y,a)=>{if($(y)===!1)return!1;const c=(0,r.toTypeInfo)(y),f=p(a,c),h=y.replace(n.DID_PREFIX,"");return f===h};e.isFromPublicKey=U;const $=y=>{if(!y)return!1;const a=(0,s.toAddress)(String(y)),{hash:c}=(0,r.toTypeInfo)(a);if(typeof c>"u")return!1;if((0,r.isEthereumDid)(a))return!0;const f=(0,t.getHasher)(c),h=(0,n.toBytes)(a),I=(0,n.toStrictHex)(E.from(h.slice(0,22)).toString("hex")),S=(0,n.toStrictHex)(E.from(h.slice(22,26)).toString("hex")),O=(0,s.stripHexPrefix)(f(`0x${I}`,1)).slice(0,8);return S===O};e.isValid=$})(V);export{V as l};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{l as q}from"./lottie-
|
|
1
|
+
import{l as q}from"./lottie-DlriAay1.js";import{r as D,bb as z}from"./index-BHdqgom8.js";function G(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,u,c,i,b=[],f=!0,A=!1;try{if(c=(r=r.call(t)).next,e!==0)for(;!(f=(n=c.call(r)).done)&&(b.push(n.value),b.length!==e);f=!0);}catch(g){A=!0,u=g}finally{try{if(!f&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(A)throw u}}return b}}function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable})),r.push.apply(r,n)}return r}function I(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?E(Object(r),!0).forEach(function(n){J(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function J(t,e,r){return e=ae(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Q(t,e){if(t==null)return{};var r={},n=Object.keys(t),u,c;for(c=0;c<n.length;c++)u=n[c],!(e.indexOf(u)>=0)&&(r[u]=t[u]);return r}function x(t,e){if(t==null)return{};var r=Q(t,e),n,u;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);for(u=0;u<c.length;u++)n=c[u],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Z(t,e){return ee(t)||G(t,e)||te(t,e)||ne()}function ee(t){if(Array.isArray(t))return t}function te(t,e){if(t){if(typeof t=="string")return j(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(t,e)}}function j(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function re(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ae(t){var e=re(t,"string");return typeof e=="symbol"?e:String(e)}var oe=["animationData","loop","autoplay","initialSegment","onComplete","onLoopComplete","onEnterFrame","onSegmentStart","onConfigReady","onDataReady","onDataFailed","onLoadedImages","onDOMLoaded","onDestroy","lottieRef","renderer","name","assetsPath","rendererSettings"],ie=function(e,r){var n=e.animationData,u=e.loop,c=e.autoplay,i=e.initialSegment,b=e.onComplete,f=e.onLoopComplete,A=e.onEnterFrame,g=e.onSegmentStart,O=e.onConfigReady,w=e.onDataReady,h=e.onDataFailed,l=e.onLoadedImages,L=e.onDOMLoaded,S=e.onDestroy;e.lottieRef,e.renderer,e.name,e.assetsPath,e.rendererSettings;var p=x(e,oe),P=D.useState(!1),s=Z(P,2),C=s[0],_=s[1],o=D.useRef(),v=D.useRef(null),H=function(){var a;(a=o.current)===null||a===void 0||a.play()},M=function(){var a;(a=o.current)===null||a===void 0||a.stop()},F=function(){var a;(a=o.current)===null||a===void 0||a.pause()},V=function(a){var d;(d=o.current)===null||d===void 0||d.setSpeed(a)},N=function(a,d){var m;(m=o.current)===null||m===void 0||m.goToAndPlay(a,d)},B=function(a,d){var m;(m=o.current)===null||m===void 0||m.goToAndStop(a,d)},$=function(a){var d;(d=o.current)===null||d===void 0||d.setDirection(a)},k=function(a,d){var m;(m=o.current)===null||m===void 0||m.playSegments(a,d)},W=function(a){var d;(d=o.current)===null||d===void 0||d.setSubframe(a)},K=function(a){var d;return(d=o.current)===null||d===void 0?void 0:d.getDuration(a)},U=function(){var a;(a=o.current)===null||a===void 0||a.destroy(),o.current=void 0},X=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d;if(v.current){(d=o.current)===null||d===void 0||d.destroy();var m=I(I(I({},e),a),{},{container:v.current});return o.current=q.loadAnimation(m),_(!!o.current),function(){var R;(R=o.current)===null||R===void 0||R.destroy(),o.current=void 0}}};D.useEffect(function(){var y=X();return function(){return y==null?void 0:y()}},[n,u]),D.useEffect(function(){o.current&&(o.current.autoplay=!!c)},[c]),D.useEffect(function(){if(o.current){if(!i){o.current.resetSegments(!0);return}!Array.isArray(i)||!i.length||((o.current.currentRawFrame<i[0]||o.current.currentRawFrame>i[1])&&(o.current.currentRawFrame=i[0]),o.current.setSegment(i[0],i[1]))}},[i]),D.useEffect(function(){var y=[{name:"complete",handler:b},{name:"loopComplete",handler:f},{name:"enterFrame",handler:A},{name:"segmentStart",handler:g},{name:"config_ready",handler:O},{name:"data_ready",handler:w},{name:"data_failed",handler:h},{name:"loaded_images",handler:l},{name:"DOMLoaded",handler:L},{name:"destroy",handler:S}],a=y.filter(function(m){return m.handler!=null});if(a.length){var d=a.map(function(m){var R;return(R=o.current)===null||R===void 0||R.addEventListener(m.name,m.handler),function(){var T;(T=o.current)===null||T===void 0||T.removeEventListener(m.name,m.handler)}});return function(){d.forEach(function(m){return m()})}}},[b,f,A,g,O,w,h,l,L,S]);var Y=z.createElement("div",I({style:r,ref:v},p));return{View:Y,play:H,stop:M,pause:F,setSpeed:V,goToAndStop:B,goToAndPlay:N,setDirection:$,playSegments:k,setSubframe:W,getDuration:K,destroy:U,animationContainerRef:v,animationLoaded:C,animationItem:o.current}};function ue(t){var e=t.getBoundingClientRect(),r=e.top,n=e.height,u=window.innerHeight-r,c=window.innerHeight+n;return u/c}function le(t,e,r){var n=t.getBoundingClientRect(),u=n.top,c=n.left,i=n.width,b=n.height,f=(e-c)/i,A=(r-u)/b;return{x:f,y:A}}var se=function(e){var r=e.wrapperRef,n=e.animationItem,u=e.mode,c=e.actions;D.useEffect(function(){var i=r.current;if(!(!i||!n||!c.length)){n.stop();var b=function(){var g=null,O=function(){var h=ue(i),l=c.find(function(S){var p=S.visibility;return p&&h>=p[0]&&h<=p[1]});if(l){if(l.type==="seek"&&l.visibility&&l.frames.length===2){var L=l.frames[0]+Math.ceil((h-l.visibility[0])/(l.visibility[1]-l.visibility[0])*l.frames[1]);//! goToAndStop must be relative to the start of the current segment
|
|
3
3
|
n.goToAndStop(L-n.firstFrame-1,!0)}l.type==="loop"&&(g===null||g!==l.frames||n.isPaused)&&(n.playSegments(l.frames,!0),g=l.frames),l.type==="play"&&n.isPaused&&(n.resetSegments(!0),n.play()),l.type==="stop"&&n.goToAndStop(l.frames[0]-n.firstFrame-1,!0)}};return document.addEventListener("scroll",O),function(){document.removeEventListener("scroll",O)}},f=function(){var g=function(l,L){var S=l,p=L;if(S!==-1&&p!==-1){var P=le(i,S,p);S=P.x,p=P.y}var s=c.find(function(o){var v=o.position;return v&&Array.isArray(v.x)&&Array.isArray(v.y)?S>=v.x[0]&&S<=v.x[1]&&p>=v.y[0]&&p<=v.y[1]:v&&!Number.isNaN(v.x)&&!Number.isNaN(v.y)?S===v.x&&p===v.y:!1});if(s){if(s.type==="seek"&&s.position&&Array.isArray(s.position.x)&&Array.isArray(s.position.y)&&s.frames.length===2){var C=(S-s.position.x[0])/(s.position.x[1]-s.position.x[0]),_=(p-s.position.y[0])/(s.position.y[1]-s.position.y[0]);n.playSegments(s.frames,!0),n.goToAndStop(Math.ceil((C+_)/2*(s.frames[1]-s.frames[0])),!0)}s.type==="loop"&&n.playSegments(s.frames,!0),s.type==="play"&&(n.isPaused&&n.resetSegments(!1),n.playSegments(s.frames)),s.type==="stop"&&n.goToAndStop(s.frames[0],!0)}},O=function(l){g(l.clientX,l.clientY)},w=function(){g(-1,-1)};return i.addEventListener("mousemove",O),i.addEventListener("mouseout",w),function(){i.removeEventListener("mousemove",O),i.removeEventListener("mouseout",w)}};switch(u){case"scroll":return b();case"cursor":return f()}}},[u,n])},de=function(e){var r=e.actions,n=e.mode,u=e.lottieObj,c=u.animationItem,i=u.View,b=u.animationContainerRef;return se({actions:r,animationItem:c,mode:n,wrapperRef:b}),i},fe=["style","interactivity"],ve=function(e){var r,n,u,c=e.style,i=e.interactivity,b=x(e,fe),f=ie(b,c),A=f.View,g=f.play,O=f.stop,w=f.pause,h=f.setSpeed,l=f.goToAndStop,L=f.goToAndPlay,S=f.setDirection,p=f.playSegments,P=f.setSubframe,s=f.getDuration,C=f.destroy,_=f.animationContainerRef,o=f.animationLoaded,v=f.animationItem;return D.useEffect(function(){e.lottieRef&&(e.lottieRef.current={play:g,stop:O,pause:w,setSpeed:h,goToAndPlay:L,goToAndStop:l,setDirection:S,playSegments:p,setSubframe:P,getDuration:s,destroy:C,animationContainerRef:_,animationLoaded:o,animationItem:v})},[(r=e.lottieRef)===null||r===void 0?void 0:r.current]),de({lottieObj:{View:A,play:g,stop:O,pause:w,setSpeed:h,goToAndStop:l,goToAndPlay:L,setDirection:S,playSegments:p,setSubframe:P,getDuration:s,destroy:C,animationContainerRef:_,animationLoaded:o,animationItem:v},actions:(n=i==null?void 0:i.actions)!==null&&n!==void 0?n:[],mode:(u=i==null?void 0:i.mode)!==null&&u!==void 0?u:"scroll"})};export{q as LottiePlayer,ve as default,ie as useLottie,de as useLottieInteractivity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bb as m}from"./index-CRLxFVWY.js";var ce=e=>e.type==="checkbox",ie=e=>e instanceof Date,O=e=>e==null;const et=e=>typeof e=="object";var T=e=>!O(e)&&!Array.isArray(e)&&et(e)&&!ie(e),tt=e=>T(e)&&e.target?ce(e.target)?e.target.checked:e.target.value:e,At=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,rt=(e,s)=>e.has(At(s)),xt=e=>{const s=e.constructor&&e.constructor.prototype;return T(s)&&s.hasOwnProperty("isPrototypeOf")},Re=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function p(e){let s;const t=Array.isArray(e);if(e instanceof Date)s=new Date(e);else if(e instanceof Set)s=new Set(e);else if(!(Re&&(e instanceof Blob||e instanceof FileList))&&(t||T(e)))if(s=t?[]:{},!t&&!xt(e))s=e;else for(const u in e)e.hasOwnProperty(u)&&(s[u]=p(e[u]));else return e;return s}var Ae=e=>Array.isArray(e)?e.filter(Boolean):[],w=e=>e===void 0,f=(e,s,t)=>{if(!s||!T(e))return t;const u=Ae(s.split(/[,[\].]+?/)).reduce((n,a)=>O(n)?n:n[a],e);return w(u)||u===e?w(e[s])?t:e[s]:u},j=e=>typeof e=="boolean",Te=e=>/^\w*$/.test(e),st=e=>Ae(e.replace(/["|']|\]/g,"").split(/\.|\[/)),x=(e,s,t)=>{let u=-1;const n=Te(s)?[s]:st(s),a=n.length,y=a-1;for(;++u<a;){const h=n[u];let D=t;if(u!==y){const S=e[h];D=T(S)||Array.isArray(S)?S:isNaN(+n[u+1])?{}:[]}if(h==="__proto__")return;e[h]=D,e=e[h]}return e};const ve={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},W={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},z={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},mt=m.createContext(null),Le=()=>m.useContext(mt);var it=(e,s,t,u=!0)=>{const n={defaultValues:s._defaultValues};for(const a in e)Object.defineProperty(n,a,{get:()=>{const y=a;return s._proxyFormState[y]!==W.all&&(s._proxyFormState[y]=!u||W.all),t&&(t[y]=!0),e[y]}});return n},M=e=>T(e)&&!Object.keys(e).length,ut=(e,s,t,u)=>{t(e);const{name:n,...a}=e;return M(a)||Object.keys(a).length>=Object.keys(s).length||Object.keys(a).find(y=>s[y]===(!u||W.all))},oe=e=>Array.isArray(e)?e:[e],lt=(e,s,t)=>!e||!s||e===s||oe(e).some(u=>u&&(t?u===s:u.startsWith(s)||s.startsWith(u)));function Ue(e){const s=m.useRef(e);s.current=e,m.useEffect(()=>{const t=!e.disabled&&s.current.subject&&s.current.subject.subscribe({next:s.current.next});return()=>{t&&t.unsubscribe()}},[e.disabled])}function Dt(e){const s=Le(),{control:t=s.control,disabled:u,name:n,exact:a}=e||{},[y,h]=m.useState(t._formState),D=m.useRef(!0),S=m.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),_=m.useRef(n);return _.current=n,Ue({disabled:u,next:v=>D.current&<(_.current,v.name,a)&&ut(v,S.current,t._updateFormState)&&h({...t._formState,...v}),subject:t._subjects.state}),m.useEffect(()=>(D.current=!0,S.current.isValid&&t._updateValid(!0),()=>{D.current=!1}),[t]),it(y,t,S.current,!1)}var $=e=>typeof e=="string",at=(e,s,t,u,n)=>$(e)?(u&&s.watch.add(e),f(t,e,n)):Array.isArray(e)?e.map(a=>(u&&s.watch.add(a),f(t,a))):(u&&(s.watchAll=!0),t);function wt(e){const s=Le(),{control:t=s.control,name:u,defaultValue:n,disabled:a,exact:y}=e||{},h=m.useRef(u);h.current=u,Ue({disabled:a,subject:t._subjects.values,next:_=>{lt(h.current,_.name,y)&&S(p(at(h.current,t._names,_.values||t._formValues,!1,n)))}});const[D,S]=m.useState(t._getWatch(u,n));return m.useEffect(()=>t._removeUnmounted()),D}function Et(e){const s=Le(),{name:t,disabled:u,control:n=s.control,shouldUnregister:a}=e,y=rt(n._names.array,t),h=wt({control:n,name:t,defaultValue:f(n._formValues,t,f(n._defaultValues,t,e.defaultValue)),exact:!0}),D=Dt({control:n,name:t,exact:!0}),S=m.useRef(n.register(t,{...e.rules,value:h,...j(e.disabled)?{disabled:e.disabled}:{}}));return m.useEffect(()=>{const _=n._options.shouldUnregister||a,v=(N,H)=>{const L=f(n._fields,N);L&&L._f&&(L._f.mount=H)};if(v(t,!0),_){const N=p(f(n._options.defaultValues,t));x(n._defaultValues,t,N),w(f(n._formValues,t))&&x(n._formValues,t,N)}return()=>{(y?_&&!n._state.action:_)?n.unregister(t):v(t,!1)}},[t,n,y,a]),m.useEffect(()=>{f(n._fields,t)&&n._updateDisabledField({disabled:u,fields:n._fields,name:t,value:f(n._fields,t)._f.value})},[u,t,n]),{field:{name:t,value:h,...j(u)||D.disabled?{disabled:D.disabled||u}:{},onChange:m.useCallback(_=>S.current.onChange({target:{value:tt(_),name:t},type:ve.CHANGE}),[t]),onBlur:m.useCallback(()=>S.current.onBlur({target:{value:f(n._formValues,t),name:t},type:ve.BLUR}),[t,n]),ref:m.useCallback(_=>{const v=f(n._fields,t);v&&_&&(v._f.ref={focus:()=>_.focus(),select:()=>_.select(),setCustomValidity:N=>_.setCustomValidity(N),reportValidity:()=>_.reportValidity()})},[n._fields,t])},formState:D,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!f(D.errors,t)},isDirty:{enumerable:!0,get:()=>!!f(D.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!f(D.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!f(D.validatingFields,t)},error:{enumerable:!0,get:()=>f(D.errors,t)}})}}const Wt=e=>e.render(Et(e));var St=(e,s,t,u,n)=>s?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[u]:n||!0}}:{},Ke=e=>({isOnSubmit:!e||e===W.onSubmit,isOnBlur:e===W.onBlur,isOnChange:e===W.onChange,isOnAll:e===W.all,isOnTouch:e===W.onTouched}),Ge=(e,s,t)=>!t&&(s.watchAll||s.watch.has(e)||[...s.watch].some(u=>e.startsWith(u)&&/^\.\w+/.test(e.slice(u.length))));const fe=(e,s,t,u)=>{for(const n of t||Object.keys(e)){const a=f(e,n);if(a){const{_f:y,...h}=a;if(y){if(y.refs&&y.refs[0]&&s(y.refs[0],n)&&!u)break;if(y.ref&&s(y.ref,y.name)&&!u)break;fe(h,s)}else T(h)&&fe(h,s)}}};var kt=(e,s,t)=>{const u=oe(f(e,t));return x(u,"root",s[t]),x(e,t,u),e},Oe=e=>e.type==="file",X=e=>typeof e=="function",_e=e=>{if(!Re)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},he=e=>$(e),pe=e=>e.type==="radio",be=e=>e instanceof RegExp;const ze={value:!1,isValid:!1},Je={value:!0,isValid:!0};var nt=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!w(e[0].attributes.value)?w(e[0].value)||e[0].value===""?Je:{value:e[0].value,isValid:!0}:Je:ze}return ze};const Qe={isValid:!1,value:null};var ot=e=>Array.isArray(e)?e.reduce((s,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:s,Qe):Qe;function Xe(e,s,t="validate"){if(he(e)||Array.isArray(e)&&e.every(he)||j(e)&&!e)return{type:t,message:he(e)?e:"",ref:s}}var se=e=>T(e)&&!be(e)?e:{value:e,message:""},Ye=async(e,s,t,u,n)=>{const{ref:a,refs:y,required:h,maxLength:D,minLength:S,min:_,max:v,pattern:N,validate:H,name:L,valueAsNumber:xe,mount:J,disabled:Q}=e._f,V=f(s,L);if(!J||Q)return{};const K=y?y[0]:a,G=b=>{u&&K.reportValidity&&(K.setCustomValidity(j(b)?"":b||""),K.reportValidity())},k={},ee=pe(a),de=ce(a),Y=ee||de,te=(xe||Oe(a))&&w(a.value)&&w(V)||_e(a)&&a.value===""||V===""||Array.isArray(V)&&!V.length,P=St.bind(null,L,t,k),ye=(b,F,C,U=z.maxLength,q=z.minLength)=>{const I=b?F:C;k[L]={type:b?U:q,message:I,ref:a,...P(b?U:q,I)}};if(n?!Array.isArray(V)||!V.length:h&&(!Y&&(te||O(V))||j(V)&&!V||de&&!nt(y).isValid||ee&&!ot(y).isValid)){const{value:b,message:F}=he(h)?{value:!!h,message:h}:se(h);if(b&&(k[L]={type:z.required,message:F,ref:K,...P(z.required,F)},!t))return G(F),k}if(!te&&(!O(_)||!O(v))){let b,F;const C=se(v),U=se(_);if(!O(V)&&!isNaN(V)){const q=a.valueAsNumber||V&&+V;O(C.value)||(b=q>C.value),O(U.value)||(F=q<U.value)}else{const q=a.valueAsDate||new Date(V),I=ae=>new Date(new Date().toDateString()+" "+ae),ue=a.type=="time",le=a.type=="week";$(C.value)&&V&&(b=ue?I(V)>I(C.value):le?V>C.value:q>new Date(C.value)),$(U.value)&&V&&(F=ue?I(V)<I(U.value):le?V<U.value:q<new Date(U.value))}if((b||F)&&(ye(!!b,C.message,U.message,z.max,z.min),!t))return G(k[L].message),k}if((D||S)&&!te&&($(V)||n&&Array.isArray(V))){const b=se(D),F=se(S),C=!O(b.value)&&V.length>+b.value,U=!O(F.value)&&V.length<+F.value;if((C||U)&&(ye(C,b.message,F.message),!t))return G(k[L].message),k}if(N&&!te&&$(V)){const{value:b,message:F}=se(N);if(be(b)&&!V.match(b)&&(k[L]={type:z.pattern,message:F,ref:a,...P(z.pattern,F)},!t))return G(F),k}if(H){if(X(H)){const b=await H(V,s),F=Xe(b,K);if(F&&(k[L]={...F,...P(z.validate,F.message)},!t))return G(F.message),k}else if(T(H)){let b={};for(const F in H){if(!M(b)&&!t)break;const C=Xe(await H[F](V,s),K,F);C&&(b={...C,...P(F,C.message)},G(C.message),t&&(k[L]=b))}if(!M(b)&&(k[L]={ref:K,...b},!t))return k}}return G(!0),k};function Ct(e,s){const t=s.slice(0,-1).length;let u=0;for(;u<t;)e=w(e)?u++:e[s[u++]];return e}function Rt(e){for(const s in e)if(e.hasOwnProperty(s)&&!w(e[s]))return!1;return!0}function R(e,s){const t=Array.isArray(s)?s:Te(s)?[s]:st(s),u=t.length===1?e:Ct(e,t),n=t.length-1,a=t[n];return u&&delete u[a],n!==0&&(T(u)&&M(u)||Array.isArray(u)&&Rt(u))&&R(e,t.slice(0,-1)),e}var Se=()=>{let e=[];return{get observers(){return e},next:n=>{for(const a of e)a.next&&a.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(a=>a!==n)}}),unsubscribe:()=>{e=[]}}},Ve=e=>O(e)||!et(e);function Z(e,s){if(Ve(e)||Ve(s))return e===s;if(ie(e)&&ie(s))return e.getTime()===s.getTime();const t=Object.keys(e),u=Object.keys(s);if(t.length!==u.length)return!1;for(const n of t){const a=e[n];if(!u.includes(n))return!1;if(n!=="ref"){const y=s[n];if(ie(a)&&ie(y)||T(a)&&T(y)||Array.isArray(a)&&Array.isArray(y)?!Z(a,y):a!==y)return!1}}return!0}var ft=e=>e.type==="select-multiple",Tt=e=>pe(e)||ce(e),ke=e=>_e(e)&&e.isConnected,ct=e=>{for(const s in e)if(X(e[s]))return!0;return!1};function Fe(e,s={}){const t=Array.isArray(e);if(T(e)||t)for(const u in e)Array.isArray(e[u])||T(e[u])&&!ct(e[u])?(s[u]=Array.isArray(e[u])?[]:{},Fe(e[u],s[u])):O(e[u])||(s[u]=!0);return s}function dt(e,s,t){const u=Array.isArray(e);if(T(e)||u)for(const n in e)Array.isArray(e[n])||T(e[n])&&!ct(e[n])?w(s)||Ve(t[n])?t[n]=Array.isArray(e[n])?Fe(e[n],[]):{...Fe(e[n])}:dt(e[n],O(s)?{}:s[n],t[n]):t[n]=!Z(e[n],s[n]);return t}var ge=(e,s)=>dt(e,s,Fe(s)),yt=(e,{valueAsNumber:s,valueAsDate:t,setValueAs:u})=>w(e)?e:s?e===""?NaN:e&&+e:t&&$(e)?new Date(e):u?u(e):e;function Ce(e){const s=e.ref;if(!(e.refs?e.refs.every(t=>t.disabled):s.disabled))return Oe(s)?s.files:pe(s)?ot(e.refs).value:ft(s)?[...s.selectedOptions].map(({value:t})=>t):ce(s)?nt(e.refs).value:yt(w(s.value)?e.ref.value:s.value,e)}var Lt=(e,s,t,u)=>{const n={};for(const a of e){const y=f(s,a);y&&x(n,a,y._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:u}},ne=e=>w(e)?e:be(e)?e.source:T(e)?be(e.value)?e.value.source:e.value:e,Ut=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Ze(e,s,t){const u=f(e,t);if(u||Te(t))return{error:u,name:t};const n=t.split(".");for(;n.length;){const a=n.join("."),y=f(s,a),h=f(e,a);if(y&&!Array.isArray(y)&&t!==a)return{name:t};if(h&&h.type)return{name:a,error:h};n.pop()}return{name:t}}var Ot=(e,s,t,u,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(s||e):(t?u.isOnBlur:n.isOnBlur)?!e:(t?u.isOnChange:n.isOnChange)?e:!0,pt=(e,s)=>!Ae(f(e,s)).length&&R(e,s);const Mt={mode:W.onSubmit,reValidateMode:W.onChange,shouldFocusError:!0};function Bt(e={}){let s={...Mt,...e},t={submitCount:0,isDirty:!1,isLoading:X(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},u={},n=T(s.defaultValues)||T(s.values)?p(s.defaultValues||s.values)||{}:{},a=s.shouldUnregister?{}:p(n),y={action:!1,mount:!1,watch:!1},h={mount:new Set,unMount:new Set,array:new Set,watch:new Set},D,S=0;const _={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={values:Se(),array:Se(),state:Se()},N=Ke(s.mode),H=Ke(s.reValidateMode),L=s.criteriaMode===W.all,xe=r=>i=>{clearTimeout(S),S=setTimeout(r,i)},J=async r=>{if(_.isValid||r){const i=s.resolver?M((await Y()).errors):await P(u,!0);i!==t.isValid&&v.state.next({isValid:i})}},Q=(r,i)=>{(_.isValidating||_.validatingFields)&&((r||Array.from(h.mount)).forEach(l=>{l&&(i?x(t.validatingFields,l,i):R(t.validatingFields,l))}),v.state.next({validatingFields:t.validatingFields,isValidating:!M(t.validatingFields)}))},V=(r,i=[],l,d,c=!0,o=!0)=>{if(d&&l){if(y.action=!0,o&&Array.isArray(f(u,r))){const g=l(f(u,r),d.argA,d.argB);c&&x(u,r,g)}if(o&&Array.isArray(f(t.errors,r))){const g=l(f(t.errors,r),d.argA,d.argB);c&&x(t.errors,r,g),pt(t.errors,r)}if(_.touchedFields&&o&&Array.isArray(f(t.touchedFields,r))){const g=l(f(t.touchedFields,r),d.argA,d.argB);c&&x(t.touchedFields,r,g)}_.dirtyFields&&(t.dirtyFields=ge(n,a)),v.state.next({name:r,isDirty:b(r,i),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else x(a,r,i)},K=(r,i)=>{x(t.errors,r,i),v.state.next({errors:t.errors})},G=r=>{t.errors=r,v.state.next({errors:t.errors,isValid:!1})},k=(r,i,l,d)=>{const c=f(u,r);if(c){const o=f(a,r,w(l)?f(n,r):l);w(o)||d&&d.defaultChecked||i?x(a,r,i?o:Ce(c._f)):U(r,o),y.mount&&J()}},ee=(r,i,l,d,c)=>{let o=!1,g=!1;const A={name:r},E=!!(f(u,r)&&f(u,r)._f&&f(u,r)._f.disabled);if(!l||d){_.isDirty&&(g=t.isDirty,t.isDirty=A.isDirty=b(),o=g!==A.isDirty);const B=E||Z(f(n,r),i);g=!!(!E&&f(t.dirtyFields,r)),B||E?R(t.dirtyFields,r):x(t.dirtyFields,r,!0),A.dirtyFields=t.dirtyFields,o=o||_.dirtyFields&&g!==!B}if(l){const B=f(t.touchedFields,r);B||(x(t.touchedFields,r,l),A.touchedFields=t.touchedFields,o=o||_.touchedFields&&B!==l)}return o&&c&&v.state.next(A),o?A:{}},de=(r,i,l,d)=>{const c=f(t.errors,r),o=_.isValid&&j(i)&&t.isValid!==i;if(e.delayError&&l?(D=xe(()=>K(r,l)),D(e.delayError)):(clearTimeout(S),D=null,l?x(t.errors,r,l):R(t.errors,r)),(l?!Z(c,l):c)||!M(d)||o){const g={...d,...o&&j(i)?{isValid:i}:{},errors:t.errors,name:r};t={...t,...g},v.state.next(g)}},Y=async r=>{Q(r,!0);const i=await s.resolver(a,s.context,Lt(r||h.mount,u,s.criteriaMode,s.shouldUseNativeValidation));return Q(r),i},te=async r=>{const{errors:i}=await Y(r);if(r)for(const l of r){const d=f(i,l);d?x(t.errors,l,d):R(t.errors,l)}else t.errors=i;return i},P=async(r,i,l={valid:!0})=>{for(const d in r){const c=r[d];if(c){const{_f:o,...g}=c;if(o){const A=h.array.has(o.name);Q([d],!0);const E=await Ye(c,a,L,s.shouldUseNativeValidation&&!i,A);if(Q([d]),E[o.name]&&(l.valid=!1,i))break;!i&&(f(E,o.name)?A?kt(t.errors,E,o.name):x(t.errors,o.name,E[o.name]):R(t.errors,o.name))}!M(g)&&await P(g,i,l)}}return l.valid},ye=()=>{for(const r of h.unMount){const i=f(u,r);i&&(i._f.refs?i._f.refs.every(l=>!ke(l)):!ke(i._f.ref))&&me(r)}h.unMount=new Set},b=(r,i)=>(r&&i&&x(a,r,i),!Z(Me(),n)),F=(r,i,l)=>at(r,h,{...y.mount?a:w(i)?n:$(r)?{[r]:i}:i},l,i),C=r=>Ae(f(y.mount?a:n,r,e.shouldUnregister?f(n,r,[]):[])),U=(r,i,l={})=>{const d=f(u,r);let c=i;if(d){const o=d._f;o&&(!o.disabled&&x(a,r,yt(i,o)),c=_e(o.ref)&&O(i)?"":i,ft(o.ref)?[...o.ref.options].forEach(g=>g.selected=c.includes(g.value)):o.refs?ce(o.ref)?o.refs.length>1?o.refs.forEach(g=>(!g.defaultChecked||!g.disabled)&&(g.checked=Array.isArray(c)?!!c.find(A=>A===g.value):c===g.value)):o.refs[0]&&(o.refs[0].checked=!!c):o.refs.forEach(g=>g.checked=g.value===c):Oe(o.ref)?o.ref.value="":(o.ref.value=c,o.ref.type||v.values.next({name:r,values:{...a}})))}(l.shouldDirty||l.shouldTouch)&&ee(r,c,l.shouldTouch,l.shouldDirty,!0),l.shouldValidate&&ae(r)},q=(r,i,l)=>{for(const d in i){const c=i[d],o=`${r}.${d}`,g=f(u,o);(h.array.has(r)||!Ve(c)||g&&!g._f)&&!ie(c)?q(o,c,l):U(o,c,l)}},I=(r,i,l={})=>{const d=f(u,r),c=h.array.has(r),o=p(i);x(a,r,o),c?(v.array.next({name:r,values:{...a}}),(_.isDirty||_.dirtyFields)&&l.shouldDirty&&v.state.next({name:r,dirtyFields:ge(n,a),isDirty:b(r,o)})):d&&!d._f&&!O(o)?q(r,o,l):U(r,o,l),Ge(r,h)&&v.state.next({...t}),v.values.next({name:y.mount?r:void 0,values:{...a}})},ue=async r=>{y.mount=!0;const i=r.target;let l=i.name,d=!0;const c=f(u,l),o=()=>i.type?Ce(c._f):tt(r),g=A=>{d=Number.isNaN(A)||A===f(a,l,A)};if(c){let A,E;const B=o(),re=r.type===ve.BLUR||r.type===ve.FOCUS_OUT,bt=!Ut(c._f)&&!s.resolver&&!f(t.errors,l)&&!c._f.deps||Ot(re,f(t.touchedFields,l),t.isSubmitted,H,N),we=Ge(l,h,re);x(a,l,B),re?(c._f.onBlur&&c._f.onBlur(r),D&&D(0)):c._f.onChange&&c._f.onChange(r);const Ee=ee(l,B,re,!1),Vt=!M(Ee)||we;if(!re&&v.values.next({name:l,type:r.type,values:{...a}}),bt)return _.isValid&&J(),Vt&&v.state.next({name:l,...we?{}:Ee});if(!re&&we&&v.state.next({...t}),s.resolver){const{errors:je}=await Y([l]);if(g(B),d){const Ft=Ze(t.errors,u,l),$e=Ze(je,u,Ft.name||l);A=$e.error,l=$e.name,E=M(je)}}else Q([l],!0),A=(await Ye(c,a,L,s.shouldUseNativeValidation))[l],Q([l]),g(B),d&&(A?E=!1:_.isValid&&(E=await P(u,!0)));d&&(c._f.deps&&ae(c._f.deps),de(l,E,A,Ee))}},le=(r,i)=>{if(f(t.errors,i)&&r.focus)return r.focus(),1},ae=async(r,i={})=>{let l,d;const c=oe(r);if(s.resolver){const o=await te(w(r)?r:c);l=M(o),d=r?!c.some(g=>f(o,g)):l}else r?(d=(await Promise.all(c.map(async o=>{const g=f(u,o);return await P(g&&g._f?{[o]:g}:g)}))).every(Boolean),!(!d&&!t.isValid)&&J()):d=l=await P(u);return v.state.next({...!$(r)||_.isValid&&l!==t.isValid?{}:{name:r},...s.resolver||!r?{isValid:l}:{},errors:t.errors}),i.shouldFocus&&!d&&fe(u,le,r?c:h.mount),d},Me=r=>{const i={...y.mount?a:n};return w(r)?i:$(r)?f(i,r):r.map(l=>f(i,l))},Be=(r,i)=>({invalid:!!f((i||t).errors,r),isDirty:!!f((i||t).dirtyFields,r),error:f((i||t).errors,r),isValidating:!!f(t.validatingFields,r),isTouched:!!f((i||t).touchedFields,r)}),gt=r=>{r&&oe(r).forEach(i=>R(t.errors,i)),v.state.next({errors:r?t.errors:{}})},Pe=(r,i,l)=>{const d=(f(u,r,{_f:{}})._f||{}).ref,c=f(t.errors,r)||{},{ref:o,message:g,type:A,...E}=c;x(t.errors,r,{...E,...i,ref:d}),v.state.next({name:r,errors:t.errors,isValid:!1}),l&&l.shouldFocus&&d&&d.focus&&d.focus()},ht=(r,i)=>X(r)?v.values.subscribe({next:l=>r(F(void 0,i),l)}):F(r,i,!0),me=(r,i={})=>{for(const l of r?oe(r):h.mount)h.mount.delete(l),h.array.delete(l),i.keepValue||(R(u,l),R(a,l)),!i.keepError&&R(t.errors,l),!i.keepDirty&&R(t.dirtyFields,l),!i.keepTouched&&R(t.touchedFields,l),!i.keepIsValidating&&R(t.validatingFields,l),!s.shouldUnregister&&!i.keepDefaultValue&&R(n,l);v.values.next({values:{...a}}),v.state.next({...t,...i.keepDirty?{isDirty:b()}:{}}),!i.keepIsValid&&J()},Ie=({disabled:r,name:i,field:l,fields:d,value:c})=>{if(j(r)&&y.mount||r){const o=r?void 0:w(c)?Ce(l?l._f:f(d,i)._f):c;x(a,i,o),ee(i,o,!1,!1,!0)}},De=(r,i={})=>{let l=f(u,r);const d=j(i.disabled);return x(u,r,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:r}},name:r,mount:!0,...i}}),h.mount.add(r),l?Ie({field:l,disabled:i.disabled,name:r,value:i.value}):k(r,!0,i.value),{...d?{disabled:i.disabled}:{},...s.progressive?{required:!!i.required,min:ne(i.min),max:ne(i.max),minLength:ne(i.minLength),maxLength:ne(i.maxLength),pattern:ne(i.pattern)}:{},name:r,onChange:ue,onBlur:ue,ref:c=>{if(c){De(r,i),l=f(u,r);const o=w(c.value)&&c.querySelectorAll&&c.querySelectorAll("input,select,textarea")[0]||c,g=Tt(o),A=l._f.refs||[];if(g?A.find(E=>E===o):o===l._f.ref)return;x(u,r,{_f:{...l._f,...g?{refs:[...A.filter(ke),o,...Array.isArray(f(n,r))?[{}]:[]],ref:{type:o.type,name:r}}:{ref:o}}}),k(r,!1,void 0,o)}else l=f(u,r,{}),l._f&&(l._f.mount=!1),(s.shouldUnregister||i.shouldUnregister)&&!(rt(h.array,r)&&y.action)&&h.unMount.add(r)}}},Ne=()=>s.shouldFocusError&&fe(u,le,h.mount),vt=r=>{j(r)&&(v.state.next({disabled:r}),fe(u,(i,l)=>{const d=f(u,l);d&&(i.disabled=d._f.disabled||r,Array.isArray(d._f.refs)&&d._f.refs.forEach(c=>{c.disabled=d._f.disabled||r}))},0,!1))},qe=(r,i)=>async l=>{let d;l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let c=p(a);if(v.state.next({isSubmitting:!0}),s.resolver){const{errors:o,values:g}=await Y();t.errors=o,c=g}else await P(u);if(R(t.errors,"root"),M(t.errors)){v.state.next({errors:{}});try{await r(c,l)}catch(o){d=o}}else i&&await i({...t.errors},l),Ne(),setTimeout(Ne);if(v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:M(t.errors)&&!d,submitCount:t.submitCount+1,errors:t.errors}),d)throw d},_t=(r,i={})=>{f(u,r)&&(w(i.defaultValue)?I(r,p(f(n,r))):(I(r,i.defaultValue),x(n,r,p(i.defaultValue))),i.keepTouched||R(t.touchedFields,r),i.keepDirty||(R(t.dirtyFields,r),t.isDirty=i.defaultValue?b(r,p(f(n,r))):b()),i.keepError||(R(t.errors,r),_.isValid&&J()),v.state.next({...t}))},We=(r,i={})=>{const l=r?p(r):n,d=p(l),c=M(r),o=c?n:d;if(i.keepDefaultValues||(n=l),!i.keepValues){if(i.keepDirtyValues)for(const g of h.mount)f(t.dirtyFields,g)?x(o,g,f(a,g)):I(g,f(o,g));else{if(Re&&w(r))for(const g of h.mount){const A=f(u,g);if(A&&A._f){const E=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;if(_e(E)){const B=E.closest("form");if(B){B.reset();break}}}}u={}}a=e.shouldUnregister?i.keepDefaultValues?p(n):{}:p(o),v.array.next({values:{...o}}),v.values.next({values:{...o}})}h={mount:i.keepDirtyValues?h.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},y.mount=!_.isValid||!!i.keepIsValid||!!i.keepDirtyValues,y.watch=!!e.shouldUnregister,v.state.next({submitCount:i.keepSubmitCount?t.submitCount:0,isDirty:c?!1:i.keepDirty?t.isDirty:!!(i.keepDefaultValues&&!Z(r,n)),isSubmitted:i.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:c?{}:i.keepDirtyValues?i.keepDefaultValues&&a?ge(n,a):t.dirtyFields:i.keepDefaultValues&&r?ge(n,r):i.keepDirty?t.dirtyFields:{},touchedFields:i.keepTouched?t.touchedFields:{},errors:i.keepErrors?t.errors:{},isSubmitSuccessful:i.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},He=(r,i)=>We(X(r)?r(a):r,i);return{control:{register:De,unregister:me,getFieldState:Be,handleSubmit:qe,setError:Pe,_executeSchema:Y,_getWatch:F,_getDirty:b,_updateValid:J,_removeUnmounted:ye,_updateFieldArray:V,_updateDisabledField:Ie,_getFieldArray:C,_reset:We,_resetDefaultValues:()=>X(s.defaultValues)&&s.defaultValues().then(r=>{He(r,s.resetOptions),v.state.next({isLoading:!1})}),_updateFormState:r=>{t={...t,...r}},_disableForm:vt,_subjects:v,_proxyFormState:_,_setErrors:G,get _fields(){return u},get _formValues(){return a},get _state(){return y},set _state(r){y=r},get _defaultValues(){return n},get _names(){return h},set _names(r){h=r},get _formState(){return t},set _formState(r){t=r},get _options(){return s},set _options(r){s={...s,...r}}},trigger:ae,register:De,handleSubmit:qe,watch:ht,setValue:I,getValues:Me,reset:He,resetField:_t,clearErrors:gt,unregister:me,setError:Pe,setFocus:(r,i={})=>{const l=f(u,r),d=l&&l._f;if(d){const c=d.refs?d.refs[0]:d.ref;c.focus&&(c.focus(),i.shouldSelect&&c.select())}},getFieldState:Be}}function Ht(e={}){const s=m.useRef(),t=m.useRef(),[u,n]=m.useState({isDirty:!1,isValidating:!1,isLoading:X(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:X(e.defaultValues)?void 0:e.defaultValues});s.current||(s.current={...Bt(e),formState:u});const a=s.current.control;return a._options=e,Ue({subject:a._subjects.state,next:y=>{ut(y,a._proxyFormState,a._updateFormState,!0)&&n({...a._formState})}}),m.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),m.useEffect(()=>{if(a._proxyFormState.isDirty){const y=a._getDirty();y!==u.isDirty&&a._subjects.state.next({isDirty:y})}},[a,u.isDirty]),m.useEffect(()=>{e.values&&!Z(e.values,t.current)?(a._reset(e.values,a._options.resetOptions),t.current=e.values,n(y=>({...y}))):a._resetDefaultValues()},[e.values,a]),m.useEffect(()=>{e.errors&&a._setErrors(e.errors)},[e.errors,a]),m.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),m.useEffect(()=>{e.shouldUnregister&&a._subjects.values.next({values:a._getWatch()})},[e.shouldUnregister,a]),s.current.formState=it(u,a),s.current}export{Wt as C,wt as a,Ht as u};
|
|
1
|
+
import{bb as m}from"./index-BHdqgom8.js";var ce=e=>e.type==="checkbox",ie=e=>e instanceof Date,O=e=>e==null;const et=e=>typeof e=="object";var T=e=>!O(e)&&!Array.isArray(e)&&et(e)&&!ie(e),tt=e=>T(e)&&e.target?ce(e.target)?e.target.checked:e.target.value:e,At=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,rt=(e,s)=>e.has(At(s)),xt=e=>{const s=e.constructor&&e.constructor.prototype;return T(s)&&s.hasOwnProperty("isPrototypeOf")},Re=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function p(e){let s;const t=Array.isArray(e);if(e instanceof Date)s=new Date(e);else if(e instanceof Set)s=new Set(e);else if(!(Re&&(e instanceof Blob||e instanceof FileList))&&(t||T(e)))if(s=t?[]:{},!t&&!xt(e))s=e;else for(const u in e)e.hasOwnProperty(u)&&(s[u]=p(e[u]));else return e;return s}var Ae=e=>Array.isArray(e)?e.filter(Boolean):[],w=e=>e===void 0,f=(e,s,t)=>{if(!s||!T(e))return t;const u=Ae(s.split(/[,[\].]+?/)).reduce((n,a)=>O(n)?n:n[a],e);return w(u)||u===e?w(e[s])?t:e[s]:u},j=e=>typeof e=="boolean",Te=e=>/^\w*$/.test(e),st=e=>Ae(e.replace(/["|']|\]/g,"").split(/\.|\[/)),x=(e,s,t)=>{let u=-1;const n=Te(s)?[s]:st(s),a=n.length,y=a-1;for(;++u<a;){const h=n[u];let D=t;if(u!==y){const S=e[h];D=T(S)||Array.isArray(S)?S:isNaN(+n[u+1])?{}:[]}if(h==="__proto__")return;e[h]=D,e=e[h]}return e};const ve={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},W={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},z={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},mt=m.createContext(null),Le=()=>m.useContext(mt);var it=(e,s,t,u=!0)=>{const n={defaultValues:s._defaultValues};for(const a in e)Object.defineProperty(n,a,{get:()=>{const y=a;return s._proxyFormState[y]!==W.all&&(s._proxyFormState[y]=!u||W.all),t&&(t[y]=!0),e[y]}});return n},M=e=>T(e)&&!Object.keys(e).length,ut=(e,s,t,u)=>{t(e);const{name:n,...a}=e;return M(a)||Object.keys(a).length>=Object.keys(s).length||Object.keys(a).find(y=>s[y]===(!u||W.all))},oe=e=>Array.isArray(e)?e:[e],lt=(e,s,t)=>!e||!s||e===s||oe(e).some(u=>u&&(t?u===s:u.startsWith(s)||s.startsWith(u)));function Ue(e){const s=m.useRef(e);s.current=e,m.useEffect(()=>{const t=!e.disabled&&s.current.subject&&s.current.subject.subscribe({next:s.current.next});return()=>{t&&t.unsubscribe()}},[e.disabled])}function Dt(e){const s=Le(),{control:t=s.control,disabled:u,name:n,exact:a}=e||{},[y,h]=m.useState(t._formState),D=m.useRef(!0),S=m.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),_=m.useRef(n);return _.current=n,Ue({disabled:u,next:v=>D.current&<(_.current,v.name,a)&&ut(v,S.current,t._updateFormState)&&h({...t._formState,...v}),subject:t._subjects.state}),m.useEffect(()=>(D.current=!0,S.current.isValid&&t._updateValid(!0),()=>{D.current=!1}),[t]),it(y,t,S.current,!1)}var $=e=>typeof e=="string",at=(e,s,t,u,n)=>$(e)?(u&&s.watch.add(e),f(t,e,n)):Array.isArray(e)?e.map(a=>(u&&s.watch.add(a),f(t,a))):(u&&(s.watchAll=!0),t);function wt(e){const s=Le(),{control:t=s.control,name:u,defaultValue:n,disabled:a,exact:y}=e||{},h=m.useRef(u);h.current=u,Ue({disabled:a,subject:t._subjects.values,next:_=>{lt(h.current,_.name,y)&&S(p(at(h.current,t._names,_.values||t._formValues,!1,n)))}});const[D,S]=m.useState(t._getWatch(u,n));return m.useEffect(()=>t._removeUnmounted()),D}function Et(e){const s=Le(),{name:t,disabled:u,control:n=s.control,shouldUnregister:a}=e,y=rt(n._names.array,t),h=wt({control:n,name:t,defaultValue:f(n._formValues,t,f(n._defaultValues,t,e.defaultValue)),exact:!0}),D=Dt({control:n,name:t,exact:!0}),S=m.useRef(n.register(t,{...e.rules,value:h,...j(e.disabled)?{disabled:e.disabled}:{}}));return m.useEffect(()=>{const _=n._options.shouldUnregister||a,v=(N,H)=>{const L=f(n._fields,N);L&&L._f&&(L._f.mount=H)};if(v(t,!0),_){const N=p(f(n._options.defaultValues,t));x(n._defaultValues,t,N),w(f(n._formValues,t))&&x(n._formValues,t,N)}return()=>{(y?_&&!n._state.action:_)?n.unregister(t):v(t,!1)}},[t,n,y,a]),m.useEffect(()=>{f(n._fields,t)&&n._updateDisabledField({disabled:u,fields:n._fields,name:t,value:f(n._fields,t)._f.value})},[u,t,n]),{field:{name:t,value:h,...j(u)||D.disabled?{disabled:D.disabled||u}:{},onChange:m.useCallback(_=>S.current.onChange({target:{value:tt(_),name:t},type:ve.CHANGE}),[t]),onBlur:m.useCallback(()=>S.current.onBlur({target:{value:f(n._formValues,t),name:t},type:ve.BLUR}),[t,n]),ref:m.useCallback(_=>{const v=f(n._fields,t);v&&_&&(v._f.ref={focus:()=>_.focus(),select:()=>_.select(),setCustomValidity:N=>_.setCustomValidity(N),reportValidity:()=>_.reportValidity()})},[n._fields,t])},formState:D,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!f(D.errors,t)},isDirty:{enumerable:!0,get:()=>!!f(D.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!f(D.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!f(D.validatingFields,t)},error:{enumerable:!0,get:()=>f(D.errors,t)}})}}const Wt=e=>e.render(Et(e));var St=(e,s,t,u,n)=>s?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[u]:n||!0}}:{},Ke=e=>({isOnSubmit:!e||e===W.onSubmit,isOnBlur:e===W.onBlur,isOnChange:e===W.onChange,isOnAll:e===W.all,isOnTouch:e===W.onTouched}),Ge=(e,s,t)=>!t&&(s.watchAll||s.watch.has(e)||[...s.watch].some(u=>e.startsWith(u)&&/^\.\w+/.test(e.slice(u.length))));const fe=(e,s,t,u)=>{for(const n of t||Object.keys(e)){const a=f(e,n);if(a){const{_f:y,...h}=a;if(y){if(y.refs&&y.refs[0]&&s(y.refs[0],n)&&!u)break;if(y.ref&&s(y.ref,y.name)&&!u)break;fe(h,s)}else T(h)&&fe(h,s)}}};var kt=(e,s,t)=>{const u=oe(f(e,t));return x(u,"root",s[t]),x(e,t,u),e},Oe=e=>e.type==="file",X=e=>typeof e=="function",_e=e=>{if(!Re)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},he=e=>$(e),pe=e=>e.type==="radio",be=e=>e instanceof RegExp;const ze={value:!1,isValid:!1},Je={value:!0,isValid:!0};var nt=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!w(e[0].attributes.value)?w(e[0].value)||e[0].value===""?Je:{value:e[0].value,isValid:!0}:Je:ze}return ze};const Qe={isValid:!1,value:null};var ot=e=>Array.isArray(e)?e.reduce((s,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:s,Qe):Qe;function Xe(e,s,t="validate"){if(he(e)||Array.isArray(e)&&e.every(he)||j(e)&&!e)return{type:t,message:he(e)?e:"",ref:s}}var se=e=>T(e)&&!be(e)?e:{value:e,message:""},Ye=async(e,s,t,u,n)=>{const{ref:a,refs:y,required:h,maxLength:D,minLength:S,min:_,max:v,pattern:N,validate:H,name:L,valueAsNumber:xe,mount:J,disabled:Q}=e._f,V=f(s,L);if(!J||Q)return{};const K=y?y[0]:a,G=b=>{u&&K.reportValidity&&(K.setCustomValidity(j(b)?"":b||""),K.reportValidity())},k={},ee=pe(a),de=ce(a),Y=ee||de,te=(xe||Oe(a))&&w(a.value)&&w(V)||_e(a)&&a.value===""||V===""||Array.isArray(V)&&!V.length,P=St.bind(null,L,t,k),ye=(b,F,C,U=z.maxLength,q=z.minLength)=>{const I=b?F:C;k[L]={type:b?U:q,message:I,ref:a,...P(b?U:q,I)}};if(n?!Array.isArray(V)||!V.length:h&&(!Y&&(te||O(V))||j(V)&&!V||de&&!nt(y).isValid||ee&&!ot(y).isValid)){const{value:b,message:F}=he(h)?{value:!!h,message:h}:se(h);if(b&&(k[L]={type:z.required,message:F,ref:K,...P(z.required,F)},!t))return G(F),k}if(!te&&(!O(_)||!O(v))){let b,F;const C=se(v),U=se(_);if(!O(V)&&!isNaN(V)){const q=a.valueAsNumber||V&&+V;O(C.value)||(b=q>C.value),O(U.value)||(F=q<U.value)}else{const q=a.valueAsDate||new Date(V),I=ae=>new Date(new Date().toDateString()+" "+ae),ue=a.type=="time",le=a.type=="week";$(C.value)&&V&&(b=ue?I(V)>I(C.value):le?V>C.value:q>new Date(C.value)),$(U.value)&&V&&(F=ue?I(V)<I(U.value):le?V<U.value:q<new Date(U.value))}if((b||F)&&(ye(!!b,C.message,U.message,z.max,z.min),!t))return G(k[L].message),k}if((D||S)&&!te&&($(V)||n&&Array.isArray(V))){const b=se(D),F=se(S),C=!O(b.value)&&V.length>+b.value,U=!O(F.value)&&V.length<+F.value;if((C||U)&&(ye(C,b.message,F.message),!t))return G(k[L].message),k}if(N&&!te&&$(V)){const{value:b,message:F}=se(N);if(be(b)&&!V.match(b)&&(k[L]={type:z.pattern,message:F,ref:a,...P(z.pattern,F)},!t))return G(F),k}if(H){if(X(H)){const b=await H(V,s),F=Xe(b,K);if(F&&(k[L]={...F,...P(z.validate,F.message)},!t))return G(F.message),k}else if(T(H)){let b={};for(const F in H){if(!M(b)&&!t)break;const C=Xe(await H[F](V,s),K,F);C&&(b={...C,...P(F,C.message)},G(C.message),t&&(k[L]=b))}if(!M(b)&&(k[L]={ref:K,...b},!t))return k}}return G(!0),k};function Ct(e,s){const t=s.slice(0,-1).length;let u=0;for(;u<t;)e=w(e)?u++:e[s[u++]];return e}function Rt(e){for(const s in e)if(e.hasOwnProperty(s)&&!w(e[s]))return!1;return!0}function R(e,s){const t=Array.isArray(s)?s:Te(s)?[s]:st(s),u=t.length===1?e:Ct(e,t),n=t.length-1,a=t[n];return u&&delete u[a],n!==0&&(T(u)&&M(u)||Array.isArray(u)&&Rt(u))&&R(e,t.slice(0,-1)),e}var Se=()=>{let e=[];return{get observers(){return e},next:n=>{for(const a of e)a.next&&a.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(a=>a!==n)}}),unsubscribe:()=>{e=[]}}},Ve=e=>O(e)||!et(e);function Z(e,s){if(Ve(e)||Ve(s))return e===s;if(ie(e)&&ie(s))return e.getTime()===s.getTime();const t=Object.keys(e),u=Object.keys(s);if(t.length!==u.length)return!1;for(const n of t){const a=e[n];if(!u.includes(n))return!1;if(n!=="ref"){const y=s[n];if(ie(a)&&ie(y)||T(a)&&T(y)||Array.isArray(a)&&Array.isArray(y)?!Z(a,y):a!==y)return!1}}return!0}var ft=e=>e.type==="select-multiple",Tt=e=>pe(e)||ce(e),ke=e=>_e(e)&&e.isConnected,ct=e=>{for(const s in e)if(X(e[s]))return!0;return!1};function Fe(e,s={}){const t=Array.isArray(e);if(T(e)||t)for(const u in e)Array.isArray(e[u])||T(e[u])&&!ct(e[u])?(s[u]=Array.isArray(e[u])?[]:{},Fe(e[u],s[u])):O(e[u])||(s[u]=!0);return s}function dt(e,s,t){const u=Array.isArray(e);if(T(e)||u)for(const n in e)Array.isArray(e[n])||T(e[n])&&!ct(e[n])?w(s)||Ve(t[n])?t[n]=Array.isArray(e[n])?Fe(e[n],[]):{...Fe(e[n])}:dt(e[n],O(s)?{}:s[n],t[n]):t[n]=!Z(e[n],s[n]);return t}var ge=(e,s)=>dt(e,s,Fe(s)),yt=(e,{valueAsNumber:s,valueAsDate:t,setValueAs:u})=>w(e)?e:s?e===""?NaN:e&&+e:t&&$(e)?new Date(e):u?u(e):e;function Ce(e){const s=e.ref;if(!(e.refs?e.refs.every(t=>t.disabled):s.disabled))return Oe(s)?s.files:pe(s)?ot(e.refs).value:ft(s)?[...s.selectedOptions].map(({value:t})=>t):ce(s)?nt(e.refs).value:yt(w(s.value)?e.ref.value:s.value,e)}var Lt=(e,s,t,u)=>{const n={};for(const a of e){const y=f(s,a);y&&x(n,a,y._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:u}},ne=e=>w(e)?e:be(e)?e.source:T(e)?be(e.value)?e.value.source:e.value:e,Ut=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Ze(e,s,t){const u=f(e,t);if(u||Te(t))return{error:u,name:t};const n=t.split(".");for(;n.length;){const a=n.join("."),y=f(s,a),h=f(e,a);if(y&&!Array.isArray(y)&&t!==a)return{name:t};if(h&&h.type)return{name:a,error:h};n.pop()}return{name:t}}var Ot=(e,s,t,u,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(s||e):(t?u.isOnBlur:n.isOnBlur)?!e:(t?u.isOnChange:n.isOnChange)?e:!0,pt=(e,s)=>!Ae(f(e,s)).length&&R(e,s);const Mt={mode:W.onSubmit,reValidateMode:W.onChange,shouldFocusError:!0};function Bt(e={}){let s={...Mt,...e},t={submitCount:0,isDirty:!1,isLoading:X(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},u={},n=T(s.defaultValues)||T(s.values)?p(s.defaultValues||s.values)||{}:{},a=s.shouldUnregister?{}:p(n),y={action:!1,mount:!1,watch:!1},h={mount:new Set,unMount:new Set,array:new Set,watch:new Set},D,S=0;const _={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={values:Se(),array:Se(),state:Se()},N=Ke(s.mode),H=Ke(s.reValidateMode),L=s.criteriaMode===W.all,xe=r=>i=>{clearTimeout(S),S=setTimeout(r,i)},J=async r=>{if(_.isValid||r){const i=s.resolver?M((await Y()).errors):await P(u,!0);i!==t.isValid&&v.state.next({isValid:i})}},Q=(r,i)=>{(_.isValidating||_.validatingFields)&&((r||Array.from(h.mount)).forEach(l=>{l&&(i?x(t.validatingFields,l,i):R(t.validatingFields,l))}),v.state.next({validatingFields:t.validatingFields,isValidating:!M(t.validatingFields)}))},V=(r,i=[],l,d,c=!0,o=!0)=>{if(d&&l){if(y.action=!0,o&&Array.isArray(f(u,r))){const g=l(f(u,r),d.argA,d.argB);c&&x(u,r,g)}if(o&&Array.isArray(f(t.errors,r))){const g=l(f(t.errors,r),d.argA,d.argB);c&&x(t.errors,r,g),pt(t.errors,r)}if(_.touchedFields&&o&&Array.isArray(f(t.touchedFields,r))){const g=l(f(t.touchedFields,r),d.argA,d.argB);c&&x(t.touchedFields,r,g)}_.dirtyFields&&(t.dirtyFields=ge(n,a)),v.state.next({name:r,isDirty:b(r,i),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else x(a,r,i)},K=(r,i)=>{x(t.errors,r,i),v.state.next({errors:t.errors})},G=r=>{t.errors=r,v.state.next({errors:t.errors,isValid:!1})},k=(r,i,l,d)=>{const c=f(u,r);if(c){const o=f(a,r,w(l)?f(n,r):l);w(o)||d&&d.defaultChecked||i?x(a,r,i?o:Ce(c._f)):U(r,o),y.mount&&J()}},ee=(r,i,l,d,c)=>{let o=!1,g=!1;const A={name:r},E=!!(f(u,r)&&f(u,r)._f&&f(u,r)._f.disabled);if(!l||d){_.isDirty&&(g=t.isDirty,t.isDirty=A.isDirty=b(),o=g!==A.isDirty);const B=E||Z(f(n,r),i);g=!!(!E&&f(t.dirtyFields,r)),B||E?R(t.dirtyFields,r):x(t.dirtyFields,r,!0),A.dirtyFields=t.dirtyFields,o=o||_.dirtyFields&&g!==!B}if(l){const B=f(t.touchedFields,r);B||(x(t.touchedFields,r,l),A.touchedFields=t.touchedFields,o=o||_.touchedFields&&B!==l)}return o&&c&&v.state.next(A),o?A:{}},de=(r,i,l,d)=>{const c=f(t.errors,r),o=_.isValid&&j(i)&&t.isValid!==i;if(e.delayError&&l?(D=xe(()=>K(r,l)),D(e.delayError)):(clearTimeout(S),D=null,l?x(t.errors,r,l):R(t.errors,r)),(l?!Z(c,l):c)||!M(d)||o){const g={...d,...o&&j(i)?{isValid:i}:{},errors:t.errors,name:r};t={...t,...g},v.state.next(g)}},Y=async r=>{Q(r,!0);const i=await s.resolver(a,s.context,Lt(r||h.mount,u,s.criteriaMode,s.shouldUseNativeValidation));return Q(r),i},te=async r=>{const{errors:i}=await Y(r);if(r)for(const l of r){const d=f(i,l);d?x(t.errors,l,d):R(t.errors,l)}else t.errors=i;return i},P=async(r,i,l={valid:!0})=>{for(const d in r){const c=r[d];if(c){const{_f:o,...g}=c;if(o){const A=h.array.has(o.name);Q([d],!0);const E=await Ye(c,a,L,s.shouldUseNativeValidation&&!i,A);if(Q([d]),E[o.name]&&(l.valid=!1,i))break;!i&&(f(E,o.name)?A?kt(t.errors,E,o.name):x(t.errors,o.name,E[o.name]):R(t.errors,o.name))}!M(g)&&await P(g,i,l)}}return l.valid},ye=()=>{for(const r of h.unMount){const i=f(u,r);i&&(i._f.refs?i._f.refs.every(l=>!ke(l)):!ke(i._f.ref))&&me(r)}h.unMount=new Set},b=(r,i)=>(r&&i&&x(a,r,i),!Z(Me(),n)),F=(r,i,l)=>at(r,h,{...y.mount?a:w(i)?n:$(r)?{[r]:i}:i},l,i),C=r=>Ae(f(y.mount?a:n,r,e.shouldUnregister?f(n,r,[]):[])),U=(r,i,l={})=>{const d=f(u,r);let c=i;if(d){const o=d._f;o&&(!o.disabled&&x(a,r,yt(i,o)),c=_e(o.ref)&&O(i)?"":i,ft(o.ref)?[...o.ref.options].forEach(g=>g.selected=c.includes(g.value)):o.refs?ce(o.ref)?o.refs.length>1?o.refs.forEach(g=>(!g.defaultChecked||!g.disabled)&&(g.checked=Array.isArray(c)?!!c.find(A=>A===g.value):c===g.value)):o.refs[0]&&(o.refs[0].checked=!!c):o.refs.forEach(g=>g.checked=g.value===c):Oe(o.ref)?o.ref.value="":(o.ref.value=c,o.ref.type||v.values.next({name:r,values:{...a}})))}(l.shouldDirty||l.shouldTouch)&&ee(r,c,l.shouldTouch,l.shouldDirty,!0),l.shouldValidate&&ae(r)},q=(r,i,l)=>{for(const d in i){const c=i[d],o=`${r}.${d}`,g=f(u,o);(h.array.has(r)||!Ve(c)||g&&!g._f)&&!ie(c)?q(o,c,l):U(o,c,l)}},I=(r,i,l={})=>{const d=f(u,r),c=h.array.has(r),o=p(i);x(a,r,o),c?(v.array.next({name:r,values:{...a}}),(_.isDirty||_.dirtyFields)&&l.shouldDirty&&v.state.next({name:r,dirtyFields:ge(n,a),isDirty:b(r,o)})):d&&!d._f&&!O(o)?q(r,o,l):U(r,o,l),Ge(r,h)&&v.state.next({...t}),v.values.next({name:y.mount?r:void 0,values:{...a}})},ue=async r=>{y.mount=!0;const i=r.target;let l=i.name,d=!0;const c=f(u,l),o=()=>i.type?Ce(c._f):tt(r),g=A=>{d=Number.isNaN(A)||A===f(a,l,A)};if(c){let A,E;const B=o(),re=r.type===ve.BLUR||r.type===ve.FOCUS_OUT,bt=!Ut(c._f)&&!s.resolver&&!f(t.errors,l)&&!c._f.deps||Ot(re,f(t.touchedFields,l),t.isSubmitted,H,N),we=Ge(l,h,re);x(a,l,B),re?(c._f.onBlur&&c._f.onBlur(r),D&&D(0)):c._f.onChange&&c._f.onChange(r);const Ee=ee(l,B,re,!1),Vt=!M(Ee)||we;if(!re&&v.values.next({name:l,type:r.type,values:{...a}}),bt)return _.isValid&&J(),Vt&&v.state.next({name:l,...we?{}:Ee});if(!re&&we&&v.state.next({...t}),s.resolver){const{errors:je}=await Y([l]);if(g(B),d){const Ft=Ze(t.errors,u,l),$e=Ze(je,u,Ft.name||l);A=$e.error,l=$e.name,E=M(je)}}else Q([l],!0),A=(await Ye(c,a,L,s.shouldUseNativeValidation))[l],Q([l]),g(B),d&&(A?E=!1:_.isValid&&(E=await P(u,!0)));d&&(c._f.deps&&ae(c._f.deps),de(l,E,A,Ee))}},le=(r,i)=>{if(f(t.errors,i)&&r.focus)return r.focus(),1},ae=async(r,i={})=>{let l,d;const c=oe(r);if(s.resolver){const o=await te(w(r)?r:c);l=M(o),d=r?!c.some(g=>f(o,g)):l}else r?(d=(await Promise.all(c.map(async o=>{const g=f(u,o);return await P(g&&g._f?{[o]:g}:g)}))).every(Boolean),!(!d&&!t.isValid)&&J()):d=l=await P(u);return v.state.next({...!$(r)||_.isValid&&l!==t.isValid?{}:{name:r},...s.resolver||!r?{isValid:l}:{},errors:t.errors}),i.shouldFocus&&!d&&fe(u,le,r?c:h.mount),d},Me=r=>{const i={...y.mount?a:n};return w(r)?i:$(r)?f(i,r):r.map(l=>f(i,l))},Be=(r,i)=>({invalid:!!f((i||t).errors,r),isDirty:!!f((i||t).dirtyFields,r),error:f((i||t).errors,r),isValidating:!!f(t.validatingFields,r),isTouched:!!f((i||t).touchedFields,r)}),gt=r=>{r&&oe(r).forEach(i=>R(t.errors,i)),v.state.next({errors:r?t.errors:{}})},Pe=(r,i,l)=>{const d=(f(u,r,{_f:{}})._f||{}).ref,c=f(t.errors,r)||{},{ref:o,message:g,type:A,...E}=c;x(t.errors,r,{...E,...i,ref:d}),v.state.next({name:r,errors:t.errors,isValid:!1}),l&&l.shouldFocus&&d&&d.focus&&d.focus()},ht=(r,i)=>X(r)?v.values.subscribe({next:l=>r(F(void 0,i),l)}):F(r,i,!0),me=(r,i={})=>{for(const l of r?oe(r):h.mount)h.mount.delete(l),h.array.delete(l),i.keepValue||(R(u,l),R(a,l)),!i.keepError&&R(t.errors,l),!i.keepDirty&&R(t.dirtyFields,l),!i.keepTouched&&R(t.touchedFields,l),!i.keepIsValidating&&R(t.validatingFields,l),!s.shouldUnregister&&!i.keepDefaultValue&&R(n,l);v.values.next({values:{...a}}),v.state.next({...t,...i.keepDirty?{isDirty:b()}:{}}),!i.keepIsValid&&J()},Ie=({disabled:r,name:i,field:l,fields:d,value:c})=>{if(j(r)&&y.mount||r){const o=r?void 0:w(c)?Ce(l?l._f:f(d,i)._f):c;x(a,i,o),ee(i,o,!1,!1,!0)}},De=(r,i={})=>{let l=f(u,r);const d=j(i.disabled);return x(u,r,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:r}},name:r,mount:!0,...i}}),h.mount.add(r),l?Ie({field:l,disabled:i.disabled,name:r,value:i.value}):k(r,!0,i.value),{...d?{disabled:i.disabled}:{},...s.progressive?{required:!!i.required,min:ne(i.min),max:ne(i.max),minLength:ne(i.minLength),maxLength:ne(i.maxLength),pattern:ne(i.pattern)}:{},name:r,onChange:ue,onBlur:ue,ref:c=>{if(c){De(r,i),l=f(u,r);const o=w(c.value)&&c.querySelectorAll&&c.querySelectorAll("input,select,textarea")[0]||c,g=Tt(o),A=l._f.refs||[];if(g?A.find(E=>E===o):o===l._f.ref)return;x(u,r,{_f:{...l._f,...g?{refs:[...A.filter(ke),o,...Array.isArray(f(n,r))?[{}]:[]],ref:{type:o.type,name:r}}:{ref:o}}}),k(r,!1,void 0,o)}else l=f(u,r,{}),l._f&&(l._f.mount=!1),(s.shouldUnregister||i.shouldUnregister)&&!(rt(h.array,r)&&y.action)&&h.unMount.add(r)}}},Ne=()=>s.shouldFocusError&&fe(u,le,h.mount),vt=r=>{j(r)&&(v.state.next({disabled:r}),fe(u,(i,l)=>{const d=f(u,l);d&&(i.disabled=d._f.disabled||r,Array.isArray(d._f.refs)&&d._f.refs.forEach(c=>{c.disabled=d._f.disabled||r}))},0,!1))},qe=(r,i)=>async l=>{let d;l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let c=p(a);if(v.state.next({isSubmitting:!0}),s.resolver){const{errors:o,values:g}=await Y();t.errors=o,c=g}else await P(u);if(R(t.errors,"root"),M(t.errors)){v.state.next({errors:{}});try{await r(c,l)}catch(o){d=o}}else i&&await i({...t.errors},l),Ne(),setTimeout(Ne);if(v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:M(t.errors)&&!d,submitCount:t.submitCount+1,errors:t.errors}),d)throw d},_t=(r,i={})=>{f(u,r)&&(w(i.defaultValue)?I(r,p(f(n,r))):(I(r,i.defaultValue),x(n,r,p(i.defaultValue))),i.keepTouched||R(t.touchedFields,r),i.keepDirty||(R(t.dirtyFields,r),t.isDirty=i.defaultValue?b(r,p(f(n,r))):b()),i.keepError||(R(t.errors,r),_.isValid&&J()),v.state.next({...t}))},We=(r,i={})=>{const l=r?p(r):n,d=p(l),c=M(r),o=c?n:d;if(i.keepDefaultValues||(n=l),!i.keepValues){if(i.keepDirtyValues)for(const g of h.mount)f(t.dirtyFields,g)?x(o,g,f(a,g)):I(g,f(o,g));else{if(Re&&w(r))for(const g of h.mount){const A=f(u,g);if(A&&A._f){const E=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;if(_e(E)){const B=E.closest("form");if(B){B.reset();break}}}}u={}}a=e.shouldUnregister?i.keepDefaultValues?p(n):{}:p(o),v.array.next({values:{...o}}),v.values.next({values:{...o}})}h={mount:i.keepDirtyValues?h.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},y.mount=!_.isValid||!!i.keepIsValid||!!i.keepDirtyValues,y.watch=!!e.shouldUnregister,v.state.next({submitCount:i.keepSubmitCount?t.submitCount:0,isDirty:c?!1:i.keepDirty?t.isDirty:!!(i.keepDefaultValues&&!Z(r,n)),isSubmitted:i.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:c?{}:i.keepDirtyValues?i.keepDefaultValues&&a?ge(n,a):t.dirtyFields:i.keepDefaultValues&&r?ge(n,r):i.keepDirty?t.dirtyFields:{},touchedFields:i.keepTouched?t.touchedFields:{},errors:i.keepErrors?t.errors:{},isSubmitSuccessful:i.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},He=(r,i)=>We(X(r)?r(a):r,i);return{control:{register:De,unregister:me,getFieldState:Be,handleSubmit:qe,setError:Pe,_executeSchema:Y,_getWatch:F,_getDirty:b,_updateValid:J,_removeUnmounted:ye,_updateFieldArray:V,_updateDisabledField:Ie,_getFieldArray:C,_reset:We,_resetDefaultValues:()=>X(s.defaultValues)&&s.defaultValues().then(r=>{He(r,s.resetOptions),v.state.next({isLoading:!1})}),_updateFormState:r=>{t={...t,...r}},_disableForm:vt,_subjects:v,_proxyFormState:_,_setErrors:G,get _fields(){return u},get _formValues(){return a},get _state(){return y},set _state(r){y=r},get _defaultValues(){return n},get _names(){return h},set _names(r){h=r},get _formState(){return t},set _formState(r){t=r},get _options(){return s},set _options(r){s={...s,...r}}},trigger:ae,register:De,handleSubmit:qe,watch:ht,setValue:I,getValues:Me,reset:He,resetField:_t,clearErrors:gt,unregister:me,setError:Pe,setFocus:(r,i={})=>{const l=f(u,r),d=l&&l._f;if(d){const c=d.refs?d.refs[0]:d.ref;c.focus&&(c.focus(),i.shouldSelect&&c.select())}},getFieldState:Be}}function Ht(e={}){const s=m.useRef(),t=m.useRef(),[u,n]=m.useState({isDirty:!1,isValidating:!1,isLoading:X(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:X(e.defaultValues)?void 0:e.defaultValues});s.current||(s.current={...Bt(e),formState:u});const a=s.current.control;return a._options=e,Ue({subject:a._subjects.state,next:y=>{ut(y,a._proxyFormState,a._updateFormState,!0)&&n({...a._formState})}}),m.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),m.useEffect(()=>{if(a._proxyFormState.isDirty){const y=a._getDirty();y!==u.isDirty&&a._subjects.state.next({isDirty:y})}},[a,u.isDirty]),m.useEffect(()=>{e.values&&!Z(e.values,t.current)?(a._reset(e.values,a._options.resetOptions),t.current=e.values,n(y=>({...y}))):a._resetDefaultValues()},[e.values,a]),m.useEffect(()=>{e.errors&&a._setErrors(e.errors)},[e.errors,a]),m.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),m.useEffect(()=>{e.shouldUnregister&&a._subjects.values.next({values:a._getWatch()})},[e.shouldUnregister,a]),s.current.formState=it(u,a),s.current}export{Wt as C,wt as a,Ht as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as i}from"./codemirror.es-
|
|
1
|
+
import{C as i}from"./codemirror.es-BSwJ_jke.js";import"./index-f7aL1bUo.js";import"./index-BHdqgom8.js";var y=Object.defineProperty,u=(e,t)=>y(e,"name",{value:t,configurable:!0});i.defineOption("info",!1,(e,t,n)=>{if(n&&n!==i.Init){const o=e.state.info.onMouseOver;i.off(e.getWrapperElement(),"mouseover",o),clearTimeout(e.state.info.hoverTimeout),delete e.state.info}if(t){const o=e.state.info=v(t);o.onMouseOver=h.bind(null,e),i.on(e.getWrapperElement(),"mouseover",o.onMouseOver)}});function v(e){return{options:e instanceof Function?{render:e}:e===!0?{}:e}}u(v,"createState");function g(e){const t=e.state.info.options;return(t==null?void 0:t.hoverTime)||500}u(g,"getHoverTime");function h(e,t){const n=e.state.info,o=t.target||t.srcElement;if(!(o instanceof HTMLElement)||o.nodeName!=="SPAN"||n.hoverTimeout!==void 0)return;const s=o.getBoundingClientRect(),r=u(function(){clearTimeout(n.hoverTimeout),n.hoverTimeout=setTimeout(f,a)},"onMouseMove"),p=u(function(){i.off(document,"mousemove",r),i.off(e.getWrapperElement(),"mouseout",p),clearTimeout(n.hoverTimeout),n.hoverTimeout=void 0},"onMouseOut"),f=u(function(){i.off(document,"mousemove",r),i.off(e.getWrapperElement(),"mouseout",p),n.hoverTimeout=void 0,T(e,s)},"onHover"),a=g(e);n.hoverTimeout=setTimeout(f,a),i.on(document,"mousemove",r),i.on(e.getWrapperElement(),"mouseout",p)}u(h,"onMouseOver");function T(e,t){const n=e.coordsChar({left:(t.left+t.right)/2,top:(t.top+t.bottom)/2}),s=e.state.info.options,r=s.render||e.getHelper(n,"info");if(r){const p=e.getTokenAt(n,!0);if(p){const f=r(p,s,e,n);f&&M(e,t,f)}}}u(T,"onMouseHover");function M(e,t,n){const o=document.createElement("div");o.className="CodeMirror-info",o.appendChild(n),document.body.appendChild(o);const s=o.getBoundingClientRect(),r=window.getComputedStyle(o),p=s.right-s.left+parseFloat(r.marginLeft)+parseFloat(r.marginRight),f=s.bottom-s.top+parseFloat(r.marginTop)+parseFloat(r.marginBottom);let a=t.bottom;f>window.innerHeight-t.bottom-15&&t.top>window.innerHeight-t.bottom&&(a=t.top-f),a<0&&(a=t.bottom);let l=Math.max(0,window.innerWidth-p-15);l>t.left&&(l=t.left),o.style.opacity="1",o.style.top=a+"px",o.style.left=l+"px";let d;const c=u(function(){clearTimeout(d)},"onMouseOverPopup"),m=u(function(){clearTimeout(d),d=setTimeout(O,200)},"onMouseOut"),O=u(function(){i.off(o,"mouseover",c),i.off(o,"mouseout",m),i.off(e.getWrapperElement(),"mouseout",m),o.style.opacity?(o.style.opacity="0",setTimeout(()=>{o.parentNode&&o.parentNode.removeChild(o)},600)):o.parentNode&&o.parentNode.removeChild(o)},"hidePopup");i.on(o,"mouseover",c),i.on(o,"mouseout",m),i.on(e.getWrapperElement(),"mouseout",m)}u(M,"showPopup");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as h}from"./codemirror.es-
|
|
1
|
+
import{C as h}from"./codemirror.es-BSwJ_jke.js";import{g as E,a as C,b as N,c as _,d as V,e as x}from"./SchemaReference.es-DknvTEzi.js";import"./info-addon.es-BC4uTAVC.js";import{Y as A,r as F}from"./index-f7aL1bUo.js";import"./index-BHdqgom8.js";import"./introspection.es-CPJcz6nz.js";import"./forEachState.es-D8bf0zSr.js";var L=Object.defineProperty,l=(r,e)=>L(r,"name",{value:e,configurable:!0});h.registerHelper("info","graphql",(r,e)=>{if(!e.schema||!r.state)return;const i=r.state,n=i.kind,d=i.step,c=E(e.schema,r.state);if(n==="Field"&&d===0&&c.fieldDef||n==="AliasedField"&&d===2&&c.fieldDef){const a=document.createElement("div");return o(a,c,e),u(a,e,c.fieldDef),a}else if(n==="Directive"&&d===1&&c.directiveDef){const a=document.createElement("div");return f(a,c,e),u(a,e,c.directiveDef),a}else if(n==="Argument"&&d===0&&c.argDef){const a=document.createElement("div");return p(a,c,e),u(a,e,c.argDef),a}else if(n==="EnumValue"&&c.enumValue&&c.enumValue.description){const a=document.createElement("div");return D(a,c,e),u(a,e,c.enumValue),a}else if(n==="NamedType"&&c.type&&c.type.description){const a=document.createElement("div");return m(a,c,e,c.type),u(a,e,c.type),a}});function o(r,e,i){s(r,e,i),v(r,e,i,e.type)}l(o,"renderField");function s(r,e,i){var n;const d=((n=e.fieldDef)===null||n===void 0?void 0:n.name)||"";d.slice(0,2)!=="__"&&(m(r,e,i,e.parentType),t(r,".")),t(r,d,"field-name",i,C(e))}l(s,"renderQualifiedField");function f(r,e,i){var n;const d="@"+(((n=e.directiveDef)===null||n===void 0?void 0:n.name)||"");t(r,d,"directive-name",i,N(e))}l(f,"renderDirective");function p(r,e,i){var n;e.directiveDef?f(r,e,i):e.fieldDef&&s(r,e,i);const d=((n=e.argDef)===null||n===void 0?void 0:n.name)||"";t(r,"("),t(r,d,"arg-name",i,_(e)),v(r,e,i,e.inputType),t(r,")")}l(p,"renderArg");function v(r,e,i,n){t(r,": "),m(r,e,i,n)}l(v,"renderTypeAnnotation");function D(r,e,i){var n;const d=((n=e.enumValue)===null||n===void 0?void 0:n.name)||"";m(r,e,i,e.inputType),t(r,"."),t(r,d,"enum-value",i,V(e))}l(D,"renderEnumValue");function m(r,e,i,n){n instanceof A?(m(r,e,i,n.ofType),t(r,"!")):n instanceof F?(t(r,"["),m(r,e,i,n.ofType),t(r,"]")):t(r,(n==null?void 0:n.name)||"","type-name",i,x(e,n))}l(m,"renderType");function u(r,e,i){const n=i.description;if(n){const d=document.createElement("div");d.className="info-description",e.renderDescription?d.innerHTML=e.renderDescription(n):d.appendChild(document.createTextNode(n)),r.appendChild(d)}T(r,e,i)}l(u,"renderDescription");function T(r,e,i){const n=i.deprecationReason;if(n){const d=document.createElement("div");d.className="info-deprecation",e.renderDescription?d.innerHTML=e.renderDescription(n):d.appendChild(document.createTextNode(n));const c=document.createElement("span");c.className="info-deprecation-label",c.appendChild(document.createTextNode("Deprecated: ")),d.insertBefore(c,d.firstChild),r.appendChild(d)}}l(T,"renderDeprecation");function t(r,e,i="",n={onClick:null},d=null){if(i){const c=n.onClick;let a;c?(a=document.createElement("a"),a.href="javascript:void 0",a.addEventListener("click",g=>{c(d,g)})):a=document.createElement("span"),a.className=i,a.appendChild(document.createTextNode(e)),r.appendChild(a)}else r.appendChild(document.createTextNode(e))}l(t,"text");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as U,j as m,dB as Bt,cN as P,dC as Ht,H as Gt,dD as Ft,b as Wt,Q as qt,dE as Kt,bl as Vt,v as zt,r as D,t as Yt,N as Xt,W as Jt,m as Qt,D as Zt,B as ft,C as pt,x as kt,K as te,y as ee,bm as ie,M as re}from"./index-CRLxFVWY.js";import{W as ne}from"./url-evaluation-Oli2ZbAu.js";import{s as Et,n as se}from"./schema-BKkMgYH9.js";import{I as mt}from"./index-D8KWuR1-.js";import{T as oe}from"./TextField-D1TVUQl2.js";import{S as ae,a as le,b as he}from"./Stepper-BQ3ikYJX.js";function ce({mode:t,...e}){return t==="development"?m.jsx(ne,{type:"primary",...e,children:"DEV"}):null}ce.propTypes={mode:U.string.isRequired};var _t={},ht={exports:{}},jt={exports:{}},X=jt.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(t){return"file-"+St(t)}}},gt={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:St};Object.keys(X).forEach(function(t){Object.keys(gt).forEach(function(e){X[t][e]||(X[t][e]=gt[e])}),X[t].protocols_re=RegExp("^("+X[t].protocols.map(function(e){return e.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function St(t){return t.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}var Ct=jt.exports,dt=Ct,q=Object.assign||function(e,i){if(i===null||typeof i!="object")return e;const r=Object.keys(i);let s=r.length;for(;s--;)e[r[s]]=i[r[s]];return e},ue=j;function j(t,e,i,r,s,a,p){var c=this;c.type=t,Object.keys(dt[t]).forEach(function(g){c[g]=dt[t][g]}),c.user=e,c.auth=i,c.project=r,c.committish=s,c.default=a,c.opts=p||{}}j.prototype.hash=function(){return this.committish?"#"+this.committish:""};j.prototype._fill=function(t,e){if(t){var i=q({},e);i.path=i.path?i.path.replace(/^[/]+/g,""):"",e=q(q({},this.opts),e);var r=this;Object.keys(this).forEach(function(f){r[f]!=null&&i[f]==null&&(i[f]=r[f])});var s=i.auth,a=i.committish,p=i.fragment,c=i.path,g=i.project;Object.keys(i).forEach(function(f){var S=i[f];(f==="path"||f==="project")&&typeof S=="string"?i[f]=S.split("/").map(function(h){return encodeURIComponent(h)}).join("/"):f!=="domain"&&(i[f]=encodeURIComponent(S))}),i["auth@"]=s?s+"@":"",i["#fragment"]=p?"#"+this.hashformat(p):"",i.fragment=i.fragment?i.fragment:"",i["#path"]=c?"#"+this.hashformat(c):"",i["/path"]=i.path?"/"+i.path:"",i.projectPath=g.split("/").map(encodeURIComponent).join("/"),e.noCommittish?(i["#committish"]="",i["/tree/committish"]="",i["/committish"]="",i.committish=""):(i["#committish"]=a?"#"+a:"",i["/tree/committish"]=i.committish?"/"+i.treepath+"/"+i.committish:"",i["/committish"]=i.committish?"/"+i.committish:"",i.committish=i.committish||"master");var x=t;return Object.keys(i).forEach(function(f){x=x.replace(new RegExp("[{]"+f+"[}]","g"),i[f])}),e.noGitPlus?x.replace(/^git[+]/,""):x}};j.prototype.ssh=function(t){return this._fill(this.sshtemplate,t)};j.prototype.sshurl=function(t){return this._fill(this.sshurltemplate,t)};j.prototype.browse=function(t,e,i){return typeof t=="string"?(typeof e!="string"&&(i=e,e=null),this._fill(this.browsefiletemplate,q({fragment:e,path:t},i))):this._fill(this.browsetemplate,t)};j.prototype.docs=function(t){return this._fill(this.docstemplate,t)};j.prototype.bugs=function(t){return this._fill(this.bugstemplate,t)};j.prototype.https=function(t){return this._fill(this.httpstemplate,t)};j.prototype.git=function(t){return this._fill(this.gittemplate,t)};j.prototype.shortcut=function(t){return this._fill(this.shortcuttemplate,t)};j.prototype.path=function(t){return this._fill(this.pathtemplate,t)};j.prototype.tarball=function(t){var e=q({},t,{noCommittish:!1});return this._fill(this.tarballtemplate,e)};j.prototype.file=function(t,e){return this._fill(this.filetemplate,q({path:t},e))};j.prototype.getDefaultRepresentation=function(){return this.default};j.prototype.toString=function(t){return this.default&&typeof this[this.default]=="function"?this[this.default](t):this.sshurl(t)};var nt,vt;function fe(){return vt||(vt=1,nt=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),nt}var pe=l;l.Node=$;l.create=l;function l(t){var e=this;if(e instanceof l||(e=new l),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(s){e.push(s)});else if(arguments.length>0)for(var i=0,r=arguments.length;i<r;i++)e.push(arguments[i]);return e}l.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),t.list.length--,t.next=null,t.prev=null,t.list=null,e};l.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};l.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};l.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)ge(this,arguments[t]);return this.length};l.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)de(this,arguments[t]);return this.length};l.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}};l.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}};l.prototype.forEach=function(t,e){e=e||this;for(var i=this.head,r=0;i!==null;r++)t.call(e,i.value,r,this),i=i.next};l.prototype.forEachReverse=function(t,e){e=e||this;for(var i=this.tail,r=this.length-1;i!==null;r--)t.call(e,i.value,r,this),i=i.prev};l.prototype.get=function(t){for(var e=0,i=this.head;i!==null&&e<t;e++)i=i.next;if(e===t&&i!==null)return i.value};l.prototype.getReverse=function(t){for(var e=0,i=this.tail;i!==null&&e<t;e++)i=i.prev;if(e===t&&i!==null)return i.value};l.prototype.map=function(t,e){e=e||this;for(var i=new l,r=this.head;r!==null;)i.push(t.call(e,r.value,this)),r=r.next;return i};l.prototype.mapReverse=function(t,e){e=e||this;for(var i=new l,r=this.tail;r!==null;)i.push(t.call(e,r.value,this)),r=r.prev;return i};l.prototype.reduce=function(t,e){var i,r=this.head;if(arguments.length>1)i=e;else if(this.head)r=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;r!==null;s++)i=t(i,r.value,s),r=r.next;return i};l.prototype.reduceReverse=function(t,e){var i,r=this.tail;if(arguments.length>1)i=e;else if(this.tail)r=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;r!==null;s--)i=t(i,r.value,s),r=r.prev;return i};l.prototype.toArray=function(){for(var t=new Array(this.length),e=0,i=this.head;i!==null;e++)t[e]=i.value,i=i.next;return t};l.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,i=this.tail;i!==null;e++)t[e]=i.value,i=i.prev;return t};l.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var i=new l;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(;s!==null&&r<e;r++,s=s.next)i.push(s.value);return i};l.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var i=new l;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=this.length,s=this.tail;s!==null&&r>e;r--)s=s.prev;for(;s!==null&&r>t;r--,s=s.prev)i.push(s.value);return i};l.prototype.splice=function(t,e,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(var a=[],r=0;s&&r<e;r++)a.push(s.value),s=this.removeNode(s);s===null&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(var r=0;r<i.length;r++)s=me(this,s,i[r]);return a};l.prototype.reverse=function(){for(var t=this.head,e=this.tail,i=t;i!==null;i=i.prev){var r=i.prev;i.prev=i.next,i.next=r}return this.head=e,this.tail=t,this};function me(t,e,i){var r=e===t.head?new $(i,null,e,t):new $(i,e,e.next,t);return r.next===null&&(t.tail=r),r.prev===null&&(t.head=r),t.length++,r}function ge(t,e){t.tail=new $(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function de(t,e){t.head=new $(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function $(t,e,i,r){if(!(this instanceof $))return new $(t,e,i,r);this.list=r,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,i?(i.prev=this,this.next=i):this.next=null}try{fe()(l)}catch{}const ve=pe,M=Symbol("max"),O=Symbol("length"),F=Symbol("lengthCalculator"),Q=Symbol("allowStale"),N=Symbol("maxAge"),I=Symbol("dispose"),yt=Symbol("noDisposeOnSet"),b=Symbol("lruList"),w=Symbol("cache"),At=Symbol("updateAgeOnGet"),st=()=>1;class ye{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");this[M]=e.max||1/0;const i=e.length||st;if(this[F]=typeof i!="function"?st:i,this[Q]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[N]=e.maxAge||0,this[I]=e.dispose,this[yt]=e.noDisposeOnSet||!1,this[At]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[M]=e||1/0,J(this)}get max(){return this[M]}set allowStale(e){this[Q]=!!e}get allowStale(){return this[Q]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[N]=e,J(this)}get maxAge(){return this[N]}set lengthCalculator(e){typeof e!="function"&&(e=st),e!==this[F]&&(this[F]=e,this[O]=0,this[b].forEach(i=>{i.length=this[F](i.value,i.key),this[O]+=i.length})),J(this)}get lengthCalculator(){return this[F]}get length(){return this[O]}get itemCount(){return this[b].length}rforEach(e,i){i=i||this;for(let r=this[b].tail;r!==null;){const s=r.prev;bt(this,e,r,i),r=s}}forEach(e,i){i=i||this;for(let r=this[b].head;r!==null;){const s=r.next;bt(this,e,r,i),r=s}}keys(){return this[b].toArray().map(e=>e.key)}values(){return this[b].toArray().map(e=>e.value)}reset(){this[I]&&this[b]&&this[b].length&&this[b].forEach(e=>this[I](e.key,e.value)),this[w]=new Map,this[b]=new ve,this[O]=0}dump(){return this[b].map(e=>k(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[b]}set(e,i,r){if(r=r||this[N],r&&typeof r!="number")throw new TypeError("maxAge must be a number");const s=r?Date.now():0,a=this[F](i,e);if(this[w].has(e)){if(a>this[M])return K(this,this[w].get(e)),!1;const g=this[w].get(e).value;return this[I]&&(this[yt]||this[I](e,g.value)),g.now=s,g.maxAge=r,g.value=i,this[O]+=a-g.length,g.length=a,this.get(e),J(this),!0}const p=new be(e,i,a,s,r);return p.length>this[M]?(this[I]&&this[I](e,i),!1):(this[O]+=p.length,this[b].unshift(p),this[w].set(e,this[b].head),J(this),!0)}has(e){if(!this[w].has(e))return!1;const i=this[w].get(e).value;return!k(this,i)}get(e){return ot(this,e,!0)}peek(e){return ot(this,e,!1)}pop(){const e=this[b].tail;return e?(K(this,e),e.value):null}del(e){K(this,this[w].get(e))}load(e){this.reset();const i=Date.now();for(let r=e.length-1;r>=0;r--){const s=e[r],a=s.e||0;if(a===0)this.set(s.k,s.v);else{const p=a-i;p>0&&this.set(s.k,s.v,p)}}}prune(){this[w].forEach((e,i)=>ot(this,i,!1))}}const ot=(t,e,i)=>{const r=t[w].get(e);if(r){const s=r.value;if(k(t,s)){if(K(t,r),!t[Q])return}else i&&(t[At]&&(r.value.now=Date.now()),t[b].unshiftNode(r));return s.value}},k=(t,e)=>{if(!e||!e.maxAge&&!t[N])return!1;const i=Date.now()-e.now;return e.maxAge?i>e.maxAge:t[N]&&i>t[N]},J=t=>{if(t[O]>t[M])for(let e=t[b].tail;t[O]>t[M]&&e!==null;){const i=e.prev;K(t,e),e=i}},K=(t,e)=>{if(e){const i=e.value;t[I]&&t[I](i.key,i.value),t[O]-=i.length,t[w].delete(i.key),t[b].removeNode(e)}};class be{constructor(e,i,r,s,a){this.key=e,this.value=i,this.length=r,this.now=s,this.maxAge=a||0}}const bt=(t,e,i,r)=>{let s=i.value;k(t,s)&&(K(t,i),t[Q]||(s=void 0)),s&&e.call(r,s.value,s.key,t)};var xe=ye,lt=Bt,xt=Ct,Ee=ht.exports=ue,_e=xe,at=new _e({max:1e3}),je={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function Se(t){return je[t]||t.slice(0,-1)}var Ce={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};ht.exports.fromUrl=function(t,e){if(typeof t=="string"){var i=t+JSON.stringify(e||{});return at.has(i)||at.set(i,Ae(t,e)),at.get(i)}};function Ae(t,e){if(!(t==null||t==="")){var i=Re(we(t)?"github:"+t:t),r=Pe(i),s=i.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),a=Object.keys(xt).map(function(p){try{var c=xt[p],g=null;r.auth&&Ce[r.protocol]&&(g=r.auth);var x=r.hash?decodeURIComponent(r.hash.substr(1)):null,f=null,S=null,h=null;if(s&&s[1]===p)f=s[2]&&decodeURIComponent(s[2]),S=decodeURIComponent(s[3].replace(/\.git$/,"")),h="shortcut";else{if(r.host&&r.host!==c.domain&&r.host.replace(/^www[.]/,"")!==c.domain||!c.protocols_re.test(r.protocol)||!r.path)return;var H=c.pathmatch,C=r.path.match(H);if(!C)return;C[1]!==null&&C[1]!==void 0&&(f=decodeURIComponent(C[1].replace(/^:/,""))),S=decodeURIComponent(C[2]),h=Se(r.protocol)}return new Ee(p,f,g,S,x,h,e)}catch(A){if(!(A instanceof URIError))throw A}}).filter(function(p){return p});if(a.length===1)return a[0]}}function we(t){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(t)}function Re(t){var e=lt.parse(t);return e.protocol==="gist:"&&e.host&&!e.path?e.protocol+"/"+e.host:t}function Pe(t){var e=t.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!e){var i=lt.parse(t);if(i.auth){const s=t.match(/[^@]+@[^:/]+/);if(s){var r=new lt.URL(s[0]);i.auth=r.username||"",r.password&&(i.auth+=":"+r.password)}}return i}return{protocol:"git+ssh:",slashes:!0,auth:e[1],host:e[2],port:null,hostname:e[2],hash:e[4],search:null,query:null,pathname:"/"+e[3],path:"/"+e[3],href:"git+ssh://"+e[1]+"@"+e[2]+"/"+e[3]+(e[4]||"")}}var Ie=ht.exports,B={},R={},wt=P&&P.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(R,"__esModule",{value:!0});R.setService=R.findService=R.getDefaultServiceConfig=R.getServiceConfig=void 0;const Ue=wt(Ht),Oe=wt(Gt),Te=Et,{NODE_SERVICES:W}=Oe.default,Z={},ct=t=>{Z[t.name]={validate:t.schema.validate.bind(t.schema),defaultConfig:t.default}};R.setService=ct;ct({name:"auth",schema:Te.authConfigSchema,default:{}});Z[W.AUTH_SERVICE]={...Z[W.AUTH],meta:{...Z[W.AUTH].meta,name:W.AUTH_SERVICE}};const Rt=t=>{if(!t)throw new Error("service name should not be empty");const e=Z[t];if(!e)throw new Error(`service ${t} does not exist`);return e},Pt=(t,e,{validate:i}={})=>{const r=Rt(t),s=(0,Ue.default)(e||{}),{value:a,error:p}=r.validate(s);if(i&&p)throw new Error(`Invalid blocklet service config: ${p.details.map(c=>c.message).join(", ")}`);return a};R.getServiceConfig=Pt;const It=t=>{const{defaultConfig:e}=Rt(t);return e};R.getDefaultServiceConfig=It;const Ut=(t,e)=>{const i=[e];return e===W.AUTH&&i.push(W.AUTH_SERVICE),(t||[]).find(r=>i.includes(r.name))};R.findService=Ut;R.default={getServiceConfig:Pt,getDefaultServiceConfig:It,findService:Ut,setService:ct};Object.defineProperty(B,"__esModule",{value:!0});B.fixAndValidateService=B.validateMeta=void 0;const De=Et,Le=R,Me=t=>(!t.interfaces||!t.interfaces.length||t.interfaces.forEach(e=>{e.services&&e.services.length&&e.services.forEach(i=>{i.config=(0,Le.getServiceConfig)(i.name,i.config,{validate:!0})})}),t);B.fixAndValidateService=Me;const Ot=(t,{ensureFiles:e=!1,ensureDist:i=!1,ensureComponentStore:r=!0,ensureName:s=!1,skipValidateDidName:a=!1,schemaOptions:p={}}={})=>{const c=(0,De.createBlockletSchema)(null,{ensureFiles:e,ensureDist:i,ensureComponentStore:r,ensureName:s,skipValidateDidName:a,...p}),{value:g,error:x}=c.validate(t);if(x)throw new Error(`Invalid blocklet meta: ${x.details.map(f=>f.message).join(", ")}`);return g};B.validateMeta=Ot;B.default=Ot;(function(t){var e=P&&P.__createBinding||(Object.create?function(n,o,d,_){_===void 0&&(_=d);var v=Object.getOwnPropertyDescriptor(o,d);(!v||("get"in v?!o.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return o[d]}}),Object.defineProperty(n,_,v)}:function(n,o,d,_){_===void 0&&(_=d),n[_]=o[d]}),i=P&&P.__setModuleDefault||(Object.create?function(n,o){Object.defineProperty(n,"default",{enumerable:!0,value:o})}:function(n,o){n.default=o}),r=P&&P.__importStar||function(n){if(n&&n.__esModule)return n;var o={};if(n!=null)for(var d in n)d!=="default"&&Object.prototype.hasOwnProperty.call(n,d)&&e(o,n,d);return i(o,n),o},s=P&&P.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(t,"__esModule",{value:!0}),t.fixService=t.fixInterfaces=t.parsePerson=t.formatPerson=t.fixName=t.fixTags=t.fixPerson=t.fixKeywords=t.fixFiles=t.fixRepository=t.fixRequired=void 0;const a=s(Ft),p=r(Ie),c=Wt,g=B;Object.defineProperty(t,"fixService",{enumerable:!0,get:function(){return g.fixAndValidateService}});const x=se,f=(n,o)=>{n.description||(n.description=`Blocklet from ${o}`),n.version||(n.version=c.BLOCKLET_DEFAULT_VERSION)};t.fixRequired=f;const S=n=>{if(n.repository&&(typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository}),n.repository.url)){const o=p.fromUrl(n.repository.url);o&&(n.repository.url=o.getDefaultRepresentation()==="shortcut"?o.https():o.toString())}};t.fixRepository=S;const h=n=>{Array.isArray(n.files)?n.files&&(n.files=n.files.filter(o=>!(!o||typeof o!="string"))):delete n.files};t.fixFiles=h;const H=n=>{typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?delete n.keywords:n.keywords&&(n.keywords=n.keywords.filter(o=>!(typeof o!="string"||!o)))};t.fixKeywords=H;const C=n=>{typeof n.tags=="string"&&(n.tags=n.tags.split(/,\s+/)),n.tags&&!Array.isArray(n.tags)?delete n.tags:n.tags&&(n.tags=n.tags.filter(o=>!(typeof o!="string"||!o)))};t.fixTags=C;const A=(n,o)=>(n.author&&(n.author=o(n.author)),["maintainers","contributors"].forEach(d=>{Array.isArray(n[d])&&(n[d]=n[d].map(o))}),n),V=n=>{if(!n)return"";if(typeof n=="string")return n;const o=n.name||"",d=n.url||n.web,_=d?` (${d})`:"",v=n.email||n.mail,y=v?` <${v}>`:"";return o+y+_};t.formatPerson=V;const T=n=>{if(typeof n!="string")return n;const o=n.match(/^([^(<]+)/),d=n.match(/\(([^)]+)\)/),_=n.match(/<([^>]+)>/),v={};return o&&o[0].trim()&&(v.name=o[0].trim()),_&&([,v.email]=_),d&&([,v.url]=d),v};t.parsePerson=T;const G=n=>(A(n,V),A(n,T),n);t.fixPerson=G;const E=(n,o=!0)=>{if(Array.isArray(n.interfaces)||(n.interfaces=[]),n.interfaces.length)return n.interfaces.forEach(y=>{y.type===c.BLOCKLET_INTERFACE_TYPE_WEB&&(y.protocol="http")}),n;const _=(0,a.default)(n,"capabilities.dynamicPathPrefix",!0)?c.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",v=({type:y="web",name:Y,path:tt="/",protocol:et="http",port:it=c.BLOCKLET_DEFAULT_PORT_NAME})=>{n.interfaces.push({type:y,name:Y,path:tt,prefix:_,port:it,protocol:et})};return[c.BLOCKLET_INTERFACE_PUBLIC].forEach(y=>{n[y]&&v({name:y,path:n[y]})}),Array.isArray(n.exposeServices)&&n.exposeServices.forEach(y=>{v({type:"service",name:y.protocol,protocol:y.protocol,port:{internal:`BLOCKLET_${y.protocol}_PORT`.toUpperCase(),external:y.port}})}),o&&(delete n.publicUrl,delete n.adminUrl,delete n.configUrl,delete n.docUrl,delete n.exposeServices,n.capabilities&&delete n.capabilities.dynamicPathPrefix),n};t.fixInterfaces=E;const z=n=>{const{did:o}=n;try{(0,x.validateNewDid)(o),n.name=o}catch{}return n};t.fixName=z,t.default={fixRequired:f,fixRepository:S,fixFiles:h,fixKeywords:H,fixPerson:G,fixTags:C,fixName:z,formatPerson:V,parsePerson:T,fixInterfaces:E,fixService:g.fixAndValidateService}})(_t);function Tt({owner:t,locale:e}){return m.jsxs(qt,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.fullName,t.did?m.jsx(Kt,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:t.did,compact:!0,size:14,locale:e}):null]})}Tt.propTypes={owner:U.object.isRequired,locale:U.string.isRequired};function Dt({defaultUrl:t,onCancel:e,onSuccess:i,onError:r,mode:s,handleText:a}){const{api:p}=Vt(),{api:c}=zt(),[g,x]=D.useState(!1),[f,S]=D.useState(""),{t:h,locale:H}=Yt(),C={dist:{}},[A,V]=D.useState(t),[T,G]=D.useState(t?1:0),[E,z]=D.useState(C),[n,o]=D.useState(!1),[d,_]=D.useState({}),v=s==="component",y=v?!0:!t,Y=async()=>{z(C),S(null),x(!0);try{const u=decodeURIComponent(A.trim());try{new URL(u)}catch{throw new Error("Invalid URL")}const{meta:rt,inStore:Nt,registryUrl:$t}=await p.getBlockletMetaFromUrl({input:{url:u}});z(rt),_({inStore:Nt,registryUrl:$t,inputUrl:A.trim()})}catch(u){console.error(u);const rt=`Blocklet Install failed: ${re(u)}`;S(rt),r(u)}finally{x(!1)}},tt=()=>{if(v){i({meta:E,...d}),e();return}x(!0),o(!0)},et=()=>{x(!1),o(!1),i({meta:E,...d}),e()},it=()=>{x(!1),o(!1)};D.useEffect(()=>{t&&Y()},[t]);const Lt=[{name:h("common.name"),value:Xt.getDisplayName({meta:E},!0)},{name:h("common.version"),value:E.version},{name:h("common.did"),value:m.jsx(Jt,{did:E.did})},{name:h("common.author"),value:E.owner?m.jsx(Tt,{owner:E.owner,locale:H}):_t.formatPerson(E.author)},{name:h("blocklet.dist.downloadLink"),value:E.dist.tarball}],Mt=()=>g?m.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:m.jsx(pt,{})}):E.did?m.jsx("div",{style:{paddingLeft:"10%"},children:Lt.map(u=>u.name===h("common.did")?m.jsx(mt,{valueComponent:"div",nameWidth:120,name:u.name,nameFormatter:()=>h("common.did"),children:u.value},u.name):m.jsx(mt,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.name))}):null,ut=[{label:h("blocklet.fromUrl.step0"),body:m.jsx(Qt,{component:"div",children:m.jsx(oe,{label:h("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,style:{marginBottom:32},margin:"dense",helperText:h("blocklet.fromUrl.description"),value:A,onChange:u=>{S(null),V(u.target.value)},disabled:g,onKeyPress:u=>{u.key==="Enter"&&(u.preventDefault(),Y(),G(1))}})}),cancel:h("common.cancel"),confirm:h("common.next"),onCancel:e,onConfirm:()=>{Y(),G(1)}},{label:h("blocklet.fromUrl.step1"),body:Mt(),cancel:h(y?"common.pre":"common.cancel"),confirm:(a==null?void 0:a.confirm)||h("blocklet.fromUrl.confirm"),onCancel:()=>{y?G(u=>u-1):e()},onConfirm:()=>{tt()}}],L=ut[T];return m.jsxs(m.Fragment,{children:[m.jsxs(Zt,{title:(a==null?void 0:a.title)||h("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>L.onCancel(),showCloseButton:T===0,disableEscapeKeyDown:!0,open:!0,actions:m.jsxs(m.Fragment,{children:[L.cancel&&m.jsx(ft,{onClick:u=>{u.stopPropagation(),S(null),L.onCancel()},color:"inherit",children:L.cancel||h("common.cancel")}),m.jsxs(ft,{onClick:u=>{u.stopPropagation(),L.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:g||!A||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[g&&T===0&&m.jsx(pt,{size:16}),L.confirm]})]}),children:[y&&m.jsx(ae,{alternativeLabel:!0,activeStep:T,children:ut.map(({label:u})=>m.jsx(le,{children:m.jsx(he,{children:u})},u))}),m.jsx(kt,{component:"div",style:{marginTop:24},children:L.body}),!!f&&m.jsx(te,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),E&&n&&m.jsx(ee,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:c.get,checkTimeout:5*60*1e3,onSuccess:et,extraParams:{title:E.title,wt:ie(E),blockletMetaUrl:decodeURIComponent(A.trim())},messages:{title:h("setup.keyPair.title"),scan:h("setup.keyPair.scan"),confirm:h("setup.keyPair.confirm"),success:h("setup.keyPair.success")},onClose:it})]})}Dt.propTypes={defaultUrl:U.string,onCancel:U.func.isRequired,onSuccess:U.func.isRequired,onError:U.func,mode:U.oneOf(["install","component"]),handleText:U.object};Dt.defaultProps={onError:()=>{},defaultUrl:"",mode:"install",handleText:{}};export{ce as B,Dt as I,Tt as a,_t as f};
|
|
1
|
+
import{P as U,j as m,dB as Bt,cN as P,dC as Ht,H as Gt,dD as Ft,b as Wt,Q as qt,dE as Kt,bl as Vt,v as zt,r as D,t as Yt,N as Xt,W as Jt,m as Qt,D as Zt,B as ft,C as pt,x as kt,K as te,y as ee,bm as ie,M as re}from"./index-BHdqgom8.js";import{W as ne}from"./url-evaluation-BTdmiGRO.js";import{s as Et,n as se}from"./schema-5ne-6Bp4.js";import{I as mt}from"./index-D3GDvQdK.js";import{T as oe}from"./TextField-Cml5LlcX.js";import{S as ae,a as le,b as he}from"./Stepper-D4h3SXw3.js";function ce({mode:t,...e}){return t==="development"?m.jsx(ne,{type:"primary",...e,children:"DEV"}):null}ce.propTypes={mode:U.string.isRequired};var _t={},ht={exports:{}},jt={exports:{}},X=jt.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(t){return"file-"+St(t)}}},gt={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:St};Object.keys(X).forEach(function(t){Object.keys(gt).forEach(function(e){X[t][e]||(X[t][e]=gt[e])}),X[t].protocols_re=RegExp("^("+X[t].protocols.map(function(e){return e.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function St(t){return t.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}var Ct=jt.exports,dt=Ct,q=Object.assign||function(e,i){if(i===null||typeof i!="object")return e;const r=Object.keys(i);let s=r.length;for(;s--;)e[r[s]]=i[r[s]];return e},ue=j;function j(t,e,i,r,s,a,p){var c=this;c.type=t,Object.keys(dt[t]).forEach(function(g){c[g]=dt[t][g]}),c.user=e,c.auth=i,c.project=r,c.committish=s,c.default=a,c.opts=p||{}}j.prototype.hash=function(){return this.committish?"#"+this.committish:""};j.prototype._fill=function(t,e){if(t){var i=q({},e);i.path=i.path?i.path.replace(/^[/]+/g,""):"",e=q(q({},this.opts),e);var r=this;Object.keys(this).forEach(function(f){r[f]!=null&&i[f]==null&&(i[f]=r[f])});var s=i.auth,a=i.committish,p=i.fragment,c=i.path,g=i.project;Object.keys(i).forEach(function(f){var S=i[f];(f==="path"||f==="project")&&typeof S=="string"?i[f]=S.split("/").map(function(h){return encodeURIComponent(h)}).join("/"):f!=="domain"&&(i[f]=encodeURIComponent(S))}),i["auth@"]=s?s+"@":"",i["#fragment"]=p?"#"+this.hashformat(p):"",i.fragment=i.fragment?i.fragment:"",i["#path"]=c?"#"+this.hashformat(c):"",i["/path"]=i.path?"/"+i.path:"",i.projectPath=g.split("/").map(encodeURIComponent).join("/"),e.noCommittish?(i["#committish"]="",i["/tree/committish"]="",i["/committish"]="",i.committish=""):(i["#committish"]=a?"#"+a:"",i["/tree/committish"]=i.committish?"/"+i.treepath+"/"+i.committish:"",i["/committish"]=i.committish?"/"+i.committish:"",i.committish=i.committish||"master");var x=t;return Object.keys(i).forEach(function(f){x=x.replace(new RegExp("[{]"+f+"[}]","g"),i[f])}),e.noGitPlus?x.replace(/^git[+]/,""):x}};j.prototype.ssh=function(t){return this._fill(this.sshtemplate,t)};j.prototype.sshurl=function(t){return this._fill(this.sshurltemplate,t)};j.prototype.browse=function(t,e,i){return typeof t=="string"?(typeof e!="string"&&(i=e,e=null),this._fill(this.browsefiletemplate,q({fragment:e,path:t},i))):this._fill(this.browsetemplate,t)};j.prototype.docs=function(t){return this._fill(this.docstemplate,t)};j.prototype.bugs=function(t){return this._fill(this.bugstemplate,t)};j.prototype.https=function(t){return this._fill(this.httpstemplate,t)};j.prototype.git=function(t){return this._fill(this.gittemplate,t)};j.prototype.shortcut=function(t){return this._fill(this.shortcuttemplate,t)};j.prototype.path=function(t){return this._fill(this.pathtemplate,t)};j.prototype.tarball=function(t){var e=q({},t,{noCommittish:!1});return this._fill(this.tarballtemplate,e)};j.prototype.file=function(t,e){return this._fill(this.filetemplate,q({path:t},e))};j.prototype.getDefaultRepresentation=function(){return this.default};j.prototype.toString=function(t){return this.default&&typeof this[this.default]=="function"?this[this.default](t):this.sshurl(t)};var nt,vt;function fe(){return vt||(vt=1,nt=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),nt}var pe=l;l.Node=$;l.create=l;function l(t){var e=this;if(e instanceof l||(e=new l),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(s){e.push(s)});else if(arguments.length>0)for(var i=0,r=arguments.length;i<r;i++)e.push(arguments[i]);return e}l.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),t.list.length--,t.next=null,t.prev=null,t.list=null,e};l.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};l.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};l.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)ge(this,arguments[t]);return this.length};l.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)de(this,arguments[t]);return this.length};l.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}};l.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}};l.prototype.forEach=function(t,e){e=e||this;for(var i=this.head,r=0;i!==null;r++)t.call(e,i.value,r,this),i=i.next};l.prototype.forEachReverse=function(t,e){e=e||this;for(var i=this.tail,r=this.length-1;i!==null;r--)t.call(e,i.value,r,this),i=i.prev};l.prototype.get=function(t){for(var e=0,i=this.head;i!==null&&e<t;e++)i=i.next;if(e===t&&i!==null)return i.value};l.prototype.getReverse=function(t){for(var e=0,i=this.tail;i!==null&&e<t;e++)i=i.prev;if(e===t&&i!==null)return i.value};l.prototype.map=function(t,e){e=e||this;for(var i=new l,r=this.head;r!==null;)i.push(t.call(e,r.value,this)),r=r.next;return i};l.prototype.mapReverse=function(t,e){e=e||this;for(var i=new l,r=this.tail;r!==null;)i.push(t.call(e,r.value,this)),r=r.prev;return i};l.prototype.reduce=function(t,e){var i,r=this.head;if(arguments.length>1)i=e;else if(this.head)r=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;r!==null;s++)i=t(i,r.value,s),r=r.next;return i};l.prototype.reduceReverse=function(t,e){var i,r=this.tail;if(arguments.length>1)i=e;else if(this.tail)r=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;r!==null;s--)i=t(i,r.value,s),r=r.prev;return i};l.prototype.toArray=function(){for(var t=new Array(this.length),e=0,i=this.head;i!==null;e++)t[e]=i.value,i=i.next;return t};l.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,i=this.tail;i!==null;e++)t[e]=i.value,i=i.prev;return t};l.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var i=new l;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(;s!==null&&r<e;r++,s=s.next)i.push(s.value);return i};l.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var i=new l;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=this.length,s=this.tail;s!==null&&r>e;r--)s=s.prev;for(;s!==null&&r>t;r--,s=s.prev)i.push(s.value);return i};l.prototype.splice=function(t,e,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(var a=[],r=0;s&&r<e;r++)a.push(s.value),s=this.removeNode(s);s===null&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(var r=0;r<i.length;r++)s=me(this,s,i[r]);return a};l.prototype.reverse=function(){for(var t=this.head,e=this.tail,i=t;i!==null;i=i.prev){var r=i.prev;i.prev=i.next,i.next=r}return this.head=e,this.tail=t,this};function me(t,e,i){var r=e===t.head?new $(i,null,e,t):new $(i,e,e.next,t);return r.next===null&&(t.tail=r),r.prev===null&&(t.head=r),t.length++,r}function ge(t,e){t.tail=new $(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function de(t,e){t.head=new $(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function $(t,e,i,r){if(!(this instanceof $))return new $(t,e,i,r);this.list=r,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,i?(i.prev=this,this.next=i):this.next=null}try{fe()(l)}catch{}const ve=pe,M=Symbol("max"),O=Symbol("length"),F=Symbol("lengthCalculator"),Q=Symbol("allowStale"),N=Symbol("maxAge"),I=Symbol("dispose"),yt=Symbol("noDisposeOnSet"),b=Symbol("lruList"),w=Symbol("cache"),At=Symbol("updateAgeOnGet"),st=()=>1;class ye{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");this[M]=e.max||1/0;const i=e.length||st;if(this[F]=typeof i!="function"?st:i,this[Q]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[N]=e.maxAge||0,this[I]=e.dispose,this[yt]=e.noDisposeOnSet||!1,this[At]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[M]=e||1/0,J(this)}get max(){return this[M]}set allowStale(e){this[Q]=!!e}get allowStale(){return this[Q]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[N]=e,J(this)}get maxAge(){return this[N]}set lengthCalculator(e){typeof e!="function"&&(e=st),e!==this[F]&&(this[F]=e,this[O]=0,this[b].forEach(i=>{i.length=this[F](i.value,i.key),this[O]+=i.length})),J(this)}get lengthCalculator(){return this[F]}get length(){return this[O]}get itemCount(){return this[b].length}rforEach(e,i){i=i||this;for(let r=this[b].tail;r!==null;){const s=r.prev;bt(this,e,r,i),r=s}}forEach(e,i){i=i||this;for(let r=this[b].head;r!==null;){const s=r.next;bt(this,e,r,i),r=s}}keys(){return this[b].toArray().map(e=>e.key)}values(){return this[b].toArray().map(e=>e.value)}reset(){this[I]&&this[b]&&this[b].length&&this[b].forEach(e=>this[I](e.key,e.value)),this[w]=new Map,this[b]=new ve,this[O]=0}dump(){return this[b].map(e=>k(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[b]}set(e,i,r){if(r=r||this[N],r&&typeof r!="number")throw new TypeError("maxAge must be a number");const s=r?Date.now():0,a=this[F](i,e);if(this[w].has(e)){if(a>this[M])return K(this,this[w].get(e)),!1;const g=this[w].get(e).value;return this[I]&&(this[yt]||this[I](e,g.value)),g.now=s,g.maxAge=r,g.value=i,this[O]+=a-g.length,g.length=a,this.get(e),J(this),!0}const p=new be(e,i,a,s,r);return p.length>this[M]?(this[I]&&this[I](e,i),!1):(this[O]+=p.length,this[b].unshift(p),this[w].set(e,this[b].head),J(this),!0)}has(e){if(!this[w].has(e))return!1;const i=this[w].get(e).value;return!k(this,i)}get(e){return ot(this,e,!0)}peek(e){return ot(this,e,!1)}pop(){const e=this[b].tail;return e?(K(this,e),e.value):null}del(e){K(this,this[w].get(e))}load(e){this.reset();const i=Date.now();for(let r=e.length-1;r>=0;r--){const s=e[r],a=s.e||0;if(a===0)this.set(s.k,s.v);else{const p=a-i;p>0&&this.set(s.k,s.v,p)}}}prune(){this[w].forEach((e,i)=>ot(this,i,!1))}}const ot=(t,e,i)=>{const r=t[w].get(e);if(r){const s=r.value;if(k(t,s)){if(K(t,r),!t[Q])return}else i&&(t[At]&&(r.value.now=Date.now()),t[b].unshiftNode(r));return s.value}},k=(t,e)=>{if(!e||!e.maxAge&&!t[N])return!1;const i=Date.now()-e.now;return e.maxAge?i>e.maxAge:t[N]&&i>t[N]},J=t=>{if(t[O]>t[M])for(let e=t[b].tail;t[O]>t[M]&&e!==null;){const i=e.prev;K(t,e),e=i}},K=(t,e)=>{if(e){const i=e.value;t[I]&&t[I](i.key,i.value),t[O]-=i.length,t[w].delete(i.key),t[b].removeNode(e)}};class be{constructor(e,i,r,s,a){this.key=e,this.value=i,this.length=r,this.now=s,this.maxAge=a||0}}const bt=(t,e,i,r)=>{let s=i.value;k(t,s)&&(K(t,i),t[Q]||(s=void 0)),s&&e.call(r,s.value,s.key,t)};var xe=ye,lt=Bt,xt=Ct,Ee=ht.exports=ue,_e=xe,at=new _e({max:1e3}),je={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function Se(t){return je[t]||t.slice(0,-1)}var Ce={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};ht.exports.fromUrl=function(t,e){if(typeof t=="string"){var i=t+JSON.stringify(e||{});return at.has(i)||at.set(i,Ae(t,e)),at.get(i)}};function Ae(t,e){if(!(t==null||t==="")){var i=Re(we(t)?"github:"+t:t),r=Pe(i),s=i.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),a=Object.keys(xt).map(function(p){try{var c=xt[p],g=null;r.auth&&Ce[r.protocol]&&(g=r.auth);var x=r.hash?decodeURIComponent(r.hash.substr(1)):null,f=null,S=null,h=null;if(s&&s[1]===p)f=s[2]&&decodeURIComponent(s[2]),S=decodeURIComponent(s[3].replace(/\.git$/,"")),h="shortcut";else{if(r.host&&r.host!==c.domain&&r.host.replace(/^www[.]/,"")!==c.domain||!c.protocols_re.test(r.protocol)||!r.path)return;var H=c.pathmatch,C=r.path.match(H);if(!C)return;C[1]!==null&&C[1]!==void 0&&(f=decodeURIComponent(C[1].replace(/^:/,""))),S=decodeURIComponent(C[2]),h=Se(r.protocol)}return new Ee(p,f,g,S,x,h,e)}catch(A){if(!(A instanceof URIError))throw A}}).filter(function(p){return p});if(a.length===1)return a[0]}}function we(t){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(t)}function Re(t){var e=lt.parse(t);return e.protocol==="gist:"&&e.host&&!e.path?e.protocol+"/"+e.host:t}function Pe(t){var e=t.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!e){var i=lt.parse(t);if(i.auth){const s=t.match(/[^@]+@[^:/]+/);if(s){var r=new lt.URL(s[0]);i.auth=r.username||"",r.password&&(i.auth+=":"+r.password)}}return i}return{protocol:"git+ssh:",slashes:!0,auth:e[1],host:e[2],port:null,hostname:e[2],hash:e[4],search:null,query:null,pathname:"/"+e[3],path:"/"+e[3],href:"git+ssh://"+e[1]+"@"+e[2]+"/"+e[3]+(e[4]||"")}}var Ie=ht.exports,B={},R={},wt=P&&P.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(R,"__esModule",{value:!0});R.setService=R.findService=R.getDefaultServiceConfig=R.getServiceConfig=void 0;const Ue=wt(Ht),Oe=wt(Gt),Te=Et,{NODE_SERVICES:W}=Oe.default,Z={},ct=t=>{Z[t.name]={validate:t.schema.validate.bind(t.schema),defaultConfig:t.default}};R.setService=ct;ct({name:"auth",schema:Te.authConfigSchema,default:{}});Z[W.AUTH_SERVICE]={...Z[W.AUTH],meta:{...Z[W.AUTH].meta,name:W.AUTH_SERVICE}};const Rt=t=>{if(!t)throw new Error("service name should not be empty");const e=Z[t];if(!e)throw new Error(`service ${t} does not exist`);return e},Pt=(t,e,{validate:i}={})=>{const r=Rt(t),s=(0,Ue.default)(e||{}),{value:a,error:p}=r.validate(s);if(i&&p)throw new Error(`Invalid blocklet service config: ${p.details.map(c=>c.message).join(", ")}`);return a};R.getServiceConfig=Pt;const It=t=>{const{defaultConfig:e}=Rt(t);return e};R.getDefaultServiceConfig=It;const Ut=(t,e)=>{const i=[e];return e===W.AUTH&&i.push(W.AUTH_SERVICE),(t||[]).find(r=>i.includes(r.name))};R.findService=Ut;R.default={getServiceConfig:Pt,getDefaultServiceConfig:It,findService:Ut,setService:ct};Object.defineProperty(B,"__esModule",{value:!0});B.fixAndValidateService=B.validateMeta=void 0;const De=Et,Le=R,Me=t=>(!t.interfaces||!t.interfaces.length||t.interfaces.forEach(e=>{e.services&&e.services.length&&e.services.forEach(i=>{i.config=(0,Le.getServiceConfig)(i.name,i.config,{validate:!0})})}),t);B.fixAndValidateService=Me;const Ot=(t,{ensureFiles:e=!1,ensureDist:i=!1,ensureComponentStore:r=!0,ensureName:s=!1,skipValidateDidName:a=!1,schemaOptions:p={}}={})=>{const c=(0,De.createBlockletSchema)(null,{ensureFiles:e,ensureDist:i,ensureComponentStore:r,ensureName:s,skipValidateDidName:a,...p}),{value:g,error:x}=c.validate(t);if(x)throw new Error(`Invalid blocklet meta: ${x.details.map(f=>f.message).join(", ")}`);return g};B.validateMeta=Ot;B.default=Ot;(function(t){var e=P&&P.__createBinding||(Object.create?function(n,o,d,_){_===void 0&&(_=d);var v=Object.getOwnPropertyDescriptor(o,d);(!v||("get"in v?!o.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return o[d]}}),Object.defineProperty(n,_,v)}:function(n,o,d,_){_===void 0&&(_=d),n[_]=o[d]}),i=P&&P.__setModuleDefault||(Object.create?function(n,o){Object.defineProperty(n,"default",{enumerable:!0,value:o})}:function(n,o){n.default=o}),r=P&&P.__importStar||function(n){if(n&&n.__esModule)return n;var o={};if(n!=null)for(var d in n)d!=="default"&&Object.prototype.hasOwnProperty.call(n,d)&&e(o,n,d);return i(o,n),o},s=P&&P.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(t,"__esModule",{value:!0}),t.fixService=t.fixInterfaces=t.parsePerson=t.formatPerson=t.fixName=t.fixTags=t.fixPerson=t.fixKeywords=t.fixFiles=t.fixRepository=t.fixRequired=void 0;const a=s(Ft),p=r(Ie),c=Wt,g=B;Object.defineProperty(t,"fixService",{enumerable:!0,get:function(){return g.fixAndValidateService}});const x=se,f=(n,o)=>{n.description||(n.description=`Blocklet from ${o}`),n.version||(n.version=c.BLOCKLET_DEFAULT_VERSION)};t.fixRequired=f;const S=n=>{if(n.repository&&(typeof n.repository=="string"&&(n.repository={type:"git",url:n.repository}),n.repository.url)){const o=p.fromUrl(n.repository.url);o&&(n.repository.url=o.getDefaultRepresentation()==="shortcut"?o.https():o.toString())}};t.fixRepository=S;const h=n=>{Array.isArray(n.files)?n.files&&(n.files=n.files.filter(o=>!(!o||typeof o!="string"))):delete n.files};t.fixFiles=h;const H=n=>{typeof n.keywords=="string"&&(n.keywords=n.keywords.split(/,\s+/)),n.keywords&&!Array.isArray(n.keywords)?delete n.keywords:n.keywords&&(n.keywords=n.keywords.filter(o=>!(typeof o!="string"||!o)))};t.fixKeywords=H;const C=n=>{typeof n.tags=="string"&&(n.tags=n.tags.split(/,\s+/)),n.tags&&!Array.isArray(n.tags)?delete n.tags:n.tags&&(n.tags=n.tags.filter(o=>!(typeof o!="string"||!o)))};t.fixTags=C;const A=(n,o)=>(n.author&&(n.author=o(n.author)),["maintainers","contributors"].forEach(d=>{Array.isArray(n[d])&&(n[d]=n[d].map(o))}),n),V=n=>{if(!n)return"";if(typeof n=="string")return n;const o=n.name||"",d=n.url||n.web,_=d?` (${d})`:"",v=n.email||n.mail,y=v?` <${v}>`:"";return o+y+_};t.formatPerson=V;const T=n=>{if(typeof n!="string")return n;const o=n.match(/^([^(<]+)/),d=n.match(/\(([^)]+)\)/),_=n.match(/<([^>]+)>/),v={};return o&&o[0].trim()&&(v.name=o[0].trim()),_&&([,v.email]=_),d&&([,v.url]=d),v};t.parsePerson=T;const G=n=>(A(n,V),A(n,T),n);t.fixPerson=G;const E=(n,o=!0)=>{if(Array.isArray(n.interfaces)||(n.interfaces=[]),n.interfaces.length)return n.interfaces.forEach(y=>{y.type===c.BLOCKLET_INTERFACE_TYPE_WEB&&(y.protocol="http")}),n;const _=(0,a.default)(n,"capabilities.dynamicPathPrefix",!0)?c.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",v=({type:y="web",name:Y,path:tt="/",protocol:et="http",port:it=c.BLOCKLET_DEFAULT_PORT_NAME})=>{n.interfaces.push({type:y,name:Y,path:tt,prefix:_,port:it,protocol:et})};return[c.BLOCKLET_INTERFACE_PUBLIC].forEach(y=>{n[y]&&v({name:y,path:n[y]})}),Array.isArray(n.exposeServices)&&n.exposeServices.forEach(y=>{v({type:"service",name:y.protocol,protocol:y.protocol,port:{internal:`BLOCKLET_${y.protocol}_PORT`.toUpperCase(),external:y.port}})}),o&&(delete n.publicUrl,delete n.adminUrl,delete n.configUrl,delete n.docUrl,delete n.exposeServices,n.capabilities&&delete n.capabilities.dynamicPathPrefix),n};t.fixInterfaces=E;const z=n=>{const{did:o}=n;try{(0,x.validateNewDid)(o),n.name=o}catch{}return n};t.fixName=z,t.default={fixRequired:f,fixRepository:S,fixFiles:h,fixKeywords:H,fixPerson:G,fixTags:C,fixName:z,formatPerson:V,parsePerson:T,fixInterfaces:E,fixService:g.fixAndValidateService}})(_t);function Tt({owner:t,locale:e}){return m.jsxs(qt,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.fullName,t.did?m.jsx(Kt,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:t.did,compact:!0,size:14,locale:e}):null]})}Tt.propTypes={owner:U.object.isRequired,locale:U.string.isRequired};function Dt({defaultUrl:t,onCancel:e,onSuccess:i,onError:r,mode:s,handleText:a}){const{api:p}=Vt(),{api:c}=zt(),[g,x]=D.useState(!1),[f,S]=D.useState(""),{t:h,locale:H}=Yt(),C={dist:{}},[A,V]=D.useState(t),[T,G]=D.useState(t?1:0),[E,z]=D.useState(C),[n,o]=D.useState(!1),[d,_]=D.useState({}),v=s==="component",y=v?!0:!t,Y=async()=>{z(C),S(null),x(!0);try{const u=decodeURIComponent(A.trim());try{new URL(u)}catch{throw new Error("Invalid URL")}const{meta:rt,inStore:Nt,registryUrl:$t}=await p.getBlockletMetaFromUrl({input:{url:u}});z(rt),_({inStore:Nt,registryUrl:$t,inputUrl:A.trim()})}catch(u){console.error(u);const rt=`Blocklet Install failed: ${re(u)}`;S(rt),r(u)}finally{x(!1)}},tt=()=>{if(v){i({meta:E,...d}),e();return}x(!0),o(!0)},et=()=>{x(!1),o(!1),i({meta:E,...d}),e()},it=()=>{x(!1),o(!1)};D.useEffect(()=>{t&&Y()},[t]);const Lt=[{name:h("common.name"),value:Xt.getDisplayName({meta:E},!0)},{name:h("common.version"),value:E.version},{name:h("common.did"),value:m.jsx(Jt,{did:E.did})},{name:h("common.author"),value:E.owner?m.jsx(Tt,{owner:E.owner,locale:H}):_t.formatPerson(E.author)},{name:h("blocklet.dist.downloadLink"),value:E.dist.tarball}],Mt=()=>g?m.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:m.jsx(pt,{})}):E.did?m.jsx("div",{style:{paddingLeft:"10%"},children:Lt.map(u=>u.name===h("common.did")?m.jsx(mt,{valueComponent:"div",nameWidth:120,name:u.name,nameFormatter:()=>h("common.did"),children:u.value},u.name):m.jsx(mt,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.name))}):null,ut=[{label:h("blocklet.fromUrl.step0"),body:m.jsx(Qt,{component:"div",children:m.jsx(oe,{label:h("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,style:{marginBottom:32},margin:"dense",helperText:h("blocklet.fromUrl.description"),value:A,onChange:u=>{S(null),V(u.target.value)},disabled:g,onKeyPress:u=>{u.key==="Enter"&&(u.preventDefault(),Y(),G(1))}})}),cancel:h("common.cancel"),confirm:h("common.next"),onCancel:e,onConfirm:()=>{Y(),G(1)}},{label:h("blocklet.fromUrl.step1"),body:Mt(),cancel:h(y?"common.pre":"common.cancel"),confirm:(a==null?void 0:a.confirm)||h("blocklet.fromUrl.confirm"),onCancel:()=>{y?G(u=>u-1):e()},onConfirm:()=>{tt()}}],L=ut[T];return m.jsxs(m.Fragment,{children:[m.jsxs(Zt,{title:(a==null?void 0:a.title)||h("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>L.onCancel(),showCloseButton:T===0,disableEscapeKeyDown:!0,open:!0,actions:m.jsxs(m.Fragment,{children:[L.cancel&&m.jsx(ft,{onClick:u=>{u.stopPropagation(),S(null),L.onCancel()},color:"inherit",children:L.cancel||h("common.cancel")}),m.jsxs(ft,{onClick:u=>{u.stopPropagation(),L.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:g||!A||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[g&&T===0&&m.jsx(pt,{size:16}),L.confirm]})]}),children:[y&&m.jsx(ae,{alternativeLabel:!0,activeStep:T,children:ut.map(({label:u})=>m.jsx(le,{children:m.jsx(he,{children:u})},u))}),m.jsx(kt,{component:"div",style:{marginTop:24},children:L.body}),!!f&&m.jsx(te,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),E&&n&&m.jsx(ee,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:c.get,checkTimeout:5*60*1e3,onSuccess:et,extraParams:{title:E.title,wt:ie(E),blockletMetaUrl:decodeURIComponent(A.trim())},messages:{title:h("setup.keyPair.title"),scan:h("setup.keyPair.scan"),confirm:h("setup.keyPair.confirm"),success:h("setup.keyPair.success")},onClose:it})]})}Dt.propTypes={defaultUrl:U.string,onCancel:U.func.isRequired,onSuccess:U.func.isRequired,onError:U.func,mode:U.oneOf(["install","component"]),handleText:U.object};Dt.defaultProps={onError:()=>{},defaultUrl:"",mode:"install",handleText:{}};export{ce as B,Dt as I,Tt as a,_t as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bJ as $,j as i,P as r,n as f,r as m,f as q,D as H,t as j,v as U,aO as E,cz as F,ch as P,q as M,cA as O,cB as B,cC as V,cp as J,cD as S,cE as N,as as z,Q as L,cg as W,C as X}from"./index-
|
|
1
|
+
import{bJ as $,j as i,P as r,n as f,r as m,f as q,D as H,t as j,v as U,aO as E,cz as F,ch as P,q as M,cA as O,cB as B,cC as V,cp as J,cD as S,cE as N,as as z,Q as L,cg as W,C as X}from"./index-BHdqgom8.js";import{R as Q}from"./index-ZTQq6T3W.js";import{C as A}from"./index-6hnZjYIo.js";import{b as Y}from"./sdk-Go6IWQIY.js";import{d as G}from"./CheckCircle-__Xpcyhc.js";import{w as K}from"./wrap-locale-D-OFTljj.js";const Z=$(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"}),"Inbox");function b({invitation:e,createPassportSvg:a,passportColor:c}){const[p,o]=m.useState(!1),{t}=m.useContext(q),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c}),[e,l]),x=m.useCallback(()=>{o(!0)},[]),s=m.useCallback(()=>{o(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(ee,{children:i.jsx("div",{className:"invite-passport__card",onClick:x,children:i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})})}),i.jsx(H,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:s,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(n=>i.jsx("li",{style:{listStyle:"circle"},children:n.description},n.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(Z,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}b.propTypes={invitation:r.object.isRequired,createPassportSvg:r.func.isRequired,passportColor:r.string};b.defaultProps={passportColor:"auto"};const ee=f.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
max-width: 350px;
|
|
4
4
|
margin: 30px auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aK as i,aL as o,j as s,g as u,fl as f}from"./index-
|
|
1
|
+
import{aK as i,aL as o,j as s,g as u,fl as f}from"./index-BHdqgom8.js";var e={},l=o;Object.defineProperty(e,"__esModule",{value:!0});var n=e.default=void 0,v=l(i()),d=s;n=e.default=(0,v.default)((0,d.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined");const a=f;var x=(t,r)=>a(t)===a(r);const h=u(x);export{n as d,h as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as r,eS as t}from"./index-
|
|
1
|
+
import{g as r,eS as t}from"./index-BHdqgom8.js";var u=t;function e(a,s){return u(a,s)}var o=e;const l=r(o);export{o as a,l as i};
|