@kanorio/elements 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/CustomerAccountPanel-FXJEOS4F.js +2 -0
- package/dist/CustomerAccountPanel-LK4GSYYU.js +2 -0
- package/dist/{FormAddressField-QR7ZCH77.js → FormAddressField-NH5LD6K7.js} +2 -2
- package/dist/{FormAddressField-C6VN7J6I.js → FormAddressField-Z5XT2ELO.js} +2 -2
- package/dist/FormFileField-5YFTKIRZ.js +2 -0
- package/dist/FormFileField-D2XIGIML.js +2 -0
- package/dist/{FormTaxIdField-K34MDUPW.js → FormTaxIdField-GGBQOVZE.js} +2 -2
- package/dist/{FormTaxIdField-XMK5WRQO.js → FormTaxIdField-XJSMW3II.js} +2 -2
- package/dist/KanorioAccount-GXRAMZCI.js +2 -0
- package/dist/KanorioAccount-P6IIPIZ2.js +2 -0
- package/dist/KanorioAnalytics-KYTK3T2L.js +2 -0
- package/dist/KanorioAnalytics-XHKBWYTS.js +2 -0
- package/dist/KanorioCurriculum-3TLNLUL4.js +2 -0
- package/dist/KanorioCurriculum-SQ4S3U5T.js +2 -0
- package/dist/KanorioForm-FDS5UKUT.js +2 -0
- package/dist/KanorioForm-K3H3YUQH.js +2 -0
- package/dist/KanorioLightbox-QPJQJLNO.js +2 -0
- package/dist/KanorioLightbox-WBMR7MLG.js +2 -0
- package/dist/KanorioLogin-JMHHBRU7.js +2 -0
- package/dist/KanorioLogin-QMPBTK55.js +2 -0
- package/dist/KanorioMedia-5P63OK4U.js +2 -0
- package/dist/KanorioMedia-LONTU7H2.js +2 -0
- package/dist/KanorioReviews-AAQ27MYU.js +2 -0
- package/dist/KanorioReviews-LUB4KF23.js +2 -0
- package/dist/KanorioUnit-ADFQ7POH.js +2 -0
- package/dist/KanorioUnit-YBKFHGLB.js +2 -0
- package/dist/{MediaPlayer-F43FPK4E.js → MediaPlayer-C5KI6N5V.js} +2 -2
- package/dist/{MediaPlayer-JHFZFOOG.js → MediaPlayer-PMAEZSCZ.js} +2 -2
- package/dist/{PDFViewerFull-INVHZL4V.js → PDFViewerFull-6MZJTHN2.js} +2 -2
- package/dist/{PDFViewerFull-CB44M7GW.js → PDFViewerFull-P3HCVGDZ.js} +2 -2
- package/dist/account.d.ts +3 -2
- package/dist/account.js +1 -1
- package/dist/analytics.js +1 -1
- package/dist/ar-JXAEXYYY.js +2 -0
- package/dist/ar-UXUCJCPY.js +2 -0
- package/dist/bg-EUIPVVBX.js +2 -0
- package/dist/bg-HEU3KGAJ.js +2 -0
- package/dist/{bn-BHRS66N3.js → bn-L35GOE5D.js} +2 -2
- package/dist/{bn-DM5WNGJ5.js → bn-LMQOF3SO.js} +2 -2
- package/dist/bot-protection.d.ts +67 -36
- package/dist/bot-protection.js +1 -1
- package/dist/chunk-2H3LTDAA.js +2 -0
- package/dist/chunk-3NXF6SCJ.js +2 -0
- package/dist/{chunk-EE4S6NRV.js → chunk-4OC7BRQS.js} +2 -2
- package/dist/{chunk-DTBRUBPG.js → chunk-56UUP6CI.js} +2 -2
- package/dist/{chunk-IAXVJLJ3.js → chunk-65RP744E.js} +2 -2
- package/dist/chunk-APWDEDWM.js +2 -0
- package/dist/{chunk-H7VP4BYY.js → chunk-CD7JDUB6.js} +2 -2
- package/dist/{chunk-4KA3HSRQ.js → chunk-CIVS7LYU.js} +2 -2
- package/dist/chunk-CMYBXWO5.js +3 -0
- package/dist/{chunk-WM5S3YN5.js → chunk-CTMHQZAU.js} +2 -2
- package/dist/chunk-D4KDA3KL.js +2 -0
- package/dist/{chunk-36YEGBKK.js → chunk-EGJ6SNTR.js} +2 -2
- package/dist/chunk-G5673RJK.js +3 -0
- package/dist/{chunk-2ONAW3CA.js → chunk-GWUOOGNK.js} +2 -2
- package/dist/{chunk-FQCA2VGY.js → chunk-HAHAYDYM.js} +2 -2
- package/dist/chunk-IDY2ZCXL.js +2 -0
- package/dist/{chunk-NGRNPVON.js → chunk-II7PVZWZ.js} +2 -2
- package/dist/chunk-J5SMJRYC.js +2 -0
- package/dist/{chunk-N5PIQM4L.js → chunk-KW2CH7SS.js} +2 -2
- package/dist/chunk-KYXZNMNA.js +2 -0
- package/dist/{chunk-QOQQCCID.js → chunk-L3BUSP27.js} +2 -2
- package/dist/{chunk-B7KLKVIM.js → chunk-L66F3USG.js} +2 -2
- package/dist/{chunk-NBDRYQZV.js → chunk-OLGITMLA.js} +2 -2
- package/dist/{chunk-BGVTMWPN.js → chunk-OWXGUUSI.js} +2 -2
- package/dist/chunk-Q4APVE7S.js +2 -0
- package/dist/chunk-QF55WZDP.js +2 -0
- package/dist/{chunk-4MOCTNN7.js → chunk-QRKYFFDH.js} +2 -2
- package/dist/chunk-QYTK2CW3.js +2 -0
- package/dist/chunk-R5M6FXXQ.js +2 -0
- package/dist/chunk-RI64PHGM.js +2 -0
- package/dist/chunk-RNRIZCZS.js +2 -0
- package/dist/chunk-RTF2NUMK.js +3 -0
- package/dist/chunk-SB5665ZK.js +2 -0
- package/dist/{chunk-5HWAL7VK.js → chunk-SGFVHVLE.js} +2 -2
- package/dist/{chunk-K4VRRKYJ.js → chunk-UDNUWN4W.js} +2 -2
- package/dist/{chunk-AF46NLXK.js → chunk-UITC3NFQ.js} +2 -2
- package/dist/chunk-VGQ2N7JH.js +2 -0
- package/dist/chunk-WJPCDZSL.js +2 -0
- package/dist/{chunk-LWRWKZBC.js → chunk-WKKPZXK3.js} +2 -2
- package/dist/{chunk-Z4OV6QHI.js → chunk-Y5JA6B5O.js} +2 -2
- package/dist/cs-LY4LE4NI.js +2 -0
- package/dist/cs-MGLMNU2K.js +2 -0
- package/dist/curriculum.d.ts +3 -2
- package/dist/curriculum.js +1 -1
- package/dist/da-LQTLZNBW.js +2 -0
- package/dist/da-X5HKEDEL.js +2 -0
- package/dist/de-M3M4VBDR.js +2 -0
- package/dist/de-Y5ELIZBU.js +2 -0
- package/dist/{deliverables-C5RD2ASE.js → deliverables-EOIAZFWB.js} +25 -25
- package/dist/{deliverables-BDS7WMBC.js → deliverables-NO5NEFRM.js} +2 -2
- package/dist/{el-SMBF7FG4.js → el-7YYYEHW6.js} +2 -2
- package/dist/{el-G2AWU43W.js → el-YZGS3PLP.js} +2 -2
- package/dist/elements.css +1 -1
- package/dist/en-AU-IUEA3YQP.js +2 -0
- package/dist/en-AU-RQ2DVIXE.js +2 -0
- package/dist/en-CA-OFK46Q44.js +2 -0
- package/dist/en-CA-QDP57WHG.js +2 -0
- package/dist/en-GB-URCOTEDK.js +2 -0
- package/dist/en-GB-VNG2IO2E.js +2 -0
- package/dist/en-JSBHSC4K.js +2 -0
- package/dist/en-MCRNEXQP.js +2 -0
- package/dist/en-US-5RT4SJ3V.js +2 -0
- package/dist/en-US-IWMVMSUT.js +2 -0
- package/dist/es-419-53Z5HI6Z.js +2 -0
- package/dist/es-419-JFUQ3D4V.js +2 -0
- package/dist/es-ES-BMD6JJEO.js +2 -0
- package/dist/es-ES-PBIVNTAT.js +2 -0
- package/dist/fa-57P7R77M.js +2 -0
- package/dist/{fa-OYP2Q5EV.js → fa-NE4XJTHW.js} +2 -2
- package/dist/fi-G5MG7VJ2.js +2 -0
- package/dist/fi-SCTIKRMX.js +2 -0
- package/dist/form.d.ts +393 -23
- package/dist/form.js +1 -1
- package/dist/{forms-answers-address-7P6EVFY5.js → forms-answers-address-5MXQYIH3.js} +2 -2
- package/dist/{forms-answers-address-IQV2Y56H.js → forms-answers-address-BGBI445K.js} +2 -2
- package/dist/{forms-answers-tax-id-WJD7K3PG.js → forms-answers-tax-id-3AYXCNP5.js} +2 -2
- package/dist/{forms-answers-tax-id-D4GOUC6N.js → forms-answers-tax-id-LSWOEHJ4.js} +2 -2
- package/dist/fr-CA-4X7URW4M.js +2 -0
- package/dist/fr-CA-RQDI3NIQ.js +2 -0
- package/dist/fr-FR-EDVHTVOW.js +2 -0
- package/dist/fr-FR-KGXOTINP.js +2 -0
- package/dist/{gu-BREQK3GJ.js → gu-7AJCL43I.js} +2 -2
- package/dist/{gu-RNCZTEOA.js → gu-QE53XIWR.js} +2 -2
- package/dist/he-UWYKIUPF.js +2 -0
- package/dist/he-VLGZUN42.js +2 -0
- package/dist/{hi-DKG5TPYX.js → hi-5M4U37GW.js} +2 -2
- package/dist/{hi-F7Y62LAZ.js → hi-KXKJMKZF.js} +2 -2
- package/dist/{hu-3Y5YEIFL.js → hu-JU7V3YQX.js} +2 -2
- package/dist/{hu-L6W5O2G5.js → hu-YRF3KPIJ.js} +2 -2
- package/dist/id-IRL2KCIE.js +2 -0
- package/dist/id-SXO4Z54V.js +2 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +1 -1
- package/dist/it-55QCLHB7.js +2 -0
- package/dist/it-RBRELRA3.js +2 -0
- package/dist/ja-2WRUVHKU.js +2 -0
- package/dist/ja-3HZPHYZS.js +2 -0
- package/dist/kanorio-elements.js +1 -1
- package/dist/{km-HPCMYWAG.js → km-EW4ISUB7.js} +2 -2
- package/dist/{km-PHVYTPLT.js → km-SL6MZB3H.js} +2 -2
- package/dist/{kn-QAWBGLHG.js → kn-RUSRJNGR.js} +2 -2
- package/dist/kn-YGEU3PSD.js +2 -0
- package/dist/ko-2GI6Z5YH.js +2 -0
- package/dist/ko-QK33QMU2.js +2 -0
- package/dist/{lightbox-DEvsB5dB.d.ts → lightbox-BmkHgtZg.d.ts} +1 -1
- package/dist/lightbox.d.ts +4 -3
- package/dist/lightbox.js +1 -1
- package/dist/{lo-JNUKFIQV.js → lo-PPDKXTQQ.js} +2 -2
- package/dist/{lo-YRHYLRZC.js → lo-ZRV6OAH6.js} +2 -2
- package/dist/login.d.ts +3 -2
- package/dist/login.js +1 -1
- package/dist/media.d.ts +3 -2
- package/dist/media.js +1 -1
- package/dist/{ml-QO64O4H6.js → ml-BIZEFHNR.js} +2 -2
- package/dist/{ml-3LXSDTNF.js → ml-KO2JGAL5.js} +2 -2
- package/dist/{mr-PLM72664.js → mr-J4AGQFC7.js} +2 -2
- package/dist/{mr-5WLN37JQ.js → mr-PZNRW5MW.js} +2 -2
- package/dist/{ms-PIAATVMD.js → ms-NYWKJQEQ.js} +2 -2
- package/dist/{ms-N544Y63H.js → ms-OMUKF5WC.js} +2 -2
- package/dist/{my-3J665CWK.js → my-FHI5JEQF.js} +2 -2
- package/dist/{my-6IKSM3XW.js → my-R4OXNUDW.js} +2 -2
- package/dist/nb-EC6AP76Y.js +2 -0
- package/dist/nb-U4QN5GJE.js +2 -0
- package/dist/{ne-ASFNHMO3.js → ne-DRPNDCZH.js} +2 -2
- package/dist/ne-J3XQJZAY.js +2 -0
- package/dist/nl-BE-QIH5K6WQ.js +2 -0
- package/dist/nl-BE-VHBDCIRF.js +2 -0
- package/dist/nl-NL-FZMZRVH4.js +2 -0
- package/dist/nl-NL-USXHXD5U.js +2 -0
- package/dist/nn-IPL74C6S.js +2 -0
- package/dist/nn-UCSEDGDB.js +2 -0
- package/dist/{pa-P2GAYL5A.js → pa-LTF7CWS2.js} +2 -2
- package/dist/{pa-VX5TUNDP.js → pa-NTK4KSUF.js} +2 -2
- package/dist/{phone-input-Q5AV6KSW.js → phone-input-DOL46AIF.js} +2 -2
- package/dist/{phone-input-T6QX2TDS.js → phone-input-PXLNDXAB.js} +2 -2
- package/dist/pl-6FXX3WNC.js +2 -0
- package/dist/pl-YWCG2YWW.js +2 -0
- package/dist/{provider-CMLzyAjJ.d.ts → provider-BYGVc6kS.d.ts} +3 -1
- package/dist/provider.d.ts +3 -2
- package/dist/provider.js +1 -1
- package/dist/pt-BR-5JRKIQVH.js +2 -0
- package/dist/pt-BR-CIJCMCLE.js +2 -0
- package/dist/pt-PT-A7F2KKCY.js +2 -0
- package/dist/pt-PT-Y2UCAKHP.js +2 -0
- package/dist/reviews.d.ts +3 -2
- package/dist/reviews.js +1 -1
- package/dist/ro-6MQF2KY2.js +2 -0
- package/dist/ro-YISUN7LU.js +2 -0
- package/dist/ru-KGU3SC3S.js +2 -0
- package/dist/ru-RMPFJQSL.js +2 -0
- package/dist/{si-5VUM5FGR.js → si-CTQN6I2M.js} +2 -2
- package/dist/{si-5F7RWQIE.js → si-N5U32GIL.js} +2 -2
- package/dist/sv-36EB3HIA.js +2 -0
- package/dist/sv-QGZRDKBJ.js +2 -0
- package/dist/sw-CWIRVHYD.js +2 -0
- package/dist/sw-OUQYTLJF.js +2 -0
- package/dist/{ta-MNWTH3F5.js → ta-E3ZBHC6A.js} +2 -2
- package/dist/{ta-R73RBA23.js → ta-N7BHKWBO.js} +2 -2
- package/dist/{te-5SBVH4OF.js → te-7JC2KGAU.js} +2 -2
- package/dist/{te-GVW56XDM.js → te-CTCZQKFU.js} +2 -2
- package/dist/{th-G6SY3D2Q.js → th-AN5CLQP6.js} +2 -2
- package/dist/{th-2GWK7DBB.js → th-JVK4E2AJ.js} +2 -2
- package/dist/tl-BSWGJB7O.js +2 -0
- package/dist/tl-X72423V3.js +2 -0
- package/dist/tr-22NUPSET.js +2 -0
- package/dist/tr-AZ2PLRZY.js +2 -0
- package/dist/{uk-PGHXMWJR.js → uk-POKPJJDZ.js} +2 -2
- package/dist/uk-UOTQJ3E7.js +2 -0
- package/dist/unit.d.ts +3 -1
- package/dist/unit.js +1 -1
- package/dist/{ur-4CR64XUI.js → ur-6LBRTMAE.js} +2 -2
- package/dist/{ur-J5HV4NTW.js → ur-NRHFTLO5.js} +2 -2
- package/dist/vi-3ZVAOXIJ.js +2 -0
- package/dist/vi-XC4CGJHX.js +2 -0
- package/dist/web-components.js +1 -1
- package/dist/zh-CN-EKEY2CLM.js +2 -0
- package/dist/zh-CN-XW3PLUG5.js +2 -0
- package/dist/zh-HK-25OZZBHO.js +2 -0
- package/dist/zh-HK-EPQAUBL3.js +2 -0
- package/dist/zh-Hant-LFJZCOMK.js +2 -0
- package/dist/zh-Hant-RQMTFZSE.js +2 -0
- package/package.json +2 -2
- package/dist/CustomerAccountPanel-DJKV7LT4.js +0 -2
- package/dist/CustomerAccountPanel-RWEHWBJY.js +0 -2
- package/dist/FormFileField-LZDCXI2Z.js +0 -2
- package/dist/FormFileField-ONL4Q55V.js +0 -2
- package/dist/KanorioAccount-EN3TM67X.js +0 -2
- package/dist/KanorioAccount-XGVSGVYN.js +0 -2
- package/dist/KanorioAnalytics-NEKTFQEE.js +0 -2
- package/dist/KanorioAnalytics-UMCUWQM7.js +0 -2
- package/dist/KanorioCurriculum-3QSCOHK7.js +0 -2
- package/dist/KanorioCurriculum-RUIGZ5X7.js +0 -2
- package/dist/KanorioForm-GUA5GEJY.js +0 -2
- package/dist/KanorioForm-KXV7D2TU.js +0 -2
- package/dist/KanorioLightbox-M72HNQQX.js +0 -2
- package/dist/KanorioLightbox-TQ3Q73TD.js +0 -2
- package/dist/KanorioLogin-5XFN3YEE.js +0 -2
- package/dist/KanorioLogin-AJHHVQGV.js +0 -2
- package/dist/KanorioMedia-ADKUDH5C.js +0 -2
- package/dist/KanorioMedia-DLBSXCKA.js +0 -2
- package/dist/KanorioReviews-42FZSXTI.js +0 -2
- package/dist/KanorioReviews-7LD5WKFG.js +0 -2
- package/dist/KanorioUnit-NWBX5DEI.js +0 -2
- package/dist/KanorioUnit-SIM3344J.js +0 -2
- package/dist/ar-3VA7IUCO.js +0 -2
- package/dist/ar-AUQCHHZG.js +0 -2
- package/dist/bg-IRGRVWOG.js +0 -2
- package/dist/bg-QWC2KG3G.js +0 -2
- package/dist/chunk-4BBERZ6T.js +0 -2
- package/dist/chunk-5AUWUK5R.js +0 -2
- package/dist/chunk-66XN5RR4.js +0 -2
- package/dist/chunk-EZMTUAQX.js +0 -2
- package/dist/chunk-FSY5GB5E.js +0 -3
- package/dist/chunk-G4U6BFZY.js +0 -2
- package/dist/chunk-GJY6AQIS.js +0 -2
- package/dist/chunk-IXDKZO42.js +0 -2
- package/dist/chunk-MIQK3T3Y.js +0 -2
- package/dist/chunk-QGR3QAQB.js +0 -3
- package/dist/chunk-SUXTLVTX.js +0 -2
- package/dist/chunk-UIHBR4NU.js +0 -3
- package/dist/chunk-WXIUWMFR.js +0 -2
- package/dist/cs-3IX2ZQKJ.js +0 -2
- package/dist/cs-NZW6FBFY.js +0 -2
- package/dist/da-AFMLFM32.js +0 -2
- package/dist/da-PZ32KKTE.js +0 -2
- package/dist/de-5JPEK4HF.js +0 -2
- package/dist/de-MVL4XGYR.js +0 -2
- package/dist/en-AIAENVLI.js +0 -2
- package/dist/en-AU-LB5UVGIW.js +0 -2
- package/dist/en-AU-Q2O2HPJ2.js +0 -2
- package/dist/en-CA-AZDOY7PW.js +0 -2
- package/dist/en-CA-PVKXM3WS.js +0 -2
- package/dist/en-GB-2N4WB6SL.js +0 -2
- package/dist/en-GB-Y5QRPC7S.js +0 -2
- package/dist/en-SAXQF5YW.js +0 -2
- package/dist/en-US-74L4OI3J.js +0 -2
- package/dist/en-US-EKS52JBW.js +0 -2
- package/dist/es-419-Q5IH6W5F.js +0 -2
- package/dist/es-419-VSZWGONE.js +0 -2
- package/dist/es-ES-7L55KPLO.js +0 -2
- package/dist/es-ES-ETSYFLPQ.js +0 -2
- package/dist/fa-WRJCKGS3.js +0 -2
- package/dist/fi-44ST6B6Q.js +0 -2
- package/dist/fi-J6NJBPNK.js +0 -2
- package/dist/fr-CA-KXRNFZBP.js +0 -2
- package/dist/fr-CA-PWWAPLBH.js +0 -2
- package/dist/fr-FR-FMLQPLOD.js +0 -2
- package/dist/fr-FR-MQAFE7IX.js +0 -2
- package/dist/he-GNC45OCB.js +0 -2
- package/dist/he-VXZCGAHY.js +0 -2
- package/dist/id-7DWHYYFC.js +0 -2
- package/dist/id-DCV57AQB.js +0 -2
- package/dist/it-7RASZ4SK.js +0 -2
- package/dist/it-JICU5WVL.js +0 -2
- package/dist/ja-4V7QJLTM.js +0 -2
- package/dist/ja-52MBIM3T.js +0 -2
- package/dist/kn-5DYCOYAN.js +0 -2
- package/dist/ko-55JV4VQK.js +0 -2
- package/dist/ko-FZIJZG6K.js +0 -2
- package/dist/nb-345ACUTX.js +0 -2
- package/dist/nb-F33WYJ6T.js +0 -2
- package/dist/ne-AAIECB2W.js +0 -2
- package/dist/nl-BE-SHZLAL5T.js +0 -2
- package/dist/nl-BE-WK4C6XRZ.js +0 -2
- package/dist/nl-NL-2YLHGJZL.js +0 -2
- package/dist/nl-NL-PHRY43UB.js +0 -2
- package/dist/nn-I5A2LCBH.js +0 -2
- package/dist/nn-S3SNETRB.js +0 -2
- package/dist/pl-4Y4BWTLT.js +0 -2
- package/dist/pl-SGPLZAER.js +0 -2
- package/dist/pt-BR-CW3MRSRP.js +0 -2
- package/dist/pt-BR-WKEKB5CG.js +0 -2
- package/dist/pt-PT-AJZQS2C6.js +0 -2
- package/dist/pt-PT-ZTPCI2K6.js +0 -2
- package/dist/ro-ANISGUFX.js +0 -2
- package/dist/ro-HRV64STT.js +0 -2
- package/dist/ru-7U566HR4.js +0 -2
- package/dist/ru-PKSZKOLH.js +0 -2
- package/dist/sv-HZVCM7LG.js +0 -2
- package/dist/sv-UOGO55PW.js +0 -2
- package/dist/sw-5XU65KFC.js +0 -2
- package/dist/sw-KVAYRFED.js +0 -2
- package/dist/tl-OCD2O6J3.js +0 -2
- package/dist/tl-PZNXANIM.js +0 -2
- package/dist/tr-2BDM6H5Q.js +0 -2
- package/dist/tr-VFMHVRQX.js +0 -2
- package/dist/uk-OQRACKKD.js +0 -2
- package/dist/vi-MQSOSIUY.js +0 -2
- package/dist/vi-U7OT2LM7.js +0 -2
- package/dist/zh-CN-CCYHPSVA.js +0 -2
- package/dist/zh-CN-RNW2BEY7.js +0 -2
- package/dist/zh-HK-HE2T63O2.js +0 -2
- package/dist/zh-HK-RKREDSAO.js +0 -2
- package/dist/zh-Hant-GBQLGJDF.js +0 -2
- package/dist/zh-Hant-T6KHSA5B.js +0 -2
package/dist/bot-protection.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
|
-
import { e as KanorioTheme } from './provider-
|
|
4
|
-
import '@kanorio/sdk';
|
|
3
|
+
import { e as KanorioTheme } from './provider-BYGVc6kS.js';
|
|
4
|
+
import '@kanorio/sdk/delivery';
|
|
5
|
+
import '@kanorio/sdk/customer';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Bot protection type definitions
|
|
@@ -29,23 +30,6 @@ interface BotProtectionData {
|
|
|
29
30
|
* Form protection strength
|
|
30
31
|
*/
|
|
31
32
|
type FormProtectionVariant = "standard" | "full";
|
|
32
|
-
/**
|
|
33
|
-
* Return value of the useBotProtection hook
|
|
34
|
-
*/
|
|
35
|
-
interface UseBotProtectionReturn {
|
|
36
|
-
/** Gets the protection data (for submitting the form) */
|
|
37
|
-
getProtectionData: () => BotProtectionData;
|
|
38
|
-
/** Whether protection is ready */
|
|
39
|
-
isReady: boolean;
|
|
40
|
-
/** Submitting is allowed only after the interaction delay following the first focus */
|
|
41
|
-
isSubmittable: boolean;
|
|
42
|
-
/** Registers a focus event (call it from a form field's onFocus) */
|
|
43
|
-
registerFocus: () => void;
|
|
44
|
-
/** Registers the ALTCHA payload (called by the widget when variant=full) */
|
|
45
|
-
registerAltchaPayload?: (payload: string) => void;
|
|
46
|
-
/** Resets the protection state (for filling the form in again) */
|
|
47
|
-
reset: () => void;
|
|
48
|
-
}
|
|
49
33
|
|
|
50
34
|
/**
|
|
51
35
|
* The registry of bot-protection entry points.
|
|
@@ -246,10 +230,37 @@ interface UseKanorioBotProtectionOptions extends Omit<UseBotProtectionOptions, "
|
|
|
246
230
|
siteUrl?: string;
|
|
247
231
|
}
|
|
248
232
|
/**
|
|
249
|
-
*
|
|
233
|
+
* What `useKanorioBotProtection` hands to `<KanorioBotProtection>` and `<KanorioBotProtectionAltcha>`: the honeypot and ALTCHA bindings,
|
|
234
|
+
* the site owner's third-party widget when the site uses one, and whether the site's provider is still being read.
|
|
250
235
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
236
|
+
interface KanorioBotProtectionFieldBindings extends BotProtectionFieldBindings {
|
|
237
|
+
/** The site's third-party widget (Turnstile, reCAPTCHA or hCaptcha); null when the site uses Kanorio's built-in check */
|
|
238
|
+
captcha: ThirdPartyCaptchaBinding | null;
|
|
239
|
+
/**
|
|
240
|
+
* True while the site's provider is still being read from `GET /site`: no check is drawn yet, so no proof of work is solved for nothing.
|
|
241
|
+
* If `GET /site` fails, the built-in check is drawn instead (most sites use it), so the form never waits forever.
|
|
242
|
+
*/
|
|
243
|
+
pending: boolean;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Public bot-protection hook: points the challenge and ALTCHA endpoints at the site's `{siteUrl}/api/form-protection/*`, and uses the
|
|
247
|
+
* provider the site owner chose under Site settings › Bot protection. `entry` defaults to `forms` (a Kanorio form submission); without
|
|
248
|
+
* `config`, the provider is read from `GET /site` (shared with the other elements on the page), and the check is drawn once it is known;
|
|
249
|
+
* if that read fails, the built-in check is drawn (a site that uses a third-party provider then rejects the submission with
|
|
250
|
+
* `verification_expired`, which the form shows, instead of a form that never becomes submittable).
|
|
251
|
+
* With a third-party provider, call `prepare()` before `getProtectionData()` (reCAPTCHA v3 fetches its token there) and
|
|
252
|
+
* `renewCaptcha()` once the server has answered a submit attempt (a third-party token works once). The exception is a lost
|
|
253
|
+
* response or `503 UPSTREAM_UNAVAILABLE`: send the same submission again with the same token, skipping both `prepare()` and
|
|
254
|
+
* `renewCaptcha()`, so the server recognises the retry and nothing is stored twice.
|
|
255
|
+
*/
|
|
256
|
+
declare function useKanorioBotProtection(options?: UseKanorioBotProtectionOptions): {
|
|
257
|
+
isReady: boolean;
|
|
258
|
+
isSubmittable: boolean;
|
|
259
|
+
fieldProps: KanorioBotProtectionFieldBindings;
|
|
260
|
+
getProtectionData: () => BotProtectionData;
|
|
261
|
+
registerFocus: () => void;
|
|
262
|
+
registerAltchaPayload?: (payload: string) => void;
|
|
263
|
+
reset: () => void;
|
|
253
264
|
challengeProps: BotProtectionChallengeBindings;
|
|
254
265
|
provider: BotProtectionProvider;
|
|
255
266
|
prepare: () => Promise<void>;
|
|
@@ -262,36 +273,56 @@ declare function useKanorioBotProtection(options?: UseKanorioBotProtectionOption
|
|
|
262
273
|
};
|
|
263
274
|
type BotProtectionThemeProps = {
|
|
264
275
|
/**
|
|
265
|
-
* The colour scheme of the
|
|
266
|
-
* `KanorioProvider`; otherwise the box keeps its light defaults (it sits in your form, whose colours it cannot know). Pass
|
|
267
|
-
* your form follows the
|
|
276
|
+
* The colour scheme of the site's check: `light`, `dark` or `auto`. Defaults to `light` or `dark` set on the surrounding
|
|
277
|
+
* `KanorioProvider`; otherwise the ALTCHA box keeps its light defaults (it sits in your form, whose colours it cannot know). Pass
|
|
278
|
+
* `auto` when your form follows the page: dark under an ancestor with the class `dark` or `data-theme="dark"`, otherwise the
|
|
279
|
+
* visitor's system. A Turnstile, reCAPTCHA or hCaptcha widget is drawn in this theme through the provider's own option (`auto` is
|
|
280
|
+
* resolved to light or dark by the same rule, and the widget is drawn again when the page or the system switches); without a theme
|
|
281
|
+
* it keeps the provider's default (Turnstile follows the system, reCAPTCHA and hCaptcha are light).
|
|
268
282
|
*/
|
|
269
283
|
theme?: KanorioTheme;
|
|
270
284
|
};
|
|
285
|
+
/** The site's check, from the `fieldProps` of `useKanorioBotProtection`; omitted (Kanorio's built-in check) when the props are written by hand */
|
|
286
|
+
type SiteCheckProps = Partial<Pick<KanorioBotProtectionFieldBindings, "captcha" | "pending">>;
|
|
271
287
|
/**
|
|
272
|
-
* Bot protection for a form you build yourself: the honeypot fields and,
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
288
|
+
* Bot protection for a form you build yourself: the honeypot fields and the site's check, which is the ALTCHA box (with
|
|
289
|
+
* `variant="full"`) or the Turnstile, reCAPTCHA or hCaptcha widget when the site owner chose one under Site settings › Bot protection.
|
|
290
|
+
* Spread the `fieldProps` of `useKanorioBotProtection` onto it and send `getProtectionData()` with your submission. Place it inside your
|
|
291
|
+
* `<form>`; it adds no wrapper element. The honeypots render at once (on the server too); the check appears once the hook knows the
|
|
292
|
+
* site's provider. The check is a part (your rules for `.kanorio-part` reach it) and takes the `theme` given to it or `light` / `dark`
|
|
293
|
+
* set on the provider; the ALTCHA box also takes the site brand of the surrounding `KanorioProvider`.
|
|
276
294
|
*
|
|
277
|
-
* `isSubmittable` turns true two seconds after the visitor first focuses the form (`registerFocus`) and
|
|
278
|
-
*
|
|
295
|
+
* `isSubmittable` turns true two seconds after the visitor first focuses the form (`registerFocus`) and once the check has passed
|
|
296
|
+
* (reCAPTCHA v3 has no box: it gets its token in `prepare()`).
|
|
279
297
|
*
|
|
280
298
|
* @example
|
|
281
299
|
* ```tsx
|
|
282
300
|
* const protection = useKanorioBotProtection({ context: formId });
|
|
283
|
-
*
|
|
301
|
+
* const client = forms.client({ siteUrl }); // from @kanorio/sdk
|
|
302
|
+
* // True after 503 UPSTREAM_UNAVAILABLE or a lost response (the SDK reports both as UPSTREAM_UNAVAILABLE): the next submit sends
|
|
303
|
+
* // the same token again, so the server recognises the retry
|
|
304
|
+
* const resendSame = useRef(false);
|
|
305
|
+
* async function onSubmit(event) {
|
|
306
|
+
* event.preventDefault();
|
|
307
|
+
* // reCAPTCHA v3 gets a new token in prepare(): not on a retry, or the server would take it for another submission
|
|
308
|
+
* if (!resendSame.current) await protection.prepare();
|
|
309
|
+
* const result = await client.submit(formId, { answers, protection: protection.getProtectionData() });
|
|
310
|
+
* resendSame.current = !result.ok && result.error.code === "UPSTREAM_UNAVAILABLE";
|
|
311
|
+
* if (!resendSame.current) protection.renewCaptcha();
|
|
312
|
+
* }
|
|
313
|
+
* <form onFocus={protection.registerFocus} onSubmit={onSubmit}>
|
|
284
314
|
* <KanorioBotProtection {...protection.fieldProps} />
|
|
285
315
|
* {yourFields}
|
|
286
316
|
* <button type="submit" disabled={!protection.isSubmittable}>Send</button>
|
|
287
317
|
* </form>
|
|
288
318
|
* ```
|
|
289
319
|
*/
|
|
290
|
-
declare function KanorioBotProtection({ theme, ...props }: ComponentProps<typeof BotProtectionFields> & BotProtectionThemeProps): react_jsx_runtime.JSX.Element;
|
|
320
|
+
declare function KanorioBotProtection({ theme, captcha, pending, ...props }: ComponentProps<typeof BotProtectionFields> & BotProtectionThemeProps & SiteCheckProps): react_jsx_runtime.JSX.Element;
|
|
291
321
|
/**
|
|
292
|
-
* The ALTCHA box
|
|
293
|
-
* `KanorioBotProtection` with `renderAltcha={false}` for the honeypots). Same
|
|
322
|
+
* The site's check alone (the ALTCHA box, or the site owner's third-party widget), for a form that places it apart from the honeypots
|
|
323
|
+
* (for example just before the submit button; render `KanorioBotProtection` with `renderAltcha={false}` for the honeypots). Same
|
|
324
|
+
* theme, brand and label rules as `KanorioBotProtection`.
|
|
294
325
|
*/
|
|
295
|
-
declare function KanorioBotProtectionAltcha({ theme, ...props }: Omit<ComponentProps<typeof BotProtectionAltcha>, "labels"> & BotProtectionThemeProps): react_jsx_runtime.JSX.Element;
|
|
326
|
+
declare function KanorioBotProtectionAltcha({ theme, captcha, pending, ...props }: Omit<ComponentProps<typeof BotProtectionAltcha>, "labels"> & BotProtectionThemeProps & SiteCheckProps): react_jsx_runtime.JSX.Element | null;
|
|
296
327
|
|
|
297
328
|
export { KanorioBotProtection, KanorioBotProtectionAltcha, type UseKanorioBotProtectionOptions, useKanorioBotProtection };
|
package/dist/bot-protection.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{KanorioBotProtection,KanorioBotProtectionAltcha,useKanorioBotProtection}from"./chunk-
|
|
1
|
+
import{KanorioBotProtection,KanorioBotProtectionAltcha,useKanorioBotProtection}from"./chunk-J5SMJRYC.js";import"./chunk-KYXZNMNA.js";import"./chunk-RKEHHJDU.js";import"./chunk-JH5D6YJX.js";import"./chunk-VUTODQFX.js";import"./chunk-QRKYFFDH.js";import"./chunk-KNNN5V3T.js";import"./chunk-763LNERD.js";import"./chunk-U7H3W23Q.js";import"./chunk-RI64PHGM.js";import"./chunk-Q4APVE7S.js";import"./chunk-CU2JJTXI.js";import"./chunk-3ZTUZPSD.js";export{KanorioBotProtection,KanorioBotProtectionAltcha,useKanorioBotProtection};
|
|
2
2
|
//# sourceMappingURL=bot-protection.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as c}from"./chunk-UM74DXPE.js";function m(t,e=Date.now()){if(t.status==="ARCHIVED")return"closed";let{openAt:n,closeAt:r,maxSubmissions:s}=t.settings;return r&&new Date(r).getTime()<=e?"closed":n&&new Date(n).getTime()>e?"not_open":s!==void 0&&t.submissionCount>=s?"full":"open"}var f=["short_text","long_text","email","phone","choice","date","time","file","rating","number","url","statement","address","tax_id"];function g(t){return typeof t=="string"&&f.includes(t)}function b(t){return g(t)&&t!=="statement"}var y=c("form").map(t=>t.mime),I={PATTERN_MESSAGE_MAX:200,MAX_FIELDS:30,MAX_OPTIONS:20,LABEL_MAX:200,DESCRIPTION_MAX:500,SHORT_TEXT_MAX:500,LONG_TEXT_MAX:5e3,MAX_FILES_PER_FIELD:3,FILE_MAX_BYTES:10*1024*1024,SUBMIT_BODY_MAX_CHARS:256*1024,STATEMENT_MAX:1e3,DATE_OFFSET_MAX:3650,MAX_HIDDEN_FIELDS:10,HIDDEN_VALUE_MAX:500};function h(t,e){if(!t)return null;if(t.type==="date")return t.value;if(!e)return null;let[n,r,s]=e.split("-").map(Number);return!n||!r||!s?null:new Date(Date.UTC(n,r-1,s+t.offsetDays)).toISOString().slice(0,10)}function A(t,e){let n=t.consentText?.[e]?.trim();return n||null}function _(t,e){return t.replaceAll("{siteName}",e.siteName?.trim()||"").replaceAll("{button}",e.button).replace(/\s{2,}/g," ")}function M(t,e,n){let r=t.marketingConsent;if(r==="off")return null;let s=A(t,r);if(s)return s;let o=r==="checkbox"?e.marketingOptIn:e.subscribeOnSubmit;return _(o,{siteName:n,button:t.submitLabel||e.submit})}var x=2048,R=4096,F="\\{(submissionId|answers\\.([a-z0-9][a-z0-9_-]*))\\}",u=()=>new RegExp(F,"g");function p(t){return u().test(t??"")}function S(t,e={}){if(typeof t!="string")return null;let n=t.trim();if(!n||n.length>(e.maxLength??x)||/[\r\n\0\s]/.test(n))return null;let r=p(n),s=r?n.replace(u(),"x"):n;if(/[{}]/.test(s))return null;if(n.startsWith("/"))return n.startsWith("//")||n.startsWith("/\\")||n.includes("\\")?null:{kind:"path",url:n};try{let o=new URL(s);if(o.protocol!=="https:"||o.username||o.password)return null;if(!r)return{kind:"absolute",url:o.toString()};let i=/^https:\/\//i.test(n)?n.slice(8):null;if(i===null)return null;let l=i.search(/[/?#]/),a=l===-1?i:i.slice(0,l);return!a||p(a)||d(n.replace(u(),"a1"))!==d(n.replace(u(),"b2.example"))?null:{kind:"absolute",url:n}}catch{return null}}function d(t){try{let e=new URL(t);return e.protocol==="https:"&&!e.username&&!e.password?e.origin:null}catch{return null}}function N(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return typeof e.countryCode=="string"&&typeof e.value=="string"}function O(t){return!!t&&typeof t=="object"&&!Array.isArray(t)&&typeof t.countryCode=="string"}export{m as a,g as b,b as c,I as d,h as e,M as f,R as g,p as h,S as i,N as j,O as k};
|
|
2
|
+
//# sourceMappingURL=chunk-2H3LTDAA.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{useAdoptTypedOnMount,useComposingEnterGuard,useControlRef}from"./chunk-C7HUM2EN.js";import{BotProtectionChallenge,BotProtectionFields,useBotProtection}from"./chunk-IXDKZO42.js";import{TONE_BG_TINT_HOVER,TONE_BG_TINT_STRONG}from"./chunk-RKEHHJDU.js";import{ArrowLeft,BookOpen,Check,Copy,FingerprintPattern,KeyRound,LoaderCircle,LogOut,ShoppingBag,User}from"./chunk-33AQQY6T.js";import{cn}from"./chunk-VUTODQFX.js";import{fillLabel}from"./chunk-KNNN5V3T.js";import{useCallback,useEffect as useEffect2,useMemo,useRef as useRef2,useState as useState2}from"react";var CUSTOMER_TEXT_CLASS="text-[var(--site-fg,#18181b)]";var CUSTOMER_MUTED_TEXT_CLASS="text-[var(--site-fg-muted,#71717a)]";var CUSTOMER_LABEL_CLASS=`mb-1.5 block text-sm font-medium ${CUSTOMER_TEXT_CLASS}`;var CUSTOMER_HINT_CLASS=`text-sm ${CUSTOMER_MUTED_TEXT_CLASS}`;var CUSTOMER_ERROR_CLASS="mt-1 text-sm text-red-600 dark:text-red-400";var CUSTOMER_INPUT_BASE_CLASS="min-h-11 rounded-[var(--site-radius-lg,0.5rem)] border border-[var(--site-border,rgba(0,0,0,0.12))] bg-[var(--site-surface,#ffffff)] px-3 text-[length:var(--site-input-text,16px)] text-[var(--site-fg,#18181b)] outline-none transition placeholder:text-[var(--site-fg-muted,#71717a)] focus:border-[var(--site-fg-muted,#71717a)] focus:ring-2 focus:ring-[color-mix(in_srgb,var(--brand-color,#18181b)_35%,transparent)] disabled:cursor-not-allowed disabled:opacity-60";var CUSTOMER_INPUT_CLASS=`w-full ${CUSTOMER_INPUT_BASE_CLASS}`;var CUSTOMER_INPUT_INVALID_CLASS="border-red-400 hover:border-red-400 focus:border-red-400 dark:border-red-500 dark:hover:border-red-500 dark:focus:border-red-500";function customerInputClass(invalid,extra){return cn(CUSTOMER_INPUT_CLASS,invalid&&CUSTOMER_INPUT_INVALID_CLASS,extra)}var BUTTON_BASE_CLASS="inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[var(--site-radius-button,0.75rem)] text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-color,#18181b)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--site-surface,#ffffff)] disabled:cursor-not-allowed disabled:opacity-60";var BUTTON_VARIANT_CLASS={primary:"bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)] hover:brightness-110",secondary:"border border-[var(--site-border,rgba(0,0,0,0.12))] bg-transparent text-[var(--site-fg,#18181b)] "+TONE_BG_TINT_HOVER,ghost:"bg-transparent text-[var(--site-fg-muted,#71717a)] hover:text-[var(--site-fg,#18181b)] "+TONE_BG_TINT_HOVER,danger:"border border-red-300 bg-transparent text-red-700 hover:bg-red-50 dark:border-red-800 dark:text-red-300 dark:hover:bg-red-950/40"};var BUTTON_SIZE_CLASS={md:"min-h-11 px-4",lg:"min-h-12 px-5"};function customerButtonClass(options){return[BUTTON_BASE_CLASS,BUTTON_VARIANT_CLASS[options?.variant??"primary"],BUTTON_SIZE_CLASS[options?.size??"md"],options?.block?"flex w-full":"",options?.extra??""].filter(Boolean).join(" ")}var CUSTOMER_CARD_CLASS="rounded-[var(--site-radius-card,1rem)] border border-[var(--site-border,rgba(0,0,0,0.12))] bg-[var(--site-surface,#ffffff)] text-[var(--site-fg,#18181b)]";var CUSTOMER_DIVIDER_CLASS="border-t border-[var(--site-border,rgba(0,0,0,0.12))]";var CUSTOMER_ERROR_BANNER_CLASS="rounded-[var(--site-radius-lg,0.5rem)] border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300";var BADGE_TONE_CLASS={neutral:"text-[var(--site-fg,#18181b)] "+TONE_BG_TINT_STRONG,success:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",warning:"bg-amber-50 text-amber-800 dark:bg-amber-950/40 dark:text-amber-300",danger:"bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-300",info:"bg-sky-50 text-sky-700 dark:bg-sky-950/40 dark:text-sky-300",brand:"bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)]"};function customerBadgeClass(tone="neutral"){return`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium ${BADGE_TONE_CLASS[tone]}`}var CUSTOMER_INLINE_ACTION_CLASS=`inline-flex cursor-pointer items-center gap-1.5 text-sm font-medium transition hover:text-[var(--site-fg,#18181b)] disabled:cursor-not-allowed disabled:opacity-60 ${CUSTOMER_MUTED_TEXT_CLASS}`;import{forwardRef}from"react";import{jsx,jsxs}from"react/jsx-runtime";var CustomerButton=forwardRef(function CustomerButton2({variant,size,block,loading,leading,className,disabled,type="button",children,...props},ref){return jsxs("button",{ref,type,disabled:disabled||loading,"aria-busy":loading||void 0,className:customerButtonClass({variant,size,block,extra:className}),...props,children:[loading?jsx(LoaderCircle,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):leading,children]})});import{useEffect,useId,useRef,useState}from"react";import{jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";function CustomerCodeInput({length=6,value,onChange,onComplete,disabled,invalid,autoFocus,label,id,className}){const generatedId=useId();const inputId=id??generatedId;const inputRef=useRef(null);const[focused,setFocused]=useState(false);const completedRef=useRef(null);const digits=value.replace(/\D/g,"").slice(0,length);useEffect(()=>{if(digits.length===length&&completedRef.current!==digits){completedRef.current=digits;onComplete?.(digits)}if(digits.length<length)completedRef.current=null},[digits,length,onComplete]);const handlePaste=event=>{const pasted=event.clipboardData.getData("text").replace(/\D/g,"").slice(0,length);if(pasted){event.preventDefault();onChange(pasted)}};const handleKeyDown=event=>{if(event.key==="Enter")return};const cells=Array.from({length},(_,index)=>digits[index]??"");const activeIndex=Math.min(digits.length,length-1);return jsxs2("div",{className:cn("relative",className),onClick:()=>inputRef.current?.focus(),children:[jsx2("div",{className:"flex gap-2","aria-hidden":"true",children:cells.map((char,index)=>{const isActive=focused&&index===activeIndex&&!disabled;return jsx2("div",{className:cn("flex h-12 min-w-0 flex-1 items-center justify-center rounded-[var(--site-radius-lg,0.5rem)] border bg-[var(--site-surface,#ffffff)] font-mono text-xl font-semibold text-[var(--site-fg,#18181b)] transition",invalid?"border-red-400 dark:border-red-500":isActive?"border-[var(--brand-color,#18181b)] ring-2 ring-[color-mix(in_srgb,var(--brand-color,#18181b)_35%,transparent)]":"border-[var(--site-border,rgba(0,0,0,0.12))]",disabled&&"opacity-60"),children:char||(isActive?jsx2("span",{className:"h-6 w-px animate-pulse bg-[var(--site-fg,#18181b)]"}):null)},index)})}),jsx2("input",{ref:inputRef,id:inputId,type:"text",inputMode:"numeric",pattern:"[0-9]*",autoComplete:"one-time-code",maxLength:length,value:digits,disabled,autoFocus,"aria-label":label,"aria-invalid":invalid||void 0,onChange:event=>onChange(event.target.value.replace(/\D/g,"").slice(0,length)),onPaste:handlePaste,onKeyDown:handleKeyDown,onFocus:()=>setFocused(true),onBlur:()=>setFocused(false),className:"absolute inset-0 h-full w-full cursor-text opacity-0"})]})}import{forwardRef as forwardRef2,useId as useId2}from"react";import{jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";function CustomerField({label,hint,error,labelTrailing,htmlFor,className,children}){return jsxs3("div",{className,children:[jsxs3("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[jsx3("label",{htmlFor,className:cn(CUSTOMER_LABEL_CLASS,"mb-0"),children:label}),labelTrailing]}),children,error?jsx3("p",{className:CUSTOMER_ERROR_CLASS,role:"alert",children:error}):hint?jsx3("p",{className:cn(CUSTOMER_HINT_CLASS,"mt-1"),children:hint}):null]})}var CustomerInput=forwardRef2(function CustomerInput2({invalid,className,id,onKeyDown,onCompositionStart,onCompositionEnd,...props},ref){const generatedId=useId2();const ime=useComposingEnterGuard({onKeyDown,onCompositionStart,onCompositionEnd});const control=useControlRef(ref);useAdoptTypedOnMount(control.ref,props.onChange);return jsx3("input",{ref:control.setRef,id:id??generatedId,"aria-invalid":invalid||void 0,className:customerInputClass(invalid,className),...ime.props,...props})});import{jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";function GoogleIcon({className}){return jsxs4("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className,role:"img","aria-label":"Google",children:[jsx4("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"var(--platform-icon-mono, #4285F4)"}),jsx4("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"var(--platform-icon-mono, #34A853)"}),jsx4("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"var(--platform-icon-mono, #FBBC05)"}),jsx4("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"var(--platform-icon-mono, #EA4335)"})]})}var storefrontAccountRoutes={index:"/account",login:"/account/login",orders:"/account/orders",order:id=>`/account/orders/${id}`,content:"/account/content",contentItem:deliverableId=>`/account/content/${encodeURIComponent(deliverableId)}`,courses:"/account/courses",settings:"/account/settings",profile:"/account/profile",devices:"/account/devices",apiSession:"/account/api/session",apiChallenge:"/account/api/challenge",apiVerify:"/account/api/verify",apiOauthStart:"/account/api/oauth/start",apiOauth2Authorize:"/account/api/oauth2/authorize",apiPasskeyLoginOptions:"/account/api/auth/passkey/options",apiPasskeyLoginVerify:"/account/api/auth/passkey/verify",apiPasskeys:"/account/api/passkeys",apiPasskey:passkeyId=>`/account/api/passkeys/${encodeURIComponent(passkeyId)}`,apiPasskeyRegisterOptions:"/account/api/passkeys/register/options",apiPasskeyRegister:"/account/api/passkeys/register",apiProfile:"/account/api/profile",apiEmailChange:"/account/api/email-change",apiEmailChangeVerify:"/account/api/email-change/verify",apiAddresses:"/account/api/addresses",apiAddress:addressId=>`/account/api/addresses/${encodeURIComponent(addressId)}`,apiAddressDefault:addressId=>`/account/api/addresses/${encodeURIComponent(addressId)}/default`,apiTaxIdentities:"/account/api/tax-identities",apiTaxIdentity:taxIdentityId=>`/account/api/tax-identities/${encodeURIComponent(taxIdentityId)}`,apiConsents:"/account/api/consents",apiData:"/account/api/data",apiErasure:"/account/api/erasure",apiContentOpen:contentId=>`/account/api/content/${encodeURIComponent(contentId)}/open`,apiContentQuiz:unitId=>`/account/api/content/${encodeURIComponent(unitId)}/quiz`,apiContentTranscript:unitId=>`/account/api/content/${encodeURIComponent(unitId)}/transcript`,apiProgress:"/account/api/progress",apiCertificate:deliverableId=>`/account/api/deliverables/${encodeURIComponent(deliverableId)}/certificate`,apiOrderReceipt:orderId=>`/account/api/orders/${encodeURIComponent(orderId)}/receipt`};var CUSTOMER_SESSION_HINT_COOKIE_NAME="knr_customer";var CUSTOMER_AUTH_METHODS=["passkey","google","apple","line","kakao","external_oidc","email_code","email_link"];var AVAILABLE_CUSTOMER_AUTH_METHODS=["passkey","google","email_code","email_link"];var REQUIRED_CUSTOMER_AUTH_METHOD="email_code";var DEFAULT_CUSTOMER_AUTH_METHODS=["email_code","email_link"];function isCustomerAuthMethod(value){return typeof value==="string"&&CUSTOMER_AUTH_METHODS.includes(value)}function normalizeCustomerAuthMethods(raw){const picked=new Set(Array.isArray(raw)?raw.filter(isCustomerAuthMethod).filter(m=>AVAILABLE_CUSTOMER_AUTH_METHODS.includes(m)):DEFAULT_CUSTOMER_AUTH_METHODS);picked.add(REQUIRED_CUSTOMER_AUTH_METHOD);return CUSTOMER_AUTH_METHODS.filter(m=>picked.has(m))}function sanitizeCustomerReturnTo(raw,fallback=storefrontAccountRoutes.index){if(typeof raw!=="string")return fallback;const trimmed=raw.trim();if(!trimmed||trimmed.length>512)return fallback;if(!trimmed.startsWith("/")||trimmed.startsWith("//")||trimmed.startsWith("/\\")){return fallback}if(/[\r\n\0]/.test(trimmed)||/^[a-z][a-z0-9+.-]*:/i.test(trimmed)){return fallback}return trimmed}function defineCustomerPortalSection(definition){return definition}var CUSTOMER_PORTAL_SECTIONS=[defineCustomerPortalSection({id:"orders",order:10,route:storefrontAccountRoutes.orders,navLabelKey:"orders",icon:"shopping-bag",apiResourcePrefixes:["/orders","/reviews"],visibility:"capability"}),defineCustomerPortalSection({id:"content",order:20,route:storefrontAccountRoutes.content,navLabelKey:"content",icon:"book-open",apiResourcePrefixes:["/deliverables","/units","/progress","/access"],visibility:"capability"}),defineCustomerPortalSection({id:"account",order:90,route:storefrontAccountRoutes.settings,navLabelKey:"account",icon:"user",apiResourcePrefixes:["/me","/session","/sessions","/email-change","/addresses","/tax-identities","/consents","/passkeys","/data","/erasure"],visibility:"always"})];function visibleCustomerPortalSections(states){const visible=new Set(states.filter(state=>state.visible).map(state=>state.id));return[...CUSTOMER_PORTAL_SECTIONS].filter(section=>visible.has(section.id)).sort((a,b)=>a.order-b.order)}function isMetaInAppByUrlOrReferrer(searchParams,referrer){const utmSource=searchParams?.get("utm_source")?.toLowerCase()??"";if(/^(ig|instagram|threads|fb|facebook)/.test(utmSource))return true;const ref=(referrer??"").toLowerCase();const metaReferrerPatterns=[/threads\.net/i,/threads\.com/i,/instagram\.com/i,/m\.facebook\.com/i,/l\.facebook\.com/i,/lm\.facebook\.com/i];return metaReferrerPatterns.some(p=>p.test(ref))}function isInAppBrowser(options){if(typeof navigator==="undefined")return false;const ua=navigator.userAgent?.toLowerCase()??"";const inAppPatterns=[/\bbarcelona\b/i,/fban|fbav/i,/fb_iab/i,/fb_iab\/threads|fban\/threads|fbios.*threads/i,/instagram/i,/threads/i,/fbios/i,/line\//i,/wechat/i,/micromessenger/i,/twitter/i,/linkedin/i,/reddit/i,/pinterest/i,/discord/i,/snapchat/i,/tiktok/i,/kakaotalk/i,/naver/i,/webview/i];if(inAppPatterns.some(pattern=>pattern.test(ua)))return true;if(options&&isMetaInAppByUrlOrReferrer(options.searchParams,options.referrer)){return true}return false}var NETWORK_ERROR_CODE="NETWORK_ERROR";async function readCustomerAuthResponse(res,fallbackCode){const data=await res.json().catch(()=>null);if(!res.ok||!data?.ok){return{ok:false,code:data?.code??fallbackCode,...typeof data?.retryAfter==="number"?{retryAfter:data.retryAfter}:{}}}return data}async function postJson(url,body,fallbackCode){try{const res=await fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(body??{})});return await readCustomerAuthResponse(res,fallbackCode)}catch{return{ok:false,code:NETWORK_ERROR_CODE}}}function createHostedCustomerAuthTransport(){const r=storefrontAccountRoutes;return{altchaChallengeUrl:"/api/form-protection/altcha",challengeUrl:"/api/form-protection/challenge",requestChallenge:({email,locale,returnTo,protection})=>postJson(r.apiChallenge,{email,locale,returnTo,...protection},"SERVER_ERROR"),verifyCode:({email,code})=>postJson(r.apiVerify,{method:"code",email,code},"INVALID_CODE"),verifyToken:({method,token})=>postJson(r.apiVerify,{method,token},"CODE_EXPIRED"),startOauth:({method,returnTo,locale})=>postJson(r.apiOauthStart,{method,returnTo,locale},"METHOD_DISABLED"),passkeyLoginOptions:()=>postJson(r.apiPasskeyLoginOptions,{},"SERVER_ERROR"),passkeyLoginVerify:input=>postJson(r.apiPasskeyLoginVerify,input,"PASSKEY_FAILED"),listPasskeys:async()=>{try{const res=await fetch(r.apiPasskeys,{credentials:"same-origin"});return await readCustomerAuthResponse(res,"UNAUTHENTICATED")}catch{return{ok:false,code:NETWORK_ERROR_CODE}}},passkeyRegisterOptions:()=>postJson(r.apiPasskeyRegisterOptions,{},"SERVER_ERROR"),passkeyRegister:input=>postJson(r.apiPasskeyRegister,input,"PASSKEY_FAILED"),session:async()=>{const res=await fetch(r.apiSession,{credentials:"same-origin"});if(res.status===401)return null;if(!res.ok)throw new Error(`HTTP ${res.status}`);const json=await res.json();if(!json?.ok||!json.contact)return null;return{contact:json.contact,sections:json.sections??[],landing:json.landing??r.index}},signOut:async()=>{await fetch(r.apiSession,{method:"DELETE",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({mode:"current"})}).catch(()=>void 0)}}}var CUSTOMER_AUTH_SILENT_CODES=new Set(["PASSKEY_CANCELLED"]);function customerAuthErrorMessage(code,messages){switch((code??"").toUpperCase()){case"INVALID_EMAIL":return messages.errorInvalidEmail;case"INVALID_CODE":return messages.errorInvalidCode;case"CODE_EXPIRED":return messages.errorCodeExpired;case"TOO_MANY_ATTEMPTS":return messages.errorTooManyAttempts;case"ACCOUNT_BLOCKED":return messages.errorAccountBlocked;case"RATE_LIMITED":return messages.errorRateLimited;case"BOT_PROTECTION_FAILED":return messages.errorBotProtection;case"SIGNUP_DISABLED":return messages.errorSignupDisabled;case"SEND_FAILED":return messages.errorSendFailed;case"METHOD_DISABLED":return messages.errorMethodDisabled;case"EMAIL_NOT_VERIFIED":return messages.errorEmailNotVerified;case"NO_EMAIL":return messages.errorNoEmail;case"PROVIDER_DENIED":case"TOKEN_EXCHANGE_FAILED":case"INVALID_ID_TOKEN":case"INVALID_STATE":return messages.errorProviderFailed;case"PASSKEY_UNSUPPORTED":return messages.errorPasskeyUnsupported;case"PASSKEY_FAILED":case"NOT_FOUND":case"VERIFY_FAILED":case"CHALLENGE_EXPIRED":case"NO_HOST":return messages.errorPasskeyFailed;case"ALREADY_REGISTERED":return messages.errorPasskeyAlreadyRegistered;case"SERVICE_UNAVAILABLE":return messages.errorServiceUnavailable;case"SHARED_SENDER_PAUSED":return messages.errorEmailSignInPaused;case NETWORK_ERROR_CODE:case"SERVER_ERROR":default:return messages.errorGeneric}}function bufferToBase64URLString(buffer){const bytes=new Uint8Array(buffer);let str="";for(const charCode of bytes){str+=String.fromCharCode(charCode)}const base64String=btoa(str);return base64String.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function base64URLStringToBuffer(base64URLString){const base64=base64URLString.replace(/-/g,"+").replace(/_/g,"/");const padLength=(4-base64.length%4)%4;const padded=base64.padEnd(base64.length+padLength,"=");const binary=atob(padded);const buffer=new ArrayBuffer(binary.length);const bytes=new Uint8Array(buffer);for(let i=0;i<binary.length;i++){bytes[i]=binary.charCodeAt(i)}return buffer}function browserSupportsWebAuthn(){return _browserSupportsWebAuthnInternals.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==="function")}var _browserSupportsWebAuthnInternals={stubThis:value=>value};function toPublicKeyCredentialDescriptor(descriptor){const{id}=descriptor;return{...descriptor,id:base64URLStringToBuffer(id),transports:descriptor.transports,type:descriptor.type}}function isValidDomain(hostname){return hostname==="localhost"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(hostname)}var WebAuthnError=class extends Error{constructor({message,code,cause,name}){super(message,{cause});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});this.name=name??cause.name;this.code=code}};function identifyRegistrationError({error,options}){const{publicKey}=options;if(!publicKey){throw Error("options was missing required publicKey property")}if(error.name==="AbortError"){if(options.signal instanceof AbortSignal){return new WebAuthnError({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:error})}}else if(error.name==="ConstraintError"){if(publicKey.authenticatorSelection?.requireResidentKey===true){return new WebAuthnError({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:error})}else if(options.mediation==="conditional"&&publicKey.authenticatorSelection?.userVerification==="required"){return new WebAuthnError({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:error})}else if(publicKey.authenticatorSelection?.userVerification==="required"){return new WebAuthnError({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:error})}}else if(error.name==="InvalidStateError"){return new WebAuthnError({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:error})}else if(error.name==="NotAllowedError"){return new WebAuthnError({message:error.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:error})}else if(error.name==="NotSupportedError"){const validPubKeyCredParams=publicKey.pubKeyCredParams.filter(param=>param.type==="public-key");if(validPubKeyCredParams.length===0){return new WebAuthnError({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:error})}return new WebAuthnError({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:error})}else if(error.name==="SecurityError"){const effectiveDomain=globalThis.location.hostname;if(!isValidDomain(effectiveDomain)){return new WebAuthnError({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:error})}else if(publicKey.rp.id!==effectiveDomain){return new WebAuthnError({message:`The RP ID "${publicKey.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:error})}}else if(error.name==="TypeError"){if(publicKey.user.id.byteLength<1||publicKey.user.id.byteLength>64){return new WebAuthnError({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:error})}}else if(error.name==="UnknownError"){return new WebAuthnError({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:error})}return error}var BaseWebAuthnAbortService=class{constructor(){Object.defineProperty(this,"controller",{enumerable:true,configurable:true,writable:true,value:void 0})}createNewAbortSignal(){if(this.controller){const abortError=new Error("Cancelling existing WebAuthn API call for new one");abortError.name="AbortError";this.controller.abort(abortError)}const newController=new AbortController;this.controller=newController;return newController.signal}cancelCeremony(){if(this.controller){const abortError=new Error("Manually cancelling existing WebAuthn API call");abortError.name="AbortError";this.controller.abort(abortError);this.controller=void 0}}};var WebAuthnAbortService=new BaseWebAuthnAbortService;var attachments=["cross-platform","platform"];function toAuthenticatorAttachment(attachment){if(!attachment){return}if(attachments.indexOf(attachment)<0){return}return attachment}async function startRegistration(options){if(!options.optionsJSON&&options.challenge){console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.");options={optionsJSON:options}}const{optionsJSON,useAutoRegister=false}=options;if(!browserSupportsWebAuthn()){throw new Error("WebAuthn is not supported in this browser")}const publicKey={...optionsJSON,challenge:base64URLStringToBuffer(optionsJSON.challenge),user:{...optionsJSON.user,id:base64URLStringToBuffer(optionsJSON.user.id)},excludeCredentials:optionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor)};const createOptions={};if(useAutoRegister){createOptions.mediation="conditional"}createOptions.publicKey=publicKey;createOptions.signal=WebAuthnAbortService.createNewAbortSignal();let credential;try{credential=await navigator.credentials.create(createOptions)}catch(err){throw identifyRegistrationError({error:err,options:createOptions})}if(!credential){throw new Error("Registration was not completed")}const{id,rawId,response,type}=credential;let transports=void 0;if(typeof response.getTransports==="function"){transports=response.getTransports()}let responsePublicKeyAlgorithm=void 0;if(typeof response.getPublicKeyAlgorithm==="function"){try{responsePublicKeyAlgorithm=response.getPublicKeyAlgorithm()}catch(error){warnOnBrokenImplementation("getPublicKeyAlgorithm()",error)}}let responsePublicKey=void 0;if(typeof response.getPublicKey==="function"){try{const _publicKey=response.getPublicKey();if(_publicKey!==null){responsePublicKey=bufferToBase64URLString(_publicKey)}}catch(error){warnOnBrokenImplementation("getPublicKey()",error)}}let responseAuthenticatorData;if(typeof response.getAuthenticatorData==="function"){try{responseAuthenticatorData=bufferToBase64URLString(response.getAuthenticatorData())}catch(error){warnOnBrokenImplementation("getAuthenticatorData()",error)}}return{id,rawId:bufferToBase64URLString(rawId),response:{attestationObject:bufferToBase64URLString(response.attestationObject),clientDataJSON:bufferToBase64URLString(response.clientDataJSON),transports,publicKeyAlgorithm:responsePublicKeyAlgorithm,publicKey:responsePublicKey,authenticatorData:responseAuthenticatorData},type,clientExtensionResults:credential.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(credential.authenticatorAttachment)}}function warnOnBrokenImplementation(methodName,cause){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.
|
|
1
|
+
import{useAdoptTypedOnMount,useComposingEnterGuard,useControlRef}from"./chunk-C7HUM2EN.js";import{BotProtectionChallenge,BotProtectionFields,useBotProtection}from"./chunk-KYXZNMNA.js";import{TONE_BG_TINT_HOVER,TONE_BG_TINT_STRONG}from"./chunk-RKEHHJDU.js";import{ArrowLeft,BookOpen,Check,Copy,FingerprintPattern,KeyRound,LoaderCircle,LogOut,ShoppingBag,User}from"./chunk-33AQQY6T.js";import{cn}from"./chunk-VUTODQFX.js";import{fillLabel}from"./chunk-KNNN5V3T.js";import{useCallback,useEffect as useEffect2,useMemo,useRef as useRef2,useState as useState2}from"react";var CUSTOMER_TEXT_CLASS="text-[var(--site-fg,#18181b)]";var CUSTOMER_MUTED_TEXT_CLASS="text-[var(--site-fg-muted,#71717a)]";var CUSTOMER_LABEL_CLASS=`mb-1.5 block text-sm font-medium ${CUSTOMER_TEXT_CLASS}`;var CUSTOMER_HINT_CLASS=`text-sm ${CUSTOMER_MUTED_TEXT_CLASS}`;var CUSTOMER_ERROR_CLASS="mt-1 text-sm text-red-600 dark:text-red-400";var CUSTOMER_INPUT_BASE_CLASS="min-h-11 rounded-[var(--site-radius-lg,0.5rem)] border border-[var(--site-border,rgba(0,0,0,0.12))] bg-[var(--site-surface,#ffffff)] px-3 text-[length:var(--site-input-text,16px)] text-[var(--site-fg,#18181b)] outline-none transition placeholder:text-[var(--site-fg-muted,#71717a)] focus:border-[var(--site-fg-muted,#71717a)] focus:ring-2 focus:ring-[color-mix(in_srgb,var(--brand-color,#18181b)_35%,transparent)] disabled:cursor-not-allowed disabled:opacity-60";var CUSTOMER_INPUT_CLASS=`w-full ${CUSTOMER_INPUT_BASE_CLASS}`;var CUSTOMER_INPUT_INVALID_CLASS="border-red-400 hover:border-red-400 focus:border-red-400 dark:border-red-500 dark:hover:border-red-500 dark:focus:border-red-500";function customerInputClass(invalid,extra){return cn(CUSTOMER_INPUT_CLASS,invalid&&CUSTOMER_INPUT_INVALID_CLASS,extra)}var BUTTON_BASE_CLASS="inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[var(--site-radius-button,0.75rem)] text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-color,#18181b)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--site-surface,#ffffff)] disabled:cursor-not-allowed disabled:opacity-60";var BUTTON_VARIANT_CLASS={primary:"bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)] hover:brightness-110",secondary:"border border-[var(--site-border,rgba(0,0,0,0.12))] bg-transparent text-[var(--site-fg,#18181b)] "+TONE_BG_TINT_HOVER,ghost:"bg-transparent text-[var(--site-fg-muted,#71717a)] hover:text-[var(--site-fg,#18181b)] "+TONE_BG_TINT_HOVER,danger:"border border-red-300 bg-transparent text-red-700 hover:bg-red-50 dark:border-red-800 dark:text-red-300 dark:hover:bg-red-950/40"};var BUTTON_SIZE_CLASS={md:"min-h-11 px-4",lg:"min-h-12 px-5"};function customerButtonClass(options){return[BUTTON_BASE_CLASS,BUTTON_VARIANT_CLASS[options?.variant??"primary"],BUTTON_SIZE_CLASS[options?.size??"md"],options?.block?"flex w-full":"",options?.extra??""].filter(Boolean).join(" ")}var CUSTOMER_CARD_CLASS="rounded-[var(--site-radius-card,1rem)] border border-[var(--site-border,rgba(0,0,0,0.12))] bg-[var(--site-surface,#ffffff)] text-[var(--site-fg,#18181b)]";var CUSTOMER_DIVIDER_CLASS="border-t border-[var(--site-border,rgba(0,0,0,0.12))]";var CUSTOMER_ERROR_BANNER_CLASS="rounded-[var(--site-radius-lg,0.5rem)] border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300";var BADGE_TONE_CLASS={neutral:"text-[var(--site-fg,#18181b)] "+TONE_BG_TINT_STRONG,success:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",warning:"bg-amber-50 text-amber-800 dark:bg-amber-950/40 dark:text-amber-300",danger:"bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-300",info:"bg-sky-50 text-sky-700 dark:bg-sky-950/40 dark:text-sky-300",brand:"bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)]"};function customerBadgeClass(tone="neutral"){return`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium ${BADGE_TONE_CLASS[tone]}`}var CUSTOMER_INLINE_ACTION_CLASS=`inline-flex cursor-pointer items-center gap-1.5 text-sm font-medium transition hover:text-[var(--site-fg,#18181b)] disabled:cursor-not-allowed disabled:opacity-60 ${CUSTOMER_MUTED_TEXT_CLASS}`;import{forwardRef}from"react";import{jsx,jsxs}from"react/jsx-runtime";var CustomerButton=forwardRef(function CustomerButton2({variant,size,block,loading,leading,className,disabled,type="button",children,...props},ref){return jsxs("button",{ref,type,disabled:disabled||loading,"aria-busy":loading||void 0,className:customerButtonClass({variant,size,block,extra:className}),...props,children:[loading?jsx(LoaderCircle,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):leading,children]})});import{useEffect,useId,useRef,useState}from"react";import{jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";function CustomerCodeInput({length=6,value,onChange,onComplete,disabled,invalid,autoFocus,label,id,className}){const generatedId=useId();const inputId=id??generatedId;const inputRef=useRef(null);const[focused,setFocused]=useState(false);const completedRef=useRef(null);const digits=value.replace(/\D/g,"").slice(0,length);useEffect(()=>{if(digits.length===length&&completedRef.current!==digits){completedRef.current=digits;onComplete?.(digits)}if(digits.length<length)completedRef.current=null},[digits,length,onComplete]);const handlePaste=event=>{const pasted=event.clipboardData.getData("text").replace(/\D/g,"").slice(0,length);if(pasted){event.preventDefault();onChange(pasted)}};const handleKeyDown=event=>{if(event.key==="Enter")return};const cells=Array.from({length},(_,index)=>digits[index]??"");const activeIndex=Math.min(digits.length,length-1);return jsxs2("div",{className:cn("relative",className),onClick:()=>inputRef.current?.focus(),children:[jsx2("div",{className:"flex gap-2","aria-hidden":"true",children:cells.map((char,index)=>{const isActive=focused&&index===activeIndex&&!disabled;return jsx2("div",{className:cn("flex h-12 min-w-0 flex-1 items-center justify-center rounded-[var(--site-radius-lg,0.5rem)] border bg-[var(--site-surface,#ffffff)] font-mono text-xl font-semibold text-[var(--site-fg,#18181b)] transition",invalid?"border-red-400 dark:border-red-500":isActive?"border-[var(--brand-color,#18181b)] ring-2 ring-[color-mix(in_srgb,var(--brand-color,#18181b)_35%,transparent)]":"border-[var(--site-border,rgba(0,0,0,0.12))]",disabled&&"opacity-60"),children:char||(isActive?jsx2("span",{className:"h-6 w-px animate-pulse bg-[var(--site-fg,#18181b)]"}):null)},index)})}),jsx2("input",{ref:inputRef,id:inputId,type:"text",inputMode:"numeric",pattern:"[0-9]*",autoComplete:"one-time-code",maxLength:length,value:digits,disabled,autoFocus,"aria-label":label,"aria-invalid":invalid||void 0,onChange:event=>onChange(event.target.value.replace(/\D/g,"").slice(0,length)),onPaste:handlePaste,onKeyDown:handleKeyDown,onFocus:()=>setFocused(true),onBlur:()=>setFocused(false),className:"absolute inset-0 h-full w-full cursor-text opacity-0"})]})}import{forwardRef as forwardRef2,useId as useId2}from"react";import{jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";function CustomerField({label,hint,error,labelTrailing,htmlFor,className,children}){return jsxs3("div",{className,children:[jsxs3("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[jsx3("label",{htmlFor,className:cn(CUSTOMER_LABEL_CLASS,"mb-0"),children:label}),labelTrailing]}),children,error?jsx3("p",{className:CUSTOMER_ERROR_CLASS,role:"alert",children:error}):hint?jsx3("p",{className:cn(CUSTOMER_HINT_CLASS,"mt-1"),children:hint}):null]})}var CustomerInput=forwardRef2(function CustomerInput2({invalid,className,id,onKeyDown,onCompositionStart,onCompositionEnd,...props},ref){const generatedId=useId2();const ime=useComposingEnterGuard({onKeyDown,onCompositionStart,onCompositionEnd});const control=useControlRef(ref);useAdoptTypedOnMount(control.ref,props.onChange);return jsx3("input",{ref:control.setRef,id:id??generatedId,"aria-invalid":invalid||void 0,className:customerInputClass(invalid,className),...ime.props,...props})});import{jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";function GoogleIcon({className}){return jsxs4("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className,role:"img","aria-label":"Google",children:[jsx4("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"var(--platform-icon-mono, #4285F4)"}),jsx4("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"var(--platform-icon-mono, #34A853)"}),jsx4("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"var(--platform-icon-mono, #FBBC05)"}),jsx4("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"var(--platform-icon-mono, #EA4335)"})]})}var storefrontAccountRoutes={index:"/account",login:"/account/login",orders:"/account/orders",order:id=>`/account/orders/${id}`,content:"/account/content",contentItem:deliverableId=>`/account/content/${encodeURIComponent(deliverableId)}`,courses:"/account/courses",settings:"/account/settings",profile:"/account/profile",devices:"/account/devices",apiSession:"/account/api/session",apiChallenge:"/account/api/challenge",apiVerify:"/account/api/verify",apiOauthStart:"/account/api/oauth/start",apiOauth2Authorize:"/account/api/oauth2/authorize",apiPasskeyLoginOptions:"/account/api/auth/passkey/options",apiPasskeyLoginVerify:"/account/api/auth/passkey/verify",apiPasskeys:"/account/api/passkeys",apiPasskey:passkeyId=>`/account/api/passkeys/${encodeURIComponent(passkeyId)}`,apiPasskeyRegisterOptions:"/account/api/passkeys/register/options",apiPasskeyRegister:"/account/api/passkeys/register",apiProfile:"/account/api/profile",apiEmailChange:"/account/api/email-change",apiEmailChangeVerify:"/account/api/email-change/verify",apiAddresses:"/account/api/addresses",apiAddress:addressId=>`/account/api/addresses/${encodeURIComponent(addressId)}`,apiAddressDefault:addressId=>`/account/api/addresses/${encodeURIComponent(addressId)}/default`,apiTaxIdentities:"/account/api/tax-identities",apiTaxIdentity:taxIdentityId=>`/account/api/tax-identities/${encodeURIComponent(taxIdentityId)}`,apiConsents:"/account/api/consents",apiData:"/account/api/data",apiErasure:"/account/api/erasure",apiContentOpen:contentId=>`/account/api/content/${encodeURIComponent(contentId)}/open`,apiContentQuiz:unitId=>`/account/api/content/${encodeURIComponent(unitId)}/quiz`,apiContentTranscript:unitId=>`/account/api/content/${encodeURIComponent(unitId)}/transcript`,apiProgress:"/account/api/progress",apiCertificate:deliverableId=>`/account/api/deliverables/${encodeURIComponent(deliverableId)}/certificate`,apiOrderReceipt:orderId=>`/account/api/orders/${encodeURIComponent(orderId)}/receipt`};var CUSTOMER_SESSION_HINT_COOKIE_NAME="knr_customer";var CUSTOMER_AUTH_METHODS=["passkey","google","apple","line","kakao","external_oidc","email_code","email_link"];var AVAILABLE_CUSTOMER_AUTH_METHODS=["passkey","google","email_code","email_link"];var REQUIRED_CUSTOMER_AUTH_METHOD="email_code";var DEFAULT_CUSTOMER_AUTH_METHODS=["email_code","email_link"];function isCustomerAuthMethod(value){return typeof value==="string"&&CUSTOMER_AUTH_METHODS.includes(value)}function normalizeCustomerAuthMethods(raw){const picked=new Set(Array.isArray(raw)?raw.filter(isCustomerAuthMethod).filter(m=>AVAILABLE_CUSTOMER_AUTH_METHODS.includes(m)):DEFAULT_CUSTOMER_AUTH_METHODS);picked.add(REQUIRED_CUSTOMER_AUTH_METHOD);return CUSTOMER_AUTH_METHODS.filter(m=>picked.has(m))}function sanitizeCustomerReturnTo(raw,fallback=storefrontAccountRoutes.index){if(typeof raw!=="string")return fallback;const trimmed=raw.trim();if(!trimmed||trimmed.length>512)return fallback;if(!trimmed.startsWith("/")||trimmed.startsWith("//")||trimmed.startsWith("/\\")){return fallback}if(/[\r\n\0]/.test(trimmed)||/^[a-z][a-z0-9+.-]*:/i.test(trimmed)){return fallback}return trimmed}function defineCustomerPortalSection(definition){return definition}var CUSTOMER_PORTAL_SECTIONS=[defineCustomerPortalSection({id:"orders",order:10,route:storefrontAccountRoutes.orders,navLabelKey:"orders",icon:"shopping-bag",apiResourcePrefixes:["/orders","/reviews"],visibility:"capability"}),defineCustomerPortalSection({id:"content",order:20,route:storefrontAccountRoutes.content,navLabelKey:"content",icon:"book-open",apiResourcePrefixes:["/deliverables","/units","/progress","/access"],visibility:"capability"}),defineCustomerPortalSection({id:"account",order:90,route:storefrontAccountRoutes.settings,navLabelKey:"account",icon:"user",apiResourcePrefixes:["/me","/session","/sessions","/email-change","/addresses","/tax-identities","/consents","/passkeys","/data","/erasure"],visibility:"always"})];function visibleCustomerPortalSections(states){const visible=new Set(states.filter(state=>state.visible).map(state=>state.id));return[...CUSTOMER_PORTAL_SECTIONS].filter(section=>visible.has(section.id)).sort((a,b)=>a.order-b.order)}function isMetaInAppByUrlOrReferrer(searchParams,referrer){const utmSource=searchParams?.get("utm_source")?.toLowerCase()??"";if(/^(ig|instagram|threads|fb|facebook)/.test(utmSource))return true;const ref=(referrer??"").toLowerCase();const metaReferrerPatterns=[/threads\.net/i,/threads\.com/i,/instagram\.com/i,/m\.facebook\.com/i,/l\.facebook\.com/i,/lm\.facebook\.com/i];return metaReferrerPatterns.some(p=>p.test(ref))}function isInAppBrowser(options){if(typeof navigator==="undefined")return false;const ua=navigator.userAgent?.toLowerCase()??"";const inAppPatterns=[/\bbarcelona\b/i,/fban|fbav/i,/fb_iab/i,/fb_iab\/threads|fban\/threads|fbios.*threads/i,/instagram/i,/threads/i,/fbios/i,/line\//i,/wechat/i,/micromessenger/i,/twitter/i,/linkedin/i,/reddit/i,/pinterest/i,/discord/i,/snapchat/i,/tiktok/i,/kakaotalk/i,/naver/i,/webview/i];if(inAppPatterns.some(pattern=>pattern.test(ua)))return true;if(options&&isMetaInAppByUrlOrReferrer(options.searchParams,options.referrer)){return true}return false}var NETWORK_ERROR_CODE="NETWORK_ERROR";async function readCustomerAuthResponse(res,fallbackCode){const data=await res.json().catch(()=>null);if(!res.ok||!data?.ok){return{ok:false,code:data?.code??fallbackCode,...typeof data?.retryAfter==="number"?{retryAfter:data.retryAfter}:{}}}return data}async function postJson(url,body,fallbackCode){try{const res=await fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(body??{})});return await readCustomerAuthResponse(res,fallbackCode)}catch{return{ok:false,code:NETWORK_ERROR_CODE}}}function createHostedCustomerAuthTransport(){const r=storefrontAccountRoutes;return{altchaChallengeUrl:"/api/form-protection/altcha",challengeUrl:"/api/form-protection/challenge",requestChallenge:({email,locale,returnTo,protection})=>postJson(r.apiChallenge,{email,locale,returnTo,...protection},"SERVER_ERROR"),verifyCode:({email,code})=>postJson(r.apiVerify,{method:"code",email,code},"INVALID_CODE"),verifyToken:({method,token})=>postJson(r.apiVerify,{method,token},"CODE_EXPIRED"),startOauth:({method,returnTo,locale})=>postJson(r.apiOauthStart,{method,returnTo,locale},"METHOD_DISABLED"),passkeyLoginOptions:()=>postJson(r.apiPasskeyLoginOptions,{},"SERVER_ERROR"),passkeyLoginVerify:input=>postJson(r.apiPasskeyLoginVerify,input,"PASSKEY_FAILED"),listPasskeys:async()=>{try{const res=await fetch(r.apiPasskeys,{credentials:"same-origin"});return await readCustomerAuthResponse(res,"UNAUTHENTICATED")}catch{return{ok:false,code:NETWORK_ERROR_CODE}}},passkeyRegisterOptions:()=>postJson(r.apiPasskeyRegisterOptions,{},"SERVER_ERROR"),passkeyRegister:input=>postJson(r.apiPasskeyRegister,input,"PASSKEY_FAILED"),session:async()=>{const res=await fetch(r.apiSession,{credentials:"same-origin"});if(res.status===401)return null;if(!res.ok)throw new Error(`HTTP ${res.status}`);const json=await res.json();if(!json?.ok||!json.contact)return null;return{contact:json.contact,sections:json.sections??[],landing:json.landing??r.index}},signOut:async()=>{await fetch(r.apiSession,{method:"DELETE",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({mode:"current"})}).catch(()=>void 0)}}}var CUSTOMER_AUTH_SILENT_CODES=new Set(["PASSKEY_CANCELLED"]);function customerAuthErrorMessage(code,messages){switch((code??"").toUpperCase()){case"INVALID_EMAIL":return messages.errorInvalidEmail;case"INVALID_CODE":return messages.errorInvalidCode;case"CODE_EXPIRED":return messages.errorCodeExpired;case"TOO_MANY_ATTEMPTS":return messages.errorTooManyAttempts;case"ACCOUNT_BLOCKED":return messages.errorAccountBlocked;case"RATE_LIMITED":return messages.errorRateLimited;case"BOT_PROTECTION_FAILED":return messages.errorBotProtection;case"SIGNUP_DISABLED":return messages.errorSignupDisabled;case"SEND_FAILED":return messages.errorSendFailed;case"METHOD_DISABLED":return messages.errorMethodDisabled;case"EMAIL_NOT_VERIFIED":return messages.errorEmailNotVerified;case"NO_EMAIL":return messages.errorNoEmail;case"PROVIDER_DENIED":case"TOKEN_EXCHANGE_FAILED":case"INVALID_ID_TOKEN":case"INVALID_STATE":return messages.errorProviderFailed;case"PASSKEY_UNSUPPORTED":return messages.errorPasskeyUnsupported;case"PASSKEY_FAILED":case"NOT_FOUND":case"VERIFY_FAILED":case"CHALLENGE_EXPIRED":case"NO_HOST":return messages.errorPasskeyFailed;case"ALREADY_REGISTERED":return messages.errorPasskeyAlreadyRegistered;case"SERVICE_UNAVAILABLE":return messages.errorServiceUnavailable;case"SHARED_SENDER_PAUSED":return messages.errorEmailSignInPaused;case NETWORK_ERROR_CODE:case"SERVER_ERROR":default:return messages.errorGeneric}}function bufferToBase64URLString(buffer){const bytes=new Uint8Array(buffer);let str="";for(const charCode of bytes){str+=String.fromCharCode(charCode)}const base64String=btoa(str);return base64String.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function base64URLStringToBuffer(base64URLString){const base64=base64URLString.replace(/-/g,"+").replace(/_/g,"/");const padLength=(4-base64.length%4)%4;const padded=base64.padEnd(base64.length+padLength,"=");const binary=atob(padded);const buffer=new ArrayBuffer(binary.length);const bytes=new Uint8Array(buffer);for(let i=0;i<binary.length;i++){bytes[i]=binary.charCodeAt(i)}return buffer}function browserSupportsWebAuthn(){return _browserSupportsWebAuthnInternals.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==="function")}var _browserSupportsWebAuthnInternals={stubThis:value=>value};function toPublicKeyCredentialDescriptor(descriptor){const{id}=descriptor;return{...descriptor,id:base64URLStringToBuffer(id),transports:descriptor.transports,type:descriptor.type}}function isValidDomain(hostname){return hostname==="localhost"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(hostname)}var WebAuthnError=class extends Error{constructor({message,code,cause,name}){super(message,{cause});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});this.name=name??cause.name;this.code=code}};function identifyRegistrationError({error,options}){const{publicKey}=options;if(!publicKey){throw Error("options was missing required publicKey property")}if(error.name==="AbortError"){if(options.signal instanceof AbortSignal){return new WebAuthnError({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:error})}}else if(error.name==="ConstraintError"){if(publicKey.authenticatorSelection?.requireResidentKey===true){return new WebAuthnError({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:error})}else if(options.mediation==="conditional"&&publicKey.authenticatorSelection?.userVerification==="required"){return new WebAuthnError({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:error})}else if(publicKey.authenticatorSelection?.userVerification==="required"){return new WebAuthnError({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:error})}}else if(error.name==="InvalidStateError"){return new WebAuthnError({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:error})}else if(error.name==="NotAllowedError"){return new WebAuthnError({message:error.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:error})}else if(error.name==="NotSupportedError"){const validPubKeyCredParams=publicKey.pubKeyCredParams.filter(param=>param.type==="public-key");if(validPubKeyCredParams.length===0){return new WebAuthnError({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:error})}return new WebAuthnError({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:error})}else if(error.name==="SecurityError"){const effectiveDomain=globalThis.location.hostname;if(!isValidDomain(effectiveDomain)){return new WebAuthnError({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:error})}else if(publicKey.rp.id!==effectiveDomain){return new WebAuthnError({message:`The RP ID "${publicKey.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:error})}}else if(error.name==="TypeError"){if(publicKey.user.id.byteLength<1||publicKey.user.id.byteLength>64){return new WebAuthnError({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:error})}}else if(error.name==="UnknownError"){return new WebAuthnError({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:error})}return error}var BaseWebAuthnAbortService=class{constructor(){Object.defineProperty(this,"controller",{enumerable:true,configurable:true,writable:true,value:void 0})}createNewAbortSignal(){if(this.controller){const abortError=new Error("Cancelling existing WebAuthn API call for new one");abortError.name="AbortError";this.controller.abort(abortError)}const newController=new AbortController;this.controller=newController;return newController.signal}cancelCeremony(){if(this.controller){const abortError=new Error("Manually cancelling existing WebAuthn API call");abortError.name="AbortError";this.controller.abort(abortError);this.controller=void 0}}};var WebAuthnAbortService=new BaseWebAuthnAbortService;var attachments=["cross-platform","platform"];function toAuthenticatorAttachment(attachment){if(!attachment){return}if(attachments.indexOf(attachment)<0){return}return attachment}async function startRegistration(options){if(!options.optionsJSON&&options.challenge){console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.");options={optionsJSON:options}}const{optionsJSON,useAutoRegister=false}=options;if(!browserSupportsWebAuthn()){throw new Error("WebAuthn is not supported in this browser")}const publicKey={...optionsJSON,challenge:base64URLStringToBuffer(optionsJSON.challenge),user:{...optionsJSON.user,id:base64URLStringToBuffer(optionsJSON.user.id)},excludeCredentials:optionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor)};const createOptions={};if(useAutoRegister){createOptions.mediation="conditional"}createOptions.publicKey=publicKey;createOptions.signal=WebAuthnAbortService.createNewAbortSignal();let credential;try{credential=await navigator.credentials.create(createOptions)}catch(err){throw identifyRegistrationError({error:err,options:createOptions})}if(!credential){throw new Error("Registration was not completed")}const{id,rawId,response,type}=credential;let transports=void 0;if(typeof response.getTransports==="function"){transports=response.getTransports()}let responsePublicKeyAlgorithm=void 0;if(typeof response.getPublicKeyAlgorithm==="function"){try{responsePublicKeyAlgorithm=response.getPublicKeyAlgorithm()}catch(error){warnOnBrokenImplementation("getPublicKeyAlgorithm()",error)}}let responsePublicKey=void 0;if(typeof response.getPublicKey==="function"){try{const _publicKey=response.getPublicKey();if(_publicKey!==null){responsePublicKey=bufferToBase64URLString(_publicKey)}}catch(error){warnOnBrokenImplementation("getPublicKey()",error)}}let responseAuthenticatorData;if(typeof response.getAuthenticatorData==="function"){try{responseAuthenticatorData=bufferToBase64URLString(response.getAuthenticatorData())}catch(error){warnOnBrokenImplementation("getAuthenticatorData()",error)}}return{id,rawId:bufferToBase64URLString(rawId),response:{attestationObject:bufferToBase64URLString(response.attestationObject),clientDataJSON:bufferToBase64URLString(response.clientDataJSON),transports,publicKeyAlgorithm:responsePublicKeyAlgorithm,publicKey:responsePublicKey,authenticatorData:responseAuthenticatorData},type,clientExtensionResults:credential.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(credential.authenticatorAttachment)}}function warnOnBrokenImplementation(methodName,cause){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.
|
|
2
2
|
`,cause)}function browserSupportsWebAuthnAutofill(){if(!browserSupportsWebAuthn()){return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise(resolve=>resolve(false)))}const globalPublicKeyCredential=globalThis.PublicKeyCredential;if(globalPublicKeyCredential?.isConditionalMediationAvailable===void 0){return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise(resolve=>resolve(false)))}return _browserSupportsWebAuthnAutofillInternals.stubThis(globalPublicKeyCredential.isConditionalMediationAvailable())}var _browserSupportsWebAuthnAutofillInternals={stubThis:value=>value};function identifyAuthenticationError({error,options}){const{publicKey}=options;if(!publicKey){throw Error("options was missing required publicKey property")}if(error.name==="AbortError"){if(options.signal instanceof AbortSignal){return new WebAuthnError({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:error})}}else if(error.name==="NotAllowedError"){return new WebAuthnError({message:error.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:error})}else if(error.name==="SecurityError"){const effectiveDomain=globalThis.location.hostname;if(!isValidDomain(effectiveDomain)){return new WebAuthnError({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:error})}else if(publicKey.rpId!==effectiveDomain){return new WebAuthnError({message:`The RP ID "${publicKey.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:error})}}else if(error.name==="UnknownError"){return new WebAuthnError({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:error})}return error}async function startAuthentication(options){if(!options.optionsJSON&&options.challenge){console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.");options={optionsJSON:options}}const{optionsJSON,useBrowserAutofill=false,verifyBrowserAutofillInput=true}=options;if(!browserSupportsWebAuthn()){throw new Error("WebAuthn is not supported in this browser")}let allowCredentials;if(optionsJSON.allowCredentials?.length!==0){allowCredentials=optionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor)}const publicKey={...optionsJSON,challenge:base64URLStringToBuffer(optionsJSON.challenge),allowCredentials};const getOptions={};if(useBrowserAutofill){if(!await browserSupportsWebAuthnAutofill()){throw Error("Browser does not support WebAuthn autofill")}const eligibleInputs=document.querySelectorAll("input[autocomplete$='webauthn']");if(eligibleInputs.length<1&&verifyBrowserAutofillInput){throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected')}getOptions.mediation="conditional";publicKey.allowCredentials=[]}getOptions.publicKey=publicKey;getOptions.signal=WebAuthnAbortService.createNewAbortSignal();let credential;try{credential=await navigator.credentials.get(getOptions)}catch(err){throw identifyAuthenticationError({error:err,options:getOptions})}if(!credential){throw new Error("Authentication was not completed")}const{id,rawId,response,type}=credential;let userHandle=void 0;if(response.userHandle){userHandle=bufferToBase64URLString(response.userHandle)}return{id,rawId:bufferToBase64URLString(rawId),response:{authenticatorData:bufferToBase64URLString(response.authenticatorData),clientDataJSON:bufferToBase64URLString(response.clientDataJSON),signature:bufferToBase64URLString(response.signature),userHandle},type,clientExtensionResults:credential.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(credential.authenticatorAttachment)}}async function getBrowserCapabilities(){if(typeof PublicKeyCredential.getClientCapabilities==="function"){const capabilities=await PublicKeyCredential.getClientCapabilities();let _userVerifyingPlatformAuthenticator=mapCapabilityToEnum(capabilities.userVerifyingPlatformAuthenticator);if(_userVerifyingPlatformAuthenticator==="unknown"&&typeof PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable==="function"){const isUVPAA=await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();if(isUVPAA){_userVerifyingPlatformAuthenticator="supported"}else{_userVerifyingPlatformAuthenticator="unsupported"}}let _conditionalGet=mapCapabilityToEnum(capabilities.conditionalGet);if(_conditionalGet==="unknown"&&typeof PublicKeyCredential.isConditionalMediationAvailable==="function"){const isCMA=await PublicKeyCredential.isConditionalMediationAvailable();if(isCMA){_conditionalGet="supported"}else{_conditionalGet="unsupported"}}return _getBrowserCapabilitiesInternals.stubThis({conditionalCreate:mapCapabilityToEnum(capabilities.conditionalCreate),conditionalGet:_conditionalGet,hybridTransport:mapCapabilityToEnum(capabilities.hybridTransport),passkeyPlatformAuthenticator:mapCapabilityToEnum(capabilities.passkeyPlatformAuthenticator),userVerifyingPlatformAuthenticator:_userVerifyingPlatformAuthenticator,relatedOrigins:mapCapabilityToEnum(capabilities.relatedOrigins),signalAllAcceptedCredentials:mapCapabilityToEnum(capabilities.signalAllAcceptedCredentials),signalCurrentUserDetails:mapCapabilityToEnum(capabilities.signalCurrentUserDetails),signalUnknownCredential:mapCapabilityToEnum(capabilities.signalUnknownCredential)})}return _getBrowserCapabilitiesInternals.stubThis({conditionalCreate:"unknown",conditionalGet:"unknown",hybridTransport:"unknown",passkeyPlatformAuthenticator:"unknown",userVerifyingPlatformAuthenticator:"unknown",relatedOrigins:"unknown",signalAllAcceptedCredentials:"unknown",signalCurrentUserDetails:"unknown",signalUnknownCredential:"unknown"})}function mapCapabilityToEnum(value){if(value===true){return"supported"}else if(value===false){return"unsupported"}else if(typeof value==="undefined"){return"unknown"}else{throw new Error("Unexpected capability value:",value)}}var _getBrowserCapabilitiesInternals={stubThis:value=>value};function customerPasskeySupported(){return typeof window!=="undefined"&&browserSupportsWebAuthn()}function customerPasskeyAutofillSupported(){if(!customerPasskeySupported())return Promise.resolve(false);return browserSupportsWebAuthnAutofill().catch(()=>false)}async function customerPasskeyPlatformAuthenticatorAvailable(){if(!customerPasskeySupported())return false;try{const capabilities=await getBrowserCapabilities();return capabilities.userVerifyingPlatformAuthenticator==="supported"}catch{return false}}function isCustomerPasskeyCancellation(error){if(error instanceof WebAuthnError)return error.code==="ERROR_CEREMONY_ABORTED";return error instanceof Error&&(error.name==="NotAllowedError"||error.name==="AbortError")}function cancelCustomerPasskeyCeremony(){WebAuthnAbortService.cancelCeremony()}async function signInWithCustomerPasskey(transport,params){const prepared=await transport.passkeyLoginOptions();if(!prepared.ok)return prepared;let assertion;try{assertion=await startAuthentication({optionsJSON:prepared.options,useBrowserAutofill:params.useBrowserAutofill??false})}catch(error){return{ok:false,code:isCustomerPasskeyCancellation(error)?"PASSKEY_CANCELLED":"PASSKEY_FAILED"}}params.onAssertion?.();return transport.passkeyLoginVerify({challengeId:prepared.challengeId,response:assertion,returnTo:params.returnTo,locale:params.locale})}async function registerCustomerPasskey(transport,params={}){const prepared=await transport.passkeyRegisterOptions();if(!prepared.ok)return prepared;let attestation;try{attestation=await startRegistration({optionsJSON:prepared.options})}catch(error){if(error instanceof WebAuthnError&&error.code==="ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED")return{ok:false,code:"ALREADY_REGISTERED"};return{ok:false,code:isCustomerPasskeyCancellation(error)?"PASSKEY_CANCELLED":"PASSKEY_FAILED"}}return transport.passkeyRegister({response:attestation,name:params.name})}var LAST_METHOD_KEY="kanorio.customer.last-method";var PASSKEY_OFFER_KEY="kanorio.customer.passkey-offer";var PASSKEY_OFFER_MAX_DISMISSALS=2;function read(key){try{return typeof localStorage==="undefined"?null:localStorage.getItem(key)}catch{return null}}function write(key,value){try{if(typeof localStorage==="undefined")return;if(value===null)localStorage.removeItem(key);else localStorage.setItem(key,value)}catch{}}function readLastCustomerAuthMethod(siteId){const value=read(`${LAST_METHOD_KEY}:${siteId}`);return isCustomerAuthMethod(value)?value:null}function rememberLastCustomerAuthMethod(siteId,method){write(`${LAST_METHOD_KEY}:${siteId}`,method)}function readPasskeyOfferDismissals(siteId){const value=Number(read(`${PASSKEY_OFFER_KEY}:${siteId}`)??"0");return Number.isFinite(value)&&value>0?value:0}function recordPasskeyOfferDismissal(siteId){write(`${PASSKEY_OFFER_KEY}:${siteId}`,String(readPasskeyOfferDismissals(siteId)+1))}function markPasskeyOfferCompleted(siteId){write(`${PASSKEY_OFFER_KEY}:${siteId}`,String(PASSKEY_OFFER_MAX_DISMISSALS))}function isPasskeyOfferSuppressed(siteId){return readPasskeyOfferDismissals(siteId)>=PASSKEY_OFFER_MAX_DISMISSALS}import{Fragment,jsx as jsx5,jsxs as jsxs5}from"react/jsx-runtime";var RESEND_COOLDOWN_SECONDS=30;var INVISIBLE_ALTCHA_TIMEOUT_MS=15e3;var VISIBLE_AFTER_VERIFYING_MS=3e3;var EMAIL_METHODS=new Set(["email_code","email_link"]);var SECTION_ICONS={"shopping-bag":ShoppingBag,"book-open":BookOpen,user:User};function stripLoginQuery(){if(typeof window==="undefined")return;try{const url=new URL(window.location.href);let changed=false;for(const key of["token","handoff","error","verify"]){if(url.searchParams.has(key)){url.searchParams.delete(key);changed=true}}if(changed)window.history.replaceState(window.history.state,"",url.toString())}catch{}}function useCountdown(until){const[now,setNow]=useState2(()=>Date.now());useEffect2(()=>{if(until===null||until<=Date.now())return;const id=setInterval(()=>setNow(Date.now()),1e3);return()=>clearInterval(id)},[until]);if(until===null)return 0;return Math.max(0,Math.ceil((until-now)/1e3))}function CustomerAccountPanel({variant,auth,initial,returnTo,onNavigate,onSignedIn,onSignedOut,className}){const{transport,messages,methods,siteId,siteName,locale,siteLocale,accountBaseUrl}=auth;const[step,setStep]=useState2(()=>{if(initial?.token?.trim()||initial?.handoff?.trim())return{kind:"consuming"};if(initial?.verify&&initial.email?.trim())return{kind:"code",email:initial.email.trim(),sentAt:Date.now()};return{kind:"identify"}});const[email,setEmail]=useState2(initial?.email??"");const[code,setCode]=useState2("");const[busy,setBusy]=useState2(null);const[error,setError]=useState2(()=>initial?.error?customerAuthErrorMessage(initial.error,messages):null);const[lastMethod,setLastMethod]=useState2(null);const[inApp,setInApp]=useState2(false);const mountedRef=useRef2(true);const consumedTicketRef=useRef2(null);const otherMethods=useMemo(()=>methods.filter(m=>!EMAIL_METHODS.has(m)),[methods]);const signInSubtitle=otherMethods.length>0?messages.signInSubtitleChoose:messages.signInSubtitle;const passkeyEnabled=methods.includes("passkey");const safeReturnTo=returnTo?sanitizeCustomerReturnTo(returnTo):null;const{getProtectionData,isSubmittable,registerFocus,reset,fieldProps,challengeProps,provider,prepare,renewCaptcha}=useBotProtection({variant:"full",context:`customer-login:${siteId}`,challengeUrl:transport.challengeUrl,altchaChallengeUrl:transport.altchaChallengeUrl,entry:"customer_login"});const needsVisibleCheck=provider==="hcaptcha"||provider==="recaptcha"&&challengeProps.captcha?.recaptchaVersion==="v2";const[altchaRevealed,setAltchaRevealed]=useState2(false);const[altchaGeneration,setAltchaGeneration]=useState2(0);const pendingRef=useRef2(null);const pendingTimerRef=useRef2(null);const clearPending=useCallback(()=>{pendingRef.current=null;if(pendingTimerRef.current){clearTimeout(pendingTimerRef.current);pendingTimerRef.current=null}},[]);const runWhenProtected=useCallback(action=>{if(isSubmittable){action();return}if(needsVisibleCheck){setBusy(null);setError(messages.errorBotProtection);return}pendingRef.current=action;if(pendingTimerRef.current)clearTimeout(pendingTimerRef.current);pendingTimerRef.current=setTimeout(()=>{if(!pendingRef.current)return;pendingRef.current=null;setBusy(null);setAltchaRevealed(true);setError(messages.errorBotProtection)},INVISIBLE_ALTCHA_TIMEOUT_MS)},[isSubmittable,needsVisibleCheck,messages.errorBotProtection]);useEffect2(()=>{if(!isSubmittable||!pendingRef.current)return;const action=pendingRef.current;clearPending();action()},[isSubmittable,clearPending]);const verifyingTimerRef=useRef2(null);const handleAltchaState=useCallback(state=>{if(verifyingTimerRef.current){clearTimeout(verifyingTimerRef.current);verifyingTimerRef.current=null}if(state==="error")setAltchaRevealed(true);else if(state==="verifying")verifyingTimerRef.current=setTimeout(()=>setAltchaRevealed(true),VISIBLE_AFTER_VERIFYING_MS)},[]);const renewProtection=useCallback(()=>{reset();registerFocus();renewCaptcha();setAltchaGeneration(g=>g+1)},[reset,registerFocus,renewCaptcha]);useEffect2(()=>{mountedRef.current=true;setInApp(isInAppBrowser());setLastMethod(readLastCustomerAuthMethod(siteId));return()=>{mountedRef.current=false;clearPending();cancelCustomerPasskeyCeremony()}},[siteId,clearPending]);useEffect2(()=>{const onPageShow=event=>{if(event.persisted)setBusy(null)};window.addEventListener("pageshow",onPageShow);return()=>window.removeEventListener("pageshow",onPageShow)},[]);const fail=useCallback((codeOrMessage,options)=>{if(!mountedRef.current)return;if(!options?.raw&&CUSTOMER_AUTH_SILENT_CODES.has(codeOrMessage.toUpperCase()))return;setError(options?.raw?codeOrMessage:customerAuthErrorMessage(codeOrMessage,messages))},[messages]);const complete=useCallback(grant=>{if(variant==="page"){setStep({kind:"redirecting"});const target=sanitizeCustomerReturnTo(grant.returnTo??safeReturnTo??`${accountBaseUrl}${auth.landing??storefrontAccountRoutes.index}`);window.location.assign(target);return}setBusy(null);setStep({kind:"identify"})},[variant,safeReturnTo,accountBaseUrl,auth.landing]);const finishSignIn=useCallback(async(grant,method)=>{rememberLastCustomerAuthMethod(siteId,method);onSignedIn?.(grant,method);const session=await transport.session().then(overview=>({known:true,overview}),()=>({known:false}));if(!mountedRef.current)return;if(session.known)auth.applySession(session.overview);else auth.retrySession();if(method!=="passkey"&&passkeyEnabled&&!isPasskeyOfferSuppressed(siteId)&&await customerPasskeyPlatformAuthenticatorAvailable()){const list=await transport.listPasskeys();if(!mountedRef.current)return;if(list.ok&&list.passkeys.length===0){setBusy(null);setError(null);setStep({kind:"passkey-offer",grant});return}}complete(grant)},[siteId,onSignedIn,transport,auth,passkeyEnabled,complete]);const initialRef=useRef2(initial);useEffect2(()=>{const init=initialRef.current;if(!init)return;if(init.error||init.verify)stripLoginQuery();const token=init.token?.trim()||null;const handoff=init.handoff?.trim()||null;if(token||handoff){stripLoginQuery();const method=token?"link":"handoff";const ticket=token??handoff;if(consumedTicketRef.current===ticket)return;consumedTicketRef.current=ticket;transport.verifyToken({method,token:ticket}).then(result=>{if(!mountedRef.current)return;if(!result.ok){setStep({kind:"identify"});fail(result.code);return}const used=method==="link"?"email_link":readLastCustomerAuthMethod(siteId)??"google";return finishSignIn(result,used)}).catch(()=>{if(!mountedRef.current)return;setStep({kind:"identify"});fail("SERVER_ERROR")});return}},[]);const sendChallenge=useCallback(async(target,mode)=>{setBusy(mode==="first"?"challenge":"resend");setError(null);await prepare();const result=await transport.requestChallenge({email:target,locale:siteLocale,returnTo:safeReturnTo??void 0,protection:getProtectionData()});if(!mountedRef.current)return;setBusy(null);renewProtection();if(!result.ok){if(result.code==="BOT_PROTECTION_FAILED")setAltchaRevealed(true);fail(result.code);return}setCode("");setStep({kind:"code",email:target,sentAt:Date.now()})},[transport,siteLocale,safeReturnTo,getProtectionData,renewProtection,fail,prepare]);const handleEmailSubmit=event=>{event.preventDefault();const trimmed=email.trim();if(!trimmed||!trimmed.includes("@")){setError(messages.errorInvalidEmail);return}cancelCustomerPasskeyCeremony();setError(null);setBusy("challenge");runWhenProtected(()=>void sendChallenge(trimmed,"first"))};const handleResend=target=>{setBusy("resend");runWhenProtected(()=>void sendChallenge(target,"resend"))};const verifyCode=useCallback(async(target,value)=>{if(!/^\d{6}$/.test(value)){setError(messages.errorInvalidCode);return}setBusy("verify");setError(null);const result=await transport.verifyCode({email:target,code:value});if(!mountedRef.current)return;if(!result.ok){setBusy(null);setCode("");fail(result.code);return}await finishSignIn(result,"email_code")},[transport,messages.errorInvalidCode,fail,finishSignIn]);const loginWithPasskey=useCallback(async useBrowserAutofill=>{if(!useBrowserAutofill){cancelCustomerPasskeyCeremony();setBusy("passkey");setError(null)}const result=await signInWithCustomerPasskey(transport,{useBrowserAutofill,returnTo:safeReturnTo??void 0,locale:siteLocale,onAssertion:()=>{if(mountedRef.current)setStep({kind:"consuming"})}});if(!mountedRef.current)return;if(!result.ok){setBusy(null);setStep(current=>current.kind==="consuming"?{kind:"identify"}:current);fail(result.code);return}await finishSignIn(result,"passkey")},[transport,safeReturnTo,siteLocale,fail,finishSignIn]);useEffect2(()=>{if(!passkeyEnabled||step.kind!=="identify"||auth.user)return;let cancelled=false;customerPasskeyAutofillSupported().then(supported=>{if(!cancelled&&supported)void loginWithPasskey(true)});return()=>{cancelled=true;cancelCustomerPasskeyCeremony()}},[passkeyEnabled,step.kind,auth.user]);const startOauth=useCallback(async method=>{if(inApp){setStep({kind:"in-app"});return}cancelCustomerPasskeyCeremony();setBusy("oauth");setError(null);const result=await transport.startOauth({method,returnTo:safeReturnTo??void 0,locale:siteLocale});if(!mountedRef.current)return;if(!result.ok){setBusy(null);fail(result.code);return}rememberLastCustomerAuthMethod(siteId,method);window.location.assign(result.url)},[inApp,transport,safeReturnTo,siteLocale,siteId,fail]);const createPasskey=async grant=>{setBusy("passkey-register");setError(null);const result=await registerCustomerPasskey(transport);if(!mountedRef.current)return;setBusy(null);if(!result.ok){fail(result.code);return}markPasskeyOfferCompleted(siteId);complete(grant)};const skipPasskey=grant=>{recordPasskeyOfferDismissal(siteId);complete(grant)};const handleSignOut=async()=>{setBusy("verify");await auth.signOut();if(!mountedRef.current)return;setBusy(null);onSignedOut?.();onNavigate?.()};const title=fillLabel(messages.signInTitle,{siteName}).trim();const errorBanner=error?jsx5("div",{role:"alert",className:cn(CUSTOMER_ERROR_BANNER_CLASS,"mb-4"),children:error}):null;let body;if(step.kind==="consuming"||step.kind==="redirecting"){body=jsx5("p",{className:cn("py-8 text-center text-sm",CUSTOMER_MUTED_TEXT_CLASS),"aria-live":"polite",children:messages.verifying})}else if(step.kind==="passkey-offer"){body=jsx5(PasskeyOffer,{messages,busy:busy==="passkey-register",onCreate:()=>void createPasskey(step.grant),onSkip:()=>skipPasskey(step.grant)})}else if(step.kind==="in-app"){body=jsx5(InAppBrowserNotice,{messages,onBack:()=>setStep({kind:"identify"})})}else if(step.kind==="code"){body=jsx5(CodeStep,{email:step.email,sentAt:step.sentAt,code,onCodeChange:setCode,busy,messages,onVerify:value=>void verifyCode(step.email,value),onResend:()=>handleResend(step.email),onChangeEmail:()=>{setStep({kind:"identify"});setCode("");setError(null)}})}else if(auth.pending){body=jsxs5("p",{className:cn("flex items-center gap-2 py-6 text-sm",CUSTOMER_MUTED_TEXT_CLASS),role:"status","aria-live":"polite",children:[jsx5("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent","aria-hidden":"true"}),messages.sessionChecking]})}else if(auth.sessionUnavailable){body=jsxs5("div",{children:[jsx5("div",{role:"alert",className:cn(CUSTOMER_ERROR_BANNER_CLASS,"mb-4"),children:messages.errorServiceUnavailable}),jsx5(CustomerButton,{type:"button",block:true,onClick:auth.retrySession,children:messages.contentRetry})]})}else if(auth.user){body=variant==="panel"?jsx5(SignedInMenu,{auth,busy:busy!==null,onNavigate,onSignOut:()=>void handleSignOut()}):jsx5("p",{className:cn("text-sm",CUSTOMER_MUTED_TEXT_CLASS),children:jsx5("a",{href:`${accountBaseUrl}${auth.landing??storefrontAccountRoutes.index}`,className:customerButtonClass({block:true}),children:messages.signedInContinue})})}else{body=jsx5(IdentifyStep,{email,onEmailChange:value=>{registerFocus();setEmail(value)},onEmailFocus:registerFocus,onSubmit:handleEmailSubmit,otherMethods,lastMethod,busy,messages,onPasskey:()=>void loginWithPasskey(false),onOauth:method=>void startOauth(method)})}const confirmingSession=step.kind==="identify"&&(auth.pending||auth.sessionUnavailable);const protection=confirmingSession?null:jsxs5(Fragment,{children:[jsx5(BotProtectionFields,{...fieldProps,locale,renderAltcha:false}),jsx5(BotProtectionChallenge,{...challengeProps,locale,invisible:true,revealed:altchaRevealed,generation:altchaGeneration,onStateChange:handleAltchaState,onCaptchaError:()=>setError(messages.errorBotProtection),className:altchaRevealed||provider!=="kanorio"?"mt-3":void 0})]});if(variant==="page"){return jsx5("div",{className:cn("mx-auto w-full max-w-md",className),children:jsxs5("div",{className:cn(CUSTOMER_CARD_CLASS,"p-6 sm:p-8"),children:[jsxs5("div",{className:"mb-6",children:[jsx5("h1",{className:cn("text-xl font-semibold",CUSTOMER_TEXT_CLASS),children:title}),step.kind==="identify"&&!auth.user&&!auth.pending&&!auth.sessionUnavailable?jsx5("p",{className:cn("mt-1",CUSTOMER_HINT_CLASS),children:signInSubtitle}):null]}),errorBanner,body,step.kind==="identify"||step.kind==="code"?protection:null]})})}return jsxs5("div",{className,children:[step.kind==="identify"&&!auth.user&&!auth.pending&&!auth.sessionUnavailable?jsx5("p",{className:cn("mb-4",CUSTOMER_HINT_CLASS),children:signInSubtitle}):null,errorBanner,body,step.kind==="identify"||step.kind==="code"?protection:null]})}function IdentifyStep({email,onEmailChange,onEmailFocus,onSubmit,otherMethods,lastMethod,busy,messages,onPasskey,onOauth}){const anyBusy=busy!==null;return jsxs5("div",{className:"space-y-4",children:[otherMethods.length>0?jsxs5("div",{className:"space-y-2",children:[otherMethods.map(method=>jsx5(MethodButton,{method,last:lastMethod===method,loading:method==="passkey"&&busy==="passkey"||method!=="passkey"&&busy==="oauth",disabled:anyBusy,messages,onClick:()=>method==="passkey"?onPasskey():onOauth(method)},method)),jsxs5("div",{className:"flex items-center gap-3 py-1","aria-hidden":"true",children:[jsx5("span",{className:cn("h-px flex-1",CUSTOMER_DIVIDER_CLASS)}),jsx5("span",{className:cn("text-xs uppercase tracking-wide",CUSTOMER_MUTED_TEXT_CLASS),children:messages.orContinueWith}),jsx5("span",{className:cn("h-px flex-1",CUSTOMER_DIVIDER_CLASS)})]})]}):null,jsxs5("form",{onSubmit,className:"space-y-3",noValidate:true,children:[jsx5(CustomerField,{label:messages.emailLabel,htmlFor:"customer-login-email",hint:otherMethods.length>0?messages.emailCodeHint:void 0,children:jsx5(CustomerInput,{id:"customer-login-email",type:"email",name:"email",inputMode:"email",required:true,autoComplete:"username webauthn",value:email,onFocus:onEmailFocus,onChange:event=>onEmailChange(event.target.value),placeholder:messages.emailPlaceholder,disabled:anyBusy&&busy!=="passkey"})}),jsx5(CustomerButton,{type:"submit",block:true,loading:busy==="challenge",disabled:anyBusy,leading:lastMethod==="email_code"||lastMethod==="email_link"?jsx5(LastUsedDot,{}):void 0,children:messages.continueWithEmail})]})]})}var DefaultMethodIcon=({className})=>jsx5(KeyRound,{className,"aria-hidden":"true"});var METHOD_ICON={passkey:({className})=>jsx5(FingerprintPattern,{className,"aria-hidden":"true"}),google:({className})=>jsx5(GoogleIcon,{className})};var PROVIDER_NAMES={apple:"Apple",line:"LINE",kakao:"Kakao",external_oidc:"SSO"};function methodLabel(method,messages){if(method==="passkey")return messages.continueWithPasskey;if(method==="google")return messages.continueWithGoogle;return fillLabel(messages.continueWithProvider,{provider:PROVIDER_NAMES[method]??method})}function MethodButton({method,last,loading,disabled,messages,onClick}){const Icon=METHOD_ICON[method]??DefaultMethodIcon;return jsxs5(CustomerButton,{type:"button",variant:"secondary",block:true,loading,disabled,onClick,leading:jsx5(Icon,{className:"h-4 w-4"}),className:"relative",children:[jsx5("span",{children:methodLabel(method,messages)}),last?jsx5("span",{className:cn(customerBadgeClass("neutral"),"absolute right-3"),children:messages.lastUsed}):null]})}function LastUsedDot(){return jsx5(Check,{className:"h-4 w-4","aria-hidden":"true"})}function CodeStep({email,sentAt,code,onCodeChange,busy,messages,onVerify,onResend,onChangeEmail}){const secondsLeft=useCountdown(sentAt+RESEND_COOLDOWN_SECONDS*1e3);const verifying=busy==="verify";return jsxs5("form",{onSubmit:event=>{event.preventDefault();if(!verifying)onVerify(code)},className:"space-y-4",noValidate:true,children:[jsxs5("div",{children:[jsx5("h2",{className:cn("text-base font-semibold",CUSTOMER_TEXT_CLASS),children:messages.codeStepTitle}),jsx5("p",{className:cn("mt-1 break-words",CUSTOMER_HINT_CLASS),children:fillLabel(messages.codeSentHint,{email})})]}),jsx5(CustomerCodeInput,{label:messages.codeLabel,value:code,onChange:onCodeChange,onComplete:value=>!verifying&&onVerify(value),disabled:verifying,autoFocus:true}),jsx5(CustomerButton,{type:"submit",block:true,loading:verifying,disabled:busy!==null||code.length!==6,children:messages.verifyAndSignIn}),jsxs5("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2",children:[jsx5("button",{type:"button",className:CUSTOMER_INLINE_ACTION_CLASS,disabled:secondsLeft>0||busy!==null,onClick:onResend,"aria-live":"polite",children:busy==="resend"?messages.sendingCode:secondsLeft>0?fillLabel(messages.resendIn,{seconds:String(secondsLeft)}):messages.resendCode}),jsxs5("button",{type:"button",className:CUSTOMER_INLINE_ACTION_CLASS,disabled:busy!==null,onClick:onChangeEmail,children:[jsx5(ArrowLeft,{className:"h-4 w-4","aria-hidden":"true"}),messages.useAnotherEmail]})]})]})}function SignedInMenu({auth,busy,onNavigate,onSignOut}){const{messages,accountBaseUrl}=auth;const user=auth.user;const sections=visibleCustomerPortalSections(auth.sections);const display=user.name?.trim()||user.email||"";const initial=display.trim().charAt(0).toUpperCase();return jsxs5("div",{className:"space-y-4",children:[jsxs5("div",{className:"flex items-center gap-3",children:[jsx5("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-base font-semibold",style:{backgroundColor:"var(--brand-color, #18181b)",color:"var(--brand-foreground, #ffffff)"},"aria-hidden":"true",children:initial||jsx5(User,{className:"h-5 w-5"})}),jsxs5("div",{className:"min-w-0",children:[user.name?.trim()?jsx5("p",{className:cn("truncate text-sm font-semibold",CUSTOMER_TEXT_CLASS),children:user.name}):null,user.email?jsx5("p",{className:cn("truncate text-sm",CUSTOMER_MUTED_TEXT_CLASS),children:user.email}):null]})]}),jsx5("nav",{"aria-label":messages.shell.menu,children:jsxs5("ul",{className:"-mx-2 space-y-0.5",children:[(sections.length>0?sections:null)?.map(section=>{const Icon=SECTION_ICONS[section.icon];return jsx5("li",{children:jsxs5("a",{href:`${accountBaseUrl}${section.route}`,onClick:onNavigate,className:cn("flex min-h-11 items-center gap-3 rounded-[var(--site-radius-button,0.5rem)] px-2 text-sm font-medium transition "+TONE_BG_TINT_HOVER,CUSTOMER_TEXT_CLASS),children:[jsx5(Icon,{className:cn("h-4 w-4 shrink-0",CUSTOMER_MUTED_TEXT_CLASS),"aria-hidden":"true"}),messages.nav[section.navLabelKey]]})},section.id)}),sections.length===0?jsx5("li",{children:jsxs5("a",{href:`${accountBaseUrl}${storefrontAccountRoutes.index}`,onClick:onNavigate,className:cn("flex min-h-11 items-center gap-3 rounded-[var(--site-radius-button,0.5rem)] px-2 text-sm font-medium",CUSTOMER_TEXT_CLASS),children:[jsx5(User,{className:cn("h-4 w-4 shrink-0",CUSTOMER_MUTED_TEXT_CLASS),"aria-hidden":"true"}),messages.title]})}):null]})}),jsx5("div",{className:cn("pt-3",CUSTOMER_DIVIDER_CLASS),children:jsx5(CustomerButton,{type:"button",variant:"ghost",block:true,loading:busy,onClick:onSignOut,leading:jsx5(LogOut,{className:"h-4 w-4","aria-hidden":"true"}),children:messages.signOut})})]})}function PasskeyOffer({messages,busy,onCreate,onSkip}){return jsxs5("div",{className:"space-y-4",children:[jsxs5("div",{className:"flex items-start gap-3",children:[jsx5("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[color-mix(in_srgb,var(--brand-color,#18181b)_12%,transparent)] text-[var(--brand-text,var(--brand-color,#18181b))]","aria-hidden":"true",children:jsx5(FingerprintPattern,{className:"h-5 w-5"})}),jsxs5("div",{children:[jsx5("h2",{className:cn("text-base font-semibold",CUSTOMER_TEXT_CLASS),children:messages.passkeyOfferTitle}),jsx5("p",{className:cn("mt-1",CUSTOMER_HINT_CLASS),children:messages.passkeyOfferBody})]})]}),jsxs5("div",{className:"flex flex-col gap-2",children:[jsx5(CustomerButton,{type:"button",block:true,loading:busy,onClick:onCreate,children:messages.passkeyOfferCreate}),jsx5(CustomerButton,{type:"button",variant:"ghost",block:true,disabled:busy,onClick:onSkip,children:messages.passkeyOfferSkip})]})]})}function InAppBrowserNotice({messages,onBack}){const[copied,setCopied]=useState2(false);const copy=async()=>{try{await navigator.clipboard.writeText(window.location.href);setCopied(true);setTimeout(()=>setCopied(false),3e3)}catch{setCopied(false)}};return jsxs5("div",{className:"space-y-4",children:[jsxs5("div",{children:[jsx5("h2",{className:cn("text-base font-semibold",CUSTOMER_TEXT_CLASS),children:messages.inAppBrowserTitle}),jsx5("p",{className:cn("mt-1",CUSTOMER_HINT_CLASS),children:messages.inAppBrowserBody})]}),jsxs5("div",{className:"flex flex-col gap-2",children:[jsx5(CustomerButton,{type:"button",variant:"secondary",block:true,onClick:()=>void copy(),leading:copied?jsx5(Check,{className:"h-4 w-4","aria-hidden":"true"}):jsx5(Copy,{className:"h-4 w-4","aria-hidden":"true"}),children:copied?messages.inAppBrowserCopied:messages.inAppBrowserCopyLink}),jsx5(CustomerButton,{type:"button",variant:"ghost",block:true,onClick:onBack,children:messages.inAppBrowserUseEmail})]})]})}export{customerButtonClass,CUSTOMER_SESSION_HINT_COOKIE_NAME,normalizeCustomerAuthMethods,createHostedCustomerAuthTransport,customerAuthErrorMessage,RESEND_COOLDOWN_SECONDS,CustomerAccountPanel};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-4OC7BRQS.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as O,c as A}from"./chunk-UM74DXPE.js";import{c as Y}from"./chunk-LXNMHQFN.js";import{a as X}from"./chunk-J37D44SX.js";import{q as Q}from"./chunk-MQ7PBFUM.js";import{e as J}from"./chunk-ET57PWXC.js";import{A as H,ba as f,d as q,q as R,s as G}from"./chunk-S2NFWI7C.js";import{b as I}from"./chunk-AFNEGNVJ.js";import{a as u}from"./chunk-OU4IOHLN.js";import{a as ae}from"./chunk-NSY72ZYX.js";import{a as j}from"./chunk-6LGTFWQS.js";import{c as s}from"./chunk-CDG7S4P5.js";var y=s(j()),Z=s(ae());var _=s(j(),1),L=s(u(),1);function V(e,t={}){let i=(0,_.lazy)(async()=>{let c=await e();return"default"in c?c:{default:c}}),n=t.loading;return function(a){return(0,L.jsx)(_.Suspense,{fallback:n?(0,L.jsx)(n,{}):null,children:(0,L.jsx)(i,{...a})})}}var g=s(u());function se(e,t){let i=e?O(e):null;return i==="pdf"||t==="pdf"?"#dc2626":i==="archive"||t==="zip"?"#71717a":i==="ebook"||t==="epub"?"#7c3aed":e?.includes("spreadsheet")||e==="application/vnd.ms-excel"||t==="xls"||t==="xlsx"?"#15803d":e?.includes("presentation")||e==="application/vnd.ms-powerpoint"||t==="ppt"||t==="pptx"?"#ea580c":e?.includes("wordprocessingml")||e==="application/msword"||t==="doc"||t==="docx"?"#2563eb":"#52525b"}function k({mimeType:e,fileName:t,className:i}){let n=e?A(e):"",c=t&&t.includes(".")?t.slice(t.lastIndexOf(".")):"",a=(n||c).replace(/^\./,"").toLowerCase(),d=se(e,a),b=a?a.toUpperCase().slice(0,4):"FILE";return(0,g.jsxs)("div",{"aria-hidden":!0,className:f("relative h-12 w-10 shrink-0 rounded-md border border-zinc-300 bg-white shadow-sm dark:border-zinc-600 dark:bg-zinc-800",i),children:[(0,g.jsx)("div",{className:"absolute right-0 top-0 h-3 w-3 rounded-bl-sm border-b border-l border-zinc-300 bg-zinc-100 dark:border-zinc-600 dark:bg-zinc-700"}),(0,g.jsxs)("div",{className:"absolute left-2 right-2 top-4 space-y-1",children:[(0,g.jsx)("div",{className:"h-0.5 rounded bg-zinc-200 dark:bg-zinc-600"}),(0,g.jsx)("div",{className:"h-0.5 w-3/4 rounded bg-zinc-200 dark:bg-zinc-600"})]}),(0,g.jsx)("div",{className:"absolute -left-1 bottom-1.5 rounded-sm px-1 py-px text-[9px] font-bold leading-none tracking-wide text-white shadow-sm",style:{backgroundColor:d},children:b})]})}var h="inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[var(--site-radius-button)] bg-[var(--media-action)] px-4 py-2 text-sm font-medium text-[var(--media-action-fg)] shadow-sm transition-all hover:brightness-110 group-hover:shadow-md group-hover:brightness-110";var o=s(u()),ce=V(()=>import("./PDFViewerFull-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as O,c as A}from"./chunk-UM74DXPE.js";import{c as Y}from"./chunk-LXNMHQFN.js";import{a as X}from"./chunk-J37D44SX.js";import{q as Q}from"./chunk-MQ7PBFUM.js";import{e as J}from"./chunk-ET57PWXC.js";import{A as H,ba as f,d as q,q as R,s as G}from"./chunk-S2NFWI7C.js";import{b as I}from"./chunk-AFNEGNVJ.js";import{a as u}from"./chunk-OU4IOHLN.js";import{a as ae}from"./chunk-NSY72ZYX.js";import{a as j}from"./chunk-6LGTFWQS.js";import{c as s}from"./chunk-CDG7S4P5.js";var y=s(j()),Z=s(ae());var _=s(j(),1),L=s(u(),1);function V(e,t={}){let i=(0,_.lazy)(async()=>{let c=await e();return"default"in c?c:{default:c}}),n=t.loading;return function(a){return(0,L.jsx)(_.Suspense,{fallback:n?(0,L.jsx)(n,{}):null,children:(0,L.jsx)(i,{...a})})}}var g=s(u());function se(e,t){let i=e?O(e):null;return i==="pdf"||t==="pdf"?"#dc2626":i==="archive"||t==="zip"?"#71717a":i==="ebook"||t==="epub"?"#7c3aed":e?.includes("spreadsheet")||e==="application/vnd.ms-excel"||t==="xls"||t==="xlsx"?"#15803d":e?.includes("presentation")||e==="application/vnd.ms-powerpoint"||t==="ppt"||t==="pptx"?"#ea580c":e?.includes("wordprocessingml")||e==="application/msword"||t==="doc"||t==="docx"?"#2563eb":"#52525b"}function k({mimeType:e,fileName:t,className:i}){let n=e?A(e):"",c=t&&t.includes(".")?t.slice(t.lastIndexOf(".")):"",a=(n||c).replace(/^\./,"").toLowerCase(),d=se(e,a),b=a?a.toUpperCase().slice(0,4):"FILE";return(0,g.jsxs)("div",{"aria-hidden":!0,className:f("relative h-12 w-10 shrink-0 rounded-md border border-zinc-300 bg-white shadow-sm dark:border-zinc-600 dark:bg-zinc-800",i),children:[(0,g.jsx)("div",{className:"absolute right-0 top-0 h-3 w-3 rounded-bl-sm border-b border-l border-zinc-300 bg-zinc-100 dark:border-zinc-600 dark:bg-zinc-700"}),(0,g.jsxs)("div",{className:"absolute left-2 right-2 top-4 space-y-1",children:[(0,g.jsx)("div",{className:"h-0.5 rounded bg-zinc-200 dark:bg-zinc-600"}),(0,g.jsx)("div",{className:"h-0.5 w-3/4 rounded bg-zinc-200 dark:bg-zinc-600"})]}),(0,g.jsx)("div",{className:"absolute -left-1 bottom-1.5 rounded-sm px-1 py-px text-[9px] font-bold leading-none tracking-wide text-white shadow-sm",style:{backgroundColor:d},children:b})]})}var h="inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[var(--site-radius-button)] bg-[var(--media-action)] px-4 py-2 text-sm font-medium text-[var(--media-action-fg)] shadow-sm transition-all hover:brightness-110 group-hover:shadow-md group-hover:brightness-110";var o=s(u()),ce=V(()=>import("./PDFViewerFull-P3HCVGDZ.js"),{ssr:!1,loading:()=>(0,o.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/95",children:(0,o.jsx)(H,{className:"h-8 w-8 animate-spin text-white/50"})})});function ee({src:e,variant:t="preview",thumbnailUrl:i,thumbnailAlt:n,fileName:c,pageCount:a,allowDownload:d,downloadUrl:b,className:l}){let{ui:p}=I(),[v,x]=(0,y.useState)(!1),[C,F]=(0,y.useState)(!1);(0,y.useEffect)(()=>{F(!0)},[]);let m=c?.trim()||void 0,w=p.clickToRead,D=a?`${a} ${p.pdfPages} \xB7 ${w}`:w,z=C&&v&&(0,Z.createPortal)((0,o.jsx)(J,{children:(0,o.jsx)(ce,{src:e,fileName:m,allowDownload:d,downloadUrl:b,onClose:()=>x(!1)})}),document.body);if(t==="card"){let N=a?`PDF \xB7 ${a} ${p.pdfPages}`:"PDF";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{type:"button",onClick:()=>x(!0),className:f("group flex w-full items-center gap-4 rounded-[var(--site-radius-card)] border border-zinc-200 bg-zinc-50 p-4 text-left transition-colors hover:border-zinc-400 dark:border-zinc-700 dark:bg-zinc-900 dark:hover:border-zinc-500",l),children:[(0,o.jsx)(k,{mimeType:"application/pdf",fileName:m?`${m}.pdf`:"file.pdf"}),(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("p",{className:"truncate text-sm font-medium text-zinc-800 dark:text-zinc-200",title:m,children:m||"PDF"}),(0,o.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",children:N})]}),(0,o.jsxs)("span",{className:h,children:[(0,o.jsx)(q,{className:"h-4 w-4","aria-hidden":!0}),w]})]}),z]})}return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{type:"button",onClick:()=>x(!0),className:f("group relative w-full cursor-pointer rounded-[var(--site-radius-media)] overflow-hidden border border-zinc-200 dark:border-zinc-700","hover:border-zinc-400 dark:hover:border-zinc-500 transition-colors text-left",l),children:[i?(0,o.jsx)("img",{src:i,alt:n||m||"PDF",className:"w-full max-h-[560px] object-contain bg-white dark:bg-zinc-900"}):(0,o.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 bg-zinc-50 dark:bg-zinc-900",children:[(0,o.jsx)(G,{className:"h-12 w-12 text-zinc-300 dark:text-zinc-600 mb-3"}),(0,o.jsx)("p",{className:"text-sm text-zinc-500",children:m||"PDF"})]}),(0,o.jsx)("div",{className:f("absolute inset-0 flex items-center justify-center","bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-200"),children:(0,o.jsx)("p",{className:"text-base font-medium text-white px-4 text-center",children:D})})]}),z]})}var r=s(u()),te="rounded-[var(--site-radius-card)] border border-zinc-200 bg-zinc-50 text-left transition-colors dark:border-zinc-700 dark:bg-zinc-900",oe="group hover:border-zinc-400 dark:hover:border-zinc-500";function re({name:e,size:t,mimeType:i,href:n,variant:c="row",className:a}){let{ui:d,locale:b}=I(),l=i&&A(i)||(e.includes(".")?e.slice(e.lastIndexOf(".")):""),p=[l?l.slice(1).toUpperCase():null,t?Y(t,{locale:b}):null].filter(Boolean).join(" \xB7 "),v=n?"a":"div",x=n?{href:n,target:"_blank",rel:"noopener noreferrer","data-cta-track":"","data-cta-button-name":e||d.download,"data-cta-element-id":"file-download"}:{};return c==="tile"?(0,r.jsxs)(v,{...x,className:f(te,n&&oe,"flex flex-col overflow-hidden",a),children:[(0,r.jsx)("div",{className:"flex aspect-video items-center justify-center bg-zinc-100 dark:bg-zinc-800",children:(0,r.jsx)(k,{mimeType:i,fileName:e,className:"h-20 w-16 [&>div:last-child]:text-xs"})}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 p-4",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"truncate text-sm font-medium text-zinc-800 dark:text-zinc-200",title:e,children:e}),p&&(0,r.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",children:p})]}),n&&(0,r.jsxs)("span",{className:f(h,"w-full"),children:[(0,r.jsx)(R,{className:"h-4 w-4","aria-hidden":!0}),d.download]})]})]}):(0,r.jsxs)(v,{...x,className:f(te,n&&oe,"flex items-center gap-4 p-4",a),children:[(0,r.jsx)(k,{mimeType:i,fileName:e}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("p",{className:"truncate text-sm font-medium text-zinc-800 dark:text-zinc-200",title:e,children:e}),p&&(0,r.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",children:p})]}),n&&(0,r.jsxs)("span",{className:h,children:[(0,r.jsx)(R,{className:"h-4 w-4","aria-hidden":!0}),d.download]})]})}var P=s(u());function _e({src:e,mimeType:t,hlsSrc:i,thumbnails:n,streamingPartial:c,captions:a,captionLocale:d,onCaptionChange:b,title:l,fileName:p,fileSize:v,fileCardVariant:x,storageKey:C,startTime:F,seekTo:m,chapters:w,radius:D,thumbnailUrl:z,thumbnailAlt:N,pageCount:ie,autoPlay:$,loop:B,muted:ne,onTimeUpdate:U,onComplete:W,onPlaybackEvent:K,allowDownload:E,downloadUrl:S,className:T}){if(t.startsWith("video/"))return(0,P.jsx)(Q,{src:e,hlsSrc:i,thumbnails:n,streamingPartial:c,captions:a,captionLocale:d,onCaptionChange:b,title:l,poster:z,posterAlt:N,autoPlay:$,loop:B,muted:ne,allowDownload:E,downloadUrl:S,storageKey:C,startTime:F,seekTo:m,chapters:w,radius:D,onTimeUpdate:U,onComplete:W,onPlaybackEvent:K,className:T});if(t.startsWith("audio/"))return(0,P.jsx)(X,{src:e,captions:a,captionLocale:d,onCaptionChange:b,title:l,coverImage:z,coverImageAlt:N,autoPlay:$,loop:B,allowDownload:E,downloadUrl:S,storageKey:C,startTime:F,seekTo:m,chapters:w,radius:D,onTimeUpdate:U,onComplete:W,onPlaybackEvent:K,className:T});if(t==="application/pdf")return(0,P.jsx)(ee,{src:e,thumbnailUrl:z,thumbnailAlt:N,fileName:l,pageCount:ie,allowDownload:E,downloadUrl:S,className:T});let M=O(t);return M==="document"||M==="ebook"||M==="archive"?(0,P.jsx)(re,{name:p||l||"file",size:v,mimeType:t,href:S,variant:x,className:T}):null}export{ee as a,re as b,_e as c};
|
|
2
|
+
//# sourceMappingURL=chunk-56UUP6CI.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as K}from"./chunk-5AUWUK5R.js";import{a as V}from"./chunk-OU4IOHLN.js";import{a as Re}from"./chunk-6LGTFWQS.js";import{c as v}from"./chunk-CDG7S4P5.js";var xe=["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"],we=["logo","text","image"],Z={min:5,max:50,default:20},Q={min:10,max:100,default:60},Ae=60,J={pages:!0,articles:!0,products:!1},E={enabled:!1,source:"logo",text:"",image:null,layout:"single",position:"bottom-right",size:Z.default,opacity:Q.default,apply:J,overlay:null,version:null,activatedAt:null,deactivatedAt:null},F={allowDownload:!0,keepCopyright:!0,deterrence:!1,watermark:E};function Y(t,e){return typeof t!="number"||!Number.isFinite(t)?e.default:Math.min(e.max,Math.max(e.min,Math.round(t)))}function X(t,e,n){return typeof t=="string"&&e.includes(t)?t:n}function Ie(t){let e=t&&typeof t=="object"?t:{},n=r=>typeof e[r]=="boolean"?e[r]:J[r];return{pages:n("pages"),articles:n("articles"),products:n("products")}}function Fe(t){let e=t&&typeof t=="object"?t:{},n=e.overlay&&typeof e.overlay=="object"?e.overlay:null,r=n&&typeof n.url=="string"&&typeof n.width=="number"&&typeof n.height=="number"&&typeof n.key=="string"?{url:n.url,width:n.width,height:n.height,key:n.key}:null,i=Array.isArray(e.regenHistory)?e.regenHistory.filter(a=>typeof a=="string"&&!Number.isNaN(Date.parse(a))):void 0,o=$(e.scheduledAt);return{enabled:e.enabled===!0,source:X(e.source,we,E.source),text:typeof e.text=="string"?K(e.text,Ae):"",image:typeof e.image=="string"&&e.image?e.image:null,layout:e.layout==="tile"?"tile":"single",position:X(e.position,xe,E.position),size:Y(e.size,Z),opacity:Y(e.opacity,Q),apply:Ie(e.apply),overlay:r,version:typeof e.version=="string"&&e.version?e.version:null,activatedAt:$(e.activatedAt),deactivatedAt:$(e.deactivatedAt),...i&&i.length>0?{regenHistory:i}:{},...o?{scheduledAt:o}:{}}}function $(t){return typeof t=="string"&&!Number.isNaN(Date.parse(t))?t:null}function Qe(t){let e=t&&typeof t=="object"?t:{},n=r=>typeof e[r]=="boolean"?e[r]:F[r];return{allowDownload:n("allowDownload"),keepCopyright:n("keepCopyright"),deterrence:n("deterrence"),watermark:Fe(e.watermark)}}function Je(t){return t.allowDownload&&!t.deterrence}function et(t){return!t.deterrence}var y=v(Re());var ee=["24:9","21:9","16:9","4:3","1:1","4:5"],te=["16:9","4:3","1:1","3:4","4:5"],Me=["4:3","1:1","3:4"];function d(t){if(typeof t!="string")return null;let e=/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(t.trim());if(!e)return null;let n=Number(e[1]),r=Number(e[2]);if(!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0)return null;let i=n/r;return i<.25-1e-6||i>5+1e-6?null:i}function nt(t){return t.desktop===null||t.tablet===null||t.mobile===null}var D={mobile:{fill:"absolute inset-0 h-full w-full",flow:"relative h-auto w-full"},tablet:{fill:"md:absolute md:inset-0 md:h-full",flow:"md:relative md:inset-auto md:h-auto"},desktop:{fill:"lg:absolute lg:inset-0 lg:h-full",flow:"lg:relative lg:inset-auto lg:h-auto"}};function rt(t){let e=a=>a&&d(a)?"fill":"flow",n=e(t.mobile),r=e(t.tablet),i=e(t.desktop),o=[D.mobile[n]];return r!==n&&o.push(D.tablet[r]),i!==r&&o.push(D.desktop[i]),o.join(" ")}function Se(t){switch(t??"standard"){case"compact":return"24:9";case"tall":return"16:9";default:return"21:9"}}var T={"page-main-visual:banner-profile":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:ee,allowCustomRatio:!0},"page-main-visual:split-hero":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:te,allowCustomRatio:!0},"page-main-visual:overlay-hero":{tabletInherits:"desktop",devices:["desktop","mobile"],presets:["16:9","4:5"],allowCustomRatio:!1,fixedHeight:!0},"image-text-split":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:te,allowCustomRatio:!0,allowNatural:!0},"full-width-image":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:ee,allowCustomRatio:!0,allowNatural:!0},"card-grid":{tabletInherits:"desktop",devices:["desktop"],presets:Me,allowCustomRatio:!1},"multi-link":{tabletInherits:"desktop",devices:["desktop"],presets:["4:3"],allowCustomRatio:!1}};function ne(t,e,n="desktop"){if(t==null)return{desktop:e,tablet:e,mobile:e};if(typeof t!="object")return{desktop:t,tablet:t,mobile:t};let r=t,i=r.desktop??e,o=r.mobile??i,a=r.tablet??(n==="mobile"?o:i);return{desktop:i,tablet:a,mobile:o}}function ke(t){let e=t.layout??"banner-profile";if(e==="overlay-hero")return{policy:T["page-main-visual:overlay-hero"],ratios:{desktop:"16:9",tablet:"16:9",mobile:"4:5"},fixedHeight:!0};if(e==="split-hero"){let o=T["page-main-visual:split-hero"],a=ne(t.imageRatio,"4:3",o.tabletInherits);return{policy:o,ratios:{desktop:a.desktop==="natural"||!d(a.desktop)?"4:3":a.desktop,tablet:a.tablet==="natural"||!d(a.tablet)?"4:3":a.tablet,mobile:a.mobile==="natural"||!d(a.mobile)?"4:3":a.mobile},fixedHeight:!1}}let n=T["page-main-visual:banner-profile"],r=Se(t.bannerHeight),i=ne(t.imageRatio,r,n.tabletInherits);return{policy:n,ratios:{desktop:i.desktop==="natural"||!d(i.desktop)?r:i.desktop,tablet:i.tablet==="natural"||!d(i.tablet)?r:i.tablet,mobile:i.mobile==="natural"||!d(i.mobile)?r:i.mobile},fixedHeight:!1}}function Ce(t){let e=t.desktop,n=t.tablet,r=t.mobile;if(!e&&!n&&!r)return null;if(e&&e===n&&e===r)return[{device:"all",ratio:e}];let i=[];return e&&i.push({device:"desktop",ratio:e}),n&&n!==e&&n!==r&&i.push({device:"tablet",ratio:n}),r&&r!==e&&i.push({device:"mobile",ratio:r}),i.length>0?i:null}function ve(t){let{ratios:e}=ke(t??{});return Ce(e)??[{device:"all",ratio:"21:9"}]}var it=ve();var M=.05;function re(t){return Math.min(1,Math.max(0,t))}function _(t){if(!t||typeof t!="object")return null;let{x:e,y:n}=t;return typeof e!="number"||typeof n!="number"||!Number.isFinite(e)||!Number.isFinite(n)?null:{x:re(e),y:re(n)}}function ie(t){if(!t||typeof t!="object")return null;let{x:e,y:n,w:r,h:i}=t;if(typeof e!="number"||typeof n!="number"||typeof r!="number"||typeof i!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i))return null;let o=Math.min(1,Math.max(M,r)),a=Math.min(1,Math.max(M,i)),s=Math.min(1-o,Math.max(0,e)),u=Math.min(1-a,Math.max(0,n));return{x:s,y:u,w:o,h:a}}function oe(t){if(!t||typeof t!="object")return null;let e=t;if(typeof e.ratio!="string"||!d(e.ratio))return null;let n=ie(e.rect);return n?{ratio:e.ratio.trim(),rect:n}:null}function $e(t){if(typeof t!="string")return;let e=t.trim();return/^#[0-9a-fA-F]{6}$/.test(e)?e.toLowerCase():void 0}function Ee(t){return Math.abs(t.x-.5)<.005&&Math.abs(t.y-.5)<.005}function P(t){let e=_(t?.focus);return!e||Ee(e)?null:e}function O(t){if(!t?.screens||typeof t.screens!="object")return!1;for(let e of["desktop","tablet","mobile"])if(oe(t.screens[e]))return!0;return!1}function De(t,e,n){let r=_(t)??{x:.5,y:.5};if(!Number.isFinite(e)||e<=0||!Number.isFinite(n)||n<=0)return{x:0,y:0,w:1,h:1};if(e>=n){let s=Math.min(1,Math.max(M,n/e));return{x:Math.min(1-s,Math.max(0,r.x-s/2)),y:0,w:s,h:1}}let i=1,o=Math.min(1,Math.max(M,e/n));return{x:0,y:Math.min(1-o,Math.max(0,r.y-o/2)),w:i,h:o}}function Te(t,e,n){if(!t)return!1;let r=d(t.ratio),i=d(e);if(!r||!i||Math.abs(r-i)/i>.01)return!1;if(n&&n.width>0&&n.height>0&&t.rect.h>0){let o=t.rect.w*n.width/(t.rect.h*n.height);if(Math.abs(o-i)/i>.02)return!1}return!0}function U(t){let{framing:e,device:n,targetRatio:r,tabletInherits:i="desktop"}=t,o=t.source??e?.source??null,a=e?.screens,s=n==="desktop"?["desktop"]:n==="mobile"?["mobile","desktop"]:i==="mobile"?["tablet","mobile","desktop"]:["tablet","desktop"],u=null,c=!1;for(let h of s){let g=oe(a?.[h]);if(g){if(Te(g,r,o)){u=g;break}h===n&&(c=!0)}}if(u)return{ratio:r,rect:u.rect,derived:!1,ratioMismatchFallback:!1};let m=d(r)??16/9,l=o&&o.width>0&&o.height>0?o.width/o.height:m;return{ratio:r,rect:De(e?.focus,l,m),derived:!0,ratioMismatchFallback:c}}function W(t,e){if(!e||!Number.isFinite(e.width)||!Number.isFinite(e.height)||e.width<=0||e.height<=0)return null;let n=ie(t);if(!n)return null;let r=Math.max(0,Math.round(n.x*e.width)),i=Math.max(0,Math.round(n.y*e.height)),o=Math.max(1,Math.round(n.w*e.width)),a=Math.max(1,Math.round(n.h*e.height)),s=Math.max(0,e.width-r-o),u=Math.max(0,e.height-i-a);return i<=1&&s<=1&&u<=1&&r<=1?null:{top:i,right:s,bottom:u,left:r}}function st(t){let e=n=>`${Math.round(n*1e3)/10}%`;return`${e(t.x)} ${e(t.y)}`}function ae(t){let e=n=>(Math.round(n*100)/100).toFixed(2);return`${e(t.x)}x${e(t.y)}`}var se="asset:",_e=/^asset:[a-z0-9]+$/;function Pe(t){return _e.test(t)}var ce="xu6i8N5WjaI_9HFe-hZzmg",gt=`https://img.kanorio.com/cdn-cgi/imagedelivery/${ce}`;var mt=String.raw`[^\s"'()<>?#\\]+`,Oe=String.raw`[A-Za-z0-9_.-]+`;function Ue(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var pt=String.raw`(?:[?#][^\s"'()<>\\]*)?`;var We=new RegExp(String.raw`^https://(?:imagedelivery\.net|[a-z0-9-]+\.kanorio\.com/cdn-cgi/imagedelivery|img\.kanorio\.com/wm/[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)/${Ue(ce)}/(${Oe})(?:[/?#]|$)`);function Ne(t){return t?We.exec(t)?.[1]??null:null}var ze="mixed";function Le(t){return t&&t!==ze?t:null}function ft(t,e){let n=t??"";if(!e?.name)return n;if(!n||n===e.name||e.formerNames?.includes(n))return e.name;let r=e.name.lastIndexOf("."),i=n.lastIndexOf(".");return r<=0||i<=0?n:`${n.slice(0,i)}${e.name.slice(r)}`}function ht(t,e){if(e.assetId){let i=t[`${se}${e.assetId}`];if(i)return i}if(!e.url)return;if(Pe(e.url))return t[e.url];let n=Ne(e.url);if(n)return t[n];let r=e.url.split(/[?#]/,1)[0];for(let[i,o]of Object.entries(t))if(!i.startsWith(se)&&r.endsWith(`/${i}`))return o}var p=85;function le(t){if(t)try{let e=new URL(t),n=e.pathname.split("/").filter(Boolean);return e.hostname==="imagedelivery.net"&&n.length>=2?n[1]:e.hostname.endsWith(".kanorio.com")&&n[0]==="cdn-cgi"&&n[1]==="imagedelivery"&&n.length>=4?n[3]:void 0}catch{return}}function je(t){return(t.split(/[?#]/,1)[0]??"").toLowerCase().endsWith(".svg")}function x(t){if(!t)return!1;try{let e=new URL(t);return!!(e.hostname==="imagedelivery.net"||e.hostname.endsWith(".kanorio.com")&&e.pathname.startsWith("/cdn-cgi/imagedelivery/"))}catch{return!1}}function He(t){try{let e=new URL(t);return e.searchParams.has("width")||e.searchParams.has("height")||e.searchParams.has("quality")||e.searchParams.has("fit")}catch{return!1}}function ue(t){switch(t){case"page-main-visual-background":return{width:1920,quality:p,fit:"cover"};case"page-main-visual-logo":return{width:600,height:600,quality:p,fit:"scale-down"};case"header-logo":return{width:600,height:600,quality:p,fit:"scale-down"};case"card-grid-carousel-image":return{width:800,quality:p,fit:"crop"};case"image-text-split-image":return{width:1200,quality:p,fit:"crop"};case"multi-image-carousel-image":return{width:1600,quality:p,fit:"scale-down"};case"lightbox-image":return{width:4096,quality:p,fit:"scale-down"};case"full-width-image":return{width:1920,quality:p,fit:"contain"};default:return{width:1920,quality:p,fit:"crop"}}}function L(t){try{let e=new URL(t),n=e.pathname.split("/").filter(Boolean);return e.hostname==="imagedelivery.net"&&n.length>=3?{baseUrl:`${e.protocol}//${e.hostname}`,accountHash:n[0],imageId:n[1],variant:n[2]||"public"}:e.hostname.endsWith(".kanorio.com")&&n[0]==="cdn-cgi"&&n[1]==="imagedelivery"&&n.length>=5?{baseUrl:`${e.protocol}//${e.hostname}/cdn-cgi/imagedelivery`,accountHash:n[2],imageId:n[3],variant:n[4]||"public"}:null}catch{return null}}function Ge(t,e){let{baseUrl:n,accountHash:r,imageId:i}=t,o=ue(e.useCase),a=e.width??o.width,s=e.height??o.height,u=p,c=e.fit??o.fit,m=e.format,l=[];if(e.trim){let{top:h,right:g,bottom:f,left:S}=e.trim;l.push(`trim=${Math.max(0,Math.round(h))};${Math.max(0,Math.round(g))};${Math.max(0,Math.round(f))};${Math.max(0,Math.round(S))}`)}return a&&l.push(`w=${a}`),s&&l.push(`h=${s}`),c&&l.push(`fit=${c}`),!e.trim&&e.focus&&a&&s&&(c==="crop"||c==="cover")&&l.push(`gravity=${ae(e.focus)}`),e.background&&/^#[0-9a-fA-F]{6}$/.test(e.background)&&l.push(`background=${encodeURIComponent(e.background)}`),l.push(`q=${u}`),m&&l.push(`f=${m}`),l.length>0?`${n}/${r}/${i}/${l.join(",")}`:`${n}/${r}/${i}/public`}function qe(t){return ue(t).width??1920}function N(t,e){if(!x(t)||He(t)&&!e.format)return t;let n=L(t);return n?Ge(n,e):t}function Ft(t){if(!x(t))return t;let e=L(t);return e?`${e.baseUrl}/${e.accountHash}/${e.imageId}/public`:t}var Be=[400,800,1200,1600],Ve="(max-width: 768px) 100vw, 960px";function Mt(t){if(!x(t))return null;let e=L(t);if(!e)return null;let{baseUrl:n,accountHash:r,imageId:i}=e,o=p,a="scale-down",s=Be.map(c=>`${n}/${r}/${i}/w=${c},fit=${a},q=${o} ${c}w`).join(", ");return{src:`${n}/${r}/${i}/w=800,fit=${a},q=${o}`,srcSet:s,sizes:Ve}}var Ke={mobile:[640,1080],tablet:[1024,1536],desktop:[1440,1920]},R={mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)"},de=["desktop","tablet","mobile"];function ge(t){let e={};for(let n of de){let r=t.ratios[n];if(!r){e[n]={ratio:null,rect:null};continue}let i=U({framing:t.framing,device:n,targetRatio:r,tabletInherits:t.tabletInherits,source:t.source});e[n]={ratio:r,rect:i.derived?null:i.rect}}return e}function z(t,e){return t.ratio!==e.ratio?!1:!t.rect||!e.rect?t.rect===e.rect:Math.abs(t.rect.x-e.rect.x)<5e-4&&Math.abs(t.rect.y-e.rect.y)<5e-4&&Math.abs(t.rect.w-e.rect.w)<5e-4&&Math.abs(t.rect.h-e.rect.h)<5e-4}function Ye(t,e){let n=Ke[t];return!e||e<=0||e>=n[n.length-1]?n:[...n.filter(r=>r<e),Math.round(e)]}function St(t){let{src:e,framing:n,deviceRatios:r,tabletInherits:i="desktop"}=t;if(!e||!r)return"single";let o=r.mobile===r.desktop&&r.tablet===r.desktop,a=O(n);if(!a&&o)return"single";let s=x(e)&&!je(e);if(!a)return s?"picture":"single";let u=n?.source&&n.source.width>0&&n.source.height>0?n.source:null,c=ge({framing:n,ratios:r,tabletInherits:i,source:u});return de.some(l=>c[l].rect!==null)?!s||!u?"css-fallback":o&&z(c.desktop,c.tablet)&&z(c.desktop,c.mobile)?"single-trim":"picture":o||!s?"single":"picture"}function kt(t){let e=t.useCase??"general",n=t.width??qe(e),r=d(t.ratio)??16/9,i=Math.max(1,Math.round(n/r)),o=t.framing?.source&&t.framing.source.width>0&&t.framing.source.height>0?t.framing.source:null,a=U({framing:t.framing,device:"desktop",targetRatio:t.ratio,tabletInherits:t.tabletInherits,source:o}),s=!a.derived&&o?W(a.rect,o):null;return{src:N(t.src,{useCase:e,width:n,height:i,fit:"crop",trim:s,focus:s?null:P(t.framing)}),width:n,height:i}}function Ct(t){let{src:e,useCase:n="general",ratios:r,framing:i,tabletInherits:o="desktop",maxWidth:a}=t;if(!x(e))return null;let s=i?.source&&i.source.width>0&&i.source.height>0?i.source:null,u=P(i),c=ge({framing:i,ratios:r,tabletInherits:o,source:s}),m=b=>{let{ratio:j,rect:H}=c[b],w=j?d(j)??16/9:null,G=H&&s?W(H,s):null,k=Ye(b,a),A=[],he=k.map(I=>{let B=w?N(e,{useCase:n,width:I,height:Math.max(1,Math.round(I/w)),fit:"crop",trim:G,focus:G?null:u}):N(e,{useCase:n,width:I,fit:"scale-down"});return A.push(B),`${B} ${I}w`}),C=k[k.length-1],q=s?s.width/s.height:null,be=w?Math.max(1,Math.round(C/w)):q?Math.max(1,Math.round(C/q)):null,ye=A[A.length-1];return{device:b,media:b==="desktop"?void 0:R[b],src:ye,srcSet:he.join(", "),sizes:t.sizes?.[b]??"100vw",width:C,height:be,urls:A}},l=m("mobile"),h=m("tablet"),g=m("desktop"),f=z(c.tablet,c.desktop)?null:h,S=f?[{media:R.mobile,href:l.src,imageSrcSet:l.srcSet,imageSizes:l.sizes},{media:R.tablet,href:f.src,imageSrcSet:f.srcSet,imageSizes:f.sizes},{media:R.desktop,href:g.src,imageSrcSet:g.srcSet,imageSizes:g.sizes}]:[{media:R.mobile,href:l.src,imageSrcSet:l.srcSet,imageSizes:l.sizes},{media:"(min-width: 768px)",href:g.src,imageSrcSet:g.srcSet,imageSizes:g.sizes}],fe=Array.from(new Set([...l.urls,...f?f.urls:[],...g.urls]));return{mobile:l,tablet:f,desktop:g,preloads:S,allVariantUrls:fe}}var pe=v(V()),Xe={protection:F,imageDownloadUrl:()=>null},me=(0,y.createContext)(Xe);function Dt({protection:t,websiteId:e,apiBase:n="",children:r}){let i=(0,y.useMemo)(()=>({protection:t??F,imageDownloadUrl:(o,a)=>{let s=le(o);if(!e||!s)return null;let u=`${n}/api/public/sites/${encodeURIComponent(e)}/images/${encodeURIComponent(s)}/download`,c=new URLSearchParams;a&&c.set("name",a);let m=c.toString();return m?`${u}?${m}`:u}}),[t,e,n]);return(0,pe.jsx)(me.Provider,{value:i,children:r})}function Tt(){return(0,y.useContext)(me)}export{nt as a,rt as b,ie as c,$e as d,P as e,U as f,st as g,Le as h,ft as i,ht as j,le as k,je as l,N as m,Ft as n,Mt as o,St as p,kt as q,Ct as r,Qe as s,Je as t,et as u,Dt as v,Tt as w};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as K}from"./chunk-3NXF6SCJ.js";import{a as V}from"./chunk-OU4IOHLN.js";import{a as Re}from"./chunk-6LGTFWQS.js";import{c as v}from"./chunk-CDG7S4P5.js";var xe=["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"],we=["logo","text","image"],X={min:5,max:50,default:20},Q={min:10,max:100,default:60},Ae=60,J={pages:!0,articles:!0,products:!1},E={enabled:!1,source:"logo",text:"",image:null,layout:"single",position:"bottom-right",size:X.default,opacity:Q.default,apply:J,overlay:null,version:null,activatedAt:null,deactivatedAt:null},F={allowDownload:!0,keepCopyright:!0,deterrence:!1,watermark:E};function Y(t,e){return typeof t!="number"||!Number.isFinite(t)?e.default:Math.min(e.max,Math.max(e.min,Math.round(t)))}function Z(t,e,n){return typeof t=="string"&&e.includes(t)?t:n}function Ie(t){let e=t&&typeof t=="object"?t:{},n=r=>typeof e[r]=="boolean"?e[r]:J[r];return{pages:n("pages"),articles:n("articles"),products:n("products")}}function Fe(t){let e=t&&typeof t=="object"?t:{},n=e.overlay&&typeof e.overlay=="object"?e.overlay:null,r=n&&typeof n.url=="string"&&typeof n.width=="number"&&typeof n.height=="number"&&typeof n.key=="string"?{url:n.url,width:n.width,height:n.height,key:n.key}:null,i=Array.isArray(e.regenHistory)?e.regenHistory.filter(a=>typeof a=="string"&&!Number.isNaN(Date.parse(a))):void 0,o=$(e.scheduledAt);return{enabled:e.enabled===!0,source:Z(e.source,we,E.source),text:typeof e.text=="string"?K(e.text,Ae):"",image:typeof e.image=="string"&&e.image?e.image:null,layout:e.layout==="tile"?"tile":"single",position:Z(e.position,xe,E.position),size:Y(e.size,X),opacity:Y(e.opacity,Q),apply:Ie(e.apply),overlay:r,version:typeof e.version=="string"&&e.version?e.version:null,activatedAt:$(e.activatedAt),deactivatedAt:$(e.deactivatedAt),...i&&i.length>0?{regenHistory:i}:{},...o?{scheduledAt:o}:{}}}function $(t){return typeof t=="string"&&!Number.isNaN(Date.parse(t))?t:null}function Qe(t){let e=t&&typeof t=="object"?t:{},n=r=>typeof e[r]=="boolean"?e[r]:F[r];return{allowDownload:n("allowDownload"),keepCopyright:n("keepCopyright"),deterrence:n("deterrence"),watermark:Fe(e.watermark)}}function Je(t){return t.allowDownload&&!t.deterrence}function et(t){return!t.deterrence}var y=v(Re());var ee=["24:9","21:9","16:9","4:3","1:1","4:5"],te=["16:9","4:3","1:1","3:4","4:5"],Me=["4:3","1:1","3:4"];function d(t){if(typeof t!="string")return null;let e=/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(t.trim());if(!e)return null;let n=Number(e[1]),r=Number(e[2]);if(!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0)return null;let i=n/r;return i<.25-1e-6||i>5+1e-6?null:i}function nt(t){return t.desktop===null||t.tablet===null||t.mobile===null}var D={mobile:{fill:"absolute inset-0 h-full w-full",flow:"relative h-auto w-full"},tablet:{fill:"md:absolute md:inset-0 md:h-full",flow:"md:relative md:inset-auto md:h-auto"},desktop:{fill:"lg:absolute lg:inset-0 lg:h-full",flow:"lg:relative lg:inset-auto lg:h-auto"}};function rt(t){let e=a=>a&&d(a)?"fill":"flow",n=e(t.mobile),r=e(t.tablet),i=e(t.desktop),o=[D.mobile[n]];return r!==n&&o.push(D.tablet[r]),i!==r&&o.push(D.desktop[i]),o.join(" ")}function Se(t){switch(t??"standard"){case"compact":return"24:9";case"tall":return"16:9";default:return"21:9"}}var T={"page-main-visual:banner-profile":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:ee,allowCustomRatio:!0},"page-main-visual:split-hero":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:te,allowCustomRatio:!0},"page-main-visual:overlay-hero":{tabletInherits:"desktop",devices:["desktop","mobile"],presets:["16:9","4:5"],allowCustomRatio:!1,fixedHeight:!0},"image-text-split":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:te,allowCustomRatio:!0,allowNatural:!0},"full-width-image":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:ee,allowCustomRatio:!0,allowNatural:!0},"card-grid":{tabletInherits:"desktop",devices:["desktop"],presets:Me,allowCustomRatio:!1},"multi-link":{tabletInherits:"desktop",devices:["desktop"],presets:["4:3"],allowCustomRatio:!1}};function ne(t,e,n="desktop"){if(t==null)return{desktop:e,tablet:e,mobile:e};if(typeof t!="object")return{desktop:t,tablet:t,mobile:t};let r=t,i=r.desktop??e,o=r.mobile??i,a=r.tablet??(n==="mobile"?o:i);return{desktop:i,tablet:a,mobile:o}}function ke(t){let e=t.layout??"banner-profile";if(e==="overlay-hero")return{policy:T["page-main-visual:overlay-hero"],ratios:{desktop:"16:9",tablet:"16:9",mobile:"4:5"},fixedHeight:!0};if(e==="split-hero"){let o=T["page-main-visual:split-hero"],a=ne(t.imageRatio,"4:3",o.tabletInherits);return{policy:o,ratios:{desktop:a.desktop==="natural"||!d(a.desktop)?"4:3":a.desktop,tablet:a.tablet==="natural"||!d(a.tablet)?"4:3":a.tablet,mobile:a.mobile==="natural"||!d(a.mobile)?"4:3":a.mobile},fixedHeight:!1}}let n=T["page-main-visual:banner-profile"],r=Se(t.bannerHeight),i=ne(t.imageRatio,r,n.tabletInherits);return{policy:n,ratios:{desktop:i.desktop==="natural"||!d(i.desktop)?r:i.desktop,tablet:i.tablet==="natural"||!d(i.tablet)?r:i.tablet,mobile:i.mobile==="natural"||!d(i.mobile)?r:i.mobile},fixedHeight:!1}}function Ce(t){let e=t.desktop,n=t.tablet,r=t.mobile;if(!e&&!n&&!r)return null;if(e&&e===n&&e===r)return[{device:"all",ratio:e}];let i=[];return e&&i.push({device:"desktop",ratio:e}),n&&n!==e&&n!==r&&i.push({device:"tablet",ratio:n}),r&&r!==e&&i.push({device:"mobile",ratio:r}),i.length>0?i:null}function ve(t){let{ratios:e}=ke(t??{});return Ce(e)??[{device:"all",ratio:"21:9"}]}var it=ve();var M=.05;function re(t){return Math.min(1,Math.max(0,t))}function _(t){if(!t||typeof t!="object")return null;let{x:e,y:n}=t;return typeof e!="number"||typeof n!="number"||!Number.isFinite(e)||!Number.isFinite(n)?null:{x:re(e),y:re(n)}}function ie(t){if(!t||typeof t!="object")return null;let{x:e,y:n,w:r,h:i}=t;if(typeof e!="number"||typeof n!="number"||typeof r!="number"||typeof i!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i))return null;let o=Math.min(1,Math.max(M,r)),a=Math.min(1,Math.max(M,i)),s=Math.min(1-o,Math.max(0,e)),u=Math.min(1-a,Math.max(0,n));return{x:s,y:u,w:o,h:a}}function oe(t){if(!t||typeof t!="object")return null;let e=t;if(typeof e.ratio!="string"||!d(e.ratio))return null;let n=ie(e.rect);return n?{ratio:e.ratio.trim(),rect:n}:null}function $e(t){if(typeof t!="string")return;let e=t.trim();return/^#[0-9a-fA-F]{6}$/.test(e)?e.toLowerCase():void 0}function Ee(t){return Math.abs(t.x-.5)<.005&&Math.abs(t.y-.5)<.005}function P(t){let e=_(t?.focus);return!e||Ee(e)?null:e}function O(t){if(!t?.screens||typeof t.screens!="object")return!1;for(let e of["desktop","tablet","mobile"])if(oe(t.screens[e]))return!0;return!1}function De(t,e,n){let r=_(t)??{x:.5,y:.5};if(!Number.isFinite(e)||e<=0||!Number.isFinite(n)||n<=0)return{x:0,y:0,w:1,h:1};if(e>=n){let s=Math.min(1,Math.max(M,n/e));return{x:Math.min(1-s,Math.max(0,r.x-s/2)),y:0,w:s,h:1}}let i=1,o=Math.min(1,Math.max(M,e/n));return{x:0,y:Math.min(1-o,Math.max(0,r.y-o/2)),w:i,h:o}}function Te(t,e,n){if(!t)return!1;let r=d(t.ratio),i=d(e);if(!r||!i||Math.abs(r-i)/i>.01)return!1;if(n&&n.width>0&&n.height>0&&t.rect.h>0){let o=t.rect.w*n.width/(t.rect.h*n.height);if(Math.abs(o-i)/i>.02)return!1}return!0}function U(t){let{framing:e,device:n,targetRatio:r,tabletInherits:i="desktop"}=t,o=t.source??e?.source??null,a=e?.screens,s=n==="desktop"?["desktop"]:n==="mobile"?["mobile","desktop"]:i==="mobile"?["tablet","mobile","desktop"]:["tablet","desktop"],u=null,c=!1;for(let h of s){let g=oe(a?.[h]);if(g){if(Te(g,r,o)){u=g;break}h===n&&(c=!0)}}if(u)return{ratio:r,rect:u.rect,derived:!1,ratioMismatchFallback:!1};let m=d(r)??16/9,l=o&&o.width>0&&o.height>0?o.width/o.height:m;return{ratio:r,rect:De(e?.focus,l,m),derived:!0,ratioMismatchFallback:c}}function W(t,e){if(!e||!Number.isFinite(e.width)||!Number.isFinite(e.height)||e.width<=0||e.height<=0)return null;let n=ie(t);if(!n)return null;let r=Math.max(0,Math.round(n.x*e.width)),i=Math.max(0,Math.round(n.y*e.height)),o=Math.max(1,Math.round(n.w*e.width)),a=Math.max(1,Math.round(n.h*e.height)),s=Math.max(0,e.width-r-o),u=Math.max(0,e.height-i-a);return i<=1&&s<=1&&u<=1&&r<=1?null:{top:i,right:s,bottom:u,left:r}}function st(t){let e=n=>`${Math.round(n*1e3)/10}%`;return`${e(t.x)} ${e(t.y)}`}function ae(t){let e=n=>(Math.round(n*100)/100).toFixed(2);return`${e(t.x)}x${e(t.y)}`}var se="asset:",_e=/^asset:[a-z0-9]+$/;function Pe(t){return _e.test(t)}var ce="xu6i8N5WjaI_9HFe-hZzmg",gt=`https://img.kanorio.com/cdn-cgi/imagedelivery/${ce}`;var mt=String.raw`[^\s"'()<>?#\\]+`,Oe=String.raw`[A-Za-z0-9_.-]+`;function Ue(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var pt=String.raw`(?:[?#][^\s"'()<>\\]*)?`;var We=new RegExp(String.raw`^https://(?:imagedelivery\.net|[a-z0-9-]+\.kanorio\.com/cdn-cgi/imagedelivery|img\.kanorio\.com/wm/[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)/${Ue(ce)}/(${Oe})(?:[/?#]|$)`);function Ne(t){return t?We.exec(t)?.[1]??null:null}var Le="mixed";function ze(t){return t&&t!==Le?t:null}function ft(t,e){let n=t??"";if(!e?.name)return n;if(!n||n===e.name||e.formerNames?.includes(n))return e.name;let r=e.name.lastIndexOf("."),i=n.lastIndexOf(".");return r<=0||i<=0?n:`${n.slice(0,i)}${e.name.slice(r)}`}function ht(t,e){if(e.assetId){let i=t[`${se}${e.assetId}`];if(i)return i}if(!e.url)return;if(Pe(e.url))return t[e.url];let n=Ne(e.url);if(n)return t[n];let r=e.url.split(/[?#]/,1)[0];for(let[i,o]of Object.entries(t))if(!i.startsWith(se)&&r.endsWith(`/${i}`))return o}var p=85,Ft=`w=12000,h=12000,fit=scale-down,q=${p}`;function le(t){if(t)try{let e=new URL(t),n=e.pathname.split("/").filter(Boolean);return e.hostname==="imagedelivery.net"&&n.length>=2?n[1]:e.hostname.endsWith(".kanorio.com")&&n[0]==="cdn-cgi"&&n[1]==="imagedelivery"&&n.length>=4?n[3]:void 0}catch{return}}function je(t){return(t.split(/[?#]/,1)[0]??"").toLowerCase().endsWith(".svg")}function x(t){if(!t)return!1;try{let e=new URL(t);return!!(e.hostname==="imagedelivery.net"||e.hostname.endsWith(".kanorio.com")&&e.pathname.startsWith("/cdn-cgi/imagedelivery/"))}catch{return!1}}function He(t){try{let e=new URL(t);return e.searchParams.has("width")||e.searchParams.has("height")||e.searchParams.has("quality")||e.searchParams.has("fit")}catch{return!1}}function ue(t){switch(t){case"page-main-visual-background":return{width:1920,quality:p,fit:"cover"};case"page-main-visual-logo":return{width:600,height:600,quality:p,fit:"scale-down"};case"header-logo":return{width:600,height:600,quality:p,fit:"scale-down"};case"card-grid-carousel-image":return{width:800,quality:p,fit:"crop"};case"image-text-split-image":return{width:1200,quality:p,fit:"crop"};case"multi-image-carousel-image":return{width:1600,quality:p,fit:"scale-down"};case"lightbox-image":return{width:4096,quality:p,fit:"scale-down"};case"full-width-image":return{width:1920,quality:p,fit:"contain"};default:return{width:1920,quality:p,fit:"crop"}}}function z(t){try{let e=new URL(t),n=e.pathname.split("/").filter(Boolean);return e.hostname==="imagedelivery.net"&&n.length>=3?{baseUrl:`${e.protocol}//${e.hostname}`,accountHash:n[0],imageId:n[1],variant:n[2]||"public"}:e.hostname.endsWith(".kanorio.com")&&n[0]==="cdn-cgi"&&n[1]==="imagedelivery"&&n.length>=5?{baseUrl:`${e.protocol}//${e.hostname}/cdn-cgi/imagedelivery`,accountHash:n[2],imageId:n[3],variant:n[4]||"public"}:null}catch{return null}}function Ge(t,e){let{baseUrl:n,accountHash:r,imageId:i}=t,o=ue(e.useCase),a=e.width??o.width,s=e.height??o.height,u=p,c=e.fit??o.fit,m=e.format,l=[];if(e.trim){let{top:h,right:g,bottom:f,left:S}=e.trim;l.push(`trim=${Math.max(0,Math.round(h))};${Math.max(0,Math.round(g))};${Math.max(0,Math.round(f))};${Math.max(0,Math.round(S))}`)}return a&&l.push(`w=${a}`),s&&l.push(`h=${s}`),c&&l.push(`fit=${c}`),!e.trim&&e.focus&&a&&s&&(c==="crop"||c==="cover")&&l.push(`gravity=${ae(e.focus)}`),e.background&&/^#[0-9a-fA-F]{6}$/.test(e.background)&&l.push(`background=${encodeURIComponent(e.background)}`),l.push(`q=${u}`),m&&l.push(`f=${m}`),l.length>0?`${n}/${r}/${i}/${l.join(",")}`:`${n}/${r}/${i}/public`}function qe(t){return ue(t).width??1920}function N(t,e){if(!x(t)||He(t)&&!e.format)return t;let n=z(t);return n?Ge(n,e):t}function Mt(t){if(!x(t))return t;let e=z(t);return e?`${e.baseUrl}/${e.accountHash}/${e.imageId}/public`:t}var Be=[400,800,1200,1600],Ve="(max-width: 768px) 100vw, 960px";function St(t){if(!x(t))return null;let e=z(t);if(!e)return null;let{baseUrl:n,accountHash:r,imageId:i}=e,o=p,a="scale-down",s=Be.map(c=>`${n}/${r}/${i}/w=${c},fit=${a},q=${o} ${c}w`).join(", ");return{src:`${n}/${r}/${i}/w=800,fit=${a},q=${o}`,srcSet:s,sizes:Ve}}var Ke={mobile:[640,1080],tablet:[1024,1536],desktop:[1440,1920]},R={mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)"},de=["desktop","tablet","mobile"];function ge(t){let e={};for(let n of de){let r=t.ratios[n];if(!r){e[n]={ratio:null,rect:null};continue}let i=U({framing:t.framing,device:n,targetRatio:r,tabletInherits:t.tabletInherits,source:t.source});e[n]={ratio:r,rect:i.derived?null:i.rect}}return e}function L(t,e){return t.ratio!==e.ratio?!1:!t.rect||!e.rect?t.rect===e.rect:Math.abs(t.rect.x-e.rect.x)<5e-4&&Math.abs(t.rect.y-e.rect.y)<5e-4&&Math.abs(t.rect.w-e.rect.w)<5e-4&&Math.abs(t.rect.h-e.rect.h)<5e-4}function Ye(t,e){let n=Ke[t];return!e||e<=0||e>=n[n.length-1]?n:[...n.filter(r=>r<e),Math.round(e)]}function kt(t){let{src:e,framing:n,deviceRatios:r,tabletInherits:i="desktop"}=t;if(!e||!r)return"single";let o=r.mobile===r.desktop&&r.tablet===r.desktop,a=O(n);if(!a&&o)return"single";let s=x(e)&&!je(e);if(!a)return s?"picture":"single";let u=n?.source&&n.source.width>0&&n.source.height>0?n.source:null,c=ge({framing:n,ratios:r,tabletInherits:i,source:u});return de.some(l=>c[l].rect!==null)?!s||!u?"css-fallback":o&&L(c.desktop,c.tablet)&&L(c.desktop,c.mobile)?"single-trim":"picture":o||!s?"single":"picture"}function Ct(t){let e=t.useCase??"general",n=t.width??qe(e),r=d(t.ratio)??16/9,i=Math.max(1,Math.round(n/r)),o=t.framing?.source&&t.framing.source.width>0&&t.framing.source.height>0?t.framing.source:null,a=U({framing:t.framing,device:"desktop",targetRatio:t.ratio,tabletInherits:t.tabletInherits,source:o}),s=!a.derived&&o?W(a.rect,o):null;return{src:N(t.src,{useCase:e,width:n,height:i,fit:"crop",trim:s,focus:s?null:P(t.framing)}),width:n,height:i}}function vt(t){let{src:e,useCase:n="general",ratios:r,framing:i,tabletInherits:o="desktop",maxWidth:a}=t;if(!x(e))return null;let s=i?.source&&i.source.width>0&&i.source.height>0?i.source:null,u=P(i),c=ge({framing:i,ratios:r,tabletInherits:o,source:s}),m=b=>{let{ratio:j,rect:H}=c[b],w=j?d(j)??16/9:null,G=H&&s?W(H,s):null,k=Ye(b,a),A=[],he=k.map(I=>{let B=w?N(e,{useCase:n,width:I,height:Math.max(1,Math.round(I/w)),fit:"crop",trim:G,focus:G?null:u}):N(e,{useCase:n,width:I,fit:"scale-down"});return A.push(B),`${B} ${I}w`}),C=k[k.length-1],q=s?s.width/s.height:null,be=w?Math.max(1,Math.round(C/w)):q?Math.max(1,Math.round(C/q)):null,ye=A[A.length-1];return{device:b,media:b==="desktop"?void 0:R[b],src:ye,srcSet:he.join(", "),sizes:t.sizes?.[b]??"100vw",width:C,height:be,urls:A}},l=m("mobile"),h=m("tablet"),g=m("desktop"),f=L(c.tablet,c.desktop)?null:h,S=f?[{media:R.mobile,href:l.src,imageSrcSet:l.srcSet,imageSizes:l.sizes},{media:R.tablet,href:f.src,imageSrcSet:f.srcSet,imageSizes:f.sizes},{media:R.desktop,href:g.src,imageSrcSet:g.srcSet,imageSizes:g.sizes}]:[{media:R.mobile,href:l.src,imageSrcSet:l.srcSet,imageSizes:l.sizes},{media:"(min-width: 768px)",href:g.src,imageSrcSet:g.srcSet,imageSizes:g.sizes}],fe=Array.from(new Set([...l.urls,...f?f.urls:[],...g.urls]));return{mobile:l,tablet:f,desktop:g,preloads:S,allVariantUrls:fe}}var pe=v(V()),Ze={protection:F,imageDownloadUrl:()=>null},me=(0,y.createContext)(Ze);function Tt({protection:t,websiteId:e,apiBase:n="",children:r}){let i=(0,y.useMemo)(()=>({protection:t??F,imageDownloadUrl:(o,a)=>{let s=le(o);if(!e||!s)return null;let u=`${n}/api/public/sites/${encodeURIComponent(e)}/images/${encodeURIComponent(s)}/download`,c=new URLSearchParams;a&&c.set("name",a);let m=c.toString();return m?`${u}?${m}`:u}}),[t,e,n]);return(0,pe.jsx)(me.Provider,{value:i,children:r})}function _t(){return(0,y.useContext)(me)}export{nt as a,rt as b,ie as c,$e as d,P as e,U as f,st as g,ze as h,ft as i,ht as j,le as k,je as l,N as m,Mt as n,St as o,kt as p,Ct as q,vt as r,Qe as s,Je as t,et as u,Tt as v,_t as w};
|
|
2
|
+
//# sourceMappingURL=chunk-65RP744E.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{fileTypesFor}from"./chunk-FFAWYDLJ.js";function resolveFormAvailability(form,now=Date.now()){if(form.status==="ARCHIVED")return"closed";const{openAt,closeAt,maxSubmissions}=form.settings;if(closeAt&&new Date(closeAt).getTime()<=now)return"closed";if(openAt&&new Date(openAt).getTime()>now)return"not_open";if(maxSubmissions!==void 0&&form.submissionCount>=maxSubmissions)return"full";return"open"}var FORM_FIELD_TYPES=["short_text","long_text","email","phone","choice","date","time","file","rating","number","url","statement","address","tax_id"];function isKnownFormFieldType(type){return typeof type==="string"&&FORM_FIELD_TYPES.includes(type)}function isAnswerableFormFieldType(type){return isKnownFormFieldType(type)&&type!=="statement"}var FORM_FILE_ACCEPT_DEFAULT=fileTypesFor("form").map(type=>type.mime);var FORM_LIMITS={PATTERN_MESSAGE_MAX:200,MAX_FIELDS:30,MAX_OPTIONS:20,LABEL_MAX:200,DESCRIPTION_MAX:500,SHORT_TEXT_MAX:500,LONG_TEXT_MAX:5e3,MAX_FILES_PER_FIELD:3,FILE_MAX_BYTES:10*1024*1024,SUBMIT_BODY_MAX_CHARS:256*1024,STATEMENT_MAX:1e3,DATE_OFFSET_MAX:3650,MAX_HIDDEN_FIELDS:10,HIDDEN_VALUE_MAX:500};function resolveFormDateBound(bound,today){if(!bound)return null;if(bound.type==="date")return bound.value;if(!today)return null;const[y,m,d]=today.split("-").map(Number);if(!y||!m||!d)return null;const date=new Date(Date.UTC(y,m-1,d+bound.offsetDays));return date.toISOString().slice(0,10)}function customConsentText(settings,mode){const text=settings.consentText?.[mode]?.trim();return text?text:null}function fillConsentTemplate(template,values){return template.replaceAll("{siteName}",values.siteName?.trim()||"").replaceAll("{button}",values.button).replace(/\s{2,}/g," ")}function resolveConsentLabel(settings,templates,websiteName){const mode=settings.marketingConsent;if(mode==="off")return null;const custom=customConsentText(settings,mode);if(custom)return custom;const template=mode==="checkbox"?templates.marketingOptIn:templates.subscribeOnSubmit;return fillConsentTemplate(template,{siteName:websiteName,button:settings.submitLabel||templates.submit})}var FORM_REDIRECT_URL_MAX=2048;var FORM_REDIRECT_EXPANDED_URL_MAX=4096;var FORM_REDIRECT_PLACEHOLDER_SOURCE="\\{(submissionId|answers\\.([a-z0-9][a-z0-9_-]*))\\}";var redirectPlaceholderRe=()=>new RegExp(FORM_REDIRECT_PLACEHOLDER_SOURCE,"g");function hasFormRedirectPlaceholders(template){return redirectPlaceholderRe().test(template??"")}function parseFormRedirectUrl(raw,options={}){if(typeof raw!=="string")return null;const value=raw.trim();if(!value||value.length>(options.maxLength??FORM_REDIRECT_URL_MAX)||/[\r\n\0\s]/.test(value))return null;const hasPlaceholders=hasFormRedirectPlaceholders(value);const probe=hasPlaceholders?value.replace(redirectPlaceholderRe(),"x"):value;if(/[{}]/.test(probe))return null;if(value.startsWith("/")){if(value.startsWith("//")||value.startsWith("/\\")||value.includes("\\"))return null;return{kind:"path",url:value}}try{const parsed=new URL(probe);if(parsed.protocol!=="https:"||parsed.username||parsed.password)return null;if(!hasPlaceholders)return{kind:"absolute",url:parsed.toString()};const rest=/^https:\/\//i.test(value)?value.slice("https://".length):null;if(rest===null)return null;const authorityEnd=rest.search(/[/?#]/);const authority=authorityEnd===-1?rest:rest.slice(0,authorityEnd);if(!authority||hasFormRedirectPlaceholders(authority))return null;if(redirectOriginOf(value.replace(redirectPlaceholderRe(),"a1"))!==redirectOriginOf(value.replace(redirectPlaceholderRe(),"b2.example")))return null;return{kind:"absolute",url:value}}catch{return null}}function redirectOriginOf(url){try{const parsed=new URL(url);return parsed.protocol==="https:"&&!parsed.username&&!parsed.password?parsed.origin:null}catch{return null}}function isFormTaxIdAnswer(value){if(!value||typeof value!=="object"||Array.isArray(value))return false;const row=value;return typeof row.countryCode==="string"&&typeof row.value==="string"}function isFormAddressAnswer(value){return Boolean(value)&&typeof value==="object"&&!Array.isArray(value)&&typeof value.countryCode==="string"}export{resolveFormAvailability,isKnownFormFieldType,isAnswerableFormFieldType,FORM_LIMITS,resolveFormDateBound,resolveConsentLabel,FORM_REDIRECT_EXPANDED_URL_MAX,hasFormRedirectPlaceholders,parseFormRedirectUrl,isFormTaxIdAnswer,isFormAddressAnswer};
|
|
2
|
+
//# sourceMappingURL=chunk-APWDEDWM.js.map
|