@kanorio/elements 1.2.0 → 1.4.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-BGIMYMGL.js +2 -0
- package/dist/KanorioAccount-E3NDKUX5.js +2 -0
- package/dist/KanorioAnalytics-CNEIZ4VZ.js +2 -0
- package/dist/KanorioAnalytics-RTCJ62AP.js +2 -0
- package/dist/KanorioCurriculum-CDHXCPSI.js +2 -0
- package/dist/KanorioCurriculum-JIKUHPOJ.js +2 -0
- package/dist/KanorioForm-QU243SAP.js +2 -0
- package/dist/KanorioForm-W6XBJW74.js +2 -0
- package/dist/KanorioLightbox-2YTEYM57.js +2 -0
- package/dist/KanorioLightbox-WCQ4NW5Z.js +2 -0
- package/dist/KanorioLogin-CDSAAJJE.js +2 -0
- package/dist/KanorioLogin-OYIESFJL.js +2 -0
- package/dist/KanorioMedia-BEFSUKSN.js +2 -0
- package/dist/KanorioMedia-ZGHENDE3.js +2 -0
- package/dist/KanorioReviews-O67GJZ24.js +2 -0
- package/dist/KanorioReviews-V5RUA2TV.js +2 -0
- package/dist/KanorioUnit-2FXOUNOP.js +2 -0
- package/dist/KanorioUnit-AIM4O7QI.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-73S6VKNV.js +2 -0
- package/dist/{chunk-4MOCTNN7.js → chunk-7UCZ56EJ.js} +2 -2
- package/dist/{chunk-FQCA2VGY.js → chunk-A4ZGBTRT.js} +2 -2
- package/dist/chunk-APWDEDWM.js +2 -0
- package/dist/{chunk-WM5S3YN5.js → chunk-CTMHQZAU.js} +2 -2
- package/dist/chunk-D4KDA3KL.js +2 -0
- package/dist/{chunk-2ONAW3CA.js → chunk-DIHLDYIG.js} +2 -2
- package/dist/chunk-EGMCB2MQ.js +3 -0
- package/dist/{chunk-LWRWKZBC.js → chunk-FFSPNYLJ.js} +2 -2
- package/dist/chunk-FXDWRWZ3.js +3 -0
- package/dist/chunk-I6KLZIN6.js +2 -0
- package/dist/{chunk-NGRNPVON.js → chunk-II7PVZWZ.js} +2 -2
- package/dist/chunk-J24HGQ7U.js +2 -0
- package/dist/{chunk-4KA3HSRQ.js → chunk-JYBSXLT3.js} +2 -2
- 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-36YEGBKK.js → chunk-N4Y3DCC6.js} +2 -2
- package/dist/{chunk-NBDRYQZV.js → chunk-OLGITMLA.js} +2 -2
- package/dist/{chunk-5HWAL7VK.js → chunk-OSXFUIAV.js} +2 -2
- package/dist/chunk-Q4APVE7S.js +2 -0
- package/dist/chunk-QF55WZDP.js +2 -0
- package/dist/chunk-QYTK2CW3.js +2 -0
- package/dist/chunk-RNRIZCZS.js +2 -0
- package/dist/{chunk-K4VRRKYJ.js → chunk-UDNUWN4W.js} +2 -2
- package/dist/{chunk-AF46NLXK.js → chunk-UITC3NFQ.js} +2 -2
- package/dist/chunk-UWRJBUJY.js +2 -0
- package/dist/chunk-VGQ2N7JH.js +2 -0
- package/dist/{chunk-H7VP4BYY.js → chunk-VRD67HVO.js} +2 -2
- package/dist/chunk-VT2B53EX.js +2 -0
- package/dist/{chunk-BGVTMWPN.js → chunk-W5QS3RHM.js} +2 -2
- package/dist/chunk-WJPCDZSL.js +2 -0
- package/dist/chunk-XJPS3G7J.js +3 -0
- 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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{clampText}from"./chunk-O2SYHUQF.js";var WATERMARK_POSITIONS=["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"];var WATERMARK_SOURCES=["logo","text","image"];var WATERMARK_SIZE_RANGE={min:5,max:50,default:20};var WATERMARK_OPACITY_RANGE={min:10,max:100,default:60};var WATERMARK_TEXT_MAX_LENGTH=60;var DEFAULT_WATERMARK_APPLY={pages:true,articles:true,products:false};var DEFAULT_MEDIA_WATERMARK={enabled:false,source:"logo",text:"",image:null,layout:"single",position:"bottom-right",size:WATERMARK_SIZE_RANGE.default,opacity:WATERMARK_OPACITY_RANGE.default,apply:DEFAULT_WATERMARK_APPLY,overlay:null,version:null,activatedAt:null,deactivatedAt:null};var DEFAULT_MEDIA_PROTECTION={allowDownload:true,keepCopyright:true,deterrence:false,watermark:DEFAULT_MEDIA_WATERMARK};function clampInt(value,range){if(typeof value!=="number"||!Number.isFinite(value))return range.default;return Math.min(range.max,Math.max(range.min,Math.round(value)))}function pick(value,options,fallback){return typeof value==="string"&&options.includes(value)?value:fallback}function parseWatermarkApply(value){const raw=value&&typeof value==="object"?value:{};const flag=key=>typeof raw[key]==="boolean"?raw[key]:DEFAULT_WATERMARK_APPLY[key];return{pages:flag("pages"),articles:flag("articles"),products:flag("products")}}function parseMediaWatermark(value){const raw=value&&typeof value==="object"?value:{};const overlayRaw=raw.overlay&&typeof raw.overlay==="object"?raw.overlay:null;const overlay=overlayRaw&&typeof overlayRaw.url==="string"&&typeof overlayRaw.width==="number"&&typeof overlayRaw.height==="number"&&typeof overlayRaw.key==="string"?{url:overlayRaw.url,width:overlayRaw.width,height:overlayRaw.height,key:overlayRaw.key}:null;const regenHistory=Array.isArray(raw.regenHistory)?raw.regenHistory.filter(item=>typeof item==="string"&&!Number.isNaN(Date.parse(item))):void 0;const scheduledAt=isoOrNull(raw.scheduledAt);return{enabled:raw.enabled===true,source:pick(raw.source,WATERMARK_SOURCES,DEFAULT_MEDIA_WATERMARK.source),text:typeof raw.text==="string"?clampText(raw.text,WATERMARK_TEXT_MAX_LENGTH):"",image:typeof raw.image==="string"&&raw.image?raw.image:null,layout:raw.layout==="tile"?"tile":"single",position:pick(raw.position,WATERMARK_POSITIONS,DEFAULT_MEDIA_WATERMARK.position),size:clampInt(raw.size,WATERMARK_SIZE_RANGE),opacity:clampInt(raw.opacity,WATERMARK_OPACITY_RANGE),apply:parseWatermarkApply(raw.apply),overlay,version:typeof raw.version==="string"&&raw.version?raw.version:null,activatedAt:isoOrNull(raw.activatedAt),deactivatedAt:isoOrNull(raw.deactivatedAt),...regenHistory&®enHistory.length>0?{regenHistory}:{},...scheduledAt?{scheduledAt}:{}}}function isoOrNull(value){return typeof value==="string"&&!Number.isNaN(Date.parse(value))?value:null}function parseMediaProtection(value){const raw=value&&typeof value==="object"?value:{};const flag=key=>typeof raw[key]==="boolean"?raw[key]:DEFAULT_MEDIA_PROTECTION[key];return{allowDownload:flag("allowDownload"),keepCopyright:flag("keepCopyright"),deterrence:flag("deterrence"),watermark:parseMediaWatermark(raw.watermark)}}function canVisitorsDownloadImages(protection){return protection.allowDownload&&!protection.deterrence}function canVisitorsShareImages(protection){return!protection.deterrence}import{createContext,useContext,useMemo}from"react";var HERO_BANNER_PRESET_RATIOS=["24:9","21:9","16:9","4:3","1:1","4:5"];var SPLIT_IMAGE_PRESET_RATIOS=["16:9","4:3","1:1","3:4","4:5"];var CARD_PRESET_RATIOS=["4:3","1:1","3:4"];function parseAspectRatio(ratio){if(typeof ratio!=="string")return null;const match=/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(ratio.trim());if(!match)return null;const w=Number(match[1]);const h=Number(match[2]);if(!Number.isFinite(w)||!Number.isFinite(h)||w<=0||h<=0)return null;const value=w/h;if(value<.25-1e-6||value>5+1e-6)return null;return value}function hasNaturalDevice(ratios){return ratios.desktop===null||ratios.tablet===null||ratios.mobile===null}var FILL_POSITION_CLASSES={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 buildResponsiveFillClasses(ratios){const mode=ratio=>ratio&&parseAspectRatio(ratio)?"fill":"flow";const m=mode(ratios.mobile);const t=mode(ratios.tablet);const d=mode(ratios.desktop);const classes=[FILL_POSITION_CLASSES.mobile[m]];if(t!==m)classes.push(FILL_POSITION_CLASSES.tablet[t]);if(d!==t)classes.push(FILL_POSITION_CLASSES.desktop[d]);return classes.join(" ")}function bannerHeightDefaultRatio(bannerHeight){switch(bannerHeight??"standard"){case"compact":return"24:9";case"tall":return"16:9";case"standard":default:return"21:9"}}var SECTION_RATIO_POLICIES={"page-main-visual:banner-profile":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:HERO_BANNER_PRESET_RATIOS,allowCustomRatio:true},"page-main-visual:split-hero":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:SPLIT_IMAGE_PRESET_RATIOS,allowCustomRatio:true},"page-main-visual:overlay-hero":{tabletInherits:"desktop",devices:["desktop","mobile"],presets:["16:9","4:5"],allowCustomRatio:false,fixedHeight:true},"image-text-split":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:SPLIT_IMAGE_PRESET_RATIOS,allowCustomRatio:true,allowNatural:true},"full-width-image":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:HERO_BANNER_PRESET_RATIOS,allowCustomRatio:true,allowNatural:true},"card-grid":{tabletInherits:"desktop",devices:["desktop"],presets:CARD_PRESET_RATIOS,allowCustomRatio:false},"multi-link":{tabletInherits:"desktop",devices:["desktop"],presets:["4:3"],allowCustomRatio:false}};function resolveDeviceValue(input,fallback,tabletInherits="desktop"){if(input===void 0||input===null){return{desktop:fallback,tablet:fallback,mobile:fallback}}if(typeof input!=="object"){return{desktop:input,tablet:input,mobile:input}}const record=input;const desktop=record.desktop??fallback;const mobile=record.mobile??desktop;const tablet=record.tablet??(tabletInherits==="mobile"?mobile:desktop);return{desktop,tablet,mobile}}function resolvePageMainVisualRatios(input){const layout=input.layout??"banner-profile";if(layout==="overlay-hero"){const policy2=SECTION_RATIO_POLICIES["page-main-visual:overlay-hero"];return{policy:policy2,ratios:{desktop:"16:9",tablet:"16:9",mobile:"4:5"},fixedHeight:true}}if(layout==="split-hero"){const policy2=SECTION_RATIO_POLICIES["page-main-visual:split-hero"];const raw2=resolveDeviceValue(input.imageRatio,"4:3",policy2.tabletInherits);return{policy:policy2,ratios:{desktop:raw2.desktop==="natural"||!parseAspectRatio(raw2.desktop)?"4:3":raw2.desktop,tablet:raw2.tablet==="natural"||!parseAspectRatio(raw2.tablet)?"4:3":raw2.tablet,mobile:raw2.mobile==="natural"||!parseAspectRatio(raw2.mobile)?"4:3":raw2.mobile},fixedHeight:false}}const policy=SECTION_RATIO_POLICIES["page-main-visual:banner-profile"];const fallback=bannerHeightDefaultRatio(input.bannerHeight);const raw=resolveDeviceValue(input.imageRatio,fallback,policy.tabletInherits);return{policy,ratios:{desktop:raw.desktop==="natural"||!parseAspectRatio(raw.desktop)?fallback:raw.desktop,tablet:raw.tablet==="natural"||!parseAspectRatio(raw.tablet)?fallback:raw.tablet,mobile:raw.mobile==="natural"||!parseAspectRatio(raw.mobile)?fallback:raw.mobile},fixedHeight:false}}function toFocusFrameSpecs(ratios){const d=ratios.desktop;const t=ratios.tablet;const m=ratios.mobile;if(!d&&!t&&!m)return null;if(d&&d===t&&d===m){return[{device:"all",ratio:d}]}const frames=[];if(d)frames.push({device:"desktop",ratio:d});if(t&&t!==d&&t!==m)frames.push({device:"tablet",ratio:t});if(m&&m!==d)frames.push({device:"mobile",ratio:m});return frames.length>0?frames:null}function pageMainVisualFocusFrames(input){const{ratios}=resolvePageMainVisualRatios(input??{});return toFocusFrameSpecs(ratios)??[{device:"all",ratio:"21:9"}]}var HERO_FOCUS_FRAMES=pageMainVisualFocusFrames();var MIN_CROP_RECT_SPAN=.05;function clampUnit(value){return Math.min(1,Math.max(0,value))}function normalizeImageFocus(value){if(!value||typeof value!=="object")return null;const{x,y}=value;if(typeof x!=="number"||typeof y!=="number")return null;if(!Number.isFinite(x)||!Number.isFinite(y))return null;return{x:clampUnit(x),y:clampUnit(y)}}function normalizeImageCropRect(value){if(!value||typeof value!=="object")return null;const{x,y,w,h}=value;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"||!Number.isFinite(x)||!Number.isFinite(y)||!Number.isFinite(w)||!Number.isFinite(h)){return null}const nw=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,w));const nh=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,h));const nx=Math.min(1-nw,Math.max(0,x));const ny=Math.min(1-nh,Math.max(0,y));return{x:nx,y:ny,w:nw,h:nh}}function normalizeImageScreenFraming(value){if(!value||typeof value!=="object")return null;const raw=value;if(typeof raw.ratio!=="string"||!parseAspectRatio(raw.ratio))return null;const rect=normalizeImageCropRect(raw.rect);if(!rect)return null;return{ratio:raw.ratio.trim(),rect}}function normalizePadColor(value){if(typeof value!=="string")return void 0;const trimmed=value.trim();return/^#[0-9a-fA-F]{6}$/.test(trimmed)?trimmed.toLowerCase():void 0}function isCenteredFocus(focus){return Math.abs(focus.x-.5)<.005&&Math.abs(focus.y-.5)<.005}function effectiveImageFocus(framing){const focus=normalizeImageFocus(framing?.focus);if(!focus||isCenteredFocus(focus))return null;return focus}function hasScreenFraming(framing){if(!framing?.screens||typeof framing.screens!=="object")return false;for(const device of["desktop","tablet","mobile"]){if(normalizeImageScreenFraming(framing.screens[device]))return true}return false}function deriveRectFromFocus(focus,sourceAspect,targetAspect){const f=normalizeImageFocus(focus)??{x:.5,y:.5};if(!Number.isFinite(sourceAspect)||sourceAspect<=0||!Number.isFinite(targetAspect)||targetAspect<=0){return{x:0,y:0,w:1,h:1}}if(sourceAspect>=targetAspect){const w2=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,targetAspect/sourceAspect));const h2=1;const x=Math.min(1-w2,Math.max(0,f.x-w2/2));return{x,y:0,w:w2,h:h2}}const w=1;const h=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,sourceAspect/targetAspect));const y=Math.min(1-h,Math.max(0,f.y-h/2));return{x:0,y,w,h}}function isScreenFramingCompatible(screen,targetRatio,source){if(!screen)return false;const savedAspect=parseAspectRatio(screen.ratio);const targetAspect=parseAspectRatio(targetRatio);if(!savedAspect||!targetAspect)return false;if(Math.abs(savedAspect-targetAspect)/targetAspect>.01)return false;if(source&&source.width>0&&source.height>0&&screen.rect.h>0){const actualAspect=screen.rect.w*source.width/(screen.rect.h*source.height);if(Math.abs(actualAspect-targetAspect)/targetAspect>.02)return false}return true}function resolveScreenFraming(input){const{framing,device,targetRatio,tabletInherits="desktop"}=input;const source=input.source??framing?.source??null;const screens=framing?.screens;const candidateOrder=device==="desktop"?["desktop"]:device==="mobile"?["mobile","desktop"]:tabletInherits==="mobile"?["tablet","mobile","desktop"]:["tablet","desktop"];let matched=null;let hadIncompatibleOnDevice=false;for(const candidate of candidateOrder){const screen=normalizeImageScreenFraming(screens?.[candidate]);if(!screen)continue;if(isScreenFramingCompatible(screen,targetRatio,source)){matched=screen;break}if(candidate===device){hadIncompatibleOnDevice=true}}if(matched){return{ratio:targetRatio,rect:matched.rect,derived:false,ratioMismatchFallback:false}}const targetAspect=parseAspectRatio(targetRatio)??16/9;const sourceAspect=source&&source.width>0&&source.height>0?source.width/source.height:targetAspect;return{ratio:targetRatio,rect:deriveRectFromFocus(framing?.focus,sourceAspect,targetAspect),derived:true,ratioMismatchFallback:hadIncompatibleOnDevice}}function rectToCloudflareTrim(rect,source){if(!source||!Number.isFinite(source.width)||!Number.isFinite(source.height))return null;if(source.width<=0||source.height<=0)return null;const r=normalizeImageCropRect(rect);if(!r)return null;const left=Math.max(0,Math.round(r.x*source.width));const top=Math.max(0,Math.round(r.y*source.height));const cropW=Math.max(1,Math.round(r.w*source.width));const cropH=Math.max(1,Math.round(r.h*source.height));const right=Math.max(0,source.width-left-cropW);const bottom=Math.max(0,source.height-top-cropH);if(top<=1&&right<=1&&bottom<=1&&left<=1)return null;return{top,right,bottom,left}}function focusToObjectPosition(focus){const percent=value=>`${Math.round(value*1e3)/10}%`;return`${percent(focus.x)} ${percent(focus.y)}`}function focusToGravity(focus){const fixed=value=>(Math.round(value*100)/100).toFixed(2);return`${fixed(focus.x)}x${fixed(focus.y)}`}var ASSET_REF_PREFIX="asset:";var ASSET_REF_VALUE=/^asset:[a-z0-9]+$/;function isAssetRefValue(value){return ASSET_REF_VALUE.test(value)}var CF_IMAGES_ACCOUNT_HASH="xu6i8N5WjaI_9HFe-hZzmg";var CF_IMAGES_DELIVERY_BASE=`https://img.kanorio.com/cdn-cgi/imagedelivery/${CF_IMAGES_ACCOUNT_HASH}`;var URL_TAIL=String.raw`[^\s"'()<>?#\\]+`;var CF_IMAGE_ID=String.raw`[A-Za-z0-9_.-]+`;function escapeRegExp(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var QUERY_TAIL=String.raw`(?:[?#][^\s"'()<>\\]*)?`;var CF_IMAGE_URL=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_-]+)/${escapeRegExp(CF_IMAGES_ACCOUNT_HASH)}/(${CF_IMAGE_ID})(?:[/?#]|$)`);function cloudflareImageIdOf(url){return url?CF_IMAGE_URL.exec(url)?.[1]??null:null}var MIXED_EDGE_COLOR="mixed";function publicEdgeColor(edgeColor){return edgeColor&&edgeColor!==MIXED_EDGE_COLOR?edgeColor:null}function displayFileName(contentName,facts){const name=contentName??"";if(!facts?.name)return name;if(!name||name===facts.name||facts.formerNames?.includes(name))return facts.name;const dot=facts.name.lastIndexOf(".");const own=name.lastIndexOf(".");if(dot<=0||own<=0)return name;return`${name.slice(0,own)}${facts.name.slice(dot)}`}function mediaFactsFor(facts,ref){if(ref.assetId){const byId=facts[`${ASSET_REF_PREFIX}${ref.assetId}`];if(byId)return byId}if(!ref.url)return void 0;if(isAssetRefValue(ref.url))return facts[ref.url];const cfId=cloudflareImageIdOf(ref.url);if(cfId)return facts[cfId];const path=ref.url.split(/[?#]/,1)[0];for(const[key,item]of Object.entries(facts)){if(!key.startsWith(ASSET_REF_PREFIX)&&path.endsWith(`/${key}`))return item}return void 0}var CLOUDFLARE_IMAGE_QUALITY=85;function extractImageIdFromUrl(url){if(!url)return void 0;try{const urlObj=new URL(url);const pathParts=urlObj.pathname.split("/").filter(Boolean);if(urlObj.hostname==="imagedelivery.net"){if(pathParts.length>=2){return pathParts[1]}}if(urlObj.hostname.endsWith(".kanorio.com")&&pathParts[0]==="cdn-cgi"&&pathParts[1]==="imagedelivery"){if(pathParts.length>=4){return pathParts[3]}}return void 0}catch{return void 0}}function isSvgImageUrl(url){const path=url.split(/[?#]/,1)[0]??"";return path.toLowerCase().endsWith(".svg")}function isCloudflareImageUrl(url){if(!url)return false;try{const urlObj=new URL(url);if(urlObj.hostname==="imagedelivery.net"){return true}if(urlObj.hostname.endsWith(".kanorio.com")&&urlObj.pathname.startsWith("/cdn-cgi/imagedelivery/")){return true}return false}catch{return false}}function hasOptimizationParams(url){try{const urlObj=new URL(url);return urlObj.searchParams.has("width")||urlObj.searchParams.has("height")||urlObj.searchParams.has("quality")||urlObj.searchParams.has("fit")}catch{return false}}function getDefaultParamsForUseCase(useCase){switch(useCase){case"page-main-visual-background":return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"cover"};case"page-main-visual-logo":return{width:600,height:600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"header-logo":return{width:600,height:600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"card-grid-carousel-image":return{width:800,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"};case"image-text-split-image":return{width:1200,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"};case"multi-image-carousel-image":return{width:1600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"lightbox-image":return{width:4096,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"full-width-image":return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"contain"};case"general":default:return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"}}}function parseCloudflareUrl(url){try{const urlObj=new URL(url);const pathParts=urlObj.pathname.split("/").filter(Boolean);if(urlObj.hostname==="imagedelivery.net"&&pathParts.length>=3){return{baseUrl:`${urlObj.protocol}//${urlObj.hostname}`,accountHash:pathParts[0],imageId:pathParts[1],variant:pathParts[2]||"public"}}if(urlObj.hostname.endsWith(".kanorio.com")&&pathParts[0]==="cdn-cgi"&&pathParts[1]==="imagedelivery"&&pathParts.length>=5){return{baseUrl:`${urlObj.protocol}//${urlObj.hostname}/cdn-cgi/imagedelivery`,accountHash:pathParts[2],imageId:pathParts[3],variant:pathParts[4]||"public"}}return null}catch{return null}}function buildOptimizedUrl(parsed,options){const{baseUrl,accountHash,imageId}=parsed;const defaults=getDefaultParamsForUseCase(options.useCase);const width=options.width??defaults.width;const height=options.height??defaults.height;const quality=CLOUDFLARE_IMAGE_QUALITY;const fit=options.fit??defaults.fit;const format=options.format;const params=[];if(options.trim){const{top,right,bottom,left}=options.trim;params.push(`trim=${Math.max(0,Math.round(top))};${Math.max(0,Math.round(right))};${Math.max(0,Math.round(bottom))};${Math.max(0,Math.round(left))}`)}if(width)params.push(`w=${width}`);if(height)params.push(`h=${height}`);if(fit)params.push(`fit=${fit}`);if(!options.trim&&options.focus&&width&&height&&(fit==="crop"||fit==="cover")){params.push(`gravity=${focusToGravity(options.focus)}`)}if(options.background&&/^#[0-9a-fA-F]{6}$/.test(options.background)){params.push(`background=${encodeURIComponent(options.background)}`)}params.push(`q=${quality}`);if(format)params.push(`f=${format}`);if(params.length>0){return`${baseUrl}/${accountHash}/${imageId}/${params.join(",")}`}return`${baseUrl}/${accountHash}/${imageId}/public`}function defaultWidthForUseCase(useCase){return getDefaultParamsForUseCase(useCase).width??1920}function getOptimizedImageUrl(originalUrl,options){if(!isCloudflareImageUrl(originalUrl)){return originalUrl}if(hasOptimizationParams(originalUrl)&&!options.format){return originalUrl}const parsed=parseCloudflareUrl(originalUrl);if(!parsed){return originalUrl}return buildOptimizedUrl(parsed,options)}function getOriginalImageUrl(url){if(!isCloudflareImageUrl(url)){return url}const parsed=parseCloudflareUrl(url);if(!parsed){return url}return`${parsed.baseUrl}/${parsed.accountHash}/${parsed.imageId}/public`}var MARKDOWN_IMAGE_SRCSET_WIDTHS=[400,800,1200,1600];var MARKDOWN_IMAGE_SIZES="(max-width: 768px) 100vw, 960px";function getResponsiveImageAttrs(originalUrl){if(!isCloudflareImageUrl(originalUrl)){return null}const parsed=parseCloudflareUrl(originalUrl);if(!parsed){return null}const{baseUrl,accountHash,imageId}=parsed;const quality=CLOUDFLARE_IMAGE_QUALITY;const fit="scale-down";const srcSet=MARKDOWN_IMAGE_SRCSET_WIDTHS.map(w=>`${baseUrl}/${accountHash}/${imageId}/w=${w},fit=${fit},q=${quality} ${w}w`).join(", ");const src=`${baseUrl}/${accountHash}/${imageId}/w=800,fit=${fit},q=${quality}`;return{src,srcSet,sizes:MARKDOWN_IMAGE_SIZES}}var PICTURE_DEVICE_WIDTHS={mobile:[640,1080],tablet:[1024,1536],desktop:[1440,1920]};var PICTURE_DEVICE_MEDIA={mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)"};var PICTURE_DEVICES=["desktop","tablet","mobile"];function resolveDeviceCrops(input){const out={};for(const device of PICTURE_DEVICES){const ratio=input.ratios[device];if(!ratio){out[device]={ratio:null,rect:null};continue}const resolved=resolveScreenFraming({framing:input.framing,device,targetRatio:ratio,tabletInherits:input.tabletInherits,source:input.source});out[device]={ratio,rect:resolved.derived?null:resolved.rect}}return out}function isSameDeviceCrop(a,b){if(a.ratio!==b.ratio)return false;if(!a.rect||!b.rect)return a.rect===b.rect;return Math.abs(a.rect.x-b.rect.x)<5e-4&&Math.abs(a.rect.y-b.rect.y)<5e-4&&Math.abs(a.rect.w-b.rect.w)<5e-4&&Math.abs(a.rect.h-b.rect.h)<5e-4}function pictureWidthsFor(device,maxWidth){const base=PICTURE_DEVICE_WIDTHS[device];if(!maxWidth||maxWidth<=0||maxWidth>=base[base.length-1])return base;return[...base.filter(w=>w<maxWidth),Math.round(maxWidth)]}function resolveSiteImageRenderMode(input){const{src,framing,deviceRatios,tabletInherits="desktop"}=input;if(!src||!deviceRatios)return"single";const uniformRatio=deviceRatios.mobile===deviceRatios.desktop&&deviceRatios.tablet===deviceRatios.desktop;const hasScreens=hasScreenFraming(framing);if(!hasScreens&&uniformRatio)return"single";const trimmable=isCloudflareImageUrl(src)&&!isSvgImageUrl(src);if(!hasScreens)return trimmable?"picture":"single";const source=framing?.source&&framing.source.width>0&&framing.source.height>0?framing.source:null;const crops=resolveDeviceCrops({framing,ratios:deviceRatios,tabletInherits,source});const anyRect=PICTURE_DEVICES.some(device=>crops[device].rect!==null);if(!anyRect)return uniformRatio||!trimmable?"single":"picture";if(!trimmable||!source)return"css-fallback";if(uniformRatio&&isSameDeviceCrop(crops.desktop,crops.tablet)&&isSameDeviceCrop(crops.desktop,crops.mobile)){return"single-trim"}return"picture"}function buildSingleTrimImageUrl(input){const useCase=input.useCase??"general";const width=input.width??defaultWidthForUseCase(useCase);const ratioNum=parseAspectRatio(input.ratio)??16/9;const height=Math.max(1,Math.round(width/ratioNum));const source=input.framing?.source&&input.framing.source.width>0&&input.framing.source.height>0?input.framing.source:null;const resolved=resolveScreenFraming({framing:input.framing,device:"desktop",targetRatio:input.ratio,tabletInherits:input.tabletInherits,source});const trim=!resolved.derived&&source?rectToCloudflareTrim(resolved.rect,source):null;return{src:getOptimizedImageUrl(input.src,{useCase,width,height,fit:"crop",trim,focus:trim?null:effectiveImageFocus(input.framing)}),width,height}}function buildPictureSourcesPlan(input){const{src,useCase="general",ratios,framing,tabletInherits="desktop",maxWidth}=input;if(!isCloudflareImageUrl(src))return null;const sourceDims=framing?.source&&framing.source.width>0&&framing.source.height>0?framing.source:null;const focus=effectiveImageFocus(framing);const crops=resolveDeviceCrops({framing,ratios,tabletInherits,source:sourceDims});const buildForDevice=device=>{const{ratio,rect}=crops[device];const ratioNum=ratio?parseAspectRatio(ratio)??16/9:null;const trim=rect&&sourceDims?rectToCloudflareTrim(rect,sourceDims):null;const widths=pictureWidthsFor(device,maxWidth);const urls=[];const srcSetParts=widths.map(w=>{const url=ratioNum?getOptimizedImageUrl(src,{useCase,width:w,height:Math.max(1,Math.round(w/ratioNum)),fit:"crop",trim,focus:trim?null:focus}):getOptimizedImageUrl(src,{useCase,width:w,fit:"scale-down"});urls.push(url);return`${url} ${w}w`});const primaryW=widths[widths.length-1];const naturalAspect=sourceDims?sourceDims.width/sourceDims.height:null;const primaryH=ratioNum?Math.max(1,Math.round(primaryW/ratioNum)):naturalAspect?Math.max(1,Math.round(primaryW/naturalAspect)):null;const primaryUrl=urls[urls.length-1];return{device,media:device==="desktop"?void 0:PICTURE_DEVICE_MEDIA[device],src:primaryUrl,srcSet:srcSetParts.join(", "),sizes:input.sizes?.[device]??"100vw",width:primaryW,height:primaryH,urls}};const mobile=buildForDevice("mobile");const tabletDesc=buildForDevice("tablet");const desktop=buildForDevice("desktop");const tablet=isSameDeviceCrop(crops.tablet,crops.desktop)?null:tabletDesc;const preloads=tablet?[{media:PICTURE_DEVICE_MEDIA.mobile,href:mobile.src,imageSrcSet:mobile.srcSet,imageSizes:mobile.sizes},{media:PICTURE_DEVICE_MEDIA.tablet,href:tablet.src,imageSrcSet:tablet.srcSet,imageSizes:tablet.sizes},{media:PICTURE_DEVICE_MEDIA.desktop,href:desktop.src,imageSrcSet:desktop.srcSet,imageSizes:desktop.sizes}]:[{media:PICTURE_DEVICE_MEDIA.mobile,href:mobile.src,imageSrcSet:mobile.srcSet,imageSizes:mobile.sizes},{media:"(min-width: 768px)",href:desktop.src,imageSrcSet:desktop.srcSet,imageSizes:desktop.sizes}];const allVariantUrls=Array.from(new Set([...mobile.urls,...tablet?tablet.urls:[],...desktop.urls]));return{mobile,tablet,desktop,preloads,allVariantUrls}}import{jsx}from"react/jsx-runtime";var FALLBACK={protection:DEFAULT_MEDIA_PROTECTION,imageDownloadUrl:()=>null};var MediaProtectionContext=createContext(FALLBACK);function MediaProtectionProvider({protection,websiteId,apiBase="",children}){const value=useMemo(()=>({protection:protection??DEFAULT_MEDIA_PROTECTION,imageDownloadUrl:(imageUrl,name)=>{const imageId=extractImageIdFromUrl(imageUrl);if(!websiteId||!imageId)return null;const base=`${apiBase}/api/public/sites/${encodeURIComponent(websiteId)}/images/${encodeURIComponent(imageId)}/download`;const query=new URLSearchParams;if(name)query.set("name",name);const search=query.toString();return search?`${base}?${search}`:base}}),[protection,websiteId,apiBase]);return jsx(MediaProtectionContext.Provider,{value,children})}function useMediaProtection(){return useContext(MediaProtectionContext)}export{hasNaturalDevice,buildResponsiveFillClasses,normalizeImageCropRect,normalizePadColor,effectiveImageFocus,resolveScreenFraming,focusToObjectPosition,publicEdgeColor,displayFileName,mediaFactsFor,extractImageIdFromUrl,isSvgImageUrl,getOptimizedImageUrl,getOriginalImageUrl,getResponsiveImageAttrs,resolveSiteImageRenderMode,buildSingleTrimImageUrl,buildPictureSourcesPlan,parseMediaProtection,canVisitorsDownloadImages,canVisitorsShareImages,MediaProtectionProvider,useMediaProtection};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{clampText}from"./chunk-O2SYHUQF.js";var WATERMARK_POSITIONS=["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"];var WATERMARK_SOURCES=["logo","text","image"];var WATERMARK_SIZE_RANGE={min:5,max:50,default:20};var WATERMARK_OPACITY_RANGE={min:10,max:100,default:60};var WATERMARK_TEXT_MAX_LENGTH=60;var DEFAULT_WATERMARK_APPLY={pages:true,articles:true,products:false};var DEFAULT_MEDIA_WATERMARK={enabled:false,source:"logo",text:"",image:null,layout:"single",position:"bottom-right",size:WATERMARK_SIZE_RANGE.default,opacity:WATERMARK_OPACITY_RANGE.default,apply:DEFAULT_WATERMARK_APPLY,overlay:null,version:null,activatedAt:null,deactivatedAt:null};var DEFAULT_MEDIA_PROTECTION={allowDownload:true,keepCopyright:true,deterrence:false,watermark:DEFAULT_MEDIA_WATERMARK};function clampInt(value,range){if(typeof value!=="number"||!Number.isFinite(value))return range.default;return Math.min(range.max,Math.max(range.min,Math.round(value)))}function pick(value,options,fallback){return typeof value==="string"&&options.includes(value)?value:fallback}function parseWatermarkApply(value){const raw=value&&typeof value==="object"?value:{};const flag=key=>typeof raw[key]==="boolean"?raw[key]:DEFAULT_WATERMARK_APPLY[key];return{pages:flag("pages"),articles:flag("articles"),products:flag("products")}}function parseMediaWatermark(value){const raw=value&&typeof value==="object"?value:{};const overlayRaw=raw.overlay&&typeof raw.overlay==="object"?raw.overlay:null;const overlay=overlayRaw&&typeof overlayRaw.url==="string"&&typeof overlayRaw.width==="number"&&typeof overlayRaw.height==="number"&&typeof overlayRaw.key==="string"?{url:overlayRaw.url,width:overlayRaw.width,height:overlayRaw.height,key:overlayRaw.key}:null;const regenHistory=Array.isArray(raw.regenHistory)?raw.regenHistory.filter(item=>typeof item==="string"&&!Number.isNaN(Date.parse(item))):void 0;const scheduledAt=isoOrNull(raw.scheduledAt);return{enabled:raw.enabled===true,source:pick(raw.source,WATERMARK_SOURCES,DEFAULT_MEDIA_WATERMARK.source),text:typeof raw.text==="string"?clampText(raw.text,WATERMARK_TEXT_MAX_LENGTH):"",image:typeof raw.image==="string"&&raw.image?raw.image:null,layout:raw.layout==="tile"?"tile":"single",position:pick(raw.position,WATERMARK_POSITIONS,DEFAULT_MEDIA_WATERMARK.position),size:clampInt(raw.size,WATERMARK_SIZE_RANGE),opacity:clampInt(raw.opacity,WATERMARK_OPACITY_RANGE),apply:parseWatermarkApply(raw.apply),overlay,version:typeof raw.version==="string"&&raw.version?raw.version:null,activatedAt:isoOrNull(raw.activatedAt),deactivatedAt:isoOrNull(raw.deactivatedAt),...regenHistory&®enHistory.length>0?{regenHistory}:{},...scheduledAt?{scheduledAt}:{}}}function isoOrNull(value){return typeof value==="string"&&!Number.isNaN(Date.parse(value))?value:null}function parseMediaProtection(value){const raw=value&&typeof value==="object"?value:{};const flag=key=>typeof raw[key]==="boolean"?raw[key]:DEFAULT_MEDIA_PROTECTION[key];return{allowDownload:flag("allowDownload"),keepCopyright:flag("keepCopyright"),deterrence:flag("deterrence"),watermark:parseMediaWatermark(raw.watermark)}}function canVisitorsDownloadImages(protection){return protection.allowDownload&&!protection.deterrence}function canVisitorsShareImages(protection){return!protection.deterrence}import{createContext,useContext,useMemo}from"react";var HERO_BANNER_PRESET_RATIOS=["24:9","21:9","16:9","4:3","1:1","4:5"];var SPLIT_IMAGE_PRESET_RATIOS=["16:9","4:3","1:1","3:4","4:5"];var CARD_PRESET_RATIOS=["4:3","1:1","3:4"];function parseAspectRatio(ratio){if(typeof ratio!=="string")return null;const match=/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(ratio.trim());if(!match)return null;const w=Number(match[1]);const h=Number(match[2]);if(!Number.isFinite(w)||!Number.isFinite(h)||w<=0||h<=0)return null;const value=w/h;if(value<.25-1e-6||value>5+1e-6)return null;return value}function hasNaturalDevice(ratios){return ratios.desktop===null||ratios.tablet===null||ratios.mobile===null}var FILL_POSITION_CLASSES={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 buildResponsiveFillClasses(ratios){const mode=ratio=>ratio&&parseAspectRatio(ratio)?"fill":"flow";const m=mode(ratios.mobile);const t=mode(ratios.tablet);const d=mode(ratios.desktop);const classes=[FILL_POSITION_CLASSES.mobile[m]];if(t!==m)classes.push(FILL_POSITION_CLASSES.tablet[t]);if(d!==t)classes.push(FILL_POSITION_CLASSES.desktop[d]);return classes.join(" ")}function bannerHeightDefaultRatio(bannerHeight){switch(bannerHeight??"standard"){case"compact":return"24:9";case"tall":return"16:9";case"standard":default:return"21:9"}}var SECTION_RATIO_POLICIES={"page-main-visual:banner-profile":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:HERO_BANNER_PRESET_RATIOS,allowCustomRatio:true},"page-main-visual:split-hero":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:SPLIT_IMAGE_PRESET_RATIOS,allowCustomRatio:true},"page-main-visual:overlay-hero":{tabletInherits:"desktop",devices:["desktop","mobile"],presets:["16:9","4:5"],allowCustomRatio:false,fixedHeight:true},"image-text-split":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:SPLIT_IMAGE_PRESET_RATIOS,allowCustomRatio:true,allowNatural:true},"full-width-image":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:HERO_BANNER_PRESET_RATIOS,allowCustomRatio:true,allowNatural:true},"card-grid":{tabletInherits:"desktop",devices:["desktop"],presets:CARD_PRESET_RATIOS,allowCustomRatio:false},"multi-link":{tabletInherits:"desktop",devices:["desktop"],presets:["4:3"],allowCustomRatio:false}};function resolveDeviceValue(input,fallback,tabletInherits="desktop"){if(input===void 0||input===null){return{desktop:fallback,tablet:fallback,mobile:fallback}}if(typeof input!=="object"){return{desktop:input,tablet:input,mobile:input}}const record=input;const desktop=record.desktop??fallback;const mobile=record.mobile??desktop;const tablet=record.tablet??(tabletInherits==="mobile"?mobile:desktop);return{desktop,tablet,mobile}}function resolvePageMainVisualRatios(input){const layout=input.layout??"banner-profile";if(layout==="overlay-hero"){const policy2=SECTION_RATIO_POLICIES["page-main-visual:overlay-hero"];return{policy:policy2,ratios:{desktop:"16:9",tablet:"16:9",mobile:"4:5"},fixedHeight:true}}if(layout==="split-hero"){const policy2=SECTION_RATIO_POLICIES["page-main-visual:split-hero"];const raw2=resolveDeviceValue(input.imageRatio,"4:3",policy2.tabletInherits);return{policy:policy2,ratios:{desktop:raw2.desktop==="natural"||!parseAspectRatio(raw2.desktop)?"4:3":raw2.desktop,tablet:raw2.tablet==="natural"||!parseAspectRatio(raw2.tablet)?"4:3":raw2.tablet,mobile:raw2.mobile==="natural"||!parseAspectRatio(raw2.mobile)?"4:3":raw2.mobile},fixedHeight:false}}const policy=SECTION_RATIO_POLICIES["page-main-visual:banner-profile"];const fallback=bannerHeightDefaultRatio(input.bannerHeight);const raw=resolveDeviceValue(input.imageRatio,fallback,policy.tabletInherits);return{policy,ratios:{desktop:raw.desktop==="natural"||!parseAspectRatio(raw.desktop)?fallback:raw.desktop,tablet:raw.tablet==="natural"||!parseAspectRatio(raw.tablet)?fallback:raw.tablet,mobile:raw.mobile==="natural"||!parseAspectRatio(raw.mobile)?fallback:raw.mobile},fixedHeight:false}}function toFocusFrameSpecs(ratios){const d=ratios.desktop;const t=ratios.tablet;const m=ratios.mobile;if(!d&&!t&&!m)return null;if(d&&d===t&&d===m){return[{device:"all",ratio:d}]}const frames=[];if(d)frames.push({device:"desktop",ratio:d});if(t&&t!==d&&t!==m)frames.push({device:"tablet",ratio:t});if(m&&m!==d)frames.push({device:"mobile",ratio:m});return frames.length>0?frames:null}function pageMainVisualFocusFrames(input){const{ratios}=resolvePageMainVisualRatios(input??{});return toFocusFrameSpecs(ratios)??[{device:"all",ratio:"21:9"}]}var HERO_FOCUS_FRAMES=pageMainVisualFocusFrames();var MIN_CROP_RECT_SPAN=.05;function clampUnit(value){return Math.min(1,Math.max(0,value))}function normalizeImageFocus(value){if(!value||typeof value!=="object")return null;const{x,y}=value;if(typeof x!=="number"||typeof y!=="number")return null;if(!Number.isFinite(x)||!Number.isFinite(y))return null;return{x:clampUnit(x),y:clampUnit(y)}}function normalizeImageCropRect(value){if(!value||typeof value!=="object")return null;const{x,y,w,h}=value;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"||!Number.isFinite(x)||!Number.isFinite(y)||!Number.isFinite(w)||!Number.isFinite(h)){return null}const nw=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,w));const nh=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,h));const nx=Math.min(1-nw,Math.max(0,x));const ny=Math.min(1-nh,Math.max(0,y));return{x:nx,y:ny,w:nw,h:nh}}function normalizeImageScreenFraming(value){if(!value||typeof value!=="object")return null;const raw=value;if(typeof raw.ratio!=="string"||!parseAspectRatio(raw.ratio))return null;const rect=normalizeImageCropRect(raw.rect);if(!rect)return null;return{ratio:raw.ratio.trim(),rect}}function normalizePadColor(value){if(typeof value!=="string")return void 0;const trimmed=value.trim();return/^#[0-9a-fA-F]{6}$/.test(trimmed)?trimmed.toLowerCase():void 0}function isCenteredFocus(focus){return Math.abs(focus.x-.5)<.005&&Math.abs(focus.y-.5)<.005}function effectiveImageFocus(framing){const focus=normalizeImageFocus(framing?.focus);if(!focus||isCenteredFocus(focus))return null;return focus}function hasScreenFraming(framing){if(!framing?.screens||typeof framing.screens!=="object")return false;for(const device of["desktop","tablet","mobile"]){if(normalizeImageScreenFraming(framing.screens[device]))return true}return false}function deriveRectFromFocus(focus,sourceAspect,targetAspect){const f=normalizeImageFocus(focus)??{x:.5,y:.5};if(!Number.isFinite(sourceAspect)||sourceAspect<=0||!Number.isFinite(targetAspect)||targetAspect<=0){return{x:0,y:0,w:1,h:1}}if(sourceAspect>=targetAspect){const w2=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,targetAspect/sourceAspect));const h2=1;const x=Math.min(1-w2,Math.max(0,f.x-w2/2));return{x,y:0,w:w2,h:h2}}const w=1;const h=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,sourceAspect/targetAspect));const y=Math.min(1-h,Math.max(0,f.y-h/2));return{x:0,y,w,h}}function isScreenFramingCompatible(screen,targetRatio,source){if(!screen)return false;const savedAspect=parseAspectRatio(screen.ratio);const targetAspect=parseAspectRatio(targetRatio);if(!savedAspect||!targetAspect)return false;if(Math.abs(savedAspect-targetAspect)/targetAspect>.01)return false;if(source&&source.width>0&&source.height>0&&screen.rect.h>0){const actualAspect=screen.rect.w*source.width/(screen.rect.h*source.height);if(Math.abs(actualAspect-targetAspect)/targetAspect>.02)return false}return true}function resolveScreenFraming(input){const{framing,device,targetRatio,tabletInherits="desktop"}=input;const source=input.source??framing?.source??null;const screens=framing?.screens;const candidateOrder=device==="desktop"?["desktop"]:device==="mobile"?["mobile","desktop"]:tabletInherits==="mobile"?["tablet","mobile","desktop"]:["tablet","desktop"];let matched=null;let hadIncompatibleOnDevice=false;for(const candidate of candidateOrder){const screen=normalizeImageScreenFraming(screens?.[candidate]);if(!screen)continue;if(isScreenFramingCompatible(screen,targetRatio,source)){matched=screen;break}if(candidate===device){hadIncompatibleOnDevice=true}}if(matched){return{ratio:targetRatio,rect:matched.rect,derived:false,ratioMismatchFallback:false}}const targetAspect=parseAspectRatio(targetRatio)??16/9;const sourceAspect=source&&source.width>0&&source.height>0?source.width/source.height:targetAspect;return{ratio:targetRatio,rect:deriveRectFromFocus(framing?.focus,sourceAspect,targetAspect),derived:true,ratioMismatchFallback:hadIncompatibleOnDevice}}function rectToCloudflareTrim(rect,source){if(!source||!Number.isFinite(source.width)||!Number.isFinite(source.height))return null;if(source.width<=0||source.height<=0)return null;const r=normalizeImageCropRect(rect);if(!r)return null;const left=Math.max(0,Math.round(r.x*source.width));const top=Math.max(0,Math.round(r.y*source.height));const cropW=Math.max(1,Math.round(r.w*source.width));const cropH=Math.max(1,Math.round(r.h*source.height));const right=Math.max(0,source.width-left-cropW);const bottom=Math.max(0,source.height-top-cropH);if(top<=1&&right<=1&&bottom<=1&&left<=1)return null;return{top,right,bottom,left}}function focusToObjectPosition(focus){const percent=value=>`${Math.round(value*1e3)/10}%`;return`${percent(focus.x)} ${percent(focus.y)}`}function focusToGravity(focus){const fixed=value=>(Math.round(value*100)/100).toFixed(2);return`${fixed(focus.x)}x${fixed(focus.y)}`}var ASSET_REF_PREFIX="asset:";var ASSET_REF_VALUE=/^asset:[a-z0-9]+$/;function isAssetRefValue(value){return ASSET_REF_VALUE.test(value)}var CF_IMAGES_ACCOUNT_HASH="xu6i8N5WjaI_9HFe-hZzmg";var CF_IMAGES_DELIVERY_BASE=`https://img.kanorio.com/cdn-cgi/imagedelivery/${CF_IMAGES_ACCOUNT_HASH}`;var URL_TAIL=String.raw`[^\s"'()<>?#\\]+`;var CF_IMAGE_ID=String.raw`[A-Za-z0-9_.-]+`;function escapeRegExp(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var QUERY_TAIL=String.raw`(?:[?#][^\s"'()<>\\]*)?`;var CF_IMAGE_URL=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_-]+)/${escapeRegExp(CF_IMAGES_ACCOUNT_HASH)}/(${CF_IMAGE_ID})(?:[/?#]|$)`);function cloudflareImageIdOf(url){return url?CF_IMAGE_URL.exec(url)?.[1]??null:null}var MIXED_EDGE_COLOR="mixed";function publicEdgeColor(edgeColor){return edgeColor&&edgeColor!==MIXED_EDGE_COLOR?edgeColor:null}function displayFileName(contentName,facts){const name=contentName??"";if(!facts?.name)return name;if(!name||name===facts.name||facts.formerNames?.includes(name))return facts.name;const dot=facts.name.lastIndexOf(".");const own=name.lastIndexOf(".");if(dot<=0||own<=0)return name;return`${name.slice(0,own)}${facts.name.slice(dot)}`}function mediaFactsFor(facts,ref){if(ref.assetId){const byId=facts[`${ASSET_REF_PREFIX}${ref.assetId}`];if(byId)return byId}if(!ref.url)return void 0;if(isAssetRefValue(ref.url))return facts[ref.url];const cfId=cloudflareImageIdOf(ref.url);if(cfId)return facts[cfId];const path=ref.url.split(/[?#]/,1)[0];for(const[key,item]of Object.entries(facts)){if(!key.startsWith(ASSET_REF_PREFIX)&&path.endsWith(`/${key}`))return item}return void 0}var CLOUDFLARE_IMAGE_QUALITY=85;var CF_ORIGINAL_SIZE_PARAMS=`w=12000,h=12000,fit=scale-down,q=${CLOUDFLARE_IMAGE_QUALITY}`;function extractImageIdFromUrl(url){if(!url)return void 0;try{const urlObj=new URL(url);const pathParts=urlObj.pathname.split("/").filter(Boolean);if(urlObj.hostname==="imagedelivery.net"){if(pathParts.length>=2){return pathParts[1]}}if(urlObj.hostname.endsWith(".kanorio.com")&&pathParts[0]==="cdn-cgi"&&pathParts[1]==="imagedelivery"){if(pathParts.length>=4){return pathParts[3]}}return void 0}catch{return void 0}}function isSvgImageUrl(url){const path=url.split(/[?#]/,1)[0]??"";return path.toLowerCase().endsWith(".svg")}function isCloudflareImageUrl(url){if(!url)return false;try{const urlObj=new URL(url);if(urlObj.hostname==="imagedelivery.net"){return true}if(urlObj.hostname.endsWith(".kanorio.com")&&urlObj.pathname.startsWith("/cdn-cgi/imagedelivery/")){return true}return false}catch{return false}}function hasOptimizationParams(url){try{const urlObj=new URL(url);return urlObj.searchParams.has("width")||urlObj.searchParams.has("height")||urlObj.searchParams.has("quality")||urlObj.searchParams.has("fit")}catch{return false}}function getDefaultParamsForUseCase(useCase){switch(useCase){case"page-main-visual-background":return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"cover"};case"page-main-visual-logo":return{width:600,height:600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"header-logo":return{width:600,height:600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"card-grid-carousel-image":return{width:800,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"};case"image-text-split-image":return{width:1200,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"};case"multi-image-carousel-image":return{width:1600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"lightbox-image":return{width:4096,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"full-width-image":return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"contain"};case"general":default:return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"}}}function parseCloudflareUrl(url){try{const urlObj=new URL(url);const pathParts=urlObj.pathname.split("/").filter(Boolean);if(urlObj.hostname==="imagedelivery.net"&&pathParts.length>=3){return{baseUrl:`${urlObj.protocol}//${urlObj.hostname}`,accountHash:pathParts[0],imageId:pathParts[1],variant:pathParts[2]||"public"}}if(urlObj.hostname.endsWith(".kanorio.com")&&pathParts[0]==="cdn-cgi"&&pathParts[1]==="imagedelivery"&&pathParts.length>=5){return{baseUrl:`${urlObj.protocol}//${urlObj.hostname}/cdn-cgi/imagedelivery`,accountHash:pathParts[2],imageId:pathParts[3],variant:pathParts[4]||"public"}}return null}catch{return null}}function buildOptimizedUrl(parsed,options){const{baseUrl,accountHash,imageId}=parsed;const defaults=getDefaultParamsForUseCase(options.useCase);const width=options.width??defaults.width;const height=options.height??defaults.height;const quality=CLOUDFLARE_IMAGE_QUALITY;const fit=options.fit??defaults.fit;const format=options.format;const params=[];if(options.trim){const{top,right,bottom,left}=options.trim;params.push(`trim=${Math.max(0,Math.round(top))};${Math.max(0,Math.round(right))};${Math.max(0,Math.round(bottom))};${Math.max(0,Math.round(left))}`)}if(width)params.push(`w=${width}`);if(height)params.push(`h=${height}`);if(fit)params.push(`fit=${fit}`);if(!options.trim&&options.focus&&width&&height&&(fit==="crop"||fit==="cover")){params.push(`gravity=${focusToGravity(options.focus)}`)}if(options.background&&/^#[0-9a-fA-F]{6}$/.test(options.background)){params.push(`background=${encodeURIComponent(options.background)}`)}params.push(`q=${quality}`);if(format)params.push(`f=${format}`);if(params.length>0){return`${baseUrl}/${accountHash}/${imageId}/${params.join(",")}`}return`${baseUrl}/${accountHash}/${imageId}/public`}function defaultWidthForUseCase(useCase){return getDefaultParamsForUseCase(useCase).width??1920}function getOptimizedImageUrl(originalUrl,options){if(!isCloudflareImageUrl(originalUrl)){return originalUrl}if(hasOptimizationParams(originalUrl)&&!options.format){return originalUrl}const parsed=parseCloudflareUrl(originalUrl);if(!parsed){return originalUrl}return buildOptimizedUrl(parsed,options)}function getOriginalImageUrl(url){if(!isCloudflareImageUrl(url)){return url}const parsed=parseCloudflareUrl(url);if(!parsed){return url}return`${parsed.baseUrl}/${parsed.accountHash}/${parsed.imageId}/public`}var MARKDOWN_IMAGE_SRCSET_WIDTHS=[400,800,1200,1600];var MARKDOWN_IMAGE_SIZES="(max-width: 768px) 100vw, 960px";function getResponsiveImageAttrs(originalUrl){if(!isCloudflareImageUrl(originalUrl)){return null}const parsed=parseCloudflareUrl(originalUrl);if(!parsed){return null}const{baseUrl,accountHash,imageId}=parsed;const quality=CLOUDFLARE_IMAGE_QUALITY;const fit="scale-down";const srcSet=MARKDOWN_IMAGE_SRCSET_WIDTHS.map(w=>`${baseUrl}/${accountHash}/${imageId}/w=${w},fit=${fit},q=${quality} ${w}w`).join(", ");const src=`${baseUrl}/${accountHash}/${imageId}/w=800,fit=${fit},q=${quality}`;return{src,srcSet,sizes:MARKDOWN_IMAGE_SIZES}}var PICTURE_DEVICE_WIDTHS={mobile:[640,1080],tablet:[1024,1536],desktop:[1440,1920]};var PICTURE_DEVICE_MEDIA={mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)"};var PICTURE_DEVICES=["desktop","tablet","mobile"];function resolveDeviceCrops(input){const out={};for(const device of PICTURE_DEVICES){const ratio=input.ratios[device];if(!ratio){out[device]={ratio:null,rect:null};continue}const resolved=resolveScreenFraming({framing:input.framing,device,targetRatio:ratio,tabletInherits:input.tabletInherits,source:input.source});out[device]={ratio,rect:resolved.derived?null:resolved.rect}}return out}function isSameDeviceCrop(a,b){if(a.ratio!==b.ratio)return false;if(!a.rect||!b.rect)return a.rect===b.rect;return Math.abs(a.rect.x-b.rect.x)<5e-4&&Math.abs(a.rect.y-b.rect.y)<5e-4&&Math.abs(a.rect.w-b.rect.w)<5e-4&&Math.abs(a.rect.h-b.rect.h)<5e-4}function pictureWidthsFor(device,maxWidth){const base=PICTURE_DEVICE_WIDTHS[device];if(!maxWidth||maxWidth<=0||maxWidth>=base[base.length-1])return base;return[...base.filter(w=>w<maxWidth),Math.round(maxWidth)]}function resolveSiteImageRenderMode(input){const{src,framing,deviceRatios,tabletInherits="desktop"}=input;if(!src||!deviceRatios)return"single";const uniformRatio=deviceRatios.mobile===deviceRatios.desktop&&deviceRatios.tablet===deviceRatios.desktop;const hasScreens=hasScreenFraming(framing);if(!hasScreens&&uniformRatio)return"single";const trimmable=isCloudflareImageUrl(src)&&!isSvgImageUrl(src);if(!hasScreens)return trimmable?"picture":"single";const source=framing?.source&&framing.source.width>0&&framing.source.height>0?framing.source:null;const crops=resolveDeviceCrops({framing,ratios:deviceRatios,tabletInherits,source});const anyRect=PICTURE_DEVICES.some(device=>crops[device].rect!==null);if(!anyRect)return uniformRatio||!trimmable?"single":"picture";if(!trimmable||!source)return"css-fallback";if(uniformRatio&&isSameDeviceCrop(crops.desktop,crops.tablet)&&isSameDeviceCrop(crops.desktop,crops.mobile)){return"single-trim"}return"picture"}function buildSingleTrimImageUrl(input){const useCase=input.useCase??"general";const width=input.width??defaultWidthForUseCase(useCase);const ratioNum=parseAspectRatio(input.ratio)??16/9;const height=Math.max(1,Math.round(width/ratioNum));const source=input.framing?.source&&input.framing.source.width>0&&input.framing.source.height>0?input.framing.source:null;const resolved=resolveScreenFraming({framing:input.framing,device:"desktop",targetRatio:input.ratio,tabletInherits:input.tabletInherits,source});const trim=!resolved.derived&&source?rectToCloudflareTrim(resolved.rect,source):null;return{src:getOptimizedImageUrl(input.src,{useCase,width,height,fit:"crop",trim,focus:trim?null:effectiveImageFocus(input.framing)}),width,height}}function buildPictureSourcesPlan(input){const{src,useCase="general",ratios,framing,tabletInherits="desktop",maxWidth}=input;if(!isCloudflareImageUrl(src))return null;const sourceDims=framing?.source&&framing.source.width>0&&framing.source.height>0?framing.source:null;const focus=effectiveImageFocus(framing);const crops=resolveDeviceCrops({framing,ratios,tabletInherits,source:sourceDims});const buildForDevice=device=>{const{ratio,rect}=crops[device];const ratioNum=ratio?parseAspectRatio(ratio)??16/9:null;const trim=rect&&sourceDims?rectToCloudflareTrim(rect,sourceDims):null;const widths=pictureWidthsFor(device,maxWidth);const urls=[];const srcSetParts=widths.map(w=>{const url=ratioNum?getOptimizedImageUrl(src,{useCase,width:w,height:Math.max(1,Math.round(w/ratioNum)),fit:"crop",trim,focus:trim?null:focus}):getOptimizedImageUrl(src,{useCase,width:w,fit:"scale-down"});urls.push(url);return`${url} ${w}w`});const primaryW=widths[widths.length-1];const naturalAspect=sourceDims?sourceDims.width/sourceDims.height:null;const primaryH=ratioNum?Math.max(1,Math.round(primaryW/ratioNum)):naturalAspect?Math.max(1,Math.round(primaryW/naturalAspect)):null;const primaryUrl=urls[urls.length-1];return{device,media:device==="desktop"?void 0:PICTURE_DEVICE_MEDIA[device],src:primaryUrl,srcSet:srcSetParts.join(", "),sizes:input.sizes?.[device]??"100vw",width:primaryW,height:primaryH,urls}};const mobile=buildForDevice("mobile");const tabletDesc=buildForDevice("tablet");const desktop=buildForDevice("desktop");const tablet=isSameDeviceCrop(crops.tablet,crops.desktop)?null:tabletDesc;const preloads=tablet?[{media:PICTURE_DEVICE_MEDIA.mobile,href:mobile.src,imageSrcSet:mobile.srcSet,imageSizes:mobile.sizes},{media:PICTURE_DEVICE_MEDIA.tablet,href:tablet.src,imageSrcSet:tablet.srcSet,imageSizes:tablet.sizes},{media:PICTURE_DEVICE_MEDIA.desktop,href:desktop.src,imageSrcSet:desktop.srcSet,imageSizes:desktop.sizes}]:[{media:PICTURE_DEVICE_MEDIA.mobile,href:mobile.src,imageSrcSet:mobile.srcSet,imageSizes:mobile.sizes},{media:"(min-width: 768px)",href:desktop.src,imageSrcSet:desktop.srcSet,imageSizes:desktop.sizes}];const allVariantUrls=Array.from(new Set([...mobile.urls,...tablet?tablet.urls:[],...desktop.urls]));return{mobile,tablet,desktop,preloads,allVariantUrls}}import{jsx}from"react/jsx-runtime";var FALLBACK={protection:DEFAULT_MEDIA_PROTECTION,imageDownloadUrl:()=>null};var MediaProtectionContext=createContext(FALLBACK);function MediaProtectionProvider({protection,websiteId,apiBase="",children}){const value=useMemo(()=>({protection:protection??DEFAULT_MEDIA_PROTECTION,imageDownloadUrl:(imageUrl,name)=>{const imageId=extractImageIdFromUrl(imageUrl);if(!websiteId||!imageId)return null;const base=`${apiBase}/api/public/sites/${encodeURIComponent(websiteId)}/images/${encodeURIComponent(imageId)}/download`;const query=new URLSearchParams;if(name)query.set("name",name);const search=query.toString();return search?`${base}?${search}`:base}}),[protection,websiteId,apiBase]);return jsx(MediaProtectionContext.Provider,{value,children})}function useMediaProtection(){return useContext(MediaProtectionContext)}export{hasNaturalDevice,buildResponsiveFillClasses,normalizeImageCropRect,normalizePadColor,effectiveImageFocus,resolveScreenFraming,focusToObjectPosition,publicEdgeColor,displayFileName,mediaFactsFor,extractImageIdFromUrl,isSvgImageUrl,getOptimizedImageUrl,getOriginalImageUrl,getResponsiveImageAttrs,resolveSiteImageRenderMode,buildSingleTrimImageUrl,buildPictureSourcesPlan,parseMediaProtection,canVisitorsDownloadImages,canVisitorsShareImages,MediaProtectionProvider,useMediaProtection};
|
|
2
|
+
//# sourceMappingURL=chunk-L3BUSP27.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{buildPictureSourcesPlan,buildResponsiveFillClasses,buildSingleTrimImageUrl,effectiveImageFocus,focusToObjectPosition,getOptimizedImageUrl,getResponsiveImageAttrs,hasNaturalDevice,isSvgImageUrl,mediaFactsFor,normalizeImageCropRect,normalizePadColor,publicEdgeColor,resolveScreenFraming,resolveSiteImageRenderMode}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{buildPictureSourcesPlan,buildResponsiveFillClasses,buildSingleTrimImageUrl,effectiveImageFocus,focusToObjectPosition,getOptimizedImageUrl,getResponsiveImageAttrs,hasNaturalDevice,isSvgImageUrl,mediaFactsFor,normalizeImageCropRect,normalizePadColor,publicEdgeColor,resolveScreenFraming,resolveSiteImageRenderMode}from"./chunk-L3BUSP27.js";import{cn}from"./chunk-VUTODQFX.js";import{createContext,useContext,useMemo}from"react";import{jsx}from"react/jsx-runtime";var EMPTY={};var MediaFactsContext=createContext(EMPTY);function MediaFactsProvider({facts,children}){const parent=useContext(MediaFactsContext);const merged=useMemo(()=>{if(!facts||Object.keys(facts).length===0)return parent;if(Object.keys(parent).length===0)return facts;return{...parent,...facts}},[parent,facts]);return jsx(MediaFactsContext.Provider,{value:merged,children})}function useMediaFacts(ref){return mediaFactsFor(useContext(MediaFactsContext),ref)}import{forwardRef,useState}from"react";var ALT_TEXT_RECOMMENDED_MAX=125;var ALT_MAX_LENGTH=ALT_TEXT_RECOMMENDED_MAX;function generateAltText(type,name,fallback,seoKeywords){const primaryKeyword=seoKeywords&&seoKeywords.length>0?seoKeywords[0].trim():null;const trimmedName=name?.trim()||"";const fallbackText=fallback?.trim()||"";if(type==="logo"){return trimmedName||fallbackText||"logo"}if(trimmedName){if(primaryKeyword&&!trimmedName.includes(primaryKeyword)){return`${primaryKeyword} ${trimmedName}`}return trimmedName}if(fallbackText){if(primaryKeyword&&!fallbackText.includes(primaryKeyword)){return`${primaryKeyword} ${fallbackText}`}return fallbackText}return primaryKeyword||"image"}function generateIndexedAltText(type,index,name,seoKeywords){const baseAlt=generateAltText(type,name,void 0,seoKeywords);return`${baseAlt} (${index+1})`}function resolveAlt(params){const{explicitAlt,assetAltText,type,name,fallback,index,seoKeywords,websiteName}=params;const truncate=value=>value.length<=ALT_MAX_LENGTH?value:value.slice(0,ALT_MAX_LENGTH);if(explicitAlt&&explicitAlt.trim().length>0){return truncate(explicitAlt.trim())}if(type!=="logo"&&assetAltText&&assetAltText.trim().length>0){return truncate(assetAltText.trim())}const nameOrFallback=name?.trim()||fallback||websiteName?.trim();let alt;if(index!=null){alt=generateIndexedAltText(type,index,nameOrFallback||void 0,seoKeywords)}else{alt=generateAltText(type,nameOrFallback||void 0,void 0,seoKeywords)}return truncate(alt)}import{Fragment,jsx as jsx2,jsxs}from"react/jsx-runtime";function isCloudflareImage(url){return url.includes("imagedelivery.net")||url.includes("/cdn-cgi/imagedelivery/")}function rectToCssFallbackBox(rect){const r=normalizeImageCropRect(rect)??{x:0,y:0,w:1,h:1};const pct=v=>`${Math.round(v*1e4)/100}%`;return{left:pct(-r.x/r.w),top:pct(-r.y/r.h),width:pct(1/r.w),height:pct(1/r.h)}}var CSS_FALLBACK_DEVICES=[{device:"mobile",suffix:"m",position:{crop:"absolute",flow:"relative"}},{device:"tablet",suffix:"t",position:{crop:"md:absolute",flow:"md:relative"}},{device:"desktop",suffix:"d",position:{crop:"lg:absolute",flow:"lg:relative"}}];var CSS_FALLBACK_BOX_CLASSES="max-h-none max-w-none left-[var(--crop-l-m)] top-[var(--crop-t-m)] w-[var(--crop-w-m)] h-[var(--crop-h-m)] md:left-[var(--crop-l-t)] md:top-[var(--crop-t-t)] md:w-[var(--crop-w-t)] md:h-[var(--crop-h-t)] lg:left-[var(--crop-l-d)] lg:top-[var(--crop-t-d)] lg:w-[var(--crop-w-d)] lg:h-[var(--crop-h-d)]";var SiteImage=forwardRef(function SiteImage2({src,alt,altType,altName,explicitAlt,index,seoKeywords,websiteName,useCase="general",width,height,fit,responsive=false,sizes,fill=false,objectFit="cover",framing,deviceRatios,tabletInherits="desktop",priority=false,containBackdrop,className,style,onError,...rest},ref){const[failedSrc,setFailedSrc]=useState(null);const mediaFacts=useMediaFacts({url:src});const fillClass=fill?deviceRatios&&hasNaturalDevice(deviceRatios)?buildResponsiveFillClasses(deviceRatios):"absolute inset-0 h-full w-full":void 0;if(!src||failedSrc===src){return jsx2("span",{"aria-hidden":"true",className:cn("block bg-zinc-100 dark:bg-zinc-800",fillClass,className),style:{aspectRatio:width&&height?`${width} / ${height}`:"4 / 3",...style}})}const resolvedAlt=alt??(altType?resolveAlt({explicitAlt,assetAltText:mediaFacts?.altText,type:altType,name:altName,index,seoKeywords,websiteName}):"");const external=!isCloudflareImage(src);const svg=isSvgImageUrl(src);const isFramingContain=framing?.fitMode==="contain";const effectiveObjectFit=isFramingContain?"contain":objectFit;const effectiveFit=isFramingContain?"scale-down":fit;const focus=isFramingContain?null:effectiveImageFocus(framing);const mode=isFramingContain?"single":resolveSiteImageRenderMode({src,framing,deviceRatios,tabletInherits});const commonImgProps={ref,alt:resolvedAlt,loading:priority?"eager":"lazy",fetchPriority:priority?"high":"auto",decoding:"async",draggable:false,onError:event=>{setFailedSrc(src);onError?.(event)}};if(mode==="picture"&&deviceRatios){const plan=buildPictureSourcesPlan({src,useCase,ratios:deviceRatios,framing,tabletInherits,sizes:sizes?{desktop:sizes,tablet:sizes,mobile:sizes}:void 0,maxWidth:width});if(plan){return jsxs("picture",{className:cn(fill&&cn("block",fillClass)),children:[jsx2("source",{media:plan.mobile.media,srcSet:plan.mobile.srcSet,sizes:plan.mobile.sizes}),plan.tablet?jsx2("source",{media:plan.tablet.media,srcSet:plan.tablet.srcSet,sizes:plan.tablet.sizes}):null,jsx2("img",{...commonImgProps,src:plan.desktop.src,srcSet:plan.desktop.srcSet,sizes:plan.desktop.sizes,width:fill?void 0:plan.desktop.width,height:fill?void 0:plan.desktop.height??void 0,className:cn(fillClass,className),style:{objectFit,...style},...rest})]})}}if(mode==="single-trim"&&deviceRatios?.desktop){const trimmed=buildSingleTrimImageUrl({src,useCase,width,ratio:deviceRatios.desktop,framing,tabletInherits});return jsx2("img",{...commonImgProps,src:trimmed.src,width:fill?void 0:trimmed.width,height:fill?void 0:trimmed.height,className:cn(fillClass,className),style:{objectFit,...style},...rest})}if(mode==="css-fallback"&&fill&&deviceRatios){const vars={};const positionClasses=[];let previous=null;for(const{device,suffix,position}of CSS_FALLBACK_DEVICES){const ratio=deviceRatios[device];let box={left:"0%",top:"0%",width:"100%",height:"auto"};let kind="flow";if(ratio){kind="crop";const resolved=resolveScreenFraming({framing,device,targetRatio:ratio,tabletInherits,source:framing?.source??null});box=resolved.derived?{left:"0%",top:"0%",width:"100%",height:"100%"}:rectToCssFallbackBox(resolved.rect)}vars[`--crop-l-${suffix}`]=box.left;vars[`--crop-t-${suffix}`]=box.top;vars[`--crop-w-${suffix}`]=box.width;vars[`--crop-h-${suffix}`]=box.height;if(kind!==previous)positionClasses.push(position[kind]);previous=kind}const fallbackSrc=svg?src:getOptimizedImageUrl(src,{useCase,...width!=null?{width}:{}});return jsx2("img",{...commonImgProps,src:fallbackSrc,referrerPolicy:external?"no-referrer":void 0,className:cn(positionClasses,CSS_FALLBACK_BOX_CLASSES,className),style:{...vars,objectFit:"cover",...focus?{objectPosition:focusToObjectPosition(focus)}:{},...style},...rest})}const optimizeOpts={useCase};if(width!=null)optimizeOpts.width=width;if(height!=null)optimizeOpts.height=height;if(effectiveFit!=null)optimizeOpts.fit=effectiveFit;if(focus)optimizeOpts.focus=focus;const responsiveAttrs=responsive&&!svg?getResponsiveImageAttrs(src):null;const finalSrc=svg?src:responsiveAttrs?.src??getOptimizedImageUrl(src,optimizeOpts);const finalSrcSet=responsiveAttrs?.srcSet;const finalSizes=sizes??responsiveAttrs?.sizes;const activeContainBackdrop=containBackdrop??(fill&&effectiveObjectFit==="contain"||isFramingContain);const normalizedEdgeColor=publicEdgeColor(mediaFacts?.edgeColor);const customPadColor=normalizePadColor(framing?.padColor);const solidEdgeColor=activeContainBackdrop?customPadColor??(normalizedEdgeColor&&normalizedEdgeColor!=="transparent"?normalizedEdgeColor:void 0):void 0;const blurBackdropLqip=activeContainBackdrop&&!solidEdgeColor&&!normalizedEdgeColor&&mediaFacts?.lqip&&!svg?mediaFacts.lqip:void 0;const mergedStyle={objectFit:effectiveObjectFit,...focus?{objectPosition:focusToObjectPosition(focus)}:{},...solidEdgeColor?{backgroundColor:solidEdgeColor}:{},...style};const imgNode=jsx2("img",{...commonImgProps,src:finalSrc,srcSet:finalSrcSet,sizes:finalSizes,width:fill?void 0:width,height:fill?void 0:height,referrerPolicy:external?"no-referrer":void 0,className:cn(fillClass,className),style:mergedStyle,...rest});if(!blurBackdropLqip){return imgNode}return jsxs(Fragment,{children:[jsx2("span",{"aria-hidden":"true","data-testid":"site-image-blur-backdrop",className:"pointer-events-none absolute inset-0 overflow-hidden",children:jsx2("img",{src:blurBackdropLqip,alt:"",className:"h-full w-full scale-125 object-cover blur-xl"})}),imgNode]})});SiteImage.displayName="SiteImage";export{MediaFactsProvider,useMediaFacts,SiteImage};
|
|
2
|
+
//# sourceMappingURL=chunk-L66F3USG.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LazyMediaPlayer}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{LazyMediaPlayer}from"./chunk-UITC3NFQ.js";import{ElementsRoot}from"./chunk-7UCZ56EJ.js";import{useKanorio}from"./chunk-73S6VKNV.js";import{jsx}from"react/jsx-runtime";function KanorioMedia({locale,theme,siteUrl,brand,...props}){const ctx=useKanorio({locale,theme,siteUrl,brand});if(!ctx.messages)return jsx(ElementsRoot,{context:ctx,className:"aspect-video w-full animate-pulse rounded-(--media-radius,12px) bg-(--media-surface)",loading:true});return jsx(ElementsRoot,{context:ctx,children:jsx(LazyMediaPlayer,{...props})})}export{KanorioMedia};
|
|
2
|
+
//# sourceMappingURL=chunk-N4Y3DCC6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{extractImageIdFromUrl,getOptimizedImageUrl,getOriginalImageUrl,useMediaProtection}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{extractImageIdFromUrl,getOptimizedImageUrl,getOriginalImageUrl,useMediaProtection}from"./chunk-L3BUSP27.js";import{lockPageScroll}from"./chunk-HFYLTH5B.js";import{useSiteLabels}from"./chunk-U7H3W23Q.js";import{useState,useCallback,useEffect,useMemo}from"react";var IMAGE_EXTENSION_PATTERN=/\.(avif|gif|jpe?g|png|webp)$/i;function getJpegDownloadFilename(url,filename){const baseFilename=filename?.trim()||extractImageIdFromUrl(url)||"image";if(IMAGE_EXTENSION_PATTERN.test(baseFilename)){return baseFilename.replace(IMAGE_EXTENSION_PATTERN,".jpg")}return`${baseFilename}.jpg`}async function downloadImageAsFile(url,filename){const downloadUrl=getOptimizedImageUrl(url,{useCase:"lightbox-image",format:"jpeg"});const res=await fetch(downloadUrl);if(!res.ok){throw new Error(`Failed to fetch image: ${res.status} ${res.statusText}`)}const blob=await res.blob();const a=document.createElement("a");a.href=URL.createObjectURL(blob);a.download=getJpegDownloadFilename(url,filename);a.click();URL.revokeObjectURL(a.href)}var MIN_ZOOM=1;var MAX_ZOOM=3;var ZOOM_STEP=.2;var IMAGE_DISPLAY_WIDTH_RATIO=.95;var IMAGE_DISPLAY_HEIGHT_RATIO=.9;var LIGHTBOX_BUTTON_BASE="w-10 h-10 md:w-12 md:h-12 rounded-full bg-[color-mix(in_srgb,var(--media-fg)_10%,transparent)] hover:bg-[color-mix(in_srgb,var(--media-fg)_20%,transparent)] flex items-center justify-center transition-all";var LIGHTBOX_BUTTON_DISABLED=`${LIGHTBOX_BUTTON_BASE} disabled:opacity-30 disabled:cursor-not-allowed`;var LIGHTBOX_ZOOM_RESET_BUTTON="h-10 md:h-12 min-w-[50px] px-2 rounded-full text-[var(--media-fg)] text-xs md:text-sm font-medium tabular-nums text-center transition-colors enabled:hover:bg-[color-mix(in_srgb,var(--media-fg)_10%,transparent)] disabled:cursor-default";function getDragClientPoint(e){if("touches"in e&&e.touches.length>0){return{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}if("changedTouches"in e&&e.changedTouches.length>0){return{clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY}}return{clientX:e.clientX,clientY:e.clientY}}function useImageLightbox({images,filenames,enableKeyboard=false,onDownload,onShare}){const{ui}=useSiteLabels();const{imageDownloadUrl}=useMediaProtection();const isDesktopPointerDevice=useCallback(()=>{if(typeof window==="undefined"||typeof window.matchMedia!=="function"){return false}return window.matchMedia("(hover: hover) and (pointer: fine)").matches},[]);const[lightboxOpen,setLightboxOpen]=useState(false);const[lightboxIndex,setLightboxIndex]=useState(0);const[zoomLevel,setZoomLevel]=useState(1);const[position,setPosition]=useState({x:0,y:0});const[isDraggingLightbox,setIsDraggingLightbox]=useState(false);const[dragStart,setDragStart]=useState({x:0,y:0});const zoomIn=useCallback(()=>{setZoomLevel(prev=>{const newZoom=Math.min(prev+ZOOM_STEP,MAX_ZOOM);return Math.round(newZoom*10)/10})},[]);const zoomOut=useCallback(()=>{setZoomLevel(prev=>{const newZoom=Math.max(prev-ZOOM_STEP,MIN_ZOOM);const rounded=Math.round(newZoom*10)/10;if(rounded===1){setPosition({x:0,y:0})}return rounded})},[]);const resetZoom=useCallback(()=>{setZoomLevel(1);setPosition({x:0,y:0})},[]);const openLightbox=useCallback(index=>{setLightboxIndex(index);setLightboxOpen(true);setZoomLevel(1);setPosition({x:0,y:0})},[]);const closeLightbox=useCallback(()=>{setLightboxOpen(false);resetZoom()},[resetZoom]);useEffect(()=>{if(!lightboxOpen)return;return lockPageScroll()},[lightboxOpen]);const prevImage=useCallback(()=>{if(images.length<=1)return;setLightboxIndex(prev=>{if(prev===0)return prev;return prev-1});resetZoom()},[images.length,resetZoom]);const nextImage=useCallback(()=>{if(images.length<=1)return;setLightboxIndex(prev=>{if(prev===images.length-1)return prev;return prev+1});resetZoom()},[images.length,resetZoom]);useEffect(()=>{if(!lightboxOpen||!enableKeyboard)return;const handleKeyDown=e=>{const isDesktopMode=isDesktopPointerDevice();const hasZoomModifier=e.metaKey||e.ctrlKey;const isZoomInKey=e.key==="+"||e.key==="="||e.key==="NumpadAdd";const isZoomOutKey=e.key==="-"||e.key==="_"||e.key==="NumpadSubtract";const isZoomResetKey=e.key==="0"||e.key==="Numpad0";if(isDesktopMode&&(hasZoomModifier&&(isZoomInKey||isZoomOutKey||isZoomResetKey)||isZoomInKey||isZoomOutKey||isZoomResetKey)){e.preventDefault();if(isZoomInKey){zoomIn();return}if(isZoomOutKey){zoomOut();return}resetZoom();return}switch(e.key){case"Escape":closeLightbox();break;case"ArrowLeft":prevImage();break;case"ArrowRight":nextImage();break}};window.addEventListener("keydown",handleKeyDown);return()=>window.removeEventListener("keydown",handleKeyDown)},[lightboxOpen,enableKeyboard,closeLightbox,prevImage,nextImage,zoomIn,zoomOut,resetZoom,isDesktopPointerDevice]);const dragBounds=useMemo(()=>{if(zoomLevel<=1){return{maxOffsetX:0,maxOffsetY:0}}const viewportWidth=typeof window!=="undefined"?window.innerWidth:1920;const viewportHeight=typeof window!=="undefined"?window.innerHeight:1080;const imageDisplayWidth=viewportWidth*IMAGE_DISPLAY_WIDTH_RATIO;const imageDisplayHeight=viewportHeight*IMAGE_DISPLAY_HEIGHT_RATIO;const scaledWidth=imageDisplayWidth*zoomLevel;const scaledHeight=imageDisplayHeight*zoomLevel;const maxOffsetX=Math.max(0,(scaledWidth-imageDisplayWidth)/2);const maxOffsetY=Math.max(0,(scaledHeight-imageDisplayHeight)/2);return{maxOffsetX,maxOffsetY}},[zoomLevel]);const handleLightboxDragStart=useCallback(e=>{if(zoomLevel<=1)return;setIsDraggingLightbox(true);const{clientX,clientY}=getDragClientPoint(e);setDragStart({x:clientX-position.x,y:clientY-position.y})},[zoomLevel,position]);const handleLightboxDrag=useCallback(e=>{if(!isDraggingLightbox||zoomLevel<=1)return;const{clientX,clientY}=getDragClientPoint(e);let newX=clientX-dragStart.x;let newY=clientY-dragStart.y;newX=Math.max(-dragBounds.maxOffsetX,Math.min(dragBounds.maxOffsetX,newX));newY=Math.max(-dragBounds.maxOffsetY,Math.min(dragBounds.maxOffsetY,newY));setPosition({x:newX,y:newY})},[isDraggingLightbox,zoomLevel,dragStart,dragBounds]);const handleLightboxDragEnd=useCallback(()=>{setIsDraggingLightbox(false)},[]);const handleDownload=useCallback(async()=>{const imageUrl=images[lightboxIndex];if(!imageUrl)return;if(onDownload){const originalUrl2=getOriginalImageUrl(imageUrl);await onDownload(originalUrl2,lightboxIndex);return}const filename=filenames?.[lightboxIndex];const routeUrl=imageDownloadUrl(imageUrl,filename);if(routeUrl){const anchor=document.createElement("a");anchor.href=routeUrl;anchor.rel="noopener";anchor.click();return}const originalUrl=getOriginalImageUrl(imageUrl);await downloadImageAsFile(originalUrl,filename)},[images,lightboxIndex,onDownload,filenames,imageDownloadUrl]);const handleShare=useCallback(async()=>{const imageUrl=images[lightboxIndex];if(!imageUrl)return;if(onShare){await onShare(imageUrl,lightboxIndex);return}if(navigator.share){try{await navigator.share({title:ui.imageShareTitle,text:ui.imageShareText,url:imageUrl})}catch{}}else{try{await navigator.clipboard.writeText(imageUrl)}catch{}}},[images,lightboxIndex,onShare]);return{lightboxOpen,lightboxIndex,zoomLevel,position,isDraggingLightbox,openLightbox,closeLightbox,setLightboxIndex,prevImage,nextImage,zoomIn,zoomOut,resetZoom,handleLightboxDragStart,handleLightboxDrag,handleLightboxDragEnd,handleDownload,handleShare}}export{MIN_ZOOM,MAX_ZOOM,LIGHTBOX_BUTTON_BASE,LIGHTBOX_BUTTON_DISABLED,LIGHTBOX_ZOOM_RESET_BUTTON,useImageLightbox};
|
|
2
|
+
//# sourceMappingURL=chunk-OLGITMLA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{KanorioAccount}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{KanorioAccount}from"./chunk-FXDWRWZ3.js";import{customerAuthErrorMessage}from"./chunk-4OC7BRQS.js";import{jsx}from"react/jsx-runtime";function mapLoginErrorCode(code,messages){return customerAuthErrorMessage(code,messages)}function KanorioLogin(props){return jsx(KanorioAccount,{...props})}export{mapLoginErrorCode,KanorioLogin};
|
|
2
|
+
//# sourceMappingURL=chunk-OSXFUIAV.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useEffect,useState}from"react";var HOST_DARK_MARKS=[".dark",'[data-theme="dark"]'];var HOST_DARK_MARK_SELECTOR=HOST_DARK_MARKS.join(", ");var THEME_ATTRIBUTE="data-kanorio-theme";var SYSTEM_DARK_QUERY="(prefers-color-scheme: dark)";function resolveAutoCaptchaTheme(container,systemDark){let scoped=false;let auto=false;for(let el=container.closest(`[${THEME_ATTRIBUTE}]`);el;el=el.parentElement?.closest(`[${THEME_ATTRIBUTE}]`)){scoped=true;const theme=el.getAttribute(THEME_ATTRIBUTE);if(theme==="dark")return"dark";if(theme!=="auto")continue;auto=true;if(el.parentElement?.closest(HOST_DARK_MARK_SELECTOR))return"dark"}if(!scoped)return container.parentElement?.closest(HOST_DARK_MARK_SELECTOR)||systemDark?"dark":"light";return auto&&systemDark?"dark":"light"}function systemPrefersDark(){return typeof window!=="undefined"&&typeof window.matchMedia==="function"?window.matchMedia(SYSTEM_DARK_QUERY):null}function useResolvedCaptchaTheme(theme,containerRef,enabled=true){const[auto,setAuto]=useState(void 0);const wantsAuto=theme==="auto"&&enabled;useEffect(()=>{if(!wantsAuto)return;const container=containerRef.current;if(!container)return;const media=systemPrefersDark();const update=()=>setAuto(resolveAutoCaptchaTheme(container,media?.matches??false));update();media?.addEventListener?.("change",update);const observer=typeof MutationObserver==="function"?new MutationObserver(update):null;if(observer){observer.observe(container,{attributes:true,attributeFilter:[THEME_ATTRIBUTE]});for(let el=container.parentElement;el;el=el.parentElement){observer.observe(el,{attributes:true,attributeFilter:["class","data-theme",THEME_ATTRIBUTE]})}}return()=>{media?.removeEventListener?.("change",update);observer?.disconnect()}},[wantsAuto,containerRef]);if(theme==="auto")return enabled?auto:null;return theme??null}export{HOST_DARK_MARKS,useResolvedCaptchaTheme};
|
|
2
|
+
//# sourceMappingURL=chunk-Q4APVE7S.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{FORM_LIMITS}from"./chunk-APWDEDWM.js";import{fileTypesFor}from"./chunk-FFAWYDLJ.js";var FORM_FILE_STALL_TIMEOUT_MS=3e4;var FORM_FILE_EXT_BY_MIME=Object.fromEntries(fileTypesFor("form").map(type=>[type.mime,type.extensions[0]]));function formFileAcceptedMimes(field){return field.accept.length>0?field.accept:Object.keys(FORM_FILE_EXT_BY_MIME)}function checkFormFile(field,file){if(!formFileAcceptedMimes(field).includes(file.type))return"file_type_not_allowed";if(file.size>FORM_LIMITS.FILE_MAX_BYTES)return"file_too_large";return null}function putWithProgress(url,file,headers,options){const{onProgress,onActivity,signal}=options;return new Promise((resolve,reject)=>{if(signal.aborted){reject(new Error("abort"));return}const xhr=new XMLHttpRequest;const abort=()=>xhr.abort();signal.addEventListener("abort",abort,{once:true});const settle=finish=>{signal.removeEventListener("abort",abort);finish()};xhr.open("PUT",url);for(const[k,v]of Object.entries(headers))xhr.setRequestHeader(k,v);xhr.upload.onprogress=e=>{onActivity();if(e.lengthComputable)onProgress(e.loaded/e.total)};xhr.upload.onload=onActivity;xhr.onprogress=onActivity;xhr.onload=()=>settle(()=>xhr.status>=200&&xhr.status<300?resolve():reject(new Error(`PUT ${xhr.status}`)));xhr.onerror=()=>settle(()=>reject(new Error("network")));xhr.onabort=()=>settle(()=>reject(new Error("abort")));xhr.send(file)})}async function uploadFormFile(params){const{signal}=params;if(signal?.aborted)return{ok:false,reason:"aborted"};const controller=new AbortController;const abortFromCaller=()=>controller.abort();signal?.addEventListener("abort",abortFromCaller,{once:true});let stalled=false;let stallTimer;const sawActivity=()=>{clearTimeout(stallTimer);stallTimer=setTimeout(()=>{stalled=true;controller.abort()},FORM_FILE_STALL_TIMEOUT_MS)};const stopped=()=>({ok:false,reason:stalled?"failed":"aborted"});try{sawActivity();const res=await fetch(params.uploadUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fieldId:params.fieldId,fileName:params.file.name,mimeType:params.file.type,fileSize:params.file.size,...params.protection}),signal:controller.signal});const data=await res.json().catch(()=>null);if(controller.signal.aborted)return stopped();if(!res.ok||data?.ok===false||!data?.uploadId||!data.uploadUrl){const reason=data?.reason??data?.error?.code?.toLowerCase();if(reason==="file_too_large"||reason==="file_type_not_allowed")return{ok:false,reason};return{ok:false,reason:"unavailable"}}params.onUploading?.();sawActivity();await putWithProgress(data.uploadUrl,params.file,data.headers??{},{onProgress:ratio=>params.onProgress?.(ratio),onActivity:sawActivity,signal:controller.signal});return{ok:true,uploadId:data.uploadId}}catch{return controller.signal.aborted?stopped():{ok:false,reason:"failed"}}finally{clearTimeout(stallTimer);signal?.removeEventListener("abort",abortFromCaller)}}export{FORM_FILE_EXT_BY_MIME,formFileAcceptedMimes,checkFormFile,uploadFormFile};
|
|
2
|
+
//# sourceMappingURL=chunk-QF55WZDP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p}from"./chunk-6LGTFWQS.js";import{c as m}from"./chunk-CDG7S4P5.js";var d=m(p()),E=[".dark",'[data-theme="dark"]'],h=E.join(", "),a="data-kanorio-theme",v="(prefers-color-scheme: dark)";function R(t,n){let r=!1,u=!1;for(let e=t.closest(`[${a}]`);e;e=e.parentElement?.closest(`[${a}]`)){r=!0;let o=e.getAttribute(a);if(o==="dark")return"dark";if(o==="auto"&&(u=!0,e.parentElement?.closest(h)))return"dark"}return r?u&&n?"dark":"light":t.parentElement?.closest(h)||n?"dark":"light"}function T(){return typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(v):null}function b(t,n,r=!0){let[u,e]=(0,d.useState)(void 0),o=t==="auto"&&r;return(0,d.useEffect)(()=>{if(!o)return;let l=n.current;if(!l)return;let f=T(),s=()=>e(R(l,f?.matches??!1));s(),f?.addEventListener?.("change",s);let i=typeof MutationObserver=="function"?new MutationObserver(s):null;if(i){i.observe(l,{attributes:!0,attributeFilter:[a]});for(let c=l.parentElement;c;c=c.parentElement)i.observe(c,{attributes:!0,attributeFilter:["class","data-theme",a]})}return()=>{f?.removeEventListener?.("change",s),i?.disconnect()}},[o,n]),t==="auto"?r?u:null:t??null}export{E as a,b};
|
|
2
|
+
//# sourceMappingURL=chunk-QYTK2CW3.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as g}from"./chunk-2H3LTDAA.js";import{a as c}from"./chunk-UM74DXPE.js";var m=3e4,b=Object.fromEntries(c("form").map(o=>[o.mime,o.extensions[0]]));function _(o){return o.accept.length>0?o.accept:Object.keys(b)}function k(o,t){return _(o).includes(t.type)?t.size>g.FILE_MAX_BYTES?"file_too_large":null:"file_type_not_allowed"}function y(o,t,r,d){let{onProgress:p,onActivity:i,signal:l}=d;return new Promise((u,a)=>{if(l.aborted){a(new Error("abort"));return}let e=new XMLHttpRequest,n=()=>e.abort();l.addEventListener("abort",n,{once:!0});let f=s=>{l.removeEventListener("abort",n),s()};e.open("PUT",o);for(let[s,F]of Object.entries(r))e.setRequestHeader(s,F);e.upload.onprogress=s=>{i(),s.lengthComputable&&p(s.loaded/s.total)},e.upload.onload=i,e.onprogress=i,e.onload=()=>f(()=>e.status>=200&&e.status<300?u():a(new Error(`PUT ${e.status}`))),e.onerror=()=>f(()=>a(new Error("network"))),e.onabort=()=>f(()=>a(new Error("abort"))),e.send(t)})}async function w(o){let{signal:t}=o;if(t?.aborted)return{ok:!1,reason:"aborted"};let r=new AbortController,d=()=>r.abort();t?.addEventListener("abort",d,{once:!0});let p=!1,i,l=()=>{clearTimeout(i),i=setTimeout(()=>{p=!0,r.abort()},m)},u=()=>({ok:!1,reason:p?"failed":"aborted"});try{l();let a=await fetch(o.uploadUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fieldId:o.fieldId,fileName:o.file.name,mimeType:o.file.type,fileSize:o.file.size,...o.protection}),signal:r.signal}),e=await a.json().catch(()=>null);if(r.signal.aborted)return u();if(!a.ok||e?.ok===!1||!e?.uploadId||!e.uploadUrl){let n=e?.reason??e?.error?.code?.toLowerCase();return n==="file_too_large"||n==="file_type_not_allowed"?{ok:!1,reason:n}:{ok:!1,reason:"unavailable"}}return o.onUploading?.(),l(),await y(e.uploadUrl,o.file,e.headers??{},{onProgress:n=>o.onProgress?.(n),onActivity:l,signal:r.signal}),{ok:!0,uploadId:e.uploadId}}catch{return r.signal.aborted?u():{ok:!1,reason:"failed"}}finally{clearTimeout(i),t?.removeEventListener("abort",d)}}export{b as a,_ as b,k as c,w as d};
|
|
2
|
+
//# sourceMappingURL=chunk-RNRIZCZS.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AudioPlayer}from"./chunk-JREL5347.js";import{VideoPlayer}from"./chunk-CUQUEGX2.js";import{fileKindOf,primaryExtensionFor}from"./chunk-FFAWYDLJ.js";import{formatFileSize}from"./chunk-4BEKWYEW.js";import{BookOpen,Download,FileText,LoaderCircle}from"./chunk-33AQQY6T.js";import{cn}from"./chunk-VUTODQFX.js";import{PortalScopeRoot}from"./chunk-763LNERD.js";import{useSiteLabels}from"./chunk-U7H3W23Q.js";import{useState,useEffect}from"react";import{createPortal}from"react-dom";import{lazy,Suspense}from"react";import{jsx}from"react/jsx-runtime";function dynamic(loader,options={}){const Lazy=lazy(async()=>{const mod=await loader();return"default"in mod?mod:{default:mod}});const Loading=options.loading;return function DynamicComponent(props){return jsx(Suspense,{fallback:Loading?jsx(Loading,{}):null,children:jsx(Lazy,{...props})})}}import{jsx as jsx2,jsxs}from"react/jsx-runtime";function toneFor(mimeType,ext){const kind=mimeType?fileKindOf(mimeType):null;if(kind==="pdf"||ext==="pdf")return"#dc2626";if(kind==="archive"||ext==="zip")return"#71717a";if(kind==="ebook"||ext==="epub")return"#7c3aed";if(mimeType?.includes("spreadsheet")||mimeType==="application/vnd.ms-excel"||ext==="xls"||ext==="xlsx")return"#15803d";if(mimeType?.includes("presentation")||mimeType==="application/vnd.ms-powerpoint"||ext==="ppt"||ext==="pptx")return"#ea580c";if(mimeType?.includes("wordprocessingml")||mimeType==="application/msword"||ext==="doc"||ext==="docx")return"#2563eb";return"#52525b"}function FileTypeIcon({mimeType,fileName,className}){const fromMime=mimeType?primaryExtensionFor(mimeType):"";const fromName=fileName&&fileName.includes(".")?fileName.slice(fileName.lastIndexOf(".")):"";const ext=(fromMime||fromName).replace(/^\./,"").toLowerCase();const tone=toneFor(mimeType,ext);const label=ext?ext.toUpperCase().slice(0,4):"FILE";return jsxs("div",{"aria-hidden":true,className:cn("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",className),children:[jsx2("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"}),jsxs("div",{className:"absolute left-2 right-2 top-4 space-y-1",children:[jsx2("div",{className:"h-0.5 rounded bg-zinc-200 dark:bg-zinc-600"}),jsx2("div",{className:"h-0.5 w-3/4 rounded bg-zinc-200 dark:bg-zinc-600"})]}),jsx2("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:tone},children:label})]})}var MEDIA_ACTION_BUTTON_CLASS="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";import{Fragment,jsx as jsx3,jsxs as jsxs2}from"react/jsx-runtime";var PDFViewerFull=dynamic(()=>import("./PDFViewerFull-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{AudioPlayer}from"./chunk-JREL5347.js";import{VideoPlayer}from"./chunk-CUQUEGX2.js";import{fileKindOf,primaryExtensionFor}from"./chunk-FFAWYDLJ.js";import{formatFileSize}from"./chunk-4BEKWYEW.js";import{BookOpen,Download,FileText,LoaderCircle}from"./chunk-33AQQY6T.js";import{cn}from"./chunk-VUTODQFX.js";import{PortalScopeRoot}from"./chunk-763LNERD.js";import{useSiteLabels}from"./chunk-U7H3W23Q.js";import{useState,useEffect}from"react";import{createPortal}from"react-dom";import{lazy,Suspense}from"react";import{jsx}from"react/jsx-runtime";function dynamic(loader,options={}){const Lazy=lazy(async()=>{const mod=await loader();return"default"in mod?mod:{default:mod}});const Loading=options.loading;return function DynamicComponent(props){return jsx(Suspense,{fallback:Loading?jsx(Loading,{}):null,children:jsx(Lazy,{...props})})}}import{jsx as jsx2,jsxs}from"react/jsx-runtime";function toneFor(mimeType,ext){const kind=mimeType?fileKindOf(mimeType):null;if(kind==="pdf"||ext==="pdf")return"#dc2626";if(kind==="archive"||ext==="zip")return"#71717a";if(kind==="ebook"||ext==="epub")return"#7c3aed";if(mimeType?.includes("spreadsheet")||mimeType==="application/vnd.ms-excel"||ext==="xls"||ext==="xlsx")return"#15803d";if(mimeType?.includes("presentation")||mimeType==="application/vnd.ms-powerpoint"||ext==="ppt"||ext==="pptx")return"#ea580c";if(mimeType?.includes("wordprocessingml")||mimeType==="application/msword"||ext==="doc"||ext==="docx")return"#2563eb";return"#52525b"}function FileTypeIcon({mimeType,fileName,className}){const fromMime=mimeType?primaryExtensionFor(mimeType):"";const fromName=fileName&&fileName.includes(".")?fileName.slice(fileName.lastIndexOf(".")):"";const ext=(fromMime||fromName).replace(/^\./,"").toLowerCase();const tone=toneFor(mimeType,ext);const label=ext?ext.toUpperCase().slice(0,4):"FILE";return jsxs("div",{"aria-hidden":true,className:cn("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",className),children:[jsx2("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"}),jsxs("div",{className:"absolute left-2 right-2 top-4 space-y-1",children:[jsx2("div",{className:"h-0.5 rounded bg-zinc-200 dark:bg-zinc-600"}),jsx2("div",{className:"h-0.5 w-3/4 rounded bg-zinc-200 dark:bg-zinc-600"})]}),jsx2("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:tone},children:label})]})}var MEDIA_ACTION_BUTTON_CLASS="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";import{Fragment,jsx as jsx3,jsxs as jsxs2}from"react/jsx-runtime";var PDFViewerFull=dynamic(()=>import("./PDFViewerFull-6MZJTHN2.js"),{ssr:false,loading:()=>jsx3("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/95",children:jsx3(LoaderCircle,{className:"h-8 w-8 animate-spin text-white/50"})})});function PDFViewer({src,variant="preview",thumbnailUrl,thumbnailAlt,fileName,pageCount,allowDownload,downloadUrl,className}){const{ui}=useSiteLabels();const[isOpen,setIsOpen]=useState(false);const[mounted,setMounted]=useState(false);useEffect(()=>{setMounted(true)},[]);const displayTitle=fileName?.trim()||void 0;const clickToRead=ui.clickToRead;const overlayText=pageCount?`${pageCount} ${ui.pdfPages} \xB7 ${clickToRead}`:clickToRead;const fullViewer=mounted&&isOpen&&createPortal(jsx3(PortalScopeRoot,{children:jsx3(PDFViewerFull,{src,fileName:displayTitle,allowDownload,downloadUrl,onClose:()=>setIsOpen(false)})}),document.body);if(variant==="card"){const meta=pageCount?`PDF \xB7 ${pageCount} ${ui.pdfPages}`:"PDF";return jsxs2(Fragment,{children:[jsxs2("button",{type:"button",onClick:()=>setIsOpen(true),className:cn("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",className),children:[jsx3(FileTypeIcon,{mimeType:"application/pdf",fileName:displayTitle?`${displayTitle}.pdf`:"file.pdf"}),jsxs2("div",{className:"min-w-0 flex-1",children:[jsx3("p",{className:"truncate text-sm font-medium text-zinc-800 dark:text-zinc-200",title:displayTitle,children:displayTitle||"PDF"}),jsx3("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",children:meta})]}),jsxs2("span",{className:MEDIA_ACTION_BUTTON_CLASS,children:[jsx3(BookOpen,{className:"h-4 w-4","aria-hidden":true}),clickToRead]})]}),fullViewer]})}return jsxs2(Fragment,{children:[jsxs2("button",{type:"button",onClick:()=>setIsOpen(true),className:cn("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",className),children:[thumbnailUrl?jsx3("img",{src:thumbnailUrl,alt:thumbnailAlt||displayTitle||"PDF",className:"w-full max-h-[560px] object-contain bg-white dark:bg-zinc-900"}):jsxs2("div",{className:"flex flex-col items-center justify-center py-16 bg-zinc-50 dark:bg-zinc-900",children:[jsx3(FileText,{className:"h-12 w-12 text-zinc-300 dark:text-zinc-600 mb-3"}),jsx3("p",{className:"text-sm text-zinc-500",children:displayTitle||"PDF"})]}),jsx3("div",{className:cn("absolute inset-0 flex items-center justify-center","bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-200"),children:jsx3("p",{className:"text-base font-medium text-white px-4 text-center",children:overlayText})})]}),fullViewer]})}import{jsx as jsx4,jsxs as jsxs3}from"react/jsx-runtime";var CARD_CLASS="rounded-[var(--site-radius-card)] border border-zinc-200 bg-zinc-50 text-left transition-colors dark:border-zinc-700 dark:bg-zinc-900";var LINK_CLASS="group hover:border-zinc-400 dark:hover:border-zinc-500";function FileDownloadCard({name,size,mimeType,href,variant="row",className}){const{ui,locale}=useSiteLabels();const ext=mimeType&&primaryExtensionFor(mimeType)||(name.includes(".")?name.slice(name.lastIndexOf(".")):"");const meta=[ext?ext.slice(1).toUpperCase():null,size?formatFileSize(size,{locale}):null].filter(Boolean).join(" \xB7 ");const Wrapper=href?"a":"div";const linkProps=href?{href,target:"_blank",rel:"noopener noreferrer","data-cta-track":"","data-cta-button-name":name||ui.download,"data-cta-element-id":"file-download"}:{};if(variant==="tile"){return jsxs3(Wrapper,{...linkProps,className:cn(CARD_CLASS,href&&LINK_CLASS,"flex flex-col overflow-hidden",className),children:[jsx4("div",{className:"flex aspect-video items-center justify-center bg-zinc-100 dark:bg-zinc-800",children:jsx4(FileTypeIcon,{mimeType,fileName:name,className:"h-20 w-16 [&>div:last-child]:text-xs"})}),jsxs3("div",{className:"flex flex-col gap-3 p-4",children:[jsxs3("div",{className:"min-w-0",children:[jsx4("p",{className:"truncate text-sm font-medium text-zinc-800 dark:text-zinc-200",title:name,children:name}),meta&&jsx4("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",children:meta})]}),href&&jsxs3("span",{className:cn(MEDIA_ACTION_BUTTON_CLASS,"w-full"),children:[jsx4(Download,{className:"h-4 w-4","aria-hidden":true}),ui.download]})]})]})}return jsxs3(Wrapper,{...linkProps,className:cn(CARD_CLASS,href&&LINK_CLASS,"flex items-center gap-4 p-4",className),children:[jsx4(FileTypeIcon,{mimeType,fileName:name}),jsxs3("div",{className:"min-w-0 flex-1",children:[jsx4("p",{className:"truncate text-sm font-medium text-zinc-800 dark:text-zinc-200",title:name,children:name}),meta&&jsx4("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400",children:meta})]}),href&&jsxs3("span",{className:MEDIA_ACTION_BUTTON_CLASS,children:[jsx4(Download,{className:"h-4 w-4","aria-hidden":true}),ui.download]})]})}import{jsx as jsx5}from"react/jsx-runtime";function MediaPlayer({src,mimeType,hlsSrc,thumbnails,streamingPartial,captions,captionLocale,onCaptionChange,title,fileName,fileSize,fileCardVariant,storageKey,startTime,seekTo,chapters,radius,thumbnailUrl,thumbnailAlt,pageCount,autoPlay,loop,muted,onTimeUpdate,onComplete,onPlaybackEvent,allowDownload,downloadUrl,className}){if(mimeType.startsWith("video/")){return jsx5(VideoPlayer,{src,hlsSrc,thumbnails,streamingPartial,captions,captionLocale,onCaptionChange,title,poster:thumbnailUrl,posterAlt:thumbnailAlt,autoPlay,loop,muted,allowDownload,downloadUrl,storageKey,startTime,seekTo,chapters,radius,onTimeUpdate,onComplete,onPlaybackEvent,className})}if(mimeType.startsWith("audio/")){return jsx5(AudioPlayer,{src,captions,captionLocale,onCaptionChange,title,coverImage:thumbnailUrl,coverImageAlt:thumbnailAlt,autoPlay,loop,allowDownload,downloadUrl,storageKey,startTime,seekTo,chapters,radius,onTimeUpdate,onComplete,onPlaybackEvent,className})}if(mimeType==="application/pdf"){return jsx5(PDFViewer,{src,thumbnailUrl,thumbnailAlt,fileName:title,pageCount,allowDownload,downloadUrl,className})}const kind=fileKindOf(mimeType);if(kind==="document"||kind==="ebook"||kind==="archive"){return jsx5(FileDownloadCard,{name:fileName||title||"file",size:fileSize,mimeType,href:downloadUrl,variant:fileCardVariant,className})}return null}export{PDFViewer,FileDownloadCard,MediaPlayer};
|
|
2
|
+
//# sourceMappingURL=chunk-UDNUWN4W.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{lazy,Suspense}from"react";import{jsx}from"react/jsx-runtime";var MediaPlayerImpl=lazy(()=>import("./MediaPlayer-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{lazy,Suspense}from"react";import{jsx}from"react/jsx-runtime";var MediaPlayerImpl=lazy(()=>import("./MediaPlayer-PMAEZSCZ.js").then(m=>({default:m.MediaPlayer})));var DeliverablePlayerImpl=lazy(()=>import("./deliverables-NO5NEFRM.js").then(m=>({default:m.DeliverablePlayer})));function Skeleton({className="aspect-video"}){return jsx("div",{className:`w-full animate-pulse rounded-(--media-radius,12px) bg-(--media-surface) ${className}`,"aria-busy":"true"})}function LazyMediaPlayer(props){return jsx(Suspense,{fallback:jsx(Skeleton,{}),children:jsx(MediaPlayerImpl,{...props})})}function LazyDeliverablePlayer(props){return jsx(Suspense,{fallback:jsx(Skeleton,{className:"h-64"}),children:jsx(DeliverablePlayerImpl,{...props})})}export{LazyMediaPlayer,LazyDeliverablePlayer};
|
|
2
|
+
//# sourceMappingURL=chunk-UITC3NFQ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createCustomerClient,writeStoredCustomerToken}from"./chunk-73S6VKNV.js";var PKCE_STORAGE_KEY="kanorio.customer.pkce";function toGrant(wire){return{accessToken:wire.access_token,tokenType:wire.token_type,expiresIn:wire.expires_in,expiresAt:wire.expires_at,refreshToken:wire.refresh_token,refreshTokenExpiresIn:wire.refresh_token_expires_in,contactId:wire.contactId}}function base64url(bytes){let binary="";for(const byte of bytes)binary+=String.fromCharCode(byte);return btoa(binary).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function randomString(bytes=32){const buffer=new Uint8Array(bytes);crypto.getRandomValues(buffer);return base64url(buffer)}async function createPkcePair(){const verifier=randomString(32);const digest=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(verifier));return{verifier,challenge:base64url(new Uint8Array(digest)),method:"S256"}}function buildHostedLoginUrl(params){const base=params.siteUrl.replace(/\/+$/,"");const url=new URL(`${base}${params.localeRoot??""}/account/login`);url.searchParams.set("client_id",params.clientId);url.searchParams.set("redirect_uri",params.redirectUri);url.searchParams.set("code_challenge",params.codeChallenge);url.searchParams.set("code_challenge_method","S256");url.searchParams.set("state",params.state);return url.toString()}function currentRedirectUri(){const url=new URL(window.location.href);url.searchParams.delete("code");url.searchParams.delete("state");url.hash="";return url.toString()}async function startHostedCustomerLogin(options){const storage=options.storage??sessionStorage;const redirectUri=options.redirectUri??currentRedirectUri();const pkce=await createPkcePair();const state=randomString(16);storage.setItem(PKCE_STORAGE_KEY,JSON.stringify({verifier:pkce.verifier,state,redirectUri}));const url=buildHostedLoginUrl({siteUrl:options.siteUrl,clientId:options.clientId,redirectUri,codeChallenge:pkce.challenge,state,localeRoot:options.localeRoot});(options.navigate??(target=>window.location.assign(target)))(url)}async function completeHostedCustomerLogin(options){const url=new URL(window.location.href);const code=url.searchParams.get("code");const state=url.searchParams.get("state");if(!code)return null;const storage=options.storage??sessionStorage;const raw=storage.getItem(PKCE_STORAGE_KEY);storage.removeItem(PKCE_STORAGE_KEY);const saved=raw?JSON.parse(raw):null;if(!saved||saved.state!==state)throw new Error("Hosted sign-in state mismatch; start the sign-in again.");if(options.cleanUrl!==false){url.searchParams.delete("code");url.searchParams.delete("state");window.history.replaceState(window.history.state,"",url.toString())}const grant=await exchangeHostedLoginCode({siteUrl:options.siteUrl,clientId:options.clientId,code,codeVerifier:saved.verifier,redirectUri:saved.redirectUri});if(options.storeToken!==false)writeStoredCustomerToken(grant.accessToken);return grant}async function exchangeHostedLoginCode(params){const client=createCustomerClient({siteUrl:params.siteUrl,serverKey:params.serverKey,visitorIp:params.visitorIp});const wire=await client.post("/auth/oauth2/token",{body:{grant_type:"authorization_code",code:params.code,code_verifier:params.codeVerifier,redirect_uri:params.redirectUri,client_id:params.clientId}});return toGrant(wire)}export{startHostedCustomerLogin,completeHostedCustomerLogin};
|
|
2
|
+
//# sourceMappingURL=chunk-UWRJBUJY.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as _,d as m,e as x,g as R,h as E,i as k,j as w}from"./chunk-2H3LTDAA.js";function f(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e!="string")return null;let n=e.normalize("NFKC").replace(/[\s,]/g,"");if(!/^[+-]?(\d+\.?\d*|\.\d+)$/.test(n))return null;let r=Number(n);return Number.isFinite(r)?r:null}var O=/^[a-z0-9][a-z0-9_-]{0,39}$/;function p(e,n){return e!=null&&Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0}function v(e){return e==null||e===""||Array.isArray(e)&&e.length===0}var X=/^[^\s@]+@[^\s@]+\.[^\s@]+$/u,H=254;function I(e){return e.length<=H&&X.test(e)}var j=/^(\d{4})-(\d{2})-(\d{2})$/u,z=/^(\d{2}):(\d{2})$/u;function C(e){let n=j.exec(e);if(!n)return!1;let[,r,i,t]=n.map(Number),u=new Date(Date.UTC(r,i-1,t));return u.getUTCFullYear()===r&&u.getUTCMonth()===i-1&&u.getUTCDate()===t}function T(e){let n=z.exec(e);if(!n)return!1;let[,r,i]=n.map(Number);return r>=0&&r<=23&&i>=0&&i<=59}function S(e,n,r=1){if(typeof e!="string")return{ok:!1,code:"required"};let i=e.trim();return i?i.length>n?{ok:!1,code:"too_long"}:i.length<r?{ok:!1,code:"too_short"}:{ok:!0,value:i}:{ok:!1,code:"required"}}var B=2048;function N(e,n=B){if(typeof e!="string"||e.length>n)return null;try{let r=new URL(e.trim());return r.protocol!=="http:"&&r.protocol!=="https:"||r.username||r.password?null:r}catch{return null}}var $=200;function V(e,n=$){if(e.length===0||e.length>n||/\([^()]*[+*|][^()]*\)\s*[+*{]/.test(e)||/\\[1-9]/.test(e)||/\(\?[<=!]/.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}function W(e){return e.filter(n=>_(n.type))}function h(e){return e==null?!1:typeof e=="string"?e.trim()!=="":Array.isArray(e)?e.length>0:typeof e=="object"?Object.entries(e).some(([n,r])=>n!=="countryCode"&&typeof r=="string"&&r.trim()!==""):!0}function be(e,n){return W(e).filter(r=>h(p(n,r.id))).length}var F=["answered","not_answered"],g=["answered","not_answered","equals","not_equals","contains"],Y=["answered","not_answered","includes","not_includes"],D=["answered","not_answered","equals","not_equals","gt","gte","lt","lte"],K={short_text:g,long_text:g,url:g,email:F,phone:F,date:F,time:F,choice:Y,number:D,rating:D,file:[],statement:[],address:[],tax_id:[],hidden:g};function G(e){return K[e]??[]}function Q(e,n){switch(n){case"answered":case"not_answered":return"none";case"includes":case"not_includes":return"option";case"contains":return"text";case"equals":case"not_equals":return e==="number"||e==="rating"?"number":"text";case"gt":case"gte":case"lt":case"lte":return"number"}}function J(e){return e==null?!1:typeof e=="string"?e.trim()!=="":Array.isArray(e)?e.length>0:!0}function y(e){return typeof e=="string"?e.normalize("NFKC").trim().toLowerCase():typeof e=="number"?String(e):""}function Z(e,n,r){if(!G(n).includes(e.op))return null;let i=J(r);switch(e.op){case"answered":return i;case"not_answered":return!i;case"includes":case"not_includes":{let u=(Array.isArray(r)?r:typeof r=="string"&&r?[r]:[]).includes(e.value);return e.op==="includes"?u:!u}case"contains":return i&&y(r).includes(y(e.value));case"equals":case"not_equals":{if(Q(n,e.op)==="number"){let u=f(r),o=u!==null&&u===e.value;return e.op==="equals"?o:!o}let t=i&&y(r)===y(e.value);return e.op==="equals"?t:!t}case"gt":case"gte":case"lt":case"lte":{let t=f(r),u=typeof e.value=="number"?e.value:null;return t===null||u===null?!1:e.op==="gt"?t>u:e.op==="gte"?t>=u:e.op==="lt"?t<u:t<=u}}}function ee(e,n){return Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0}function L(e,n){let r=new Set,i=new Map;for(let t of e){let u=t.visibleWhen,o=u&&Array.isArray(u.conditions)?u.conditions:[];if(o.length===0||t.type==="email"||t.type==="phone"){r.add(t.id),i.set(t.id,t.type);continue}let a=!1,l=o.map(c=>{let A=c.kind==="hidden"?"hidden":i.get(c.ref);if(!A)return a=!0,!1;let U=c.kind==="hidden"||r.has(c.ref)?ee(n,c.ref):null,b=Z(c,A,U);return b===null&&(a=!0),b===!0});(a||(u?.match==="any"?l.some(Boolean):l.every(Boolean)))&&r.add(t.id),i.set(t.id,t.type)}return r}function ke(e){return e.some(n=>(n.visibleWhen?.conditions?.length??0)>0)}var ne=["required","invalid_email","invalid_phone","invalid_date","invalid_time","too_long","too_short","invalid_format","invalid_option","other_required","too_few_options","too_many_options","invalid_number","not_integer","out_of_range","invalid_url","date_out_of_range","invalid_address","invalid_tax_id","invalid_postal_code","invalid"];function re(e){return typeof e=="string"&&ne.includes(e)}var te=/^[a-z][a-z_]{0,39}$/;function oe(e){return re(e)?e:typeof e=="string"&&te.test(e)?"invalid":null}function M(e){let n={};if(!e||typeof e!="object"||Array.isArray(e))return n;for(let[r,i]of Object.entries(e)){let t=O.test(r)?oe(i):null;t&&(n[r]=t)}return n}var ie=["invalid_answers","duplicate","daily_limit","rate_limited","verification_expired","temporarily_unavailable","too_large","server_error"];function se(e){return typeof e=="string"&&ie.includes(e)}var ue=/^[a-z0-9]{20,30}$/;function Te(e){if(!e||typeof e!="object")return{ok:!1,error:"server_error"};let n=e;if(n.ok===!0||n.ok===void 0&&n.error===void 0){let r=n.state;if(r==="closed"||r==="not_open"||r==="full")return{ok:!0,state:r};let i=typeof n.redirectUrl=="string"&&!E(n.redirectUrl)?k(n.redirectUrl,{maxLength:R}):null;return{ok:!0,...typeof n.submissionId=="string"&&ue.test(n.submissionId)?{submissionId:n.submissionId}:{},...i?{redirectUrl:i.url}:{}}}if(n.ok===!1&&se(n.error))return n.error!=="invalid_answers"?{ok:!1,error:n.error}:{ok:!1,error:"invalid_answers",errors:M(n.errors)};if(n.error&&typeof n.error=="object"){let r=n.error,t=(r.details&&typeof r.details=="object"?r.details:{}).issues??r.issues;switch(r.code){case"VERIFICATION_EXPIRED":return{ok:!1,error:"verification_expired"};case"DUPLICATE_SUBMISSION":return{ok:!1,error:"duplicate"};case"RATE_LIMITED":return{ok:!1,error:"rate_limited"};case"INVALID_ANSWERS":return{ok:!1,error:"invalid_answers",errors:M(t)};case"PAYLOAD_TOO_LARGE":return{ok:!1,error:"too_large"}}}return{ok:!1,error:"server_error"}}function le(e,n){return e.defaultCountry?.toUpperCase()||n?.toUpperCase()||null}var ae="__other__";function de(e){return typeof e!="string"?null:e.replace(/\p{Cc}/gu,"").trim().slice(0,m.HIDDEN_VALUE_MAX)||null}var d=e=>({ok:!0,value:e}),s=e=>({ok:!1,code:e}),Se={phone:null,address:null,tax_id:null};function ce(e,n){if(!V(e))return!0;try{return new RegExp(`^(?:${e})$`,"u").test(n)}catch{return!0}}function P(e,n,r){let i=S(e,n,r??1);return i.ok?d(i.value):s(i.code)}var pe=40;function me(e,n){if(typeof n=="string"&&n.length>pe)return s("invalid_number");let r=f(n);return r===null||Math.abs(r)>Number.MAX_SAFE_INTEGER?s("invalid_number"):e.integer&&!Number.isInteger(r)?s("not_integer"):e.min!==void 0&&r<e.min||e.max!==void 0&&r>e.max?s("out_of_range"):d(r)}function fe(e){if(typeof e!="string")return s("invalid_url");let n=e.trim(),r=N(n.includes("://")?n:`https://${n}`);return!r||!r.hostname.includes(".")?s("invalid_url"):d(r.toString())}function _e(e,n,r){if(typeof n!="string"||!C(n))return s("invalid_date");let i=x(e.range?.min,r),t=x(e.range?.max,r);return i&&n<i||t&&n>t?s("date_out_of_range"):d(n)}function Fe(e,n,r){let i=new Set(e.options.map(a=>a.id)),t=Array.isArray(n)?n:typeof n=="string"&&n?[n]:[];if(!e.allowMultiple&&t.length>1||t.length>m.MAX_OPTIONS+1)return s("invalid_option");let u=r?.trim()??"",o=[];for(let a of t){if(typeof a!="string")return s("invalid_option");if(i.has(a)){o.includes(a)||o.push(a);continue}if(!e.allowOther)return s("invalid_option");let l=a===ae?u:a.trim();if(!l)return s("other_required");if(l.length>m.LABEL_MAX)return s("too_long");o.push(l)}return o.length===0?s("required"):e.allowMultiple?e.minSelections!==void 0&&o.length<e.minSelections?s("too_few_options"):e.maxSelections!==void 0&&o.length>e.maxSelections?s("too_many_options"):d(o):d(o[0])}function q(e,n,r,i,t){let u=v(typeof r=="string"?r.trim():r);if(n.type==="file"){let o=Array.isArray(r)?r:[];if(o.some(l=>typeof l!="string"||!l||l.length>64)||o.length>n.maxFiles)return s("invalid_option");let a=t.fileRequired!=="skip"&&!t.fileRequired.exempt.includes(n.id);return n.required&&o.length===0&&a?s("required"):d(o.length>0?o:null)}if(n.type==="address")return e.address?e.address(n,r):n.required&&!h(r)?s("required"):d(r??null);if(n.type==="tax_id"){if(e.tax_id)return e.tax_id(n,r);let o=w(r)&&r.value.trim()!=="";return n.required&&!o?s("required"):d(r??null)}if(u)return n.required?s("required"):d(null);switch(n.type){case"short_text":{let o=P(r,n.maxLength??m.SHORT_TEXT_MAX,n.minLength);return!o.ok||!n.pattern||typeof o.value!="string"||ce(n.pattern,o.value)?o:s("invalid_format")}case"long_text":return P(r,n.maxLength??m.LONG_TEXT_MAX,n.minLength);case"email":{if(typeof r!="string")return s("invalid_email");let o=r.trim().toLowerCase();return I(o)?d(o):s("invalid_email")}case"phone":{if(typeof r!="string")return s("invalid_phone");if(!e.phone)return d(r);let o=e.phone(r,le(n,t.defaultPhoneCountry));return o?d(o):s("invalid_phone")}case"choice":return Fe(n,r,p(i.otherText,n.id));case"date":return _e(n,r,t.today);case"number":return me(n,r);case"url":return fe(r);case"statement":return d(null);case"time":return typeof r=="string"&&T(r)?d(r):s("invalid_time");case"rating":{let o=typeof r=="number"?r:Number(r);return Number.isInteger(o)&&o>=1&&o<=n.max?d(o):s("invalid_option")}}}function Ne(e,n,r,i){let t={},u={},o=r.answers&&typeof r.answers=="object"?r.answers:{},a=L(n,o);for(let l of n){if(!_(l.type))continue;if(!a.has(l.id)){t[l.id]=null;continue}let c=q(e,l,p(o,l.id),r,i);c.ok?t[l.id]=c.value:u[l.id]=c.code}for(let l of i.hiddenFields??[])t[l.id]=de(p(o,l.id));return Object.keys(u).length>0?{ok:!1,errors:u}:{ok:!0,answers:t}}function Ve(e,n,r,i){if(!_(n.type))return null;let t=q(e,n,p(r.answers,n.id),r,i);return t.ok?null:t.code}export{p as a,be as b,L as c,ke as d,Te as e,le as f,ae as g,d as h,s as i,Se as j,Ne as k,Ve as l};
|
|
2
|
+
//# sourceMappingURL=chunk-VGQ2N7JH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AuthorList}from"./chunk-5G3PQI25.js";import{LazyMediaPlayer}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{AuthorList}from"./chunk-5G3PQI25.js";import{LazyMediaPlayer}from"./chunk-UITC3NFQ.js";import{formatDuration}from"./chunk-4BEKWYEW.js";import{ChevronDown,Download,FileText,Headphones,Lock,Play}from"./chunk-33AQQY6T.js";import{ElementsRoot}from"./chunk-7UCZ56EJ.js";import{fillLabel}from"./chunk-KNNN5V3T.js";import{createDeliveryClient,useKanorio}from"./chunk-73S6VKNV.js";import{useEffect,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";function kindIcon(kind){if(kind==="video")return Play;if(kind==="audio")return Headphones;if(kind==="text"||kind==="pdf")return FileText;return Download}function KanorioCurriculum({product,deliverable,outline:given,expandAll=true,className,...config}){const ctx=useKanorio(config);const[outline,setOutline]=useState(given??null);const[failed,setFailed]=useState(false);const[preview,setPreview]=useState(null);const[collapsed,setCollapsed]=useState(new Set);useEffect(()=>{if(given){setOutline(given);return}let cancelled=false;const client=createDeliveryClient({siteUrl:ctx.siteUrl});const load=locale=>client.get("/products/{slug}",{params:{slug:product},query:locale?{locale}:{}});load(ctx.locale).catch(error=>{if(error.code==="UNSUPPORTED_LOCALE")return load();throw error}).then(res=>{if(!cancelled)setOutline(res.product.deliverables??[])}).catch(()=>{if(!cancelled)setFailed(true)});return()=>{cancelled=true}},[ctx.siteUrl,ctx.locale,product,given]);const openPreview=async unitId=>{const res=await ctx.client.openUnit(unitId,"read");if(res.ok)setPreview({unitId,url:res.url,mimeType:res.mimeType,title:res.title,hls:res.renditions?.find(r=>r.kind==="hls")?.url,thumbnails:res.thumbnails??res.renditions?.find(r=>r.kind==="thumbnails")?.url,captions:res.renditions?.flatMap(r=>r.kind==="captions"&&r.locale?[{locale:r.locale,url:r.url,source:r.source??"ai",edited:r.edited??false}]:[]),chapters:res.renditions?.find(r=>r.kind==="chapters")?.url,poster:res.poster??void 0,partial:res.streaming==="partial"});else setPreview({unitId,error:res.code})};if(!ctx.messages)return jsx(ElementsRoot,{context:ctx,className,loading:true});const a=ctx.messages.account;if(failed)return jsx(ElementsRoot,{context:ctx,className,children:jsx("p",{role:"alert",className:"text-sm text-(--site-fg-muted,#71717a)",children:a.contentLoadError})});if(!outline)return jsx(ElementsRoot,{context:ctx,className,loading:true,children:jsx("div",{className:"h-40 w-full animate-pulse rounded-(--media-radius,12px) bg-(--media-surface)"})});const shown=deliverable?outline.filter(d=>d.id===deliverable):outline;if(shown.length===0)return jsx(ElementsRoot,{context:ctx,className,children:jsx("p",{className:"text-sm text-(--site-fg-muted,#71717a)",children:a.contentNoUnits})});return jsx(ElementsRoot,{context:ctx,className,children:shown.map(d=>{const chapters=d.units.filter(u=>u.parentId===null&&(u.kind==="chapter"||d.units.some(c=>c.parentId===u.id)));const loose=d.units.filter(u=>u.parentId===null&&!chapters.includes(u));const groups=[...loose.length?[{id:`${d.id}:loose`,title:null,units:loose}]:[],...chapters.map(c=>({id:c.id,title:c.title,units:d.units.filter(u=>u.parentId===c.id).sort((x,y)=>x.order-y.order)}))];return jsxs("section",{className:"space-y-3",children:[jsxs("header",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[jsx("h3",{className:"text-lg font-semibold text-(--site-fg,#18181b)",children:d.title}),jsxs("p",{className:"text-sm text-(--site-fg-muted,#71717a)",children:[fillLabel(a.contentUnitsCount,{count:String(d.unitCount)}),d.totalDurationSeconds?` \xB7 ${formatDuration(d.totalDurationSeconds)}`:""]})]}),d.authors&&d.authors.length>0&&jsx(AuthorList,{authors:d.authors}),jsx("ol",{className:"divide-y divide-(--site-border,rgba(0,0,0,0.1)) overflow-hidden rounded-(--media-radius,12px) border border-(--site-border,rgba(0,0,0,0.1))",children:groups.map((g,gi)=>{const isCollapsed=collapsed.has(g.id)||!expandAll&&gi>0&&!collapsed.has(`open:${g.id}`);return jsxs("li",{children:[g.title!==null&&jsxs("button",{type:"button",onClick:()=>setCollapsed(prev=>{const next=new Set(prev);if(expandAll){if(next.has(g.id))next.delete(g.id);else next.add(g.id)}else if(next.has(`open:${g.id}`))next.delete(`open:${g.id}`);else next.add(`open:${g.id}`);return next}),"aria-expanded":!isCollapsed,className:"flex w-full items-center justify-between gap-3 bg-(--media-surface) px-4 py-3 text-left text-sm font-medium text-(--site-fg,#18181b)",children:[jsx("span",{children:g.title}),jsx(ChevronDown,{className:`h-4 w-4 transition-transform ${isCollapsed?"":"rotate-180"}`,"aria-hidden":"true"})]}),!isCollapsed&&jsx("ul",{children:g.units.map(u=>{const Icon=kindIcon(u.kind);const isOpen=preview&&preview.unitId===u.id;return jsxs("li",{className:"border-t border-(--site-border,rgba(0,0,0,0.06)) first:border-t-0",children:[jsxs("div",{className:"flex items-center gap-3 px-4 py-3 text-sm",children:[jsx(Icon,{className:"h-4 w-4 shrink-0 text-(--site-fg-muted,#71717a)","aria-hidden":"true"}),jsx("span",{className:"min-w-0 flex-1 truncate text-(--site-fg,#18181b)",children:u.title??u.kind}),u.countsTowardCompletion===false?jsx("span",{className:"text-xs text-(--site-fg-muted,#71717a)",children:a.contentOptional}):null,u.duration?jsx("span",{className:"text-xs tabular-nums text-(--site-fg-muted,#71717a)",children:formatDuration(u.duration)}):null,u.pageCount?jsxs("span",{className:"text-xs tabular-nums text-(--site-fg-muted,#71717a)",children:[u.pageCount," p"]}):null,u.isPreview&&!(u.releaseAt&&new Date(u.releaseAt)>new Date)?jsx("button",{type:"button",onClick:()=>isOpen?setPreview(null):openPreview(u.id),className:"rounded-full bg-(--brand-color,#18181b) px-2.5 py-1 text-xs font-medium text-(--brand-foreground,#ffffff)",children:a.contentPreviewBadge}):jsx(Lock,{className:"h-3.5 w-3.5 shrink-0 text-(--site-fg-muted,#71717a)","aria-label":a.contentLocked})]}),isOpen&&preview&&"url"in preview&&jsx("div",{className:"px-4 pb-4",children:jsx(LazyMediaPlayer,{src:preview.url,hlsSrc:preview.hls,thumbnails:preview.thumbnails,captions:preview.captions?.length?preview.captions:void 0,chapters:preview.chapters,streamingPartial:preview.partial,thumbnailUrl:preview.poster,mimeType:preview.mimeType??"video/mp4",title:preview.title??void 0,storageKey:`preview:${u.id}`})}),isOpen&&preview&&"error"in preview&&jsx("p",{role:"alert",className:"px-4 pb-3 text-xs text-(--site-fg-muted,#71717a)",children:a.contentLoadError})]},u.id)})})]},g.id)})})]},d.id)})})}export{KanorioCurriculum};
|
|
2
|
+
//# sourceMappingURL=chunk-VRD67HVO.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{BotProtectionAltcha,BotProtectionFields,ThirdPartyCaptcha,parsePublicBotProtectionConfig,preloadAltchaWidget,useBotProtection,useBotProtectionConfig}from"./chunk-KYXZNMNA.js";import{useIsInsideElementsRoot}from"./chunk-7UCZ56EJ.js";import{PartScopeProvider}from"./chunk-763LNERD.js";import{useOptionalSiteLabels}from"./chunk-U7H3W23Q.js";import{ELEMENTS_PART_CLASS,markScope,optionalSiteUrl,resolveLocale,resolveVisitorLocale,useBrandStyle,useElementsMessages,useKanorioProviderConfig,useKanorioSiteUrl,useSiteMeta}from"./chunk-73S6VKNV.js";import{useEffect,useMemo as useMemo2}from"react";import{createContext,useContext,useMemo}from"react";import{jsx}from"react/jsx-runtime";var BotProtectionContext=createContext(null);import{Fragment,jsx as jsx2,jsxs}from"react/jsx-runtime";function useKanorioBotProtection(options={}){const siteUrl=useKanorioSiteUrl(options.siteUrl);const entry=options.entry??"forms";const contextConfig=useBotProtectionConfig();const givenConfig=options.config!==void 0?options.config:contextConfig;const readsSite=givenConfig===null&&options.config===void 0;const{site,error:siteError}=useSiteMeta(siteUrl,readsSite);const siteConfig=useMemo2(()=>site?parsePublicBotProtectionConfig(site.botProtection):null,[site]);const pending=readsSite&&siteConfig===null&&!siteError;const raw=useBotProtection({...options,entry,config:readsSite?siteConfig:givenConfig,variant:options.variant??"full",challengeUrl:`${siteUrl}/api/form-protection/challenge`,altchaChallengeUrl:`${siteUrl}/api/form-protection/altcha`});const captcha=raw.challengeProps.captcha;const fieldProps=useMemo2(()=>({...raw.fieldProps,captcha,pending}),[raw.fieldProps,captcha,pending]);return{...raw,isReady:raw.isReady&&!pending,isSubmittable:raw.isSubmittable&&!pending,fieldProps}}var ENGLISH_ALTCHA_LABELS={botProtection:"Human verification",botProtectionLoading:"Loading human verification"};function useBotProtectionPart(theme,localeProp,wantsAltcha){const parent=useKanorioProviderConfig();const insideRoot=useIsInsideElementsRoot();const locale=resolveLocale(localeProp??parent?.locale);const hostTheme=theme??(parent?.theme==="light"||parent?.theme==="dark"?parent.theme:null);const resolvedTheme=insideRoot?null:hostTheme;const brandSiteUrl=wantsAltcha&&!insideRoot&&parent!==null&&parent.brand!==false?optionalSiteUrl(parent.siteUrl):null;const{site}=useSiteMeta(brandSiteUrl??"",brandSiteUrl!==null);const brandScope=useBrandStyle(site,locale,brandSiteUrl!==null);const scope=useMemo2(()=>insideRoot?null:{className:ELEMENTS_PART_CLASS,mark:element=>markScope(element,resolvedTheme,brandScope)},[insideRoot,resolvedTheme,brandScope]);const rootLabels=useOptionalSiteLabels();const english=resolveVisitorLocale(locale).startsWith("en");const{messages}=useElementsMessages(locale,wantsAltcha&&rootLabels===null&&!english);const labels=useMemo2(()=>{if(rootLabels)return void 0;if(!messages||english)return ENGLISH_ALTCHA_LABELS;return{botProtection:messages.ui.botProtection,botProtectionLoading:messages.ui.botProtectionLoading}},[rootLabels,messages,english]);useEffect(()=>{if(wantsAltcha)preloadAltchaWidget(locale)},[wantsAltcha,locale]);return{scope,labels,locale,theme:resolvedTheme}}function KanorioBotProtection({theme,captcha,pending,...props}){return jsxs(Fragment,{children:[props.renderAltcha===false?null:jsx2(KanorioBotProtectionAltcha,{theme,captcha,pending,...props}),jsx2(BotProtectionFields,{...props,renderAltcha:false})]})}function KanorioBotProtectionAltcha({theme,captcha,pending,...props}){const part=useBotProtectionPart(theme,props.locale,props.variant==="full"&&!captcha&&!pending);const{scope,labels,locale}=part;if(pending)return null;if(captcha){return jsx2(PartScopeProvider,{value:scope,children:jsx2(ThirdPartyCaptcha,{provider:captcha.provider,siteKey:captcha.siteKey,action:captcha.action,cData:captcha.cData,recaptchaVersion:captcha.recaptchaVersion,locale,theme:part.theme,generation:captcha.generation,onVerified:captcha.onVerified,onInvalidated:captcha.onInvalidated,registerExecutor:captcha.registerExecutor,className:props.className})})}return jsx2(PartScopeProvider,{value:scope,children:jsx2(BotProtectionAltcha,{...props,locale,labels})})}export{useKanorioBotProtection,ENGLISH_ALTCHA_LABELS,KanorioBotProtection,KanorioBotProtectionAltcha};
|
|
2
|
+
//# sourceMappingURL=chunk-VT2B53EX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useKanorioProviderConfig,useKanorioSiteUrl}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{useKanorioProviderConfig,useKanorioSiteUrl}from"./chunk-73S6VKNV.js";import{useEffect,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";function reviewDate(publishedAt,timeZone){if(!timeZone)return publishedAt.slice(0,10);try{return new Intl.DateTimeFormat("en-CA",{timeZone,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(publishedAt))}catch{return publishedAt.slice(0,10)}}function KanorioReviews({target,pageSize,loadMoreLabel,verifiedLabel,replyLabel,className,siteUrl:siteUrlProp,timeZone:timeZoneProp}){const siteUrl=useKanorioSiteUrl(siteUrlProp);const parent=useKanorioProviderConfig();const timeZone=timeZoneProp!==void 0?timeZoneProp:parent?.timeZone??null;const[items,setItems]=useState([]);const[nextCursor,setNextCursor]=useState(null);const[loading,setLoading]=useState(false);async function load(cursor,replace){const url=new URL("/api/v1/reviews",siteUrl);url.searchParams.set("target",target);if(pageSize)url.searchParams.set("limit",String(pageSize));if(cursor)url.searchParams.set("cursor",cursor);setLoading(true);try{const res=await fetch(url.toString());if(!res.ok)throw new Error(String(res.status));const body=await res.json();setItems(prev=>replace?body.data??[]:[...prev,...body.data??[]]);setNextCursor(body.nextCursor??null)}catch{if(replace)setItems([]);setNextCursor(null)}finally{setLoading(false)}}useEffect(()=>{let cancelled=false;const url=new URL("/api/v1/reviews",siteUrl);url.searchParams.set("target",target);if(pageSize)url.searchParams.set("limit",String(pageSize));fetch(url.toString()).then(res=>res.ok?res.json():Promise.reject(new Error(String(res.status)))).then(body=>{if(cancelled)return;setItems(body.data??[]);setNextCursor(body.nextCursor??null)}).catch(()=>{if(cancelled)return;setItems([]);setNextCursor(null)});return()=>{cancelled=true}},[siteUrl,target,pageSize]);if(items.length===0)return null;return jsxs("div",{className,"data-kanorio-reviews":target,children:[jsx("ul",{"data-kanorio-reviews-list":"",children:items.map(item=>jsxs("li",{"data-kanorio-review":"","data-rating":item.rating,"data-verified":item.verified?"":void 0,children:[jsxs("div",{"data-kanorio-review-head":"",children:[jsx("strong",{"data-kanorio-review-author":"",children:item.authorName}),jsxs("span",{"data-kanorio-review-rating":"","aria-label":`${item.rating} / 5`,children:[item.rating,"/5"]}),item.verified&&verifiedLabel?jsx("span",{"data-kanorio-review-verified":"",children:verifiedLabel}):null,jsx("time",{"data-kanorio-review-date":"",dateTime:item.publishedAt,children:reviewDate(item.publishedAt,timeZone)})]}),item.content?jsx("p",{"data-kanorio-review-content":"",children:item.content}):null,item.reply?.body&&replyLabel?jsxs("div",{"data-kanorio-review-reply":"",children:[jsx("span",{"data-kanorio-review-reply-label":"",children:replyLabel}),jsx("p",{"data-kanorio-review-reply-body":"",children:item.reply.body})]}):null]},item.id))}),nextCursor&&loadMoreLabel?jsx("button",{type:"button","data-kanorio-reviews-more":"",disabled:loading,onClick:()=>void load(nextCursor,false),children:loadMoreLabel}):null]})}function KanorioRating({target,countLabel,className,siteUrl:siteUrlProp}){const siteUrl=useKanorioSiteUrl(siteUrlProp);const[summary,setSummary]=useState(null);useEffect(()=>{let cancelled=false;const url=new URL("/api/v1/reviews/summary",siteUrl);url.searchParams.set("target",target);fetch(url.toString()).then(res=>res.ok?res.json():Promise.reject(new Error(String(res.status)))).then(body=>{if(!cancelled)setSummary(body)}).catch(()=>{if(!cancelled)setSummary(null)});return()=>{cancelled=true}},[siteUrl,target]);if(!summary||!summary.visible||summary.rating==null)return null;const rounded=Math.round(summary.rating*10)/10;return jsxs("p",{className,"data-kanorio-rating":target,"data-rating":rounded,"data-count":summary.count,children:[jsx("span",{"data-kanorio-rating-value":"","aria-label":`${rounded} / 5`,children:rounded.toFixed(1)}),jsx("span",{"data-kanorio-rating-count":"",children:countLabel?countLabel.replace("{count}",String(summary.count)):summary.count})]})}export{KanorioReviews,KanorioRating};
|
|
2
|
+
//# sourceMappingURL=chunk-W5QS3RHM.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as Et}from"./chunk-QYTK2CW3.js";import{e as yt}from"./chunk-2LOQXVFI.js";import{d as K}from"./chunk-ET57PWXC.js";import{ba as M}from"./chunk-S2NFWI7C.js";import{c as vt}from"./chunk-AFNEGNVJ.js";import{a as L}from"./chunk-OU4IOHLN.js";import{b as Pt}from"./chunk-OTK4YNSG.js";import{a as $}from"./chunk-6LGTFWQS.js";import{c as E}from"./chunk-CDG7S4P5.js";var j=E($()),Ct=E(L()),bt=(0,j.createContext)(null);function ne({value:t,children:e}){return(0,Ct.jsx)(bt.Provider,{value:t,children:e})}function Tt(){return(0,j.useContext)(bt)}var Gt=[{id:"forms",builtinVariant:"full",providerSelectable:!0},{id:"customer_login",builtinVariant:"full",providerSelectable:!0},{id:"checkout_draft",builtinVariant:"standard",providerSelectable:!1}],xt=Gt.filter(t=>t.providerSelectable).map(t=>t.id);var Kt=["kanorio","turnstile","recaptcha","hcaptcha"];function jt(t){return typeof t=="string"&&Kt.includes(t)}function Xt(t){return jt(t)&&t!=="kanorio"}function It(t){return t.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,255)}var rt={provider:"kanorio",recaptchaVersion:null,entries:{}};function ce(t){if(!t||typeof t!="object")return{...rt,entries:{}};let e=t;if(!Xt(e.provider))return{...rt,entries:{}};let r={},p=e.entries&&typeof e.entries=="object"?e.entries:{};for(let c of xt){let i=p[c];i&&typeof i.siteKey=="string"&&i.siteKey&&(r[c]={siteKey:i.siteKey,action:typeof i.action=="string"?i.action:c})}let o=e.recaptchaVersion==="v2"||e.recaptchaVersion==="v3"?e.recaptchaVersion:null;return e.provider==="recaptcha"&&!o?{...rt,entries:{}}:{provider:e.provider,recaptchaVersion:e.provider==="recaptcha"?o:null,entries:r}}var Z=E($());var _t={MIN_SUBMIT_TIME:5e3,MAX_SUBMIT_TIME:9e5,TOKEN_EXPIRY:36e5,INTERACTION_DELAY_MS:2e3},qt=600*1e3,kt=qt-60*1e3,Bt="_kfp_a",Rt="_kfp_b",At="_kfp_c";var w=E($());function St(t){return t.state==="verified"&&t.payload?{kind:"verified",payload:t.payload}:{kind:"invalidated",state:t.state}}var ot={ar:()=>import("./ar-DCOOI5KT.js"),bg:()=>import("./bg-3IK4HFKG.js"),bn:()=>import("./bn-RR3LC6EH.js"),cs:()=>import("./cs-MFQPSNCV.js"),da:()=>import("./da-7SYMTSVT.js"),de:()=>import("./de-E4Z2FEBZ.js"),el:()=>import("./el-O7W5IGS6.js"),en:()=>import("./en-CMYO4GCN.js"),"es-419":()=>import("./es-419-KBS42HIO.js"),"es-es":()=>import("./es-es-ZHEJP4O2.js"),fa:()=>import("./fa-QWGXRQ4X.js"),fi:()=>import("./fi-PSUMYQZD.js"),"fr-ca":()=>import("./fr-ca-2B3TKJL6.js"),"fr-fr":()=>import("./fr-fr-TONIMGOJ.js"),he:()=>import("./he-4AQSZCU4.js"),hi:()=>import("./hi-LFKLYYDS.js"),hu:()=>import("./hu-YRQRLSFJ.js"),id:()=>import("./id-64FYGYA6.js"),it:()=>import("./it-YD6A6Q35.js"),ja:()=>import("./ja-EGKR5NHK.js"),ko:()=>import("./ko-7QD664NG.js"),mr:()=>import("./mr-Q2RUE6T6.js"),nb:()=>import("./nb-VXSPTUAK.js"),nl:()=>import("./nl-VXJ7CRDZ.js"),pl:()=>import("./pl-OV5IAHMC.js"),"pt-br":()=>import("./pt-br-EXNYC3L5.js"),"pt-pt":()=>import("./pt-pt-DGEIQHKN.js"),ro:()=>import("./ro-SLAZ33BA.js"),ru:()=>import("./ru-EJILX4Y7.js"),sv:()=>import("./sv-GFAENRIP.js"),sw:()=>import("./sw-EVYAYVM2.js"),ta:()=>import("./ta-L62HPFNH.js"),te:()=>import("./te-WKXYDHSM.js"),th:()=>import("./th-F7RKJACJ.js"),tr:()=>import("./tr-RJO57G2Z.js"),uk:()=>import("./uk-JZQ5M5JE.js"),ur:()=>import("./ur-PJPC3XAH.js"),vi:()=>import("./vi-XMAGDR5G.js"),"zh-cn":()=>import("./zh-cn-XPV5D6U6.js"),"zh-tw":()=>import("./zh-tw-EGRDKAEG.js")},X={"zh-hant":"zh-tw","zh-hk":"zh-tw","zh-tw":"zh-tw",zh:"zh-cn","zh-cn":"zh-cn","zh-hans":"zh-cn",es:"es-es",fr:"fr-fr",pt:"pt-pt","nl-nl":"nl","nl-be":"nl","en-us":"en","en-gb":"en","en-au":"en","en-ca":"en",no:"nb",nn:"nb",ms:"id"};function Zt(t){let e=(t??"").trim().toLowerCase();if(!e)return"en";if(X[e])return X[e];if(ot[e])return e;let r=e.split("-")[0];return X[r]?X[r]:ot[r]?r:"en"}async function wt(t){let e=Zt(t);return await ot[e](),e}var it=E(L());function Ot(t){return Promise.all([import("./altcha-J22D7W3J.js"),wt(t)]).then(([,e])=>(Pt(),e))}function Ee(t){Ot(t).catch(()=>{})}var Jt=M("block w-full","[--altcha-max-width:100%] [--altcha-border-width:1px]","[--altcha-border-radius:0.5rem]","[--altcha-color-base:var(--site-field-bg,rgba(255,255,255,0.9))]","[--altcha-color-border:var(--site-field-border,rgba(0,0,0,0.15))]","[--altcha-color-border-focus:var(--site-field-accent,var(--brand-color,#FF5733))]","[--altcha-color-active:var(--site-field-accent,var(--brand-color,#FF5733))]","[--altcha-color-text:inherit]","text-[15px] text-[var(--site-field-fg,#18181b)]","[&_.altcha-checkbox_input]:accent-[var(--site-field-accent,var(--brand-color,#FF5733))] [&_.altcha-spinner]:text-[var(--site-field-fg-muted,#71717a)]","[&_.altcha-main]:min-h-11 [&_.altcha-main]:px-3.5 [&_.altcha-main]:py-2.5");function Lt({challengeUrl:t,onVerified:e,onInvalidated:r,expireMs:p=kt,locale:o,className:c,invisible:i=!1,revealed:P=!1,generation:u=0,onStateChange:g,labels:f}){let a=vt(),T=f??a?.ui,B=(0,w.useRef)(null),l=K(B),[_,C]=(0,w.useState)(null);if((0,w.useEffect)(()=>{let m=!1;return Ot(o).then(x=>{m||C(x)}),()=>{m=!0}},[o]),(0,w.useEffect)(()=>{if(!e)return;let m=B.current?.querySelector("altcha-widget");if(!m)return;let x=h=>{let k=h.detail,v=St(k);v.kind==="verified"?e(v.payload):r?.(),g?.(v.kind==="verified"?"verified":v.state)};return m.addEventListener("statechange",x),()=>m.removeEventListener("statechange",x)},[e,r,g,_,u]),!T)throw new Error("AltchaWidget: pass `labels` or render it inside a SiteLabelsProvider");let y=i&&!P;return _?(0,it.jsx)("div",{ref:l.ref,className:M(Jt,l.className,c,y&&"hidden"),"aria-label":T.botProtection,hidden:y||void 0,children:(0,w.createElement)("altcha-widget",{key:u,challengeurl:t,expire:p,language:_,...i?{auto:"onload"}:{},hidefooter:!0,hidelogo:!0})}):y?null:(0,it.jsx)("div",{ref:l.ref,className:M("h-11 w-full animate-pulse rounded-lg "+yt,l.className,c),"aria-label":T.botProtectionLoading})}var D=E($());var Vt=E(L()),b=()=>globalThis,at=new Map;function q(t,e){let r=at.get(t);if(r)return r;let p=new Promise((o,c)=>{if(e()){o();return}let i=document.createElement("script");i.src=t,i.async=!0,i.defer=!0,i.onerror=()=>{at.delete(t),c(new Error(`Failed to load ${t}`))},i.onload=()=>{let P=Date.now(),u=()=>{e()?o():Date.now()-P>1e4?c(new Error(`Timed out waiting for ${t}`)):setTimeout(u,50)};u()},document.head.appendChild(i)});return at.set(t,p),p}function ct(t){return t?`&hl=${encodeURIComponent(t)}`:""}function Nt({provider:t,siteKey:e,action:r,cData:p,recaptchaVersion:o,locale:c,invisible:i=!1,theme:P,generation:u=0,onVerified:g,onInvalidated:f,onError:a,registerExecutor:T,className:B}){let l=(0,D.useRef)(null),_=K(l),C=(0,D.useRef)(null),y=(0,D.useRef)({onVerified:g,onInvalidated:f,onError:a});y.current={onVerified:g,onInvalidated:f,onError:a};let m=t==="recaptcha"&&o==="v3",x=Et(P,l,!m);return(0,D.useEffect)(()=>{if(x===void 0)return;let h=!1,k=l.current,v=s=>!h&&y.current.onVerified(s),N=()=>!h&&y.current.onInvalidated(),R=()=>{h||(y.current.onInvalidated(),y.current.onError?.())},U=x?{theme:x}:{};return t==="turnstile"?q("https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",()=>!!b().turnstile?.render).then(()=>{let s=b().turnstile;h||!k||!s||(C.current=s.render(k,{sitekey:e,action:r,...p?{cData:p}:{},theme:x??"auto",size:"flexible",appearance:i?"interaction-only":"always","refresh-expired":"auto",callback:v,"expired-callback":N,"timeout-callback":N,"error-callback":R}))}).catch(R):t==="hcaptcha"?q(`https://js.hcaptcha.com/1/api.js?render=explicit&recaptchacompat=off${ct(c)}`,()=>!!b().hcaptcha?.render).then(()=>{let s=b().hcaptcha;h||!k||!s||(C.current=s.render(k,{sitekey:e,...U,callback:v,"expired-callback":N,"chalexpired-callback":N,"error-callback":R}))}).catch(R):m?q(`https://www.google.com/recaptcha/api.js?render=${encodeURIComponent(e)}${ct(c)}`,()=>!!b().grecaptcha?.execute).then(()=>{h||T?.(()=>new Promise(s=>{let V=b().grecaptcha;if(!V)return s(null);V.ready(()=>{V.execute(e,{action:r}).then(s,()=>s(null))})}))}).catch(R):q(`https://www.google.com/recaptcha/api.js?render=explicit${ct(c)}`,()=>!!b().grecaptcha?.render).then(()=>{let s=b().grecaptcha;h||!k||!s||s.ready(()=>{h||C.current!==null||(C.current=s.render(k,{sitekey:e,...U,callback:v,"expired-callback":N,"error-callback":R}))})}).catch(R),()=>{h=!0,T?.(null);let s=C.current;if(C.current=null,s!==null)try{t==="turnstile"?b().turnstile?.remove(s):t==="hcaptcha"&&b().hcaptcha?.remove(s)}catch{}}},[t,e,r,p,m,i,c,x]),(0,D.useEffect)(()=>{if(u===0)return;let h=C.current;if(h!==null)try{t==="turnstile"?b().turnstile?.reset(h):t==="hcaptcha"?b().hcaptcha?.reset(h):m||b().grecaptcha?.reset(h)}catch{}},[u,t,m]),m?null:(0,Vt.jsx)("div",{ref:_.ref,className:M("min-h-[65px] w-full",_.className,B),"data-captcha-provider":t})}var I=E(L()),Qt={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0};function te(t,e){if(!e)return t;let r=t.includes("?")?"&":"?";return`${t}${r}context=${encodeURIComponent(e)}`}function Dt({variant:t,altchaChallengeUrl:e,context:r,onAltchaVerified:p,onAltchaInvalidated:o,locale:c,className:i,invisible:P,revealed:u,generation:g,onStateChange:f,labels:a}){return t!=="full"||!e||!p?null:(0,I.jsx)(Lt,{challengeUrl:te(e,r),onVerified:p,onInvalidated:o,locale:c,className:i,invisible:P,revealed:u,generation:g,onStateChange:f,labels:a})}function Re({provider:t,fieldProps:e,captcha:r,locale:p,className:o,invisible:c,revealed:i,generation:P,onStateChange:u,onCaptchaError:g,theme:f}){return t!=="kanorio"&&r?(0,I.jsx)(Nt,{provider:r.provider,siteKey:r.siteKey,action:r.action,cData:r.cData,recaptchaVersion:r.recaptchaVersion,locale:p,invisible:c,generation:r.generation,onVerified:r.onVerified,onInvalidated:r.onInvalidated,onError:g,registerExecutor:r.registerExecutor,theme:f,className:o}):(0,I.jsx)(Dt,{...e,locale:p,className:o,invisible:c,revealed:i,generation:P,onStateChange:u})}function Ae({variant:t,altchaChallengeUrl:e,context:r,onAltchaVerified:p,onAltchaInvalidated:o,onHoneypotChange:c,onHoneypotWpChange:i,onHoneypotCoChange:P,locale:u,renderAltcha:g=!0}){let f=(0,Z.useCallback)(l=>{c?.(l.target.value)},[c]),a=(0,Z.useCallback)(l=>{i?.(l.target.value)},[i]),T=(0,Z.useCallback)(l=>{P?.(l.target.value)},[P]);return(0,I.jsxs)(I.Fragment,{children:[g&&(0,I.jsx)(Dt,{variant:t,altchaChallengeUrl:e,context:r,onAltchaVerified:p,onAltchaInvalidated:o,locale:u}),[{name:Bt,onChange:f},{name:Rt,onChange:a},{name:At,onChange:T}].map(({name:l,onChange:_})=>(0,I.jsxs)("div",{style:Qt,"aria-hidden":"true",children:[(0,I.jsx)("label",{htmlFor:l,children:"Leave this field empty"}),(0,I.jsx)("input",{type:"text",id:l,name:l,autoComplete:"one-time-code",tabIndex:-1,onChange:_})]},l))]})}var n=E($());var ee=600*1e3;function Ne(t={}){let{variant:e="standard",challengeUrl:r="/api/form-protection/challenge",altchaChallengeUrl:p="/api/form-protection/altcha",context:o="",entry:c,needsUploadToken:i=!1}=t,P=Tt(),u=t.config!==void 0?t.config:P,g=c&&u&&u.provider!=="kanorio"?u.entries[c]:void 0,f=g&&u?u.provider:"kanorio",a=f!=="kanorio",T=a?u?.recaptchaVersion??null:null,B=f==="recaptcha"&&T==="v3",l=!a&&e==="standard"||a&&i,[_,C]=(0,n.useState)(e==="full"||a),[y,m]=(0,n.useState)(!1),[x,h]=(0,n.useState)(!1),[k,v]=(0,n.useState)(!1),[N,R]=(0,n.useState)(!1),[U,s]=(0,n.useState)(0),V=(0,n.useRef)(0),O=(0,n.useRef)(""),lt=(0,n.useRef)(""),H=(0,n.useRef)(""),st=(0,n.useRef)(null),z=(0,n.useRef)(""),Y=(0,n.useRef)(""),G=(0,n.useRef)(""),J=(0,n.useRef)(0),A=(0,n.useRef)(null),Q=(0,n.useCallback)(d=>{O.current=d,h(!0)},[]),dt=(0,n.useCallback)(()=>{O.current="",h(!1)},[]),pt=(0,n.useCallback)(d=>{H.current=d,v(!0)},[]),ut=(0,n.useCallback)(()=>{H.current="",v(!1)},[]),ht=(0,n.useCallback)(d=>{st.current=d},[]);(0,n.useEffect)(()=>{if(V.current=Date.now(),z.current="",Y.current="",G.current="",!l){C(!0);return}let d=`${r}?context=${encodeURIComponent(o)}`,S=()=>fetch(d).then(F=>F.ok?F.json():Promise.reject(new Error("Challenge fetch failed"))).then(F=>{let mt=`${F.nonce}|${F.ts}|${F.sig}`;a?lt.current=mt:O.current=mt,R(!0)}).catch(()=>{});S().finally(()=>C(!0));let Yt=setInterval(()=>{S()},ee);return()=>clearInterval(Yt)},[l,a,r,o]),(0,n.useEffect)(()=>()=>{A.current&&clearTimeout(A.current)},[]);let Ht=(0,n.useCallback)(()=>{J.current===0&&(J.current=Date.now(),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{m(!0),A.current=null},_t.INTERACTION_DELAY_MS))},[]),ft=a?y&&(B||k):e==="full"?y&&x:y,W=(0,n.useCallback)(()=>({_hp:z.current,_wp:Y.current,_co:G.current,_ts:V.current,...o?{_ctx:o}:{}}),[o]),Wt=(0,n.useCallback)(()=>a?{...W(),_tk:"",captchaToken:H.current}:{...W(),_tk:O.current},[W,a]),Ft=(0,n.useCallback)(()=>a?{...W(),_tk:lt.current}:{...W(),_tk:O.current},[W,a]),Mt=(0,n.useCallback)(async()=>{if(!B)return;let d=await st.current?.()??"";H.current=d,v(!!d)},[B]),Ut=(0,n.useCallback)(()=>{a&&(H.current="",v(!1),s(d=>d+1))},[a]),$t=(0,n.useCallback)(()=>{if(V.current=Date.now(),z.current="",Y.current="",G.current="",J.current=0,m(!1),h(!1),A.current&&(clearTimeout(A.current),A.current=null),a){H.current="",v(!1),s(d=>d+1);return}if(e==="standard"){let d=`${r}?context=${encodeURIComponent(o)}`;fetch(d).then(S=>S.ok?S.json():Promise.reject(new Error("Challenge fetch failed"))).then(S=>{O.current=`${S.nonce}|${S.ts}|${S.sig}`}).catch(()=>{O.current=""})}else O.current=""},[a,e,r,o]),tt=(0,n.useCallback)(d=>{z.current=d},[]),et=(0,n.useCallback)(d=>{Y.current=d},[]),nt=(0,n.useCallback)(d=>{G.current=d},[]),gt=(0,n.useMemo)(()=>({variant:e,context:o,altchaChallengeUrl:p,onAltchaVerified:e==="full"?Q:void 0,onAltchaInvalidated:e==="full"?dt:void 0,onHoneypotChange:tt,onHoneypotWpChange:et,onHoneypotCoChange:nt}),[e,o,p,Q,dt,tt,et,nt]),zt=(0,n.useMemo)(()=>a&&g?{provider:f,siteKey:g.siteKey,action:g.action,cData:f==="turnstile"?It(o):null,recaptchaVersion:T,generation:U,onVerified:pt,onInvalidated:ut,registerExecutor:ht}:null,[a,g,f,o,T,U,pt,ut,ht]);return{getProtectionData:Wt,getUploadProtectionData:Ft,isReady:_,isSubmittable:ft,isUploadReady:a?N:ft,registerFocus:Ht,registerAltchaPayload:e==="full"&&!a?Q:void 0,reset:$t,prepare:Mt,renewCaptcha:Ut,provider:f,fieldProps:gt,challengeProps:{provider:f,fieldProps:gt,captcha:zt},_setHoneypotValue:tt,_setHoneypotWpValue:et,_setHoneypotCoValue:nt}}export{ne as a,Tt as b,ce as c,Ee as d,Nt as e,Dt as f,Re as g,Ae as h,Ne as i};
|
|
2
|
+
//# sourceMappingURL=chunk-WJPCDZSL.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as $}from"./chunk-QYTK2CW3.js";import{a as M,b as U}from"./chunk-BKNL7ZCI.js";import{a as H}from"./chunk-OU4IOHLN.js";import{a as be}from"./chunk-6LGTFWQS.js";import{c as O}from"./chunk-CDG7S4P5.js";var N="X-Kanorio-Server-Key",V="X-Kanorio-Visitor-IP";var xe="knr_sk_";var pt=`${xe}${"0".repeat(43)}`;function F(e){let t=e.split(".");if(t.length!==4)return null;let n=[];for(let r of t){if(!/^\d{1,3}$/.test(r))return null;let o=Number(r);if(o>255)return null;n.push(o)}return n}function Se(e){if(!e.includes(":")||e.includes("%"))return null;let t=e,n=null,r=e.lastIndexOf(":"),o=e.slice(r+1);if(o.includes(".")){if(n=F(o),!n)return null;t=`${e.slice(0,r)}:0:0`}let i=t.indexOf("::");if(i!==t.lastIndexOf("::"))return null;let s;if(i>=0){let l=t.slice(0,i).split(":").filter(Boolean),c=t.slice(i+2).split(":").filter(Boolean),d=8-l.length-c.length;if(d<1)return null;s=[...l,...Array(d).fill("0"),...c]}else s=t.split(":");if(s.length!==8)return null;let a=[];for(let l of s){if(!/^[0-9a-fA-F]{1,4}$/.test(l))return null;let c=parseInt(l,16);a.push(c>>8,c&255)}return n&&a.splice(12,4,...n),a}function we(e){let t=e.trim();if(!t||t.length>45)return null;let n=F(t);if(n)return{version:4,bytes:n};let r=Se(t);return r?r.slice(0,10).every(i=>i===0)&&r[10]===255&&r[11]===255?{version:4,bytes:r.slice(12)}:{version:6,bytes:r}:null}function Ee(e,t,n){let r=Math.floor(n/8);for(let s=0;s<r;s++)if(e[s]!==t[s])return!1;let o=n%8;if(o===0)return!0;let i=255<<8-o&255;return((e[r]??0)&i)===((t[r]??0)&i)}var Re=[[[0,0,0,0],8],[[10,0,0,0],8],[[100,64,0,0],10],[[127,0,0,0],8],[[169,254,0,0],16],[[172,16,0,0],12],[[192,0,0,0],24],[[192,0,2,0],24],[[192,168,0,0],16],[[198,18,0,0],15],[[198,51,100,0],24],[[203,0,113,0],24],[[224,0,0,0],3]],ve=[[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],127],[[252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],7],[[254,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0],10],[[255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],8],[[32,1,13,184,0,0,0,0,0,0,0,0,0,0,0,0],32]];function ke(e){return!(e.version===4?Re:ve).some(([n,r])=>Ee(e.bytes,n,r))}function Ce(e){if(e.version===4)return e.bytes.join(".");let t=[];for(let n=0;n<16;n+=2)t.push(((e.bytes[n]??0)<<8|(e.bytes[n+1]??0)).toString(16));return t.join(":")}function q(e){if(!e)return null;let t=we(e);return!t||!ke(t)?null:Ce(t)}var Te=/^(localhost|127\.0\.0\.1|\[::1\])$/i;function j(){return typeof window<"u"&&typeof document<"u"}async function B(e,t){let n=e.serverKey?.trim();if(!n)return null;if(j())throw new Error("@kanorio/sdk: `serverKey` must never be used in the browser. Call Kanorio from your server (route handler, server action, middleware) and keep the key in an environment variable.");let r=new URL(t);if(r.protocol!=="https:"&&!Te.test(r.hostname))throw new Error("@kanorio/sdk: `serverKey` requires an https site URL.");let o={[N]:n},i=typeof e.visitorIp=="function"?await e.visitorIp():e.visitorIp,s=q(i);return s&&(o[V]=s),{headers:o,redirect:"error"}}function z(e){return e.headers.get("cf-mitigated")==="challenge"}var W="EDGE_CHALLENGE";function Y(e){return j()?"Kanorio's edge answered this request with a security check page, so it never reached the API. API requests are not normally checked this way: retry in a moment, and contact Kanorio support if it keeps happening.":e?`Kanorio's edge challenged this server-side request even though a server key was sent. Check that the key is a server key (starts with knr_sk_, purpose "Website server") and that it is sent to the site's own hostname.`:'Kanorio\'s edge challenged this server-side request, so it never reached the API. Sending a server key avoids this: create one under Site settings > Developer (purpose "Website server"), store it as KANORIO_SERVER_KEY, and pass `serverKey` to the client. Do not paste the key into chat or commit it.'}var Oe="1.4.0",Pe="x-kanorio-sdk-version";function _e(e){if(typeof e!="object"||e===null)return!1;let t=e.error;if(typeof t!="object"||t===null)return!1;let{code:n,message:r}=t;return typeof n=="string"&&typeof r=="string"}var m=class extends Error{constructor(n,r,o,i,s,a){super(o);this.code=n;this.status=r;this.details=i;this.retryAfter=s;this.availableAt=a;this.name="KanorioApiError"}},P=class extends m{constructor(t){super(W,403,t),this.name="KanorioEdgeChallengeError"}};function Ie(e,t,n){let r=n.get("retry-after"),o=r?Number.parseInt(r,10):void 0;if(_e(t)){let a=t.error.details,l=typeof a?.retryAfter=="number"?a.retryAfter:void 0,c=typeof a?.availableAt=="string"?a.availableAt:void 0;return new m(t.error.code,e,t.error.message,t.error.details,o??l,c)}let i=e===401?"UNAUTHENTICATED":e===404?"NOT_FOUND":e===429?"RATE_LIMITED":e>=500?"UPSTREAM_ERROR":"HTTP_ERROR",s=typeof t=="string"?t.slice(0,200):"";return new m(i,e,s||`Request failed with HTTP ${e}.`,void 0,o)}function Ae(e,t,n){if(!e.has("deprecation"))return null;let r=e.get("link")??"",o=i=>r.match(new RegExp(`<([^>]+)>;\\s*rel="${i}"`))?.[1]??null;return{method:t,path:n,sunset:e.get("sunset"),successor:o("successor-version"),policy:o("deprecation")}}function Ke(e,t,n){let r=new URL(t.replace(/^\//,""),e.endsWith("/")?e:`${e}/`);if(n)for(let[o,i]of Object.entries(n)){let s=Array.isArray(i)?i:[i];for(let a of s)a!=null&&r.searchParams.append(o,String(a))}return r.toString()}function S(e){let t=e.fetch??globalThis.fetch;if(!t)throw new Error("@kanorio/sdk: global fetch is not available; pass `fetch` in options.");let n=new Set,r=e.onDeprecation??(s=>{let a=`${s.method} ${s.path}`;n.has(a)||(n.add(a),console.warn(`[kanorio] ${a} is deprecated${s.sunset?` (sunset ${s.sunset})`:""}${s.successor?`; use ${s.successor}`:""}.`))});async function o(s,a,l={}){let c=new Headers(typeof e.headers=="function"?await e.headers():e.headers);new Headers(l.headers).forEach((h,y)=>c.set(y,h)),c.set("accept","application/json"),typeof document>"u"&&(c.set(Pe,Oe),e.userAgent&&c.set("user-agent",e.userAgent));let d;l.body!==void 0&&(c.set("content-type","application/json"),d=JSON.stringify(l.body));let p=Ke(e.baseUrl,a,l.query),g=await B(e,p);if(g)for(let[h,y]of Object.entries(g.headers))c.set(h,y);let f=e.timeoutMs?new AbortController:null,x=f?setTimeout(()=>f.abort(),e.timeoutMs):null;f&&l.signal&&l.signal.addEventListener("abort",()=>f.abort(),{once:!0});try{return await t(p,{method:s,headers:c,body:d,signal:f?.signal??l.signal,...g?{redirect:g.redirect}:{}})}finally{x&&clearTimeout(x)}}async function i(s,a,l={}){let c=await o(s,a,l);if(z(c))throw new P(Y(!!e.serverKey));let d=Ae(c.headers,s,a);d&&r(d);let p=await c.text(),g=p;if(p)try{g=JSON.parse(p)}catch{g=p}else g=void 0;if(!c.ok)throw Ie(c.status,g,c.headers);return g}return{request:i,raw:o}}var Le=[{source:"/sitemap.xml",apiPath:"/seo/sitemap.xml"},{source:"/robots.txt",apiPath:"/seo/robots.txt"},{source:"/llms.txt",apiPath:"/seo/llms.txt"},{source:"/llms-full.txt",apiPath:"/seo/llms-full.txt"},{source:"/feed.xml",apiPath:"/feed"},{source:"/rss.xml",apiPath:"/feed"},{source:"/feed.atom",apiPath:"/feed.atom"}];function De(e){let t=w(e.siteUrl),n=Le.map(r=>({source:r.source,destination:`${t}${r.apiPath}`}));return e.framework==="astro"?Object.fromEntries(n.map(r=>[r.source,r.destination])):(n.push({source:"/:key([a-f0-9]{32}).txt",destination:`${t}/seo/indexnow-key.txt`}),n)}function He(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}async function Me(e){let t=e.fetch??globalThis.fetch,n=(e.path??"/").trim(),r=n.startsWith("/")?n:`/${n}`,o=`${w(e.siteUrl)}/seo/jsonld?path=${encodeURIComponent(r)}`,i=await t(o);if(!i.ok)return null;let s=await i.json();return{jsonLd:s,scriptJson:He(JSON.stringify(s)),cacheTags:_(i.headers)}}async function Ue(e){let t=e.fetch??globalThis.fetch;try{let n=await t(`${w(e.siteUrl)}/seo/sitemap`);if(!n.ok)return null;let r=await n.json();return typeof r.siteUrl!="string"||!Array.isArray(r.urls)?null:{siteUrl:r.siteUrl,urls:r.urls,cacheTags:_(n.headers)}}catch{return null}}function G(e){function t(n){return De({siteUrl:e.siteUrl,framework:n.framework})}return{rewrites:t,jsonLd:(n="/")=>Me({siteUrl:e.siteUrl,path:n,fetch:e.fetch}),sitemapEntries:()=>Ue({siteUrl:e.siteUrl,fetch:e.fetch})}}function $e(e,t){return e.replace(/\{([^}]+)\}/g,(n,r)=>{let o=t?.[r];if(o==null)throw new Error(`@kanorio/sdk: missing path parameter "${r}" for ${e}`);return encodeURIComponent(String(o))})}function v(e){let t=n=>(r,o)=>{let i=o??{},s={query:i.query,body:i.body,headers:i.headers,signal:i.signal};return e.request(n,$e(r,i.params),s)};return{get:t("GET"),post:t("POST"),put:t("PUT"),patch:t("PATCH"),delete:t("DELETE"),http:e}}var J="x-kanorio-cache-tags";function Ne(e){let t=[],n=new Set;for(let r of e){let o=r.trim();!o||n.has(o)||(n.add(o),t.push(o))}return t}function Q(e){return e?Ne(e.split(/\s+/)):[]}var Ve="x-kanorio-preview";function w(e){return`${e.replace(/\/+$/,"")}/api/v1`}function Z(e){let{siteUrl:t,previewToken:n,headers:r,...o}=e,s=v(S({...o,headers:n===void 0?r:async()=>{let l=new Headers(typeof r=="function"?await r():r),c=typeof n=="function"?await n():n;return c&&l.set(Ve,c),l},baseUrl:w(t)})),a=G({siteUrl:t,fetch:o.fetch});return Object.assign(s,{seo:a})}var X=J;function _(e){if(!e)return[];let t=typeof e.get=="function"?e.get(X):e[X]??e["X-Kanorio-Cache-Tags"];return Q(t)}function Fe(e){return`${e.replace(/\/+$/,"")}/api/v1/customer`}async function ee(e){let t=typeof e=="function"?await e():e;return t||null}function qe(e){let{siteUrl:t,token:n,headers:r,...o}=e,i=S({...o,baseUrl:Fe(t),headers:async()=>{let s=new Headers(r),a=await ee(n);return a&&s.set("authorization",`Bearer ${a}`),s}});return v(i)}var k="kanorio.customer.token";function je(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}function te(e,t=je()){try{e?t?.setItem(k,e):t?.removeItem(k)}catch{}}function b(e){return{...e,ok:!0}}function ne(e){let t=qe(e),n=S({...e,baseUrl:`${e.siteUrl.replace(/\/+$/,"")}/api/v1`}),r=o=>o instanceof m?{ok:!1,code:o.code,...o.availableAt?{availableAt:o.availableAt}:{}}:{ok:!1,code:"NETWORK_ERROR"};return{async openUnit(o,i,s){try{if(!await ee(e.token))return b(await n.request("POST",`units/${encodeURIComponent(o)}/open`,{body:{mode:i}}));let l=s?.attachmentId?{mode:i,attachmentId:s.attachmentId}:{mode:i};return b(await t.post("/units/{id}/open",{params:{id:o},query:e.locale?{locale:e.locale}:{},body:l}))}catch(a){return r(a)}},async reportProgress(o){try{return b(await t.post("/progress",{body:o}))}catch(i){return r(i)}},async submitQuiz(o){try{return b(await t.post("/units/{id}/quiz",{params:{id:o.unitId},body:{answers:o.answers}}))}catch(i){return r(i)}},async getCertificate(o){try{return b(await t.get("/deliverables/{deliverableId}/certificate",{params:{deliverableId:o}}))}catch(i){return r(i)}},async getTranscript(o,i){try{let s=i??e.locale;return b(await t.get("/units/{id}/transcript",{params:{id:o},query:s?{locale:s}:{}}))}catch(s){return r(s)}}}}var u=O(be(),1);var Be="en-US",I={ar:()=>import("./ar-JXAEXYYY.js"),bg:()=>import("./bg-EUIPVVBX.js"),bn:()=>import("./bn-L35GOE5D.js"),cs:()=>import("./cs-MGLMNU2K.js"),da:()=>import("./da-X5HKEDEL.js"),de:()=>import("./de-Y5ELIZBU.js"),el:()=>import("./el-YZGS3PLP.js"),"en-AU":()=>import("./en-AU-IUEA3YQP.js"),"en-CA":()=>import("./en-CA-OFK46Q44.js"),"en-GB":()=>import("./en-GB-VNG2IO2E.js"),"en-US":()=>import("./en-US-5RT4SJ3V.js"),en:()=>import("./en-MCRNEXQP.js"),"es-419":()=>import("./es-419-JFUQ3D4V.js"),"es-ES":()=>import("./es-ES-BMD6JJEO.js"),fa:()=>import("./fa-NE4XJTHW.js"),fi:()=>import("./fi-SCTIKRMX.js"),"fr-CA":()=>import("./fr-CA-RQDI3NIQ.js"),"fr-FR":()=>import("./fr-FR-KGXOTINP.js"),gu:()=>import("./gu-7AJCL43I.js"),he:()=>import("./he-UWYKIUPF.js"),hi:()=>import("./hi-KXKJMKZF.js"),hu:()=>import("./hu-YRF3KPIJ.js"),id:()=>import("./id-SXO4Z54V.js"),it:()=>import("./it-RBRELRA3.js"),ja:()=>import("./ja-2WRUVHKU.js"),km:()=>import("./km-SL6MZB3H.js"),kn:()=>import("./kn-YGEU3PSD.js"),ko:()=>import("./ko-2GI6Z5YH.js"),lo:()=>import("./lo-ZRV6OAH6.js"),ml:()=>import("./ml-BIZEFHNR.js"),mr:()=>import("./mr-PZNRW5MW.js"),ms:()=>import("./ms-NYWKJQEQ.js"),my:()=>import("./my-FHI5JEQF.js"),nb:()=>import("./nb-U4QN5GJE.js"),ne:()=>import("./ne-J3XQJZAY.js"),"nl-BE":()=>import("./nl-BE-VHBDCIRF.js"),"nl-NL":()=>import("./nl-NL-FZMZRVH4.js"),nn:()=>import("./nn-UCSEDGDB.js"),pa:()=>import("./pa-LTF7CWS2.js"),pl:()=>import("./pl-YWCG2YWW.js"),"pt-BR":()=>import("./pt-BR-5JRKIQVH.js"),"pt-PT":()=>import("./pt-PT-Y2UCAKHP.js"),ro:()=>import("./ro-6MQF2KY2.js"),ru:()=>import("./ru-KGU3SC3S.js"),si:()=>import("./si-CTQN6I2M.js"),sv:()=>import("./sv-QGZRDKBJ.js"),sw:()=>import("./sw-CWIRVHYD.js"),ta:()=>import("./ta-E3ZBHC6A.js"),te:()=>import("./te-7JC2KGAU.js"),th:()=>import("./th-JVK4E2AJ.js"),tl:()=>import("./tl-X72423V3.js"),tr:()=>import("./tr-22NUPSET.js"),uk:()=>import("./uk-POKPJJDZ.js"),ur:()=>import("./ur-6LBRTMAE.js"),vi:()=>import("./vi-XC4CGJHX.js"),"zh-CN":()=>import("./zh-CN-XW3PLUG5.js"),"zh-HK":()=>import("./zh-HK-25OZZBHO.js"),"zh-Hant":()=>import("./zh-Hant-LFJZCOMK.js")},At=Object.keys(I);function ze(e){return e&&e in I?e:Be}async function re(e){return(await I[ze(e)]()).default}var We="kanorio-elements",Ye="kanorio-popup",Ge="kanorio-part",C="data-kanorio-brand";function Dt(e,t,n){t?e.setAttribute("data-kanorio-theme",t):e.removeAttribute("data-kanorio-theme"),n?e.setAttribute(C,n):e.removeAttribute(C)}var Je=`:is(.${We}, .${Ye}, .${Ge})`,se=$,Ht=se.join(", "),oe=se.map(e=>`${e} *`).join(", "),ie=['[data-kanorio-theme="dark"]','[data-kanorio-theme="dark"] *',`[data-kanorio-theme="auto"]:where(${oe})`,`[data-kanorio-theme="auto"]:where(${oe}) *`].join(", "),ae='[data-kanorio-theme="auto"], [data-kanorio-theme="auto"] *';var dt=O(H(),1);U(M);var A="kanorio:token-change";function ue(e){let t=e?.replace(/\/+$/,"");if(t)return t;if(typeof window<"u")return window.location.origin;if(e)return"";throw new Error("@kanorio/elements: siteUrl is required outside the browser.")}function qt(e){let t=e?.replace(/\/+$/,"");return t||(typeof window<"u"?window.location.origin:null)}function Qe(e){return e||(typeof document<"u"&&document.documentElement.lang?document.documentElement.lang:"en")}var de=()=>()=>{},R=Object.freeze({value:null,failures:0,round:0}),Xe=()=>R;function pe(e){let t=new Map,n=new Map,r=new Set,o=0,i=()=>{for(let s of[...r])s()};return{entry:s=>t.get(s)??R,subscribe(s){return r.add(s),()=>{r.delete(s)}},load(s){let a=t.get(s);if(a&&a.value!==null)return Promise.resolve(a.value);let l=n.get(s);if(l)return l;let c=o,d=Promise.resolve().then(()=>e(s)).catch(()=>null).then(p=>{if(n.get(s)===d&&n.delete(s),c!==o)return p;let g=t.get(s)??R;return t.set(s,p===null?{...g,failures:g.failures+1}:{value:p,failures:g.failures,round:g.round}),i(),p});return n.set(s,d),d},clear(){o+=1;for(let[s,a]of t)t.set(s,{value:null,failures:a.failures,round:a.round+1});for(let s of n.keys())t.has(s)||t.set(s,{...R,round:1});n.clear(),i()},retryFailed(){let s=!1;for(let[a,l]of t)l.value!==null||n.has(a)||(t.set(a,{...l,round:l.round+1}),s=!0);s&&i()},reset(){o+=1,t.clear(),n.clear(),i()}}}function ge(e,t){let n=(0,u.useSyncExternalStore)(t===null?de:e.subscribe,()=>t===null?R:e.entry(t),Xe),[r,o]=(0,u.useState)(()=>({key:t,failures:t===null?0:e.entry(t).failures})),i=r;r.key!==t&&(i={key:t,failures:t===null?0:e.entry(t).failures},o(i));let s=t!==null&&n.value===null;(0,u.useEffect)(()=>{s&&t!==null&&e.load(t)},[e,t,s,n.round]);let a=t!==null&&n.value===null&&n.failures>i.failures;return(0,u.useMemo)(()=>({value:n.value,error:a}),[n.value,a])}var fe=pe(e=>re(e)),K=pe(e=>Z({siteUrl:e}).get("/site").then(t=>typeof t?.id=="string"?t:null));typeof window<"u"&&window.addEventListener("online",()=>{fe.retryFailed(),K.retryFailed()});function Ze(e,t=!0){let{value:n,error:r}=ge(fe,t?e:null),[o,i]=(0,u.useState)(null);n!==null&&(o===null||o.messages!==n||o.locale!==e)&&i({messages:n,locale:e});let s=n??o?.messages??null,a=n!==null?e:o?.locale??e;return(0,u.useMemo)(()=>({messages:s,locale:a,error:r}),[s,a,r])}function jt(e){return K.load(e)}function et(e,t=!0){let{value:n,error:r}=ge(K,t?e:null),[o,i]=(0,u.useState)(null);n!==null&&(o===null||o.site!==n||o.siteUrl!==e)&&i({site:n,siteUrl:e});let s=n??(t&&o?.siteUrl===e?o.site:null);return(0,u.useMemo)(()=>({site:s,error:r}),[s,r])}function me(e){let t=e.toLowerCase();return t.startsWith("zh-hans")||t.startsWith("zh-cn")||t.startsWith("zh-sg")?"zh-Hans":t.startsWith("zh")?"zh-Hant":t.startsWith("ja")?"ja":t.startsWith("ko")?"ko":"en"}function tt(e,t,n){let r=e.colors.primary.light,o=e.colors.primary.dark,i=Object.entries(e.radius).map(([d,p])=>`--site-radius-${d}: ${p};`).join(" "),s=me(t),a=e.fonts.find(d=>d.locales.includes(s))??e.fonts[0],l=a?`--site-font-family: ${a.family};`:"",c=`--brand-color: ${o.background}; --brand-foreground: ${o.foreground};`;return[`:where(${n}) { --brand-color: ${r.background}; --brand-foreground: ${r.foreground}; ${i} ${l} font-family: var(--site-font-family, inherit); }`,`:where(${n}):where(${ie}) { ${c} }`,`@media (prefers-color-scheme: dark) { :where(${n}):where(${ae}) { ${c} } }`].join(`
|
|
2
|
+
`)}function nt(e,t){return`${e}-${me(t)}`}var rt=typeof window>"u"?u.useEffect:u.useLayoutEffect,le=new Map;function ot(e,t,n){let r=n&&e?.brand?nt(e.id,t):null;return rt(()=>{if(!r||!e?.brand||typeof document>"u")return;let o=le.get(r);if(o&&o.site===e&&o.style.isConnected)return;let i=`kanorio-brand-${r}`,s=tt(e.brand,t,`[${C}="${r}"]`),a=document.getElementById(i);a||(a=document.createElement("style"),a.id=i,document.head.appendChild(a)),a.textContent!==s&&(a.textContent=s);for(let l of e.brand.fonts){if(!l.stylesheetUrl)continue;let c=`link[data-kanorio-font="${CSS.escape(l.stylesheetUrl)}"]`;if(document.head.querySelector(c))continue;let d=document.createElement("link");d.rel="stylesheet",d.href=l.stylesheetUrl,d.dataset.kanorioFont=l.stylesheetUrl,document.head.appendChild(d)}le.set(r,{site:e,style:a})},[r,e,t]),r}var E=new Set;function T(){for(let e of[...E])e()}function st(e){return E.add(e),E.size===1&&(window.addEventListener("storage",T),window.addEventListener(A,T)),()=>{E.delete(e),E.size===0&&(window.removeEventListener("storage",T),window.removeEventListener(A,T))}}var he=null;function it(){try{return localStorage.getItem(k)}catch{return he}}var ce=()=>null;function ye(e){he=e;try{te(e)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent(A,{detail:{token:e}}))}function at(e){let[t,n]=(0,u.useState)({given:e,written:null}),r=t.written;t.given!==e&&(r=null,n({given:e,written:null}));let o=(0,u.useCallback)(i=>{n(s=>({given:s.given,written:{token:i}})),ye(i)},[]);return(0,u.useMemo)(()=>e===void 0?null:{token:r?r.token:e,setToken:o},[e,r,o])}function lt(e,t){let r=at(e)??t,o=(0,u.useSyncExternalStore)(r?de:st,r?ce:it,ce);return(0,u.useMemo)(()=>r??{token:o,setToken:ye},[r,o])}var L=(0,u.createContext)(null);function Bt(){return(0,u.useContext)(L)?.config??null}function zt(e){let t=(0,u.useContext)(L);return ue(e??t?.config.siteUrl)}function ct(e,t={}){let n=(0,u.useContext)(L),r={...n?.config,...ut(e)},o=ue(r.siteUrl),i=r.theme??"auto",s=r.timeZone??null,a=r.brand!==!1,{token:l,setToken:c}=lt(e.token,n?.token??null),d=Ze(Qe(r.locale)),p=d.locale,{site:g,error:f}=et(o,a||t.needsSite===!0),x=ot(g,p,a),h=(0,u.useMemo)(()=>ne({siteUrl:o,token:()=>l,locale:p}),[o,l,p]),y=d.messages,D=d.error;return(0,u.useMemo)(()=>({siteUrl:o,token:l,setToken:c,locale:p,theme:i,timeZone:s,messages:y,messagesError:D,client:h,brandScope:x,site:g,siteError:f}),[o,l,c,p,i,s,y,D,h,x,g,f])}function Wt(e={}){return ct(e)}function ut(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}export{m as a,Z as b,qe as c,te as d,ze as e,We as f,Ye as g,Ge as h,C as i,Dt as j,Ht as k,qt as l,Qe as m,Ze as n,jt as o,et as p,ot as q,Bt as r,zt as s,ct as t,Wt as u};
|
|
3
|
+
//# sourceMappingURL=chunk-XJPS3G7J.js.map
|