@citolab/qti-components 7.0.8 → 7.0.9-beta.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/cdn/chunks/chunk-3AHQU35T.js +1 -0
- package/cdn/chunks/chunk-4AGTWY6I.js +1 -0
- package/cdn/{chunk-A536ZOJJ.js → chunks/chunk-6EIGTAJQ.js} +2 -4
- package/cdn/chunks/chunk-6UEXCXHG.js +17 -0
- package/cdn/chunks/chunk-BJL2ZC5L.js +1 -0
- package/cdn/chunks/chunk-FB3WTNRH.js +8 -0
- package/cdn/chunks/chunk-GCKESRQG.js +1 -0
- package/{dist/chunks/chunk-NZQKGIJP.js → cdn/chunks/chunk-GVU44M3E.js} +6 -8
- package/cdn/chunks/{chunk-SATSEEWJ.js → chunk-I3HQJPKA.js} +84 -84
- package/cdn/chunks/chunk-IKDNYCM7.js +1 -0
- package/cdn/chunks/chunk-KDO3T66B.js +1 -0
- package/cdn/chunks/{chunk-T2KKTMAT.js → chunk-KGVJXME7.js} +84 -84
- package/cdn/chunks/chunk-KQPTKMFJ.js +1 -0
- package/cdn/chunks/{chunk-4ILXLVT5.js → chunk-LCKLXCUP.js} +6 -18
- package/cdn/chunks/chunk-M5PPZ5M3.js +59 -0
- package/cdn/chunks/chunk-O5MMIBRR.js +10 -0
- package/cdn/chunks/chunk-OEXGDZO2.js +8 -0
- package/cdn/chunks/{chunk-RXKI3AO4.js → chunk-R45JL2ZY.js} +1 -1
- package/cdn/chunks/chunk-W2VSEYLY.js +8 -0
- package/cdn/chunks/chunk-WYDU2FBY.js +8 -0
- package/cdn/chunks/chunk-X7T7HK65.js +8 -0
- package/cdn/chunks/{chunk-X2KBNXRO.js → chunk-YIYKK4RV.js} +1 -1
- package/cdn/exports/computed.context.js +1 -0
- package/cdn/exports/config.context.js +1 -0
- package/cdn/exports/qti-assessment-item.context.js +1 -1
- package/cdn/exports/qti-condition-expression.js +1 -1
- package/cdn/exports/qti-expression.js +1 -1
- package/cdn/exports/session.context.js +1 -0
- package/cdn/exports/test.context.js +1 -0
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-item/core/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/test-container.js +1 -3549
- package/cdn/qti-test/components/test-end-attempt.js +1 -1
- package/cdn/qti-test/components/test-item-link.js +1 -1
- package/cdn/qti-test/components/test-navigation.js +1 -0
- package/cdn/qti-test/components/test-next.js +1 -1
- package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -1
- package/cdn/qti-test/components/test-prev.js +1 -1
- package/cdn/qti-test/components/test-show-correct-response.js +1 -1
- package/cdn/qti-test/components/test-view.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/dist/chunks/chunk-3A4IOMBQ.js +8 -0
- package/dist/chunks/chunk-3A4IOMBQ.js.map +1 -0
- package/dist/{chunk-2CHF3TMY.js → chunks/chunk-6MW3J6OM.js} +112 -4
- package/dist/chunks/chunk-6MW3J6OM.js.map +1 -0
- package/dist/chunks/chunk-CBYNKDSF.js +1 -0
- package/dist/chunks/{chunk-WWN5AD6V.js → chunk-CHINL5UJ.js} +12 -7
- package/dist/chunks/chunk-CHINL5UJ.js.map +1 -0
- package/dist/chunks/{chunk-W4272Q5U.js → chunk-CWCYTL3F.js} +18 -8
- package/dist/chunks/chunk-CWCYTL3F.js.map +1 -0
- package/dist/chunks/{chunk-GQ5P3NWC.js → chunk-FZVLLSCM.js} +18 -8
- package/dist/chunks/chunk-FZVLLSCM.js.map +1 -0
- package/dist/chunks/chunk-GNCPECOC.js +45 -0
- package/dist/chunks/chunk-GNCPECOC.js.map +1 -0
- package/dist/chunks/{chunk-YOXF6JPS.js → chunk-GRYVMG5Q.js} +135 -193
- package/dist/chunks/chunk-GRYVMG5Q.js.map +1 -0
- package/dist/chunks/{chunk-BPHQLJWE.js → chunk-I7HVKMDI.js} +2 -2
- package/dist/chunks/chunk-I7HVKMDI.js.map +1 -0
- package/dist/chunks/chunk-J4MM4JXS.js +8 -0
- package/dist/chunks/chunk-J4MM4JXS.js.map +1 -0
- package/dist/chunks/{chunk-FV7HWK54.js → chunk-JUAS2TVR.js} +1 -1
- package/dist/chunks/chunk-JUAS2TVR.js.map +1 -0
- package/dist/chunks/chunk-K6EUKFNW.js +43 -0
- package/dist/chunks/chunk-K6EUKFNW.js.map +1 -0
- package/dist/chunks/chunk-LZ7UIV5O.js +91 -0
- package/dist/chunks/chunk-LZ7UIV5O.js.map +1 -0
- package/dist/chunks/{chunk-J2SHENRN.js → chunk-MDWBTFKL.js} +100 -5
- package/dist/chunks/chunk-MDWBTFKL.js.map +1 -0
- package/dist/chunks/{chunk-KOEILLVS.js → chunk-NJNQOQUU.js} +1 -1
- package/dist/chunks/chunk-NJNQOQUU.js.map +1 -0
- package/dist/chunks/{chunk-E4TWZ2DL.js → chunk-NPHDN2TQ.js} +139 -113
- package/dist/chunks/chunk-NPHDN2TQ.js.map +1 -0
- package/dist/chunks/chunk-ODLYMQOS.js +8 -0
- package/dist/chunks/chunk-ODLYMQOS.js.map +1 -0
- package/dist/chunks/{chunk-XSI6FXGD.js → chunk-OOQLWOYU.js} +2 -2
- package/dist/chunks/{chunk-NHA53UTY.js → chunk-PR6AZWRP.js} +3 -6
- package/dist/chunks/chunk-PR6AZWRP.js.map +1 -0
- package/dist/chunks/chunk-QAA6MWGE.js +170 -0
- package/dist/chunks/chunk-QAA6MWGE.js.map +1 -0
- package/dist/chunks/chunk-QTH3WLGY.js +8 -0
- package/dist/chunks/chunk-QTH3WLGY.js.map +1 -0
- package/dist/chunks/{chunk-DLUJN2FW.js → chunk-W7ZXKJ5O.js} +1 -1
- package/dist/chunks/chunk-W7ZXKJ5O.js.map +1 -0
- package/dist/chunks/{chunk-OIRWOI3E.js → chunk-WRHEO7NG.js} +1 -1
- package/dist/chunks/chunk-WRHEO7NG.js.map +1 -0
- package/dist/chunks/chunk-WXART76T.js +95 -0
- package/dist/chunks/chunk-WXART76T.js.map +1 -0
- package/dist/exports/computed.context.d.ts +30 -0
- package/dist/exports/computed.context.js +8 -0
- package/dist/exports/config.context.d.ts +8 -0
- package/dist/exports/config.context.js +8 -0
- package/dist/exports/interaction.js +1 -1
- package/dist/exports/item.context.d.ts +2 -2
- package/dist/exports/item.context.js +1 -1
- package/dist/exports/qti-assessment-item.context.js +1 -1
- package/dist/exports/qti-condition-expression.js +3 -3
- package/dist/exports/qti-expression.js +2 -2
- package/dist/exports/session.context.d.ts +12 -0
- package/dist/exports/session.context.js +8 -0
- package/dist/exports/test.context.d.ts +16 -0
- package/dist/exports/test.context.js +8 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +58 -55
- package/dist/qti-components/index.d.ts +2 -2
- package/dist/qti-components/index.js +7 -7
- package/dist/qti-components-jsx.d.ts +112 -86
- package/dist/qti-item/core/index.js +2 -3
- package/dist/qti-loader/index.d.ts +1 -1
- package/dist/qti-loader/index.js +1 -1
- package/dist/{qti-response-declaration-Di9CsqiJ.d.ts → qti-response-declaration-CyOeVboh.d.ts} +2 -2
- package/dist/qti-test/components/index.d.ts +10 -4
- package/dist/qti-test/components/index.js +28 -19
- package/dist/qti-test/components/test-container.d.ts +3 -1
- package/dist/qti-test/components/test-container.js +6 -3778
- package/dist/qti-test/components/test-container.js.map +1 -1
- package/dist/qti-test/components/test-end-attempt.d.ts +4 -11
- package/dist/qti-test/components/test-end-attempt.js +3 -5
- package/dist/qti-test/components/test-item-link.d.ts +2 -11
- package/dist/qti-test/components/test-item-link.js +1 -5
- package/dist/qti-test/components/test-navigation.d.ts +35 -0
- package/dist/qti-test/components/test-navigation.js +12 -0
- package/dist/qti-test/components/test-navigation.js.map +1 -0
- package/dist/qti-test/components/test-next.d.ts +12 -12
- package/dist/qti-test/components/test-next.js +4 -4
- package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +8 -15
- package/dist/qti-test/components/test-paging-buttons-stamp.js +2 -5
- package/dist/qti-test/components/test-prev.d.ts +11 -12
- package/dist/qti-test/components/test-prev.js +4 -4
- package/dist/qti-test/components/test-show-correct-response.d.ts +4 -11
- package/dist/qti-test/components/test-show-correct-response.js +3 -5
- package/dist/qti-test/components/test-view.d.ts +3 -12
- package/dist/qti-test/components/test-view.js +2 -4
- package/dist/qti-test/core/index.d.ts +18 -48
- package/dist/qti-test/core/index.js +7 -12
- package/dist/{test.context-C2LBA3w4.d.ts → qti-test-part-zX9tOUbA.d.ts} +17 -33
- package/dist/vscode.html-custom-data.json +33 -30
- package/package.json +20 -19
- package/cdn/chunk-4DFVJE2A.js +0 -48
- package/cdn/chunk-4I75QSIL.js +0 -8
- package/cdn/chunk-5WCOPF7O.js +0 -73
- package/cdn/chunk-66PERJA3.js +0 -939
- package/cdn/chunk-6WNSQ7U6.js +0 -939
- package/cdn/chunk-AT2C24P4.js +0 -8
- package/cdn/chunk-BLKKKK6C.js +0 -11
- package/cdn/chunk-DC2R556M.js +0 -5
- package/cdn/chunk-GALSGMIP.js +0 -5
- package/cdn/chunk-IXSX4SJX.js +0 -1
- package/cdn/chunk-KYOTSBCX.js +0 -1
- package/cdn/chunk-L4TDHAKL.js +0 -24
- package/cdn/chunk-LVW3MHTI.js +0 -23
- package/cdn/chunk-M6AATWPS.js +0 -59
- package/cdn/chunk-MFWSHIPH.js +0 -17
- package/cdn/chunk-QGKK4T2J.js +0 -8
- package/cdn/chunk-ROXN2HIJ.js +0 -8
- package/cdn/chunk-SQDSHH6N.js +0 -3539
- package/cdn/chunk-TJMODUN5.js +0 -8
- package/cdn/chunk-VI2WKTN4.js +0 -1
- package/cdn/chunk-Z6SKK5ZX.js +0 -8
- package/cdn/chunks/chunk-3GO57DNP.js +0 -0
- package/cdn/chunks/chunk-3V6LA7B3.js +0 -8
- package/cdn/chunks/chunk-4PEUIMDK.js +0 -8
- package/cdn/chunks/chunk-4WXQYE2P.js +0 -8
- package/cdn/chunks/chunk-5P7CTN7Q.js +0 -11
- package/cdn/chunks/chunk-5X76K77R.js +0 -8
- package/cdn/chunks/chunk-6MCYE7P5.js +0 -1
- package/cdn/chunks/chunk-6PW2L463.js +0 -0
- package/cdn/chunks/chunk-6S4CDN3T.js +0 -43
- package/cdn/chunks/chunk-76VGZJCP.js +0 -934
- package/cdn/chunks/chunk-7RBGYKOX.js +0 -5
- package/cdn/chunks/chunk-7XYBFL7U.js +0 -934
- package/cdn/chunks/chunk-AJJJAZWM.js +0 -1
- package/cdn/chunks/chunk-ANDPD7F2.js +0 -5
- package/cdn/chunks/chunk-ARHBUT6F.js +0 -5
- package/cdn/chunks/chunk-AUHO2E7V.js +0 -934
- package/cdn/chunks/chunk-CZ3CSGCE.js +0 -934
- package/cdn/chunks/chunk-D3GR6AUG.js +0 -43
- package/cdn/chunks/chunk-DZCKF45D.js +0 -5
- package/cdn/chunks/chunk-EFU4L43Q.js +0 -8
- package/cdn/chunks/chunk-FM5C34DM.js +0 -934
- package/cdn/chunks/chunk-FRS2J3OS.js +0 -59
- package/cdn/chunks/chunk-GMK2YRB2.js +0 -934
- package/cdn/chunks/chunk-H2V2RXUW.js +0 -11
- package/cdn/chunks/chunk-HUMOYGEM.js +0 -43
- package/cdn/chunks/chunk-IMJOPCFR.js +0 -1
- package/cdn/chunks/chunk-IQZ7AOCQ.js +0 -8
- package/cdn/chunks/chunk-J3JSSCM6.js +0 -5
- package/cdn/chunks/chunk-KHLUVO6Y.js +0 -8
- package/cdn/chunks/chunk-LARBLB7K.js +0 -8
- package/cdn/chunks/chunk-LNFCEHB3.js +0 -934
- package/cdn/chunks/chunk-MJMONWKB.js +0 -3539
- package/cdn/chunks/chunk-N5OHGRGG.js +0 -8
- package/cdn/chunks/chunk-NDHSIO2G.js +0 -8
- package/cdn/chunks/chunk-NRY3WHJD.js +0 -5
- package/cdn/chunks/chunk-PKT2SJQD.js +0 -8
- package/cdn/chunks/chunk-PPWEIKLT.js +0 -1
- package/cdn/chunks/chunk-PT523RSK.js +0 -8
- package/cdn/chunks/chunk-QD3NT5PG.js +0 -934
- package/cdn/chunks/chunk-QTK4CPHP.js +0 -8
- package/cdn/chunks/chunk-QV6I5NVQ.js +0 -8
- package/cdn/chunks/chunk-R33OODNX.js +0 -1
- package/cdn/chunks/chunk-RIXTWE2H.js +0 -8
- package/cdn/chunks/chunk-ROZIP5LG.js +0 -8
- package/cdn/chunks/chunk-RPZVSBLM.js +0 -8
- package/cdn/chunks/chunk-SXM25YH3.js +0 -934
- package/cdn/chunks/chunk-TEYXRLTI.js +0 -8
- package/cdn/chunks/chunk-TQBDBMWL.js +0 -5
- package/cdn/chunks/chunk-TV3SPOLH.js +0 -8
- package/cdn/chunks/chunk-TVDTF6P6.js +0 -934
- package/cdn/chunks/chunk-U2TE6TOV.js +0 -934
- package/cdn/chunks/chunk-W5Y3ZU2W.js +0 -5
- package/cdn/chunks/chunk-WPGJ54IP.js +0 -1
- package/cdn/chunks/chunk-YHWMZAZD.js +0 -43
- package/cdn/chunks/chunk-YVZ742ID.js +0 -934
- package/cdn/chunks/chunk-YWH4TGMA.js +0 -5
- package/cdn/chunks/chunk-YXR6KSZI.js +0 -11
- package/cdn/qti-components/index.global.js +0 -226
- package/cdn/qti-item/components/index.global.js +0 -149
- package/cdn/qti-item/components/index.js +0 -3549
- package/cdn/qti-item/components/item-container.global.js +0 -149
- package/cdn/qti-item/components/item-container.js +0 -3549
- package/cdn/qti-item/core/index.global.js +0 -149
- package/cdn/qti-item/index.global.js +0 -149
- package/cdn/qti-item/index.js +0 -3549
- package/cdn/qti-item/qti-item.global.js +0 -114
- package/cdn/qti-item/qti-item.js +0 -1
- package/cdn/qti-loader/index.global.js +0 -1
- package/cdn/qti-test/components/index.global.js +0 -207
- package/cdn/qti-test/components/styles.global.js +0 -44
- package/cdn/qti-test/components/test-component.abstract.global.js +0 -170
- package/cdn/qti-test/components/test-component.abstract.js +0 -1
- package/cdn/qti-test/components/test-container.global.js +0 -149
- package/cdn/qti-test/components/test-item-link.global.js +0 -170
- package/cdn/qti-test/components/test-next.global.js +0 -170
- package/cdn/qti-test/components/test-next.spec.css +0 -1
- package/cdn/qti-test/components/test-next.spec.global.js +0 -64
- package/cdn/qti-test/components/test-next.spec.js +0 -713
- package/cdn/qti-test/components/test-paging-buttons-stamp.global.js +0 -207
- package/cdn/qti-test/components/test-prev.global.js +0 -170
- package/cdn/qti-test/components/test-view.global.js +0 -170
- package/cdn/qti-test/context/index.global.js +0 -58
- package/cdn/qti-test/context/index.js +0 -1
- package/cdn/qti-test/context/test.context.global.js +0 -58
- package/cdn/qti-test/context/test.context.js +0 -1
- package/cdn/qti-test/core/index.global.js +0 -205
- package/cdn/qti-test/index.global.js +0 -242
- package/cdn/qti-test/index.js +0 -3598
- package/cdn/qti-test/mixins/index.global.js +0 -1
- package/cdn/qti-test/mixins/index.js +0 -23
- package/cdn/qti-test/mixins/test-loader.mixin.global.js +0 -1
- package/cdn/qti-test/mixins/test-loader.mixin.js +0 -23
- package/cdn/qti-test/mixins/test-navigation.mixin.global.js +0 -1
- package/cdn/qti-test/mixins/test-navigation.mixin.js +0 -1
- package/cdn/qti-test/mixins/test-view.mixin.global.js +0 -1
- package/cdn/qti-test/mixins/test-view.mixin.js +0 -1
- package/cdn/qti-test/qti-assessment-test/index.global.js +0 -170
- package/cdn/qti-test/qti-assessment-test/index.js +0 -1
- package/cdn/qti-test/qti-assessment-test/qti-assessment-item-ref.global.js +0 -170
- package/cdn/qti-test/qti-assessment-test/qti-assessment-item-ref.js +0 -1
- package/cdn/qti-test/qti-assessment-test/qti-assessment-section.global.js +0 -170
- package/cdn/qti-test/qti-assessment-test/qti-assessment-section.js +0 -1
- package/cdn/qti-test/qti-assessment-test/qti-assessment-test.global.js +0 -170
- package/cdn/qti-test/qti-assessment-test/qti-assessment-test.js +0 -1
- package/cdn/qti-test/qti-assessment-test/qti-test-part.global.js +0 -114
- package/cdn/qti-test/qti-assessment-test/qti-test-part.js +0 -1
- package/cdn/qti-test/qti-test.global.js +0 -170
- package/cdn/qti-test/qti-test.js +0 -23
- package/cdn/qti-test/test-base.global.js +0 -170
- package/cdn/qti-test/test-base.js +0 -1
- package/cdn/qti-transformers/index.global.js +0 -1
- package/dist/chunk-2CHF3TMY.js.map +0 -1
- package/dist/chunk-2LWLX7WV.js +0 -6307
- package/dist/chunk-2LWLX7WV.js.map +0 -1
- package/dist/chunk-2OA7E3E7.js +0 -294
- package/dist/chunk-2OA7E3E7.js.map +0 -1
- package/dist/chunk-3G364JZC.js +0 -72
- package/dist/chunk-3G364JZC.js.map +0 -1
- package/dist/chunk-44VE5POH.js +0 -55
- package/dist/chunk-4YG2FPKK.js +0 -31
- package/dist/chunk-4YG2FPKK.js.map +0 -1
- package/dist/chunk-6TUE644E.js +0 -569
- package/dist/chunk-6TUE644E.js.map +0 -1
- package/dist/chunk-6ZMD232X.js +0 -78
- package/dist/chunk-6ZMD232X.js.map +0 -1
- package/dist/chunk-AYRSHIHA.js +0 -50
- package/dist/chunk-AYRSHIHA.js.map +0 -1
- package/dist/chunk-BN32D5J2.js +0 -43
- package/dist/chunk-BN32D5J2.js.map +0 -1
- package/dist/chunk-CJRXRBRQ.js +0 -50
- package/dist/chunk-CJRXRBRQ.js.map +0 -1
- package/dist/chunk-GPJ6WTE5.js +0 -118
- package/dist/chunk-GPJ6WTE5.js.map +0 -1
- package/dist/chunk-KAUHKHPH.js +0 -50
- package/dist/chunk-KAUHKHPH.js.map +0 -1
- package/dist/chunk-MAC76UNI.js +0 -1
- package/dist/chunk-QYN5S4EM.js +0 -107
- package/dist/chunk-QYN5S4EM.js.map +0 -1
- package/dist/chunk-UB5K44DB.js +0 -30
- package/dist/chunk-UB5K44DB.js.map +0 -1
- package/dist/chunk-UJTJIU3C.js +0 -43
- package/dist/chunk-UJTJIU3C.js.map +0 -1
- package/dist/chunk-XVQZ5JI5.js +0 -50
- package/dist/chunk-XVQZ5JI5.js.map +0 -1
- package/dist/chunk-XW3PQRKW.js +0 -6306
- package/dist/chunk-XW3PQRKW.js.map +0 -1
- package/dist/chunk-YQ7EXOAK.js +0 -10
- package/dist/chunk-YQ7EXOAK.js.map +0 -1
- package/dist/chunks/chunk-2V6LQV2K.js +0 -50
- package/dist/chunks/chunk-2V6LQV2K.js.map +0 -1
- package/dist/chunks/chunk-3EU75IUF.js +0 -118
- package/dist/chunks/chunk-3EU75IUF.js.map +0 -1
- package/dist/chunks/chunk-3QQFMVDS.js +0 -118
- package/dist/chunks/chunk-3QQFMVDS.js.map +0 -1
- package/dist/chunks/chunk-4GNVYCBN.js +0 -627
- package/dist/chunks/chunk-4GNVYCBN.js.map +0 -1
- package/dist/chunks/chunk-4MQV5IRV.js +0 -59
- package/dist/chunks/chunk-4MQV5IRV.js.map +0 -1
- package/dist/chunks/chunk-4WVLWWYJ.js +0 -50
- package/dist/chunks/chunk-4WVLWWYJ.js.map +0 -1
- package/dist/chunks/chunk-5KVGRLYT.js +0 -10
- package/dist/chunks/chunk-5KVGRLYT.js.map +0 -1
- package/dist/chunks/chunk-5PCD2B62.js +0 -6091
- package/dist/chunks/chunk-5PCD2B62.js.map +0 -1
- package/dist/chunks/chunk-5RTLOB3Q.js +0 -59
- package/dist/chunks/chunk-5RTLOB3Q.js.map +0 -1
- package/dist/chunks/chunk-6JXR63MH.js +0 -50
- package/dist/chunks/chunk-6JXR63MH.js.map +0 -1
- package/dist/chunks/chunk-6PAEJQSQ.js +0 -6058
- package/dist/chunks/chunk-6PAEJQSQ.js.map +0 -1
- package/dist/chunks/chunk-6QT4LIPL.js +0 -623
- package/dist/chunks/chunk-6QT4LIPL.js.map +0 -1
- package/dist/chunks/chunk-7QMCKYDR.js +0 -43
- package/dist/chunks/chunk-7QMCKYDR.js.map +0 -1
- package/dist/chunks/chunk-A24F75DB.js +0 -72
- package/dist/chunks/chunk-A24F75DB.js.map +0 -1
- package/dist/chunks/chunk-AUWATZ65.js +0 -10
- package/dist/chunks/chunk-AUWATZ65.js.map +0 -1
- package/dist/chunks/chunk-AXTEKPP5.js +0 -6084
- package/dist/chunks/chunk-AXTEKPP5.js.map +0 -1
- package/dist/chunks/chunk-B6MJCAOF.js +0 -6063
- package/dist/chunks/chunk-B6MJCAOF.js.map +0 -1
- package/dist/chunks/chunk-BJ2JLJIJ.js +0 -623
- package/dist/chunks/chunk-BJ2JLJIJ.js.map +0 -1
- package/dist/chunks/chunk-BPHQLJWE.js.map +0 -1
- package/dist/chunks/chunk-CD3E4M5Y.js +0 -107
- package/dist/chunks/chunk-CD3E4M5Y.js.map +0 -1
- package/dist/chunks/chunk-CEXAR7BF.js +0 -52
- package/dist/chunks/chunk-CEXAR7BF.js.map +0 -1
- package/dist/chunks/chunk-CWYAQA25.js +0 -6067
- package/dist/chunks/chunk-CWYAQA25.js.map +0 -1
- package/dist/chunks/chunk-D3QX5N57.js +0 -6117
- package/dist/chunks/chunk-D3QX5N57.js.map +0 -1
- package/dist/chunks/chunk-DLUJN2FW.js.map +0 -1
- package/dist/chunks/chunk-DNHDFXTV.js +0 -59
- package/dist/chunks/chunk-DNHDFXTV.js.map +0 -1
- package/dist/chunks/chunk-E4TWZ2DL.js.map +0 -1
- package/dist/chunks/chunk-FV7HWK54.js.map +0 -1
- package/dist/chunks/chunk-GQ5P3NWC.js.map +0 -1
- package/dist/chunks/chunk-GSWZT6N2.js +0 -50
- package/dist/chunks/chunk-GSWZT6N2.js.map +0 -1
- package/dist/chunks/chunk-HHVRU3AJ.js +0 -107
- package/dist/chunks/chunk-HHVRU3AJ.js.map +0 -1
- package/dist/chunks/chunk-HOTNM5DT.js +0 -1
- package/dist/chunks/chunk-IWG66KQQ.js +0 -107
- package/dist/chunks/chunk-IWG66KQQ.js.map +0 -1
- package/dist/chunks/chunk-J2SHENRN.js.map +0 -1
- package/dist/chunks/chunk-K6ATVWMP.js +0 -6091
- package/dist/chunks/chunk-K6ATVWMP.js.map +0 -1
- package/dist/chunks/chunk-KOEILLVS.js.map +0 -1
- package/dist/chunks/chunk-KYAIMBP5.js +0 -78
- package/dist/chunks/chunk-KYAIMBP5.js.map +0 -1
- package/dist/chunks/chunk-LNISKMIL.js +0 -6063
- package/dist/chunks/chunk-LNISKMIL.js.map +0 -1
- package/dist/chunks/chunk-LNKJEW5E.js +0 -627
- package/dist/chunks/chunk-LNKJEW5E.js.map +0 -1
- package/dist/chunks/chunk-LXJA3VP2.js +0 -72
- package/dist/chunks/chunk-LXJA3VP2.js.map +0 -1
- package/dist/chunks/chunk-MLT7V47R.js +0 -100
- package/dist/chunks/chunk-MLT7V47R.js.map +0 -1
- package/dist/chunks/chunk-N5FPZNMX.js +0 -43
- package/dist/chunks/chunk-N5FPZNMX.js.map +0 -1
- package/dist/chunks/chunk-NHA53UTY.js.map +0 -1
- package/dist/chunks/chunk-NZQKGIJP.js.map +0 -1
- package/dist/chunks/chunk-O6WEZVEM.js +0 -43
- package/dist/chunks/chunk-O6WEZVEM.js.map +0 -1
- package/dist/chunks/chunk-OIRWOI3E.js.map +0 -1
- package/dist/chunks/chunk-PWOY6REC.js +0 -6064
- package/dist/chunks/chunk-PWOY6REC.js.map +0 -1
- package/dist/chunks/chunk-QJELKGWM.js +0 -6061
- package/dist/chunks/chunk-QJELKGWM.js.map +0 -1
- package/dist/chunks/chunk-QUB54PXZ.js +0 -50
- package/dist/chunks/chunk-QUB54PXZ.js.map +0 -1
- package/dist/chunks/chunk-RX3BRYYI.js +0 -59
- package/dist/chunks/chunk-RX3BRYYI.js.map +0 -1
- package/dist/chunks/chunk-UEEMM6H2.js +0 -6090
- package/dist/chunks/chunk-UEEMM6H2.js.map +0 -1
- package/dist/chunks/chunk-UFYWCLXF.js +0 -10
- package/dist/chunks/chunk-UFYWCLXF.js.map +0 -1
- package/dist/chunks/chunk-UN2IFSGC.js +0 -1
- package/dist/chunks/chunk-VAPB5TN4.js +0 -46
- package/dist/chunks/chunk-VAPB5TN4.js.map +0 -1
- package/dist/chunks/chunk-VBF3GCZK.js +0 -50
- package/dist/chunks/chunk-VBF3GCZK.js.map +0 -1
- package/dist/chunks/chunk-W4272Q5U.js.map +0 -1
- package/dist/chunks/chunk-WWN5AD6V.js.map +0 -1
- package/dist/chunks/chunk-X226BX2U.js +0 -78
- package/dist/chunks/chunk-X226BX2U.js.map +0 -1
- package/dist/chunks/chunk-XCHS3RTZ.js +0 -107
- package/dist/chunks/chunk-XCHS3RTZ.js.map +0 -1
- package/dist/chunks/chunk-YFC3BVN2.js +0 -78
- package/dist/chunks/chunk-YFC3BVN2.js.map +0 -1
- package/dist/chunks/chunk-YOXF6JPS.js.map +0 -1
- package/dist/chunks/chunk-YQB6YLNW.js +0 -78
- package/dist/chunks/chunk-YQB6YLNW.js.map +0 -1
- package/dist/chunks/chunk-Z5THRO6Z.js +0 -46
- package/dist/chunks/chunk-Z5THRO6Z.js.map +0 -1
- package/dist/chunks/chunk-ZHAJ3CMP.js +0 -6091
- package/dist/chunks/chunk-ZHAJ3CMP.js.map +0 -1
- package/dist/chunks/chunk-ZPNJ2HP5.js +0 -71
- package/dist/chunks/chunk-ZPNJ2HP5.js.map +0 -1
- package/dist/chunks/chunk-ZQXZ6PK7.js +0 -649
- package/dist/chunks/chunk-ZQXZ6PK7.js.map +0 -1
- package/dist/custom-element-eslint-rules.js +0 -337
- package/dist/custom-elements.json +0 -27158
- package/dist/loader/index.d.ts +0 -20
- package/dist/loader/index.js +0 -310
- package/dist/loader/index.js.map +0 -1
- package/dist/qti-components/index.cjs +0 -6773
- package/dist/qti-components/index.cjs.map +0 -1
- package/dist/qti-components/index.d.cts +0 -150
- package/dist/qti-item/components/index.d.ts +0 -3
- package/dist/qti-item/components/index.js +0 -3856
- package/dist/qti-item/components/index.js.map +0 -1
- package/dist/qti-item/components/item-container.d.ts +0 -40
- package/dist/qti-item/components/item-container.js +0 -3856
- package/dist/qti-item/components/item-container.js.map +0 -1
- package/dist/qti-item/index.cjs +0 -89
- package/dist/qti-item/index.cjs.map +0 -1
- package/dist/qti-item/index.d.cts +0 -24
- package/dist/qti-item/index.d.ts +0 -4
- package/dist/qti-item/index.js +0 -3869
- package/dist/qti-item/index.js.map +0 -1
- package/dist/qti-item/qti-item.d.ts +0 -25
- package/dist/qti-item/qti-item.js +0 -26
- package/dist/qti-item/qti-item.js.map +0 -1
- package/dist/qti-loader/index.cjs +0 -332
- package/dist/qti-loader/index.cjs.map +0 -1
- package/dist/qti-loader/index.d.cts +0 -20
- package/dist/qti-response-declaration-DAeBp8HH.d.ts +0 -1008
- package/dist/qti-response-declaration-ucAqd0qK.d.ts +0 -1034
- package/dist/qti-simple-choice-3M44uWiN.d.ts +0 -1153
- package/dist/qti-simple-choice-B5GnzbqW.d.ts +0 -1080
- package/dist/qti-simple-choice-BOLF9wXz.d.ts +0 -1170
- package/dist/qti-simple-choice-BeixIkA0.d.ts +0 -1088
- package/dist/qti-simple-choice-BiEjEO6s.d.ts +0 -1152
- package/dist/qti-simple-choice-Bo_ikO6H.d.ts +0 -1198
- package/dist/qti-simple-choice-C0CcrtK5.d.ts +0 -1169
- package/dist/qti-simple-choice-Cgh1-Jbr.d.cts +0 -1185
- package/dist/qti-simple-choice-Cgh1-Jbr.d.ts +0 -1185
- package/dist/qti-simple-choice-Cn5y-Ta8.d.ts +0 -1158
- package/dist/qti-simple-choice-D0GiMrqD.d.ts +0 -1168
- package/dist/qti-simple-choice-DxWcdKHi.d.ts +0 -1158
- package/dist/qti-simple-choice-R_LxBTp8.d.ts +0 -1158
- package/dist/qti-simple-choice-hAIyfF0z.d.ts +0 -1114
- package/dist/qti-simple-choice-o4rje1RA.d.ts +0 -1176
- package/dist/qti-simple-choice-v2GxpPNh.d.ts +0 -1181
- package/dist/qti-test/components/test-component.abstract.d.ts +0 -26
- package/dist/qti-test/components/test-component.abstract.js +0 -11
- package/dist/qti-test/components/test-next.spec.css +0 -2481
- package/dist/qti-test/components/test-next.spec.css.map +0 -1
- package/dist/qti-test/components/test-next.spec.d.ts +0 -13
- package/dist/qti-test/components/test-next.spec.js +0 -45904
- package/dist/qti-test/components/test-next.spec.js.map +0 -1
- package/dist/qti-test/context/index.d.ts +0 -6
- package/dist/qti-test/context/index.js +0 -9
- package/dist/qti-test/context/index.js.map +0 -1
- package/dist/qti-test/context/test.context.d.ts +0 -6
- package/dist/qti-test/context/test.context.js +0 -9
- package/dist/qti-test/context/test.context.js.map +0 -1
- package/dist/qti-test/index.cjs +0 -4823
- package/dist/qti-test/index.cjs.map +0 -1
- package/dist/qti-test/index.d.cts +0 -304
- package/dist/qti-test/index.d.ts +0 -14
- package/dist/qti-test/index.js +0 -4746
- package/dist/qti-test/index.js.map +0 -1
- package/dist/qti-test/mixins/index.d.ts +0 -8
- package/dist/qti-test/mixins/index.js +0 -350
- package/dist/qti-test/mixins/index.js.map +0 -1
- package/dist/qti-test/mixins/test-loader.mixin.d.ts +0 -8
- package/dist/qti-test/mixins/test-loader.mixin.js +0 -240
- package/dist/qti-test/mixins/test-loader.mixin.js.map +0 -1
- package/dist/qti-test/mixins/test-navigation.mixin.d.ts +0 -22
- package/dist/qti-test/mixins/test-navigation.mixin.js +0 -64
- package/dist/qti-test/mixins/test-navigation.mixin.js.map +0 -1
- package/dist/qti-test/mixins/test-view.mixin.d.ts +0 -6
- package/dist/qti-test/mixins/test-view.mixin.js +0 -50
- package/dist/qti-test/mixins/test-view.mixin.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/index.d.ts +0 -6
- package/dist/qti-test/qti-assessment-test/index.js +0 -221
- package/dist/qti-test/qti-assessment-test/index.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.d.ts +0 -6
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.js +0 -85
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.d.ts +0 -6
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.js +0 -73
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.d.ts +0 -6
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.js +0 -54
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/qti-test-part.d.ts +0 -19
- package/dist/qti-test/qti-assessment-test/qti-test-part.js +0 -62
- package/dist/qti-test/qti-assessment-test/qti-test-part.js.map +0 -1
- package/dist/qti-test/qti-test.d.ts +0 -68
- package/dist/qti-test/qti-test.js +0 -500
- package/dist/qti-test/qti-test.js.map +0 -1
- package/dist/qti-test/test-base.d.ts +0 -6
- package/dist/qti-test/test-base.js +0 -137
- package/dist/qti-test/test-base.js.map +0 -1
- package/dist/qti-transformers/index.cjs +0 -316
- package/dist/qti-transformers/index.cjs.map +0 -1
- package/dist/qti-transformers/index.d.cts +0 -75
- package/dist/test-base-BJwG9Ie8.d.ts +0 -109
- package/dist/test.context-Bx-606B3.d.ts +0 -99
- package/dist/test.context-CB5V4xJz.d.ts +0 -99
- package/dist/test.context-CaENAJNk.d.ts +0 -101
- package/dist/test.context-CmsDQ8k2.d.ts +0 -99
- package/dist/transformers/index.d.ts +0 -76
- package/dist/transformers/index.js +0 -293
- package/dist/transformers/index.js.map +0 -1
- /package/cdn/{chunk-22HAPLRD.js → chunks/chunk-MTNLMWSG.js} +0 -0
- /package/dist/{chunk-44VE5POH.js.map → chunks/chunk-CBYNKDSF.js.map} +0 -0
- /package/dist/chunks/{chunk-XSI6FXGD.js.map → chunk-OOQLWOYU.js.map} +0 -0
- /package/dist/{chunk-MAC76UNI.js.map → exports/computed.context.js.map} +0 -0
- /package/dist/{chunks/chunk-HOTNM5DT.js.map → exports/config.context.js.map} +0 -0
- /package/dist/{chunks/chunk-UN2IFSGC.js.map → exports/session.context.js.map} +0 -0
- /package/dist/{qti-test/components/test-component.abstract.js.map → exports/test.context.js.map} +0 -0
|
@@ -1,934 +0,0 @@
|
|
|
1
|
-
import{a as ae,b as j,c as le,e as ce,f as W,g as $t,h as Ot,i as Be,j as It}from"./chunk-5BR5CJFH.js";import{a as Nt}from"./chunk-5FCXUJAG.js";import{a as Ue}from"./chunk-EHK76KRT.js";import{a as M}from"./chunk-XUJ7TXHW.js";import{a as x}from"./chunk-UJP4TGD3.js";import{a as Ht}from"./chunk-KWPDTFYH.js";import{a as V}from"./chunk-RXKI3AO4.js";import{a as C}from"./chunk-X2KBNXRO.js";import{a as h,b as d,c as E,d as Ye,e as Vt}from"./chunk-5GCSZ3CH.js";import{a as f,d as u,e as at,f as ne,g as R,i as v}from"./chunk-LZZB4VGC.js";import{a as L}from"./chunk-QQCGUVEV.js";import{a as Dt,b as D}from"./chunk-FRS2J3OS.js";import{a as n}from"./chunk-IAP2CEE7.js";var S=class extends v{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(i=>i.readonly=t);this._context={identifier:this.getAttribute("identifier"),variables:Ht};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(r=>r.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.detail.interactionElement)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(r=>r.identifier===t.identifier);return i?{...t,...i}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=this._interactionElements.find(r=>r.responseIdentifier===t.identifier);i&&(i.value=t.value)}})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let r=this._interactionElements.find(a=>a.getAttribute("response-identifier")===t.responseIdentifier);r&&(r.value=t.response)}}render(){return u`<slot></slot>`}showCorrectResponse(e){let i=this._context.variables.filter(r=>"correctResponse"in r&&r.correctResponse).map(r=>({responseIdentifier:r.identifier,response:r.correctResponse}));for(let r of i){let a=this._interactionElements.find(s=>s.getAttribute("response-identifier")===r.responseIdentifier);a&&(a.correctResponse=e?r.response:"")}}processResponse(e=!0){this.validate();let t=this.querySelector("qti-response-processing");return!t||!t.process?!1:(t.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(i=>i.identifier==="numAttempts")?.value+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:t,response:i}=e.detail;this.updateResponseVariable(t,i)}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==e?r:{...r,value:i.cardinality==="single"?t:[...r.value,t]})},this._feedbackElements.forEach(r=>r.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(r=>r.identifier===e)?.value})}validate(){return this._interactionElements.every(e=>e.validate())?!0:this._interactionElements.some(e=>e.validate())?!1:null}_getCompletionStatus(){let e=this.validate();return e===!0?"completed":e===!1?"incomplete":"not_attempted"}_emit(e,t=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}};n([d({type:String})],S.prototype,"title",2),n([d({type:String})],S.prototype,"identifier",2),n([d({type:String})],S.prototype,"adaptive",2),n([d({type:String})],S.prototype,"timeDependent",2),n([d({type:Boolean})],S.prototype,"disabled",2),n([M("disabled",{waitUntilFirstUpdate:!0})],S.prototype,"_handleDisabledChange",2),n([d({type:Boolean})],S.prototype,"readonly",2),n([M("readonly",{waitUntilFirstUpdate:!0})],S.prototype,"_handleReadonlyChange",2),n([Dt({context:L})],S.prototype,"_context",2),S=n([h("qti-assessment-item")],S);var pe=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0,composed:!0});if(this.dispatchEvent(e)){let r=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);r?await this.updateStimulusRef(r):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let t=await Nt().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};n([d({type:String})],pe.prototype,"identifier",2),n([d({type:String})],pe.prototype,"href",2),pe=n([h("qti-assessment-stimulus-ref")],pe);var Xe=class extends v{};Xe=n([h("qti-companion-materials-info")],Xe);var xe=class extends v{render(){return u`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let o=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",o?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let o={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,o,e)}};n([D({context:L,subscribe:!0}),E()],xe.prototype,"_context",2),xe=n([h("qti-custom-operator")],xe);var di=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ee=c=>{if(typeof c=="string")return c;let o=di();return o==="."?c.toLocaleString():c.toString().replace(".","").replace(o,".")};function lt(c){return c==null}function Ce(c){return c.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var _=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(o){let e=this._context.variables.find(i=>i.identifier===o)||null;if(this.outcomeIdentifier!==o||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!lt(this.identifier)&&!lt(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(o){this.showStatus=o&&this.showHide==="show"||!o&&this.showHide==="hide"?"on":"off"}};n([d({type:String,attribute:"show-hide"})],_.prototype,"showHide",2),n([d({type:String,attribute:"outcome-identifier"})],_.prototype,"outcomeIdentifier",2),n([d({type:String})],_.prototype,"identifier",2),n([d({type:String,attribute:!1})],_.prototype,"showStatus",2),n([D({context:L,subscribe:!0}),E()],_.prototype,"_context",2);var qe=class extends _{render(){return u` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(o){this.checkShowFeedback(this.outcomeIdentifier)}};qe.styles=f`
|
|
2
|
-
:host {
|
|
3
|
-
display: block;
|
|
4
|
-
}
|
|
5
|
-
.on {
|
|
6
|
-
display: block;
|
|
7
|
-
}
|
|
8
|
-
.off {
|
|
9
|
-
display: none;
|
|
10
|
-
}
|
|
11
|
-
`,qe=n([h("qti-feedback-block")],qe);var we=class extends _{constructor(){super(...arguments);this.render=()=>u` <slot part="feedback" class="${this.showStatus}"></slot> `}};we.styles=f`
|
|
12
|
-
.on {
|
|
13
|
-
display: inline-block;
|
|
14
|
-
}
|
|
15
|
-
.off {
|
|
16
|
-
display: none;
|
|
17
|
-
}
|
|
18
|
-
`,we=n([h("qti-feedback-inline")],we);var Te=class extends _{render(){return u`
|
|
19
|
-
<dialog class="qti-dialog" part="feedback" ?open="${this.showStatus==="on"}">
|
|
20
|
-
<slot></slot>
|
|
21
|
-
<div style="margin-top: var(--qti-gap-size); text-align: center;">
|
|
22
|
-
<button class="button close-button" @click="${this.closeFeedback}"></button>
|
|
23
|
-
</div>
|
|
24
|
-
</dialog>
|
|
25
|
-
`}openFeedback(){let o=this.shadowRoot?.querySelector("dialog");o&&!o.open&&o.showModal()}closeFeedback(){let o=this.shadowRoot?.querySelector("dialog");o&&o.open&&(o.close(),this.showStatus="off")}firstUpdated(){this.showStatus==="on"&&this.openFeedback()}updated(o){o.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};Te.styles=f`
|
|
26
|
-
.qti-dialog {
|
|
27
|
-
background: var(--qti-bg);
|
|
28
|
-
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
29
|
-
border-radius: var(--qti-border-radius);
|
|
30
|
-
padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
|
|
31
|
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
32
|
-
position: fixed;
|
|
33
|
-
top: 50%;
|
|
34
|
-
left: 50%;
|
|
35
|
-
transform: translate(-50%, -50%);
|
|
36
|
-
z-index: 1000;
|
|
37
|
-
width: auto;
|
|
38
|
-
max-width: 90%;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.button {
|
|
42
|
-
border-radius: var(--qti-border-radius);
|
|
43
|
-
padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
|
|
44
|
-
background-color: var(--qti-bg-active);
|
|
45
|
-
border: var(--qti-border-active);
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
position: relative;
|
|
48
|
-
display: inline-block;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.button:hover {
|
|
52
|
-
background-color: var(--qti-hover-bg);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.button:disabled {
|
|
56
|
-
background-color: var(--qti-disabled-bg);
|
|
57
|
-
color: var(--qti-disabled-color);
|
|
58
|
-
cursor: not-allowed;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.button:focus {
|
|
62
|
-
outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/* Text content of the button */
|
|
66
|
-
.button::after {
|
|
67
|
-
content: var(--qti-close-text, 'Close');
|
|
68
|
-
color: inherit;
|
|
69
|
-
font-size: inherit;
|
|
70
|
-
text-align: center;
|
|
71
|
-
display: inline-block;
|
|
72
|
-
line-height: 1.5;
|
|
73
|
-
}
|
|
74
|
-
`,Te=n([h("qti-modal-feedback")],Te);var Me=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return u` <slot name="drags"></slot> `}};Me.styles=f`
|
|
75
|
-
:host {
|
|
76
|
-
display: flex;
|
|
77
|
-
user-select: none;
|
|
78
|
-
position: absolute;
|
|
79
|
-
}
|
|
80
|
-
`,Me=n([h("qti-associable-hotspot")],Me);var Pt=(c,o,e)=>{class t extends c{}return t};var H=(c,o,e,t)=>{class i extends Pt(c,e,o){constructor(){super(...arguments);this.observer=null;this.droppableObsever=null;this.resizeObserver=null;this.draggables=[];this.droppables=[];this.dragContainers=[];this.dragClone=null;this.dragSource=null;this.touchStartPoint=null;this.isDraggable=!1;this.cloneOffset={x:0,y:0};this.isDragging=!1;this.allDropzones=[];this.lastTarget=null;this.currentDropTarget=null;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;this.dataTransfer={data:{},setData(s,l){this.data[s]=l},getData(s){return this.data[s]},effectAllowed:"move"};this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=1;this.draggablesModified=(s,l)=>{for(let m of l)this.draggables.includes(m)&&(this.draggables=this.draggables.filter(g=>g!==m),m.removeAttribute("tabindex"),m.removeEventListener("touchstart",this.handleTouchStart.bind(this)),m.removeEventListener("mousedown",this.handleTouchStart.bind(this)));for(let m of s)this.draggables.includes(m)||(this.draggables.push(m),m.setAttribute("tabindex","0"),m.hasTouchStartListener||(m.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),m.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1}),m.hasTouchStartListener=!0));let p=0;this.draggables.forEach(m=>{m.style.viewTransitionName=`drag-${p}-${this.getAttribute("identifier")||crypto.randomUUID()}`,m.setAttribute("qti-draggable","true"),p++})};this.droppablesModified=(s,l)=>{for(let p of l)this.droppables.includes(p)&&(this.droppables=this.droppables.filter(m=>m!==p),this.allDropzones=this.allDropzones.filter(m=>m!==p));for(let p of s)this.droppables.includes(p)||(this.droppables.push(p),this.allDropzones.push(p));for(let p of this.droppables)this.dataset.choicesContainerWidth&&(p.style.width=`${this.dataset.choicesContainerWidth}px`,p.style.boxSizing="border-box")}}handleDraggableContainerChange(s,l){this.isMatchTabular()||(s.length>0||l.length>0)&&this.dragContainersModified(s||[],l||[])}dragContainersModified(s,l){for(let p of l)this.dragContainers.includes(p)&&(this.dragContainers=this.dragContainers.filter(m=>m!==p),this.allDropzones=this.allDropzones.filter(m=>m!==p));for(let p of s)this.dragContainers.includes(p)||(this.dragContainers.push(p),this.allDropzones.push(p))}handleDraggablesChange(s,l){this.isMatchTabular()||(s.length>0||l.length>0)&&this.draggablesModified(s||[],l||[])}handleDroppablesChange(s,l){this.isMatchTabular()||(s.length>0||l.length>0)&&this.droppablesModified(s||[],l||[])}firstUpdated(s){super.firstUpdated(s),this.hasAttribute("disabled")||(document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1}));let p=Array.from(this.querySelectorAll(o)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(o)||[])),m=Array.from(this.querySelectorAll(e)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(e)||[])),g=Array.from(this.querySelectorAll(t)||[]).concat(Array.from(this.shadowRoot?.querySelectorAll(t)||[]));this.dragContainersModified(g,[]),this.droppablesModified(m,[]),this.draggablesModified(p,[]),this.updateMinDimensionsForDropZones(),this.observer=new MutationObserver(()=>this.updateMinDimensionsForDropZones()),this.observer.observe(this,{childList:!0,subtree:!0}),this.resizeObserver=new ResizeObserver(()=>this.updateMinDimensionsForDropZones()),this.querySelectorAll("qti-gap-text").forEach(y=>this.resizeObserver?.observe(y))}async moveDraggableToDroppable(s,l){(()=>{s.style.transform="translate(0, 0)",l.tagName==="SLOT"?s.setAttribute("slot",l.getAttribute("name")):l.appendChild(s),this.checkAllMaxAssociations(),this.saveResponse()})()}activateDroppable(s){this.dragContainers.includes(s)?(this._internals.states.add("--dragzone-active"),s.setAttribute("active","")):(this._internals.states.delete("--dragzone-active"),s.setAttribute("active",""))}deactivateDroppable(s,l=!0){l&&this._internals.states.add("--dragzone-active"),s.removeAttribute("active")}connectedCallback(){super.connectedCallback()}isMatchTabular(){return this.classList.contains("qti-match-tabular")}updateMinDimensionsForDropZones(){let s=this.querySelectorAll(o),l=Array.from(this.querySelectorAll(e)).map(b=>b),p=0,m=0;s.forEach(b=>{let y=b.getBoundingClientRect();p=Math.max(p,y.height),m=Math.max(m,y.width)});let g=this.querySelector(t)||this.shadowRoot?.querySelector(t);g&&(g.style.minHeight=`${p}px`,g.style.minWidth=`${m}px`);for(let b of l)b.style.minHeight=`${p}px`,b.style.minWidth=`${m}px`}activateDroppables(s){this.dragContainers.forEach(p=>{p.setAttribute("enabled",""),p.hasAttribute("disabled")&&(p.contains(s)||p.shadowRoot&&p.shadowRoot.contains(s))&&p.removeAttribute("disabled")}),this.droppables.forEach(p=>{p.setAttribute("enabled",""),p.hasAttribute("disabled")&&(p.contains(s)||p.shadowRoot&&p.shadowRoot.contains(s))&&p.removeAttribute("disabled")})}activateDragLocation(){this._internals.states.add("--dragzone-enabled")}deactivateDragLocation(){this._internals.states.delete("--dragzone-enabled")}deactivateDroppables(){this.dragContainers.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active")}),this.droppables.forEach(l=>{l.removeAttribute("enabled"),l.removeAttribute("active")})}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.droppableObsever&&(this.droppableObsever.disconnect(),this.droppableObsever=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),document.removeEventListener("touchmove",this.handleTouchMove),document.removeEventListener("mousemove",this.handleTouchMove),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("mouseup",this.handleTouchEnd),document.removeEventListener("touchcancel",this.handleTouchCancel)}handleTouchMove(s){if(this.isDraggable&&this.dragClone){let{x:l,y:p}=this.getEventCoordinates(s),m={clientX:l,clientY:p};this.calculateDragDistance(m)>=this.MIN_DRAG_DISTANCE&&(this.isDragging=!0,this.updateDragClonePosition(m));let g=this.findClosestDropzone();this.currentDropTarget=g,g!==this.lastTarget&&(this.lastTarget&&(this.deactivateDroppable(this.lastTarget),this.dispatchCustomEvent(this.lastTarget,"dragleave")),g&&(this.activateDroppable(g),this.dispatchCustomEvent(g,"dragenter")),this.lastTarget=g),this.currentDropTarget&&this.dispatchCustomEvent(this.currentDropTarget,"dragover"),s.preventDefault()}}handleTouchEnd(s){if(this.isDragging){if(this.currentDropTarget){let l=this.dragClone;this.moveDraggableToDroppable(l,this.currentDropTarget)}this.resetDragState()}this._internals.states.delete("--dragzone-active"),this.checkAllMaxAssociations(),this._internals.states.delete("--dragzone-enabled"),this._internals.states.delete("--dragzone-active"),this.deactivateDragLocation(),this.deactivateDroppables(),this.draggables.forEach(l=>{l.removeAttribute("dragging")}),s.preventDefault()}handleTouchCancel(s){this.resetDragState()}validate(){if(!this.shadowRoot)return!1;let s=this.getValidAssociations(),l=!0,p="";this.maxAssociations>0&&s>this.maxAssociations?(l=!1,p=this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):this.minAssociations>0&&s<this.minAssociations&&(l=!1,p=this.dataset.minSelectionsMessage||`You haven't selected enough associations. Minimum required is ${this.minAssociations}.`);let m=this.lastElementChild;return this._internals.setValidity(l?{}:{customError:!0},p,m),this.reportValidity(),l}reportValidity(){let s=this.shadowRoot.querySelector("#validationMessage");return s&&(this._internals.validity.valid?(s.textContent="",s.style.display="none"):(s.textContent=this._internals.validationMessage,s.style.display="block")),this._internals.validity.valid}checkMaxAssociations(s){let l=this.getMatchMaxValue(s),p=s.querySelectorAll('[qti-draggable="true"]').length;return l===0||p>=l}resetDragState(){if(this.dragClone){let s=this.currentDropTarget!==null,l=!s||this.dragContainers.includes(this.currentDropTarget);if(s&&this.currentDropTarget&&!l){let p=this.dragSource.cloneNode(!0);p.removeAttribute("style"),this.currentDropTarget.appendChild(p),this.draggablesModified([p],[])}l&&(this.dragSource.style.opacity="1.0",this.dragSource.style.display="block",this.dragSource.style.position="static",this.dragSource.style.pointerEvents="auto"),this.dragClone.remove(),this.draggablesModified([],[this.dragClone])}this.isDragging=!1,this.isDraggable=!1,this.dragSource=null,this.dragClone=null,this.touchStartPoint=null,this.currentDropTarget=null,this.lastTarget=null,this.deactivateDroppables()}checkAllMaxAssociations(){this.droppables.forEach(s=>{this.checkMaxAssociations(s)?this.disableDroppable(s):this.enableDroppable(s)})}getMatchMaxValue(s){let l=s.getAttribute("match-max");return l?parseInt(l,10):1}disableDroppable(s){s.setAttribute("disabled","")}enableDroppable(s){s.removeAttribute("disabled")}get value(){return this.collectResponseData()}set value(s){if(!this.isMatchTabular())if(Array.isArray(s)){s?.forEach(p=>this.placeResponse(p));let l=new FormData;s.forEach(p=>{l.append(this.responseIdentifier,p)}),this._internals.setFormValue(l)}else this._internals.setFormValue(s||"")}placeResponse(s){let[l,...p]=s.split(" ").reverse(),m=this.findDroppableById(l);p.forEach(g=>this.placeDraggableInDroppable(g,m))}findDroppableById(s){return this.droppables.find(l=>l.getAttribute("identifier")===s)}async placeDraggableInDroppable(s,l){let p=this.querySelector(`[identifier=${s}]`);if(!l||!p){console.error(`Cannot find draggable or droppable with the given identifier: ${s}`);return}let m=()=>{p.style.transform="translate(0, 0)",l.appendChild(p),this.checkAllMaxAssociations()};document.startViewTransition?await document.startViewTransition(m).finished:m()}getValidAssociations(){return this.droppables.filter(s=>s.childElementCount>0).length}saveResponse(){let s=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:s}}))}collectResponseData(){return this.droppables.map(l=>{let p=l.querySelectorAll('[qti-draggable="true"]'),m=Array.from(p).map(b=>b.getAttribute("identifier")),g=l.getAttribute("identifier");return m.map(b=>`${b} ${g}`)}).flat()}reset(s=!0){s&&this.saveResponse()}updateDragClonePosition(s){if(!this.isDragging||!this.dragClone)return;let l=s.clientX-this.cloneOffset.x,p=s.clientY-this.cloneOffset.y,{newLeft:m,newTop:g}=this.applyBoundaries(l,p,this.dragClone);this.dragClone.style.left=`${m}px`,this.dragClone.style.top=`${g}px`}getEventCoordinates(s,l=!1){let p=s.touches?s.touches[0]:s;return{x:l?p.pageX:p.clientX,y:l?p.pageY:p.clientY}}calculateDragDistance(s){let l=Math.abs(s.clientX-this.touchStartPoint.x),p=Math.abs(s.clientY-this.touchStartPoint.y);return l+p}applyBoundaries(s,l,p){let m=new DOMRect(0,0,window.innerWidth,window.innerHeight);this.shadowRoot instanceof ShadowRoot?m=this.shadowRoot.host.getBoundingClientRect():this.getRootNode()instanceof Document&&(m=document.documentElement.getBoundingClientRect());let g=p.getBoundingClientRect(),b=g.width,y=g.height,w=Math.max(m.left,Math.min(s,m.right-b)),q=Math.max(m.top,Math.min(l,m.bottom-y));return{newLeft:w,newTop:q}}findClosestDropzone(){let s=this.allDropzones.filter(g=>!g.hasAttribute("disabled"));if(!this.dragClone||s.length===0)return null;let l=this.dragClone.getBoundingClientRect(),p=null,m=0;for(let g of s){let b=g.getBoundingClientRect(),y=this.calculateOverlapArea(l,b);y>m&&(m=y,p=g)}if(!p){let g=200;for(let b of s){let y=b.getBoundingClientRect(),w=Math.sqrt(Math.pow(l.left-y.left,2)+Math.pow(l.top-y.top,2));w<g&&(g=w,p=b)}}return p}calculateOverlapArea(s,l){let p=Math.max(0,Math.min(s.right,l.right)-Math.max(s.left,l.left)),m=Math.max(0,Math.min(s.bottom,l.bottom)-Math.max(s.top,l.top));return p*m}dispatchCustomEvent(s,l,p=!0){if(!s)return;let m=new CustomEvent(l,{bubbles:p,cancelable:!0});m.dataTransfer=this.dataTransfer,s.dispatchEvent(m)}appendClone(){document.body.appendChild(this.dragClone)}handleTouchStart(s){let{x:l,y:p}=this.getEventCoordinates(s);this.touchStartPoint={x:l,y:p},this.dragSource=s.currentTarget,this.isDraggable=!0,this._internals.states.add("--dragzone-enabled"),this._internals.states.add("--dragzone-active"),this.activateDragLocation(),this.activateDroppables(this.dragSource);let m=this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier")),g=this.droppables.some(T=>Array.from(T.children).some(oe=>oe===this.dragSource)),b=this.dragSource.getBoundingClientRect();g&&(this.dragSource.remove(),this.draggablesModified([],[this.dragSource]),this.dragSource=m),this.cloneOffset.x=l-b.left,this.cloneOffset.y=p-b.top,this.dragClone=m.cloneNode(!0);let y=window.getComputedStyle(m);for(let T=0;T<y.length;T++){let oe=y[T];this.dragClone.style.setProperty(oe,y.getPropertyValue(oe))}let w=m.getBoundingClientRect();this.dragClone.style.width=`${w.width}px`,this.dragClone.style.height=`${w.height}px`,b&&this.setDragCloneStyles(b),this.dragClone.style.display="block",this.dragClone.style.opacity="1",this.appendClone();let q=this.getMatchMaxValue(this.dragSource),re=this.draggables.filter(T=>T.getAttribute("identifier")===this.dragSource.getAttribute("identifier"));q!==0&&re.length>=q?(m.style.opacity="0.0",m.style.pointerEvents="none"):m.style.opacity="1.0",s.preventDefault(),this.dragClone.setAttribute("dragging","")}findParentInteractionElement(s){let l=s.parentElement;for(;l&&!l.tagName?.toLowerCase().endsWith("-interaction");)l=l.parentElement;return l}findDraggableInDraggableContainer(s){let l=this.dragContainers.flat();for(let p of l){if(p.getAttribute("identifier")===s)return p;let m;p instanceof HTMLSlotElement?m=Array.from(p?.assignedElements()||[]):m=Array.from(p.querySelectorAll(o));let g=m.find(b=>b.getAttribute("identifier")===s);if(g)return g}}setDragCloneStyles(s){this.dragClone.style.position="fixed",this.dragClone.style.top=`${s.top}px`,this.dragClone.style.left=`${s.left}px`,this.dragClone.style.setProperty("box-sizing","border-box","important"),this.dragClone.style.zIndex="9999",this.dragClone.style.pointerEvents="none",this.dragClone.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone.style.display="block"}}return n([d({attribute:!1,type:Object})],i.prototype,"configuration",2),n([d({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),n([d({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),n([Ue(t)],i.prototype,"handleDraggableContainerChange",1),n([Ue(o)],i.prototype,"handleDraggablesChange",1),n([Ue(e)],i.prototype,"handleDroppablesChange",1),i};var Ft=f`
|
|
81
|
-
:host {
|
|
82
|
-
display: block; /* necessary to calculate scaling position */
|
|
83
|
-
}
|
|
84
|
-
slot[name='qti-simple-associable-choice'] {
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: flex-start;
|
|
87
|
-
flex: 1;
|
|
88
|
-
border: 2px solid transparent;
|
|
89
|
-
padding: 0.3rem;
|
|
90
|
-
border-radius: 0.3rem;
|
|
91
|
-
gap: 0.5rem;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
:host::part(associables-container) {
|
|
95
|
-
display: flex;
|
|
96
|
-
padding: 0.5rem;
|
|
97
|
-
justify-content: space-between;
|
|
98
|
-
background: linear-gradient(
|
|
99
|
-
180deg,
|
|
100
|
-
rgb(0 0 0 / 0%) calc(50% - 1px),
|
|
101
|
-
var(--qti-border-color-gray) calc(50%),
|
|
102
|
-
rgb(0 0 0 / 0%) calc(50% + 1px)
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
`;var de=class extends H(x,"qti-simple-associable-choice",".dl","slot[name='qti-simple-associable-choice']"){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(e){let t=e.target;this._childrenMap.push(t)}render(){return u` <slot name="prompt"></slot>
|
|
106
|
-
<slot name="qti-simple-associable-choice"></slot>
|
|
107
|
-
<div part="drop-container">
|
|
108
|
-
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>u`<div part="associables-container">
|
|
109
|
-
<div name="left${t}" part="drop-list" class="dl" identifier="droplist${t}_left"></div>
|
|
110
|
-
<div name="right${t}" part="drop-list" class="dl" identifier="droplist${t}_right"></div>
|
|
111
|
-
</div>`)}
|
|
112
|
-
|
|
113
|
-
<div role="alert" id="validationMessage"></div>
|
|
114
|
-
</div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};de.styles=Ft,n([E()],de.prototype,"_childrenMap",2),de=n([h("qti-associate-interaction")],de);var K=(c,o)=>{class e extends c{constructor(){super(...arguments);this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(r,a)=>{this._choiceElements.forEach(s=>s.disabled=a)};this._handleReadonlyChange=(r,a)=>{this._choiceElements.forEach(s=>s.readonly=a)};this._value=""}_handleMaxChoicesChange(r,a){this._determineInputType()}get value(){return Array.isArray(this._value)&&this._value.length===0||this._value===""?null:Array.isArray(this._value)?this._value.join(","):this._value}set value(r){if(this.maxChoices>1&&(typeof r=="string"||r===null)?this._value=r?r.toString().split(","):[]:this._value=r||"",Array.isArray(this._value)){let a=new FormData;this._value.forEach(s=>{a.append(this.responseIdentifier,s)}),this._internals.setFormValue(a)}else this._internals.setFormValue(this._value);this._updateChoiceSelection()}get correctResponse(){return this._correctResponse}set correctResponse(r){this._correctResponse=r;let a=Array.isArray(r)?r:[r];this._choiceElements.forEach(s=>{s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),a.length>0&&(a.includes(s.identifier)?s.internals.states.add("correct-response"):s.internals.states.add("incorrect-response"))})}connectedCallback(){super.connectedCallback(),this.addEventListener(`register-${o}`,this._registerChoiceElement),this.addEventListener(`unregister-${o}`,this._unregisterChoiceElement),this.addEventListener(`activate-${o}`,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`register-${o}`,this._registerChoiceElement),this.removeEventListener(`unregister-${o}`,this._unregisterChoiceElement),this.removeEventListener(`activate-${o}`,this._choiceElementSelectedHandler)}validate(){let r=this._choiceElements.filter(p=>this._getChoiceChecked(p)),a=r.length,s=!0,l="";return this.maxChoices!==0&&a>this.maxChoices?(s=!1,l=this.dataset.maxSelectionsMessage||`You can select at most ${this.maxChoices} choices.`):a<this.minChoices&&(s=!1,l=this.dataset.minSelectionsMessage||`You must select at least ${this.minChoices} choices.`),r.length>0&&this._internals.setValidity(s?{}:{customError:!0},l,r[a-1]||this._choiceElements[0]||this),this.reportValidity(),s}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.display="block")),this._internals.validity.valid}_registerChoiceElement(r){r.stopPropagation();let a=r.target;a.disabled=this.disabled,this._choiceElements.push(a),this._setInputType(a)}_unregisterChoiceElement(r){r.stopPropagation();let a=r.target;this._choiceElements=this._choiceElements.filter(s=>s!==a)}_determineInputType(){this._choiceElements.forEach(r=>{this._setInputType(r)})}_setInputType(r){this._internals.ariaLabel=this.maxChoices===1?"radio-group":"checkbox-group";let a=this.maxChoices===1?"radio":"checkbox";r.internals.role=a,r.internals.states.delete(a==="radio"?"checkbox":"radio"),r.internals.states.add(a)}_choiceElementSelectedHandler(r){this._toggleChoiceChecked(r.target),this.maxChoices===1&&this._choiceElements.forEach(a=>{a.identifier!==r.detail.identifier&&this._setChoiceChecked(a,!1)}),this._handleChoiceSelection()}_setChoiceChecked(r,a){r.internals?.states&&(a?(r.internals.states.add("--checked"),r.internals.ariaChecked="true"):(r.internals.states.delete("--checked"),r.internals.ariaChecked="false"))}_getChoiceChecked(r){return r.internals.states.has("--checked")}_toggleChoiceChecked(r){let a=this._getChoiceChecked(r);this._setChoiceChecked(r,!a)}_handleChoiceSelection(){let a=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.value=this.maxChoices===1?a[0]||"":a,this.validate(),this.saveResponse(this._value)}_updateChoiceSelection(){let r=Array.isArray(this._value)?this._value:[this._value];this._choiceElements.forEach(a=>{let s=r.includes(a.identifier);this._setChoiceChecked(a,s)})}}return n([Ye("#validationMessage")],e.prototype,"_validationMessageElement",2),n([d({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),n([d({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),n([M("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),n([M("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),n([M("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),e};var je=(c,o)=>{class e extends c{constructor(){super(...arguments);this.shuffle="false"}connectedCallback(){super.connectedCallback(),this._applyShuffle()}updated(r){r.has("shuffle")&&this._applyShuffle()}_applyShuffle(){this.shuffle==="true"?this._shuffleChoices():this._resetShuffleChoices()}_shuffleChoices(){let r=Array.from(this.querySelectorAll(o)),a=r.filter(b=>b.hasAttribute("fixed")),s=r.filter(b=>!b.hasAttribute("fixed"));if(s.length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");return}let l=[...s],p=!1,m=0;for(;!p&&m<10;){m++;for(let b=s.length-1;b>0;b--){let y=Math.floor(Math.random()*(b+1));[s[b],s[y]]=[s[y],s[b]]}p=!s.every((b,y)=>b===l[y])}p||console.warn("Failed to shuffle the choices after multiple attempts.");let g=1;[...a,...s].forEach(b=>{b.style.setProperty("order",String(g++))})}_resetShuffleChoices(){this.querySelectorAll(o).forEach(r=>{r.style.setProperty("order","initial")})}}return n([d({type:String,reflect:!0})],e.prototype,"shuffle",2),e};var zt=(c,o)=>{class e extends c{constructor(){super(...arguments);this._classes=[];this._allLabels=["qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];this._allLabelSuffixes=["qti-labels-suffix-period","qti-labels-suffix-parenthesis"]}set class(r){r&&(this._classes=r.split(" "),this._addLabels())}get class(){return this._classes?.join(" ")||""}updated(r){super.updated(r),r.has("shuffle")&&this._addLabels()}_addLabels(){let r=this._classes.some(s=>this._allLabels.includes(s)||this._allLabelSuffixes.includes(s)),a=s=>!isNaN(+s);if(r){let l=Array.from(this.querySelectorAll("qti-simple-choice")).map(p=>p).map((p,m)=>({el:p,order:a(p.style.order)?+p.style.order:m+1})).sort((p,m)=>p.order-m.order).map(p=>p.el);for(let p=0;p<l.length;p++)l[p].marker=this._getLabel(p+1)}}_getLabel(r){let a=this._classes.filter(p=>this._allLabels.includes(p)).pop(),s=this._classes.filter(p=>this._allLabelSuffixes.includes(p)).pop();!a&&s&&(a="qti-labels-upper-alpha");let l="";switch(a){case"qti-labels-decimal":l=`${r}`;break;case"qti-labels-lower-alpha":l=`${String.fromCharCode(97+r-1)}`;break;case"qti-labels-upper-alpha":l=`${String.fromCharCode(65+r-1)}`;break}return s==="qti-labels-suffix-period"?l+=".":s==="qti-labels-suffix-parenthesis"&&(l+=")"),l}}return n([d({type:String,reflect:!0})],e.prototype,"class",1),e};var Yt=f`
|
|
115
|
-
[part='slot'] {
|
|
116
|
-
display: flex;
|
|
117
|
-
flex-direction: column;
|
|
118
|
-
gap: var(--qti-gap-size);
|
|
119
|
-
flex-wrap: wrap;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
::slotted(qti-simple-choice) {
|
|
123
|
-
flex: 0 0
|
|
124
|
-
calc((100% - (var(--qti-gap-size) * var(--choice-interactions-stacking))) / var(--choice-interactions-stacking)) !important;
|
|
125
|
-
box-sizing: border-box !important;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
:host(.qti-choices-stacking-1) [part='slot'] {
|
|
129
|
-
flex-direction: row;
|
|
130
|
-
--choice-interactions-stacking: 1;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
:host(.qti-choices-stacking-2) [part='slot'] {
|
|
134
|
-
flex-direction: row;
|
|
135
|
-
--choice-interactions-stacking: 2;
|
|
136
|
-
}
|
|
137
|
-
:host(.qti-choices-stacking-3) [part='slot'] {
|
|
138
|
-
flex-direction: row;
|
|
139
|
-
--choice-interactions-stacking: 3;
|
|
140
|
-
}
|
|
141
|
-
:host(.qti-choices-stacking-4) [part='slot'] {
|
|
142
|
-
flex-direction: row;
|
|
143
|
-
--choice-interactions-stacking: 4;
|
|
144
|
-
}
|
|
145
|
-
:host(.qti-choices-stacking-5) [part='slot'] {
|
|
146
|
-
flex-direction: row;
|
|
147
|
-
--choice-interactions-stacking: 5;
|
|
148
|
-
}
|
|
149
|
-
:host([orientation='horizontal']) [part='slot'] {
|
|
150
|
-
flex-direction: row;
|
|
151
|
-
}
|
|
152
|
-
`;var ue=class extends zt(je(K(x,"qti-simple-choice"),"qti-simple-choice"),"qti-simple-choice"){constructor(){super(),this._internals.role="group"}render(){return u`
|
|
153
|
-
<slot part="prompt" name="prompt"></slot><slot part="slot"></slot>
|
|
154
|
-
<div part="message" role="alert" id="validationMessage"></div>
|
|
155
|
-
`}};ue.styles=Yt,n([d({type:String})],ue.prototype,"orientation",2),ue=n([h("qti-choice-interaction")],ue);var z=class extends x{constructor(){super();this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")?this.data:Ce(this.baseItemUrl+"/"+this.data);fetch(e).then(t=>t.json()).then(t=>{this.manifest=t,this.setupCES()}).catch(t=>{this._errorMessage=t})}setupCES(){let e=this.shadowRoot.querySelector("#pciContainer"),t=e.contentDocument;window.addEventListener("message",this.handlePostMessage),t.open(),t.write(`
|
|
156
|
-
<html>
|
|
157
|
-
<head>
|
|
158
|
-
<link href='${Ce(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
|
|
159
|
-
<script src='${Ce(`${this.baseRefUrl}/${this.manifest.script[0]}`)}'></script>
|
|
160
|
-
</head>
|
|
161
|
-
<body></body>
|
|
162
|
-
</html>
|
|
163
|
-
`),t.close()}getIFrames(){let e=this.shadowRoot.querySelectorAll("iframe"),t=this.querySelectorAll("iframe"),i=[...e,...t];for(let r of i){let a=r.src;if(new URL(a,window.location.href).origin===window.location.origin)try{let l=r.contentDocument||r.contentWindow.document;l&&this.getInnerIFrames(l,i)}catch(l){console.error("Error accessing nested iframe:",l)}}return i.forEach((r,a)=>{i.indexOf(r)!==a&&i.splice(a,1)}),i}getInnerIFrames(e,t=[]){return e.querySelectorAll("iframe").forEach(r=>{t.push(r);let a=r.src;if(new URL(a,window.location.href).origin===window.location.origin)try{let l=r.contentDocument||r.contentWindow.document;this.getInnerIFrames(l,t)}catch(l){console.error("Error accessing nested iframe:",l)}else console.warn("Skipped cross-origin iframe:",a)}),t}postToWindowAndIframes(e,t){window.postMessage({type:e,data:t},"*");let i=this.getIFrames();for(let r of i)r.contentWindow&&r.contentWindow.postMessage({type:e,data:t},"*")}handlePostMessage(e){let{type:t,data:i}=e.data;switch(t){case"setResponse":this.rawResponse=i,this.saveResponse(i);break;case"getResponse":{this.postToWindowAndIframes("responseData",this.rawResponse);break}case"getMedia":{let r=this.manifest.media.map(a=>a.startsWith("http")?a:Ce(this.baseRefUrl+"/"+a));this.postToWindowAndIframes("mediaData",r);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){return this.rawResponse!==""}get value(){return this.rawResponse}set value(e){if(typeof e=="string")this.rawResponse=e,this.saveResponse(e);else throw new Error("Value must be a string")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return u`<iframe
|
|
164
|
-
width=${this.getAttribute("width")}
|
|
165
|
-
height=${this.getAttribute("height")}
|
|
166
|
-
frameborder="0"
|
|
167
|
-
title="pciContainer"
|
|
168
|
-
id="pciContainer"
|
|
169
|
-
>
|
|
170
|
-
</iframe>
|
|
171
|
-
${this._errorMessage&&u`<div style="color:red">
|
|
172
|
-
<h1>Error</h1>
|
|
173
|
-
${this._errorMessage}
|
|
174
|
-
</div>`}`}};n([d({type:String,attribute:"data"})],z.prototype,"data",2),n([d({type:String,attribute:"data-base-item"})],z.prototype,"baseItemUrl",2),n([d({type:String,attribute:"data-base-ref"})],z.prototype,"baseRefUrl",2),n([d({type:String,attribute:"id"})],z.prototype,"id",2),n([E()],z.prototype,"_errorMessage",2),z=n([h("qti-custom-interaction")],z);var J=class extends v{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}render(){return u`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};n([d({type:String,attribute:"response-identifier"})],J.prototype,"responseIdentifier",2),n([d({reflect:!0,type:Boolean})],J.prototype,"disabled",2),n([d({type:String,attribute:"count-attempt"})],J.prototype,"countAttempt",2),n([d({type:String})],J.prototype,"title",2),J=n([h("qti-end-attempt-interaction")],J);var Z=c=>c??R;var Ut=f`
|
|
175
|
-
/* PK: display host as block, else design will be collapsed */
|
|
176
|
-
:host {
|
|
177
|
-
display: block;
|
|
178
|
-
}
|
|
179
|
-
textarea {
|
|
180
|
-
box-sizing: border-box;
|
|
181
|
-
width: 100%;
|
|
182
|
-
height: 100%;
|
|
183
|
-
border: 0;
|
|
184
|
-
}
|
|
185
|
-
`;var k=class extends x{constructor(){super(...arguments);this._rows=5;this._value=""}handleclassNamesChange(e,t){let i=t.split(" "),r=!1;if(i.forEach(a=>{if(a.startsWith("qti-height-lines-")){let s=a.replace("qti-height-lines-","");this._rows=parseInt(s),r=!0}}),!r&&this.expectedLength){let a=Math.ceil(this.expectedLength/50);this._rows=a}}get value(){return this._value||null}set value(e){if(typeof e=="string"||e===null){this._value=e||"";let t=new FormData;t.append(this.responseIdentifier,this._value),this._internals.setFormValue(t),this.validate()}else throw new Error("Value must be a string")}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let t=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(t);e.checkValidity()&&i.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return this._value!==""&&e.checkValidity()}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}render(){return u`<slot name="prompt"></slot
|
|
186
|
-
><textarea
|
|
187
|
-
part="textarea"
|
|
188
|
-
name="${this.responseIdentifier}"
|
|
189
|
-
spellcheck="false"
|
|
190
|
-
autocomplete="off"
|
|
191
|
-
maxlength="${5e3}"
|
|
192
|
-
@keydown="${e=>e.stopImmediatePropagation()}"
|
|
193
|
-
@keyup="${this.textChanged}"
|
|
194
|
-
@change="${this.textChanged}"
|
|
195
|
-
@blur="${e=>{this.reportValidity()}}"
|
|
196
|
-
placeholder="${Z(this.placeholderText?this.placeholderText:void 0)}"
|
|
197
|
-
rows="${this._rows}"
|
|
198
|
-
?disabled="${this.disabled}"
|
|
199
|
-
?readonly="${this.readonly}"
|
|
200
|
-
.value=${this._value}
|
|
201
|
-
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this.value=t.value,this.saveResponse(t.value))}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};k.styles=Ut,n([E()],k.prototype,"_rows",2),n([d({type:Number,attribute:"expected-length"})],k.prototype,"expectedLength",2),n([d({type:String,attribute:"pattern-mask"})],k.prototype,"patternMask",2),n([d({type:String,attribute:"placeholder-text"})],k.prototype,"placeholderText",2),n([d({type:String,attribute:"data-patternmask-message"})],k.prototype,"dataPatternmaskMessage",2),n([E()],k.prototype,"_value",2),n([d({type:String,attribute:"class"})],k.prototype,"classNames",2),n([M("classNames")],k.prototype,"handleclassNamesChange",1),k=n([h("qti-extended-text-interaction")],k);var he=class extends v{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","drags")}};he.styles=f`
|
|
202
|
-
:host {
|
|
203
|
-
display: flex;
|
|
204
|
-
user-select: none;
|
|
205
|
-
}
|
|
206
|
-
`,n([d({type:Number,reflect:!0})],he.prototype,"tabindex",2),he=n([h("qti-gap-img")],he);var Bt=f`
|
|
207
|
-
:host {
|
|
208
|
-
display: flex;
|
|
209
|
-
align-items: flex-start;
|
|
210
|
-
flex-direction: column;
|
|
211
|
-
flex-wrap: wrap;
|
|
212
|
-
gap: 0.5rem;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
:host(.qti-choices-top) {
|
|
216
|
-
flex-direction: column;
|
|
217
|
-
}
|
|
218
|
-
:host(.qti-choices-bottom) {
|
|
219
|
-
flex-direction: column-reverse;
|
|
220
|
-
}
|
|
221
|
-
:host(.qti-choices-left) {
|
|
222
|
-
flex-direction: row;
|
|
223
|
-
}
|
|
224
|
-
:host(.qti-choices-right) {
|
|
225
|
-
flex-direction: row-reverse;
|
|
226
|
-
}
|
|
227
|
-
/* [part='drops'] , */
|
|
228
|
-
[name='prompt'] {
|
|
229
|
-
width: 100%;
|
|
230
|
-
}
|
|
231
|
-
[name='drags'] {
|
|
232
|
-
display: flex;
|
|
233
|
-
align-items: flex-start;
|
|
234
|
-
flex: 1;
|
|
235
|
-
border: 2px solid transparent;
|
|
236
|
-
padding: 0.3rem;
|
|
237
|
-
border-radius: 0.3rem;
|
|
238
|
-
gap: 0.5rem;
|
|
239
|
-
}
|
|
240
|
-
`;var Se=class extends H(x,"qti-gap-text","qti-gap","slot[part='drags']"){render(){return u`<slot name="prompt"> </slot>
|
|
241
|
-
<slot part="drags" name="drags"></slot>
|
|
242
|
-
<slot part="drops"></slot>
|
|
243
|
-
<div role="alert" id="validationMessage"></div>`}set correctResponse(o){let e=[],t=Array.isArray(o)?o:[o];t&&(e=t.map(r=>{let a=r.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(r=>{let a=r.getAttribute("identifier"),s=e.find(p=>p.gap===a)?.text,l=this.querySelector(`qti-gap-text[identifier="${s}"]`)?.textContent.trim();if(s&&l){if(!r.nextElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=l,r.insertAdjacentElement("afterend",p)}}else r.nextElementSibling?.classList.contains("correct-option")&&r.nextElementSibling.remove()})}};Se.styles=Bt,Se=n([h("qti-gap-match-interaction")],Se);var Xt={toAttribute:c=>c?"true":"false",fromAttribute:c=>c==="true"};function N(c,o){class e extends c{constructor(...r){super(...r);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(r,a){this.tabIndex=a?-1:0,a&&this.blur()}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${o}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${o}`,{bubbles:!0,composed:!0}))}_onKeyUp(r){r.altKey||r.code==="Space"&&(r.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${o}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return u`<slot></slot>`}}return n([d({type:String})],e.prototype,"identifier",2),n([d({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),n([d({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Xt})],e.prototype,"disabled",2),n([d({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Xt})],e.prototype,"readonly",2),n([M("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var me=class extends N(v,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return u`<slot></slot>`}};me.styles=f`
|
|
244
|
-
:host {
|
|
245
|
-
display: inline-flex;
|
|
246
|
-
user-select: none;
|
|
247
|
-
}
|
|
248
|
-
`,n([d({type:Number,reflect:!0})],me.prototype,"tabindex",2),me=n([h("qti-gap-text")],me);var fe=class extends v{constructor(){super(...arguments);this.tabindex=0}render(){return u` <slot name="drags"></slot>`}};fe.styles=f`
|
|
249
|
-
:host {
|
|
250
|
-
display: flex;
|
|
251
|
-
user-select: none;
|
|
252
|
-
}
|
|
253
|
-
`,n([d({type:Number,reflect:!0})],fe.prototype,"tabindex",2),fe=n([h("qti-gap")],fe);var jt=(c,o,e)=>{let t=new Map;for(let i=o;i<=e;i++)t.set(c[i],i);return t},We=j(class extends le{constructor(c){if(super(c),c.type!==ae.CHILD)throw Error("repeat() can only be used in text expressions")}dt(c,o,e){let t;e===void 0?e=o:o!==void 0&&(t=o);let i=[],r=[],a=0;for(let s of c)i[a]=t?t(s,a):a,r[a]=e(s,a),a++;return{values:r,keys:i}}render(c,o,e){return this.dt(c,o,e).values}update(c,[o,e,t]){let i=Ot(c),{values:r,keys:a}=this.dt(o,e,t);if(!Array.isArray(i))return this.ut=a,r;let s=this.ut??(this.ut=[]),l=[],p,m,g=0,b=i.length-1,y=0,w=r.length-1;for(;g<=b&&y<=w;)if(i[g]===null)g++;else if(i[b]===null)b--;else if(s[g]===a[y])l[y]=W(i[g],r[y]),g++,y++;else if(s[b]===a[w])l[w]=W(i[b],r[w]),b--,w--;else if(s[g]===a[w])l[w]=W(i[g],r[w]),ce(c,l[w+1],i[g]),g++,w--;else if(s[b]===a[y])l[y]=W(i[b],r[y]),ce(c,i[g],i[b]),b--,y++;else if(p===void 0&&(p=jt(a,y,w),m=jt(s,g,b)),p.has(s[g]))if(p.has(s[b])){let q=m.get(a[y]),re=q!==void 0?i[q]:null;if(re===null){let T=ce(c,i[g]);W(T,r[y]),l[y]=T}else l[y]=W(re,r[y]),ce(c,i[g],re),i[q]=null;y++}else Be(i[b]),b--;else Be(i[g]),g++;for(;y<=w;){let q=ce(c,l[w+1]);W(q,r[y]),l[y++]=q}for(;g<=b;){let q=i[g++];q!==null&&Be(q)}return this.ut=a,$t(c,l),ne}});function ge(c,o,e,t){switch(c){case"circle":{let[i,r,a]=o,s=i/e.width*100,l=r/e.height*100,p=a/e.width*100;t.style.left=s-p+"%",t.style.top=l-p+"%",t.style.width=t.style.height=4*p+"px",t.style.borderRadius="9999px"}break;case"rect":{let[i,r,a,s]=o,l=i/e.width*100,p=r/e.height*100,m=a/e.width*100,g=s/e.height*100;t.style.left=l+"%",t.style.top=p+"%",t.style.width=m-l+"%",t.style.height=g-p+"%"}break;case"poly":{let i=o.reduce((q,re,T,oe)=>{if(T%2===1){let pi=q.pop();q[q.length]={x:pi,y:oe[T]}}else q.push(re);return q},[]),r=Math.min(...i.map(q=>q.x)),a=Math.max(...i.map(q=>q.x)),s=Math.min(...i.map(q=>q.y)),l=Math.max(...i.map(q=>q.y)),p=r/e.width*100,m=s/e.height*100,g=a/e.width*100,b=l/e.height*100;t.style.left=r/e.width*100+"%",t.style.top=s/e.height*100+"%",t.style.width=g-p+"%",t.style.height=b-m+"%";let w=i.map(q=>({x:(q.x-r)/(a-r)*100,y:(q.y-s)/(l-s)*100})).map(q=>Math.round(q.x)+"% "+Math.round(q.y)+"%").join(",");t.style.clipPath=`polygon(${w})`}break;default:break}}var Wt=f`
|
|
254
|
-
slot:not([name='prompt']) {
|
|
255
|
-
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
256
|
-
display: block;
|
|
257
|
-
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
258
|
-
}
|
|
259
|
-
::slotted(img) {
|
|
260
|
-
/* image not selectable anymore */
|
|
261
|
-
pointer-events: none;
|
|
262
|
-
user-select: none;
|
|
263
|
-
}
|
|
264
|
-
::slotted(qti-associable-hotspot) {
|
|
265
|
-
transform: translate(-50%, -50%);
|
|
266
|
-
}
|
|
267
|
-
line-container {
|
|
268
|
-
display: block;
|
|
269
|
-
position: relative;
|
|
270
|
-
}
|
|
271
|
-
svg {
|
|
272
|
-
position: absolute;
|
|
273
|
-
top: 0px;
|
|
274
|
-
left: 0px;
|
|
275
|
-
}
|
|
276
|
-
`;var Y=class extends x{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set value(e){Array.isArray(e)&&(this._lines=e)}get value(){return this._lines}render(){return u`<slot name="prompt"></slot>
|
|
277
|
-
<line-container>
|
|
278
|
-
<svg
|
|
279
|
-
width=${Z(this.grImage[0]?.width)}
|
|
280
|
-
height=${Z(this.grImage[0]?.height)}
|
|
281
|
-
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
282
|
-
>
|
|
283
|
-
${We(this._lines,e=>e,(e,t)=>at`
|
|
284
|
-
<line
|
|
285
|
-
part="line"
|
|
286
|
-
x1=${parseInt(this.querySelector("[identifier="+e.split(" ")[0]+"]").style.left)}
|
|
287
|
-
y1=${parseInt(this.querySelector("[identifier="+e.split(" ")[0]+"]").style.top)}
|
|
288
|
-
x2=${parseInt(this.querySelector("[identifier="+e.split(" ")[1]+"]").style.left)}
|
|
289
|
-
y2=${parseInt(this.querySelector("[identifier="+e.split(" ")[1]+"]").style.top)}
|
|
290
|
-
stroke="red"
|
|
291
|
-
stroke-width="3"
|
|
292
|
-
@click=${i=>{i.stopPropagation(),this._lines=this._lines.filter((r,a)=>a!==t),this.saveResponse(this._lines)}}
|
|
293
|
-
/>
|
|
294
|
-
`)}
|
|
295
|
-
${this.startPoint&&at`<line
|
|
296
|
-
part="point"
|
|
297
|
-
x1=${this.startCoord.x}
|
|
298
|
-
y1=${this.startCoord.y}
|
|
299
|
-
x2=${this.mouseCoord.x}
|
|
300
|
-
y2=${this.mouseCoord.y}
|
|
301
|
-
stroke="red"
|
|
302
|
-
stroke-width="3"
|
|
303
|
-
/>`}
|
|
304
|
-
</svg>
|
|
305
|
-
<slot></slot>
|
|
306
|
-
</line-container>
|
|
307
|
-
<div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),i=e.target,r=i.getAttribute("coords"),a=i.getAttribute("shape"),s=r.split(",").map(l=>parseInt(l));ge(a,s,t,i)}firstUpdated(e){super.firstUpdated(e),this.hotspots=this.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",t=>{this.mouseCoord={x:t.clientX-this.grImage[0].getBoundingClientRect().left,y:t.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.addEventListener("click",i=>{this.startPoint?this.endPoint||(this.endPoint=i.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=i.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};Y.styles=Wt,n([E()],Y.prototype,"_lines",2),n([E()],Y.prototype,"startCoord",2),n([E()],Y.prototype,"mouseCoord",2),n([Vt({selector:"img"})],Y.prototype,"grImage",2),Y=n([h("qti-graphic-associate-interaction")],Y);var Kt=f`
|
|
308
|
-
:host {
|
|
309
|
-
display: flex;
|
|
310
|
-
align-items: flex-start;
|
|
311
|
-
flex-direction: column;
|
|
312
|
-
flex-wrap: wrap;
|
|
313
|
-
gap: 0.5rem;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
:host(.qti-choices-top) {
|
|
317
|
-
flex-direction: column-reverse;
|
|
318
|
-
}
|
|
319
|
-
:host(.qti-choices-bottom) {
|
|
320
|
-
flex-direction: column;
|
|
321
|
-
}
|
|
322
|
-
:host(.qti-choices-left) {
|
|
323
|
-
flex-direction: row-reverse;
|
|
324
|
-
& [name='drags'] {
|
|
325
|
-
width: 25%;
|
|
326
|
-
}
|
|
327
|
-
& [part='image'] {
|
|
328
|
-
width: 75%;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
:host(.qti-choices-right) {
|
|
332
|
-
flex-direction: row;
|
|
333
|
-
& [name='drags'] {
|
|
334
|
-
width: 25%;
|
|
335
|
-
}
|
|
336
|
-
& [part='image'] {
|
|
337
|
-
width: 75%;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
[part='image'] {
|
|
341
|
-
display: block;
|
|
342
|
-
position: relative;
|
|
343
|
-
}
|
|
344
|
-
/* [part='drops'] , */
|
|
345
|
-
|
|
346
|
-
[name='drags'] {
|
|
347
|
-
display: flex;
|
|
348
|
-
align-items: flex-start;
|
|
349
|
-
flex-wrap: wrap;
|
|
350
|
-
flex: 1;
|
|
351
|
-
border: 2px solid transparent;
|
|
352
|
-
padding: 0.3rem;
|
|
353
|
-
border-radius: 0.3rem;
|
|
354
|
-
gap: 0.5rem;
|
|
355
|
-
}
|
|
356
|
-
::slotted(img) {
|
|
357
|
-
display: inline-block;
|
|
358
|
-
user-select: none;
|
|
359
|
-
pointer-events: none;
|
|
360
|
-
}
|
|
361
|
-
`;var _e=class extends H(x,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part='drags']"){render(){return u` <slot name="prompt"></slot>
|
|
362
|
-
<slot part="image"></slot>
|
|
363
|
-
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
364
|
-
<div role="alert" id="validationMessage"></div>`}positionHotspotOnRegister(o){let e=o.target,t=e.getAttribute("coords"),i=e.getAttribute("shape"),r=t.split(",").map(a=>parseInt(a));switch(i){case"circle":{let[a,s,l]=r;e.style.left=a-l+"px",e.style.top=s-l+"px",e.style.width=e.style.height=2*l+"px"}break;case"rect":{let[a,s,l,p]=r;e.style.left=a+"px",e.style.top=s+"px",e.style.width=l-a+"px",e.style.height=p-s+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};_e.styles=Kt,_e=n([h("qti-graphic-gap-match-interaction")],_e);var Jt=f`
|
|
365
|
-
slot:not([name='prompt']) {
|
|
366
|
-
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
367
|
-
display: block;
|
|
368
|
-
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
369
|
-
}
|
|
370
|
-
::slotted(img) {
|
|
371
|
-
/* image not selectable anymore */
|
|
372
|
-
pointer-events: none;
|
|
373
|
-
user-select: none;
|
|
374
|
-
}
|
|
375
|
-
`;var ke=class extends K(x,"qti-hotspot-choice"){constructor(){super(...arguments);this._choiceElements=[]}render(){return u`
|
|
376
|
-
<slot name="prompt"></slot>
|
|
377
|
-
<slot></slot>
|
|
378
|
-
<div role="alert" id="validationMessage"></div>
|
|
379
|
-
`}setHotspotOrder(e){let{identifier:t}=e.detail,i=this._choiceElements.find(a=>a.getAttribute("identifier")===t),r=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){if(this._choiceElements.filter(a=>a.order>0).length>=r){this.choiceOrdering=!1;return}i.order=this._choiceElements.filter(a=>!!a.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(a=>(a.order>a.order&&a.order--,a)),i.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let t=this.querySelector("img"),i=e.target,r=i.getAttribute("coords"),a=i.getAttribute("shape"),s=r.split(",").map(l=>parseInt(l));ge(a,s,t,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.removeEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}};ke.styles=Jt,ke=n([h("qti-graphic-order-interaction")],ke);var be=class extends N(v,"qti-hotspot-choice"){};be.styles=f`
|
|
380
|
-
:host {
|
|
381
|
-
display: flex;
|
|
382
|
-
user-select: none;
|
|
383
|
-
position: absolute;
|
|
384
|
-
}
|
|
385
|
-
`,n([d({attribute:"aria-ordervalue",type:Number,reflect:!0})],be.prototype,"order",2),be=n([h("qti-hotspot-choice")],be);var Zt=f`
|
|
386
|
-
slot:not([name='prompt']) {
|
|
387
|
-
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
388
|
-
display: block;
|
|
389
|
-
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
390
|
-
}
|
|
391
|
-
::slotted(img) {
|
|
392
|
-
/* image not selectable anymore */
|
|
393
|
-
pointer-events: none;
|
|
394
|
-
user-select: none;
|
|
395
|
-
/* width:100%; */
|
|
396
|
-
}
|
|
397
|
-
`;var Re=class extends K(x,"qti-hotspot-choice"){render(){return u`
|
|
398
|
-
<slot name="prompt"></slot>
|
|
399
|
-
<slot></slot>
|
|
400
|
-
`}positionHotspotOnRegister(o){let e=this.querySelector("img"),t=o.target,i=t.getAttribute("coords"),r=t.getAttribute("shape"),a=i.split(",").map(s=>parseInt(s));ge(r,a,e,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.positionHotspotOnRegister)}};Re.styles=Zt,Re=n([h("qti-hotspot-interaction")],Re);var Ke=class extends K(x,"qti-hottext"){constructor(){super(...arguments);this.render=()=>u`<slot></slot>`}};Ke=n([h("qti-hottext-interaction")],Ke);var Le=class extends N(v,"qti-hottext"){render(){return u`<div part="ch"><div part="cha"></div></div>
|
|
401
|
-
<slot></slot> `}};Le.styles=f`
|
|
402
|
-
:host {
|
|
403
|
-
display: flex;
|
|
404
|
-
user-select: none;
|
|
405
|
-
}
|
|
406
|
-
`,Le=n([h("qti-hottext")],Le);var Ae=class extends le{constructor(o){if(super(o),this.it=R,o.type!==ae.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(o){if(o===R||o==null)return this._t=void 0,this.it=o;if(o===ne)return o;if(typeof o!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(o===this.it)return this._t;this.it=o;let e=[o];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Ae.directiveName="unsafeHTML",Ae.resultType=1;var G=j(Ae);var Q=class extends x{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[f`
|
|
407
|
-
:host {
|
|
408
|
-
display: inline-block;
|
|
409
|
-
}
|
|
410
|
-
slot {
|
|
411
|
-
display: flex;
|
|
412
|
-
flex-direction: column;
|
|
413
|
-
}
|
|
414
|
-
[role='menu'] {
|
|
415
|
-
position: absolute;
|
|
416
|
-
z-index: 1000;
|
|
417
|
-
}
|
|
418
|
-
.anchor {
|
|
419
|
-
/* anchor-name: --infobox; */
|
|
420
|
-
width: fit-content;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
.positionedElement {
|
|
424
|
-
position: absolute;
|
|
425
|
-
/* position-anchor: --infobox; */
|
|
426
|
-
/* top: anchor(bottom); */
|
|
427
|
-
}
|
|
428
|
-
`]}render(){return u`
|
|
429
|
-
<select part="select" @change="${this.choiceSelected}" ?disabled="${this.disabled}" ?readonly="${this.readonly}">
|
|
430
|
-
${this.options.map(e=>u`
|
|
431
|
-
<option value="${e.value}" ?selected="${e.selected}">${G(e.textContent)}</option>
|
|
432
|
-
`)}
|
|
433
|
-
</select>
|
|
434
|
-
|
|
435
|
-
${G(this.correctOption)}
|
|
436
|
-
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(t=>({textContent:t.innerHTML,value:t.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>({...e,selected:t===0}))}set value(e){this.options=this.options.map(t=>(e&&e===t.value&&(t.selected=!0),t))}get value(){return this.options.find(e=>e.selected)?.value||null}set correctResponse(e){if(e===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(t=>e===t.value).textContent}</span>`}choiceSelected(e){let t=e.target.value;this.options=this.options.map(i=>({...i,selected:i.value===t})),this.saveResponse(t)}};Q.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],n([E()],Q.prototype,"options",2),n([E()],Q.prototype,"correctOption",2),n([d({attribute:"data-prompt",type:String})],Q.prototype,"dataPrompt",2),Q=n([h("qti-inline-choice-interaction")],Q);var De=class extends v{static get styles(){return[f`
|
|
437
|
-
:host {
|
|
438
|
-
display: block;
|
|
439
|
-
cursor: pointer;
|
|
440
|
-
}
|
|
441
|
-
`]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return u` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};n([d({type:String})],De.prototype,"identifier",2),De=n([h("qti-inline-choice")],De);var ee=class extends N(v,"qti-simple-associable-choice"){constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return u`
|
|
442
|
-
<slot part="slot"></slot>
|
|
443
|
-
<slot part="dropslot" name="qti-simple-associable-choice"></slot>
|
|
444
|
-
`}};ee.styles=f`
|
|
445
|
-
:host {
|
|
446
|
-
display: flex;
|
|
447
|
-
user-select: none;
|
|
448
|
-
}
|
|
449
|
-
slot {
|
|
450
|
-
width: 100%;
|
|
451
|
-
display: block;
|
|
452
|
-
}
|
|
453
|
-
slot[name='qti-simple-associable-choice'] {
|
|
454
|
-
width: 100%;
|
|
455
|
-
}
|
|
456
|
-
`,n([d({type:Number,attribute:"match-min"})],ee.prototype,"matchMin",2),n([d({type:Number,attribute:"match-max"})],ee.prototype,"matchMax",2),n([d({type:Boolean,attribute:"fixed"})],ee.prototype,"fixed",2),ee=n([h("qti-simple-associable-choice")],ee);var Gt=f`
|
|
457
|
-
slot:not([hidden]) {
|
|
458
|
-
/* slot where the */
|
|
459
|
-
display: flex;
|
|
460
|
-
flex-direction: column;
|
|
461
|
-
gap: 0.5rem;
|
|
462
|
-
align-items: flex-start; /* prevents the drag and drop container slots having the same height */
|
|
463
|
-
}
|
|
464
|
-
:host(.qti-choices-top) slot {
|
|
465
|
-
flex-direction: column;
|
|
466
|
-
}
|
|
467
|
-
:host(.qti-choices-bottom) slot {
|
|
468
|
-
flex-direction: column-reverse;
|
|
469
|
-
}
|
|
470
|
-
:host(.qti-choices-left) slot {
|
|
471
|
-
flex-direction: row;
|
|
472
|
-
}
|
|
473
|
-
:host(.qti-choices-right) slot {
|
|
474
|
-
flex-direction: row-reverse;
|
|
475
|
-
}
|
|
476
|
-
slot[name='prompt'] {
|
|
477
|
-
display: block;
|
|
478
|
-
}
|
|
479
|
-
::slotted(qti-simple-match-set) {
|
|
480
|
-
/* Make sure the drag and drop container slots have the same width */
|
|
481
|
-
flex: 1;
|
|
482
|
-
}
|
|
483
|
-
`;var U=class extends H(x,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=[];this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,i=t.value,r=t.name,a=t.type;t.checked?(this.value?this.value.indexOf(i)===-1&&(a==="radio"&&(this.value=this.value.filter(s=>s.indexOf(r)===-1)),this.value=[...this.value,i]):this.value=[i],this.lastCheckedRadio=t):(this.value=this.value.filter(s=>s!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.value)?[...this.value]:this.value}}))}}get value(){return this.classList.contains("qti-match-tabular")?this._response:super.value}set value(e){this.classList.contains("qti-match-tabular")?this._response=e:super.value=e}async connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.value=[]}set correctResponse(e){if(e===""){this.correctOptions=[];return}else Array.isArray(e)&&(this.correctOptions=e)}render(){let e=this.class.split(" ").includes("qti-match-tabular");return u`
|
|
484
|
-
<slot name="prompt"></slot>
|
|
485
|
-
<slot ?hidden=${e}></slot>
|
|
486
|
-
|
|
487
|
-
${e?u`
|
|
488
|
-
<table>
|
|
489
|
-
<tr>
|
|
490
|
-
<td></td>
|
|
491
|
-
${this.cols.map(t=>u`<th part="r-header">${G(t.innerHTML)}</th>`)}
|
|
492
|
-
</tr>
|
|
493
|
-
|
|
494
|
-
${this.rows.map(t=>u`<tr>
|
|
495
|
-
<td part="c-header">${G(t.innerHTML)}</td>
|
|
496
|
-
${this.cols.map(i=>{let r=t.getAttribute("identifier"),a=i.getAttribute("identifier"),s=`${r} ${a}`,l=this.value.filter(b=>b.split(" ")[0]===r).length||0,p=this.value.includes(s),m=`rb ${p?"rb-checked":""} ${this.correctOptions.includes(s)?"rb-correct":""}`,g=this.correctOptions.length>0?!0:t.matchMax===1?!1:l>=t.matchMax&&!p;return u`<td>
|
|
497
|
-
<input
|
|
498
|
-
type=${t.matchMax===1?"radio":"checkbox"}
|
|
499
|
-
part=${m}
|
|
500
|
-
name=${r}
|
|
501
|
-
value=${s}
|
|
502
|
-
.disabled=${g}
|
|
503
|
-
@change=${b=>this.handleRadioChange(b)}
|
|
504
|
-
@click=${b=>t.matchMax===1?this.handleRadioClick(b):null}
|
|
505
|
-
/>
|
|
506
|
-
</td>`})}
|
|
507
|
-
</tr>`)}
|
|
508
|
-
</table>
|
|
509
|
-
`:R}
|
|
510
|
-
|
|
511
|
-
<div role="alert" id="validationMessage"></div>
|
|
512
|
-
`}};U.styles=Gt,n([d({type:String})],U.prototype,"class",2),n([E()],U.prototype,"_response",2),n([d({type:String,attribute:"response-identifier"})],U.prototype,"responseIdentifier",2),n([E()],U.prototype,"correctOptions",2),U=n([h("qti-match-interaction")],U);var Ve=class extends x{constructor(){super();this._value=0}reset(){}validate(){return!0}get value(){return this._value.toString()}set value(e){if(!isNaN(parseInt(e.toString())))this._value=parseInt(e.toString());else throw new Error("Value must be a number")}static get properties(){return{...x.properties,step:{type:Number,attribute:"step",default:10}}}render(){return u` <slot name="prompt"></slot>
|
|
513
|
-
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};Ve.styles=[f``],Ve=n([h("qti-media-interaction")],Ve);var Qt=f`
|
|
514
|
-
[part='drags'] {
|
|
515
|
-
display: flex;
|
|
516
|
-
align-items: flex-start;
|
|
517
|
-
flex: 1;
|
|
518
|
-
border: 2px solid transparent;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
[part='drops'] {
|
|
522
|
-
flex: 1;
|
|
523
|
-
display: grid;
|
|
524
|
-
grid-auto-flow: column;
|
|
525
|
-
grid-auto-columns: 1fr;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
:host([orientation='horizontal']) [part='drags'] {
|
|
529
|
-
flex-direction: row;
|
|
530
|
-
}
|
|
531
|
-
:host([orientation='horizontal']) [part='drops'] {
|
|
532
|
-
grid-auto-flow: column;
|
|
533
|
-
}
|
|
534
|
-
:host([orientation='vertical']) [part='drags'] {
|
|
535
|
-
flex-direction: column;
|
|
536
|
-
}
|
|
537
|
-
:host([orientation='vertical']) [part='drops'] {
|
|
538
|
-
grid-auto-flow: row;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
[part='drop-list'] {
|
|
542
|
-
display: block;
|
|
543
|
-
flex: 1;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
[part='container'] {
|
|
547
|
-
display: flex;
|
|
548
|
-
gap: 0.5rem;
|
|
549
|
-
}
|
|
550
|
-
:host(.qti-choices-top) [part='container'] {
|
|
551
|
-
flex-direction: column;
|
|
552
|
-
}
|
|
553
|
-
:host(.qti-choices-bottom) [part='container'] {
|
|
554
|
-
flex-direction: column-reverse;
|
|
555
|
-
}
|
|
556
|
-
:host(.qti-choices-left) [part='container'] {
|
|
557
|
-
flex-direction: row;
|
|
558
|
-
}
|
|
559
|
-
:host(.qti-choices-right) [part='container'] {
|
|
560
|
-
flex-direction: row-reverse;
|
|
561
|
-
}
|
|
562
|
-
`;var B=class extends je(H(x,"qti-simple-choice","drop-list","slot[part='drags']"),"qti-simple-choice"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),u` <slot name="prompt"> </slot>
|
|
563
|
-
<div part="container">
|
|
564
|
-
<slot part="drags"> </slot>
|
|
565
|
-
<div part="drops">
|
|
566
|
-
${Array.from(Array(this.nrChoices)).map((t,i)=>u`<drop-list part="drop-list" identifier="droplist${i}"></drop-list>${this.showCorrectResponses&&this.correctResponses.length>i?G(`<span part='correct-response'>${this.correctResponses[i]}</span>`):""}`)}
|
|
567
|
-
</div>
|
|
568
|
-
</div>`}set correctResponse(e){if(e===""){this.showCorrectResponses=!1;return}this.correctResponses.length===0&&(Array.isArray(e)?e:[e]).forEach(i=>{let r=this.querySelector(`qti-simple-choice[identifier="${i}"]`);r||(r=this.shadowRoot.querySelector(`qti-simple-choice[identifier="${i}"]`));let a=r?.textContent.trim();this.correctResponses=[...this.correctResponses,a]}),this.showCorrectResponses=!0}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let r=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(r).map(s=>s.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(t=>t.setAttribute("part","qti-simple-choice"))}};B.styles=Qt,n([E()],B.prototype,"nrChoices",2),n([E()],B.prototype,"correctResponses",2),n([E()],B.prototype,"showCorrectResponses",2),n([d({type:String})],B.prototype,"orientation",2),B=n([h("qti-order-interaction")],B);var se=class extends x{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,t)=>{e=this.removeDoubleSlashes(e);try{let i=await fetch(e);if(i.ok){let a=await i.json();for(let s in a.paths)t&&(a.paths[s]=this.getResolvablePath(a.paths[s],t));return a}}catch{}return null};this.getResolvablePathString=(e,t)=>(e=e.replace(/\.js$/,""),e?.toLocaleLowerCase().startsWith("http")||!t?e:this.removeDoubleSlashes(`${t}/${e}`));this.getResolvablePath=(e,t)=>Array.isArray(e)?e.map(i=>this.getResolvablePathString(i,t)):this.getResolvablePathString(e,t)}convertQtiVariableJSON(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t];if(i){for(let r in i)if(i.hasOwnProperty(r)){let a=i[r];if(Array.isArray(a))return a.map(String);if(a!=null)return String(a)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),t=this.pci.getResponse(),i=JSON.stringify(e);if(i!==this.rawResponse){this.rawResponse=i;let r=this.convertQtiVariableJSON(t);this.value=r,this.saveResponse(r)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set value(e){}get value(){return this.rawResponse}getTAOConfig(e){let t=e.querySelectorAll("properties"),i={},r=s=>{let l={},p=s.getAttribute("key");if(p){let m=Array.from(s.children),g=m.map(y=>y.getAttribute("key"));g.length>0&&!g.find(y=>!Number.isInteger(+y))?l[p]=m.map(y=>a(y)):l[p]=s.textContent}return l},a=s=>{if(s){let l={};for(let p of s.children)l={...l,...r(p)};return l}};for(let s of t)return s.getAttribute("key")||(i={...i,...a(s)}),i;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=e;let t=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",i=t=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.classList.add("qti-customInteraction"),t=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let r=t=="IMS"?{properties:this.dataset,onready:()=>{console.log("onready")}}:this.getTAOConfig(this);t=="IMS"?e.getInstance(i,r,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,r),t=="TAO"&&Array.from(this.querySelectorAll("link")).map(s=>s.getAttribute("href")).forEach(s=>{let l=document.createElement("link");l.rel="stylesheet",l.type="text/css",l.media="screen",l.href=s,i.appendChild(l)}),this.startChecking()}connectedCallback(){super.connectedCallback(),define("qtiCustomInteractionContext",()=>({register:i=>{this.register(i)},notifyReady:()=>{}}));let e=this.buildRequireConfig();requirejs.config(e)(["require"],i=>{i([this.module])})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.stopChecking()}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:window.requirePaths||{},shim:window.requireShim||{}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let t=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let r=i.querySelectorAll("qti-interaction-module");for(let a of r){let s=a.getAttribute("id"),l=a.getAttribute("primary-path"),p=a.getAttribute("fallback-path");if(s&&l){let m=p?this.combineRequireResolvePaths(this.getResolvablePath(l,t),this.getResolvablePath(p,t)):this.getResolvablePath(l,t),g=e.paths[s]||[];e.paths[s]=this.combineRequireResolvePaths(g,m)}}}return e}combineRequireResolvePaths(e,t){let i=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t];return i.concat(r)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return u`<slot></slot>${this._errorMessage&&u`<div style="color:red">
|
|
569
|
-
<h1>Error</h1>
|
|
570
|
-
${this._errorMessage}
|
|
571
|
-
</div>`}`}};n([d({type:String,attribute:"module"})],se.prototype,"module",2),n([d({type:String,attribute:"custom-interaction-type-identifier"})],se.prototype,"customInteractionTypeIdentifier",2),n([E()],se.prototype,"_errorMessage",2),se=n([h("qti-portable-custom-interaction")],se);var Je=class extends v{render(){return u`<slot></slot>`}};Je.styles=[f`
|
|
572
|
-
:host {
|
|
573
|
-
display: block;
|
|
574
|
-
}
|
|
575
|
-
::slotted(img) {
|
|
576
|
-
position: absolute;
|
|
577
|
-
cursor: move;
|
|
578
|
-
user-select: none;
|
|
579
|
-
left: 50%;
|
|
580
|
-
transform: translateX(-50%);
|
|
581
|
-
}
|
|
582
|
-
`];customElements.define("qti-position-object-interaction",Je);var He=class extends v{render(){return u`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(o){o.preventDefault();let e=o.clientX-this.startX,t=o.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+t+"px",this.startX=o.clientX,this.startY=o.clientY}firstUpdated(o){super.firstUpdated(o),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};He.styles=[f`
|
|
583
|
-
:host {
|
|
584
|
-
display: inline-block;
|
|
585
|
-
position: relative;
|
|
586
|
-
}
|
|
587
|
-
`],He=n([h("qti-position-object-stage")],He);var ei="important",ui=" !"+ei,ti=j(class extends le{constructor(c){if(super(c),c.type!==ae.ATTRIBUTE||c.name!=="style"||c.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(c){return Object.keys(c).reduce((o,e)=>{let t=c[e];return t==null?o:o+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(c,[o]){let{style:e}=c.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(o)),this.render(o);for(let t of this.ft)o[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in o){let i=o[t];if(i!=null){this.ft.add(t);let r=typeof i=="string"&&i.endsWith(ui);t.includes("-")||r?e.setProperty(t,r?i.slice(0,-11):i,r?ei:""):e[t]=i}}return ne}});var te=class extends x{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this._points=[];this._imgElement=null;this._onImageClick=e=>{if(this._points.length<this.maxChoices){let t=e.offsetX,i=e.offsetY;this._points=[...this._points,`${t} ${i}`],this.saveResponse(this._points)}}}render(){return u` <slot name="prompt"></slot>
|
|
588
|
-
<point-container>
|
|
589
|
-
${We(this._points,e=>e,(e,t)=>u`
|
|
590
|
-
<button
|
|
591
|
-
part="point"
|
|
592
|
-
style=${ti({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
|
|
593
|
-
aria-label="Remove point at ${e}"
|
|
594
|
-
@click=${i=>{i.stopPropagation(),this._points=this._points.filter((r,a)=>a!==t),this.saveResponse(this._points)}}
|
|
595
|
-
></button>
|
|
596
|
-
`)}
|
|
597
|
-
<slot></slot>
|
|
598
|
-
</point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set value(e){this._points=Array.isArray(e)?e:[e]}get value(){return this._points}firstUpdated(){this._imgElement=this.querySelector("img"),this._imgElement?this._imgElement.addEventListener("click",this._onImageClick):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),this._imgElement&&this._imgElement.removeEventListener("click",this._onImageClick)}};te.styles=[f`
|
|
599
|
-
:host {
|
|
600
|
-
display: block;
|
|
601
|
-
}
|
|
602
|
-
point-container {
|
|
603
|
-
display: block;
|
|
604
|
-
position: relative;
|
|
605
|
-
}
|
|
606
|
-
`],n([d({type:Number,attribute:"max-choices"})],te.prototype,"maxChoices",2),n([d({type:Number,attribute:"min-choices"})],te.prototype,"minChoices",2),n([E()],te.prototype,"_points",2),te=n([h("qti-select-point-interaction")],te);var ve=class extends N(v,"qti-simple-choice"){get checked(){return this.internals.states.has("--checked")}render(){return u`<div part="ch">
|
|
607
|
-
<div part="cha"></div>
|
|
608
|
-
</div>
|
|
609
|
-
${this.marker?u`<div id="label">${this.marker}</div>`:R}
|
|
610
|
-
<slot part="slot"></slot> `}};ve.styles=f`
|
|
611
|
-
:host {
|
|
612
|
-
display: flex;
|
|
613
|
-
align-items: center;
|
|
614
|
-
user-select: none;
|
|
615
|
-
}
|
|
616
|
-
slot {
|
|
617
|
-
width: 100%;
|
|
618
|
-
display: flex;
|
|
619
|
-
align-items: center;
|
|
620
|
-
}
|
|
621
|
-
[part='ch'] {
|
|
622
|
-
display: flex;
|
|
623
|
-
flex-shrink: 0;
|
|
624
|
-
align-items: center;
|
|
625
|
-
justify-content: center;
|
|
626
|
-
}
|
|
627
|
-
`,n([d({type:String,attribute:!1})],ve.prototype,"marker",2),ve=n([h("qti-simple-choice")],ve);var ii=f`
|
|
628
|
-
:host {
|
|
629
|
-
display: block;
|
|
630
|
-
--show-bounds: true;
|
|
631
|
-
--show-ticks: true;
|
|
632
|
-
--show-value: true;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
[part='slider'] {
|
|
636
|
-
margin-left: 2rem; /* mx-8 */
|
|
637
|
-
margin-right: 2rem;
|
|
638
|
-
padding-bottom: 1rem; /* pb-4 */
|
|
639
|
-
padding-top: 1.25rem; /* pt-5 */
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
[part='bounds'] {
|
|
643
|
-
display: flex;
|
|
644
|
-
width: 100%;
|
|
645
|
-
justify-content: space-between;
|
|
646
|
-
margin-bottom: 0.5rem; /* mb-2 */
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
[part='ticks'] {
|
|
650
|
-
margin-left: 0.125rem; /* mx-0.5 */
|
|
651
|
-
margin-right: 0.125rem;
|
|
652
|
-
margin-bottom: 0.25rem; /* mb-1 */
|
|
653
|
-
height: 0.5rem; /* h-2 */
|
|
654
|
-
background: linear-gradient(to right, var(--qti-border-color) var(--qti-border-thickness), transparent 1px) repeat-x
|
|
655
|
-
0 center / calc(calc(100% - var(--qti-border-thickness)) / ((var(--max) - var(--min)) / var(--step))) 100%;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
[part='rail'] {
|
|
659
|
-
display: flex;
|
|
660
|
-
align-items: center;
|
|
661
|
-
box-sizing: border-box;
|
|
662
|
-
height: 0.375rem; /* h-1.5 */
|
|
663
|
-
width: 100%;
|
|
664
|
-
cursor: pointer;
|
|
665
|
-
border-radius: 9999px; /* rounded-full */
|
|
666
|
-
border: 1px solid #d1d5db; /* border-gray-300 */
|
|
667
|
-
background-color: #e5e7eb; /* bg-gray-200 */
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
[part='knob'] {
|
|
671
|
-
background-color: var(--qti-bg-active);
|
|
672
|
-
border: 2px solid var(--qti-border-active);
|
|
673
|
-
position: relative;
|
|
674
|
-
height: 1rem; /* h-4 */
|
|
675
|
-
width: 1rem; /* w-4 */
|
|
676
|
-
transform-origin: center;
|
|
677
|
-
transform: translateX(-50%);
|
|
678
|
-
cursor: pointer;
|
|
679
|
-
border-radius: 9999px; /* rounded-full */
|
|
680
|
-
left: var(--value-percentage);
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
[part='value'] {
|
|
684
|
-
position: absolute;
|
|
685
|
-
bottom: 2rem; /* bottom-8 */
|
|
686
|
-
left: 0.5rem; /* left-2 */
|
|
687
|
-
transform: translateX(-50%);
|
|
688
|
-
cursor: pointer;
|
|
689
|
-
border-radius: 0.25rem; /* rounded */
|
|
690
|
-
background-color: #f3f4f6; /* bg-gray-100 */
|
|
691
|
-
padding: 0.25rem 0.5rem; /* px-2 py-1 */
|
|
692
|
-
text-align: center;
|
|
693
|
-
color: #6b7280; /* text-gray-500 */
|
|
694
|
-
}
|
|
695
|
-
`;var $=class extends v{constructor(){super();this._value=0;this.min=0;this.max=100;this.step=1;this._internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),this._updateValue(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get value(){return this._value.toString()}set value(e){let t=parseInt(e,10);isNaN(t)||this._updateValue(t)}_updateValue(e){this._value=Math.min(this.max,Math.max(this.min,e));let t=(this._value-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${t}%`),this._internals.setFormValue(this.value),this.requestUpdate()}render(){return u`
|
|
696
|
-
<slot name="prompt"></slot>
|
|
697
|
-
<div id="slider" part="slider">
|
|
698
|
-
<div id="bounds" part="bounds">
|
|
699
|
-
<div>${this.min}</div>
|
|
700
|
-
<div>${this.max}</div>
|
|
701
|
-
</div>
|
|
702
|
-
|
|
703
|
-
<div id="ticks" part="ticks"></div>
|
|
704
|
-
|
|
705
|
-
<div id="rail" part="rail" @mousedown=${this._onMouseDown} @touchstart=${this._onTouchStart}>
|
|
706
|
-
<div id="knob" part="knob"><div id="value" part="value">${this.value}</div></div>
|
|
707
|
-
</div>
|
|
708
|
-
</div>
|
|
709
|
-
`}_onMouseDown(e){this._startDrag(e.pageX);let t=r=>this._onDrag(r.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this._onDragEnd()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}_onTouchStart(e){this._startDrag(e.touches[0].pageX);let t=r=>this._onDrag(r.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this._onDragEnd()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}_startDrag(e){this._onDrag(e)}_onDrag(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,r=Math.min(1,Math.max(0,i/t.width)),a=this.min+Math.round(r*(this.max-this.min)/this.step)*this.step;this._updateValue(a)}_onDragEnd(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};$.formAssociated=!0,$.styles=ii,n([Ye("#rail")],$.prototype,"_rail",2),n([d({type:Number,attribute:"lower-bound"})],$.prototype,"min",2),n([d({type:Number,attribute:"upper-bound"})],$.prototype,"max",2),n([d({type:Number,attribute:"step"})],$.prototype,"step",2),$=n([h("qti-slider-interaction")],$);var ri=()=>new pt,pt=class{},ct=new WeakMap,Ia=j(class extends It{render(c){return R}update(c,[o]){let e=o!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=o,this.ht=c.options?.host,this.rt(this.ct=c.element)),R}rt(c){if(this.isConnected||(c=void 0),typeof this.Y=="function"){let o=this.ht??globalThis,e=ct.get(o);e===void 0&&(e=new WeakMap,ct.set(o,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,c),c!==void 0&&this.Y.call(this.ht,c)}else this.Y.value=c}get lt(){return typeof this.Y=="function"?ct.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var si=f`
|
|
710
|
-
:host {
|
|
711
|
-
display: inline-block;
|
|
712
|
-
}
|
|
713
|
-
[part='correct'] {
|
|
714
|
-
position: absolute;
|
|
715
|
-
width: 100%;
|
|
716
|
-
}
|
|
717
|
-
:host(.qti-input-width-1) [part='input'] {
|
|
718
|
-
width: 1.1rem;
|
|
719
|
-
min-width: 1.1rem;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
:host(.qti-input-width-2) [part='input'] {
|
|
723
|
-
width: 2.3rem;
|
|
724
|
-
min-width: 2.3rem;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
:host(.qti-input-width-3) [part='input'] {
|
|
728
|
-
width: 3.3rem;
|
|
729
|
-
min-width: 3.3rem;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
:host(.qti-input-width-4) [part='input'] {
|
|
733
|
-
width: 4.2rem;
|
|
734
|
-
min-width: 4.2rem;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
:host(.qti-input-width-6) [part='input'] {
|
|
738
|
-
width: 6.6rem;
|
|
739
|
-
min-width: 6.6rem;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
:host(.qti-input-width-10) [part='input'] {
|
|
743
|
-
width: 8rem;
|
|
744
|
-
min-width: 8rem;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
:host(.qti-input-width-15) [part='input'] {
|
|
748
|
-
width: 12rem;
|
|
749
|
-
min-width: 12rem;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
:host(.qti-input-width-20) [part='input'] {
|
|
753
|
-
width: 17rem;
|
|
754
|
-
min-width: 17rem;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
:host(.qti-input-width-25) [part='input'] {
|
|
758
|
-
width: 20rem;
|
|
759
|
-
min-width: 20rem;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
:host(.qti-input-width-30) [part='input'] {
|
|
763
|
-
width: 24rem;
|
|
764
|
-
min-width: 24rem;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
:host(.qti-input-width-35) [part='input'] {
|
|
768
|
-
width: 28rem;
|
|
769
|
-
min-width: 28rem;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
:host(.qti-input-width-40) [part='input'] {
|
|
773
|
-
width: 32rem;
|
|
774
|
-
min-width: 32rem;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
:host(.qti-input-width-45) [part='input'] {
|
|
778
|
-
width: 36rem;
|
|
779
|
-
min-width: 36rem;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
:host(.qti-input-width-50) [part='input'] {
|
|
783
|
-
width: 40rem;
|
|
784
|
-
min-width: 40rem;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
:host(.qti-input-width-72) [part='input'] {
|
|
788
|
-
width: 57rem;
|
|
789
|
-
min-width: 57rem;
|
|
790
|
-
}
|
|
791
|
-
`;var O=class extends x{constructor(){super(...arguments);this._value="";this.inputRef=ri()}get value(){return this._value||null}set value(e){if(typeof e=="string"||e===null){this._value=e||"";let t=new FormData;t.append(this.responseIdentifier,this._value),this._internals.setFormValue(t),this.validate()}else throw new Error("Value must be a string")}validate(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),e.setCustomValidity(""),e.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage));else{let t=e.checkValidity();this._internals.setValidity(t?{}:{customError:!1})}return this._value!==""&&e.checkValidity()}render(){return u`
|
|
792
|
-
<input
|
|
793
|
-
part="input"
|
|
794
|
-
name="${this.responseIdentifier}"
|
|
795
|
-
spellcheck="false"
|
|
796
|
-
autocomplete="off"
|
|
797
|
-
@blur="${e=>{this.reportValidity()}}"
|
|
798
|
-
@keydown="${e=>e.stopImmediatePropagation()}"
|
|
799
|
-
@keyup="${this.textChanged}"
|
|
800
|
-
@change="${this.textChanged}"
|
|
801
|
-
type="${this.patternMask=="[0-9]*"?"number":"text"}"
|
|
802
|
-
placeholder="${Z(this.placeholderText?this.placeholderText:void 0)}"
|
|
803
|
-
.value="${this._value}"
|
|
804
|
-
pattern="${Z(this.patternMask?this.patternMask:void 0)}"
|
|
805
|
-
maxlength=${1e3}
|
|
806
|
-
?disabled="${this.disabled}"
|
|
807
|
-
?readonly="${this.readonly}"
|
|
808
|
-
/>
|
|
809
|
-
<div part="correct">${this._correctResponse}</div>
|
|
810
|
-
`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let t=this.validate();return t||e.reportValidity(),t}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};O.styles=si,n([d({type:Number,attribute:"expected-length"})],O.prototype,"expectedLength",2),n([d({type:String,attribute:"pattern-mask"})],O.prototype,"patternMask",2),n([d({type:String,attribute:"placeholder-text"})],O.prototype,"placeholderText",2),n([d({type:String,attribute:"data-patternmask-message"})],O.prototype,"dataPatternmaskMessage",2),n([E()],O.prototype,"_value",2),O=n([h("qti-text-entry-interaction")],O);var Ne=class extends x{constructor(){super(...arguments);this._file=null;this._base64=null}reset(){this._file=null,this._base64=null,this.saveResponse(null)}validate(){return this._base64!==null}get value(){return this._base64}set value(e){if(typeof e=="string")this._base64=e,this.saveResponse(e);else if(e===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...x.properties}}render(){return u`
|
|
811
|
-
<div>
|
|
812
|
-
<slot name="prompt"></slot>
|
|
813
|
-
<input type="file" @change="${this._onFileChange}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
|
|
814
|
-
</div>
|
|
815
|
-
`}async _onFileChange(e){let t=e.target;t.files&&t.files.length>0&&(this._file=t.files[0],this._base64=await this._convertToBase64(this._file),this.saveResponse(this._base64),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this._base64}})))}_convertToBase64(e){return new Promise((t,i)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>i(r.error),r.readAsDataURL(e)})}};Ne.styles=[f`
|
|
816
|
-
:host {
|
|
817
|
-
display: block;
|
|
818
|
-
margin: 1em 0;
|
|
819
|
-
}
|
|
820
|
-
input[type='file'] {
|
|
821
|
-
display: block;
|
|
822
|
-
margin-top: 0.5em;
|
|
823
|
-
}
|
|
824
|
-
`],Ne=n([h("qti-upload-interaction")],Ne);var oi=f`
|
|
825
|
-
:host {
|
|
826
|
-
display: block;
|
|
827
|
-
}
|
|
828
|
-
`;var $e=class extends v{render(){return u`<slot name="qti-rubric-block"></slot><slot></slot>`}};$e.styles=oi,$e=n([h("qti-item-body")],$e);var Oe=class extends v{render(){return u`<slot></slot>`}process(){let o=new dt,e=[...this.children];o.process(e)}};Oe.styles=[f`
|
|
829
|
-
:host {
|
|
830
|
-
display: none;
|
|
831
|
-
}
|
|
832
|
-
`],Oe=n([h("qti-outcome-processing")],Oe);var dt=class{process(o){for(let e of o)e.process()}};var Ze=class extends v{render(){return u`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};Ze=n([h("qti-prompt")],Ze);var ni=`<qti-response-processing>
|
|
833
|
-
<qti-response-condition>
|
|
834
|
-
<qti-response-if>
|
|
835
|
-
<qti-match>
|
|
836
|
-
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
837
|
-
<qti-correct identifier="RESPONSE"></qti-correct>
|
|
838
|
-
</qti-match>
|
|
839
|
-
<qti-set-outcome-value identifier="SCORE">
|
|
840
|
-
<qti-base-value base-type="float">1</qti-base-value>
|
|
841
|
-
</qti-set-outcome-value>
|
|
842
|
-
</qti-response-if>
|
|
843
|
-
<qti-response-else>
|
|
844
|
-
<qti-set-outcome-value identifier="SCORE">
|
|
845
|
-
<qti-base-value base-type="float">0</qti-base-value>
|
|
846
|
-
</qti-set-outcome-value>
|
|
847
|
-
</qti-response-else>
|
|
848
|
-
</qti-response-condition>
|
|
849
|
-
</qti-response-processing>`,ai=`<qti-response-processing>
|
|
850
|
-
<qti-response-condition>
|
|
851
|
-
<qti-response-if>
|
|
852
|
-
<qti-is-null>
|
|
853
|
-
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
854
|
-
</qti-is-null>
|
|
855
|
-
<qti-set-outcome-value identifier="SCORE">
|
|
856
|
-
<qti-base-value base-type="float">0.0</qti-base-value>
|
|
857
|
-
</qti-set-outcome-value>
|
|
858
|
-
</qti-response-if>
|
|
859
|
-
<qti-response-else>
|
|
860
|
-
<qti-set-outcome-value identifier="SCORE">
|
|
861
|
-
<qti-map-response identifier="RESPONSE"> </qti-map-response>
|
|
862
|
-
</qti-set-outcome-value>
|
|
863
|
-
</qti-response-else>
|
|
864
|
-
</qti-response-condition>
|
|
865
|
-
</qti-response-processing>`,li=`<qti-response-processing>
|
|
866
|
-
<qti-response-condition>
|
|
867
|
-
<qti-response-if>
|
|
868
|
-
<qti-is-null>
|
|
869
|
-
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
870
|
-
</qti-is-null>
|
|
871
|
-
<qti-set-outcome-value identifier="SCORE">
|
|
872
|
-
<qti-base-value base-type="float">0</qti-base-value>
|
|
873
|
-
</qti-set-outcome-value>
|
|
874
|
-
</qti-response-if>
|
|
875
|
-
<qti-response-else>
|
|
876
|
-
<qti-set-outcome-value identifier="SCORE">
|
|
877
|
-
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
878
|
-
</qti-set-outcome-value>
|
|
879
|
-
</qti-response-else>
|
|
880
|
-
</qti-response-condition>
|
|
881
|
-
</qti-response-processing>`;var Ie=class extends v{render(){return u`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];for(let t of e)t.process()}firstUpdated(o){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":{this.appendChild(this.fragmentFromString(ai).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(li).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(ni).firstElementChild.firstElementChild);break}}}fragmentFromString(o){return document.createRange().createContextualFragment(o)}};Ie.styles=[f`
|
|
882
|
-
:host {
|
|
883
|
-
display: none;
|
|
884
|
-
}
|
|
885
|
-
`],Ie=n([h("qti-response-processing")],Ie);var I=class extends v{render(){return u`<slot></slot>`}process(){throw new Error("Not implemented")}};I=n([h("qti-rule")],I);var Ge=class extends I{get childExpression(){return this.firstElementChild}process(){let o=this.getAttribute("identifier"),e=this.closest("qti-assessment-item").getVariable(o),t;return e.interpolationTable&&(t=e.interpolationTable.get(parseInt(this.childExpression.calculate()))),t==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Ee(t)}})),t)}};n([d({type:String})],Ge.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",Ge);var ut=class extends I{render(){return u`<slot></slot>`}process(){let o=[...this.children];for(let e=0;e<o.length;e++){let t=o[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",ut);var ht=class extends I{process(){let o=this.getAttribute("identifier"),e=this.firstElementChild,i=new mt(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:o,value:Array.isArray(i)?i.map(r=>Ee(r)):Ee(i)}}))}},mt=class{constructor(o){this.expression=o}process(){let o=this.expression?this.expression.calculate():null;if(o==null){console.warn("setOutcomeValue: value is null or undefined");return}return o}};customElements.define("qti-set-outcome-value",ht);var Pe=class extends v{render(){return u`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let o=this.getSubRules();for(let e=0;e<o.length;e++)o[e].process()}};customElements.define("qti-response-else",Pe);var Fe=class extends Pe{calculate(){return this.firstElementChild.calculate()}getSubRules(){let o=[];for(let e=1;e<this.children.length;e++)o.push(this.children[e]);return o}};customElements.define("qti-response-if",Fe);var ft=class extends Fe{render(){return u`${super.render()}`}};customElements.define("qti-response-else-if",ft);var ci=class extends hi(V){calculate(){return this.calculateChildren(Array.from(this.children))}};function hi(c){return class extends c{calculateChildren(e){return e.map(i=>{let r=i;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let a=r.calculate(),s=!1;if(typeof a=="string")if(a==="true")s=!0;else if(a==="false")s=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof a=="boolean"&&(s=a);return s}).every(i=>typeof i=="boolean"&&i)}}}var Qe=class extends C{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};n([d({type:String,attribute:"base-type"})],Qe.prototype,"baseType",2);customElements.define("qti-base-value",Qe);var gt=class extends V{getResult(){let o=this.getVariables();if(this.children.length===2){let e=o[0],t=o[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,r=t.value;return i.filter(l=>r.includes(l)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",gt);var bt=class extends C{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let o=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===o)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",bt);var et=class extends C{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let r=parseFloat(t.value),a=parseFloat(i.value);if(!isNaN(r)&&!isNaN(a))return this.roundingMode==="significantFigures"?r.toPrecision(this.figures)===a.toPrecision(this.figures):Math.round(r*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(a*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${r}, ${a}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};n([d({type:String})],et.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",et);var A=class{static compareSingleValues(o,e,t){switch(t){case"identifier":case"string":return o===e;case"integer":{let i=parseInt(o,10),r=parseInt(e,10);if(!isNaN(i)&&!isNaN(r))return i===r;console.error(`Cannot convert ${o} and/or ${e} to int.`);break}case"float":{let i=parseFloat(o),r=parseFloat(e);if(!isNaN(i)&&!isNaN(r))return i===r;console.error(`couldn't convert ${o} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=o.split(" ").sort(),r=e.split(" ").sort();if(i.length===2&&r.length===2)return t==="pair"&&(i.sort(),r.sort()),i.join(" ")===r.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${o} 2: ${e}`);break}}return!1}};var tt=class extends C{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):A.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};n([d({type:String})],tt.prototype,"toleranceMode",2);customElements.define("qti-equal",tt);var vt=class extends C{getResult(){if(this.children.length===2){let o=this.getVariables(),e=o[0],t=o[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",vt);var yt=class extends V{getResult(){if(this.children.length===2){let o=this.getVariables(),e=o[0],t=o[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",yt);var xt=class extends C{getResult(){if(this.children.length===1){let o=this.getVariables();if(!o)return!0;let e=o[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",xt);var Et=class extends C{getResult(){if(this.children.length===2){let o=this.getVariables(),e=o[0],t=o[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",Et);var Ct=class extends V{getResult(){if(this.children.length===2){let o=this.getVariables(),e=o[0],t=o[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",Ct);var it=class extends C{getResult(){let o=this.context.variables.find(r=>r.identifier===this.identifier);if(!o)return console.warn(`Response ${this.identifier} can not be found`),null;let e=o.mapping,t=Array.isArray(o.value)?o.value:[o.value],i=0;for(let r of t){let a=e.mapEntries.find(s=>A.compareSingleValues(s.mapKey,r,o.baseType));a==null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};n([d({type:String})],it.prototype,"identifier",2);customElements.define("qti-map-response",it);var ye=class extends v{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};n([d({attribute:"default-value",type:Number})],ye.prototype,"defaultValue",2),n([d({attribute:"lower-bound",type:Number})],ye.prototype,"lowerBound",2),n([d({attribute:"upper-bound",type:Number})],ye.prototype,"upperBound",2);customElements.define("qti-mapping",ye);var qt=class c extends C{getResult(){if(this.children.length===2){let o=this.getVariables(),e=o[0],t=o[1];return c.match(e,t)}return console.error("unexpected number of children in match"),null}static match(o,e){switch(e.cardinality){case"single":return o.value===null?!1:Array.isArray(o.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):A.compareSingleValues(o.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(o.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(o.value.length!==e.value.length)return!1;for(let t=0;t<o.value.length;t++)if(!A.compareSingleValues(e.value[t],o.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(o.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(o.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let r=null,a=[...o.value];for(let s of a)if(A.compareSingleValues(i,s,e.baseType)){r=s;break}if(r!==null)a.splice(a.indexOf(r),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",qt);var wt=class extends C{getResult(){let o=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=o;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",wt);var Tt=class extends C{getResult(){let o=this.getVariables();if(o.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of o)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return o}};customElements.define("qti-multiple",Tt);var Mt=class extends C{render(){return u`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Mt);var St=class extends V{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),r=!1;if(typeof i=="string")if(i==="true")r=!0;else if(i==="false")r=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(r=i);return r}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",St);var _t=class extends C{getResult(){let o=this.getVariables();if(o.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of o)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return o}};customElements.define("qti-ordered",_t);var ze=class extends v{render(){let o=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return u`${JSON.stringify(o,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};n([d({type:String})],ze.prototype,"identifier",2),n([D({context:L,subscribe:!0}),E()],ze.prototype,"context",2);customElements.define("qti-printed-variable",ze);var kt=class extends C{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseInt(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",kt);var rt=class extends mi(C){getResult(){return this.calculateChildren(Array.from(this.children))}};function mi(c){return class extends c{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=i.calculate();return Number.isNaN(r)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(r)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",rt);var st=class extends C{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let r=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),a=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return A.compareSingleValues(r,a,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};n([d({type:String,attribute:"case-sensitive"})],st.prototype,"caseSensitive",2);customElements.define("qti-string-match",st);var Rt=class extends C{constructor(){super(),this._expression=new Lt(Array.from(this.children))}getResult(){return this._expression.calculate()}},Lt=class{constructor(o){this.expressions=o}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let t=e.calculate();return Number.isNaN(t)?(console.error("unexpected value in qti-sum, expected number"),null):Number(t)}).reduce((e,t)=>e+t,0)}};customElements.define("qti-sum",Rt);var At=class extends C{getResult(){let o=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===o).value}};customElements.define("qti-variable",At);var ot=class extends v{render(){return u`<slot></slot>`}};ot=n([h("qti-content-body")],ot);var P=class extends v{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return u`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};P.styles=f`
|
|
886
|
-
:host {
|
|
887
|
-
display: block;
|
|
888
|
-
}
|
|
889
|
-
`,n([d({type:String})],P.prototype,"id",2),n([d({type:String})],P.prototype,"use",2),n([d({type:String})],P.prototype,"view",2),n([d({type:String,attribute:"class"})],P.prototype,"classNames",2),n([M("classNames",{waitUntilFirstUpdate:!0})],P.prototype,"handleclassNamesChange",1),P=n([h("qti-rubric-block")],P);var nt=class extends v{constructor(){super(...arguments);this.styleElement=null}firstUpdated(e){super.firstUpdated(e);let t=this.getAttribute("href");if(t!==null&&fetch(t).then(i=>i.text()).then(i=>{let r=this.minifyCss(i);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=this.minifyCss(this.textContent);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}}minifyCss(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.styleElement)try{this.styleElement.remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};nt=n([h("qti-stylesheet")],nt);var ie=class extends v{render(){return u`<slot></slot>`}defaultValues(o){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(i=>i.innerHTML.trim());return t.length>1||o.cardinality==="multiple"||o.cardinality==="ordered"?t:t[0]}};ie=n([h("qti-variabledeclaration")],ie);var F=class extends ie{constructor(){super(...arguments);this.externalScored=null}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return u`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let i of e.querySelectorAll("qti-interpolation-table-entry")){!i.getAttribute("source-value")&&i.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let r=parseInt(i.getAttribute("source-value")),a=parseInt(i.getAttribute("target-value"));(isNaN(r)||isNaN(a))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(r,a)}return t}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};F.styles=[f`
|
|
890
|
-
:host {
|
|
891
|
-
display: none;
|
|
892
|
-
}
|
|
893
|
-
`],n([d({type:String,attribute:"base-type"})],F.prototype,"baseType",2),n([d({type:String,attribute:"external-scored"})],F.prototype,"externalScored",2),n([d({type:String})],F.prototype,"identifier",2),n([d({type:String})],F.prototype,"cardinality",2),n([D({context:L,subscribe:!0}),E()],F.prototype,"itemContext",2),F=n([h("qti-outcome-declaration")],F);var X=class extends ie{render(){let o=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return u`${JSON.stringify(o,null,2)}`}connectedCallback(){super.connectedCallback();let o={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};o.value=this.defaultValues(o),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:o}}))}get correctResponse(){let o,e=this.querySelector("qti-correct-response");if(e){let t=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&t.length>0)o=t[0].textContent,t[0].remove();else if(this.cardinality!=="single"){o=[];for(let i=0;i<t.length;i++)o.push(t[i].textContent),t[i].remove()}}return o}get mapping(){return this.querySelector("qti-mapping")}};X.styles=[f`
|
|
894
|
-
:host {
|
|
895
|
-
display: none;
|
|
896
|
-
}
|
|
897
|
-
`],n([d({type:String,attribute:"base-type"})],X.prototype,"baseType",2),n([d({type:String})],X.prototype,"identifier",2),n([d({type:String})],X.prototype,"cardinality",2),n([D({context:L,subscribe:!0}),E()],X.prototype,"itemContext",2),X=n([h("qti-response-declaration")],X);export{S as a,pe as b,Xe as c,xe as d,qe as e,we as f,Te as g,Me as h,de as i,ue as j,z as k,J as l,k as m,he as n,Se as o,me as p,fe as q,Y as r,_e as s,ke as t,be as u,Re as v,Ke as w,Le as x,Q as y,De as z,ee as A,U as B,Ve as C,B as D,se as E,Je as F,He as G,te as H,ve as I,$ as J,O as K,Ne as L,$e as M,Oe as N,dt as O,Ze as P,Ie as Q,I as R,Ge as S,ut as T,ht as U,mt as V,Pe as W,Fe as X,ft as Y,ci as Z,hi as _,Qe as $,gt as aa,bt as ba,et as ca,tt as da,vt as ea,yt as fa,xt as ga,Et as ha,Ct as ia,it as ja,ye as ka,qt as la,wt as ma,Tt as na,Mt as oa,St as pa,_t as qa,ze as ra,kt as sa,rt as ta,mi as ua,st as va,Rt as wa,Lt as xa,At as ya,ot as za,P as Aa,nt as Ba,F as Ca,X as Da};
|
|
898
|
-
/*! Bundled license information:
|
|
899
|
-
|
|
900
|
-
lit-html/node/directives/if-defined.js:
|
|
901
|
-
(**
|
|
902
|
-
* @license
|
|
903
|
-
* Copyright 2018 Google LLC
|
|
904
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
905
|
-
*)
|
|
906
|
-
|
|
907
|
-
lit-html/node/directives/repeat.js:
|
|
908
|
-
(**
|
|
909
|
-
* @license
|
|
910
|
-
* Copyright 2017 Google LLC
|
|
911
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
912
|
-
*)
|
|
913
|
-
|
|
914
|
-
lit-html/node/directives/unsafe-html.js:
|
|
915
|
-
(**
|
|
916
|
-
* @license
|
|
917
|
-
* Copyright 2017 Google LLC
|
|
918
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
919
|
-
*)
|
|
920
|
-
|
|
921
|
-
lit-html/node/directives/style-map.js:
|
|
922
|
-
(**
|
|
923
|
-
* @license
|
|
924
|
-
* Copyright 2018 Google LLC
|
|
925
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
926
|
-
*)
|
|
927
|
-
|
|
928
|
-
lit-html/node/directives/ref.js:
|
|
929
|
-
(**
|
|
930
|
-
* @license
|
|
931
|
-
* Copyright 2020 Google LLC
|
|
932
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
933
|
-
*)
|
|
934
|
-
*/
|