@cimplify/sdk 0.108.0 → 0.110.2
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/LICENSE +21 -0
- package/dist/advanced.d.mts +4 -3
- package/dist/advanced.d.ts +4 -3
- package/dist/advanced.js +24 -24
- package/dist/advanced.mjs +5 -5
- package/dist/animation-4EXBXRVX.js +27 -0
- package/dist/animation-6DICNWUP.mjs +6 -0
- package/dist/audio-DhvyjqdA.d.mts +249 -0
- package/dist/audio-m0w8cnxq.d.ts +249 -0
- package/dist/avatars.d.mts +110 -0
- package/dist/avatars.d.ts +110 -0
- package/dist/avatars.js +82 -0
- package/dist/avatars.mjs +5 -0
- package/dist/backend-gUCzs5Kg.d.mts +3866 -0
- package/dist/backend-gUCzs5Kg.d.ts +3866 -0
- package/dist/{catalogue-B4eLL8Mi.d.ts → catalogue-CPTMyBUz.d.mts} +109 -221
- package/dist/catalogue-DzrTXP3v.d.mts +541 -0
- package/dist/catalogue-DzrTXP3v.d.ts +541 -0
- package/dist/{catalogue-OT89_Ifs.d.mts → catalogue-OTuS5zp-.d.ts} +109 -221
- package/dist/chunk-22BD3RHN.mjs +1809 -0
- package/dist/chunk-25T4JHEA.mjs +21 -0
- package/dist/chunk-2AQ237Y4.js +508 -0
- package/dist/chunk-2IC4H6OV.mjs +48 -0
- package/dist/chunk-2LHLG4OB.mjs +71 -0
- package/dist/chunk-2O2CG465.js +1709 -0
- package/dist/chunk-2Q4DTHXK.js +316 -0
- package/dist/chunk-2QTQ6BUH.mjs +46 -0
- package/dist/chunk-2UN4SFLR.mjs +100 -0
- package/dist/chunk-2V75I7K3.js +454 -0
- package/dist/chunk-2V7IL4HC.js +10 -0
- package/dist/chunk-34XBXUMW.js +296 -0
- package/dist/chunk-3C4C654I.js +71 -0
- package/dist/chunk-3DAD2LDF.mjs +72 -0
- package/dist/chunk-3GXH2NFD.mjs +4 -0
- package/dist/chunk-3O47ZFW3.js +961 -0
- package/dist/chunk-3OY3VYNF.mjs +11 -0
- package/dist/chunk-3S6WPBZL.js +2936 -0
- package/dist/chunk-3TUOUP5T.js +399 -0
- package/dist/chunk-3VEH23I5.mjs +1380 -0
- package/dist/chunk-3ZYSAW2T.mjs +263 -0
- package/dist/chunk-4ANVF274.js +103 -0
- package/dist/chunk-4C7I3ELN.js +388 -0
- package/dist/chunk-4DYKAYFO.mjs +8 -0
- package/dist/chunk-4ZDR72SG.js +329 -0
- package/dist/chunk-52YS45RR.js +1066 -0
- package/dist/chunk-5325XSCH.js +107 -0
- package/dist/chunk-5AD5X6AV.js +13 -0
- package/dist/chunk-5BYDGGWO.mjs +197 -0
- package/dist/chunk-5C3C7VDM.mjs +55 -0
- package/dist/chunk-5HFMY3D7.js +660 -0
- package/dist/chunk-5LH2QN3T.js +1862 -0
- package/dist/chunk-5PJEXSOW.js +44 -0
- package/dist/chunk-5SXDH3Y7.js +90 -0
- package/dist/chunk-5YFBGGCK.mjs +502 -0
- package/dist/chunk-5YWN6H5Q.mjs +133 -0
- package/dist/chunk-66QP3SMN.js +402 -0
- package/dist/chunk-6DAEZKIG.mjs +385 -0
- package/dist/chunk-6DATW7TB.mjs +420 -0
- package/dist/{chunk-JRGK3NXR.mjs → chunk-6ETDAU62.mjs} +72 -212
- package/dist/chunk-6H254EVP.mjs +178 -0
- package/dist/chunk-6PFNJPBJ.mjs +820 -0
- package/dist/chunk-6PJWXIFX.mjs +357 -0
- package/dist/chunk-6SWKWCMS.js +80 -0
- package/dist/chunk-6VVXXX7S.js +808 -0
- package/dist/chunk-6WUBSMTX.js +1403 -0
- package/dist/chunk-73SGZLAQ.mjs +35 -0
- package/dist/chunk-76L2V6KD.mjs +4 -0
- package/dist/chunk-7AAIAVAA.js +1531 -0
- package/dist/chunk-7ARSJPV3.mjs +93 -0
- package/dist/chunk-7BHW5GTC.mjs +1234 -0
- package/dist/chunk-7DQSDKDU.js +6 -0
- package/dist/chunk-7IQQQENP.mjs +401 -0
- package/dist/chunk-7KFTYENS.js +11357 -0
- package/dist/chunk-7SM6XSPZ.js +3171 -0
- package/dist/chunk-7SXOHAIR.mjs +28 -0
- package/dist/chunk-A2MAX6S4.js +90 -0
- package/dist/chunk-A33OORT7.mjs +1530 -0
- package/dist/{chunk-U6ACF76H.mjs → chunk-A36JRXXH.mjs} +1075 -1845
- package/dist/chunk-A7BU3BK4.js +52 -0
- package/dist/chunk-A7MQSN2V.mjs +77 -0
- package/dist/chunk-A7V4L2IT.mjs +416 -0
- package/dist/chunk-AABEK6XU.js +226 -0
- package/dist/chunk-AGV33FWC.mjs +5005 -0
- package/dist/chunk-AHNR3BXI.js +108 -0
- package/dist/chunk-AQ5RLBU2.mjs +286 -0
- package/dist/chunk-AQOE6WCG.js +1270 -0
- package/dist/chunk-ATAWRACV.mjs +62 -0
- package/dist/chunk-ATCURNUV.js +14 -0
- package/dist/chunk-AWPV33OO.js +6 -0
- package/dist/chunk-AYJPHKYV.js +337 -0
- package/dist/chunk-AZ5BGWHB.js +162 -0
- package/dist/chunk-AZAXD44P.js +1373 -0
- package/dist/chunk-BBGKQIJJ.mjs +406 -0
- package/dist/chunk-BP4JLSUA.js +1453 -0
- package/dist/{chunk-SUCE7FWA.mjs → chunk-BTUSVHIE.mjs} +539 -978
- package/dist/chunk-BU6OK542.mjs +818 -0
- package/dist/chunk-CVSRWM6W.js +418 -0
- package/dist/chunk-CYBMFMJD.mjs +247 -0
- package/dist/chunk-DDJLDOUX.mjs +217 -0
- package/dist/{chunk-V32BCG7M.js → chunk-DFZWHNRG.js} +75 -215
- package/dist/chunk-DJ2C7AVG.js +644 -0
- package/dist/chunk-DS2VU4WW.mjs +102 -0
- package/dist/chunk-DSAG7T5P.js +7290 -0
- package/dist/chunk-E2QPPH7I.js +327 -0
- package/dist/chunk-E65WCTIG.mjs +1187 -0
- package/dist/{chunk-33VCYWVL.mjs → chunk-E6QQKDNE.mjs} +30 -42
- package/dist/chunk-ECDK6QBF.mjs +981 -0
- package/dist/chunk-EIB4OWVQ.mjs +620 -0
- package/dist/chunk-EQUZYCGO.js +250 -0
- package/dist/chunk-F3UJ6ZRM.mjs +313 -0
- package/dist/chunk-F63N2ZTQ.js +7023 -0
- package/dist/chunk-F6XRYEM3.mjs +26 -0
- package/dist/chunk-FE6VCE4K.js +5030 -0
- package/dist/chunk-FLWD6GRR.js +1372 -0
- package/dist/chunk-FQBFWJBS.mjs +110 -0
- package/dist/chunk-FXVJ2HFU.js +26 -0
- package/dist/chunk-FZMQMQBW.js +312 -0
- package/dist/chunk-G3EEC44R.js +53 -0
- package/dist/{chunk-KG3WT4PR.mjs → chunk-GCKWKLZF.mjs} +73 -104
- package/dist/chunk-GCX7TY4D.mjs +6826 -0
- package/dist/chunk-GDB6TCSD.js +450 -0
- package/dist/chunk-GDCV4IWO.mjs +21 -0
- package/dist/chunk-GDZT5LZ5.js +170 -0
- package/dist/chunk-GHPUYD4I.mjs +213 -0
- package/dist/chunk-GHS6MIL6.mjs +1432 -0
- package/dist/chunk-GPS2THCL.mjs +11 -0
- package/dist/{chunk-EV2EVOYS.js → chunk-GTJWQAGU.js} +31 -42
- package/dist/chunk-GVTI6UJQ.mjs +130 -0
- package/dist/chunk-GXKI64OT.mjs +1138 -0
- package/dist/chunk-GYDYF2WX.js +275 -0
- package/dist/chunk-GYLP6UG4.mjs +705 -0
- package/dist/chunk-H3OQKK6X.js +1158 -0
- package/dist/chunk-H5DFSCJ6.js +40 -0
- package/dist/chunk-HAGEIC2L.mjs +186 -0
- package/dist/chunk-HAJ4JRFO.js +293 -0
- package/dist/chunk-HDR72GB6.js +188 -0
- package/dist/chunk-HF5HPS4T.mjs +40 -0
- package/dist/chunk-HK6LOFDS.js +218 -0
- package/dist/chunk-HMWYTXCY.mjs +143 -0
- package/dist/chunk-HPCSRCMA.js +89 -0
- package/dist/chunk-HSEO6TPU.js +247 -0
- package/dist/chunk-I5FOHCLH.js +132 -0
- package/dist/chunk-IDLW4NWA.mjs +85 -0
- package/dist/chunk-IIDZ5WUX.js +61 -0
- package/dist/chunk-IR74FJHU.js +2332 -0
- package/dist/chunk-IRVFYAKP.mjs +100 -0
- package/dist/{chunk-XBL3TMPC.mjs → chunk-IZDWAL53.mjs} +1795 -3287
- package/dist/chunk-J2KZXIU3.js +51 -0
- package/dist/chunk-J2U6PJSO.js +91 -0
- package/dist/chunk-J5AJNY2N.js +283 -0
- package/dist/chunk-J6KQZ4FO.mjs +821 -0
- package/dist/{chunk-OWW5GUSB.js → chunk-JGBCIKJV.js} +7 -6
- package/dist/chunk-JKGTBMU7.mjs +25 -0
- package/dist/chunk-JR3TNEQC.js +422 -0
- package/dist/chunk-JURRXY2J.mjs +29 -0
- package/dist/chunk-K3HW5I2A.mjs +317 -0
- package/dist/chunk-K46SMZ66.mjs +103 -0
- package/dist/chunk-K4UDGE3Z.mjs +6 -0
- package/dist/chunk-KDQOR4QQ.mjs +350 -0
- package/dist/chunk-KDTVOLHI.mjs +288 -0
- package/dist/chunk-KGHJH5KJ.mjs +35 -0
- package/dist/chunk-KIZOA5LX.mjs +140 -0
- package/dist/chunk-KK6HYVBI.mjs +242 -0
- package/dist/chunk-KMKWGXMK.js +856 -0
- package/dist/chunk-KPA6K5IB.js +80 -0
- package/dist/chunk-KU7O4IXU.mjs +260 -0
- package/dist/chunk-KVFNRJOR.mjs +11142 -0
- package/dist/chunk-KZJRSXHK.js +2432 -0
- package/dist/chunk-LHWPRUJL.js +79 -0
- package/dist/chunk-LIV3KXJG.mjs +369 -0
- package/dist/chunk-LKV4LACG.js +21 -0
- package/dist/chunk-LUY45X3U.mjs +263 -0
- package/dist/chunk-LYEZZEEF.mjs +17 -0
- package/dist/chunk-M5EXQZYY.mjs +1519 -0
- package/dist/chunk-ME6HGG4I.mjs +1338 -0
- package/dist/chunk-MEXP6DA6.js +31 -0
- package/dist/chunk-MG52AW3H.js +902 -0
- package/dist/chunk-MIPO6F72.js +334 -0
- package/dist/{chunk-5QW7CQBA.js → chunk-MKIJQL5Q.js} +211 -321
- package/dist/chunk-MN3YETVN.mjs +17 -0
- package/dist/chunk-MOBSBXVE.mjs +2391 -0
- package/dist/chunk-MOMOZEUM.mjs +88 -0
- package/dist/chunk-MRFUNRAP.js +62 -0
- package/dist/chunk-MTIHEW2M.js +433 -0
- package/dist/chunk-N4RGGDEL.mjs +73 -0
- package/dist/chunk-NH654HAT.js +10 -0
- package/dist/chunk-NHJUGZUR.mjs +253 -0
- package/dist/chunk-NMQT4HG3.mjs +757 -0
- package/dist/chunk-NPSYB6DC.mjs +906 -0
- package/dist/chunk-NW2GPMSO.js +857 -0
- package/dist/chunk-NXKQOQ6L.js +76 -0
- package/dist/chunk-NXLAZIJZ.js +309 -0
- package/dist/chunk-NYWNA5CF.js +148 -0
- package/dist/chunk-NZTKLY2W.js +1442 -0
- package/dist/chunk-O2ICABUD.js +36 -0
- package/dist/chunk-OIVVQQ22.js +862 -0
- package/dist/chunk-OKC2B4O3.mjs +312 -0
- package/dist/chunk-OLWFPDBK.js +2220 -0
- package/dist/chunk-OMTVH334.js +3779 -0
- package/dist/chunk-OQRVEM56.mjs +362 -0
- package/dist/chunk-OXMIBOD4.js +337 -0
- package/dist/chunk-PBL6YL5L.mjs +288 -0
- package/dist/chunk-PDOELNNQ.js +97 -0
- package/dist/chunk-PDQJY2GZ.js +136 -0
- package/dist/chunk-PKOZXD2Q.js +1274 -0
- package/dist/chunk-PPF2BYFL.mjs +2191 -0
- package/dist/chunk-PQTQKNKD.js +539 -0
- package/dist/chunk-PRSR4FAV.mjs +81 -0
- package/dist/chunk-PTRNO5UD.js +95 -0
- package/dist/chunk-Q2Y3VMKH.js +2000 -0
- package/dist/chunk-QCZOE65N.js +96 -0
- package/dist/chunk-QDYFLATW.mjs +52 -0
- package/dist/chunk-QQABGCMM.js +22 -0
- package/dist/chunk-QS6TRHMR.js +345 -0
- package/dist/chunk-R56P64LB.mjs +208 -0
- package/dist/chunk-RCQ2MPBV.js +428 -0
- package/dist/chunk-RFVRPYR2.mjs +856 -0
- package/dist/chunk-RKBLPGPV.js +11521 -0
- package/dist/chunk-RM2V4IND.mjs +327 -0
- package/dist/chunk-RQXN5A34.mjs +613 -0
- package/dist/chunk-RUVGVNOF.mjs +2687 -0
- package/dist/chunk-SAFJIGYB.mjs +165 -0
- package/dist/chunk-SKQFLBDD.js +263 -0
- package/dist/chunk-SMK6JU2F.mjs +2092 -0
- package/dist/{chunk-UVRPC2P7.js → chunk-SNNEOS5Z.js} +1984 -3476
- package/dist/chunk-SPCRQ6NO.mjs +1246 -0
- package/dist/chunk-SWX4SALA.mjs +19 -0
- package/dist/{chunk-JVODCGFP.mjs → chunk-SYEO2WV4.mjs} +128 -238
- package/dist/chunk-T2QQMX2N.js +10 -0
- package/dist/chunk-T3AFF3L7.mjs +57 -0
- package/dist/chunk-T6Z2EXYL.js +712 -0
- package/dist/chunk-T7LOXGYX.js +118 -0
- package/dist/chunk-TJCAE7RC.mjs +1315 -0
- package/dist/chunk-TJI3K6RP.js +137 -0
- package/dist/chunk-TL2SVO4P.mjs +55 -0
- package/dist/chunk-TM63CYGN.mjs +399 -0
- package/dist/chunk-TU5RYTYU.mjs +13 -0
- package/dist/chunk-TVJZ4GPS.js +1553 -0
- package/dist/chunk-TWM6DLYF.js +371 -0
- package/dist/chunk-U63OC4TQ.js +30 -0
- package/dist/{chunk-L5GKVQVJ.js → chunk-U6BVSJZ6.js} +25 -57
- package/dist/chunk-U6UVWEAK.mjs +792 -0
- package/dist/chunk-UCEPNO6N.mjs +11048 -0
- package/dist/{chunk-ANT574FD.js → chunk-UCR5HRYM.js} +74 -105
- package/dist/chunk-UG5BTOTF.mjs +334 -0
- package/dist/chunk-UGH37BQW.mjs +157 -0
- package/dist/chunk-V7ZRH3PY.mjs +271 -0
- package/dist/chunk-VBGHBL3E.mjs +1394 -0
- package/dist/chunk-VRBDAS5I.js +920 -0
- package/dist/chunk-VVE3Y76O.js +230 -0
- package/dist/chunk-W65JIRI4.mjs +1182 -0
- package/dist/chunk-WHYKAT7G.js +62 -0
- package/dist/{chunk-YOIVZ6OA.mjs → chunk-WIZRUIZB.mjs} +25 -57
- package/dist/chunk-WKWTDZS7.js +385 -0
- package/dist/chunk-WLMINRC4.mjs +78 -0
- package/dist/chunk-WOF3AD3J.js +22 -0
- package/dist/chunk-WWKMOA76.js +1262 -0
- package/dist/chunk-X5A5FOWW.js +615 -0
- package/dist/chunk-X6CN6KQF.mjs +192 -0
- package/dist/chunk-XD2PMH46.mjs +517 -0
- package/dist/chunk-XJA2NGTI.mjs +88 -0
- package/dist/chunk-XJIHN3BY.mjs +8 -0
- package/dist/chunk-XK6UDWJS.js +203 -0
- package/dist/chunk-XPG3N5CF.mjs +415 -0
- package/dist/chunk-XVZ2NKSU.mjs +74 -0
- package/dist/chunk-XYP45OLE.js +117 -0
- package/dist/chunk-XZSDGZX6.mjs +301 -0
- package/dist/chunk-Y2EMGN4T.mjs +120 -0
- package/dist/chunk-Y3XWP5XW.mjs +298 -0
- package/dist/chunk-Y4K22JL6.js +228 -0
- package/dist/chunk-Y65LXQGA.mjs +3164 -0
- package/dist/chunk-Y66WVMO5.mjs +87 -0
- package/dist/chunk-Y7JWLB25.mjs +7280 -0
- package/dist/chunk-YCDXAJKU.js +175 -0
- package/dist/chunk-YRDQCCIS.js +152 -0
- package/dist/chunk-YV52DGSA.js +111 -0
- package/dist/chunk-YXGZQPUD.js +94 -0
- package/dist/chunk-Z3A3AFVU.mjs +102 -0
- package/dist/chunk-ZCY6YKKP.mjs +475 -0
- package/dist/chunk-ZEQHXVU5.js +215 -0
- package/dist/chunk-ZF7JCXCI.js +284 -0
- package/dist/chunk-ZJBRUH6V.js +29 -0
- package/dist/chunk-ZMIL4ZOA.js +365 -0
- package/dist/chunk-ZR5ULMN2.mjs +337 -0
- package/dist/chunk-ZXREOYOW.js +87 -0
- package/dist/{client-BSP9U1O1.d.mts → client-CX_WR0-J.d.mts} +2 -2
- package/dist/client-Dytx_ZTC.d.ts +230 -0
- package/dist/{client-B878xeAP.d.ts → client-dqOhP9Nc.d.ts} +2 -2
- package/dist/client-hTKbCuhG.d.mts +230 -0
- package/dist/clock-B-UAjkKa.d.mts +5 -0
- package/dist/clock-B-UAjkKa.d.ts +5 -0
- package/dist/config-BlXQluJR.d.mts +36 -0
- package/dist/config-BlXQluJR.d.ts +36 -0
- package/dist/courier-Cnn-edJ4.d.ts +95 -0
- package/dist/courier-FmGfkvIN.d.mts +95 -0
- package/dist/crowd-DdHFbqKK.d.ts +186 -0
- package/dist/crowd-hOVSAmA3.d.mts +186 -0
- package/dist/danfo-BEBapFlX.d.mts +146 -0
- package/dist/danfo-UQ_PTIIx.d.ts +146 -0
- package/dist/{elements-Bty6Qs_N.d.mts → elements-DdsRig-2.d.mts} +1548 -257
- package/dist/{elements-Bty6Qs_N.d.ts → elements-DdsRig-2.d.ts} +1548 -257
- package/dist/engines/godot.d.mts +56 -0
- package/dist/engines/godot.d.ts +56 -0
- package/dist/engines/godot.js +28 -0
- package/dist/engines/godot.mjs +3 -0
- package/dist/engines/wasm.d.mts +11 -0
- package/dist/engines/wasm.d.ts +11 -0
- package/dist/engines/wasm.js +178 -0
- package/dist/engines/wasm.mjs +176 -0
- package/dist/fallback-CrG_lTFk.d.mts +270 -0
- package/dist/fallback-CrG_lTFk.d.ts +270 -0
- package/dist/fallback-KDB4Y2CE.mjs +6 -0
- package/dist/fallback-Y26TQENE.js +19 -0
- package/dist/features-CZB4rmcD.d.mts +118 -0
- package/dist/features-CZB4rmcD.d.ts +118 -0
- package/dist/fit-BWiE7rgA.d.mts +44 -0
- package/dist/fit-DK0oT7zO.d.ts +44 -0
- package/dist/five-a-side-Bv1AOUy3.d.mts +115 -0
- package/dist/five-a-side-EC51SJY1.d.ts +115 -0
- package/dist/fluid-ARr0qUIL.d.ts +939 -0
- package/dist/fluid-DLlEj2cs.d.mts +939 -0
- package/dist/game/conformance.d.mts +84 -0
- package/dist/game/conformance.d.ts +84 -0
- package/dist/game/conformance.js +1025 -0
- package/dist/game/conformance.mjs +994 -0
- package/dist/game/heap.d.mts +40 -0
- package/dist/game/heap.d.ts +40 -0
- package/dist/game/heap.js +48 -0
- package/dist/game/heap.mjs +7 -0
- package/dist/game/kit/canvas.d.mts +240 -0
- package/dist/game/kit/canvas.d.ts +240 -0
- package/dist/game/kit/canvas.js +3566 -0
- package/dist/game/kit/canvas.mjs +1039 -0
- package/dist/game/kit/courier.d.mts +17 -0
- package/dist/game/kit/courier.d.ts +17 -0
- package/dist/game/kit/courier.js +66 -0
- package/dist/game/kit/courier.mjs +49 -0
- package/dist/game/kit/danfo.d.mts +11 -0
- package/dist/game/kit/danfo.d.ts +11 -0
- package/dist/game/kit/danfo.js +109 -0
- package/dist/game/kit/danfo.mjs +44 -0
- package/dist/game/kit/engine.d.mts +29 -0
- package/dist/game/kit/engine.d.ts +29 -0
- package/dist/game/kit/engine.js +183 -0
- package/dist/game/kit/engine.mjs +30 -0
- package/dist/game/kit/five-a-side.d.mts +11 -0
- package/dist/game/kit/five-a-side.d.ts +11 -0
- package/dist/game/kit/five-a-side.js +86 -0
- package/dist/game/kit/five-a-side.mjs +41 -0
- package/dist/game/kit/frontier.d.mts +344 -0
- package/dist/game/kit/frontier.d.ts +344 -0
- package/dist/game/kit/frontier.js +435 -0
- package/dist/game/kit/frontier.mjs +14 -0
- package/dist/game/kit/genesis.d.mts +752 -0
- package/dist/game/kit/genesis.d.ts +752 -0
- package/dist/game/kit/genesis.js +380 -0
- package/dist/game/kit/genesis.mjs +15 -0
- package/dist/game/kit/ludo.d.mts +15 -0
- package/dist/game/kit/ludo.d.ts +15 -0
- package/dist/game/kit/ludo.js +87 -0
- package/dist/game/kit/ludo.mjs +42 -0
- package/dist/game/kit/runner.d.mts +12 -0
- package/dist/game/kit/runner.d.ts +12 -0
- package/dist/game/kit/runner.js +83 -0
- package/dist/game/kit/runner.mjs +46 -0
- package/dist/game/kit/shootout.d.mts +13 -0
- package/dist/game/kit/shootout.d.ts +13 -0
- package/dist/game/kit/shootout.js +122 -0
- package/dist/game/kit/shootout.mjs +57 -0
- package/dist/game/kit/slots.d.mts +392 -0
- package/dist/game/kit/slots.d.ts +392 -0
- package/dist/game/kit/slots.js +215 -0
- package/dist/game/kit/slots.mjs +6 -0
- package/dist/game/kit/tycoon.d.mts +16 -0
- package/dist/game/kit/tycoon.d.ts +16 -0
- package/dist/game/kit/tycoon.js +145 -0
- package/dist/game/kit/tycoon.mjs +44 -0
- package/dist/game/kit/word.d.mts +11 -0
- package/dist/game/kit/word.d.ts +11 -0
- package/dist/game/kit/word.js +78 -0
- package/dist/game/kit/word.mjs +41 -0
- package/dist/game/kit/worlds.d.mts +18 -0
- package/dist/game/kit/worlds.d.ts +18 -0
- package/dist/game/kit/worlds.js +74 -0
- package/dist/game/kit/worlds.mjs +49 -0
- package/dist/game/kit.d.mts +53 -0
- package/dist/game/kit.d.ts +53 -0
- package/dist/game/kit.js +2610 -0
- package/dist/game/kit.mjs +101 -0
- package/dist/game/prepared.d.mts +14 -0
- package/dist/game/prepared.d.ts +14 -0
- package/dist/game/prepared.js +81 -0
- package/dist/game/prepared.mjs +32 -0
- package/dist/game-Bx8onkhX.d.mts +1451 -0
- package/dist/game-fgQy2YIm.d.ts +1451 -0
- package/dist/game-theme-CBTw1b_d.d.mts +35 -0
- package/dist/game-theme-Dg-ict5A.d.ts +35 -0
- package/dist/game.d.mts +3546 -0
- package/dist/game.d.ts +3546 -0
- package/dist/game.js +4455 -0
- package/dist/game.mjs +50 -0
- package/dist/graphics-C6YjWYvP.d.ts +5 -0
- package/dist/graphics-Dk2yQnYN.d.mts +5 -0
- package/dist/guest-DrsA00XD.d.mts +732 -0
- package/dist/guest-wIdfoT05.d.ts +732 -0
- package/dist/hit-stop-BKkVwTq7.d.mts +43 -0
- package/dist/hit-stop-D-8pPYnM.d.ts +43 -0
- package/dist/hot-Crn9XpHJ.d.ts +29 -0
- package/dist/hot-DH3nOhQD.d.mts +29 -0
- package/dist/{index-CQStGb3B.d.mts → index-6gkHMGAq.d.mts} +2 -2
- package/dist/index-B8ybCKJI.d.ts +41 -0
- package/dist/{index-DJwXmoaP.d.ts → index-B98Xac8e.d.ts} +2 -2
- package/dist/{index-B7oA_1XI.d.ts → index-B_ByTtIT.d.ts} +2 -2
- package/dist/index-DHjNHb1c.d.mts +41 -0
- package/dist/{index-DhUSTAhT.d.mts → index-DbAN_VQE.d.mts} +2 -2
- package/dist/index.d.mts +134 -24
- package/dist/index.d.ts +134 -24
- package/dist/index.js +407 -248
- package/dist/index.mjs +184 -58
- package/dist/interactives-authoring.d.mts +231 -0
- package/dist/interactives-authoring.d.ts +231 -0
- package/dist/interactives-authoring.js +1743 -0
- package/dist/interactives-authoring.mjs +1704 -0
- package/dist/interactives-canvas.global.js +148 -0
- package/dist/interactives-guest.d.mts +20 -0
- package/dist/interactives-guest.d.ts +20 -0
- package/dist/interactives-guest.js +63 -0
- package/dist/interactives-guest.json +1 -0
- package/dist/interactives-guest.mjs +61 -0
- package/dist/interactives-jsc.global.js +9357 -0
- package/dist/interactives-meters.d.mts +93 -0
- package/dist/interactives-meters.d.ts +93 -0
- package/dist/interactives-meters.js +252 -0
- package/dist/interactives-meters.mjs +68 -0
- package/dist/interactives-production.d.mts +430 -0
- package/dist/interactives-production.d.ts +430 -0
- package/dist/interactives-production.js +1231 -0
- package/dist/interactives-production.mjs +1170 -0
- package/dist/interactives-record.d.mts +112 -0
- package/dist/interactives-record.d.ts +112 -0
- package/dist/interactives-record.js +302 -0
- package/dist/interactives-record.mjs +295 -0
- package/dist/interactives-runtime.d.mts +61 -0
- package/dist/interactives-runtime.d.ts +61 -0
- package/dist/interactives-runtime.js +442 -0
- package/dist/interactives-runtime.mjs +25 -0
- package/dist/interactives-studio-kernel.global.js +1 -0
- package/dist/interactives-studio.d.mts +806 -0
- package/dist/interactives-studio.d.ts +806 -0
- package/dist/interactives-studio.js +5741 -0
- package/dist/interactives-studio.mjs +5651 -0
- package/dist/interactives-tick.d.mts +90 -0
- package/dist/interactives-tick.d.ts +90 -0
- package/dist/interactives-tick.js +203 -0
- package/dist/interactives-tick.mjs +6 -0
- package/dist/interactives-web.d.mts +762 -0
- package/dist/interactives-web.d.ts +762 -0
- package/dist/interactives-web.js +5000 -0
- package/dist/interactives-web.mjs +4628 -0
- package/dist/interactives.d.mts +2430 -0
- package/dist/interactives.d.ts +2430 -0
- package/dist/interactives.js +5723 -0
- package/dist/interactives.mjs +4333 -0
- package/dist/juice-CoHxlpKA.d.ts +42 -0
- package/dist/juice-DQztFS43.d.mts +42 -0
- package/dist/launch-T2f4_Di4.d.mts +151 -0
- package/dist/launch-d6oreMzR.d.ts +151 -0
- package/dist/library-DXYaMFhi.d.mts +69 -0
- package/dist/library-DXYaMFhi.d.ts +69 -0
- package/dist/link-BUTqGmyi.d.mts +38 -0
- package/dist/link-BUTqGmyi.d.ts +38 -0
- package/dist/lint.js +104 -204
- package/dist/lint.mjs +103 -203
- package/dist/local-D8_I6UeL.d.mts +6967 -0
- package/dist/local-VZkqsCzR.d.ts +6967 -0
- package/dist/lockstep-BLf6dglI.d.mts +321 -0
- package/dist/lockstep-D50Ia0JW.d.ts +321 -0
- package/dist/ludo-B8ClkDqr.d.ts +205 -0
- package/dist/ludo-BOuohQ-M.d.mts +205 -0
- package/dist/mock/cli.mjs +200 -56
- package/dist/mock/library.js +200 -56
- package/dist/mock/library.mjs +200 -56
- package/dist/mock/msw.js +200 -56
- package/dist/mock/msw.mjs +200 -56
- package/dist/native-BodxSh03.d.mts +16 -0
- package/dist/native-DUHMT8gA.d.ts +16 -0
- package/dist/network-ZXLD7l1b.d.mts +19 -0
- package/dist/network-ZXLD7l1b.d.ts +19 -0
- package/dist/online-XeymeM9s.d.ts +381 -0
- package/dist/online-d7W_Al9a.d.mts +381 -0
- package/dist/params-DxFb5G_U.d.mts +155 -0
- package/dist/params-DxFb5G_U.d.ts +155 -0
- package/dist/play-BRRlfLhX.d.ts +940 -0
- package/dist/play-ClrMd_e8.d.mts +940 -0
- package/dist/policy-CCw8tXLm.d.mts +3078 -0
- package/dist/policy-CMqOSQIu.d.ts +3078 -0
- package/dist/ports-B_0v_P3A.d.mts +13 -0
- package/dist/ports-CGU_3e_0.d.ts +13 -0
- package/dist/prefetch-BHnicOQj.d.ts +117 -0
- package/dist/prefetch-CBXgYacv.d.mts +117 -0
- package/dist/{price-CSztR02F.d.mts → price-BOzexBww.d.mts} +1 -1
- package/dist/{price-C_vasx9A.d.ts → price-C1h9sPxE.d.ts} +1 -1
- package/dist/protocol-C8qbpUbT.d.mts +242 -0
- package/dist/protocol-C8qbpUbT.d.ts +242 -0
- package/dist/rapier-AZHT4YI7.js +7886 -0
- package/dist/rapier-ODEPCQA6.mjs +7792 -0
- package/dist/react.d.mts +157 -15
- package/dist/react.d.ts +157 -15
- package/dist/react.js +5564 -5904
- package/dist/react.mjs +5451 -5808
- package/dist/runner-CQcLL7By.d.ts +189 -0
- package/dist/runner-D46Yj-wE.d.mts +189 -0
- package/dist/runtime-BRWfkf_q.d.mts +51 -0
- package/dist/runtime-DyuBMkKM.d.ts +51 -0
- package/dist/scheduling-D2ajXpMC.d.ts +224 -0
- package/dist/scheduling-DSRbbaZb.d.mts +224 -0
- package/dist/schema-BrWxzKp6.d.mts +63 -0
- package/dist/schema-BrWxzKp6.d.ts +63 -0
- package/dist/server/evict.js +34 -37
- package/dist/server/evict.mjs +34 -37
- package/dist/server/tanstack.d.mts +49 -3
- package/dist/server/tanstack.d.ts +49 -3
- package/dist/server/tanstack.js +169 -117
- package/dist/server/tanstack.mjs +166 -118
- package/dist/{server-Dckg4Vdr.d.ts → server-D29IIuDV.d.ts} +136 -130
- package/dist/{server-B6dW7-Lj.d.mts → server-DQMWPnc8.d.mts} +136 -130
- package/dist/server.d.mts +45 -5
- package/dist/server.d.ts +45 -5
- package/dist/server.js +171 -227
- package/dist/server.mjs +165 -225
- package/dist/session-grant-CJ27DwrT.d.mts +19 -0
- package/dist/session-grant-CJ27DwrT.d.ts +19 -0
- package/dist/shootout-BJZeX6FG.d.ts +140 -0
- package/dist/shootout-tcZd1Rxt.d.mts +140 -0
- package/dist/state-replica-stMtdkVD.d.mts +42 -0
- package/dist/state-replica-stMtdkVD.d.ts +42 -0
- package/dist/studio-CowqWqez.d.mts +14 -0
- package/dist/studio-CowqWqez.d.ts +14 -0
- package/dist/styles.css +1 -1
- package/dist/template-AhCdB1kW.d.mts +190 -0
- package/dist/template-BkEGVTQj.d.ts +190 -0
- package/dist/terrain-BMxEc6Oc.d.ts +429 -0
- package/dist/terrain-C-XC1Oui.d.mts +429 -0
- package/dist/testing/msw.d.mts +28 -4
- package/dist/testing/msw.d.ts +28 -4
- package/dist/testing/msw.js +15 -21
- package/dist/testing/msw.mjs +15 -21
- package/dist/testing/suite.d.mts +6 -5
- package/dist/testing/suite.d.ts +6 -5
- package/dist/testing/suite.js +89 -124
- package/dist/testing/suite.mjs +81 -116
- package/dist/testing.d.mts +27 -1227
- package/dist/testing.d.ts +27 -1227
- package/dist/testing.js +127 -131
- package/dist/testing.mjs +19 -23
- package/dist/tick-transport-C8QEh8Uw.d.mts +50 -0
- package/dist/tick-transport-UjHY3xK1.d.ts +50 -0
- package/dist/timeline-protocol-hp6e8zFB.d.mts +47 -0
- package/dist/timeline-protocol-hp6e8zFB.d.ts +47 -0
- package/dist/tokens-DhanQRQS.d.mts +21 -0
- package/dist/tokens-K8yxwd6G.d.ts +21 -0
- package/dist/tree-C-Io2Hbx.d.mts +35 -0
- package/dist/tree-CP_qSW4H.d.ts +35 -0
- package/dist/tycoon-B5KHk2Xx.d.mts +255 -0
- package/dist/tycoon-hmHo-3HX.d.ts +255 -0
- package/dist/types-BQkxPwZP.d.mts +219 -0
- package/dist/types-D_f6UUxM.d.ts +219 -0
- package/dist/ui-DwHicuFv.d.mts +563 -0
- package/dist/ui-hi7S2YcH.d.ts +563 -0
- package/dist/{sign-in-DQlIdqsi.d.mts → url-52ndUruG.d.mts} +15 -1
- package/dist/{sign-in-DQlIdqsi.d.ts → url-52ndUruG.d.ts} +15 -1
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +37 -37
- package/dist/utils.mjs +4 -4
- package/dist/vars-Dc_PrhBK.d.mts +511 -0
- package/dist/vars-Dc_PrhBK.d.ts +511 -0
- package/dist/vm-IUARFFAI.mjs +63 -0
- package/dist/vm-N7L6MGGH.js +65 -0
- package/dist/weave-delivery-CW-Kstut.d.mts +360 -0
- package/dist/weave-delivery-CW-Kstut.d.ts +360 -0
- package/dist/web-Dss74a7v.d.ts +883 -0
- package/dist/web-f9ZQPoyw.d.mts +883 -0
- package/dist/web-transport-C7MkBL0a.d.ts +19 -0
- package/dist/web-transport-aYEqXMd9.d.mts +19 -0
- package/dist/weight-CPGjsgjV.d.ts +92 -0
- package/dist/weight-tF1ODR1p.d.mts +92 -0
- package/dist/word-BcX9Jcmv.d.mts +70 -0
- package/dist/word-C7sVPLHm.d.ts +70 -0
- package/dist/world-PvILHDR1.d.ts +2285 -0
- package/dist/world-qekkXjJv.d.mts +2285 -0
- package/dist/worlds-Br2Pb0Cs.d.ts +109 -0
- package/dist/worlds-D5ydYr7d.d.mts +109 -0
- package/engines/c/cimplify.h +108 -0
- package/engines/c/cimplify.lib.js +11 -0
- package/engines/godot/addons/cimplify/cimplify.gd +97 -0
- package/engines/rust/interactives-ctx/Cargo.toml +9 -0
- package/engines/rust/interactives-ctx/src/lib.rs +189 -0
- package/package.json +189 -3
- package/vendor/rapier3d-compat/LICENSE +201 -0
- package/vendor/rapier3d-compat/PATCHES.md +61 -0
- package/dist/chunk-2P4KXFB6.js +0 -274
- package/dist/chunk-3G6RQLXK.mjs +0 -21
- package/dist/chunk-3V4DVXV3.mjs +0 -254
- package/dist/chunk-EDK3LNM6.js +0 -2436
- package/dist/chunk-F7J3HK27.js +0 -4549
- package/dist/chunk-U4MW6PYU.mjs +0 -23
- package/dist/chunk-XREIZ56K.js +0 -26
|
@@ -0,0 +1,4628 @@
|
|
|
1
|
+
import './chunk-GVTI6UJQ.mjs';
|
|
2
|
+
import './chunk-Y3XWP5XW.mjs';
|
|
3
|
+
import { identityCapturePolicy, identityFromCapture, IdentityFitter } from './chunk-KK6HYVBI.mjs';
|
|
4
|
+
import { WebFaceColours } from './chunk-FQBFWJBS.mjs';
|
|
5
|
+
import { referable, chunksForHost, hostIsolated, DEFAULT_HOST_TIER, hostThreads, shellPath, sha256Hex, linksBeforeStart, guestOrigin, ENGINE_GROUP_PREFIX, isDigestHex, WASM_SUFFIX, JOINED_PREFIX, JOINED_PARTS_PARAM, JOINED_PART_SEPARATOR, MAX_JOINED_PARTS, SHELL_PREFIX, sri, runtimePath, RUNTIME_SUFFIX, RUNTIME_PREFIX, WASM_PREFIX, fetchTwin } from './chunk-VBGHBL3E.mjs';
|
|
6
|
+
export { ALTERNATIVE_RUNTIMES, CLIP_CAMERA, DEFAULT_HOST_LIMITS, DEFAULT_LAZY_BUDGET_BYTES, DEFAULT_LAZY_CONCURRENCY, ENGINE_GROUP_PREFIX, GPU_REQUIREMENT_NAMES, GuestPool, HOST_PAGE_ISOLATION_HEADERS, HostClips, HostFaultError, HostMediator, LazyChunkServer, REPLAY_MEDIA_TYPE, TreeStore, WebHost, ZoneSpans, chunksForHost, deviceGpuLimits, forgetHostWebGpu, guestOrigin, hostThreads, hostWebGpu, httpChunks, interactiveLabel, manifestGpuRequirements, openSession, parseContentOrigin, probeHostWebGpu, rangedChunks, servesContent, sessionUrl, sha256Hex, swapInPlace, swappable, unmetGpuRequirement, workerEngines } from './chunk-VBGHBL3E.mjs';
|
|
7
|
+
import './chunk-DDJLDOUX.mjs';
|
|
8
|
+
import './chunk-HMWYTXCY.mjs';
|
|
9
|
+
export { CANNOT_REWIND, NOT_RECORDING, TIMELINE_PREFIX, TIMELINE_REPORT, TIMELINE_TOPIC } from './chunk-KVFNRJOR.mjs';
|
|
10
|
+
import './chunk-KDTVOLHI.mjs';
|
|
11
|
+
import './chunk-RM2V4IND.mjs';
|
|
12
|
+
import './chunk-22BD3RHN.mjs';
|
|
13
|
+
import './chunk-ME6HGG4I.mjs';
|
|
14
|
+
import './chunk-5BYDGGWO.mjs';
|
|
15
|
+
import './chunk-Y65LXQGA.mjs';
|
|
16
|
+
import './chunk-7ARSJPV3.mjs';
|
|
17
|
+
import './chunk-7BHW5GTC.mjs';
|
|
18
|
+
import './chunk-RUVGVNOF.mjs';
|
|
19
|
+
import './chunk-HF5HPS4T.mjs';
|
|
20
|
+
import './chunk-XPG3N5CF.mjs';
|
|
21
|
+
import './chunk-KIZOA5LX.mjs';
|
|
22
|
+
import './chunk-7SXOHAIR.mjs';
|
|
23
|
+
import './chunk-ATAWRACV.mjs';
|
|
24
|
+
import './chunk-T3AFF3L7.mjs';
|
|
25
|
+
import './chunk-TL2SVO4P.mjs';
|
|
26
|
+
import './chunk-IDLW4NWA.mjs';
|
|
27
|
+
import { woven, openWeaveHead, chunkWeaveSource, storeWeaveSource, unweaveIndex } from './chunk-ZR5ULMN2.mjs';
|
|
28
|
+
import './chunk-3GXH2NFD.mjs';
|
|
29
|
+
import { chunkRefMessage, chunkMessage, fetchVerified, MemoryPartBackend, SharedPartStore, verifyChunk } from './chunk-BU6OK542.mjs';
|
|
30
|
+
export { DEFAULT_DISK_RESERVE_BYTES, DEFAULT_KEPT_BUDGET_BYTES, DEFAULT_PART_STORE_BUDGET_BYTES, DEFAULT_PART_ZONE, KEEP_REASONS, MemoryPartBackend, PartSession, PartVerifyError, SharedPartStore, localFirstChunks } from './chunk-BU6OK542.mjs';
|
|
31
|
+
import './chunk-PRSR4FAV.mjs';
|
|
32
|
+
import './chunk-TM63CYGN.mjs';
|
|
33
|
+
import './chunk-X6CN6KQF.mjs';
|
|
34
|
+
import './chunk-MN3YETVN.mjs';
|
|
35
|
+
import './chunk-73SGZLAQ.mjs';
|
|
36
|
+
import { Transport, WebTransportDialer, WebSocketDialer, SizedViews } from './chunk-M5EXQZYY.mjs';
|
|
37
|
+
import { PACKET_BYTES } from './chunk-TU5RYTYU.mjs';
|
|
38
|
+
import './chunk-3OY3VYNF.mjs';
|
|
39
|
+
import './chunk-EIB4OWVQ.mjs';
|
|
40
|
+
import './chunk-PBL6YL5L.mjs';
|
|
41
|
+
import './chunk-GXKI64OT.mjs';
|
|
42
|
+
import './chunk-NHJUGZUR.mjs';
|
|
43
|
+
import './chunk-E65WCTIG.mjs';
|
|
44
|
+
import './chunk-5YFBGGCK.mjs';
|
|
45
|
+
import './chunk-K4UDGE3Z.mjs';
|
|
46
|
+
import './chunk-MOBSBXVE.mjs';
|
|
47
|
+
import './chunk-SMK6JU2F.mjs';
|
|
48
|
+
import './chunk-UG5BTOTF.mjs';
|
|
49
|
+
export { ENGINE_HEAP_CEILING_BYTES, ENGINE_HEAP_HEADROOM, declareEngineHeap, engineHeapFor } from './chunk-JURRXY2J.mjs';
|
|
50
|
+
export { EngineSessionError } from './chunk-GHS6MIL6.mjs';
|
|
51
|
+
import './chunk-GDCV4IWO.mjs';
|
|
52
|
+
import './chunk-Y66WVMO5.mjs';
|
|
53
|
+
import './chunk-U6UVWEAK.mjs';
|
|
54
|
+
import './chunk-A33OORT7.mjs';
|
|
55
|
+
export { ClipError } from './chunk-3VEH23I5.mjs';
|
|
56
|
+
import { FACE_FRAME, CAMERA_PLACE_BYTES, readFloat, CAMERA_PLACE_X_AT, CAMERA_WORD_BYTES, CAMERA_PLACE_FLAGS_AT, CameraViewFlag, FACE_PAYLOAD_BYTES, FACE_FLOATS_AT, FACE_FLOATS, FACE_ARKIT_AT, FACE_POSE_AT, CAMERA_HANDLE_BYTES, readWord, CAMERA_ID_AT, CAMERA_PAIR_BYTES, CAMERA_SECOND_AT, CAMERA_OPEN_BYTES, CAMERA_PURPOSE_AT, NO_CAMERA, CameraRefusal, CameraOpenPurpose, CAMERA_IDENTIFIED_BYTES, writeWord, IDENTITY_CAPTURED, CAMERA_IDENTITY_CODE_AT, identityCodeByte, CAMERA_FACE_BYTES, CAMERA_COLOURED_BYTES, NO_FACE_COLOUR } from './chunk-5C3C7VDM.mjs';
|
|
57
|
+
import { CLIP_PAUSE_BYTES, CLIP_SAVE_BYTES, writeClipPause, writeClipSave, readClipSaved, ClipStatus } from './chunk-UGH37BQW.mjs';
|
|
58
|
+
export { DEFAULT_CLIP_ARM } from './chunk-UGH37BQW.mjs';
|
|
59
|
+
import './chunk-KDQOR4QQ.mjs';
|
|
60
|
+
import './chunk-LYEZZEEF.mjs';
|
|
61
|
+
export { STUDIO_MESSAGE_MAX_BYTES } from './chunk-HAGEIC2L.mjs';
|
|
62
|
+
import { webNetworkHint, prefetchDepth } from './chunk-K46SMZ66.mjs';
|
|
63
|
+
import './chunk-OKC2B4O3.mjs';
|
|
64
|
+
import './chunk-PPF2BYFL.mjs';
|
|
65
|
+
import './chunk-WLMINRC4.mjs';
|
|
66
|
+
import { UiRole, UiTrait } from './chunk-RFVRPYR2.mjs';
|
|
67
|
+
import './chunk-DS2VU4WW.mjs';
|
|
68
|
+
import { sha256Into, SHA256_BYTES } from './chunk-5YWN6H5Q.mjs';
|
|
69
|
+
import './chunk-F6XRYEM3.mjs';
|
|
70
|
+
import './chunk-OQRVEM56.mjs';
|
|
71
|
+
import { FACE_LAYOUT, CAMERA_LAYOUT, CTX_CAPABILITIES } from './chunk-SPCRQ6NO.mjs';
|
|
72
|
+
import { MessageWriter, MessageTag, forEachChunkEntry, CHUNK_REQUEST_ENTRY_BYTES, readJson, LifecycleCode, unhex, ENGINE_CORE_UNIT, PONG_BYTES, hex } from './chunk-V7ZRH3PY.mjs';
|
|
73
|
+
export { CHUNK_FAILED_BYTES, CHUNK_RELEASE_ENTRY_BYTES, CHUNK_REQUESTS_VERSION, CHUNK_REQUEST_ENTRY_BYTES, ChunkBatch, ChunkFailure, ChunkPriority, FrameTouchKind, LifecycleCode, MessageTag, forEachChunkEntry, readChunkFailed, writeChunkFailed } from './chunk-V7ZRH3PY.mjs';
|
|
74
|
+
import './chunk-GYLP6UG4.mjs';
|
|
75
|
+
import './chunk-XJA2NGTI.mjs';
|
|
76
|
+
import { encodeBase64 } from './chunk-2IC4H6OV.mjs';
|
|
77
|
+
import './chunk-MOMOZEUM.mjs';
|
|
78
|
+
import './chunk-N4RGGDEL.mjs';
|
|
79
|
+
import './chunk-XJIHN3BY.mjs';
|
|
80
|
+
export { CONSENT_KINDS, ConsentStore, browserStore, memoryStore } from './chunk-XVZ2NKSU.mjs';
|
|
81
|
+
import { encodeIdentity } from './chunk-XD2PMH46.mjs';
|
|
82
|
+
import './chunk-25T4JHEA.mjs';
|
|
83
|
+
|
|
84
|
+
// src/interactives/hosts/credits.ts
|
|
85
|
+
var decoder = new TextDecoder(), CONTENT_BLOCKED_ERROR = "INTERACTIVES_CONTENT_BLOCKED", CONTENT_BLOCKED_CLOSE = "content_blocked", CONTENT_BLOCKED_STATUS = 451;
|
|
86
|
+
function text(value) {
|
|
87
|
+
return typeof value == "string" && value.length > 0 ? value : null;
|
|
88
|
+
}
|
|
89
|
+
function credit(raw) {
|
|
90
|
+
let title = text(raw.title), licence = text(raw.licence);
|
|
91
|
+
return title === null || licence === null ? null : {
|
|
92
|
+
title,
|
|
93
|
+
authors: Array.isArray(raw.authors) ? raw.authors.filter((a) => typeof a == "string") : [],
|
|
94
|
+
licence,
|
|
95
|
+
licenceUrl: text(raw.licence_url),
|
|
96
|
+
sourceUrl: text(raw.source_url),
|
|
97
|
+
modified: raw.modified === true,
|
|
98
|
+
item: text(raw.item),
|
|
99
|
+
ai: text(raw.ai)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function manifestCredits(manifest) {
|
|
103
|
+
let parsed = JSON.parse(decoder.decode(manifest));
|
|
104
|
+
if (!Array.isArray(parsed.credits)) return [];
|
|
105
|
+
let out = [];
|
|
106
|
+
for (let raw of parsed.credits) {
|
|
107
|
+
if (typeof raw != "object" || raw === null) continue;
|
|
108
|
+
let found = credit(raw);
|
|
109
|
+
found !== null && out.push(found);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
function blockedItems(detail) {
|
|
114
|
+
return detail === null || detail.length === 0 ? [] : detail.split(",").filter((item) => item.length > 0);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// src/interactives/hosts/warm.ts
|
|
118
|
+
var DEFAULT_WARM_BOOT_MS = 1e4, PART_SUFFIX = /\.(\d+)$/, KEY_SEPARATOR = ",", INTERACTIVE_SEPARATOR = "@";
|
|
119
|
+
function engineCore(chunk) {
|
|
120
|
+
return chunk.runtime?.name === ENGINE_CORE_UNIT;
|
|
121
|
+
}
|
|
122
|
+
function staged(chunk) {
|
|
123
|
+
let group = chunk.asset_group;
|
|
124
|
+
return engineCore(chunk) ? true : chunk.runtime != null && group !== void 0 && !group.startsWith(ENGINE_GROUP_PREFIX);
|
|
125
|
+
}
|
|
126
|
+
function runtimeImage(chunks) {
|
|
127
|
+
let digests = [], payloads = /* @__PURE__ */ new Map(), named = /* @__PURE__ */ new Map();
|
|
128
|
+
for (let chunk of chunks) {
|
|
129
|
+
if (!staged(chunk)) continue;
|
|
130
|
+
digests.push(chunk.digest), referable(chunk) && payloads.set(chunk.digest, chunk.payload_digest);
|
|
131
|
+
let name = chunk.runtime.name, part = engineCore(chunk) ? null : PART_SUFFIX.exec(name), base = part === null ? name : name.slice(0, part.index), parts = named.get(base) ?? [];
|
|
132
|
+
parts.push({ index: part === null ? 0 : Number(part[1]), digest: chunk.digest }), named.set(base, parts);
|
|
133
|
+
}
|
|
134
|
+
let files = {};
|
|
135
|
+
for (let [name, parts] of named) files[name] = parts.sort((a, b) => a.index - b.index).map((p) => p.digest);
|
|
136
|
+
return { key: digests.join(KEY_SEPARATOR), chunks: digests, payloads, warm: { files } };
|
|
137
|
+
}
|
|
138
|
+
var RuntimePool = class {
|
|
139
|
+
constructor(factory, source, boot_ms = (1e4)) {
|
|
140
|
+
this.factory = factory;
|
|
141
|
+
this.source = source;
|
|
142
|
+
this.boot_ms = boot_ms;
|
|
143
|
+
this.slots = /* @__PURE__ */ new Map();
|
|
144
|
+
this.bodies = /* @__PURE__ */ new Map();
|
|
145
|
+
this.writer = new MessageWriter();
|
|
146
|
+
}
|
|
147
|
+
keyOf(image, interactive) {
|
|
148
|
+
return this.factory.isolates_interactives === true ? `${image.key}${INTERACTIVE_SEPARATOR}${interactive ?? ""}` : image.key;
|
|
149
|
+
}
|
|
150
|
+
warm(chunks, interactive) {
|
|
151
|
+
let image = runtimeImage(chunksForHost(chunks, null, hostIsolated(), DEFAULT_HOST_TIER, hostThreads())), key = this.keyOf(image, interactive), slot = this.slots.get(key) ?? { guest: null };
|
|
152
|
+
if (this.slots.set(key, slot), slot.guest !== null) return;
|
|
153
|
+
let guest = this.stage(image, slot, interactive);
|
|
154
|
+
slot.guest = guest, guest.then((engine) => {
|
|
155
|
+
engine === null && slot.guest === guest && (slot.guest = null);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async warmed(chunks, interactive) {
|
|
159
|
+
let guest = this.slots.get(this.keyOf(runtimeImage(chunksForHost(chunks, null, hostIsolated(), DEFAULT_HOST_TIER, hostThreads())), interactive))?.guest ?? null;
|
|
160
|
+
return guest !== null && await guest !== null;
|
|
161
|
+
}
|
|
162
|
+
async take(chunks, interactive) {
|
|
163
|
+
let image = runtimeImage(chunksForHost(chunks, null, hostIsolated(), DEFAULT_HOST_TIER, hostThreads())), slot = this.slots.get(this.keyOf(image, interactive)), guest = slot?.guest ?? null;
|
|
164
|
+
if (slot === void 0 || guest === null) return null;
|
|
165
|
+
slot.guest = null;
|
|
166
|
+
let engine = await guest;
|
|
167
|
+
return engine === null ? null : { engine, staged: new Set(image.chunks) };
|
|
168
|
+
}
|
|
169
|
+
drain() {
|
|
170
|
+
for (let slot of this.slots.values())
|
|
171
|
+
slot.guest?.then((engine) => engine?.terminate()), slot.guest = null;
|
|
172
|
+
this.slots.clear(), this.bodies.clear();
|
|
173
|
+
}
|
|
174
|
+
async stage(image, slot, interactive) {
|
|
175
|
+
let engine = this.factory.spawn(interactive), alive = true, lose = () => {
|
|
176
|
+
}, lost = new Promise((_, reject) => {
|
|
177
|
+
lose = reject;
|
|
178
|
+
});
|
|
179
|
+
lost.catch(() => {
|
|
180
|
+
}), engine.on_crash((message) => {
|
|
181
|
+
alive = false, lose(new Error(message)), engine.terminate();
|
|
182
|
+
let current = slot.guest;
|
|
183
|
+
current?.then((held) => {
|
|
184
|
+
held === engine && slot.guest === current && (slot.guest = null);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
try {
|
|
188
|
+
let deferred = engine.may_fetch_wasm === !0, eager = deferred ? image.chunks.filter((digest) => !image.payloads.has(digest)) : image.chunks, late = deferred ? image.chunks.filter((digest) => image.payloads.has(digest)) : [], [, bodies] = await Promise.race([Promise.all([this.ready(engine), this.fetch(eager)]), lost]), byUrl = engine.fetches_wasm === !0, lateBodies = byUrl ? [] : await Promise.race([this.fetch(late), lost]), warmed = image.chunks.length > 0 ? this.warmedReply(engine) : null;
|
|
189
|
+
for (let i = 0; i < bodies.length; i++) this.stageBody(engine, eager[i], bodies[i]);
|
|
190
|
+
for (let i = 0; i < lateBodies.length; i++) this.stageBody(engine, late[i], lateBodies[i]);
|
|
191
|
+
if (byUrl)
|
|
192
|
+
for (let digest of late) {
|
|
193
|
+
let message = chunkRefMessage(MessageTag.stage_ref, digest, image.payloads.get(digest));
|
|
194
|
+
engine.send(message, message.length);
|
|
195
|
+
}
|
|
196
|
+
return warmed !== null && (engine.send(this.writer.bytes, this.writer.json(MessageTag.warm, image.warm)), await Promise.race([warmed, lost])), alive ? engine : null;
|
|
197
|
+
} catch {
|
|
198
|
+
return engine.terminate(), null;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
ready(engine) {
|
|
202
|
+
return new Promise((resolve, reject) => {
|
|
203
|
+
let timer = setTimeout(() => reject(new Error("the warm guest did not start in time")), this.boot_ms);
|
|
204
|
+
engine.on_message((bytes) => {
|
|
205
|
+
bytes[0] === MessageTag.ready && (clearTimeout(timer), engine.on_message(() => {
|
|
206
|
+
}), resolve());
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
stageBody(engine, digest, body) {
|
|
211
|
+
let message = chunkMessage(MessageTag.stage, digest, body);
|
|
212
|
+
engine.send(message, message.length);
|
|
213
|
+
}
|
|
214
|
+
warmedReply(engine) {
|
|
215
|
+
return new Promise((resolve) => {
|
|
216
|
+
engine.on_message((bytes) => {
|
|
217
|
+
if (bytes[0] === MessageTag.chunk_request) {
|
|
218
|
+
forEachChunkEntry(bytes, CHUNK_REQUEST_ENTRY_BYTES, (digest) => {
|
|
219
|
+
this.fetch([digest]).then(
|
|
220
|
+
([body]) => this.stageBody(engine, digest, body),
|
|
221
|
+
() => engine.terminate()
|
|
222
|
+
);
|
|
223
|
+
});
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
bytes[0] === MessageTag.warmed && (engine.on_message(() => {
|
|
227
|
+
}), resolve());
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
fetch(digests) {
|
|
232
|
+
let missing2 = digests.filter((digest) => !this.bodies.has(digest));
|
|
233
|
+
if (missing2.length > 0) {
|
|
234
|
+
let fetched = fetchVerified(this.source, missing2);
|
|
235
|
+
missing2.forEach((digest, i) => {
|
|
236
|
+
let body = fetched.then((all) => all[i]);
|
|
237
|
+
body.catch(() => this.bodies.delete(digest)), this.bodies.set(digest, body);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
return Promise.all(digests.map((digest) => this.bodies.get(digest)));
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// src/interactives/hosts/part-store-web.ts
|
|
245
|
+
var PART_STORE_NAME = "cimplify-parts", WEB_DISK_RESERVE_BYTES = 64 * 1024 * 1024, DB_VERSION = 1, BODIES = "bodies", META = "meta", INDEX_KEY = "index", CACHE_PREFIX = "/cimplify-parts/", CACHE_INDEX = `${CACHE_PREFIX}index.json`, OCTETS = "application/octet-stream";
|
|
246
|
+
function request(req) {
|
|
247
|
+
return new Promise((resolve, reject) => {
|
|
248
|
+
req.onsuccess = () => resolve(req.result), req.onerror = () => reject(req.error);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function done(tx) {
|
|
252
|
+
return new Promise((resolve, reject) => {
|
|
253
|
+
tx.oncomplete = () => resolve(), tx.onerror = () => reject(tx.error), tx.onabort = () => reject(tx.error);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
var IndexedDbPartBackend = class _IndexedDbPartBackend {
|
|
257
|
+
constructor(db) {
|
|
258
|
+
this.db = db;
|
|
259
|
+
}
|
|
260
|
+
static async open(factory, name = PART_STORE_NAME) {
|
|
261
|
+
let req = factory.open(name, (1));
|
|
262
|
+
return req.onupgradeneeded = () => {
|
|
263
|
+
let db = req.result;
|
|
264
|
+
db.objectStoreNames.contains(BODIES) || db.createObjectStore(BODIES), db.objectStoreNames.contains(META) || db.createObjectStore(META);
|
|
265
|
+
}, new _IndexedDbPartBackend(await request(req));
|
|
266
|
+
}
|
|
267
|
+
async read(digest) {
|
|
268
|
+
let value = await request(this.db.transaction(BODIES, "readonly").objectStore(BODIES).get(digest));
|
|
269
|
+
return value === void 0 ? null : new Uint8Array(value);
|
|
270
|
+
}
|
|
271
|
+
async write(digest, bytes) {
|
|
272
|
+
let tx = this.db.transaction(BODIES, "readwrite");
|
|
273
|
+
tx.objectStore(BODIES).put(bytes.slice().buffer, digest), await done(tx);
|
|
274
|
+
}
|
|
275
|
+
async remove(digest) {
|
|
276
|
+
let tx = this.db.transaction(BODIES, "readwrite");
|
|
277
|
+
tx.objectStore(BODIES).delete(digest), await done(tx);
|
|
278
|
+
}
|
|
279
|
+
async load() {
|
|
280
|
+
return await request(this.db.transaction(META, "readonly").objectStore(META).get(INDEX_KEY)) ?? null;
|
|
281
|
+
}
|
|
282
|
+
async save(snapshot) {
|
|
283
|
+
let tx = this.db.transaction(META, "readwrite");
|
|
284
|
+
tx.objectStore(META).put(snapshot, INDEX_KEY), await done(tx);
|
|
285
|
+
}
|
|
286
|
+
}, CacheStoragePartBackend = class _CacheStoragePartBackend {
|
|
287
|
+
constructor(cache) {
|
|
288
|
+
this.cache = cache;
|
|
289
|
+
}
|
|
290
|
+
static async open(storage, name = PART_STORE_NAME) {
|
|
291
|
+
return new _CacheStoragePartBackend(await storage.open(name));
|
|
292
|
+
}
|
|
293
|
+
async read(digest) {
|
|
294
|
+
let hit = await this.cache.match(`${CACHE_PREFIX}${digest}`);
|
|
295
|
+
return hit === void 0 ? null : new Uint8Array(await hit.arrayBuffer());
|
|
296
|
+
}
|
|
297
|
+
write(digest, bytes) {
|
|
298
|
+
return this.cache.put(`${CACHE_PREFIX}${digest}`, new Response(bytes.slice(), { headers: { "content-type": OCTETS } }));
|
|
299
|
+
}
|
|
300
|
+
async remove(digest) {
|
|
301
|
+
await this.cache.delete(`${CACHE_PREFIX}${digest}`);
|
|
302
|
+
}
|
|
303
|
+
async load() {
|
|
304
|
+
let hit = await this.cache.match(CACHE_INDEX);
|
|
305
|
+
return hit === void 0 ? null : await hit.json();
|
|
306
|
+
}
|
|
307
|
+
save(snapshot) {
|
|
308
|
+
return this.cache.put(CACHE_INDEX, new Response(JSON.stringify(snapshot), { headers: { "content-type": "application/json" } }));
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
function webStorageDisk(storage = globalThis.navigator?.storage) {
|
|
312
|
+
if (storage?.estimate !== void 0)
|
|
313
|
+
return {
|
|
314
|
+
free_bytes: async () => {
|
|
315
|
+
let estimate = await storage.estimate();
|
|
316
|
+
return estimate.quota === void 0 || estimate.usage === void 0 ? null : Math.max(0, estimate.quota - estimate.usage);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
async function openWebPartStore(options = {}) {
|
|
321
|
+
let scope = globalThis, backend = scope.indexedDB !== void 0 ? await IndexedDbPartBackend.open(scope.indexedDB).catch(() => new MemoryPartBackend()) : scope.caches !== void 0 ? await CacheStoragePartBackend.open(scope.caches).catch(() => new MemoryPartBackend()) : new MemoryPartBackend();
|
|
322
|
+
return SharedPartStore.open(backend, { disk: webStorageDisk(), disk_reserve_bytes: WEB_DISK_RESERVE_BYTES, ...options });
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// src/interactives/rooms/links/bridge.ts
|
|
326
|
+
var ROOM_LINK_HEADER_BYTES = 3, ROOM_FRAME_HEADER_BYTES = 4, ROOM_DIAL_HEADER_BYTES = 6, MAX_BRIDGE_LINKS = 64;
|
|
327
|
+
var ROOM_DIALED_OK = 1;
|
|
328
|
+
var TRANSPORT_CODES = [Transport.WebTransport, Transport.WebSocket];
|
|
329
|
+
function transportOf(code) {
|
|
330
|
+
return TRANSPORT_CODES[code] ?? null;
|
|
331
|
+
}
|
|
332
|
+
function linkOf(bytes) {
|
|
333
|
+
return bytes[1] | bytes[2] << 8;
|
|
334
|
+
}
|
|
335
|
+
function writeLinkHeader(out, at, tag, link) {
|
|
336
|
+
out[at] = tag, out[at + 1] = link & 255, out[at + 2] = link >>> 8;
|
|
337
|
+
}
|
|
338
|
+
function writeRoomFrame(port, tag, link, lane, bytes) {
|
|
339
|
+
let at = port.reserve((4) + bytes.length), out = port.out;
|
|
340
|
+
writeLinkHeader(out, at, tag, link), out[at + (3)] = lane, out.set(bytes, at + (4)), port.commitFrame();
|
|
341
|
+
}
|
|
342
|
+
function writeRoomSignal(port, tag, link) {
|
|
343
|
+
writeLinkHeader(port.out, port.reserve((3)), tag, link), port.commitTask();
|
|
344
|
+
}
|
|
345
|
+
new TextEncoder();
|
|
346
|
+
|
|
347
|
+
// src/interactives/runtime/camera-bridge.ts
|
|
348
|
+
new TextEncoder(); new TextDecoder();
|
|
349
|
+
|
|
350
|
+
// src/interactives/clips/mp4.ts
|
|
351
|
+
var CLIP_MP4_TYPE = "video/mp4";
|
|
352
|
+
var UNITY_MATRIX = [65536, 0, 0, 0, 65536, 0, 0, 0, 1073741824], BRANDS = ["isom", "iso6", "avc1", "mp41"], VIDEO_HANDLER = "VideoHandler", AUDIO_HANDLER = "SoundHandler";
|
|
353
|
+
function clipDurationMs(plan) {
|
|
354
|
+
let { ring, from, to } = plan.video.range;
|
|
355
|
+
return to <= from ? 0 : Math.round((ring.time(to - 1) + ring.duration(to - 1) - ring.time(from)) / 1e3);
|
|
356
|
+
}
|
|
357
|
+
var BoxWriter = class {
|
|
358
|
+
constructor() {
|
|
359
|
+
this.at = 0;
|
|
360
|
+
this.view = null;
|
|
361
|
+
this.bytes = null;
|
|
362
|
+
this.base = 0;
|
|
363
|
+
}
|
|
364
|
+
target(bytes, base) {
|
|
365
|
+
this.bytes = bytes, this.view = bytes === null ? null : new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength), this.base = base, this.at = 0;
|
|
366
|
+
}
|
|
367
|
+
u8(value) {
|
|
368
|
+
this.view?.setUint8(this.base + this.at, value), this.at += 1;
|
|
369
|
+
}
|
|
370
|
+
u16(value) {
|
|
371
|
+
this.view?.setUint16(this.base + this.at, value, false), this.at += 2;
|
|
372
|
+
}
|
|
373
|
+
i16(value) {
|
|
374
|
+
this.view?.setInt16(this.base + this.at, value, false), this.at += 2;
|
|
375
|
+
}
|
|
376
|
+
u24(value) {
|
|
377
|
+
this.u8(value >>> 16 & 255), this.u16(value & 65535);
|
|
378
|
+
}
|
|
379
|
+
u32(value) {
|
|
380
|
+
this.view?.setUint32(this.base + this.at, value >>> 0, false), this.at += 4;
|
|
381
|
+
}
|
|
382
|
+
i32(value) {
|
|
383
|
+
this.view?.setInt32(this.base + this.at, value, false), this.at += 4;
|
|
384
|
+
}
|
|
385
|
+
u64(value) {
|
|
386
|
+
this.u32(Math.floor(value / 4294967296)), this.u32(value >>> 0);
|
|
387
|
+
}
|
|
388
|
+
zeros(count) {
|
|
389
|
+
this.bytes !== null && this.bytes.fill(0, this.base + this.at, this.base + this.at + count), this.at += count;
|
|
390
|
+
}
|
|
391
|
+
ascii(text2) {
|
|
392
|
+
for (let i = 0; i < text2.length; i++) this.u8(text2.charCodeAt(i));
|
|
393
|
+
}
|
|
394
|
+
bytesFrom(source, from, length) {
|
|
395
|
+
this.bytes !== null && this.bytes.set(source.subarray(from, from + length), this.base + this.at), this.at += length;
|
|
396
|
+
}
|
|
397
|
+
box(type, body) {
|
|
398
|
+
let start = this.at;
|
|
399
|
+
this.u32(0), this.ascii(type), body(), this.view?.setUint32(this.base + start, this.at - start, false);
|
|
400
|
+
}
|
|
401
|
+
full(type, version, flags, body) {
|
|
402
|
+
this.box(type, () => {
|
|
403
|
+
this.u8(version), this.u24(flags), body();
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
patch32(at, value) {
|
|
407
|
+
this.view?.setInt32(this.base + at, value, false);
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
function scaled(us, timescale) {
|
|
411
|
+
return Math.round(us * timescale / 1e6);
|
|
412
|
+
}
|
|
413
|
+
function audioTimescale(track) {
|
|
414
|
+
return track.codec === "opus" ? 48e3 : track.sample_rate;
|
|
415
|
+
}
|
|
416
|
+
function descriptorLength(w, length) {
|
|
417
|
+
if (length <= 127) {
|
|
418
|
+
w.u8(length);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
w.u8(128 | length >>> 21 & 127), w.u8(128 | length >>> 14 & 127), w.u8(128 | length >>> 7 & 127), w.u8(length & 127);
|
|
422
|
+
}
|
|
423
|
+
function descriptorBytes(length) {
|
|
424
|
+
return length <= 127 ? 1 : 4;
|
|
425
|
+
}
|
|
426
|
+
var Mp4Writer = class {
|
|
427
|
+
constructor(plan) {
|
|
428
|
+
this.plan = plan;
|
|
429
|
+
this.w = new BoxWriter();
|
|
430
|
+
}
|
|
431
|
+
size() {
|
|
432
|
+
return this.w.target(null, 0), this.write(), this.w.at;
|
|
433
|
+
}
|
|
434
|
+
into(out, at) {
|
|
435
|
+
return this.w.target(out, at), this.write(), this.w.at;
|
|
436
|
+
}
|
|
437
|
+
write() {
|
|
438
|
+
let w = this.w;
|
|
439
|
+
w.box("ftyp", () => {
|
|
440
|
+
w.ascii("isom"), w.u32(512);
|
|
441
|
+
for (let brand of BRANDS) w.ascii(brand);
|
|
442
|
+
}), this.moov();
|
|
443
|
+
let moofAt = w.at, offsets = this.moof(), mdatPayload = w.at + 8 - moofAt;
|
|
444
|
+
w.patch32(offsets.video, mdatPayload), offsets.audio >= 0 && w.patch32(offsets.audio, mdatPayload + this.rangeBytes(this.plan.video.range)), this.mdat();
|
|
445
|
+
}
|
|
446
|
+
durationMs() {
|
|
447
|
+
return clipDurationMs(this.plan);
|
|
448
|
+
}
|
|
449
|
+
moov() {
|
|
450
|
+
let w = this.w, plan = this.plan;
|
|
451
|
+
w.box("moov", () => {
|
|
452
|
+
w.full("mvhd", 0, 0, () => {
|
|
453
|
+
w.u32(0), w.u32(0), w.u32(1e3), w.u32(0), w.u32(65536), w.u16(256), w.zeros(10);
|
|
454
|
+
for (let value of UNITY_MATRIX) w.u32(value);
|
|
455
|
+
w.zeros(24), w.u32(plan.audio === null ? 2 : 3);
|
|
456
|
+
}), this.videoTrak(), plan.audio !== null && this.audioTrak(plan.audio.track), w.box("mvex", () => {
|
|
457
|
+
w.full("mehd", 0, 0, () => w.u32(this.durationMs())), this.trex(1), plan.audio !== null && this.trex(2);
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
trex(track) {
|
|
462
|
+
let w = this.w;
|
|
463
|
+
w.full("trex", 0, 0, () => {
|
|
464
|
+
w.u32(track), w.u32(1), w.u32(0), w.u32(0), w.u32(0);
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
tkhd(track, audio, width, height) {
|
|
468
|
+
let w = this.w;
|
|
469
|
+
w.full("tkhd", 0, 3, () => {
|
|
470
|
+
w.u32(0), w.u32(0), w.u32(track), w.u32(0), w.u32(0), w.zeros(8), w.u16(0), w.u16(audio ? 1 : 0), w.u16(audio ? 256 : 0), w.u16(0);
|
|
471
|
+
for (let value of UNITY_MATRIX) w.u32(value);
|
|
472
|
+
w.u32(width * 65536), w.u32(height * 65536);
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
mdhd(timescale) {
|
|
476
|
+
let w = this.w;
|
|
477
|
+
w.full("mdhd", 0, 0, () => {
|
|
478
|
+
w.u32(0), w.u32(0), w.u32(timescale), w.u32(0), w.u16(21956), w.u16(0);
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
hdlr(handler, name) {
|
|
482
|
+
let w = this.w;
|
|
483
|
+
w.full("hdlr", 0, 0, () => {
|
|
484
|
+
w.u32(0), w.ascii(handler), w.zeros(12), w.ascii(name), w.u8(0);
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
dinf() {
|
|
488
|
+
let w = this.w;
|
|
489
|
+
w.box("dinf", () => {
|
|
490
|
+
w.full("dref", 0, 0, () => {
|
|
491
|
+
w.u32(1), w.full("url ", 0, 1, () => {
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
emptyTables() {
|
|
497
|
+
let w = this.w;
|
|
498
|
+
w.full("stts", 0, 0, () => w.u32(0)), w.full("stsc", 0, 0, () => w.u32(0)), w.full("stsz", 0, 0, () => {
|
|
499
|
+
w.u32(0), w.u32(0);
|
|
500
|
+
}), w.full("stco", 0, 0, () => w.u32(0));
|
|
501
|
+
}
|
|
502
|
+
videoTrak() {
|
|
503
|
+
let w = this.w, track = this.plan.video.track;
|
|
504
|
+
w.box("trak", () => {
|
|
505
|
+
this.tkhd(1, false, track.width, track.height), w.box("mdia", () => {
|
|
506
|
+
this.mdhd(9e4), this.hdlr("vide", VIDEO_HANDLER), w.box("minf", () => {
|
|
507
|
+
w.full("vmhd", 0, 1, () => w.zeros(8)), this.dinf(), w.box("stbl", () => {
|
|
508
|
+
w.full("stsd", 0, 0, () => {
|
|
509
|
+
w.u32(1), w.box("avc1", () => {
|
|
510
|
+
w.zeros(6), w.u16(1), w.zeros(16), w.u16(track.width), w.u16(track.height), w.u32(4718592), w.u32(4718592), w.u32(0), w.u16(1), w.zeros(32), w.u16(24), w.u16(65535), w.box("avcC", () => w.bytesFrom(track.description, 0, track.description.length));
|
|
511
|
+
});
|
|
512
|
+
}), this.emptyTables();
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
audioTrak(track) {
|
|
519
|
+
let w = this.w;
|
|
520
|
+
w.box("trak", () => {
|
|
521
|
+
this.tkhd(2, true, 0, 0), w.box("mdia", () => {
|
|
522
|
+
this.mdhd(audioTimescale(track)), this.hdlr("soun", AUDIO_HANDLER), w.box("minf", () => {
|
|
523
|
+
w.full("smhd", 0, 0, () => w.zeros(4)), this.dinf(), w.box("stbl", () => {
|
|
524
|
+
w.full("stsd", 0, 0, () => {
|
|
525
|
+
w.u32(1), w.box(track.codec === "opus" ? "Opus" : "mp4a", () => {
|
|
526
|
+
w.zeros(6), w.u16(1), w.zeros(8), w.u16(track.channels), w.u16(16), w.u32(0), w.u32((track.codec === "opus" ? 48e3 : track.sample_rate) * 65536), track.codec === "opus" ? this.dops(track) : this.esds(track);
|
|
527
|
+
});
|
|
528
|
+
}), this.emptyTables();
|
|
529
|
+
});
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
esds(track) {
|
|
535
|
+
let w = this.w, config = track.description ?? new Uint8Array(0), decoder7 = 13 + (1 + descriptorBytes(config.length) + config.length), es = 4 + descriptorBytes(decoder7) + decoder7 + 3;
|
|
536
|
+
w.full("esds", 0, 0, () => {
|
|
537
|
+
w.u8(3), descriptorLength(w, es), w.u16(2), w.u8(0), w.u8(4), descriptorLength(w, decoder7), w.u8(64), w.u8(21), w.u24(0), w.u32(0), w.u32(0), w.u8(5), descriptorLength(w, config.length), w.bytesFrom(config, 0, config.length), w.u8(6), w.u8(1), w.u8(2);
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
dops(track) {
|
|
541
|
+
let w = this.w, head = track.description, parsed = head !== null && head.length >= 19 ? new DataView(head.buffer, head.byteOffset, head.byteLength) : null;
|
|
542
|
+
w.box("dOps", () => {
|
|
543
|
+
w.u8(0), w.u8(parsed === null ? track.channels : parsed.getUint8(9)), w.u16(parsed === null ? 312 : parsed.getUint16(10, true)), w.u32(parsed === null ? track.sample_rate : parsed.getUint32(12, true)), w.i16(parsed === null ? 0 : parsed.getInt16(16, true)), w.u8(parsed === null ? 0 : parsed.getUint8(18));
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
rangeBytes(range) {
|
|
547
|
+
let total = 0;
|
|
548
|
+
for (let i = range.from; i < range.to; i++) total += range.ring.length(i);
|
|
549
|
+
return total;
|
|
550
|
+
}
|
|
551
|
+
moof() {
|
|
552
|
+
let w = this.w, plan = this.plan, start = plan.video.range.ring.time(plan.video.range.from), video = 0, audio = -1;
|
|
553
|
+
return w.box("moof", () => {
|
|
554
|
+
w.full("mfhd", 0, 0, () => w.u32(1)), video = this.traf(1, plan.video.range, 9e4, start, true), plan.audio !== null && (audio = this.traf(2, plan.audio.range, audioTimescale(plan.audio.track), start, false));
|
|
555
|
+
}), { video, audio };
|
|
556
|
+
}
|
|
557
|
+
traf(track, range, timescale, start_us, video) {
|
|
558
|
+
let w = this.w, ring = range.ring, dataOffset = 0;
|
|
559
|
+
return w.box("traf", () => {
|
|
560
|
+
w.full("tfhd", 0, 131072, () => w.u32(track));
|
|
561
|
+
let first = range.to > range.from ? ring.time(range.from) : start_us;
|
|
562
|
+
w.full("tfdt", 1, 0, () => w.u64(Math.max(0, scaled(first - start_us, timescale)))), w.full("trun", 0, video ? 1793 : 769, () => {
|
|
563
|
+
w.u32(range.to - range.from), dataOffset = w.at, w.i32(0);
|
|
564
|
+
for (let i = range.from; i < range.to; i++) {
|
|
565
|
+
let at = scaled(ring.time(i) - first, timescale), end = i + 1 < range.to ? scaled(ring.time(i + 1) - first, timescale) : scaled(ring.time(i) + ring.duration(i) - first, timescale);
|
|
566
|
+
w.u32(Math.max(1, end - at)), w.u32(ring.length(i)), video && w.u32(ring.key(i) ? 33554432 : 16842752);
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
}), dataOffset;
|
|
570
|
+
}
|
|
571
|
+
mdat() {
|
|
572
|
+
let w = this.w, plan = this.plan;
|
|
573
|
+
w.box("mdat", () => {
|
|
574
|
+
this.samples(plan.video.range), plan.audio !== null && this.samples(plan.audio.range);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
samples(range) {
|
|
578
|
+
let ring = range.ring;
|
|
579
|
+
for (let i = range.from; i < range.to; i++) this.w.bytesFrom(ring.arena, ring.offset(i), ring.length(i));
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
function muxMp4(plan) {
|
|
583
|
+
let writer = new Mp4Writer(plan), out = new Uint8Array(writer.size());
|
|
584
|
+
return writer.into(out, 0), out;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// src/interactives/clips/ring.ts
|
|
588
|
+
var EncodedRing = class {
|
|
589
|
+
constructor(options) {
|
|
590
|
+
this.head = 0;
|
|
591
|
+
this.size = 0;
|
|
592
|
+
this.writePage = 0;
|
|
593
|
+
this.dropped = 0;
|
|
594
|
+
let pageBytes = options.page_bytes ?? 1024, pageCount = Math.max(1, Math.ceil(options.capacity_bytes / pageBytes));
|
|
595
|
+
this.pageBytes = pageBytes, this.arena = new Uint8Array(pageCount * pageBytes), this.pages = [];
|
|
596
|
+
for (let page = 0; page < pageCount; page++) this.pages.push(this.arena.subarray(page * pageBytes));
|
|
597
|
+
this.maxSamples = options.max_samples, this.starts = new Uint32Array(options.max_samples), this.lengths = new Uint32Array(options.max_samples), this.times = new Float64Array(options.max_samples), this.durations = new Float64Array(options.max_samples), this.keys = new Uint8Array(options.max_samples);
|
|
598
|
+
}
|
|
599
|
+
get count() {
|
|
600
|
+
return this.size;
|
|
601
|
+
}
|
|
602
|
+
get pageCount() {
|
|
603
|
+
return this.pages.length;
|
|
604
|
+
}
|
|
605
|
+
slot(index) {
|
|
606
|
+
return (this.head + index) % this.maxSamples;
|
|
607
|
+
}
|
|
608
|
+
push(sample, time_us, duration_us, key) {
|
|
609
|
+
let length = sample.byteLength, pageCount = this.pages.length, need = Math.ceil(length / this.pageBytes) || 1;
|
|
610
|
+
if (need > pageCount)
|
|
611
|
+
return this.dropped++, false;
|
|
612
|
+
this.size === 0 && (this.writePage = 0);
|
|
613
|
+
let from = this.writePage, wraps = from + need > pageCount, span = wraps ? pageCount - from + need : need;
|
|
614
|
+
for (; this.size > 0 && (this.size === this.maxSamples || (this.starts[this.head] - from + pageCount) % pageCount < span); ) this.evict();
|
|
615
|
+
let start = wraps ? 0 : from;
|
|
616
|
+
sample.copyTo(this.pages[start]);
|
|
617
|
+
let slot = this.slot(this.size);
|
|
618
|
+
this.starts[slot] = start, this.lengths[slot] = length, this.times[slot] = time_us, this.durations[slot] = duration_us, this.keys[slot] = key ? 1 : 0, this.size++;
|
|
619
|
+
let end = start + need;
|
|
620
|
+
return this.writePage = end === pageCount ? 0 : end, true;
|
|
621
|
+
}
|
|
622
|
+
evict() {
|
|
623
|
+
this.head = (this.head + 1) % this.maxSamples, this.size--;
|
|
624
|
+
}
|
|
625
|
+
retain(window_us) {
|
|
626
|
+
if (this.size === 0) return;
|
|
627
|
+
let cutoff = this.endUs() - window_us;
|
|
628
|
+
for (; ; ) {
|
|
629
|
+
let next = this.nextKey(1);
|
|
630
|
+
if (next === -1 || this.times[this.slot(next)] > cutoff) return;
|
|
631
|
+
for (let i = 0; i < next; i++) this.evict();
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
nextKey(from) {
|
|
635
|
+
for (let i = from; i < this.size; i++) if (this.keys[this.slot(i)] === 1) return i;
|
|
636
|
+
return -1;
|
|
637
|
+
}
|
|
638
|
+
endUs() {
|
|
639
|
+
if (this.size === 0) return 0;
|
|
640
|
+
let last = this.slot(this.size - 1);
|
|
641
|
+
return this.times[last] + this.durations[last];
|
|
642
|
+
}
|
|
643
|
+
startFor(keep_us) {
|
|
644
|
+
if (this.size === 0) return -1;
|
|
645
|
+
let target = this.endUs() - keep_us, chosen = this.nextKey(0);
|
|
646
|
+
if (chosen === -1) return -1;
|
|
647
|
+
for (let i = chosen + 1; i < this.size; i++) {
|
|
648
|
+
let slot = this.slot(i);
|
|
649
|
+
if (this.times[slot] > target) break;
|
|
650
|
+
this.keys[slot] === 1 && (chosen = i);
|
|
651
|
+
}
|
|
652
|
+
return chosen;
|
|
653
|
+
}
|
|
654
|
+
firstAtOrAfter(time_us) {
|
|
655
|
+
for (let i = 0; i < this.size; i++) if (this.times[this.slot(i)] >= time_us) return i;
|
|
656
|
+
return -1;
|
|
657
|
+
}
|
|
658
|
+
offset(index) {
|
|
659
|
+
return this.starts[this.slot(index)] * this.pageBytes;
|
|
660
|
+
}
|
|
661
|
+
length(index) {
|
|
662
|
+
return this.lengths[this.slot(index)];
|
|
663
|
+
}
|
|
664
|
+
time(index) {
|
|
665
|
+
return this.times[this.slot(index)];
|
|
666
|
+
}
|
|
667
|
+
duration(index) {
|
|
668
|
+
return this.durations[this.slot(index)];
|
|
669
|
+
}
|
|
670
|
+
key(index) {
|
|
671
|
+
return this.keys[this.slot(index)] === 1;
|
|
672
|
+
}
|
|
673
|
+
clear() {
|
|
674
|
+
this.head = 0, this.size = 0, this.writePage = 0;
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
// src/interactives/runtime/font-bridge.ts
|
|
679
|
+
var FONT_TAG_BYTES = 1, FONT_WORD_BYTES = 4, FONT_ID_AT = (1), FONT_CODEPOINT_AT = FONT_ID_AT + (4), FONT_REQUEST_BYTES = FONT_CODEPOINT_AT + (4), FONT_REPLY_HEADER_BYTES = FONT_ID_AT + (4);
|
|
680
|
+
|
|
681
|
+
// src/game/text/fallback-fonts.ts
|
|
682
|
+
var MANIFEST_VERSION = 1, MANIFEST_FILE = "manifest.json", NOTO_FALLBACK_PATH = `fonts/noto/v${(1)}/`, HEX = 16, HEX_DIGITS = 2, SECURE_PROTOCOL = "https:", LOOPBACK_HOSTS = ["localhost", "127.0.0.1", "[::1]"];
|
|
683
|
+
function notoFallbackBase(cdnBase) {
|
|
684
|
+
return new URL(NOTO_FALLBACK_PATH, cdnBase.endsWith("/") ? cdnBase : `${cdnBase}/`).href;
|
|
685
|
+
}
|
|
686
|
+
function hex2(bytes) {
|
|
687
|
+
let out = "";
|
|
688
|
+
for (let byte of bytes) out += byte.toString((16)).padStart((2), "0");
|
|
689
|
+
return out;
|
|
690
|
+
}
|
|
691
|
+
function sha256Hex2(bytes) {
|
|
692
|
+
let digest = new Uint8Array(SHA256_BYTES);
|
|
693
|
+
return sha256Into(bytes, digest), hex2(digest);
|
|
694
|
+
}
|
|
695
|
+
function covers(face, codepoint) {
|
|
696
|
+
let ranges = face.ranges, low = 0, high = ranges.length;
|
|
697
|
+
for (; low < high; ) {
|
|
698
|
+
let middle = low + high >>> 1;
|
|
699
|
+
ranges[middle][1] < codepoint ? low = middle + 1 : high = middle;
|
|
700
|
+
}
|
|
701
|
+
return low < ranges.length && ranges[low][0] <= codepoint;
|
|
702
|
+
}
|
|
703
|
+
function languageRank(face, language) {
|
|
704
|
+
if (face.language === null) return 1;
|
|
705
|
+
let wanted = language.toLowerCase(), own = face.language.toLowerCase();
|
|
706
|
+
return wanted === own || wanted.startsWith(`${own}-`) || own === "zh-hant" && (wanted === "zh-tw" || wanted === "zh-hk" || wanted === "zh-mo") || own === "zh-hans" && wanted === "zh" ? 0 : 2;
|
|
707
|
+
}
|
|
708
|
+
function pickNotoFace(manifest, codepoint, language = "") {
|
|
709
|
+
let best = null, bestRank = Number.POSITIVE_INFINITY;
|
|
710
|
+
for (let face of manifest.faces) {
|
|
711
|
+
if (!covers(face, codepoint)) continue;
|
|
712
|
+
let rank = languageRank(face, language);
|
|
713
|
+
rank < bestRank && (best = face, bestRank = rank);
|
|
714
|
+
}
|
|
715
|
+
return best;
|
|
716
|
+
}
|
|
717
|
+
function checkBase(base) {
|
|
718
|
+
let url = new URL(base);
|
|
719
|
+
if (url.protocol !== SECURE_PROTOCOL && !LOOPBACK_HOSTS.includes(url.hostname))
|
|
720
|
+
throw new Error(`fallback faces come only from the CDN over TLS, not ${base}`);
|
|
721
|
+
}
|
|
722
|
+
function notoFallbackSource(base, fetcher, options = {}) {
|
|
723
|
+
checkBase(base);
|
|
724
|
+
let root = base.endsWith("/") ? base : `${base}/`, manifest = null, loaded = /* @__PURE__ */ new Map(), readManifest = () => {
|
|
725
|
+
manifest ?? (manifest = fetcher(new URL(MANIFEST_FILE, root).href).then(
|
|
726
|
+
async (response) => {
|
|
727
|
+
if (!response.ok) return null;
|
|
728
|
+
let parsed = JSON.parse(new TextDecoder().decode(await response.arrayBuffer()));
|
|
729
|
+
return parsed.version === (1) ? parsed : null;
|
|
730
|
+
},
|
|
731
|
+
() => null
|
|
732
|
+
));
|
|
733
|
+
let current = manifest;
|
|
734
|
+
return current.then((found) => {
|
|
735
|
+
found === null && manifest === current && (manifest = null);
|
|
736
|
+
}), current;
|
|
737
|
+
};
|
|
738
|
+
return async (codepoint) => {
|
|
739
|
+
let found = await readManifest();
|
|
740
|
+
if (found === null) return null;
|
|
741
|
+
let face = pickNotoFace(found, codepoint, options.language);
|
|
742
|
+
if (face === null) return null;
|
|
743
|
+
let pending = loaded.get(face.file);
|
|
744
|
+
if (pending === void 0) {
|
|
745
|
+
pending = fetcher(new URL(face.file, root).href).then(
|
|
746
|
+
async (response) => {
|
|
747
|
+
if (!response.ok) return null;
|
|
748
|
+
let bytes = new Uint8Array(await response.arrayBuffer());
|
|
749
|
+
return bytes.byteLength === face.bytes && sha256Hex2(bytes) === face.sha256 ? bytes : null;
|
|
750
|
+
},
|
|
751
|
+
() => null
|
|
752
|
+
), loaded.set(face.file, pending);
|
|
753
|
+
let current = pending;
|
|
754
|
+
current.then((bytes) => {
|
|
755
|
+
bytes === null && loaded.get(face.file) === current && loaded.delete(face.file);
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
return pending;
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
new TextEncoder(); new TextDecoder();
|
|
762
|
+
var TRUE = "true", LIVE_POLITE = "polite";
|
|
763
|
+
(() => {
|
|
764
|
+
let roles = [];
|
|
765
|
+
return roles[UiRole.none] = null, roles[UiRole.group] = "group", roles[UiRole.text] = null, roles[UiRole.button] = "button", roles[UiRole.image] = "img", roles[UiRole.header] = "heading", roles[UiRole.link] = "link", roles[UiRole.adjustable] = "slider", roles[UiRole.tab] = "tab", roles[UiRole.tab_list] = "tablist", roles[UiRole.progress] = "progressbar", roles[UiRole.text_field] = "textbox", roles[UiRole.scroll_view] = "region", roles[UiRole.alert] = "alert", roles;
|
|
766
|
+
})(); [
|
|
767
|
+
[UiTrait.selected, "aria-selected", TRUE],
|
|
768
|
+
[UiTrait.disabled, "aria-disabled", TRUE],
|
|
769
|
+
[UiTrait.hidden, "aria-hidden", TRUE],
|
|
770
|
+
[UiTrait.live, "aria-live", LIVE_POLITE],
|
|
771
|
+
[UiTrait.modal, "aria-modal", TRUE]
|
|
772
|
+
];
|
|
773
|
+
new TextDecoder();
|
|
774
|
+
|
|
775
|
+
// src/interactives/runtime/game-ui/host.ts
|
|
776
|
+
new TextDecoder(); new TextEncoder();
|
|
777
|
+
|
|
778
|
+
// src/interactives/runtime/port-bridge.ts
|
|
779
|
+
function animationFrameScheduler(scope = globalThis) {
|
|
780
|
+
let raf = scope.requestAnimationFrame?.bind(scope);
|
|
781
|
+
return {
|
|
782
|
+
task: (flush) => queueMicrotask(flush),
|
|
783
|
+
frame: raf === void 0 ? (flush) => queueMicrotask(flush) : (flush) => {
|
|
784
|
+
raf(flush);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
var PortBridge = class {
|
|
789
|
+
constructor(port, scheduler) {
|
|
790
|
+
this.port = port;
|
|
791
|
+
this.scheduler = scheduler;
|
|
792
|
+
this.free = [];
|
|
793
|
+
this.transfer = [new ArrayBuffer(0)];
|
|
794
|
+
this.listener = () => {
|
|
795
|
+
};
|
|
796
|
+
this.buffer = null;
|
|
797
|
+
this.bytes = new Uint8Array(0);
|
|
798
|
+
this.view = new DataView(new ArrayBuffer(4));
|
|
799
|
+
this.used = 4;
|
|
800
|
+
this.taskPending = false;
|
|
801
|
+
this.framePending = false;
|
|
802
|
+
this.allocatedCount = 0;
|
|
803
|
+
this.batchCount = 0;
|
|
804
|
+
this.recordCount = 0;
|
|
805
|
+
this.flushTask = () => {
|
|
806
|
+
this.taskPending = false, this.flush();
|
|
807
|
+
};
|
|
808
|
+
this.flushFrame = () => {
|
|
809
|
+
this.framePending = false, this.flush();
|
|
810
|
+
};
|
|
811
|
+
port.addEventListener("message", (event) => this.receive(event.data)), port.start?.();
|
|
812
|
+
}
|
|
813
|
+
get stats() {
|
|
814
|
+
return { allocated: this.allocatedCount, batches: this.batchCount, records: this.recordCount };
|
|
815
|
+
}
|
|
816
|
+
get pooled() {
|
|
817
|
+
return this.free.length;
|
|
818
|
+
}
|
|
819
|
+
on_message(listener) {
|
|
820
|
+
this.listener = listener;
|
|
821
|
+
}
|
|
822
|
+
send(bytes, length) {
|
|
823
|
+
this.write(bytes, length), this.scheduleTask();
|
|
824
|
+
}
|
|
825
|
+
sendFrame(bytes, length) {
|
|
826
|
+
this.write(bytes, length), this.scheduleFrame();
|
|
827
|
+
}
|
|
828
|
+
write(bytes, length) {
|
|
829
|
+
let at = this.reserve(length);
|
|
830
|
+
this.bytes.set(bytes.subarray(0, length), at);
|
|
831
|
+
}
|
|
832
|
+
reserve(length) {
|
|
833
|
+
let needed = 4 + length;
|
|
834
|
+
if (4 + needed > 65536) return this.dedicated(length);
|
|
835
|
+
(this.buffer === null || this.used + needed > 65536) && (this.flush(), this.open()), this.view.setUint32(this.used, length, true);
|
|
836
|
+
let at = this.used + 4;
|
|
837
|
+
return this.used += needed, this.recordCount++, at;
|
|
838
|
+
}
|
|
839
|
+
get out() {
|
|
840
|
+
return this.bytes;
|
|
841
|
+
}
|
|
842
|
+
commitFrame() {
|
|
843
|
+
this.scheduleFrame();
|
|
844
|
+
}
|
|
845
|
+
commitTask() {
|
|
846
|
+
this.scheduleTask();
|
|
847
|
+
}
|
|
848
|
+
dedicated(length) {
|
|
849
|
+
this.flush();
|
|
850
|
+
let buffer = new ArrayBuffer(8 + length);
|
|
851
|
+
return this.buffer = buffer, this.bytes = new Uint8Array(buffer), this.view = new DataView(buffer), this.view.setUint32(4, length, true), this.used = buffer.byteLength, this.recordCount++, 8;
|
|
852
|
+
}
|
|
853
|
+
open() {
|
|
854
|
+
let buffer = this.free.pop();
|
|
855
|
+
buffer === void 0 && (buffer = new ArrayBuffer(65536), this.allocatedCount++), this.buffer = buffer, this.bytes = new Uint8Array(buffer), this.view = new DataView(buffer), this.used = 4;
|
|
856
|
+
}
|
|
857
|
+
scheduleTask() {
|
|
858
|
+
this.taskPending || (this.taskPending = true, this.scheduler.task(this.flushTask));
|
|
859
|
+
}
|
|
860
|
+
scheduleFrame() {
|
|
861
|
+
this.framePending || this.taskPending || (this.framePending = true, this.scheduler.frame(this.flushFrame));
|
|
862
|
+
}
|
|
863
|
+
flush() {
|
|
864
|
+
let buffer = this.buffer;
|
|
865
|
+
buffer === null || this.used === 4 || (this.view.setUint32(0, this.used, true), this.buffer = null, this.used = 4, this.batchCount++, this.post(buffer));
|
|
866
|
+
}
|
|
867
|
+
post(buffer) {
|
|
868
|
+
this.transfer[0] = buffer, this.port.postMessage(buffer, this.transfer);
|
|
869
|
+
}
|
|
870
|
+
receive(buffer) {
|
|
871
|
+
if (buffer.byteLength < 4) return;
|
|
872
|
+
let view = new DataView(buffer), header = view.getUint32(0, true);
|
|
873
|
+
if (header === 0) {
|
|
874
|
+
buffer.byteLength === 65536 && this.free.push(buffer);
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
let used = Math.min(header, buffer.byteLength), at = 4;
|
|
878
|
+
for (; at + 4 <= used; ) {
|
|
879
|
+
let length = view.getUint32(at, true);
|
|
880
|
+
at += 4, this.listener(new Uint8Array(buffer, at, length)), at += length;
|
|
881
|
+
}
|
|
882
|
+
buffer.byteLength === 65536 && (view.setUint32(0, 0, true), this.post(buffer));
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
// src/interactives/runtime/canvas-entry.ts
|
|
887
|
+
var HEARTBEAT_BYTES = 16, HEARTBEAT_COUNT_WORD = 0, HEARTBEAT_HEAP_OFFSET = 8;
|
|
888
|
+
|
|
889
|
+
// src/interactives/hosts/clip-relay.ts
|
|
890
|
+
var ClipRelay = class {
|
|
891
|
+
constructor(port) {
|
|
892
|
+
this.port = port;
|
|
893
|
+
this.writer = new MessageWriter(256);
|
|
894
|
+
this.pauseMessage = new Uint8Array(CLIP_PAUSE_BYTES);
|
|
895
|
+
this.saveMessage = new Uint8Array(CLIP_SAVE_BYTES);
|
|
896
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
897
|
+
this.nextId = 1;
|
|
898
|
+
this.live = false;
|
|
899
|
+
this.listener = () => {
|
|
900
|
+
};
|
|
901
|
+
this.closed = false;
|
|
902
|
+
}
|
|
903
|
+
get camera_live() {
|
|
904
|
+
return this.live;
|
|
905
|
+
}
|
|
906
|
+
on_camera_live(listener) {
|
|
907
|
+
this.listener = listener;
|
|
908
|
+
}
|
|
909
|
+
cameraLive(live) {
|
|
910
|
+
this.live !== live && (this.live = live, this.listener(live));
|
|
911
|
+
}
|
|
912
|
+
arm(config) {
|
|
913
|
+
if (!this.closed) {
|
|
914
|
+
if (config === null) {
|
|
915
|
+
this.writer.bytes[0] = MessageTag.clip_arm, this.port.send(this.writer.bytes, 1);
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
this.port.send(this.writer.bytes, this.writer.json(MessageTag.clip_arm, config));
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
pause(paused) {
|
|
922
|
+
this.closed || this.port.send(this.pauseMessage, writeClipPause(this.pauseMessage, paused));
|
|
923
|
+
}
|
|
924
|
+
save(keep_ms) {
|
|
925
|
+
if (this.closed) return Promise.resolve(null);
|
|
926
|
+
let id = this.nextId;
|
|
927
|
+
return this.nextId = this.nextId + 1 >>> 0 || 1, new Promise((resolve) => {
|
|
928
|
+
this.pending.set(id, resolve), this.port.send(this.saveMessage, writeClipSave(this.saveMessage, id, keep_ms));
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
handle(bytes) {
|
|
932
|
+
if (bytes[0] !== MessageTag.clip_saved) return false;
|
|
933
|
+
let saved = readClipSaved(bytes);
|
|
934
|
+
if (saved === null) return true;
|
|
935
|
+
let header = saved.header, resolve = this.pending.get(header.id);
|
|
936
|
+
return resolve === void 0 ? true : (this.pending.delete(header.id), header.status !== ClipStatus.saved || saved.body.length === 0 ? (resolve(null), true) : (resolve({
|
|
937
|
+
blob: new Blob([saved.body], { type: header.type }),
|
|
938
|
+
type: header.type,
|
|
939
|
+
duration_ms: header.duration_ms,
|
|
940
|
+
width: header.width,
|
|
941
|
+
height: header.height
|
|
942
|
+
}), true));
|
|
943
|
+
}
|
|
944
|
+
shutdown() {
|
|
945
|
+
this.closed = true;
|
|
946
|
+
for (let resolve of this.pending.values()) resolve(null);
|
|
947
|
+
this.pending.clear();
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
// src/interactives/runtime/face-arkit.ts
|
|
952
|
+
var expression = (name) => FACE_LAYOUT.expressions.indexOf(name), weight = (name) => FACE_LAYOUT.arkit.indexOf(name), ARKIT_WEIGHTS = FACE_LAYOUT.arkit.length, DERIVED_WEIGHTS = Int32Array.of(
|
|
953
|
+
weight("mouth_smile_left"),
|
|
954
|
+
weight("mouth_smile_right"),
|
|
955
|
+
weight("jaw_open"),
|
|
956
|
+
weight("eye_blink_left"),
|
|
957
|
+
weight("eye_blink_right"),
|
|
958
|
+
weight("brow_inner_up"),
|
|
959
|
+
weight("brow_outer_up_left"),
|
|
960
|
+
weight("brow_outer_up_right"),
|
|
961
|
+
weight("mouth_pucker")
|
|
962
|
+
), DERIVED_SOURCES = Int32Array.of(
|
|
963
|
+
expression("smile"),
|
|
964
|
+
expression("smile"),
|
|
965
|
+
expression("jaw_open"),
|
|
966
|
+
expression("blink_left"),
|
|
967
|
+
expression("blink_right"),
|
|
968
|
+
expression("brow_raise"),
|
|
969
|
+
expression("brow_raise"),
|
|
970
|
+
expression("brow_raise"),
|
|
971
|
+
expression("pucker")
|
|
972
|
+
);
|
|
973
|
+
function deriveArkit(expressions, out) {
|
|
974
|
+
out.fill(0, 0, ARKIT_WEIGHTS);
|
|
975
|
+
for (let i = 0; i < DERIVED_WEIGHTS.length; i++) out[DERIVED_WEIGHTS[i]] = expressions[DERIVED_SOURCES[i]];
|
|
976
|
+
}
|
|
977
|
+
var UPPER = /[A-Z]/g;
|
|
978
|
+
function arkitIndex(blendshape) {
|
|
979
|
+
let snake = blendshape.replace(UPPER, (letter) => `_${letter.toLowerCase()}`);
|
|
980
|
+
return FACE_LAYOUT.arkit.indexOf(snake);
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// src/interactives/runtime/face-canonical.ts
|
|
984
|
+
var CANONICAL_FACE = Float32Array.of(
|
|
985
|
+
0,
|
|
986
|
+
-3.406404,
|
|
987
|
+
5.979507,
|
|
988
|
+
0,
|
|
989
|
+
-1.126865,
|
|
990
|
+
7.475604,
|
|
991
|
+
0,
|
|
992
|
+
-2.089024,
|
|
993
|
+
6.058267,
|
|
994
|
+
-0.463928,
|
|
995
|
+
0.955357,
|
|
996
|
+
6.633583,
|
|
997
|
+
0,
|
|
998
|
+
-0.46317,
|
|
999
|
+
7.58658,
|
|
1000
|
+
0,
|
|
1001
|
+
0.365669,
|
|
1002
|
+
7.24287,
|
|
1003
|
+
0,
|
|
1004
|
+
2.473255,
|
|
1005
|
+
5.788627,
|
|
1006
|
+
-4.253081,
|
|
1007
|
+
2.577646,
|
|
1008
|
+
3.279702,
|
|
1009
|
+
0,
|
|
1010
|
+
4.019042,
|
|
1011
|
+
5.284764,
|
|
1012
|
+
0,
|
|
1013
|
+
4.885979,
|
|
1014
|
+
5.385258,
|
|
1015
|
+
0,
|
|
1016
|
+
8.261778,
|
|
1017
|
+
4.481535,
|
|
1018
|
+
0,
|
|
1019
|
+
-3.706811,
|
|
1020
|
+
5.864924,
|
|
1021
|
+
0,
|
|
1022
|
+
-3.918301,
|
|
1023
|
+
5.56943,
|
|
1024
|
+
0,
|
|
1025
|
+
-3.994436,
|
|
1026
|
+
5.219482,
|
|
1027
|
+
0,
|
|
1028
|
+
-4.5424,
|
|
1029
|
+
5.404754,
|
|
1030
|
+
0,
|
|
1031
|
+
-4.745577,
|
|
1032
|
+
5.529457,
|
|
1033
|
+
0,
|
|
1034
|
+
-5.019567,
|
|
1035
|
+
5.601448,
|
|
1036
|
+
0,
|
|
1037
|
+
-5.365123,
|
|
1038
|
+
5.535441,
|
|
1039
|
+
0,
|
|
1040
|
+
-6.149624,
|
|
1041
|
+
5.071372,
|
|
1042
|
+
0,
|
|
1043
|
+
-1.501095,
|
|
1044
|
+
7.112196,
|
|
1045
|
+
-0.416106,
|
|
1046
|
+
-1.466449,
|
|
1047
|
+
6.447657,
|
|
1048
|
+
-7.08796,
|
|
1049
|
+
5.434801,
|
|
1050
|
+
0.09962,
|
|
1051
|
+
-2.628639,
|
|
1052
|
+
2.035898,
|
|
1053
|
+
3.848121,
|
|
1054
|
+
-3.198363,
|
|
1055
|
+
1.985815,
|
|
1056
|
+
3.796952,
|
|
1057
|
+
-3.775151,
|
|
1058
|
+
2.039402,
|
|
1059
|
+
3.646194,
|
|
1060
|
+
-4.465819,
|
|
1061
|
+
2.42295,
|
|
1062
|
+
3.155168,
|
|
1063
|
+
-2.164289,
|
|
1064
|
+
2.189867,
|
|
1065
|
+
3.851822,
|
|
1066
|
+
-3.208229,
|
|
1067
|
+
3.223926,
|
|
1068
|
+
4.115822,
|
|
1069
|
+
-2.673803,
|
|
1070
|
+
3.205337,
|
|
1071
|
+
4.092203,
|
|
1072
|
+
-3.745193,
|
|
1073
|
+
3.165286,
|
|
1074
|
+
3.972409,
|
|
1075
|
+
-4.161018,
|
|
1076
|
+
3.059069,
|
|
1077
|
+
3.719554,
|
|
1078
|
+
-5.062006,
|
|
1079
|
+
1.934418,
|
|
1080
|
+
2.776093,
|
|
1081
|
+
-2.266659,
|
|
1082
|
+
-7.425768,
|
|
1083
|
+
4.389812,
|
|
1084
|
+
-4.445859,
|
|
1085
|
+
2.663991,
|
|
1086
|
+
3.173422,
|
|
1087
|
+
-7.21453,
|
|
1088
|
+
2.263009,
|
|
1089
|
+
0.07315,
|
|
1090
|
+
-5.799793,
|
|
1091
|
+
2.349546,
|
|
1092
|
+
2.204059,
|
|
1093
|
+
-2.844939,
|
|
1094
|
+
-0.720868,
|
|
1095
|
+
4.43313,
|
|
1096
|
+
-0.711452,
|
|
1097
|
+
-3.329355,
|
|
1098
|
+
5.877044,
|
|
1099
|
+
-0.606033,
|
|
1100
|
+
-3.924562,
|
|
1101
|
+
5.444923,
|
|
1102
|
+
-1.431615,
|
|
1103
|
+
-3.500953,
|
|
1104
|
+
5.496189,
|
|
1105
|
+
-1.91491,
|
|
1106
|
+
-3.803146,
|
|
1107
|
+
5.02893,
|
|
1108
|
+
-1.131043,
|
|
1109
|
+
-3.973937,
|
|
1110
|
+
5.189648,
|
|
1111
|
+
-1.563548,
|
|
1112
|
+
-4.082763,
|
|
1113
|
+
4.842263,
|
|
1114
|
+
-2.650112,
|
|
1115
|
+
-5.003649,
|
|
1116
|
+
4.188483,
|
|
1117
|
+
-0.427049,
|
|
1118
|
+
-1.094134,
|
|
1119
|
+
7.360529,
|
|
1120
|
+
-0.496396,
|
|
1121
|
+
-0.475659,
|
|
1122
|
+
7.440358,
|
|
1123
|
+
-5.253307,
|
|
1124
|
+
3.881582,
|
|
1125
|
+
3.363159,
|
|
1126
|
+
-1.718698,
|
|
1127
|
+
0.974609,
|
|
1128
|
+
4.558359,
|
|
1129
|
+
-1.608635,
|
|
1130
|
+
-0.942516,
|
|
1131
|
+
5.814193,
|
|
1132
|
+
-1.651267,
|
|
1133
|
+
-0.610868,
|
|
1134
|
+
5.581319,
|
|
1135
|
+
-4.765501,
|
|
1136
|
+
-0.701554,
|
|
1137
|
+
3.534632,
|
|
1138
|
+
-0.478306,
|
|
1139
|
+
0.295766,
|
|
1140
|
+
7.101013,
|
|
1141
|
+
-3.734964,
|
|
1142
|
+
4.50823,
|
|
1143
|
+
4.550454,
|
|
1144
|
+
-4.588603,
|
|
1145
|
+
4.302037,
|
|
1146
|
+
4.048484,
|
|
1147
|
+
-6.279331,
|
|
1148
|
+
6.615427,
|
|
1149
|
+
1.42585,
|
|
1150
|
+
-1.220941,
|
|
1151
|
+
4.142165,
|
|
1152
|
+
5.106035,
|
|
1153
|
+
-2.193489,
|
|
1154
|
+
3.100317,
|
|
1155
|
+
4.000575,
|
|
1156
|
+
-3.102642,
|
|
1157
|
+
-4.352984,
|
|
1158
|
+
4.095905,
|
|
1159
|
+
-6.719682,
|
|
1160
|
+
-4.788645,
|
|
1161
|
+
-1.745401,
|
|
1162
|
+
-1.193824,
|
|
1163
|
+
-1.306795,
|
|
1164
|
+
5.737747,
|
|
1165
|
+
-0.729766,
|
|
1166
|
+
-1.593712,
|
|
1167
|
+
5.833208,
|
|
1168
|
+
-2.456206,
|
|
1169
|
+
-4.342621,
|
|
1170
|
+
4.283884,
|
|
1171
|
+
-2.204823,
|
|
1172
|
+
-4.304508,
|
|
1173
|
+
4.162499,
|
|
1174
|
+
-4.985894,
|
|
1175
|
+
4.802461,
|
|
1176
|
+
3.751977,
|
|
1177
|
+
-1.592294,
|
|
1178
|
+
-1.257709,
|
|
1179
|
+
5.456949,
|
|
1180
|
+
-2.644548,
|
|
1181
|
+
4.524654,
|
|
1182
|
+
4.921559,
|
|
1183
|
+
-2.760292,
|
|
1184
|
+
5.100971,
|
|
1185
|
+
5.01599,
|
|
1186
|
+
-3.523964,
|
|
1187
|
+
8.005976,
|
|
1188
|
+
3.729163,
|
|
1189
|
+
-5.599763,
|
|
1190
|
+
5.71547,
|
|
1191
|
+
2.724259,
|
|
1192
|
+
-3.063932,
|
|
1193
|
+
6.566144,
|
|
1194
|
+
4.529981,
|
|
1195
|
+
-5.720968,
|
|
1196
|
+
4.254584,
|
|
1197
|
+
2.830852,
|
|
1198
|
+
-6.374393,
|
|
1199
|
+
4.78559,
|
|
1200
|
+
1.591691,
|
|
1201
|
+
-0.672728,
|
|
1202
|
+
-3.688016,
|
|
1203
|
+
5.737804,
|
|
1204
|
+
-1.26256,
|
|
1205
|
+
-3.787691,
|
|
1206
|
+
5.417779,
|
|
1207
|
+
-1.732553,
|
|
1208
|
+
-3.952767,
|
|
1209
|
+
5.000579,
|
|
1210
|
+
-1.043625,
|
|
1211
|
+
-1.464973,
|
|
1212
|
+
5.662455,
|
|
1213
|
+
-2.321234,
|
|
1214
|
+
-4.329069,
|
|
1215
|
+
4.258156,
|
|
1216
|
+
-2.056846,
|
|
1217
|
+
-4.477671,
|
|
1218
|
+
4.520883,
|
|
1219
|
+
-2.153084,
|
|
1220
|
+
-4.276322,
|
|
1221
|
+
4.038093,
|
|
1222
|
+
-0.946874,
|
|
1223
|
+
-1.035249,
|
|
1224
|
+
6.512274,
|
|
1225
|
+
-1.469132,
|
|
1226
|
+
-4.036351,
|
|
1227
|
+
4.604908,
|
|
1228
|
+
-1.02434,
|
|
1229
|
+
-3.989851,
|
|
1230
|
+
4.926693,
|
|
1231
|
+
-0.533422,
|
|
1232
|
+
-3.993222,
|
|
1233
|
+
5.138202,
|
|
1234
|
+
-0.76972,
|
|
1235
|
+
-6.095394,
|
|
1236
|
+
4.985883,
|
|
1237
|
+
-0.699606,
|
|
1238
|
+
-5.29185,
|
|
1239
|
+
5.448304,
|
|
1240
|
+
-0.669687,
|
|
1241
|
+
-4.94977,
|
|
1242
|
+
5.509612,
|
|
1243
|
+
-0.630947,
|
|
1244
|
+
-4.695101,
|
|
1245
|
+
5.449371,
|
|
1246
|
+
-0.583218,
|
|
1247
|
+
-4.517982,
|
|
1248
|
+
5.339869,
|
|
1249
|
+
-1.53717,
|
|
1250
|
+
-4.423206,
|
|
1251
|
+
4.74547,
|
|
1252
|
+
-1.6156,
|
|
1253
|
+
-4.475942,
|
|
1254
|
+
4.813632,
|
|
1255
|
+
-1.729053,
|
|
1256
|
+
-4.61868,
|
|
1257
|
+
4.854463,
|
|
1258
|
+
-1.838624,
|
|
1259
|
+
-4.828746,
|
|
1260
|
+
4.823737,
|
|
1261
|
+
-2.36825,
|
|
1262
|
+
-3.106237,
|
|
1263
|
+
4.868096,
|
|
1264
|
+
-7.542244,
|
|
1265
|
+
-1.049282,
|
|
1266
|
+
-2.431321,
|
|
1267
|
+
0,
|
|
1268
|
+
-1.724003,
|
|
1269
|
+
6.60139,
|
|
1270
|
+
-1.826614,
|
|
1271
|
+
-4.399531,
|
|
1272
|
+
4.399021,
|
|
1273
|
+
-1.929558,
|
|
1274
|
+
-4.411831,
|
|
1275
|
+
4.497052,
|
|
1276
|
+
-0.597442,
|
|
1277
|
+
-2.013686,
|
|
1278
|
+
5.866456,
|
|
1279
|
+
-1.405627,
|
|
1280
|
+
-1.714196,
|
|
1281
|
+
5.241087,
|
|
1282
|
+
-0.662449,
|
|
1283
|
+
-1.819321,
|
|
1284
|
+
5.863759,
|
|
1285
|
+
-2.34234,
|
|
1286
|
+
0.572222,
|
|
1287
|
+
4.294303,
|
|
1288
|
+
-3.327324,
|
|
1289
|
+
0.104863,
|
|
1290
|
+
4.11386,
|
|
1291
|
+
-1.726175,
|
|
1292
|
+
-0.919165,
|
|
1293
|
+
5.273355,
|
|
1294
|
+
-5.133204,
|
|
1295
|
+
7.485602,
|
|
1296
|
+
2.660442,
|
|
1297
|
+
-4.538641,
|
|
1298
|
+
6.319907,
|
|
1299
|
+
3.683424,
|
|
1300
|
+
-3.986562,
|
|
1301
|
+
5.109487,
|
|
1302
|
+
4.466315,
|
|
1303
|
+
-2.169681,
|
|
1304
|
+
-5.440433,
|
|
1305
|
+
4.455874,
|
|
1306
|
+
-1.395634,
|
|
1307
|
+
5.011963,
|
|
1308
|
+
5.316032,
|
|
1309
|
+
-1.6195,
|
|
1310
|
+
6.599217,
|
|
1311
|
+
4.921106,
|
|
1312
|
+
-1.891399,
|
|
1313
|
+
8.236377,
|
|
1314
|
+
4.274997,
|
|
1315
|
+
-4.195832,
|
|
1316
|
+
2.235205,
|
|
1317
|
+
3.375099,
|
|
1318
|
+
-5.733342,
|
|
1319
|
+
1.411738,
|
|
1320
|
+
2.431726,
|
|
1321
|
+
-1.859887,
|
|
1322
|
+
2.355757,
|
|
1323
|
+
3.843181,
|
|
1324
|
+
-4.988612,
|
|
1325
|
+
3.074654,
|
|
1326
|
+
3.083858,
|
|
1327
|
+
-1.303263,
|
|
1328
|
+
1.416453,
|
|
1329
|
+
4.831091,
|
|
1330
|
+
-1.305757,
|
|
1331
|
+
-0.672779,
|
|
1332
|
+
6.415959,
|
|
1333
|
+
-6.46517,
|
|
1334
|
+
0.937119,
|
|
1335
|
+
1.689873,
|
|
1336
|
+
-5.258659,
|
|
1337
|
+
0.945811,
|
|
1338
|
+
2.974312,
|
|
1339
|
+
-4.432338,
|
|
1340
|
+
0.722096,
|
|
1341
|
+
3.522615,
|
|
1342
|
+
-3.300681,
|
|
1343
|
+
0.861641,
|
|
1344
|
+
3.872784,
|
|
1345
|
+
-2.430178,
|
|
1346
|
+
1.131492,
|
|
1347
|
+
4.039035,
|
|
1348
|
+
-1.820731,
|
|
1349
|
+
1.467954,
|
|
1350
|
+
4.224124,
|
|
1351
|
+
-0.563221,
|
|
1352
|
+
2.307693,
|
|
1353
|
+
5.566789,
|
|
1354
|
+
-6.338145,
|
|
1355
|
+
-0.529279,
|
|
1356
|
+
1.881175,
|
|
1357
|
+
-5.587698,
|
|
1358
|
+
3.208071,
|
|
1359
|
+
2.687839,
|
|
1360
|
+
-0.242624,
|
|
1361
|
+
-1.462857,
|
|
1362
|
+
7.071491,
|
|
1363
|
+
-1.611251,
|
|
1364
|
+
0.339326,
|
|
1365
|
+
4.895421,
|
|
1366
|
+
-7.743095,
|
|
1367
|
+
2.364999,
|
|
1368
|
+
-2.005167,
|
|
1369
|
+
-1.391142,
|
|
1370
|
+
1.851048,
|
|
1371
|
+
4.448999,
|
|
1372
|
+
-1.785794,
|
|
1373
|
+
-0.978284,
|
|
1374
|
+
4.85047,
|
|
1375
|
+
-4.670959,
|
|
1376
|
+
2.664461,
|
|
1377
|
+
3.084075,
|
|
1378
|
+
-1.33397,
|
|
1379
|
+
-0.283761,
|
|
1380
|
+
6.097047,
|
|
1381
|
+
-7.270895,
|
|
1382
|
+
-2.890917,
|
|
1383
|
+
-2.252455,
|
|
1384
|
+
-1.856432,
|
|
1385
|
+
2.585245,
|
|
1386
|
+
3.757904,
|
|
1387
|
+
-0.923388,
|
|
1388
|
+
0.073076,
|
|
1389
|
+
6.671944,
|
|
1390
|
+
-5.000589,
|
|
1391
|
+
-6.135128,
|
|
1392
|
+
1.892523,
|
|
1393
|
+
-5.085276,
|
|
1394
|
+
-7.17859,
|
|
1395
|
+
0.714711,
|
|
1396
|
+
-7.159291,
|
|
1397
|
+
-0.81182,
|
|
1398
|
+
-0.072044,
|
|
1399
|
+
-5.843051,
|
|
1400
|
+
-5.248023,
|
|
1401
|
+
0.924091,
|
|
1402
|
+
-6.847258,
|
|
1403
|
+
3.662916,
|
|
1404
|
+
0.724695,
|
|
1405
|
+
-2.412942,
|
|
1406
|
+
-8.258853,
|
|
1407
|
+
4.119213,
|
|
1408
|
+
-0.179909,
|
|
1409
|
+
-1.689864,
|
|
1410
|
+
6.573301,
|
|
1411
|
+
-2.103655,
|
|
1412
|
+
-0.163946,
|
|
1413
|
+
4.566119,
|
|
1414
|
+
-6.407571,
|
|
1415
|
+
2.236021,
|
|
1416
|
+
1.560843,
|
|
1417
|
+
-3.670075,
|
|
1418
|
+
2.360153,
|
|
1419
|
+
3.63523,
|
|
1420
|
+
-3.177186,
|
|
1421
|
+
2.294265,
|
|
1422
|
+
3.775704,
|
|
1423
|
+
-2.196121,
|
|
1424
|
+
-4.598322,
|
|
1425
|
+
4.479786,
|
|
1426
|
+
-6.234883,
|
|
1427
|
+
-1.94443,
|
|
1428
|
+
1.663542,
|
|
1429
|
+
-1.292924,
|
|
1430
|
+
-9.29592,
|
|
1431
|
+
4.094063,
|
|
1432
|
+
-3.210651,
|
|
1433
|
+
-8.533278,
|
|
1434
|
+
2.802001,
|
|
1435
|
+
-4.068926,
|
|
1436
|
+
-7.993109,
|
|
1437
|
+
1.925119,
|
|
1438
|
+
0,
|
|
1439
|
+
6.54539,
|
|
1440
|
+
5.027311,
|
|
1441
|
+
0,
|
|
1442
|
+
-9.403378,
|
|
1443
|
+
4.264492,
|
|
1444
|
+
-2.724032,
|
|
1445
|
+
2.315802,
|
|
1446
|
+
3.777151,
|
|
1447
|
+
-2.28846,
|
|
1448
|
+
2.398891,
|
|
1449
|
+
3.697603,
|
|
1450
|
+
-1.998311,
|
|
1451
|
+
2.496547,
|
|
1452
|
+
3.689148,
|
|
1453
|
+
-6.13004,
|
|
1454
|
+
3.399261,
|
|
1455
|
+
2.038516,
|
|
1456
|
+
-2.28846,
|
|
1457
|
+
2.886504,
|
|
1458
|
+
3.775031,
|
|
1459
|
+
-2.724032,
|
|
1460
|
+
2.96181,
|
|
1461
|
+
3.871767,
|
|
1462
|
+
-3.177186,
|
|
1463
|
+
2.964136,
|
|
1464
|
+
3.876973,
|
|
1465
|
+
-3.670075,
|
|
1466
|
+
2.927714,
|
|
1467
|
+
3.724325,
|
|
1468
|
+
-4.018389,
|
|
1469
|
+
2.857357,
|
|
1470
|
+
3.482983,
|
|
1471
|
+
-7.555811,
|
|
1472
|
+
4.106811,
|
|
1473
|
+
-0.991917,
|
|
1474
|
+
-4.018389,
|
|
1475
|
+
2.483695,
|
|
1476
|
+
3.440898,
|
|
1477
|
+
0,
|
|
1478
|
+
-2.521945,
|
|
1479
|
+
5.932265,
|
|
1480
|
+
-1.776217,
|
|
1481
|
+
-2.683946,
|
|
1482
|
+
5.213116,
|
|
1483
|
+
-1.222237,
|
|
1484
|
+
-1.182444,
|
|
1485
|
+
5.952465,
|
|
1486
|
+
-0.731493,
|
|
1487
|
+
-2.536683,
|
|
1488
|
+
5.815343,
|
|
1489
|
+
0,
|
|
1490
|
+
3.271027,
|
|
1491
|
+
5.236015,
|
|
1492
|
+
-4.135272,
|
|
1493
|
+
-6.996638,
|
|
1494
|
+
2.67197,
|
|
1495
|
+
-3.311811,
|
|
1496
|
+
-7.660815,
|
|
1497
|
+
3.382963,
|
|
1498
|
+
-1.313701,
|
|
1499
|
+
-8.639995,
|
|
1500
|
+
4.702456,
|
|
1501
|
+
-5.940524,
|
|
1502
|
+
-6.223629,
|
|
1503
|
+
-0.631468,
|
|
1504
|
+
-1.998311,
|
|
1505
|
+
2.743838,
|
|
1506
|
+
3.74403,
|
|
1507
|
+
-0.901447,
|
|
1508
|
+
1.236992,
|
|
1509
|
+
5.754256,
|
|
1510
|
+
0,
|
|
1511
|
+
-8.765243,
|
|
1512
|
+
4.891441,
|
|
1513
|
+
-2.308977,
|
|
1514
|
+
-8.974196,
|
|
1515
|
+
3.60907,
|
|
1516
|
+
-6.954154,
|
|
1517
|
+
-2.439843,
|
|
1518
|
+
-0.131163,
|
|
1519
|
+
-1.098819,
|
|
1520
|
+
-4.458788,
|
|
1521
|
+
5.120727,
|
|
1522
|
+
-1.181124,
|
|
1523
|
+
-4.579996,
|
|
1524
|
+
5.189564,
|
|
1525
|
+
-1.255818,
|
|
1526
|
+
-4.787901,
|
|
1527
|
+
5.237051,
|
|
1528
|
+
-1.325085,
|
|
1529
|
+
-5.106507,
|
|
1530
|
+
5.20501,
|
|
1531
|
+
-1.546388,
|
|
1532
|
+
-5.819392,
|
|
1533
|
+
4.757893,
|
|
1534
|
+
-1.953754,
|
|
1535
|
+
-4.183892,
|
|
1536
|
+
4.431713,
|
|
1537
|
+
-2.117802,
|
|
1538
|
+
-4.137093,
|
|
1539
|
+
4.555096,
|
|
1540
|
+
-2.285339,
|
|
1541
|
+
-4.051196,
|
|
1542
|
+
4.582438,
|
|
1543
|
+
-2.85016,
|
|
1544
|
+
-3.66572,
|
|
1545
|
+
4.484994,
|
|
1546
|
+
-5.278538,
|
|
1547
|
+
-2.238942,
|
|
1548
|
+
2.861224,
|
|
1549
|
+
-0.946709,
|
|
1550
|
+
1.907628,
|
|
1551
|
+
5.196779,
|
|
1552
|
+
-1.314173,
|
|
1553
|
+
3.104912,
|
|
1554
|
+
4.231404,
|
|
1555
|
+
-1.78,
|
|
1556
|
+
2.86,
|
|
1557
|
+
3.881555,
|
|
1558
|
+
-1.84511,
|
|
1559
|
+
-4.09888,
|
|
1560
|
+
4.247264,
|
|
1561
|
+
-5.436187,
|
|
1562
|
+
-4.030482,
|
|
1563
|
+
2.109852,
|
|
1564
|
+
-0.766444,
|
|
1565
|
+
3.182131,
|
|
1566
|
+
4.861453,
|
|
1567
|
+
-1.938616,
|
|
1568
|
+
-6.61441,
|
|
1569
|
+
4.521085,
|
|
1570
|
+
0,
|
|
1571
|
+
1.059413,
|
|
1572
|
+
6.774605,
|
|
1573
|
+
-0.516573,
|
|
1574
|
+
1.583572,
|
|
1575
|
+
6.148363,
|
|
1576
|
+
0,
|
|
1577
|
+
1.728369,
|
|
1578
|
+
6.31675,
|
|
1579
|
+
-1.246815,
|
|
1580
|
+
0.230297,
|
|
1581
|
+
5.681036,
|
|
1582
|
+
0,
|
|
1583
|
+
-7.942194,
|
|
1584
|
+
5.181173,
|
|
1585
|
+
0,
|
|
1586
|
+
-6.991499,
|
|
1587
|
+
5.153478,
|
|
1588
|
+
-0.997827,
|
|
1589
|
+
-6.930921,
|
|
1590
|
+
4.979576,
|
|
1591
|
+
-3.288807,
|
|
1592
|
+
-5.382514,
|
|
1593
|
+
3.795752,
|
|
1594
|
+
-2.311631,
|
|
1595
|
+
-1.566237,
|
|
1596
|
+
4.590085,
|
|
1597
|
+
-2.68025,
|
|
1598
|
+
-6.111567,
|
|
1599
|
+
4.096152,
|
|
1600
|
+
-3.832928,
|
|
1601
|
+
-1.537326,
|
|
1602
|
+
4.137731,
|
|
1603
|
+
-2.96186,
|
|
1604
|
+
-2.274215,
|
|
1605
|
+
4.440943,
|
|
1606
|
+
-4.386901,
|
|
1607
|
+
-2.683286,
|
|
1608
|
+
3.643886,
|
|
1609
|
+
-1.217295,
|
|
1610
|
+
-7.834465,
|
|
1611
|
+
4.969286,
|
|
1612
|
+
-1.542374,
|
|
1613
|
+
-0.136843,
|
|
1614
|
+
5.201008,
|
|
1615
|
+
-3.878377,
|
|
1616
|
+
-6.041764,
|
|
1617
|
+
3.311079,
|
|
1618
|
+
-3.084037,
|
|
1619
|
+
-6.809842,
|
|
1620
|
+
3.814195,
|
|
1621
|
+
-3.747321,
|
|
1622
|
+
-4.503545,
|
|
1623
|
+
3.726453,
|
|
1624
|
+
-6.094129,
|
|
1625
|
+
-3.205991,
|
|
1626
|
+
1.473482,
|
|
1627
|
+
-4.588995,
|
|
1628
|
+
-4.728726,
|
|
1629
|
+
2.983221,
|
|
1630
|
+
-6.583231,
|
|
1631
|
+
-3.941269,
|
|
1632
|
+
0.070268,
|
|
1633
|
+
-3.49258,
|
|
1634
|
+
-3.19582,
|
|
1635
|
+
4.130198,
|
|
1636
|
+
-1.255543,
|
|
1637
|
+
0.802341,
|
|
1638
|
+
5.307551,
|
|
1639
|
+
-1.126122,
|
|
1640
|
+
-0.933602,
|
|
1641
|
+
6.538785,
|
|
1642
|
+
-1.443109,
|
|
1643
|
+
-1.142774,
|
|
1644
|
+
5.905127,
|
|
1645
|
+
-0.923043,
|
|
1646
|
+
-0.529042,
|
|
1647
|
+
7.003423,
|
|
1648
|
+
-1.755386,
|
|
1649
|
+
3.529117,
|
|
1650
|
+
4.327696,
|
|
1651
|
+
-2.632589,
|
|
1652
|
+
3.713828,
|
|
1653
|
+
4.364629,
|
|
1654
|
+
-3.388062,
|
|
1655
|
+
3.721976,
|
|
1656
|
+
4.309028,
|
|
1657
|
+
-4.075766,
|
|
1658
|
+
3.675413,
|
|
1659
|
+
4.076063,
|
|
1660
|
+
-4.62291,
|
|
1661
|
+
3.474691,
|
|
1662
|
+
3.646321,
|
|
1663
|
+
-5.171755,
|
|
1664
|
+
2.535753,
|
|
1665
|
+
2.670867,
|
|
1666
|
+
-7.297331,
|
|
1667
|
+
0.763172,
|
|
1668
|
+
-0.048769,
|
|
1669
|
+
-4.706828,
|
|
1670
|
+
1.651,
|
|
1671
|
+
3.109532,
|
|
1672
|
+
-4.071712,
|
|
1673
|
+
1.476821,
|
|
1674
|
+
3.476944,
|
|
1675
|
+
-3.269817,
|
|
1676
|
+
1.470659,
|
|
1677
|
+
3.731945,
|
|
1678
|
+
-2.527572,
|
|
1679
|
+
1.617311,
|
|
1680
|
+
3.865444,
|
|
1681
|
+
-1.970894,
|
|
1682
|
+
1.858505,
|
|
1683
|
+
3.961782,
|
|
1684
|
+
-1.579543,
|
|
1685
|
+
2.097941,
|
|
1686
|
+
4.084996,
|
|
1687
|
+
-7.664182,
|
|
1688
|
+
0.673132,
|
|
1689
|
+
-2.435867,
|
|
1690
|
+
-1.397041,
|
|
1691
|
+
-1.340139,
|
|
1692
|
+
5.630378,
|
|
1693
|
+
-0.884838,
|
|
1694
|
+
0.65874,
|
|
1695
|
+
6.233232,
|
|
1696
|
+
-0.767097,
|
|
1697
|
+
-0.968035,
|
|
1698
|
+
7.077932,
|
|
1699
|
+
-0.460213,
|
|
1700
|
+
-1.334106,
|
|
1701
|
+
6.787447,
|
|
1702
|
+
-0.748618,
|
|
1703
|
+
-1.067994,
|
|
1704
|
+
6.798303,
|
|
1705
|
+
-1.236408,
|
|
1706
|
+
-1.585568,
|
|
1707
|
+
5.48049,
|
|
1708
|
+
-0.387306,
|
|
1709
|
+
-1.40999,
|
|
1710
|
+
6.957705,
|
|
1711
|
+
-0.319925,
|
|
1712
|
+
-1.607931,
|
|
1713
|
+
6.508676,
|
|
1714
|
+
-1.639633,
|
|
1715
|
+
2.556298,
|
|
1716
|
+
3.863736,
|
|
1717
|
+
-1.255645,
|
|
1718
|
+
2.467144,
|
|
1719
|
+
4.2038,
|
|
1720
|
+
-1.031362,
|
|
1721
|
+
2.382663,
|
|
1722
|
+
4.615849,
|
|
1723
|
+
-4.253081,
|
|
1724
|
+
2.772296,
|
|
1725
|
+
3.315305,
|
|
1726
|
+
-4.53,
|
|
1727
|
+
2.91,
|
|
1728
|
+
3.339685,
|
|
1729
|
+
0.463928,
|
|
1730
|
+
0.955357,
|
|
1731
|
+
6.633583,
|
|
1732
|
+
4.253081,
|
|
1733
|
+
2.577646,
|
|
1734
|
+
3.279702,
|
|
1735
|
+
0.416106,
|
|
1736
|
+
-1.466449,
|
|
1737
|
+
6.447657,
|
|
1738
|
+
7.08796,
|
|
1739
|
+
5.434801,
|
|
1740
|
+
0.09962,
|
|
1741
|
+
2.628639,
|
|
1742
|
+
2.035898,
|
|
1743
|
+
3.848121,
|
|
1744
|
+
3.198363,
|
|
1745
|
+
1.985815,
|
|
1746
|
+
3.796952,
|
|
1747
|
+
3.775151,
|
|
1748
|
+
2.039402,
|
|
1749
|
+
3.646194,
|
|
1750
|
+
4.465819,
|
|
1751
|
+
2.42295,
|
|
1752
|
+
3.155168,
|
|
1753
|
+
2.164289,
|
|
1754
|
+
2.189867,
|
|
1755
|
+
3.851822,
|
|
1756
|
+
3.208229,
|
|
1757
|
+
3.223926,
|
|
1758
|
+
4.115822,
|
|
1759
|
+
2.673803,
|
|
1760
|
+
3.205337,
|
|
1761
|
+
4.092203,
|
|
1762
|
+
3.745193,
|
|
1763
|
+
3.165286,
|
|
1764
|
+
3.972409,
|
|
1765
|
+
4.161018,
|
|
1766
|
+
3.059069,
|
|
1767
|
+
3.719554,
|
|
1768
|
+
5.062006,
|
|
1769
|
+
1.934418,
|
|
1770
|
+
2.776093,
|
|
1771
|
+
2.266659,
|
|
1772
|
+
-7.425768,
|
|
1773
|
+
4.389812,
|
|
1774
|
+
4.445859,
|
|
1775
|
+
2.663991,
|
|
1776
|
+
3.173422,
|
|
1777
|
+
7.21453,
|
|
1778
|
+
2.263009,
|
|
1779
|
+
0.07315,
|
|
1780
|
+
5.799793,
|
|
1781
|
+
2.349546,
|
|
1782
|
+
2.204059,
|
|
1783
|
+
2.844939,
|
|
1784
|
+
-0.720868,
|
|
1785
|
+
4.43313,
|
|
1786
|
+
0.711452,
|
|
1787
|
+
-3.329355,
|
|
1788
|
+
5.877044,
|
|
1789
|
+
0.606033,
|
|
1790
|
+
-3.924562,
|
|
1791
|
+
5.444923,
|
|
1792
|
+
1.431615,
|
|
1793
|
+
-3.500953,
|
|
1794
|
+
5.496189,
|
|
1795
|
+
1.91491,
|
|
1796
|
+
-3.803146,
|
|
1797
|
+
5.02893,
|
|
1798
|
+
1.131043,
|
|
1799
|
+
-3.973937,
|
|
1800
|
+
5.189648,
|
|
1801
|
+
1.563548,
|
|
1802
|
+
-4.082763,
|
|
1803
|
+
4.842263,
|
|
1804
|
+
2.650112,
|
|
1805
|
+
-5.003649,
|
|
1806
|
+
4.188483,
|
|
1807
|
+
0.427049,
|
|
1808
|
+
-1.094134,
|
|
1809
|
+
7.360529,
|
|
1810
|
+
0.496396,
|
|
1811
|
+
-0.475659,
|
|
1812
|
+
7.440358,
|
|
1813
|
+
5.253307,
|
|
1814
|
+
3.881582,
|
|
1815
|
+
3.363159,
|
|
1816
|
+
1.718698,
|
|
1817
|
+
0.974609,
|
|
1818
|
+
4.558359,
|
|
1819
|
+
1.608635,
|
|
1820
|
+
-0.942516,
|
|
1821
|
+
5.814193,
|
|
1822
|
+
1.651267,
|
|
1823
|
+
-0.610868,
|
|
1824
|
+
5.581319,
|
|
1825
|
+
4.765501,
|
|
1826
|
+
-0.701554,
|
|
1827
|
+
3.534632,
|
|
1828
|
+
0.478306,
|
|
1829
|
+
0.295766,
|
|
1830
|
+
7.101013,
|
|
1831
|
+
3.734964,
|
|
1832
|
+
4.50823,
|
|
1833
|
+
4.550454,
|
|
1834
|
+
4.588603,
|
|
1835
|
+
4.302037,
|
|
1836
|
+
4.048484,
|
|
1837
|
+
6.279331,
|
|
1838
|
+
6.615427,
|
|
1839
|
+
1.42585,
|
|
1840
|
+
1.220941,
|
|
1841
|
+
4.142165,
|
|
1842
|
+
5.106035,
|
|
1843
|
+
2.193489,
|
|
1844
|
+
3.100317,
|
|
1845
|
+
4.000575,
|
|
1846
|
+
3.102642,
|
|
1847
|
+
-4.352984,
|
|
1848
|
+
4.095905,
|
|
1849
|
+
6.719682,
|
|
1850
|
+
-4.788645,
|
|
1851
|
+
-1.745401,
|
|
1852
|
+
1.193824,
|
|
1853
|
+
-1.306795,
|
|
1854
|
+
5.737747,
|
|
1855
|
+
0.729766,
|
|
1856
|
+
-1.593712,
|
|
1857
|
+
5.833208,
|
|
1858
|
+
2.456206,
|
|
1859
|
+
-4.342621,
|
|
1860
|
+
4.283884,
|
|
1861
|
+
2.204823,
|
|
1862
|
+
-4.304508,
|
|
1863
|
+
4.162499,
|
|
1864
|
+
4.985894,
|
|
1865
|
+
4.802461,
|
|
1866
|
+
3.751977,
|
|
1867
|
+
1.592294,
|
|
1868
|
+
-1.257709,
|
|
1869
|
+
5.456949,
|
|
1870
|
+
2.644548,
|
|
1871
|
+
4.524654,
|
|
1872
|
+
4.921559,
|
|
1873
|
+
2.760292,
|
|
1874
|
+
5.100971,
|
|
1875
|
+
5.01599,
|
|
1876
|
+
3.523964,
|
|
1877
|
+
8.005976,
|
|
1878
|
+
3.729163,
|
|
1879
|
+
5.599763,
|
|
1880
|
+
5.71547,
|
|
1881
|
+
2.724259,
|
|
1882
|
+
3.063932,
|
|
1883
|
+
6.566144,
|
|
1884
|
+
4.529981,
|
|
1885
|
+
5.720968,
|
|
1886
|
+
4.254584,
|
|
1887
|
+
2.830852,
|
|
1888
|
+
6.374393,
|
|
1889
|
+
4.78559,
|
|
1890
|
+
1.591691,
|
|
1891
|
+
0.672728,
|
|
1892
|
+
-3.688016,
|
|
1893
|
+
5.737804,
|
|
1894
|
+
1.26256,
|
|
1895
|
+
-3.787691,
|
|
1896
|
+
5.417779,
|
|
1897
|
+
1.732553,
|
|
1898
|
+
-3.952767,
|
|
1899
|
+
5.000579,
|
|
1900
|
+
1.043625,
|
|
1901
|
+
-1.464973,
|
|
1902
|
+
5.662455,
|
|
1903
|
+
2.321234,
|
|
1904
|
+
-4.329069,
|
|
1905
|
+
4.258156,
|
|
1906
|
+
2.056846,
|
|
1907
|
+
-4.477671,
|
|
1908
|
+
4.520883,
|
|
1909
|
+
2.153084,
|
|
1910
|
+
-4.276322,
|
|
1911
|
+
4.038093,
|
|
1912
|
+
0.946874,
|
|
1913
|
+
-1.035249,
|
|
1914
|
+
6.512274,
|
|
1915
|
+
1.469132,
|
|
1916
|
+
-4.036351,
|
|
1917
|
+
4.604908,
|
|
1918
|
+
1.02434,
|
|
1919
|
+
-3.989851,
|
|
1920
|
+
4.926693,
|
|
1921
|
+
0.533422,
|
|
1922
|
+
-3.993222,
|
|
1923
|
+
5.138202,
|
|
1924
|
+
0.76972,
|
|
1925
|
+
-6.095394,
|
|
1926
|
+
4.985883,
|
|
1927
|
+
0.699606,
|
|
1928
|
+
-5.29185,
|
|
1929
|
+
5.448304,
|
|
1930
|
+
0.669687,
|
|
1931
|
+
-4.94977,
|
|
1932
|
+
5.509612,
|
|
1933
|
+
0.630947,
|
|
1934
|
+
-4.695101,
|
|
1935
|
+
5.449371,
|
|
1936
|
+
0.583218,
|
|
1937
|
+
-4.517982,
|
|
1938
|
+
5.339869,
|
|
1939
|
+
1.53717,
|
|
1940
|
+
-4.423206,
|
|
1941
|
+
4.74547,
|
|
1942
|
+
1.6156,
|
|
1943
|
+
-4.475942,
|
|
1944
|
+
4.813632,
|
|
1945
|
+
1.729053,
|
|
1946
|
+
-4.61868,
|
|
1947
|
+
4.854463,
|
|
1948
|
+
1.838624,
|
|
1949
|
+
-4.828746,
|
|
1950
|
+
4.823737,
|
|
1951
|
+
2.36825,
|
|
1952
|
+
-3.106237,
|
|
1953
|
+
4.868096,
|
|
1954
|
+
7.542244,
|
|
1955
|
+
-1.049282,
|
|
1956
|
+
-2.431321,
|
|
1957
|
+
1.826614,
|
|
1958
|
+
-4.399531,
|
|
1959
|
+
4.399021,
|
|
1960
|
+
1.929558,
|
|
1961
|
+
-4.411831,
|
|
1962
|
+
4.497052,
|
|
1963
|
+
0.597442,
|
|
1964
|
+
-2.013686,
|
|
1965
|
+
5.866456,
|
|
1966
|
+
1.405627,
|
|
1967
|
+
-1.714196,
|
|
1968
|
+
5.241087,
|
|
1969
|
+
0.662449,
|
|
1970
|
+
-1.819321,
|
|
1971
|
+
5.863759,
|
|
1972
|
+
2.34234,
|
|
1973
|
+
0.572222,
|
|
1974
|
+
4.294303,
|
|
1975
|
+
3.327324,
|
|
1976
|
+
0.104863,
|
|
1977
|
+
4.11386,
|
|
1978
|
+
1.726175,
|
|
1979
|
+
-0.919165,
|
|
1980
|
+
5.273355,
|
|
1981
|
+
5.133204,
|
|
1982
|
+
7.485602,
|
|
1983
|
+
2.660442,
|
|
1984
|
+
4.538641,
|
|
1985
|
+
6.319907,
|
|
1986
|
+
3.683424,
|
|
1987
|
+
3.986562,
|
|
1988
|
+
5.109487,
|
|
1989
|
+
4.466315,
|
|
1990
|
+
2.169681,
|
|
1991
|
+
-5.440433,
|
|
1992
|
+
4.455874,
|
|
1993
|
+
1.395634,
|
|
1994
|
+
5.011963,
|
|
1995
|
+
5.316032,
|
|
1996
|
+
1.6195,
|
|
1997
|
+
6.599217,
|
|
1998
|
+
4.921106,
|
|
1999
|
+
1.891399,
|
|
2000
|
+
8.236377,
|
|
2001
|
+
4.274997,
|
|
2002
|
+
4.195832,
|
|
2003
|
+
2.235205,
|
|
2004
|
+
3.375099,
|
|
2005
|
+
5.733342,
|
|
2006
|
+
1.411738,
|
|
2007
|
+
2.431726,
|
|
2008
|
+
1.859887,
|
|
2009
|
+
2.355757,
|
|
2010
|
+
3.843181,
|
|
2011
|
+
4.988612,
|
|
2012
|
+
3.074654,
|
|
2013
|
+
3.083858,
|
|
2014
|
+
1.303263,
|
|
2015
|
+
1.416453,
|
|
2016
|
+
4.831091,
|
|
2017
|
+
1.305757,
|
|
2018
|
+
-0.672779,
|
|
2019
|
+
6.415959,
|
|
2020
|
+
6.46517,
|
|
2021
|
+
0.937119,
|
|
2022
|
+
1.689873,
|
|
2023
|
+
5.258659,
|
|
2024
|
+
0.945811,
|
|
2025
|
+
2.974312,
|
|
2026
|
+
4.432338,
|
|
2027
|
+
0.722096,
|
|
2028
|
+
3.522615,
|
|
2029
|
+
3.300681,
|
|
2030
|
+
0.861641,
|
|
2031
|
+
3.872784,
|
|
2032
|
+
2.430178,
|
|
2033
|
+
1.131492,
|
|
2034
|
+
4.039035,
|
|
2035
|
+
1.820731,
|
|
2036
|
+
1.467954,
|
|
2037
|
+
4.224124,
|
|
2038
|
+
0.563221,
|
|
2039
|
+
2.307693,
|
|
2040
|
+
5.566789,
|
|
2041
|
+
6.338145,
|
|
2042
|
+
-0.529279,
|
|
2043
|
+
1.881175,
|
|
2044
|
+
5.587698,
|
|
2045
|
+
3.208071,
|
|
2046
|
+
2.687839,
|
|
2047
|
+
0.242624,
|
|
2048
|
+
-1.462857,
|
|
2049
|
+
7.071491,
|
|
2050
|
+
1.611251,
|
|
2051
|
+
0.339326,
|
|
2052
|
+
4.895421,
|
|
2053
|
+
7.743095,
|
|
2054
|
+
2.364999,
|
|
2055
|
+
-2.005167,
|
|
2056
|
+
1.391142,
|
|
2057
|
+
1.851048,
|
|
2058
|
+
4.448999,
|
|
2059
|
+
1.785794,
|
|
2060
|
+
-0.978284,
|
|
2061
|
+
4.85047,
|
|
2062
|
+
4.670959,
|
|
2063
|
+
2.664461,
|
|
2064
|
+
3.084075,
|
|
2065
|
+
1.33397,
|
|
2066
|
+
-0.283761,
|
|
2067
|
+
6.097047,
|
|
2068
|
+
7.270895,
|
|
2069
|
+
-2.890917,
|
|
2070
|
+
-2.252455,
|
|
2071
|
+
1.856432,
|
|
2072
|
+
2.585245,
|
|
2073
|
+
3.757904,
|
|
2074
|
+
0.923388,
|
|
2075
|
+
0.073076,
|
|
2076
|
+
6.671944,
|
|
2077
|
+
5.000589,
|
|
2078
|
+
-6.135128,
|
|
2079
|
+
1.892523,
|
|
2080
|
+
5.085276,
|
|
2081
|
+
-7.17859,
|
|
2082
|
+
0.714711,
|
|
2083
|
+
7.159291,
|
|
2084
|
+
-0.81182,
|
|
2085
|
+
-0.072044,
|
|
2086
|
+
5.843051,
|
|
2087
|
+
-5.248023,
|
|
2088
|
+
0.924091,
|
|
2089
|
+
6.847258,
|
|
2090
|
+
3.662916,
|
|
2091
|
+
0.724695,
|
|
2092
|
+
2.412942,
|
|
2093
|
+
-8.258853,
|
|
2094
|
+
4.119213,
|
|
2095
|
+
0.179909,
|
|
2096
|
+
-1.689864,
|
|
2097
|
+
6.573301,
|
|
2098
|
+
2.103655,
|
|
2099
|
+
-0.163946,
|
|
2100
|
+
4.566119,
|
|
2101
|
+
6.407571,
|
|
2102
|
+
2.236021,
|
|
2103
|
+
1.560843,
|
|
2104
|
+
3.670075,
|
|
2105
|
+
2.360153,
|
|
2106
|
+
3.63523,
|
|
2107
|
+
3.177186,
|
|
2108
|
+
2.294265,
|
|
2109
|
+
3.775704,
|
|
2110
|
+
2.196121,
|
|
2111
|
+
-4.598322,
|
|
2112
|
+
4.479786,
|
|
2113
|
+
6.234883,
|
|
2114
|
+
-1.94443,
|
|
2115
|
+
1.663542,
|
|
2116
|
+
1.292924,
|
|
2117
|
+
-9.29592,
|
|
2118
|
+
4.094063,
|
|
2119
|
+
3.210651,
|
|
2120
|
+
-8.533278,
|
|
2121
|
+
2.802001,
|
|
2122
|
+
4.068926,
|
|
2123
|
+
-7.993109,
|
|
2124
|
+
1.925119,
|
|
2125
|
+
2.724032,
|
|
2126
|
+
2.315802,
|
|
2127
|
+
3.777151,
|
|
2128
|
+
2.28846,
|
|
2129
|
+
2.398891,
|
|
2130
|
+
3.697603,
|
|
2131
|
+
1.998311,
|
|
2132
|
+
2.496547,
|
|
2133
|
+
3.689148,
|
|
2134
|
+
6.13004,
|
|
2135
|
+
3.399261,
|
|
2136
|
+
2.038516,
|
|
2137
|
+
2.28846,
|
|
2138
|
+
2.886504,
|
|
2139
|
+
3.775031,
|
|
2140
|
+
2.724032,
|
|
2141
|
+
2.96181,
|
|
2142
|
+
3.871767,
|
|
2143
|
+
3.177186,
|
|
2144
|
+
2.964136,
|
|
2145
|
+
3.876973,
|
|
2146
|
+
3.670075,
|
|
2147
|
+
2.927714,
|
|
2148
|
+
3.724325,
|
|
2149
|
+
4.018389,
|
|
2150
|
+
2.857357,
|
|
2151
|
+
3.482983,
|
|
2152
|
+
7.555811,
|
|
2153
|
+
4.106811,
|
|
2154
|
+
-0.991917,
|
|
2155
|
+
4.018389,
|
|
2156
|
+
2.483695,
|
|
2157
|
+
3.440898,
|
|
2158
|
+
1.776217,
|
|
2159
|
+
-2.683946,
|
|
2160
|
+
5.213116,
|
|
2161
|
+
1.222237,
|
|
2162
|
+
-1.182444,
|
|
2163
|
+
5.952465,
|
|
2164
|
+
0.731493,
|
|
2165
|
+
-2.536683,
|
|
2166
|
+
5.815343,
|
|
2167
|
+
4.135272,
|
|
2168
|
+
-6.996638,
|
|
2169
|
+
2.67197,
|
|
2170
|
+
3.311811,
|
|
2171
|
+
-7.660815,
|
|
2172
|
+
3.382963,
|
|
2173
|
+
1.313701,
|
|
2174
|
+
-8.639995,
|
|
2175
|
+
4.702456,
|
|
2176
|
+
5.940524,
|
|
2177
|
+
-6.223629,
|
|
2178
|
+
-0.631468,
|
|
2179
|
+
1.998311,
|
|
2180
|
+
2.743838,
|
|
2181
|
+
3.74403,
|
|
2182
|
+
0.901447,
|
|
2183
|
+
1.236992,
|
|
2184
|
+
5.754256,
|
|
2185
|
+
2.308977,
|
|
2186
|
+
-8.974196,
|
|
2187
|
+
3.60907,
|
|
2188
|
+
6.954154,
|
|
2189
|
+
-2.439843,
|
|
2190
|
+
-0.131163,
|
|
2191
|
+
1.098819,
|
|
2192
|
+
-4.458788,
|
|
2193
|
+
5.120727,
|
|
2194
|
+
1.181124,
|
|
2195
|
+
-4.579996,
|
|
2196
|
+
5.189564,
|
|
2197
|
+
1.255818,
|
|
2198
|
+
-4.787901,
|
|
2199
|
+
5.237051,
|
|
2200
|
+
1.325085,
|
|
2201
|
+
-5.106507,
|
|
2202
|
+
5.20501,
|
|
2203
|
+
1.546388,
|
|
2204
|
+
-5.819392,
|
|
2205
|
+
4.757893,
|
|
2206
|
+
1.953754,
|
|
2207
|
+
-4.183892,
|
|
2208
|
+
4.431713,
|
|
2209
|
+
2.117802,
|
|
2210
|
+
-4.137093,
|
|
2211
|
+
4.555096,
|
|
2212
|
+
2.285339,
|
|
2213
|
+
-4.051196,
|
|
2214
|
+
4.582438,
|
|
2215
|
+
2.85016,
|
|
2216
|
+
-3.66572,
|
|
2217
|
+
4.484994,
|
|
2218
|
+
5.278538,
|
|
2219
|
+
-2.238942,
|
|
2220
|
+
2.861224,
|
|
2221
|
+
0.946709,
|
|
2222
|
+
1.907628,
|
|
2223
|
+
5.196779,
|
|
2224
|
+
1.314173,
|
|
2225
|
+
3.104912,
|
|
2226
|
+
4.231404,
|
|
2227
|
+
1.78,
|
|
2228
|
+
2.86,
|
|
2229
|
+
3.881555,
|
|
2230
|
+
1.84511,
|
|
2231
|
+
-4.09888,
|
|
2232
|
+
4.247264,
|
|
2233
|
+
5.436187,
|
|
2234
|
+
-4.030482,
|
|
2235
|
+
2.109852,
|
|
2236
|
+
0.766444,
|
|
2237
|
+
3.182131,
|
|
2238
|
+
4.861453,
|
|
2239
|
+
1.938616,
|
|
2240
|
+
-6.61441,
|
|
2241
|
+
4.521085,
|
|
2242
|
+
0.516573,
|
|
2243
|
+
1.583572,
|
|
2244
|
+
6.148363,
|
|
2245
|
+
1.246815,
|
|
2246
|
+
0.230297,
|
|
2247
|
+
5.681036,
|
|
2248
|
+
0.997827,
|
|
2249
|
+
-6.930921,
|
|
2250
|
+
4.979576,
|
|
2251
|
+
3.288807,
|
|
2252
|
+
-5.382514,
|
|
2253
|
+
3.795752,
|
|
2254
|
+
2.311631,
|
|
2255
|
+
-1.566237,
|
|
2256
|
+
4.590085,
|
|
2257
|
+
2.68025,
|
|
2258
|
+
-6.111567,
|
|
2259
|
+
4.096152,
|
|
2260
|
+
3.832928,
|
|
2261
|
+
-1.537326,
|
|
2262
|
+
4.137731,
|
|
2263
|
+
2.96186,
|
|
2264
|
+
-2.274215,
|
|
2265
|
+
4.440943,
|
|
2266
|
+
4.386901,
|
|
2267
|
+
-2.683286,
|
|
2268
|
+
3.643886,
|
|
2269
|
+
1.217295,
|
|
2270
|
+
-7.834465,
|
|
2271
|
+
4.969286,
|
|
2272
|
+
1.542374,
|
|
2273
|
+
-0.136843,
|
|
2274
|
+
5.201008,
|
|
2275
|
+
3.878377,
|
|
2276
|
+
-6.041764,
|
|
2277
|
+
3.311079,
|
|
2278
|
+
3.084037,
|
|
2279
|
+
-6.809842,
|
|
2280
|
+
3.814195,
|
|
2281
|
+
3.747321,
|
|
2282
|
+
-4.503545,
|
|
2283
|
+
3.726453,
|
|
2284
|
+
6.094129,
|
|
2285
|
+
-3.205991,
|
|
2286
|
+
1.473482,
|
|
2287
|
+
4.588995,
|
|
2288
|
+
-4.728726,
|
|
2289
|
+
2.983221,
|
|
2290
|
+
6.583231,
|
|
2291
|
+
-3.941269,
|
|
2292
|
+
0.070268,
|
|
2293
|
+
3.49258,
|
|
2294
|
+
-3.19582,
|
|
2295
|
+
4.130198,
|
|
2296
|
+
1.255543,
|
|
2297
|
+
0.802341,
|
|
2298
|
+
5.307551,
|
|
2299
|
+
1.126122,
|
|
2300
|
+
-0.933602,
|
|
2301
|
+
6.538785,
|
|
2302
|
+
1.443109,
|
|
2303
|
+
-1.142774,
|
|
2304
|
+
5.905127,
|
|
2305
|
+
0.923043,
|
|
2306
|
+
-0.529042,
|
|
2307
|
+
7.003423,
|
|
2308
|
+
1.755386,
|
|
2309
|
+
3.529117,
|
|
2310
|
+
4.327696,
|
|
2311
|
+
2.632589,
|
|
2312
|
+
3.713828,
|
|
2313
|
+
4.364629,
|
|
2314
|
+
3.388062,
|
|
2315
|
+
3.721976,
|
|
2316
|
+
4.309028,
|
|
2317
|
+
4.075766,
|
|
2318
|
+
3.675413,
|
|
2319
|
+
4.076063,
|
|
2320
|
+
4.62291,
|
|
2321
|
+
3.474691,
|
|
2322
|
+
3.646321,
|
|
2323
|
+
5.171755,
|
|
2324
|
+
2.535753,
|
|
2325
|
+
2.670867,
|
|
2326
|
+
7.297331,
|
|
2327
|
+
0.763172,
|
|
2328
|
+
-0.048769,
|
|
2329
|
+
4.706828,
|
|
2330
|
+
1.651,
|
|
2331
|
+
3.109532,
|
|
2332
|
+
4.071712,
|
|
2333
|
+
1.476821,
|
|
2334
|
+
3.476944,
|
|
2335
|
+
3.269817,
|
|
2336
|
+
1.470659,
|
|
2337
|
+
3.731945,
|
|
2338
|
+
2.527572,
|
|
2339
|
+
1.617311,
|
|
2340
|
+
3.865444,
|
|
2341
|
+
1.970894,
|
|
2342
|
+
1.858505,
|
|
2343
|
+
3.961782,
|
|
2344
|
+
1.579543,
|
|
2345
|
+
2.097941,
|
|
2346
|
+
4.084996,
|
|
2347
|
+
7.664182,
|
|
2348
|
+
0.673132,
|
|
2349
|
+
-2.435867,
|
|
2350
|
+
1.397041,
|
|
2351
|
+
-1.340139,
|
|
2352
|
+
5.630378,
|
|
2353
|
+
0.884838,
|
|
2354
|
+
0.65874,
|
|
2355
|
+
6.233232,
|
|
2356
|
+
0.767097,
|
|
2357
|
+
-0.968035,
|
|
2358
|
+
7.077932,
|
|
2359
|
+
0.460213,
|
|
2360
|
+
-1.334106,
|
|
2361
|
+
6.787447,
|
|
2362
|
+
0.748618,
|
|
2363
|
+
-1.067994,
|
|
2364
|
+
6.798303,
|
|
2365
|
+
1.236408,
|
|
2366
|
+
-1.585568,
|
|
2367
|
+
5.48049,
|
|
2368
|
+
0.387306,
|
|
2369
|
+
-1.40999,
|
|
2370
|
+
6.957705,
|
|
2371
|
+
0.319925,
|
|
2372
|
+
-1.607931,
|
|
2373
|
+
6.508676,
|
|
2374
|
+
1.639633,
|
|
2375
|
+
2.556298,
|
|
2376
|
+
3.863736,
|
|
2377
|
+
1.255645,
|
|
2378
|
+
2.467144,
|
|
2379
|
+
4.2038,
|
|
2380
|
+
1.031362,
|
|
2381
|
+
2.382663,
|
|
2382
|
+
4.615849,
|
|
2383
|
+
4.253081,
|
|
2384
|
+
2.772296,
|
|
2385
|
+
3.315305,
|
|
2386
|
+
4.53,
|
|
2387
|
+
2.91,
|
|
2388
|
+
3.339685
|
|
2389
|
+
);
|
|
2390
|
+
|
|
2391
|
+
// src/interactives/runtime/face-solve.ts
|
|
2392
|
+
var FACE_REGIONS = {
|
|
2393
|
+
imageLeftEye: [33, 7, 163, 144, 145, 153, 154, 155, 133, 173, 157, 158, 159, 160, 161, 246],
|
|
2394
|
+
imageRightEye: [263, 249, 390, 373, 374, 380, 381, 382, 362, 398, 384, 385, 386, 387, 388, 466],
|
|
2395
|
+
imageLeftBrow: [46, 53, 52, 65, 55, 70, 63, 105, 66, 107],
|
|
2396
|
+
imageRightBrow: [276, 283, 282, 295, 285, 300, 293, 334, 296, 336],
|
|
2397
|
+
outerLips: [61, 146, 91, 181, 84, 17, 314, 405, 321, 375, 291, 409, 270, 269, 267, 0, 37, 39, 40, 185],
|
|
2398
|
+
innerLips: [78, 95, 88, 178, 87, 14, 317, 402, 318, 324, 308, 415, 310, 311, 312, 13, 82, 81, 80, 191]
|
|
2399
|
+
}, FaceCalibration = {
|
|
2400
|
+
canonicalFaceWidth: 15.33,
|
|
2401
|
+
canonicalEyeSpan: 8.891718,
|
|
2402
|
+
minimumInterPupil: 0.01,
|
|
2403
|
+
eyeOpenAspect: 0.3,
|
|
2404
|
+
mouthRestWidth: 0.8,
|
|
2405
|
+
smileWidth: 1.05,
|
|
2406
|
+
smileLift: 0.25,
|
|
2407
|
+
jawRest: 0.05,
|
|
2408
|
+
jawSpan: 0.45,
|
|
2409
|
+
browRest: 0.5,
|
|
2410
|
+
browSpan: 0.12,
|
|
2411
|
+
puckerSpan: 0.25
|
|
2412
|
+
}, STRIDE = FACE_LAYOUT.landmark_stride, POINTS = FACE_LAYOUT.landmark_count, LANDMARK_FLOATS = POINTS * STRIDE, EXPRESSION_AT = LANDMARK_FLOATS, POSE_AT = EXPRESSION_AT + FACE_LAYOUT.expressions.length, SOLVED_FLOATS = POSE_AT + FACE_LAYOUT.head_pose.length, SOLVED_LANDMARK_FLOATS = LANDMARK_FLOATS, SOLVED_POSE_AT = POSE_AT, expressionIndex = (name) => FACE_LAYOUT.expressions.indexOf(name), poseIndex = (name) => FACE_LAYOUT.head_pose.indexOf(name), SMILE = EXPRESSION_AT + expressionIndex("smile"), JAW_OPEN = EXPRESSION_AT + expressionIndex("jaw_open"), BLINK_LEFT = EXPRESSION_AT + expressionIndex("blink_left"), BLINK_RIGHT = EXPRESSION_AT + expressionIndex("blink_right"), BROW_RAISE = EXPRESSION_AT + expressionIndex("brow_raise"), PUCKER = EXPRESSION_AT + expressionIndex("pucker"), YAW = POSE_AT + poseIndex("yaw"), PITCH = POSE_AT + poseIndex("pitch"), ROLL = POSE_AT + poseIndex("roll"), POSE_X = POSE_AT + poseIndex("x"), POSE_Y = POSE_AT + poseIndex("y"), POSE_Z = POSE_AT + poseIndex("z"), AXES = 4, RIDGE = 1e-6, MINIMUM_SCALE = 1e-5, MINIMUM_ASPECT = 1e-6, DETERMINANT_FLOOR = 1e-30, HALF = 0.5, ROOT_HALF = Math.SQRT1_2;
|
|
2413
|
+
function clampUnit(value) {
|
|
2414
|
+
return value < 0 ? 0 : value > 1 ? 1 : value;
|
|
2415
|
+
}
|
|
2416
|
+
function invert4(source, out) {
|
|
2417
|
+
let work = new Float64Array((4) * (4) * 2);
|
|
2418
|
+
for (let r = 0; r < (4); r++)
|
|
2419
|
+
for (let c = 0; c < (4); c++)
|
|
2420
|
+
work[r * (4) * 2 + c] = source[r * (4) + c], work[r * (4) * 2 + (4) + c] = r === c ? 1 : 0;
|
|
2421
|
+
let width = (4) * 2;
|
|
2422
|
+
for (let col = 0; col < (4); col++) {
|
|
2423
|
+
let pivot = col;
|
|
2424
|
+
for (let r = col + 1; r < (4); r++) Math.abs(work[r * width + col]) > Math.abs(work[pivot * width + col]) && (pivot = r);
|
|
2425
|
+
let lead = work[pivot * width + col];
|
|
2426
|
+
if (Math.abs(lead) < (1e-30)) return false;
|
|
2427
|
+
if (pivot !== col)
|
|
2428
|
+
for (let c = 0; c < width; c++) {
|
|
2429
|
+
let swap = work[col * width + c];
|
|
2430
|
+
work[col * width + c] = work[pivot * width + c], work[pivot * width + c] = swap;
|
|
2431
|
+
}
|
|
2432
|
+
for (let c = 0; c < width; c++) work[col * width + c] /= lead;
|
|
2433
|
+
for (let r = 0; r < (4); r++) {
|
|
2434
|
+
if (r === col) continue;
|
|
2435
|
+
let factor = work[r * width + col];
|
|
2436
|
+
if (factor !== 0)
|
|
2437
|
+
for (let c = 0; c < width; c++) work[r * width + c] -= factor * work[col * width + c];
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
for (let r = 0; r < (4); r++) for (let c = 0; c < (4); c++) out[r * (4) + c] = work[r * width + (4) + c];
|
|
2441
|
+
return true;
|
|
2442
|
+
}
|
|
2443
|
+
var FaceSolver = class {
|
|
2444
|
+
constructor() {
|
|
2445
|
+
this.inverse = new Float64Array((4) * (4));
|
|
2446
|
+
this.bx = new Float64Array((4));
|
|
2447
|
+
this.by = new Float64Array((4));
|
|
2448
|
+
this.rows = new Float64Array(9);
|
|
2449
|
+
this.units = new Float64Array(POINTS * 2);
|
|
2450
|
+
let normal = new Float64Array((4) * (4)), x = new Float64Array((4));
|
|
2451
|
+
for (let i = 0; i < 468; i++) {
|
|
2452
|
+
x[0] = CANONICAL_FACE[i * 3], x[1] = CANONICAL_FACE[i * 3 + 1], x[2] = CANONICAL_FACE[i * 3 + 2], x[3] = 1;
|
|
2453
|
+
for (let r = 0; r < (4); r++) for (let c = 0; c < (4); c++) normal[r * (4) + c] += x[r] * x[c];
|
|
2454
|
+
}
|
|
2455
|
+
for (let a = 0; a < (4); a++) normal[a * (4) + a] += (1e-6);
|
|
2456
|
+
this.ready = invert4(normal, this.inverse);
|
|
2457
|
+
}
|
|
2458
|
+
solve(points, count, aspect, out) {
|
|
2459
|
+
if (!this.ready || count < POINTS || out.length < SOLVED_FLOATS) return false;
|
|
2460
|
+
let ratio = Math.max(aspect, (1e-6)), units = this.units;
|
|
2461
|
+
for (let i = 0; i < LANDMARK_FLOATS; i++) out[i] = points[i];
|
|
2462
|
+
for (let i = 0; i < POINTS; i++)
|
|
2463
|
+
units[i * 2] = points[i * STRIDE], units[i * 2 + 1] = points[i * STRIDE + 1] * ratio;
|
|
2464
|
+
return this.fit(out, ratio) ? (this.expressions(out), true) : false;
|
|
2465
|
+
}
|
|
2466
|
+
fit(out, ratio) {
|
|
2467
|
+
let bx = this.bx, by = this.by, units = this.units;
|
|
2468
|
+
bx.fill(0), by.fill(0);
|
|
2469
|
+
for (let i = 0; i < POINTS; i++) {
|
|
2470
|
+
let base = i * 3, ux = units[i * 2], uy = units[i * 2 + 1], cx = CANONICAL_FACE[base], cy = CANONICAL_FACE[base + 1], cz = CANONICAL_FACE[base + 2];
|
|
2471
|
+
bx[0] += cx * ux, bx[1] += cy * ux, bx[2] += cz * ux, bx[3] += ux, by[0] += cx * uy, by[1] += cy * uy, by[2] += cz * uy, by[3] += uy;
|
|
2472
|
+
}
|
|
2473
|
+
let inv = this.inverse, m1x = inv[0] * bx[0] + inv[1] * bx[1] + inv[2] * bx[2] + inv[3] * bx[3], m1y = inv[4] * bx[0] + inv[5] * bx[1] + inv[6] * bx[2] + inv[7] * bx[3], m1z = inv[8] * bx[0] + inv[9] * bx[1] + inv[10] * bx[2] + inv[11] * bx[3], m2x = inv[0] * by[0] + inv[1] * by[1] + inv[2] * by[2] + inv[3] * by[3], m2y = inv[4] * by[0] + inv[5] * by[1] + inv[6] * by[2] + inv[7] * by[3], m2z = inv[8] * by[0] + inv[9] * by[1] + inv[10] * by[2] + inv[11] * by[3], n1 = Math.hypot(m1x, m1y, m1z), n2 = Math.hypot(m2x, m2y, m2z);
|
|
2474
|
+
if (n1 <= (1e-5) || n2 <= (1e-5)) return false;
|
|
2475
|
+
let ax = m1x / n1, ay = m1y / n1, az = m1z / n1, bxn = m2x / n2, byn = m2y / n2, bzn = m2z / n2, sx = ax + bxn, sy = ay + byn, sz = az + bzn, sn = Math.hypot(sx, sy, sz), dx = ax - bxn, dy = ay - byn, dz = az - bzn, dn = Math.hypot(dx, dy, dz);
|
|
2476
|
+
if (dn <= (1e-5) || sn <= (1e-5)) return false;
|
|
2477
|
+
sx /= sn, sy /= sn, sz /= sn, dx /= dn, dy /= dn, dz /= dn;
|
|
2478
|
+
let rows = this.rows;
|
|
2479
|
+
rows[0] = (sx + dx) * ROOT_HALF, rows[1] = (sy + dy) * ROOT_HALF, rows[2] = (sz + dz) * ROOT_HALF, rows[3] = (sx - dx) * ROOT_HALF, rows[4] = (sy - dy) * ROOT_HALF, rows[5] = (sz - dz) * ROOT_HALF, rows[6] = rows[1] * rows[5] - rows[2] * rows[4], rows[7] = rows[2] * rows[3] - rows[0] * rows[5], rows[8] = rows[0] * rows[4] - rows[1] * rows[3];
|
|
2480
|
+
let scale = (n1 + n2) * (0.5), tx = 0, ty = 0;
|
|
2481
|
+
for (let i = 0; i < POINTS; i++) {
|
|
2482
|
+
let base = i * 3, cx = CANONICAL_FACE[base], cy = CANONICAL_FACE[base + 1], cz = CANONICAL_FACE[base + 2];
|
|
2483
|
+
tx += units[i * 2] - (rows[0] * cx + rows[1] * cy + rows[2] * cz) * scale, ty += units[i * 2 + 1] - (rows[3] * cx + rows[4] * cy + rows[5] * cz) * scale;
|
|
2484
|
+
}
|
|
2485
|
+
return tx /= POINTS, ty /= POINTS, out[YAW] = Math.atan2(rows[2], -rows[8]), out[PITCH] = -Math.asin(Math.min(Math.max(rows[5], -1), 1)), out[ROLL] = -Math.atan2(-rows[3], -rows[4]), out[POSE_X] = tx, out[POSE_Y] = ty / ratio, out[POSE_Z] = 1 / Math.max(scale * FaceCalibration.canonicalFaceWidth, (1e-5)), true;
|
|
2486
|
+
}
|
|
2487
|
+
expressions(out) {
|
|
2488
|
+
let leftX = this.centroid(FACE_REGIONS.imageLeftEye, 0), leftY = this.centroid(FACE_REGIONS.imageLeftEye, 1), rightX = this.centroid(FACE_REGIONS.imageRightEye, 0), rightY = this.centroid(FACE_REGIONS.imageRightEye, 1), swapped = leftX > rightX, lineX = swapped ? leftX - rightX : rightX - leftX, lineY = swapped ? leftY - rightY : rightY - leftY, ipd = Math.max(Math.hypot(lineX, lineY), FaceCalibration.minimumInterPupil), roll = Math.atan2(lineY, lineX), acrossX = Math.cos(roll), acrossY = Math.sin(roll), upX = acrossY, upY = -acrossX, mouthOpen = this.extent(FACE_REGIONS.innerLips, upX, upY) / ipd, jaw = clampUnit((mouthOpen - FaceCalibration.jawRest) / FaceCalibration.jawSpan);
|
|
2489
|
+
out[SMILE] = this.smile(acrossX, acrossY, upX, upY, ipd), out[JAW_OPEN] = jaw, out[BLINK_LEFT] = this.blink(FACE_REGIONS.imageRightEye, acrossX, acrossY, upX, upY), out[BLINK_RIGHT] = this.blink(FACE_REGIONS.imageLeftEye, acrossX, acrossY, upX, upY);
|
|
2490
|
+
let browLeft = (this.centroid(FACE_REGIONS.imageLeftBrow, 0) - leftX) * upX + (this.centroid(FACE_REGIONS.imageLeftBrow, 1) - leftY) * upY, browRight = (this.centroid(FACE_REGIONS.imageRightBrow, 0) - rightX) * upX + (this.centroid(FACE_REGIONS.imageRightBrow, 1) - rightY) * upY, brows = (browLeft + browRight) * (0.5) / ipd;
|
|
2491
|
+
out[BROW_RAISE] = clampUnit((brows - FaceCalibration.browRest) / FaceCalibration.browSpan);
|
|
2492
|
+
let width = this.extent(FACE_REGIONS.outerLips, acrossX, acrossY) / ipd, narrowing = clampUnit((FaceCalibration.mouthRestWidth - width) / FaceCalibration.puckerSpan);
|
|
2493
|
+
out[PUCKER] = narrowing * (1 - jaw);
|
|
2494
|
+
}
|
|
2495
|
+
centroid(region, axis) {
|
|
2496
|
+
let sum = 0;
|
|
2497
|
+
for (let i = 0; i < region.length; i++) sum += this.units[region[i] * 2 + axis];
|
|
2498
|
+
return sum / region.length;
|
|
2499
|
+
}
|
|
2500
|
+
extent(region, ax, ay) {
|
|
2501
|
+
let low = Number.POSITIVE_INFINITY, high = Number.NEGATIVE_INFINITY;
|
|
2502
|
+
for (let i = 0; i < region.length; i++) {
|
|
2503
|
+
let p = region[i] * 2, along = this.units[p] * ax + this.units[p + 1] * ay;
|
|
2504
|
+
along < low && (low = along), along > high && (high = along);
|
|
2505
|
+
}
|
|
2506
|
+
return high - low;
|
|
2507
|
+
}
|
|
2508
|
+
blink(region, acrossX, acrossY, upX, upY) {
|
|
2509
|
+
let width = this.extent(region, acrossX, acrossY);
|
|
2510
|
+
return width <= 0 ? 0 : clampUnit(1 - this.extent(region, upX, upY) / width / FaceCalibration.eyeOpenAspect);
|
|
2511
|
+
}
|
|
2512
|
+
smile(acrossX, acrossY, upX, upY, ipd) {
|
|
2513
|
+
let lips = FACE_REGIONS.outerLips, cx = this.centroid(lips, 0), cy = this.centroid(lips, 1), leftmost = Number.POSITIVE_INFINITY, rightmost = Number.NEGATIVE_INFINITY, leftLift = 0, rightLift = 0;
|
|
2514
|
+
for (let i = 0; i < lips.length; i++) {
|
|
2515
|
+
let p = lips[i] * 2, ox = this.units[p] - cx, oy = this.units[p + 1] - cy, along = ox * acrossX + oy * acrossY, lift = ox * upX + oy * upY;
|
|
2516
|
+
along < leftmost && (leftmost = along, leftLift = lift), along > rightmost && (rightmost = along, rightLift = lift);
|
|
2517
|
+
}
|
|
2518
|
+
let widthShare = ((rightmost - leftmost) / ipd - FaceCalibration.mouthRestWidth) / (FaceCalibration.smileWidth - FaceCalibration.mouthRestWidth), liftShare = (leftLift + rightLift) * (0.5) / ipd / FaceCalibration.smileLift;
|
|
2519
|
+
return clampUnit(widthShare + liftShare);
|
|
2520
|
+
}
|
|
2521
|
+
};
|
|
2522
|
+
|
|
2523
|
+
// src/interactives/hosts/identity-capture.ts
|
|
2524
|
+
var IDENTITY_PURPOSE = CAMERA_LAYOUT.identity_purpose, IdentityCopy = {
|
|
2525
|
+
title: "Make your character from your face",
|
|
2526
|
+
consent: "Use your own face only, never anyone else's. The camera picture stays on this device. The game gets only your character's shape and colours.",
|
|
2527
|
+
decline: "Not now",
|
|
2528
|
+
agree: "This is me, continue",
|
|
2529
|
+
capture: "Capture",
|
|
2530
|
+
close: "Close",
|
|
2531
|
+
ready: "Your character is ready",
|
|
2532
|
+
save: "Also save as my avatar",
|
|
2533
|
+
use: "Use in game",
|
|
2534
|
+
retake: "Try again",
|
|
2535
|
+
preview: "Your camera, shown only here on this device"
|
|
2536
|
+
}, IdentityGuidance = {
|
|
2537
|
+
starting: "Starting the camera",
|
|
2538
|
+
find_face: "Look at the camera",
|
|
2539
|
+
face_camera: "Face the camera straight on",
|
|
2540
|
+
move_closer: "Move a little closer",
|
|
2541
|
+
hold_still: "Hold still"
|
|
2542
|
+
}, POSE_YAW = SOLVED_POSE_AT + FACE_LAYOUT.head_pose.indexOf("yaw"), POSE_PITCH = SOLVED_POSE_AT + FACE_LAYOUT.head_pose.indexOf("pitch"), POSE_Z2 = SOLVED_POSE_AT + FACE_LAYOUT.head_pose.indexOf("z"), MINIMUM_DEPTH = 1e-6, RED_SHIFT = 16, GREEN_SHIFT = 8, BYTE = 255;
|
|
2543
|
+
function faceWidthFromDepth(depth) {
|
|
2544
|
+
return depth > (1e-6) ? FaceCalibration.canonicalEyeSpan / (depth * FaceCalibration.canonicalFaceWidth) : 0;
|
|
2545
|
+
}
|
|
2546
|
+
function unpack(word) {
|
|
2547
|
+
return word === NO_FACE_COLOUR ? null : [word >> (16) & (255), word >> (8) & (255), word & (255)];
|
|
2548
|
+
}
|
|
2549
|
+
function capturedColours(colours) {
|
|
2550
|
+
let skin = colours === null ? null : unpack(colours.skin);
|
|
2551
|
+
return colours === null || skin === null ? null : { skin, hair: unpack(colours.hair), eye: unpack(colours.eye) };
|
|
2552
|
+
}
|
|
2553
|
+
function frameContext(solved, faces, ageRange) {
|
|
2554
|
+
return {
|
|
2555
|
+
ageRange,
|
|
2556
|
+
consented: true,
|
|
2557
|
+
subject: "self",
|
|
2558
|
+
source: "camera",
|
|
2559
|
+
faces,
|
|
2560
|
+
yaw: faces === 1 ? solved[POSE_YAW] : 0,
|
|
2561
|
+
pitch: faces === 1 ? solved[POSE_PITCH] : 0,
|
|
2562
|
+
faceWidth: faces === 1 ? faceWidthFromDepth(solved[POSE_Z2]) : 0
|
|
2563
|
+
};
|
|
2564
|
+
}
|
|
2565
|
+
var GUIDANCE_FOR = {
|
|
2566
|
+
one_face_only: "find_face",
|
|
2567
|
+
face_turned: "face_camera",
|
|
2568
|
+
face_too_small: "move_closer"
|
|
2569
|
+
};
|
|
2570
|
+
function guidanceFor(context) {
|
|
2571
|
+
let refusal = identityCapturePolicy(context).refusal;
|
|
2572
|
+
return refusal === null ? "hold_still" : GUIDANCE_FOR[refusal] ?? "find_face";
|
|
2573
|
+
}
|
|
2574
|
+
function ageAnswer(ageRange) {
|
|
2575
|
+
return ageRange === "under_16" || ageRange === "undeclared" ? "refused" : null;
|
|
2576
|
+
}
|
|
2577
|
+
function fitIdentity(fitter, landmarks, aspect, colours, context) {
|
|
2578
|
+
let { fit } = identityFromCapture(fitter, { landmarks, aspect, colours }, context, {
|
|
2579
|
+
residual: true
|
|
2580
|
+
});
|
|
2581
|
+
return fit === null ? null : encodeIdentity(fit.params);
|
|
2582
|
+
}
|
|
2583
|
+
async function identityFitter(options) {
|
|
2584
|
+
let base = await options.base();
|
|
2585
|
+
return base instanceof IdentityFitter ? base : new IdentityFitter(base);
|
|
2586
|
+
}
|
|
2587
|
+
var IdentityAttempt = class {
|
|
2588
|
+
constructor(grant, handle) {
|
|
2589
|
+
this.grant = grant;
|
|
2590
|
+
this.handle = handle;
|
|
2591
|
+
this.consented = false;
|
|
2592
|
+
this.framing = false;
|
|
2593
|
+
this.wanted = false;
|
|
2594
|
+
this.shown = null;
|
|
2595
|
+
this.identity = null;
|
|
2596
|
+
this.ageRange = "undeclared";
|
|
2597
|
+
this.fitter = null;
|
|
2598
|
+
this.sheet = null;
|
|
2599
|
+
this.queue = [];
|
|
2600
|
+
this.waiting = null;
|
|
2601
|
+
this.aborted = null;
|
|
2602
|
+
this.events = {
|
|
2603
|
+
agree: () => this.push({ kind: "agree" }),
|
|
2604
|
+
decline: () => this.push({ kind: "decline" }),
|
|
2605
|
+
capture: () => this.push({ kind: "capture" }),
|
|
2606
|
+
retake: () => this.push({ kind: "retake" }),
|
|
2607
|
+
use: (save) => this.push({ kind: "use", save }),
|
|
2608
|
+
close: () => this.push({ kind: "close" })
|
|
2609
|
+
};
|
|
2610
|
+
}
|
|
2611
|
+
push(event) {
|
|
2612
|
+
if (this.aborted !== null) return;
|
|
2613
|
+
event.kind === "abort" && (this.aborted = event.code);
|
|
2614
|
+
let waiting = this.waiting;
|
|
2615
|
+
if (waiting === null) {
|
|
2616
|
+
this.queue.push(event);
|
|
2617
|
+
return;
|
|
2618
|
+
}
|
|
2619
|
+
this.waiting = null, waiting(event);
|
|
2620
|
+
}
|
|
2621
|
+
abort(code) {
|
|
2622
|
+
this.push({ kind: "abort", code });
|
|
2623
|
+
}
|
|
2624
|
+
get abortedWith() {
|
|
2625
|
+
return this.aborted;
|
|
2626
|
+
}
|
|
2627
|
+
next() {
|
|
2628
|
+
let queued = this.queue.shift();
|
|
2629
|
+
return queued !== void 0 ? Promise.resolve(queued) : this.aborted !== null ? Promise.resolve({ kind: "abort", code: this.aborted }) : new Promise((resolve) => {
|
|
2630
|
+
this.waiting = resolve;
|
|
2631
|
+
});
|
|
2632
|
+
}
|
|
2633
|
+
guide(guidance) {
|
|
2634
|
+
this.shown !== guidance && (this.shown = guidance, this.sheet?.guide(guidance));
|
|
2635
|
+
}
|
|
2636
|
+
}, LAYER_SHEET = 4, SHEET_STYLE = `position:absolute;inset:0;z-index:${(4)};display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:24px 16px;box-sizing:border-box;background:rgba(8,10,12,0.94);color:#f4f5f6;font:15px/1.45 system-ui,-apple-system,sans-serif;text-align:center`, PREVIEW_STYLE = "width:min(72vw,280px);aspect-ratio:3/4;border-radius:24px;object-fit:cover;transform:scaleX(-1);background:#000", TEXT_STYLE = "margin:0;max-width:340px", TITLE_STYLE = "margin:0;font-size:19px;font-weight:600", ROW_STYLE = "display:flex;gap:12px;flex-wrap:wrap;justify-content:center", PRIMARY_STYLE = "min-height:44px;padding:0 20px;border:0;border-radius:22px;background:#f4f5f6;color:#0b0d0f;font:inherit;font-weight:600;cursor:pointer", SECONDARY_STYLE = "min-height:44px;padding:0 20px;border:1px solid rgba(255,255,255,0.32);border-radius:22px;background:transparent;color:inherit;font:inherit;cursor:pointer", TOGGLE_STYLE = "display:flex;align-items:center;gap:10px;min-height:44px;cursor:pointer";
|
|
2637
|
+
function domIdentitySheet(container) {
|
|
2638
|
+
return (events) => {
|
|
2639
|
+
let doc = container?.ownerDocument ?? document, root = doc.createElement("div");
|
|
2640
|
+
root.setAttribute("role", "dialog"), root.setAttribute("aria-modal", "true"), root.setAttribute("aria-label", IdentityCopy.title), root.setAttribute("style", SHEET_STYLE), root.addEventListener("keydown", (event) => {
|
|
2641
|
+
event.key === "Escape" && events.close();
|
|
2642
|
+
}), container?.appendChild(root);
|
|
2643
|
+
let video = null, guidance = null, captureButton = null, element = (tag, style, text2) => {
|
|
2644
|
+
let node = doc.createElement(tag);
|
|
2645
|
+
return node.setAttribute("style", style), text2 !== void 0 && (node.textContent = text2), node;
|
|
2646
|
+
}, button = (text2, style, action) => {
|
|
2647
|
+
let node = element("button", style, text2);
|
|
2648
|
+
return node.type = "button", node.addEventListener("click", action), node;
|
|
2649
|
+
}, stopPreview = () => {
|
|
2650
|
+
video !== null && (video.pause(), video.srcObject = null, video = null);
|
|
2651
|
+
}, show = (...nodes) => {
|
|
2652
|
+
root.replaceChildren(...nodes);
|
|
2653
|
+
};
|
|
2654
|
+
return {
|
|
2655
|
+
consent() {
|
|
2656
|
+
let agree = button(IdentityCopy.agree, PRIMARY_STYLE, () => events.agree());
|
|
2657
|
+
show(
|
|
2658
|
+
element("h2", TITLE_STYLE, IdentityCopy.title),
|
|
2659
|
+
element("p", TEXT_STYLE, IdentityCopy.consent),
|
|
2660
|
+
rowOf(
|
|
2661
|
+
element("div", ROW_STYLE),
|
|
2662
|
+
button(IdentityCopy.decline, SECONDARY_STYLE, () => events.decline()),
|
|
2663
|
+
agree
|
|
2664
|
+
)
|
|
2665
|
+
), agree.focus();
|
|
2666
|
+
},
|
|
2667
|
+
framing(stream) {
|
|
2668
|
+
stopPreview();
|
|
2669
|
+
let preview = element("video", PREVIEW_STYLE);
|
|
2670
|
+
preview.muted = true, preview.playsInline = true, preview.autoplay = true, preview.setAttribute("aria-label", IdentityCopy.preview), preview.srcObject = stream, video = preview, guidance = element("p", TEXT_STYLE, IdentityGuidance.starting), guidance.setAttribute("aria-live", "polite"), captureButton = button(IdentityCopy.capture, PRIMARY_STYLE, () => events.capture()), captureButton.disabled = true, show(
|
|
2671
|
+
element("h2", TITLE_STYLE, IdentityCopy.title),
|
|
2672
|
+
preview,
|
|
2673
|
+
guidance,
|
|
2674
|
+
rowOf(
|
|
2675
|
+
element("div", ROW_STYLE),
|
|
2676
|
+
button(IdentityCopy.close, SECONDARY_STYLE, () => events.close()),
|
|
2677
|
+
captureButton
|
|
2678
|
+
)
|
|
2679
|
+
), preview.play().catch(() => {
|
|
2680
|
+
});
|
|
2681
|
+
},
|
|
2682
|
+
guide(key) {
|
|
2683
|
+
guidance !== null && (guidance.textContent = IdentityGuidance[key]), captureButton !== null && (captureButton.disabled = key !== "hold_still");
|
|
2684
|
+
},
|
|
2685
|
+
result(offerSave) {
|
|
2686
|
+
stopPreview(), guidance = null, captureButton = null;
|
|
2687
|
+
let nodes = [element("h2", TITLE_STYLE, IdentityCopy.ready)], save = null;
|
|
2688
|
+
if (offerSave) {
|
|
2689
|
+
let label = element("label", TOGGLE_STYLE);
|
|
2690
|
+
save = element("input", "width:20px;height:20px"), save.type = "checkbox", save.checked = false, label.append(save, doc.createTextNode(IdentityCopy.save)), nodes.push(label);
|
|
2691
|
+
}
|
|
2692
|
+
let chosen = save, use = button(IdentityCopy.use, PRIMARY_STYLE, () => events.use(chosen?.checked === true));
|
|
2693
|
+
nodes.push(
|
|
2694
|
+
rowOf(
|
|
2695
|
+
element("div", ROW_STYLE),
|
|
2696
|
+
button(IdentityCopy.close, SECONDARY_STYLE, () => events.close()),
|
|
2697
|
+
button(IdentityCopy.retake, SECONDARY_STYLE, () => events.retake()),
|
|
2698
|
+
use
|
|
2699
|
+
)
|
|
2700
|
+
), show(...nodes), use.focus();
|
|
2701
|
+
},
|
|
2702
|
+
close() {
|
|
2703
|
+
stopPreview(), root.remove();
|
|
2704
|
+
}
|
|
2705
|
+
};
|
|
2706
|
+
};
|
|
2707
|
+
}
|
|
2708
|
+
function rowOf(row, ...children) {
|
|
2709
|
+
return row.append(...children), row;
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
// src/interactives/hosts/face-camera.ts
|
|
2713
|
+
var CAMERA_ON_COPY = "Your camera is on. It stays on this device.", CAMERA_NEEDLE = new TextEncoder().encode('"camera.'), REQUEST_OPERATION = "camera.request", RELEASE_OPERATION = "camera.release", VIEW_PURPOSE = CAMERA_LAYOUT.view_purpose, TRACK_PURPOSE = CAMERA_LAYOUT.track_purpose, GRANTED = "granted", DENIED = "denied", AGE_UNDECLARED = "age_undeclared", UNDECLARED_RANGE = "undeclared", UNAVAILABLE = "unavailable", CANCELLED = "cancelled", CONSENT = "consent", READY = "hold_still", IDENTITY_CONSUMER = -1, NOT_ALLOWED = "NotAllowedError", MAX_POINTS = 478, POINT_STRIDE = 3, LANDMARK_FLOATS2 = FACE_LAYOUT.landmark_count * FACE_LAYOUT.landmark_stride, EXPRESSION_FLOATS = FACE_FRAME.expression_floats, POSE_FLOATS = FACE_FRAME.pose_floats, MEASURED = 1, DERIVED = 0, LAYER_UNDER = 0, LAYER_INSET = 2, LAYER_OVER = 3, decoder6 = new TextDecoder();
|
|
2714
|
+
function mentionsCamera(bytes) {
|
|
2715
|
+
let needle = CAMERA_NEEDLE, last = bytes.length - needle.length;
|
|
2716
|
+
outer: for (let i = 0; i <= last; i++) {
|
|
2717
|
+
for (let j = 0; j < needle.length; j++) if (bytes[i + j] !== needle[j]) continue outer;
|
|
2718
|
+
return true;
|
|
2719
|
+
}
|
|
2720
|
+
return false;
|
|
2721
|
+
}
|
|
2722
|
+
var CameraGrants = class {
|
|
2723
|
+
constructor(revoked = () => {
|
|
2724
|
+
}) {
|
|
2725
|
+
this.revoked = revoked;
|
|
2726
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
2727
|
+
this.granted = /* @__PURE__ */ new Map();
|
|
2728
|
+
}
|
|
2729
|
+
observeRequest(bytes) {
|
|
2730
|
+
if (!mentionsCamera(bytes)) return;
|
|
2731
|
+
let envelope;
|
|
2732
|
+
try {
|
|
2733
|
+
envelope = readJson(bytes);
|
|
2734
|
+
} catch {
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
let call = envelope.call;
|
|
2738
|
+
call.operation === REQUEST_OPERATION ? this.pending.set(envelope.request_id, { kind: "request" }) : call.operation === RELEASE_OPERATION && this.pending.set(envelope.request_id, {
|
|
2739
|
+
kind: "release",
|
|
2740
|
+
grant: call.arguments?.grant_id ?? null
|
|
2741
|
+
});
|
|
2742
|
+
}
|
|
2743
|
+
observeResponse(bytes) {
|
|
2744
|
+
if (this.pending.size === 0) return null;
|
|
2745
|
+
let envelope;
|
|
2746
|
+
try {
|
|
2747
|
+
envelope = readJson(bytes);
|
|
2748
|
+
} catch {
|
|
2749
|
+
return null;
|
|
2750
|
+
}
|
|
2751
|
+
let operation = this.pending.get(envelope.request_id);
|
|
2752
|
+
if (operation === void 0) return null;
|
|
2753
|
+
this.pending.delete(envelope.request_id);
|
|
2754
|
+
let outcome = envelope.outcome;
|
|
2755
|
+
if (operation.kind === "release")
|
|
2756
|
+
return operation.grant !== null && this.granted.delete(operation.grant) && this.revoked(operation.grant), null;
|
|
2757
|
+
if (outcome.status === "error") {
|
|
2758
|
+
let error = outcome.error;
|
|
2759
|
+
return error.code === DENIED && error.reason === AGE_UNDECLARED ? AGE_UNDECLARED : null;
|
|
2760
|
+
}
|
|
2761
|
+
let consent = outcome.response.result;
|
|
2762
|
+
return consent?.status !== GRANTED || typeof consent.grant_id != "string" || this.granted.set(consent.grant_id, new Set(consent.purposes ?? [])), null;
|
|
2763
|
+
}
|
|
2764
|
+
allows(grant, purpose) {
|
|
2765
|
+
return this.granted.get(grant)?.has(purpose) ?? false;
|
|
2766
|
+
}
|
|
2767
|
+
allowsFaceTracking(grant) {
|
|
2768
|
+
return this.allows(grant, TRACK_PURPOSE);
|
|
2769
|
+
}
|
|
2770
|
+
allowsPreview(grant) {
|
|
2771
|
+
return this.allows(grant, VIEW_PURPOSE);
|
|
2772
|
+
}
|
|
2773
|
+
revokeAll() {
|
|
2774
|
+
let all = [...this.granted.keys()];
|
|
2775
|
+
this.granted.clear(), this.pending.clear();
|
|
2776
|
+
for (let grant of all) this.revoked(grant);
|
|
2777
|
+
}
|
|
2778
|
+
}, INSET_STYLE = `position:absolute;top:12px;right:12px;width:88px;height:120px;border-radius:14px;object-fit:cover;transform:scaleX(-1);pointer-events:none;z-index:${(2)};border:1px solid rgba(255,255,255,0.24);background:#000`;
|
|
2779
|
+
function cameraViewStyle(rect, origin = { left: 0, top: 0 }) {
|
|
2780
|
+
if (rect === null) return INSET_STYLE;
|
|
2781
|
+
let mirror = rect.mirror ? "transform:scaleX(-1);" : "", layer = rect.over ? (3) : (0);
|
|
2782
|
+
return `position:absolute;left:${origin.left + rect.x}px;top:${origin.top + rect.y}px;width:${rect.width}px;height:${rect.height}px;object-fit:cover;${mirror}pointer-events:none;z-index:${layer};background:#000`;
|
|
2783
|
+
}
|
|
2784
|
+
function readViewRect(bytes) {
|
|
2785
|
+
if (bytes.length < CAMERA_PLACE_BYTES) return null;
|
|
2786
|
+
let x = readFloat(bytes, CAMERA_PLACE_X_AT), y = readFloat(bytes, CAMERA_PLACE_X_AT + CAMERA_WORD_BYTES), width = readFloat(bytes, CAMERA_PLACE_X_AT + CAMERA_WORD_BYTES * 2), height = readFloat(bytes, CAMERA_PLACE_X_AT + CAMERA_WORD_BYTES * 3);
|
|
2787
|
+
if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(width) || !Number.isFinite(height) || width < 0 || height < 0) return null;
|
|
2788
|
+
let flags = bytes[CAMERA_PLACE_FLAGS_AT];
|
|
2789
|
+
return {
|
|
2790
|
+
x,
|
|
2791
|
+
y,
|
|
2792
|
+
width,
|
|
2793
|
+
height,
|
|
2794
|
+
mirror: (flags & CameraViewFlag.mirror) !== 0,
|
|
2795
|
+
over: (flags & CameraViewFlag.over) !== 0
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
var VIDEO_CONSTRAINTS = {
|
|
2799
|
+
audio: false,
|
|
2800
|
+
video: { facingMode: "user", width: { ideal: 1280 }, height: { ideal: 720 } }
|
|
2801
|
+
};
|
|
2802
|
+
function insetVideo(container, surface = () => ({ left: 0, top: 0 })) {
|
|
2803
|
+
return async (stream) => {
|
|
2804
|
+
let video = (container?.ownerDocument ?? document).createElement("video");
|
|
2805
|
+
return video.muted = true, video.playsInline = true, video.autoplay = true, video.setAttribute("aria-label", CAMERA_ON_COPY), video.setAttribute("title", CAMERA_ON_COPY), video.setAttribute("role", "img"), video.setAttribute("style", INSET_STYLE), video.srcObject = stream, container?.appendChild(video), await video.play(), {
|
|
2806
|
+
video,
|
|
2807
|
+
place: (rect) => video.setAttribute("style", cameraViewStyle(rect, surface())),
|
|
2808
|
+
release: () => {
|
|
2809
|
+
video.pause(), video.srcObject = null, video.remove();
|
|
2810
|
+
}
|
|
2811
|
+
};
|
|
2812
|
+
};
|
|
2813
|
+
}
|
|
2814
|
+
var FaceCameraRelay = class {
|
|
2815
|
+
constructor(port, options) {
|
|
2816
|
+
this.port = port;
|
|
2817
|
+
this.options = options;
|
|
2818
|
+
this.solver = new FaceSolver();
|
|
2819
|
+
this.solved = new Float32Array(SOLVED_FLOATS);
|
|
2820
|
+
this.staging = new ArrayBuffer(FACE_PAYLOAD_BYTES);
|
|
2821
|
+
this.stagingBytes = new Uint8Array(this.staging);
|
|
2822
|
+
this.stagingWords = new Uint32Array(this.staging, 0, FACE_FRAME.header_words - FACE_FRAME.faces);
|
|
2823
|
+
this.floats = new Float32Array(this.staging, FACE_FLOATS_AT, FACE_FLOATS);
|
|
2824
|
+
this.expressions = this.floats.subarray(0, EXPRESSION_FLOATS);
|
|
2825
|
+
this.arkit = this.floats.subarray(FACE_ARKIT_AT, FACE_POSE_AT);
|
|
2826
|
+
this.pose = this.floats.subarray(FACE_POSE_AT, FACE_POSE_AT + POSE_FLOATS);
|
|
2827
|
+
this.points = new Float32Array((478) * (3));
|
|
2828
|
+
this.paints = [];
|
|
2829
|
+
this.session = null;
|
|
2830
|
+
this.attempt = null;
|
|
2831
|
+
this.runner = null;
|
|
2832
|
+
this.loading = false;
|
|
2833
|
+
this.visible = true;
|
|
2834
|
+
this.frameHandle = 0;
|
|
2835
|
+
this.frameScheduled = false;
|
|
2836
|
+
this.nextHandle = 0;
|
|
2837
|
+
this.placements = 0;
|
|
2838
|
+
this.under = false;
|
|
2839
|
+
this.closed = false;
|
|
2840
|
+
this.step = () => {
|
|
2841
|
+
this.frameScheduled = false;
|
|
2842
|
+
let session = this.session, runner = this.runner;
|
|
2843
|
+
if (session === null || runner === null || !this.wanted(session) || !this.visible || session.view === null) return;
|
|
2844
|
+
let video = session.view.video, faces = 0;
|
|
2845
|
+
try {
|
|
2846
|
+
let count = runner.detect(video, this.now(), this.points);
|
|
2847
|
+
count > 0 && this.solver.solve(this.points, count, video.videoHeight / Math.max(video.videoWidth, 1), this.solved) && (faces = 1);
|
|
2848
|
+
} catch (error) {
|
|
2849
|
+
this.options?.on_error?.(error);
|
|
2850
|
+
}
|
|
2851
|
+
this.tracked(session) && (faces === 1 && this.derive(runner), this.publish(session, faces), faces === 1 && this.paints.length > 0 && this.paint(session));
|
|
2852
|
+
let attempt = this.attempt;
|
|
2853
|
+
attempt !== null && attempt.framing && this.frame(attempt, session, video, faces), this.schedule();
|
|
2854
|
+
};
|
|
2855
|
+
this.grants = new CameraGrants((grant) => this.revoke(grant));
|
|
2856
|
+
let scope = globalThis;
|
|
2857
|
+
this.media = options?.media ?? scope.navigator?.mediaDevices ?? null, this.videoFactory = options?.video ?? insetVideo(options?.container ?? null, options?.surface), this.now = options?.now ?? (() => performance.now());
|
|
2858
|
+
}
|
|
2859
|
+
get live() {
|
|
2860
|
+
return this.session?.media !== null && this.session?.media !== void 0;
|
|
2861
|
+
}
|
|
2862
|
+
observeRequest(bytes) {
|
|
2863
|
+
this.grants.observeRequest(bytes);
|
|
2864
|
+
}
|
|
2865
|
+
observeResponse(bytes) {
|
|
2866
|
+
this.grants.observeResponse(bytes) === AGE_UNDECLARED && this.options?.on_age_needed?.();
|
|
2867
|
+
}
|
|
2868
|
+
observeLifecycle(code) {
|
|
2869
|
+
code === LifecycleCode.hidden || code === LifecycleCode.suspend ? this.setVisible(false) : code === LifecycleCode.visible || code === LifecycleCode.resume ? this.setVisible(true) : code === LifecycleCode.dispose && this.releaseAll();
|
|
2870
|
+
}
|
|
2871
|
+
handle(bytes) {
|
|
2872
|
+
let tag = bytes[0];
|
|
2873
|
+
if ((tag < MessageTag.camera_open || tag > MessageTag.camera_coloured) && tag !== MessageTag.camera_place && tag !== MessageTag.camera_identify) return false;
|
|
2874
|
+
if (bytes.length < CAMERA_HANDLE_BYTES) return true;
|
|
2875
|
+
let id = readWord(bytes, CAMERA_ID_AT);
|
|
2876
|
+
switch (tag) {
|
|
2877
|
+
case MessageTag.camera_open:
|
|
2878
|
+
bytes.length >= CAMERA_OPEN_BYTES && this.open(id, bytes[CAMERA_PURPOSE_AT], decoder6.decode(bytes.subarray(CAMERA_OPEN_BYTES)));
|
|
2879
|
+
break;
|
|
2880
|
+
case MessageTag.camera_close:
|
|
2881
|
+
this.close(id);
|
|
2882
|
+
break;
|
|
2883
|
+
case MessageTag.camera_track:
|
|
2884
|
+
this.track(id);
|
|
2885
|
+
break;
|
|
2886
|
+
case MessageTag.camera_untrack:
|
|
2887
|
+
this.untrack(id);
|
|
2888
|
+
break;
|
|
2889
|
+
case MessageTag.camera_colours:
|
|
2890
|
+
bytes.length >= CAMERA_PAIR_BYTES && this.colours(id, readWord(bytes, CAMERA_SECOND_AT));
|
|
2891
|
+
break;
|
|
2892
|
+
case MessageTag.camera_place:
|
|
2893
|
+
this.place(id, bytes);
|
|
2894
|
+
break;
|
|
2895
|
+
case MessageTag.camera_identify:
|
|
2896
|
+
this.identify(id, decoder6.decode(bytes.subarray(CAMERA_HANDLE_BYTES)));
|
|
2897
|
+
break;
|
|
2898
|
+
}
|
|
2899
|
+
return true;
|
|
2900
|
+
}
|
|
2901
|
+
setVisible(visible) {
|
|
2902
|
+
if (this.visible === visible) return;
|
|
2903
|
+
this.visible = visible, visible || this.attempt?.abort(CANCELLED);
|
|
2904
|
+
let session = this.session;
|
|
2905
|
+
if (session !== null) {
|
|
2906
|
+
if (visible) {
|
|
2907
|
+
this.acquire(session).then((ok) => {
|
|
2908
|
+
ok && this.schedule();
|
|
2909
|
+
});
|
|
2910
|
+
return;
|
|
2911
|
+
}
|
|
2912
|
+
this.stopMedia(session), this.answerPaints(), this.tracked(session) && this.publish(session, 0);
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
shutdown() {
|
|
2916
|
+
this.closed || (this.closed = true, this.releaseAll());
|
|
2917
|
+
}
|
|
2918
|
+
releaseAll() {
|
|
2919
|
+
this.attempt?.abort(CANCELLED), this.grants.revokeAll();
|
|
2920
|
+
let session = this.session;
|
|
2921
|
+
session !== null && this.end(session);
|
|
2922
|
+
}
|
|
2923
|
+
async open(request2, purpose, grant) {
|
|
2924
|
+
if (this.closed || this.options === null || this.media === null) return this.opened(request2, NO_CAMERA, CameraRefusal.unavailable);
|
|
2925
|
+
if (purpose === CameraOpenPurpose.track) {
|
|
2926
|
+
if (!this.grants.allowsFaceTracking(grant)) return this.opened(request2, NO_CAMERA, CameraRefusal.noGrant);
|
|
2927
|
+
} else if (purpose === CameraOpenPurpose.view) {
|
|
2928
|
+
if (!this.grants.allowsPreview(grant)) return this.opened(request2, NO_CAMERA, CameraRefusal.noPreview);
|
|
2929
|
+
} else
|
|
2930
|
+
return this.opened(request2, NO_CAMERA, CameraRefusal.unavailable);
|
|
2931
|
+
if (this.session !== null && this.session.grant !== grant) return this.opened(request2, NO_CAMERA, CameraRefusal.busy);
|
|
2932
|
+
let session = this.session ?? {
|
|
2933
|
+
grant,
|
|
2934
|
+
consumers: /* @__PURE__ */ new Map(),
|
|
2935
|
+
media: null,
|
|
2936
|
+
view: null,
|
|
2937
|
+
colours: null,
|
|
2938
|
+
acquiring: null
|
|
2939
|
+
};
|
|
2940
|
+
this.session = session, this.nextHandle = this.nextHandle + 1 >>> 0 || 1;
|
|
2941
|
+
let consumer = {
|
|
2942
|
+
handle: this.nextHandle,
|
|
2943
|
+
purpose,
|
|
2944
|
+
tracking: false,
|
|
2945
|
+
rect: null,
|
|
2946
|
+
shown: false,
|
|
2947
|
+
placed: 0
|
|
2948
|
+
};
|
|
2949
|
+
session.consumers.set(consumer.handle, consumer);
|
|
2950
|
+
let refusal = await this.acquireOrRefuse(session);
|
|
2951
|
+
if (this.session !== session || !session.consumers.has(consumer.handle)) return this.opened(request2, NO_CAMERA, CameraRefusal.notOpen);
|
|
2952
|
+
if (refusal !== null)
|
|
2953
|
+
return session.consumers.delete(consumer.handle), session.consumers.size === 0 && this.end(session), this.opened(request2, NO_CAMERA, refusal);
|
|
2954
|
+
this.opened(request2, consumer.handle, "");
|
|
2955
|
+
}
|
|
2956
|
+
async acquireOrRefuse(session) {
|
|
2957
|
+
try {
|
|
2958
|
+
return await this.acquire(session, !0) ? null : CameraRefusal.notOpen;
|
|
2959
|
+
} catch (error) {
|
|
2960
|
+
return error?.name === NOT_ALLOWED ? CameraRefusal.denied : CameraRefusal.unavailable;
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
acquire(session, rethrow = false) {
|
|
2964
|
+
return session.media !== null || !this.visible ? Promise.resolve(true) : (session.acquiring ?? (session.acquiring = this.start(session).finally(() => {
|
|
2965
|
+
session.acquiring = null;
|
|
2966
|
+
})), rethrow ? session.acquiring : session.acquiring.catch(() => false));
|
|
2967
|
+
}
|
|
2968
|
+
async start(session) {
|
|
2969
|
+
let stream = await this.media.getUserMedia(VIDEO_CONSTRAINTS);
|
|
2970
|
+
if (this.session !== session || !this.visible) {
|
|
2971
|
+
for (let track of stream.getTracks()) track.stop();
|
|
2972
|
+
return this.session === session;
|
|
2973
|
+
}
|
|
2974
|
+
let view;
|
|
2975
|
+
try {
|
|
2976
|
+
view = await this.videoFactory(stream);
|
|
2977
|
+
} catch (error) {
|
|
2978
|
+
for (let track of stream.getTracks()) track.stop();
|
|
2979
|
+
throw error;
|
|
2980
|
+
}
|
|
2981
|
+
if (this.session !== session || !this.visible) {
|
|
2982
|
+
view.release();
|
|
2983
|
+
for (let track of stream.getTracks()) track.stop();
|
|
2984
|
+
return this.session === session;
|
|
2985
|
+
}
|
|
2986
|
+
return session.media = stream, session.view = view, session.colours = new WebFaceColours(view.video), this.restyle(session), this.options?.on_live?.(true), true;
|
|
2987
|
+
}
|
|
2988
|
+
stopMedia(session) {
|
|
2989
|
+
this.cancelFrame(session);
|
|
2990
|
+
let media = session.media, view = session.view;
|
|
2991
|
+
if (session.media = null, session.view = null, session.colours = null, view?.release(), this.setUnder(false), media !== null) {
|
|
2992
|
+
for (let track of media.getTracks()) track.stop();
|
|
2993
|
+
this.options?.on_live?.(false);
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
end(session) {
|
|
2997
|
+
this.session === session && (this.session = null, session.consumers.clear(), this.stopMedia(session), this.answerPaints());
|
|
2998
|
+
}
|
|
2999
|
+
consumer(handle) {
|
|
3000
|
+
return this.session?.consumers.get(handle) ?? null;
|
|
3001
|
+
}
|
|
3002
|
+
close(handle) {
|
|
3003
|
+
let session = this.session;
|
|
3004
|
+
session === null || session.consumers.get(handle)?.purpose === (-1) || this.drop(session, handle);
|
|
3005
|
+
}
|
|
3006
|
+
drop(session, handle) {
|
|
3007
|
+
if (session.consumers.delete(handle)) {
|
|
3008
|
+
if (session.consumers.size === 0) {
|
|
3009
|
+
this.end(session);
|
|
3010
|
+
return;
|
|
3011
|
+
}
|
|
3012
|
+
this.wanted(session) || this.cancelFrame(session), this.restyle(session);
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
revoke(grant) {
|
|
3016
|
+
this.attempt?.grant === grant && this.attempt.abort(CONSENT);
|
|
3017
|
+
let session = this.session;
|
|
3018
|
+
session !== null && session.grant === grant && this.end(session);
|
|
3019
|
+
}
|
|
3020
|
+
wanted(session) {
|
|
3021
|
+
let attempt = this.attempt;
|
|
3022
|
+
return this.tracked(session) || attempt !== null && attempt.framing && attempt.grant === session.grant;
|
|
3023
|
+
}
|
|
3024
|
+
frame(attempt, session, video, faces) {
|
|
3025
|
+
let context = frameContext(this.solved, faces, attempt.ageRange), guidance = guidanceFor(context);
|
|
3026
|
+
if (attempt.guide(guidance), !attempt.wanted || guidance !== READY || attempt.fitter === null) return;
|
|
3027
|
+
attempt.wanted = false;
|
|
3028
|
+
let landmarks = this.solved.subarray(0, SOLVED_LANDMARK_FLOATS), colours = null;
|
|
3029
|
+
try {
|
|
3030
|
+
colours = session.colours === null ? null : session.colours.sample(landmarks);
|
|
3031
|
+
} catch (error) {
|
|
3032
|
+
this.options?.on_error?.(error);
|
|
3033
|
+
}
|
|
3034
|
+
let identity = null;
|
|
3035
|
+
try {
|
|
3036
|
+
identity = fitIdentity(attempt.fitter, landmarks, video.videoWidth / Math.max(video.videoHeight, 1), capturedColours(colours), context);
|
|
3037
|
+
} catch (error) {
|
|
3038
|
+
this.options?.on_error?.(error);
|
|
3039
|
+
}
|
|
3040
|
+
identity !== null && (attempt.framing = false, attempt.push({ kind: "captured", identity }));
|
|
3041
|
+
}
|
|
3042
|
+
async identify(request2, grant) {
|
|
3043
|
+
let identity = this.options?.identity;
|
|
3044
|
+
if (this.closed || this.options === null || identity === void 0 || this.media === null || this.attempt !== null || !this.visible)
|
|
3045
|
+
return this.identified(request2, { code: UNAVAILABLE });
|
|
3046
|
+
if (!this.grants.allows(grant, IDENTITY_PURPOSE)) return this.identified(request2, { code: CONSENT });
|
|
3047
|
+
this.nextHandle = this.nextHandle + 1 >>> 0 || 1;
|
|
3048
|
+
let attempt = new IdentityAttempt(grant, this.nextHandle);
|
|
3049
|
+
this.attempt = attempt;
|
|
3050
|
+
let answer;
|
|
3051
|
+
try {
|
|
3052
|
+
answer = await this.capture(attempt, identity);
|
|
3053
|
+
} catch (error) {
|
|
3054
|
+
this.options.on_error?.(error), answer = { code: attempt.abortedWith ?? UNAVAILABLE };
|
|
3055
|
+
}
|
|
3056
|
+
attempt.framing = false, attempt.sheet?.close(), this.attempt === attempt && (this.attempt = null);
|
|
3057
|
+
let session = this.session;
|
|
3058
|
+
session !== null && session.grant === grant && this.drop(session, attempt.handle), this.identified(request2, answer);
|
|
3059
|
+
}
|
|
3060
|
+
async capture(attempt, options) {
|
|
3061
|
+
let ageRange = await options.age_range(), refused = ageAnswer(ageRange);
|
|
3062
|
+
if (refused !== null)
|
|
3063
|
+
return ageRange === UNDECLARED_RANGE && this.options?.on_age_needed?.(), { code: refused };
|
|
3064
|
+
if (attempt.abortedWith !== null) return { code: attempt.abortedWith };
|
|
3065
|
+
attempt.ageRange = ageRange;
|
|
3066
|
+
let fitter = identityFitter(options);
|
|
3067
|
+
fitter.catch(() => {
|
|
3068
|
+
}), attempt.sheet = (options.sheet ?? domIdentitySheet(this.options?.container ?? null))(attempt.events), attempt.sheet.consent();
|
|
3069
|
+
let answered = await attempt.next();
|
|
3070
|
+
if (answered.kind === "abort") return { code: answered.code };
|
|
3071
|
+
if (answered.kind !== "agree") return { code: CONSENT };
|
|
3072
|
+
attempt.consented = true;
|
|
3073
|
+
let refusal = await this.openFor(attempt);
|
|
3074
|
+
if (refusal !== null) return { code: refusal };
|
|
3075
|
+
let session = this.session;
|
|
3076
|
+
if (await this.loadRunner(), this.runner === null) return { code: UNAVAILABLE };
|
|
3077
|
+
if (attempt.fitter = await fitter, attempt.abortedWith !== null || session.media === null) return { code: attempt.abortedWith ?? UNAVAILABLE };
|
|
3078
|
+
let stream = session.media;
|
|
3079
|
+
for (attempt.sheet.framing(stream), attempt.framing = true, attempt.shown = null, this.schedule(); ; ) {
|
|
3080
|
+
let event = await attempt.next();
|
|
3081
|
+
switch (event.kind) {
|
|
3082
|
+
case "abort":
|
|
3083
|
+
return { code: event.code };
|
|
3084
|
+
case "capture":
|
|
3085
|
+
attempt.wanted = true;
|
|
3086
|
+
break;
|
|
3087
|
+
case "captured":
|
|
3088
|
+
attempt.identity = event.identity, attempt.sheet.result(options.save_avatar !== void 0);
|
|
3089
|
+
break;
|
|
3090
|
+
case "retake":
|
|
3091
|
+
attempt.identity = null, attempt.sheet.framing(stream), attempt.framing = true, attempt.shown = null, this.schedule();
|
|
3092
|
+
break;
|
|
3093
|
+
case "use":
|
|
3094
|
+
if (attempt.identity === null) break;
|
|
3095
|
+
if (event.save && options.save_avatar !== void 0)
|
|
3096
|
+
try {
|
|
3097
|
+
await options.save_avatar(attempt.identity);
|
|
3098
|
+
} catch (error) {
|
|
3099
|
+
this.options?.on_error?.(error);
|
|
3100
|
+
}
|
|
3101
|
+
return { identity: attempt.identity };
|
|
3102
|
+
default:
|
|
3103
|
+
return { code: CANCELLED };
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
async openFor(attempt) {
|
|
3108
|
+
if (this.session !== null && this.session.grant !== attempt.grant) return UNAVAILABLE;
|
|
3109
|
+
let session = this.session ?? {
|
|
3110
|
+
grant: attempt.grant,
|
|
3111
|
+
consumers: /* @__PURE__ */ new Map(),
|
|
3112
|
+
media: null,
|
|
3113
|
+
view: null,
|
|
3114
|
+
colours: null,
|
|
3115
|
+
acquiring: null
|
|
3116
|
+
};
|
|
3117
|
+
this.session = session, session.consumers.set(attempt.handle, {
|
|
3118
|
+
handle: attempt.handle,
|
|
3119
|
+
purpose: (-1),
|
|
3120
|
+
tracking: false,
|
|
3121
|
+
rect: null,
|
|
3122
|
+
shown: false,
|
|
3123
|
+
placed: 0
|
|
3124
|
+
});
|
|
3125
|
+
let refusal = await this.acquireOrRefuse(session);
|
|
3126
|
+
return attempt.abortedWith !== null ? attempt.abortedWith : this.session !== session || !session.consumers.has(attempt.handle) ? UNAVAILABLE : refusal === null ? null : refusal === CameraRefusal.denied ? CONSENT : UNAVAILABLE;
|
|
3127
|
+
}
|
|
3128
|
+
identified(request2, answer) {
|
|
3129
|
+
let identity = "identity" in answer ? answer.identity : null, at = this.port.reserve(CAMERA_IDENTIFIED_BYTES + (identity?.length ?? 0)), out = this.port.out;
|
|
3130
|
+
out[at] = MessageTag.camera_identified, writeWord(out, at + CAMERA_ID_AT, request2), out[at + CAMERA_IDENTITY_CODE_AT] = identity === null ? identityCodeByte(answer.code) : IDENTITY_CAPTURED, identity !== null && out.set(identity, at + CAMERA_IDENTIFIED_BYTES), this.port.commitTask();
|
|
3131
|
+
}
|
|
3132
|
+
tracked(session) {
|
|
3133
|
+
for (let consumer of session.consumers.values()) if (consumer.tracking) return true;
|
|
3134
|
+
return false;
|
|
3135
|
+
}
|
|
3136
|
+
track(handle) {
|
|
3137
|
+
let consumer = this.consumer(handle);
|
|
3138
|
+
consumer === null || consumer.purpose !== CameraOpenPurpose.track || (consumer.tracking = true, this.loadRunner().then(() => this.schedule()));
|
|
3139
|
+
}
|
|
3140
|
+
untrack(handle) {
|
|
3141
|
+
let consumer = this.consumer(handle), session = this.session;
|
|
3142
|
+
consumer === null || session === null || (consumer.tracking = false, this.wanted(session) || this.cancelFrame(session));
|
|
3143
|
+
}
|
|
3144
|
+
place(handle, bytes) {
|
|
3145
|
+
let consumer = this.consumer(handle), session = this.session;
|
|
3146
|
+
if (consumer === null || session === null || consumer.purpose !== CameraOpenPurpose.view) return;
|
|
3147
|
+
let rect = readViewRect(bytes);
|
|
3148
|
+
rect !== null && (consumer.rect = rect, consumer.shown = (bytes[CAMERA_PLACE_FLAGS_AT] & CameraViewFlag.shown) !== 0, consumer.placed = ++this.placements, this.restyle(session));
|
|
3149
|
+
}
|
|
3150
|
+
restyle(session) {
|
|
3151
|
+
let view = session.view;
|
|
3152
|
+
if (view === null) return;
|
|
3153
|
+
let shown = null;
|
|
3154
|
+
for (let consumer of session.consumers.values())
|
|
3155
|
+
consumer.shown && consumer.rect !== null && (shown === null || consumer.placed > shown.placed) && (shown = consumer);
|
|
3156
|
+
view.place(shown?.rect ?? null), this.setUnder(shown !== null && shown.rect !== null && !shown.rect.over);
|
|
3157
|
+
}
|
|
3158
|
+
setUnder(under) {
|
|
3159
|
+
this.under !== under && (this.under = under, this.options?.on_under?.(under));
|
|
3160
|
+
}
|
|
3161
|
+
colours(handle, request2) {
|
|
3162
|
+
let session = this.session, consumer = session?.consumers.get(handle);
|
|
3163
|
+
if (session === null || consumer === void 0 || consumer.purpose === (-1) || session.media === null) {
|
|
3164
|
+
this.coloured(request2, null);
|
|
3165
|
+
return;
|
|
3166
|
+
}
|
|
3167
|
+
this.paints.push(request2);
|
|
3168
|
+
}
|
|
3169
|
+
paint(session) {
|
|
3170
|
+
let requests = this.paints.splice(0, this.paints.length), result = null;
|
|
3171
|
+
try {
|
|
3172
|
+
result = session.colours === null ? null : session.colours.sample(this.solved.subarray(0, LANDMARK_FLOATS2));
|
|
3173
|
+
} catch (error) {
|
|
3174
|
+
this.options?.on_error?.(error);
|
|
3175
|
+
}
|
|
3176
|
+
for (let request2 of requests) this.coloured(request2, result);
|
|
3177
|
+
}
|
|
3178
|
+
answerPaints() {
|
|
3179
|
+
let requests = this.paints.splice(0, this.paints.length);
|
|
3180
|
+
for (let request2 of requests) this.coloured(request2, null);
|
|
3181
|
+
}
|
|
3182
|
+
async loadRunner() {
|
|
3183
|
+
if (!(this.runner !== null || this.loading || this.options === null)) {
|
|
3184
|
+
this.loading = true;
|
|
3185
|
+
try {
|
|
3186
|
+
this.runner = await this.options.runner();
|
|
3187
|
+
} catch (error) {
|
|
3188
|
+
this.options.on_error?.(error);
|
|
3189
|
+
} finally {
|
|
3190
|
+
this.loading = false;
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
schedule() {
|
|
3195
|
+
let session = this.session;
|
|
3196
|
+
if (this.frameScheduled || session === null || !this.wanted(session) || !this.visible || session.view === null || this.runner === null) return;
|
|
3197
|
+
this.frameScheduled = true;
|
|
3198
|
+
let video = session.view.video;
|
|
3199
|
+
typeof video.requestVideoFrameCallback == "function" ? this.frameHandle = video.requestVideoFrameCallback(this.step) : this.frameHandle = requestAnimationFrame(this.step);
|
|
3200
|
+
}
|
|
3201
|
+
cancelFrame(session) {
|
|
3202
|
+
if (!this.frameScheduled) return;
|
|
3203
|
+
this.frameScheduled = false;
|
|
3204
|
+
let video = session.view?.video;
|
|
3205
|
+
video !== void 0 && typeof video.cancelVideoFrameCallback == "function" ? video.cancelVideoFrameCallback(this.frameHandle) : cancelAnimationFrame(this.frameHandle);
|
|
3206
|
+
}
|
|
3207
|
+
derive(runner) {
|
|
3208
|
+
let solved = this.solved;
|
|
3209
|
+
for (let i = 0; i < EXPRESSION_FLOATS; i++) this.expressions[i] = solved[LANDMARK_FLOATS2 + i];
|
|
3210
|
+
for (let i = 0; i < POSE_FLOATS; i++) this.pose[i] = solved[LANDMARK_FLOATS2 + EXPRESSION_FLOATS + i];
|
|
3211
|
+
let measured = runner.weigh?.(this.arkit) ?? false;
|
|
3212
|
+
measured || deriveArkit(this.expressions, this.arkit), this.stagingWords[FACE_FRAME.measured - FACE_FRAME.faces] = measured ? (1) : (0);
|
|
3213
|
+
}
|
|
3214
|
+
publish(session, faces) {
|
|
3215
|
+
this.stagingWords[0] = faces;
|
|
3216
|
+
for (let consumer of session.consumers.values()) {
|
|
3217
|
+
if (!consumer.tracking) continue;
|
|
3218
|
+
let at = this.port.reserve(CAMERA_FACE_BYTES), out = this.port.out;
|
|
3219
|
+
out[at] = MessageTag.camera_face, writeWord(out, at + CAMERA_ID_AT, consumer.handle), out.set(this.stagingBytes, at + CAMERA_HANDLE_BYTES), this.port.commitFrame();
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
opened(request2, handle, reason) {
|
|
3223
|
+
let text2 = new TextEncoder().encode(reason), at = this.port.reserve(CAMERA_PAIR_BYTES + text2.length), out = this.port.out;
|
|
3224
|
+
out[at] = MessageTag.camera_opened, writeWord(out, at + CAMERA_ID_AT, request2), writeWord(out, at + CAMERA_SECOND_AT, handle), out.set(text2, at + CAMERA_PAIR_BYTES), this.port.commitTask();
|
|
3225
|
+
}
|
|
3226
|
+
coloured(request2, colours) {
|
|
3227
|
+
let at = this.port.reserve(CAMERA_COLOURED_BYTES), out = this.port.out;
|
|
3228
|
+
out[at] = MessageTag.camera_coloured, writeWord(out, at + CAMERA_ID_AT, request2), writeWord(out, at + CAMERA_SECOND_AT, colours === null ? NO_FACE_COLOUR : colours.skin), writeWord(out, at + CAMERA_SECOND_AT + CAMERA_WORD_BYTES, colours === null ? NO_FACE_COLOUR : colours.hair), writeWord(out, at + CAMERA_SECOND_AT + CAMERA_WORD_BYTES * 2, colours === null ? NO_FACE_COLOUR : colours.eye), this.port.commitTask();
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
|
|
3232
|
+
// src/interactives/hosts/font-relay.ts
|
|
3233
|
+
var FontRelay = class {
|
|
3234
|
+
constructor(port, source) {
|
|
3235
|
+
this.port = port;
|
|
3236
|
+
this.source = source;
|
|
3237
|
+
}
|
|
3238
|
+
handle(bytes) {
|
|
3239
|
+
if (bytes[0] !== MessageTag.font_request) return false;
|
|
3240
|
+
if (bytes.length < FONT_REQUEST_BYTES) return true;
|
|
3241
|
+
let request2 = readWord(bytes, FONT_ID_AT), codepoint = readWord(bytes, FONT_CODEPOINT_AT), source = this.source;
|
|
3242
|
+
return source === null ? (this.reply(request2, null), true) : (source(codepoint).then(
|
|
3243
|
+
(face) => this.reply(request2, face),
|
|
3244
|
+
() => this.reply(request2, null)
|
|
3245
|
+
), true);
|
|
3246
|
+
}
|
|
3247
|
+
reply(request2, face) {
|
|
3248
|
+
let length = face === null ? 0 : face.byteLength, at = this.port.reserve(FONT_REPLY_HEADER_BYTES + length), out = this.port.out;
|
|
3249
|
+
out[at] = MessageTag.font_reply, writeWord(out, at + FONT_ID_AT, request2), face !== null && out.set(face, at + FONT_REPLY_HEADER_BYTES), this.port.commitTask();
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
|
|
3253
|
+
// src/interactives/hosts/canvas.ts
|
|
3254
|
+
var CANVAS_SANDBOX = "allow-scripts", CONTENT_SANDBOX = "allow-scripts allow-same-origin", ANY_ORIGIN = "*", CANVAS_PERMISSIONS = "cross-origin-isolated; autoplay; gamepad; fullscreen; accelerometer; gyroscope", RELAY_SCRATCH_SLOTS = 64, ROOM_OPERATIONS = /* @__PURE__ */ new Set(["room.create", "room.join"]), SCRIPT_CLOSE = /<\/script/gi, SCRIPT_CLOSE_ESCAPED = "<\\/script", FRAME_STYLE = "position:relative;z-index:1;border:0;width:100%;height:100%;display:none;background:#000", FRAME_SHOWN = "block", FRAME_BACKDROP = "#000", FRAME_SEE_THROUGH = "transparent", NAVIGATED = "the canvas document navigated away from its package", LITTLE_ENDIAN = true, NO_PING = -1, BEAT_RECHECK_MS = 50, AUDIO_WARM_TIMEOUT_MS = 2e3, PING_SEQUENCE_OFFSET = 1, PONG_HEAP_OFFSET = 5;
|
|
3255
|
+
function sharedHeartbeat() {
|
|
3256
|
+
return typeof SharedArrayBuffer == "function" && globalThis.crossOriginIsolated === true ? new SharedArrayBuffer((16)) : null;
|
|
3257
|
+
}
|
|
3258
|
+
var NETWORK_DIALERS = (transport, url) => transport === Transport.WebTransport ? new WebTransportDialer(url) : new WebSocketDialer(url);
|
|
3259
|
+
function fallbackFonts(options) {
|
|
3260
|
+
if (options.fallback_fonts !== void 0) return options.fallback_fonts;
|
|
3261
|
+
let base = options.asset_cdn_base;
|
|
3262
|
+
return base == null ? null : notoFallbackSource(notoFallbackBase(base), (url) => fetch(url));
|
|
3263
|
+
}
|
|
3264
|
+
function base64(bytes) {
|
|
3265
|
+
return encodeBase64(bytes);
|
|
3266
|
+
}
|
|
3267
|
+
function canvasPolicy(scriptHash) {
|
|
3268
|
+
return [
|
|
3269
|
+
"default-src 'none'",
|
|
3270
|
+
`script-src 'sha256-${scriptHash}' blob: 'wasm-unsafe-eval'`,
|
|
3271
|
+
"worker-src blob:",
|
|
3272
|
+
"connect-src 'none'",
|
|
3273
|
+
"img-src blob: data:",
|
|
3274
|
+
"media-src blob:",
|
|
3275
|
+
"font-src blob: data:",
|
|
3276
|
+
"style-src 'unsafe-inline'",
|
|
3277
|
+
"base-uri 'none'",
|
|
3278
|
+
"form-action 'none'"
|
|
3279
|
+
].join("; ");
|
|
3280
|
+
}
|
|
3281
|
+
function canvasDocument(runtime) {
|
|
3282
|
+
let script = runtime.replace(SCRIPT_CLOSE, SCRIPT_CLOSE_ESCAPED), digest = new Uint8Array(SHA256_BYTES);
|
|
3283
|
+
return sha256Into(new TextEncoder().encode(script), digest), `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${canvasPolicy(base64(digest))}"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"><style>html,body{margin:0;width:100%;height:100%;overflow:hidden;background:transparent;touch-action:none;user-select:none}</style><script>${script}</script></head><body></body></html>`;
|
|
3284
|
+
}
|
|
3285
|
+
var RelayHandler = class {
|
|
3286
|
+
constructor(relay, id) {
|
|
3287
|
+
this.relay = relay;
|
|
3288
|
+
this.id = id;
|
|
3289
|
+
}
|
|
3290
|
+
frame(lane, bytes) {
|
|
3291
|
+
this.relay.inbound(this.id, lane, bytes);
|
|
3292
|
+
}
|
|
3293
|
+
closed() {
|
|
3294
|
+
this.relay.lost(this.id);
|
|
3295
|
+
}
|
|
3296
|
+
}, RoomRelay = class {
|
|
3297
|
+
constructor(port, dialers) {
|
|
3298
|
+
this.port = port;
|
|
3299
|
+
this.dialers = dialers;
|
|
3300
|
+
this.links = Array.from({ length: (64) }, () => ({ link: null, dialing: false }));
|
|
3301
|
+
this.handlers = Array.from({ length: (64) }, (_, i) => new RelayHandler(this, i));
|
|
3302
|
+
this.scratch = Array.from({ length: (64) }, () => new SizedViews(new Uint8Array(PACKET_BYTES)));
|
|
3303
|
+
this.allowed = /* @__PURE__ */ new Set();
|
|
3304
|
+
this.pending = /* @__PURE__ */ new Set();
|
|
3305
|
+
this.next = 0;
|
|
3306
|
+
}
|
|
3307
|
+
observeRequest(bytes) {
|
|
3308
|
+
let envelope = readJson(bytes);
|
|
3309
|
+
ROOM_OPERATIONS.has(envelope.call.operation) && this.pending.add(envelope.request_id);
|
|
3310
|
+
}
|
|
3311
|
+
observeResponse(bytes) {
|
|
3312
|
+
if (this.pending.size === 0) return;
|
|
3313
|
+
let envelope = readJson(bytes);
|
|
3314
|
+
if (!this.pending.delete(envelope.request_id) || envelope.outcome.status !== "ok") return;
|
|
3315
|
+
let endpoints = envelope.outcome.response.result.tick?.endpoints;
|
|
3316
|
+
endpoints?.web_transport && this.allowed.add(`${Transport.WebTransport} ${endpoints.web_transport}`), endpoints?.web_socket && this.allowed.add(`${Transport.WebSocket} ${endpoints.web_socket}`);
|
|
3317
|
+
}
|
|
3318
|
+
handle(bytes) {
|
|
3319
|
+
switch (bytes[0]) {
|
|
3320
|
+
case MessageTag.room_dial:
|
|
3321
|
+
return this.dial(bytes), true;
|
|
3322
|
+
case MessageTag.room_send:
|
|
3323
|
+
return this.outbound(bytes), true;
|
|
3324
|
+
case MessageTag.room_close:
|
|
3325
|
+
return this.close(linkOf(bytes)), true;
|
|
3326
|
+
}
|
|
3327
|
+
return false;
|
|
3328
|
+
}
|
|
3329
|
+
dial(bytes) {
|
|
3330
|
+
let id = linkOf(bytes), transport = transportOf(bytes[(3)]), urlBytes = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint16(4, (true)), url = new TextDecoder().decode(bytes.subarray((6), (6) + urlBytes)), request2 = bytes.slice((6) + urlBytes), entry = this.links[id], dialer = transport === null || entry === void 0 || entry.link !== null || entry.dialing || !this.allowed.has(`${transport} ${url}`) ? null : this.dialers(transport, url);
|
|
3331
|
+
if (dialer === null) {
|
|
3332
|
+
this.dialed(id, null);
|
|
3333
|
+
return;
|
|
3334
|
+
}
|
|
3335
|
+
entry.dialing = true, dialer.dial(request2, this.handlers[id]).then(
|
|
3336
|
+
(dialed) => this.settle(id, dialed),
|
|
3337
|
+
() => this.settle(id, null)
|
|
3338
|
+
);
|
|
3339
|
+
}
|
|
3340
|
+
settle(id, dialed) {
|
|
3341
|
+
let entry = this.links[id];
|
|
3342
|
+
if (!entry.dialing) {
|
|
3343
|
+
dialed?.link.close();
|
|
3344
|
+
return;
|
|
3345
|
+
}
|
|
3346
|
+
entry.dialing = false, entry.link = dialed?.link ?? null, this.dialed(id, dialed);
|
|
3347
|
+
}
|
|
3348
|
+
dialed(id, dialed) {
|
|
3349
|
+
let reply = dialed?.reply, length = reply === void 0 ? 0 : reply.length, at = this.port.reserve((3) + 1 + length), out = this.port.out;
|
|
3350
|
+
writeLinkHeader(out, at, MessageTag.room_dialed, id), out[at + (3)] = dialed === null ? 0 : (1), reply !== void 0 && out.set(reply, at + (3) + 1), this.port.commitTask();
|
|
3351
|
+
}
|
|
3352
|
+
outbound(bytes) {
|
|
3353
|
+
let link = this.links[linkOf(bytes)]?.link;
|
|
3354
|
+
if (link == null) return;
|
|
3355
|
+
let payload = bytes.subarray((4));
|
|
3356
|
+
if (payload.length > PACKET_BYTES) return;
|
|
3357
|
+
let slot = this.scratch[this.next];
|
|
3358
|
+
this.next = (this.next + 1) % (64), slot.buffer.set(payload), link.send(bytes[(3)], slot.of(payload.length));
|
|
3359
|
+
}
|
|
3360
|
+
inbound(id, lane, bytes) {
|
|
3361
|
+
this.links[id].link !== null && writeRoomFrame(this.port, MessageTag.room_frames, id, lane, bytes);
|
|
3362
|
+
}
|
|
3363
|
+
lost(id) {
|
|
3364
|
+
let entry = this.links[id];
|
|
3365
|
+
entry.link !== null && (entry.link = null, writeRoomSignal(this.port, MessageTag.room_closed, id));
|
|
3366
|
+
}
|
|
3367
|
+
close(id) {
|
|
3368
|
+
let entry = this.links[id];
|
|
3369
|
+
if (entry === void 0) return;
|
|
3370
|
+
entry.dialing = false;
|
|
3371
|
+
let link = entry.link;
|
|
3372
|
+
entry.link = null, link?.close();
|
|
3373
|
+
}
|
|
3374
|
+
closeAll() {
|
|
3375
|
+
for (let i = 0; i < (64); i++) this.close(i);
|
|
3376
|
+
}
|
|
3377
|
+
}, CanvasEngine = class {
|
|
3378
|
+
constructor(options, document2, placement) {
|
|
3379
|
+
this.target = ANY_ORIGIN;
|
|
3380
|
+
this.hosted = false;
|
|
3381
|
+
this.terminated = false;
|
|
3382
|
+
this.channel = new MessageChannel();
|
|
3383
|
+
this.listener = () => {
|
|
3384
|
+
};
|
|
3385
|
+
this.crashed = () => {
|
|
3386
|
+
};
|
|
3387
|
+
this.loads = 0;
|
|
3388
|
+
this.heartbeat = sharedHeartbeat();
|
|
3389
|
+
this.beats = this.heartbeat === null ? null : new Int32Array(this.heartbeat, 0, 1);
|
|
3390
|
+
this.heap = this.heartbeat === null ? null : new Float64Array(this.heartbeat, (8), 1);
|
|
3391
|
+
this.pong = new Uint8Array(PONG_BYTES);
|
|
3392
|
+
this.pongView = new DataView(this.pong.buffer);
|
|
3393
|
+
this.lastBeat = 0;
|
|
3394
|
+
this.beatsShared = false;
|
|
3395
|
+
this.pending = (-1);
|
|
3396
|
+
this.recheck = null;
|
|
3397
|
+
this.checkBeat = () => {
|
|
3398
|
+
this.recheck = null;
|
|
3399
|
+
let beats = this.beats;
|
|
3400
|
+
if (beats === null || this.pending === (-1)) return;
|
|
3401
|
+
let current = Atomics.load(beats, (0));
|
|
3402
|
+
if (current === this.lastBeat) {
|
|
3403
|
+
this.recheck = setTimeout(this.checkBeat, (50));
|
|
3404
|
+
return;
|
|
3405
|
+
}
|
|
3406
|
+
this.lastBeat = current, this.pong[0] = MessageTag.pong, this.pongView.setUint32((1), this.pending, (true)), this.pongView.setFloat64((5), this.heap[0], (true)), this.pending = (-1), this.listener(this.pong);
|
|
3407
|
+
};
|
|
3408
|
+
let frame = options.container.ownerDocument.createElement("iframe");
|
|
3409
|
+
frame.setAttribute("allow", CANVAS_PERMISSIONS), frame.setAttribute("referrerpolicy", "no-referrer"), frame.setAttribute("style", FRAME_STYLE), this.frame = frame, this.placed = placement !== null, this.bridge = new PortBridge(this.channel.port1, options.scheduler ?? animationFrameScheduler()), this.relay = new RoomRelay(this.bridge, options.dialers ?? NETWORK_DIALERS);
|
|
3410
|
+
let camera = options.camera ?? null;
|
|
3411
|
+
this.clips = new ClipRelay(this.bridge), this.camera = new FaceCameraRelay(
|
|
3412
|
+
this.bridge,
|
|
3413
|
+
camera === null ? null : {
|
|
3414
|
+
...camera,
|
|
3415
|
+
container: camera.container ?? options.container,
|
|
3416
|
+
on_live: (live) => {
|
|
3417
|
+
camera.on_live?.(live), this.clips.cameraLive(live);
|
|
3418
|
+
},
|
|
3419
|
+
surface: camera.surface ?? (() => ({ left: frame.offsetLeft, top: frame.offsetTop })),
|
|
3420
|
+
on_under: (under) => {
|
|
3421
|
+
frame.style.background = under ? FRAME_SEE_THROUGH : FRAME_BACKDROP, camera.on_under?.(under);
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
), this.fonts = new FontRelay(this.bridge, fallbackFonts(options)), this.bridge.on_message((bytes) => this.fromGuest(bytes));
|
|
3425
|
+
let boot = {
|
|
3426
|
+
engine: options.engine ?? "core",
|
|
3427
|
+
heartbeat: null,
|
|
3428
|
+
game_ui_accessibility: options.game_ui_accessibility ?? true,
|
|
3429
|
+
engine_session: options.engine_session ?? null
|
|
3430
|
+
};
|
|
3431
|
+
frame.addEventListener("load", () => {
|
|
3432
|
+
if (++this.loads > 1) {
|
|
3433
|
+
this.crashed(NAVIGATED);
|
|
3434
|
+
return;
|
|
3435
|
+
}
|
|
3436
|
+
let guest = frame.contentWindow;
|
|
3437
|
+
guest?.postMessage(boot, this.target, [this.channel.port2]), this.heartbeat !== null && guest?.postMessage({ heartbeat: this.heartbeat }, this.target);
|
|
3438
|
+
}), placement === null ? this.place(options.container, document2, null) : placement.reachable.then((hosted) => this.place(options.container, document2, hosted ? placement : null));
|
|
3439
|
+
}
|
|
3440
|
+
get fetches_wasm() {
|
|
3441
|
+
return this.hosted;
|
|
3442
|
+
}
|
|
3443
|
+
get may_fetch_wasm() {
|
|
3444
|
+
return this.placed;
|
|
3445
|
+
}
|
|
3446
|
+
place(container, document2, placement) {
|
|
3447
|
+
this.terminated || (placement === null ? (this.frame.setAttribute("sandbox", CANVAS_SANDBOX), this.frame.srcdoc = document2) : (this.frame.setAttribute("sandbox", CONTENT_SANDBOX), this.frame.src = placement.origin + placement.shell, this.target = placement.origin, this.hosted = true), container.appendChild(this.frame));
|
|
3448
|
+
}
|
|
3449
|
+
beating() {
|
|
3450
|
+
return this.beatsShared ? true : (this.beatsShared = this.beats !== null && Atomics.load(this.beats, (0)) !== 0, this.beatsShared);
|
|
3451
|
+
}
|
|
3452
|
+
fromGuest(bytes) {
|
|
3453
|
+
this.relay.handle(bytes) || this.camera.handle(bytes) || this.fonts.handle(bytes) || this.clips.handle(bytes) || (bytes[0] === MessageTag.request && (this.relay.observeRequest(bytes), this.camera.observeRequest(bytes)), this.listener(bytes));
|
|
3454
|
+
}
|
|
3455
|
+
send(bytes, length) {
|
|
3456
|
+
let tag = bytes[0];
|
|
3457
|
+
if (tag === MessageTag.ping && this.beating()) {
|
|
3458
|
+
this.pending = (bytes[1] | bytes[2] << 8 | bytes[3] << 16 | bytes[4] << 24) >>> 0, this.checkBeat();
|
|
3459
|
+
return;
|
|
3460
|
+
}
|
|
3461
|
+
if (tag === MessageTag.start && (this.frame.style.display = FRAME_SHOWN), tag === MessageTag.response) {
|
|
3462
|
+
let response = bytes.subarray(0, length);
|
|
3463
|
+
this.relay.observeResponse(response), this.camera.observeResponse(response);
|
|
3464
|
+
}
|
|
3465
|
+
tag === MessageTag.lifecycle && this.camera.observeLifecycle(bytes[1]), tag === MessageTag.frames ? this.bridge.sendFrame(bytes, length) : this.bridge.send(bytes, length);
|
|
3466
|
+
}
|
|
3467
|
+
on_message(listener) {
|
|
3468
|
+
this.listener = listener;
|
|
3469
|
+
}
|
|
3470
|
+
on_crash(listener) {
|
|
3471
|
+
this.crashed = listener;
|
|
3472
|
+
}
|
|
3473
|
+
terminate() {
|
|
3474
|
+
this.terminated = true, this.recheck !== null && clearTimeout(this.recheck), this.pending = (-1), this.relay.closeAll(), this.camera.shutdown(), this.clips.shutdown(), this.channel.port1.close(), this.frame.remove();
|
|
3475
|
+
}
|
|
3476
|
+
};
|
|
3477
|
+
function probeShell(origin, shell) {
|
|
3478
|
+
return typeof fetch != "function" ? Promise.resolve(false) : fetch(origin + shell, { method: "HEAD", mode: "cors", credentials: "omit", redirect: "error" }).then(
|
|
3479
|
+
(response) => response.ok,
|
|
3480
|
+
() => false
|
|
3481
|
+
);
|
|
3482
|
+
}
|
|
3483
|
+
var audioWarmed = false;
|
|
3484
|
+
function warmAudioOutput() {
|
|
3485
|
+
if (audioWarmed || typeof AudioContext != "function") return;
|
|
3486
|
+
audioWarmed = true;
|
|
3487
|
+
let warm = () => {
|
|
3488
|
+
try {
|
|
3489
|
+
new AudioContext().close();
|
|
3490
|
+
} catch {
|
|
3491
|
+
audioWarmed = false;
|
|
3492
|
+
}
|
|
3493
|
+
}, idle = globalThis.requestIdleCallback;
|
|
3494
|
+
typeof idle == "function" ? idle(warm, { timeout: (2e3) }) : setTimeout(warm, 0);
|
|
3495
|
+
}
|
|
3496
|
+
function iframeEngines(options) {
|
|
3497
|
+
warmAudioOutput();
|
|
3498
|
+
let document2 = canvasDocument(options.runtime), content = options.content ?? null, shell = content === null ? "" : shellPath(sha256Hex(new TextEncoder().encode(options.runtime))), reachable = null, placement = (interactive) => {
|
|
3499
|
+
if (content === null || interactive === void 0) return null;
|
|
3500
|
+
let origin = guestOrigin(content, interactive);
|
|
3501
|
+
return reachable ?? (reachable = probeShell(origin, shell)), { origin, shell, reachable };
|
|
3502
|
+
};
|
|
3503
|
+
return { spawn: (interactive) => new CanvasEngine(options, document2, placement(interactive)), isolates_interactives: content !== null };
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3506
|
+
// src/interactives/hosts/face-landmarker.ts
|
|
3507
|
+
var TASKS_VISION = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@1.0.1/", FACE_MODEL = "https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task", FACE_LANDMARKER = {
|
|
3508
|
+
runtime: "@mediapipe/tasks-vision",
|
|
3509
|
+
runtime_version: "1.0.1",
|
|
3510
|
+
model: "face_landmarker/float16/1",
|
|
3511
|
+
licence: "Apache-2.0",
|
|
3512
|
+
points: 478,
|
|
3513
|
+
parts: {
|
|
3514
|
+
bundle: {
|
|
3515
|
+
sha256: "d885630c297c0b20b1fe86096cb06291c4c8080876f27852e724f24ac603713f",
|
|
3516
|
+
bytes: 155439,
|
|
3517
|
+
type: "text/javascript",
|
|
3518
|
+
upstream: `${TASKS_VISION}vision_bundle.mjs`
|
|
3519
|
+
},
|
|
3520
|
+
loader: {
|
|
3521
|
+
sha256: "e170ee67dd4e16c1a6fcd8840a206687e5a59b22c20e4a902bc445b095454d73",
|
|
3522
|
+
bytes: 323377,
|
|
3523
|
+
type: "text/javascript",
|
|
3524
|
+
upstream: `${TASKS_VISION}wasm/vision_wasm_internal.js`
|
|
3525
|
+
},
|
|
3526
|
+
wasm: {
|
|
3527
|
+
sha256: "8da277a733926eacd0474b8704b36742d6ec3231c57a860c5b889dff8f1df886",
|
|
3528
|
+
bytes: 11756954,
|
|
3529
|
+
type: "application/wasm",
|
|
3530
|
+
upstream: `${TASKS_VISION}wasm/vision_wasm_internal.wasm`
|
|
3531
|
+
},
|
|
3532
|
+
model: {
|
|
3533
|
+
sha256: "64184e229b263107bc2b804c6625db1341ff2bb731874b0bcc2fe6544e0bc9ff",
|
|
3534
|
+
bytes: 3758596,
|
|
3535
|
+
type: "application/octet-stream",
|
|
3536
|
+
upstream: FACE_MODEL
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
}, DELEGATES = ["GPU", "CPU"], FACES = 1, STRIDE2 = 3;
|
|
3540
|
+
function defaultScope() {
|
|
3541
|
+
return {
|
|
3542
|
+
URL,
|
|
3543
|
+
Blob,
|
|
3544
|
+
import: (url) => import(
|
|
3545
|
+
/* @vite-ignore */
|
|
3546
|
+
url
|
|
3547
|
+
)
|
|
3548
|
+
};
|
|
3549
|
+
}
|
|
3550
|
+
function partSource(source, store) {
|
|
3551
|
+
return store === null ? async (digest) => (await fetchVerified(source, [digest]))[0] : (digest) => store.fetch(digest, source);
|
|
3552
|
+
}
|
|
3553
|
+
var UNMAPPED = -2, MAX_CATEGORIES = 64;
|
|
3554
|
+
function weighBlendshapes(categories, lookup, out) {
|
|
3555
|
+
if (categories === void 0 || categories.length === 0) return false;
|
|
3556
|
+
out.fill(0, 0, ARKIT_WEIGHTS);
|
|
3557
|
+
for (let i = 0; i < categories.length; i++) {
|
|
3558
|
+
let at;
|
|
3559
|
+
i < lookup.length ? (lookup[i] === (-2) && (lookup[i] = arkitIndex(categories[i].categoryName)), at = lookup[i]) : at = arkitIndex(categories[i].categoryName), at >= 0 && (out[at] = categories[i].score);
|
|
3560
|
+
}
|
|
3561
|
+
return true;
|
|
3562
|
+
}
|
|
3563
|
+
var MediaPipeRunner = class {
|
|
3564
|
+
constructor(landmarker) {
|
|
3565
|
+
this.landmarker = landmarker;
|
|
3566
|
+
this.last = Number.NEGATIVE_INFINITY;
|
|
3567
|
+
this.categories = void 0;
|
|
3568
|
+
this.lookup = new Int32Array((64)).fill((-2));
|
|
3569
|
+
}
|
|
3570
|
+
weigh(out) {
|
|
3571
|
+
return weighBlendshapes(this.categories, this.lookup, out);
|
|
3572
|
+
}
|
|
3573
|
+
detect(video, timestamp_ms, out) {
|
|
3574
|
+
let at = timestamp_ms > this.last ? timestamp_ms : this.last + 1;
|
|
3575
|
+
this.last = at;
|
|
3576
|
+
let result = this.landmarker.detectForVideo(video, at), faces = result.faceLandmarks;
|
|
3577
|
+
if (this.categories = result.faceBlendshapes?.[0]?.categories, faces.length === 0) return 0;
|
|
3578
|
+
let points = faces[0], count = Math.min(points.length, Math.floor(out.length / (3)));
|
|
3579
|
+
for (let i = 0; i < count; i++) {
|
|
3580
|
+
let point = points[i];
|
|
3581
|
+
out[i * (3)] = point.x, out[i * (3) + 1] = point.y, out[i * (3) + 2] = point.z;
|
|
3582
|
+
}
|
|
3583
|
+
return count;
|
|
3584
|
+
}
|
|
3585
|
+
close() {
|
|
3586
|
+
this.landmarker.close();
|
|
3587
|
+
}
|
|
3588
|
+
};
|
|
3589
|
+
async function createRunner(fetchPart, scope) {
|
|
3590
|
+
let parts = FACE_LANDMARKER.parts, [bundle, loader, wasm, model] = await Promise.all([parts.bundle, parts.loader, parts.wasm, parts.model].map((part) => fetchPart(part.sha256))), urls = [
|
|
3591
|
+
scope.URL.createObjectURL(new scope.Blob([bundle], { type: parts.bundle.type })),
|
|
3592
|
+
scope.URL.createObjectURL(new scope.Blob([loader], { type: parts.loader.type })),
|
|
3593
|
+
scope.URL.createObjectURL(new scope.Blob([wasm], { type: parts.wasm.type }))
|
|
3594
|
+
];
|
|
3595
|
+
try {
|
|
3596
|
+
let vision = await scope.import(urls[0]), failure = null;
|
|
3597
|
+
for (let delegate of DELEGATES)
|
|
3598
|
+
try {
|
|
3599
|
+
let landmarker = await vision.FaceLandmarker.createFromOptions(
|
|
3600
|
+
{ wasmLoaderPath: urls[1], wasmBinaryPath: urls[2] },
|
|
3601
|
+
{
|
|
3602
|
+
baseOptions: { modelAssetBuffer: model, delegate },
|
|
3603
|
+
runningMode: "VIDEO",
|
|
3604
|
+
numFaces: (1),
|
|
3605
|
+
outputFaceBlendshapes: !0,
|
|
3606
|
+
outputFacialTransformationMatrixes: !1
|
|
3607
|
+
}
|
|
3608
|
+
);
|
|
3609
|
+
return new MediaPipeRunner(landmarker);
|
|
3610
|
+
} catch (error) {
|
|
3611
|
+
failure = error;
|
|
3612
|
+
}
|
|
3613
|
+
throw failure;
|
|
3614
|
+
} finally {
|
|
3615
|
+
for (let url of urls) scope.URL.revokeObjectURL(url);
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
function mediaPipeFaceRunner(source, store = null, scope = defaultScope()) {
|
|
3619
|
+
let loading = null, fetchPart = partSource(source, store);
|
|
3620
|
+
return () => (loading ?? (loading = createRunner(fetchPart, scope).catch((error) => {
|
|
3621
|
+
throw loading = null, error;
|
|
3622
|
+
})), loading);
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
// src/interactives/content/edge.ts
|
|
3626
|
+
var MAX_WASM_TWIN_BYTES = 16 * 1024 * 1024;
|
|
3627
|
+
var BROTLI_CODING = "br", ACCEPT_SEPARATOR = ",", PARAMETER_SEPARATOR = ";", QUALITY_PREFIX = "q=", NO_QUALITY = 0;
|
|
3628
|
+
function acceptsBrotli(accept) {
|
|
3629
|
+
return accept === null ? false : accept.split(ACCEPT_SEPARATOR).some((entry) => {
|
|
3630
|
+
let [coding, ...parameters] = entry.split(PARAMETER_SEPARATOR).map((part) => part.trim().toLowerCase());
|
|
3631
|
+
if (coding !== BROTLI_CODING) return false;
|
|
3632
|
+
let quality = parameters.find((parameter) => parameter.startsWith(QUALITY_PREFIX));
|
|
3633
|
+
return quality === void 0 || Number(quality.slice(QUALITY_PREFIX.length)) > (0);
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
var CHUNK_MAGIC = 1262701891, CHUNK_FORMAT_VERSION = 1, CHUNK_HEADER_BYTES = 64, CHUNK_KIND_WASM = 6, CHUNK_KIND_DATA = 5, OFFSET_MAGIC = 0, OFFSET_VERSION = 4, OFFSET_KIND = 6, OFFSET_LENGTH = 8, OFFSET_PAYLOAD = 16, TWO_32 = 2 ** 32, STATUS_OK = 200, STATUS_NOT_FOUND = 404, STATUS_NOT_ALLOWED = 405, STATUS_BAD_GATEWAY = 502, IMMUTABLE = "public, max-age=31536000, immutable", NO_STORE = "no-store", SHELL_STYLE = "html,body{margin:0;width:100%;height:100%;overflow:hidden;background:transparent;touch-action:none;user-select:none}", VIEWPORT = "width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover", READ_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]), ISOLATION_HEADERS = {
|
|
3637
|
+
"cross-origin-opener-policy": "same-origin",
|
|
3638
|
+
"cross-origin-embedder-policy": "require-corp",
|
|
3639
|
+
"cross-origin-resource-policy": "cross-origin",
|
|
3640
|
+
"origin-agent-cluster": "?1",
|
|
3641
|
+
"x-content-type-options": "nosniff",
|
|
3642
|
+
"referrer-policy": "no-referrer",
|
|
3643
|
+
"access-control-allow-origin": "*"
|
|
3644
|
+
}, SHA256 = "SHA-256", HEX_RADIX = 16, HEX_PAIR = 2;
|
|
3645
|
+
async function digestHex(bytes) {
|
|
3646
|
+
let subtle = globalThis.crypto?.subtle;
|
|
3647
|
+
if (subtle === void 0) return sha256Hex(bytes);
|
|
3648
|
+
let digest = new Uint8Array(await subtle.digest(SHA256, bytes)), out = "";
|
|
3649
|
+
for (let i = 0; i < digest.length; i++) out += digest[i].toString((16)).padStart((2), "0");
|
|
3650
|
+
return out;
|
|
3651
|
+
}
|
|
3652
|
+
function shellPolicy(runtimeDigest, policy) {
|
|
3653
|
+
let script = sri(runtimeDigest), ancestors = policy.frame_ancestors.length === 0 ? "'none'" : policy.frame_ancestors.join(" ");
|
|
3654
|
+
return [
|
|
3655
|
+
"default-src 'none'",
|
|
3656
|
+
`script-src '${script}' blob: 'wasm-unsafe-eval'`,
|
|
3657
|
+
"worker-src blob:",
|
|
3658
|
+
"connect-src 'self'",
|
|
3659
|
+
"img-src blob: data:",
|
|
3660
|
+
"media-src blob:",
|
|
3661
|
+
"font-src blob: data:",
|
|
3662
|
+
"style-src 'unsafe-inline'",
|
|
3663
|
+
"base-uri 'none'",
|
|
3664
|
+
"form-action 'none'",
|
|
3665
|
+
`frame-ancestors ${ancestors}`
|
|
3666
|
+
].join("; ");
|
|
3667
|
+
}
|
|
3668
|
+
function shellDocument(runtimeDigest) {
|
|
3669
|
+
let integrity = sri(runtimeDigest);
|
|
3670
|
+
return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="${VIEWPORT}"><style>${SHELL_STYLE}</style><script src="${runtimePath(runtimeDigest)}" integrity="${integrity}"></script></head><body></body></html>`;
|
|
3671
|
+
}
|
|
3672
|
+
function respond(status, body, headers, head) {
|
|
3673
|
+
return new Response(head ? null : body, { status, headers: { ...ISOLATION_HEADERS, ...headers } });
|
|
3674
|
+
}
|
|
3675
|
+
var VARY_ENCODING = "Accept-Encoding";
|
|
3676
|
+
function brotliWasm(twin) {
|
|
3677
|
+
let init = {
|
|
3678
|
+
status: (200),
|
|
3679
|
+
headers: {
|
|
3680
|
+
...ISOLATION_HEADERS,
|
|
3681
|
+
"content-type": "application/wasm",
|
|
3682
|
+
"content-encoding": BROTLI_CODING,
|
|
3683
|
+
vary: VARY_ENCODING,
|
|
3684
|
+
"cache-control": IMMUTABLE
|
|
3685
|
+
},
|
|
3686
|
+
encodeBody: "manual"
|
|
3687
|
+
};
|
|
3688
|
+
return new Response(twin, init);
|
|
3689
|
+
}
|
|
3690
|
+
function missing(head) {
|
|
3691
|
+
return respond((404), "not found", { "content-type": "text/plain; charset=utf-8", "cache-control": NO_STORE }, head);
|
|
3692
|
+
}
|
|
3693
|
+
function wasmPayload(chunk, kind = (6)) {
|
|
3694
|
+
if (chunk.length < (64)) return null;
|
|
3695
|
+
let view = new DataView(chunk.buffer, chunk.byteOffset, (64));
|
|
3696
|
+
if (view.getUint32((0), true) !== (1262701891) || view.getUint16((4), true) !== (1) || view.getUint8((6)) !== kind) return null;
|
|
3697
|
+
let length = view.getUint32((8) + 4, true) * TWO_32 + view.getUint32((8), true), offset = view.getUint32((16), true);
|
|
3698
|
+
return offset < (64) || length > chunk.length - offset ? null : chunk.subarray(offset, offset + length);
|
|
3699
|
+
}
|
|
3700
|
+
function digestBetween(path, prefix, suffix) {
|
|
3701
|
+
if (!path.startsWith(prefix) || !path.endsWith(suffix)) return null;
|
|
3702
|
+
let digest = path.slice(prefix.length, path.length - suffix.length);
|
|
3703
|
+
return isDigestHex(digest) ? digest : null;
|
|
3704
|
+
}
|
|
3705
|
+
function joinedParts(url) {
|
|
3706
|
+
let listed = url.searchParams.get(JOINED_PARTS_PARAM);
|
|
3707
|
+
if (listed === null || [...url.searchParams.keys()].length !== 1) return null;
|
|
3708
|
+
let parts = listed.split(JOINED_PART_SEPARATOR);
|
|
3709
|
+
return parts.length < 2 || parts.length > MAX_JOINED_PARTS || !parts.every(isDigestHex) ? null : parts;
|
|
3710
|
+
}
|
|
3711
|
+
async function joinedWasm(digest, parts, store) {
|
|
3712
|
+
let chunks = await Promise.all(parts.map((part) => store.chunk(part))), payloads = [], total = 0;
|
|
3713
|
+
for (let i = 0; i < parts.length; i++) {
|
|
3714
|
+
let chunk = chunks[i];
|
|
3715
|
+
if (chunk === null) return "missing";
|
|
3716
|
+
if (await digestHex(chunk) !== parts[i]) return "mismatch";
|
|
3717
|
+
let payload = wasmPayload(chunk, (5));
|
|
3718
|
+
if (payload === null) return "missing";
|
|
3719
|
+
payloads.push(payload), total += payload.length;
|
|
3720
|
+
}
|
|
3721
|
+
let joined = new Uint8Array(total), at = 0;
|
|
3722
|
+
for (let payload of payloads)
|
|
3723
|
+
joined.set(payload, at), at += payload.length;
|
|
3724
|
+
return await digestHex(joined) === digest ? joined : "mismatch";
|
|
3725
|
+
}
|
|
3726
|
+
async function serveContent(request2, store, policy) {
|
|
3727
|
+
if (!READ_METHODS.has(request2.method))
|
|
3728
|
+
return respond((405), "method not allowed", { allow: "GET, HEAD", "cache-control": NO_STORE }, false);
|
|
3729
|
+
let head = request2.method === "HEAD", url = new URL(request2.url), path = url.pathname, joinedDigest = digestBetween(path, JOINED_PREFIX, WASM_SUFFIX);
|
|
3730
|
+
if (joinedDigest !== null) {
|
|
3731
|
+
let parts = joinedParts(url);
|
|
3732
|
+
if (parts === null) return missing(head);
|
|
3733
|
+
let joined = await joinedWasm(joinedDigest, parts, store);
|
|
3734
|
+
return joined === "missing" ? missing(head) : joined === "mismatch" ? respond((502), "joined digest mismatch", { "cache-control": NO_STORE }, head) : respond((200), joined, { "content-type": "application/wasm", "cache-control": IMMUTABLE }, head);
|
|
3735
|
+
}
|
|
3736
|
+
let shell = digestBetween(path, SHELL_PREFIX, "");
|
|
3737
|
+
if (shell !== null) {
|
|
3738
|
+
let runtime = await store.runtime(shell);
|
|
3739
|
+
return runtime === null || await digestHex(runtime) !== shell ? missing(head) : respond(
|
|
3740
|
+
(200),
|
|
3741
|
+
shellDocument(shell),
|
|
3742
|
+
{ "content-type": "text/html; charset=utf-8", "cache-control": IMMUTABLE, "content-security-policy": shellPolicy(shell, policy) },
|
|
3743
|
+
head
|
|
3744
|
+
);
|
|
3745
|
+
}
|
|
3746
|
+
let script = digestBetween(path, RUNTIME_PREFIX, RUNTIME_SUFFIX);
|
|
3747
|
+
if (script !== null) {
|
|
3748
|
+
let runtime = await store.runtime(script);
|
|
3749
|
+
return runtime === null ? missing(head) : await digestHex(runtime) !== script ? respond((502), "runtime digest mismatch", { "cache-control": NO_STORE }, head) : respond((200), runtime, { "content-type": "text/javascript; charset=utf-8", "cache-control": IMMUTABLE }, head);
|
|
3750
|
+
}
|
|
3751
|
+
let wasm = digestBetween(path, WASM_PREFIX, WASM_SUFFIX);
|
|
3752
|
+
if (wasm !== null) {
|
|
3753
|
+
if (!head && store.wasmTwin !== void 0 && acceptsBrotli(request2.headers.get("accept-encoding"))) {
|
|
3754
|
+
let twin = await store.wasmTwin(wasm);
|
|
3755
|
+
if (twin !== null && twin.length > 0 && twin.length <= MAX_WASM_TWIN_BYTES) return brotliWasm(twin);
|
|
3756
|
+
}
|
|
3757
|
+
let chunk = await store.chunk(wasm);
|
|
3758
|
+
if (chunk === null) return missing(head);
|
|
3759
|
+
if (await digestHex(chunk) !== wasm) return respond((502), "chunk digest mismatch", { "cache-control": NO_STORE }, head);
|
|
3760
|
+
let payload = wasmPayload(chunk);
|
|
3761
|
+
return payload === null ? missing(head) : respond((200), payload, { "content-type": "application/wasm", "cache-control": IMMUTABLE, vary: VARY_ENCODING }, head);
|
|
3762
|
+
}
|
|
3763
|
+
return missing(head);
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
// src/interactives/hosts/spindrift.ts
|
|
3767
|
+
var REPAIR_SYMBOL_BYTES = 1024, DECODE_SLACK = 2, NOMINAL_RTT_MS = 300, NOMINAL_BYTES_PER_SECOND = 125e3, NOMINAL_CONCURRENCY = 4, RUN_LIMIT_BYTES = 256 * 1024, MS_PER_SECOND = 1e3, PARTIAL_CONTENT = 206, SECURE_PROTOCOL2 = "https:", DECODED = 0, INSUFFICIENT = 1;
|
|
3768
|
+
function partSymbols(bytes) {
|
|
3769
|
+
return Math.max(1, Math.ceil(bytes / (1024)));
|
|
3770
|
+
}
|
|
3771
|
+
function nominalCostMs(requests, bytes) {
|
|
3772
|
+
return Math.ceil(requests / (4)) * (300) + bytes * (1e3) / (125e3);
|
|
3773
|
+
}
|
|
3774
|
+
async function repairDecoder(wasm) {
|
|
3775
|
+
let module = wasm instanceof WebAssembly.Module ? wasm : await WebAssembly.compile(wasm), exports = (await WebAssembly.instantiate(module, {})).exports;
|
|
3776
|
+
return {
|
|
3777
|
+
decode(block, known, repair) {
|
|
3778
|
+
let symbols = known.length;
|
|
3779
|
+
if (symbols === 0 || block.length !== symbols * (1024) || repair.length % (1024) !== 0) return "shape";
|
|
3780
|
+
let blockAt = exports.cimplify_spindrift_alloc(block.length), knownAt = exports.cimplify_spindrift_alloc(known.length), repairAt = exports.cimplify_spindrift_alloc(repair.length);
|
|
3781
|
+
try {
|
|
3782
|
+
if (blockAt === 0 || knownAt === 0 || repairAt === 0) return "shape";
|
|
3783
|
+
let memory = new Uint8Array(exports.memory.buffer);
|
|
3784
|
+
memory.set(block, blockAt), memory.set(known, knownAt), memory.set(repair, repairAt);
|
|
3785
|
+
let code = exports.cimplify_spindrift_decode(blockAt, symbols, knownAt, repairAt, repair.length / (1024));
|
|
3786
|
+
return code === (0) && block.set(new Uint8Array(exports.memory.buffer, blockAt, block.length)), code === (0) ? "decoded" : code === (1) ? "insufficient" : "shape";
|
|
3787
|
+
} finally {
|
|
3788
|
+
exports.cimplify_spindrift_free(blockAt, block.length), exports.cimplify_spindrift_free(knownAt, known.length), exports.cimplify_spindrift_free(repairAt, repair.length);
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
function cdnRepairs(base, fetcher = fetch) {
|
|
3794
|
+
if (new URL(base).protocol !== SECURE_PROTOCOL2) throw new Error(`repair files come only from the CDN over TLS, not ${base}`);
|
|
3795
|
+
return {
|
|
3796
|
+
async fetchRepair(digest, symbols, signal) {
|
|
3797
|
+
let bytes = symbols * (1024), response = await fetcher(new URL(digest, base).href, { signal, headers: { Range: `bytes=0-${bytes - 1}` } });
|
|
3798
|
+
if (!response.ok) throw new Error(`repair file ${digest} answered ${response.status}`);
|
|
3799
|
+
let body = new Uint8Array(await response.arrayBuffer());
|
|
3800
|
+
if (body.length < bytes) throw new Error(`repair file ${digest} answered ${body.length} bytes for ${bytes}`);
|
|
3801
|
+
return response.status === (206) && body.length === bytes ? body : body.slice(0, bytes);
|
|
3802
|
+
}
|
|
3803
|
+
};
|
|
3804
|
+
}
|
|
3805
|
+
function runsOf(members, missing2) {
|
|
3806
|
+
let runs = 0, bytes = 0, last = -2;
|
|
3807
|
+
for (let index of missing2) {
|
|
3808
|
+
let size = members[index].size;
|
|
3809
|
+
(index !== last + 1 || bytes + size > RUN_LIMIT_BYTES) && (runs++, bytes = 0), bytes += size, last = index;
|
|
3810
|
+
}
|
|
3811
|
+
return runs;
|
|
3812
|
+
}
|
|
3813
|
+
function planZone(members, held, files) {
|
|
3814
|
+
let plans = [], covered = Array.from({ length: members.length }, () => false);
|
|
3815
|
+
for (let file of files) {
|
|
3816
|
+
let end = file.first + file.parts;
|
|
3817
|
+
if (file.first < 0 || end > members.length || members.slice(file.first, end).reduce((sum, member) => sum + partSymbols(member.size), 0) !== file.symbols) continue;
|
|
3818
|
+
let missing2 = [], missingSymbols = 0, missingBytes = 0;
|
|
3819
|
+
for (let index = file.first; index < end; index++)
|
|
3820
|
+
covered[index] = true, !held[index] && (missing2.push(index), missingSymbols += partSymbols(members[index].size), missingBytes += members[index].size);
|
|
3821
|
+
if (missing2.length === 0) continue;
|
|
3822
|
+
let ask = missingSymbols + (2), runs = runsOf(members, missing2), repairs = ask <= file.repair && nominalCostMs(1, ask * (1024)) < nominalCostMs(runs, missingBytes);
|
|
3823
|
+
plans.push(repairs ? { kind: "repair", file, missing: missing2, ask } : { kind: "runs", missing: missing2, runs });
|
|
3824
|
+
}
|
|
3825
|
+
let rest = [];
|
|
3826
|
+
for (let index = 0; index < members.length; index++) !covered[index] && !held[index] && rest.push(index);
|
|
3827
|
+
return rest.length > 0 && plans.push({ kind: "runs", missing: rest, runs: runsOf(members, rest) }), plans;
|
|
3828
|
+
}
|
|
3829
|
+
async function decodeBlock(store, members, plan, repair, decoder7) {
|
|
3830
|
+
let { file } = plan, block = new Uint8Array(file.symbols * (1024)), known = new Uint8Array(file.symbols), offsets = [], missing2 = new Set(plan.missing), symbol = 0;
|
|
3831
|
+
for (let index = file.first; index < file.first + file.parts; index++) {
|
|
3832
|
+
offsets.push(symbol);
|
|
3833
|
+
let span = partSymbols(members[index].size);
|
|
3834
|
+
if (!missing2.has(index)) {
|
|
3835
|
+
let body = await store.read(members[index].digest);
|
|
3836
|
+
if (body === null || body.length !== members[index].size) return plan.missing.slice();
|
|
3837
|
+
block.set(body, symbol * (1024)), known.fill(1, symbol, symbol + span);
|
|
3838
|
+
}
|
|
3839
|
+
symbol += span;
|
|
3840
|
+
}
|
|
3841
|
+
if (decoder7.decode(block, known, repair) !== "decoded") return plan.missing.slice();
|
|
3842
|
+
let failed = [];
|
|
3843
|
+
for (let index of plan.missing) {
|
|
3844
|
+
let start = offsets[index - file.first] * (1024), body = block.slice(start, start + members[index].size);
|
|
3845
|
+
await verifyChunk(members[index].digest, body) ? await store.admit(members[index].digest, body) : failed.push(index);
|
|
3846
|
+
}
|
|
3847
|
+
return failed;
|
|
3848
|
+
}
|
|
3849
|
+
async function completeZone(store, members, files, upstream, repairs, decoder7, signal) {
|
|
3850
|
+
let held = members.map((member) => store.has(member.digest)), repaired = 0, fetched = 0, requests = 0, repairBytes = 0, plain = [];
|
|
3851
|
+
for (let plan of planZone(members, held, files)) {
|
|
3852
|
+
if (plan.kind === "runs") {
|
|
3853
|
+
plain.push(...plan.missing), requests += plan.runs;
|
|
3854
|
+
continue;
|
|
3855
|
+
}
|
|
3856
|
+
requests++;
|
|
3857
|
+
let repair = await repairs.fetchRepair(plan.file.digest, plan.ask, signal).catch(() => null), failed = repair === null ? plan.missing.slice() : await decodeBlock(store, members, plan, repair, decoder7);
|
|
3858
|
+
repair !== null && (repairBytes += repair.length), repaired += plan.missing.length - failed.length, failed.length > 0 && (plain.push(...failed), requests += runsOf(members, failed));
|
|
3859
|
+
}
|
|
3860
|
+
return plain.length > 0 && (plain.sort((a, b) => a - b), fetched = (await store.fetchRun(
|
|
3861
|
+
plain.map((index) => members[index].digest),
|
|
3862
|
+
upstream,
|
|
3863
|
+
signal
|
|
3864
|
+
)).filter((body) => body !== null).length), { repaired, fetched, requests, repair_bytes: repairBytes };
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
// src/interactives/hosts/shoal.ts
|
|
3868
|
+
var SHOAL_MAX_MESSAGE_BYTES = 65536, ID_BYTES = 32, POINTER_BYTES = 4, HOLDINGS_OPEN_BYTES = 6 * (4), OPEN_BYTES = 3 * (4), PART_BYTES = (32) + 4, EVENT_BYTES = 16, SCRATCH_BYTES = 32, OK = 0, EVENT_KINDS = ["reconciled", "unreconciled", "admitted", "rejected", "missing", "closed"], CLOSE_REASONS = ["mismatch", "hostile", "peer", "finished"], HIGH_WATER_BYTES = 1 << 20, LOW_WATER_BYTES = 256 * 1024, ShoalHoldings = class {
|
|
3869
|
+
constructor(exports, handle) {
|
|
3870
|
+
this.sessions = 0;
|
|
3871
|
+
this.exports = exports, this.handle = handle;
|
|
3872
|
+
}
|
|
3873
|
+
setHeld(zone, index, held) {
|
|
3874
|
+
this.handle !== 0 && this.exports.cimplify_shoal_holdings_set_held(this.handle, zone, index, held ? 1 : 0);
|
|
3875
|
+
}
|
|
3876
|
+
/** A session over these holdings, asking for `order`'s zones in turn. Free it before the holdings. */
|
|
3877
|
+
session(order) {
|
|
3878
|
+
if (this.handle === 0) throw new Error("these holdings were freed");
|
|
3879
|
+
let bytes = OPEN_BYTES + order.length * 4, base = this.exports.cimplify_spindrift_alloc(bytes);
|
|
3880
|
+
if (base === 0) throw new Error("the delivery module could not allocate a session");
|
|
3881
|
+
try {
|
|
3882
|
+
let view = new DataView(this.exports.memory.buffer), at = base + OPEN_BYTES;
|
|
3883
|
+
order.forEach((zone, k) => view.setUint32(at + k * 4, zone, !0)), [this.handle, at, order.length].forEach((value, k) => view.setUint32(base + k * (4), value, !0));
|
|
3884
|
+
let session = this.exports.cimplify_shoal_open(base);
|
|
3885
|
+
if (session === 0) throw new Error("the delivery module refused the session");
|
|
3886
|
+
return this.sessions++, new ShoalSession(this.exports, session, this, () => this.sessions--);
|
|
3887
|
+
} finally {
|
|
3888
|
+
this.exports.cimplify_spindrift_free(base, bytes);
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3891
|
+
/** Frees the holdings; every session over them must be freed first. */
|
|
3892
|
+
free() {
|
|
3893
|
+
if (this.handle !== 0) {
|
|
3894
|
+
if (this.sessions > 0) throw new Error("free every session over these holdings first");
|
|
3895
|
+
this.exports.cimplify_shoal_holdings_free(this.handle), this.handle = 0;
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
}, ShoalSession = class {
|
|
3899
|
+
constructor(exports, session, holdings, released) {
|
|
3900
|
+
this.staging = 0;
|
|
3901
|
+
this.stagingBytes = 0;
|
|
3902
|
+
if (this.exports = exports, this.holdings = holdings, this.released = released, this.session = session, this.message = exports.cimplify_spindrift_alloc((65536)), this.scratch = exports.cimplify_spindrift_alloc((32)), this.message === 0 || this.scratch === 0) throw new Error("the delivery module could not allocate a session's buffers");
|
|
3903
|
+
}
|
|
3904
|
+
get bytes() {
|
|
3905
|
+
return new Uint8Array(this.exports.memory.buffer);
|
|
3906
|
+
}
|
|
3907
|
+
get view() {
|
|
3908
|
+
return new DataView(this.exports.memory.buffer);
|
|
3909
|
+
}
|
|
3910
|
+
/** Hands the session one received message and returns the events it raised. */
|
|
3911
|
+
receive(message) {
|
|
3912
|
+
return this.session === 0 ? [] : (message.length > (65536) ? (this.bytes.fill(0, this.message, this.message + 1), this.exports.cimplify_shoal_receive(this.session, this.message, 1)) : (this.bytes.set(message, this.message), this.exports.cimplify_shoal_receive(this.session, this.message, message.length)), this.events());
|
|
3913
|
+
}
|
|
3914
|
+
/** The next message to send, or null when there is nothing to send now. */
|
|
3915
|
+
transmit() {
|
|
3916
|
+
if (this.session === 0) return null;
|
|
3917
|
+
let length = this.exports.cimplify_shoal_transmit(this.session, this.message, (65536));
|
|
3918
|
+
return length === 0 ? null : this.bytes.slice(this.message, this.message + length);
|
|
3919
|
+
}
|
|
3920
|
+
events() {
|
|
3921
|
+
let out = [];
|
|
3922
|
+
for (; this.session !== 0 && this.exports.cimplify_shoal_event(this.session, this.scratch) === 1; ) {
|
|
3923
|
+
let view = this.view, kind = EVENT_KINDS[view.getUint32(this.scratch, true) - 1], zone = view.getUint32(this.scratch + 4, true), index = view.getUint32(this.scratch + 8, true), value = view.getUint32(this.scratch + 12, true);
|
|
3924
|
+
kind === "reconciled" ? out.push({ kind, zone, wanted: value }) : kind === "unreconciled" ? out.push({ kind, zone }) : kind === "admitted" ? out.push({ kind, zone, index, body: this.admitted() }) : kind === "rejected" || kind === "missing" ? out.push({ kind, zone, index }) : kind === "closed" && out.push({ kind, reason: CLOSE_REASONS[value - 1] ?? "hostile" });
|
|
3925
|
+
}
|
|
3926
|
+
return out;
|
|
3927
|
+
}
|
|
3928
|
+
admitted() {
|
|
3929
|
+
let length = this.exports.cimplify_shoal_admitted(this.session, this.scratch + (16)), at = this.view.getUint32(this.scratch + (16), true);
|
|
3930
|
+
return this.bytes.slice(at, at + length);
|
|
3931
|
+
}
|
|
3932
|
+
/** The held part the peer asked for whose bytes the session is waiting on. */
|
|
3933
|
+
need() {
|
|
3934
|
+
return this.session === 0 || this.exports.cimplify_shoal_need(this.session, this.scratch, this.scratch + 4) !== 1 ? null : { zone: this.view.getUint32(this.scratch, true), index: this.view.getUint32(this.scratch + 4, true) };
|
|
3935
|
+
}
|
|
3936
|
+
provide(zone, index, body) {
|
|
3937
|
+
return this.session === 0 || this.stagingBytes < body.length && (this.staging !== 0 && this.exports.cimplify_spindrift_free(this.staging, this.stagingBytes), this.staging = this.exports.cimplify_spindrift_alloc(body.length), this.stagingBytes = this.staging === 0 ? 0 : body.length, this.staging === 0) ? false : (this.bytes.set(body, this.staging), this.exports.cimplify_shoal_provide(this.session, zone, index, this.staging, body.length) === (0));
|
|
3938
|
+
}
|
|
3939
|
+
/** Marks a part held or not in the holdings this session borrows. */
|
|
3940
|
+
setHeld(zone, index, held) {
|
|
3941
|
+
this.holdings.setHeld(zone, index, held);
|
|
3942
|
+
}
|
|
3943
|
+
closed() {
|
|
3944
|
+
if (this.session === 0) return "peer";
|
|
3945
|
+
let code = this.exports.cimplify_shoal_closed(this.session);
|
|
3946
|
+
return code === 0 ? null : CLOSE_REASONS[code - 1] ?? "hostile";
|
|
3947
|
+
}
|
|
3948
|
+
free() {
|
|
3949
|
+
this.session !== 0 && (this.exports.cimplify_shoal_free(this.session), this.exports.cimplify_spindrift_free(this.message, (65536)), this.exports.cimplify_spindrift_free(this.scratch, (32)), this.staging !== 0 && this.exports.cimplify_spindrift_free(this.staging, this.stagingBytes), this.session = 0, this.released());
|
|
3950
|
+
}
|
|
3951
|
+
};
|
|
3952
|
+
function idBytes(text2, what) {
|
|
3953
|
+
let out = new Uint8Array((32));
|
|
3954
|
+
if (!unhex(text2, out)) throw new Error(`${what} must be ${(32)} bytes of hex`);
|
|
3955
|
+
return out;
|
|
3956
|
+
}
|
|
3957
|
+
var PEER_SHARING_FEATURE = "peer_sharing";
|
|
3958
|
+
function peerSharingEnabled(features) {
|
|
3959
|
+
return features.includes(PEER_SHARING_FEATURE);
|
|
3960
|
+
}
|
|
3961
|
+
async function openPeerSharing(features, load) {
|
|
3962
|
+
return peerSharingEnabled(features) ? shoalModule(await load()) : null;
|
|
3963
|
+
}
|
|
3964
|
+
async function shoalModule(wasm) {
|
|
3965
|
+
let module = wasm instanceof WebAssembly.Module ? wasm : await WebAssembly.compile(wasm), exports = (await WebAssembly.instantiate(module, {})).exports;
|
|
3966
|
+
return {
|
|
3967
|
+
holdings(options) {
|
|
3968
|
+
let game = idBytes(options.game, "the game id"), root = idBytes(options.root, "the manifest root"), parts = options.zones.flat(), ids = 2 * (32), countBytes = options.zones.length * 4, partBytes = parts.length * PART_BYTES, total = HOLDINGS_OPEN_BYTES + ids + countBytes + partBytes + parts.length, base = exports.cimplify_spindrift_alloc(total);
|
|
3969
|
+
if (base === 0) throw new Error("the delivery module could not allocate the holdings");
|
|
3970
|
+
try {
|
|
3971
|
+
let memory = new Uint8Array(exports.memory.buffer), view = new DataView(exports.memory.buffer), at = { ids: base + HOLDINGS_OPEN_BYTES, counts: base + HOLDINGS_OPEN_BYTES + ids, parts: 0, held: 0 };
|
|
3972
|
+
at.parts = at.counts + countBytes, at.held = at.parts + partBytes, memory.set(game, at.ids), memory.set(root, at.ids + (32)), options.zones.forEach((zone, k) => view.setUint32(at.counts + k * 4, zone.length, !0)), parts.forEach((part, k) => {
|
|
3973
|
+
let digest = memory.subarray(at.parts + k * PART_BYTES, at.parts + k * PART_BYTES + (32));
|
|
3974
|
+
if (!unhex(part.digest, digest)) throw new Error(`part digest ${part.digest} is not ${(32)} bytes of hex`);
|
|
3975
|
+
view.setUint32(at.parts + k * PART_BYTES + (32), part.size, !0), memory[at.held + k] = options.holds(part.digest) ? 1 : 0;
|
|
3976
|
+
}), [at.ids, at.ids + (32), options.zones.length, at.counts, at.parts, at.held].forEach((value, k) => view.setUint32(base + k * (4), value, !0));
|
|
3977
|
+
let handle = exports.cimplify_shoal_holdings_open(base);
|
|
3978
|
+
if (handle === 0) throw new Error("the delivery module refused the manifest");
|
|
3979
|
+
return new ShoalHoldings(exports, handle);
|
|
3980
|
+
} finally {
|
|
3981
|
+
exports.cimplify_spindrift_free(base, total);
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
};
|
|
3985
|
+
}
|
|
3986
|
+
function runOverChannel(session, channel, store, zones) {
|
|
3987
|
+
let admitted = 0, rejected = 0, reconciled = [], unreconciled = [], staging = false, settled = false;
|
|
3988
|
+
return new Promise((resolve) => {
|
|
3989
|
+
let finish = (reason) => {
|
|
3990
|
+
settled || (settled = true, session.free(), channel.close(), resolve({ reason, admitted, rejected, reconciled, unreconciled }));
|
|
3991
|
+
}, handle = (events) => {
|
|
3992
|
+
for (let event of events)
|
|
3993
|
+
if (event.kind === "admitted") {
|
|
3994
|
+
admitted++;
|
|
3995
|
+
let digest = zones[event.zone]?.[event.index]?.digest;
|
|
3996
|
+
digest !== void 0 && store.admit(digest, event.body);
|
|
3997
|
+
} else event.kind === "rejected" ? rejected++ : event.kind === "reconciled" ? reconciled.push(event.zone) : event.kind === "unreconciled" && unreconciled.push(event.zone);
|
|
3998
|
+
}, pump = () => {
|
|
3999
|
+
for (; !settled && channel.readyState === "open" && channel.bufferedAmount < HIGH_WATER_BYTES; ) {
|
|
4000
|
+
let message = session.transmit();
|
|
4001
|
+
if (message === null) break;
|
|
4002
|
+
channel.send(message);
|
|
4003
|
+
}
|
|
4004
|
+
let closed = session.closed();
|
|
4005
|
+
if (closed !== null)
|
|
4006
|
+
return handle(session.events()), finish(closed);
|
|
4007
|
+
let need = staging ? null : session.need();
|
|
4008
|
+
if (need === null) return;
|
|
4009
|
+
let digest = zones[need.zone]?.[need.index]?.digest;
|
|
4010
|
+
digest !== void 0 && (staging = true, store.read(digest).then((body) => {
|
|
4011
|
+
staging = false, !settled && ((body === null || !session.provide(need.zone, need.index, body)) && session.setHeld(need.zone, need.index, false), pump());
|
|
4012
|
+
}));
|
|
4013
|
+
};
|
|
4014
|
+
channel.binaryType = "arraybuffer", channel.bufferedAmountLowThreshold = LOW_WATER_BYTES, channel.onopen = pump, channel.onbufferedamountlow = pump, channel.onclose = () => finish(session.closed() ?? "peer"), channel.onmessage = (event) => {
|
|
4015
|
+
let data = event.data;
|
|
4016
|
+
data instanceof ArrayBuffer && (handle(session.receive(new Uint8Array(data))), pump());
|
|
4017
|
+
}, channel.readyState === "open" && pump();
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
// src/interactives/hosts/chrome/controller.ts
|
|
4022
|
+
var HostChromeController = class {
|
|
4023
|
+
constructor() {
|
|
4024
|
+
this.queue = [];
|
|
4025
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
4026
|
+
this.subscribe = (listener) => (this.listeners.add(listener), () => this.listeners.delete(listener));
|
|
4027
|
+
this.snapshot = () => this.queue[0]?.sheet ?? null;
|
|
4028
|
+
}
|
|
4029
|
+
ask(sheet, fallback) {
|
|
4030
|
+
return new Promise((resolve) => {
|
|
4031
|
+
this.queue.push({ sheet, settle: resolve, fallback }), this.queue.length === 1 && this.notify();
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
notify() {
|
|
4035
|
+
for (let listener of this.listeners) listener();
|
|
4036
|
+
}
|
|
4037
|
+
requestConsent(consent) {
|
|
4038
|
+
return this.ask({ kind: "consent", consent }, false);
|
|
4039
|
+
}
|
|
4040
|
+
confirmSpend(prompt) {
|
|
4041
|
+
return this.ask({ kind: "spend", prompt }, "cancelled");
|
|
4042
|
+
}
|
|
4043
|
+
showAd(creative) {
|
|
4044
|
+
return this.ask({ kind: "ad", creative }, "skipped");
|
|
4045
|
+
}
|
|
4046
|
+
offerClip(media) {
|
|
4047
|
+
return this.ask({ kind: "clip", media }, "done");
|
|
4048
|
+
}
|
|
4049
|
+
open(sheet) {
|
|
4050
|
+
this.ask(sheet, void 0);
|
|
4051
|
+
}
|
|
4052
|
+
resolve(value) {
|
|
4053
|
+
let current = this.queue.shift();
|
|
4054
|
+
current !== void 0 && (current.settle(value), this.notify());
|
|
4055
|
+
}
|
|
4056
|
+
dismiss() {
|
|
4057
|
+
let current = this.queue[0];
|
|
4058
|
+
current !== void 0 && this.resolve(current.fallback);
|
|
4059
|
+
}
|
|
4060
|
+
dismissAll() {
|
|
4061
|
+
for (; this.queue.length > 0; ) this.dismiss();
|
|
4062
|
+
}
|
|
4063
|
+
};
|
|
4064
|
+
|
|
4065
|
+
// src/interactives/parts/boot-delivery.ts
|
|
4066
|
+
var BOOT_FORMAT_VERSION = 1, PARTIAL_CONTENT2 = 206, SECURE_PROTOCOL3 = "https:", LAZY_GROUP_PREFIX = "lazy:", BYTECODE_GROUP_PREFIX = "engine:hermes";
|
|
4067
|
+
function bootSection(head) {
|
|
4068
|
+
let boot = head.boot;
|
|
4069
|
+
if (boot == null || boot.version !== (1) || !Array.isArray(boot.parts) || !Number.isSafeInteger(boot.follow) || boot.follow < 0 || boot.follow > boot.parts.length) return null;
|
|
4070
|
+
let offset = 0;
|
|
4071
|
+
for (let k = 0; k < boot.parts.length; k++) {
|
|
4072
|
+
let part = boot.parts[k];
|
|
4073
|
+
if (typeof part?.digest != "string" || !Number.isSafeInteger(part.size) || part.size < 0 || head.asset_groups[part.group] === void 0 || k === boot.follow && offset !== boot.follow_offset) return null;
|
|
4074
|
+
offset += part.size;
|
|
4075
|
+
}
|
|
4076
|
+
return boot.follow === boot.parts.length && offset !== boot.follow_offset ? null : offset === boot.bytes ? boot : null;
|
|
4077
|
+
}
|
|
4078
|
+
function bootChunks(head, boot) {
|
|
4079
|
+
return boot.parts.map((part, k) => {
|
|
4080
|
+
let group = head.asset_groups[part.group];
|
|
4081
|
+
return {
|
|
4082
|
+
digest: part.digest,
|
|
4083
|
+
size: part.size,
|
|
4084
|
+
asset_group: group.name,
|
|
4085
|
+
before_play: k < boot.follow,
|
|
4086
|
+
lazy: k >= boot.follow || group.name.startsWith(LAZY_GROUP_PREFIX),
|
|
4087
|
+
runtime: null,
|
|
4088
|
+
payload_digest: null
|
|
4089
|
+
};
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4092
|
+
function cdnBootRanges(base, fetcher = fetch) {
|
|
4093
|
+
if (new URL(base).protocol !== SECURE_PROTOCOL3) throw new Error(`boot files come only from the CDN over TLS, not ${base}`);
|
|
4094
|
+
return {
|
|
4095
|
+
async fetchRange(file, start, end, signal) {
|
|
4096
|
+
let response = await fetcher(new URL(file, base).href, { signal, headers: { Range: `bytes=${start}-${end - 1}` } });
|
|
4097
|
+
if (!response.ok) throw new Error(`boot file ${file} answered ${response.status}`);
|
|
4098
|
+
let body = new Uint8Array(await response.arrayBuffer());
|
|
4099
|
+
if (response.status === (206)) {
|
|
4100
|
+
if (body.length !== end - start) throw new Error(`boot file ${file} answered ${body.length} bytes for ${end - start}`);
|
|
4101
|
+
return body;
|
|
4102
|
+
}
|
|
4103
|
+
if (body.length < end) throw new Error(`boot file ${file} answered ${body.length} bytes for ${end}`);
|
|
4104
|
+
return body.subarray(start, end);
|
|
4105
|
+
}
|
|
4106
|
+
};
|
|
4107
|
+
}
|
|
4108
|
+
function webBootTail(boot, groups) {
|
|
4109
|
+
let last = boot.follow;
|
|
4110
|
+
for (; last > 0 && (groups[boot.parts[last - 1].group]?.name ?? "").startsWith(BYTECODE_GROUP_PREFIX); ) last--;
|
|
4111
|
+
return last;
|
|
4112
|
+
}
|
|
4113
|
+
async function installBootRange(store, boot, source, range, signal, bootParts = boot.follow) {
|
|
4114
|
+
let kept = Math.max(0, Math.min(bootParts, boot.follow)), bootEnd = boot.parts.slice(0, kept).reduce((sum, part) => sum + part.size, 0), [first, last, start, end] = range === "boot" ? [0, kept, 0, bootEnd] : [boot.follow, boot.parts.length, boot.follow_offset, boot.bytes];
|
|
4115
|
+
if (end <= start) return { parts: 0, bytes: 0, refused: [] };
|
|
4116
|
+
if (!boot.parts.slice(first, last).some((part) => !store.has(part.digest))) return { parts: 0, bytes: 0, refused: [] };
|
|
4117
|
+
let bytes = await source.fetchRange(boot.file, start, end, signal), refused = [], at = 0, parts = 0;
|
|
4118
|
+
for (let part of boot.parts.slice(first, last)) {
|
|
4119
|
+
let body = bytes.subarray(at, at + part.size);
|
|
4120
|
+
if (at += part.size, !store.has(part.digest)) {
|
|
4121
|
+
if (!await verifyChunk(part.digest, body)) {
|
|
4122
|
+
refused.push(part.digest);
|
|
4123
|
+
continue;
|
|
4124
|
+
}
|
|
4125
|
+
await store.admit(part.digest, body.slice()), parts++;
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
return { parts, bytes: bytes.length, refused };
|
|
4129
|
+
}
|
|
4130
|
+
|
|
4131
|
+
// src/interactives/parts/boot-bundle.ts
|
|
4132
|
+
var BOOT_BUNDLE_MAGIC = 1145979459, BOOT_BUNDLE_VERSION = 1, BOOT_BUNDLE_HEADER_BYTES = 32, BOOT_BUNDLE_PART_BYTES = 36, BOOT_BUNDLE_MAX_HEAD_BYTES = 16 * 1024 * 1024, BOOT_BUNDLE_MAX_KEY_ID_BYTES = 64, BOOT_BUNDLE_SIGNATURE_BYTES = 64, BOOT_BUNDLE_MAX_PARTS = 4096, BOOT_BUNDLE_KEY_PREFIX = "boot/", BOOT_BUNDLE_HERMES_SUFFIX = ".hermes";
|
|
4133
|
+
var MAX_BOOT_BUNDLE_BYTES = 64 * 1024 * 1024, BYTECODE_GROUP_PREFIX2 = "engine:hermes", BYTECODE_GROUP_SEPARATOR = "@", Field = { magic: 0, version: 4, flavour: 6, bytecode: 8, head: 12, keyId: 16, signature: 20, parts: 24, reserved: 28 }, BootBundleFlavour = { source: 0, hermes: 1 }, BootBundleRefusal = {
|
|
4134
|
+
bounds: "bounds",
|
|
4135
|
+
signature: "signature",
|
|
4136
|
+
head: "head",
|
|
4137
|
+
launch: "launch",
|
|
4138
|
+
table: "table"
|
|
4139
|
+
}, BootBundleError = class extends Error {
|
|
4140
|
+
constructor(refusal) {
|
|
4141
|
+
super(`the boot bundle is refused: ${refusal}`);
|
|
4142
|
+
this.refusal = refusal;
|
|
4143
|
+
this.name = "BootBundleError";
|
|
4144
|
+
}
|
|
4145
|
+
};
|
|
4146
|
+
function bootBundleKey(package_digest, bytecode = null) {
|
|
4147
|
+
return `${BOOT_BUNDLE_KEY_PREFIX}${package_digest}${bytecode === null ? "" : `${BOOT_BUNDLE_HERMES_SUFFIX}${bytecode}`}`;
|
|
4148
|
+
}
|
|
4149
|
+
function bytecodeOf(group) {
|
|
4150
|
+
if (!group.startsWith(BYTECODE_GROUP_PREFIX2)) return null;
|
|
4151
|
+
let at = group.indexOf(BYTECODE_GROUP_SEPARATOR), version = at < 0 ? Number.NaN : Number(group.slice(at + 1));
|
|
4152
|
+
return Number.isSafeInteger(version) ? version : Number.NaN;
|
|
4153
|
+
}
|
|
4154
|
+
function allowed(boot, head, flavour, bytecode) {
|
|
4155
|
+
let group = (k) => head.asset_groups[boot.parts[k].group]?.name ?? "", out = boot.parts.map((_, k) => k < boot.follow);
|
|
4156
|
+
if (flavour === BootBundleFlavour.source)
|
|
4157
|
+
for (let k = boot.follow - 1; k >= 0 && bytecodeOf(group(k)) !== null; k--) out[k] = false;
|
|
4158
|
+
else
|
|
4159
|
+
for (let k = 0; k < boot.follow; k++) {
|
|
4160
|
+
let version = bytecodeOf(group(k));
|
|
4161
|
+
version !== null && version !== bytecode && (out[k] = false);
|
|
4162
|
+
}
|
|
4163
|
+
return out;
|
|
4164
|
+
}
|
|
4165
|
+
function u32(view, at) {
|
|
4166
|
+
return view.getUint32(at, true);
|
|
4167
|
+
}
|
|
4168
|
+
function openBootBundle(bytes, launch, trust) {
|
|
4169
|
+
if (bytes.length < (32)) throw new BootBundleError(BootBundleRefusal.bounds);
|
|
4170
|
+
let view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength), flavour = view.getUint16(Field.flavour, true), [headBytes, keyBytes, signatureBytes, count] = [u32(view, Field.head), u32(view, Field.keyId), u32(view, Field.signature), u32(view, Field.parts)];
|
|
4171
|
+
if (u32(view, Field.magic) !== (1145979459) || view.getUint16(Field.version, true) !== (1) || flavour !== BootBundleFlavour.source && flavour !== BootBundleFlavour.hermes || u32(view, Field.reserved) !== 0 || headBytes > BOOT_BUNDLE_MAX_HEAD_BYTES || keyBytes > (64) || signatureBytes !== (64) || count > (4096))
|
|
4172
|
+
throw new BootBundleError(BootBundleRefusal.bounds);
|
|
4173
|
+
let bytecode = u32(view, Field.bytecode), keyAt = (32) + headBytes, signatureAt = keyAt + keyBytes, tableAt = signatureAt + signatureBytes, bodiesAt = tableAt + count * (36);
|
|
4174
|
+
if (bodiesAt > bytes.length) throw new BootBundleError(BootBundleRefusal.bounds);
|
|
4175
|
+
let sizes = [], total = bodiesAt;
|
|
4176
|
+
for (let k = 0; k < count; k++) {
|
|
4177
|
+
let size = u32(view, tableAt + k * (36) + SHA256_BYTES);
|
|
4178
|
+
sizes.push(size), total += size;
|
|
4179
|
+
}
|
|
4180
|
+
if (total !== bytes.length) throw new BootBundleError(BootBundleRefusal.bounds);
|
|
4181
|
+
let head = bytes.subarray((32), keyAt), parsed;
|
|
4182
|
+
try {
|
|
4183
|
+
let peek = JSON.parse(new TextDecoder().decode(head));
|
|
4184
|
+
parsed = openWeaveHead(
|
|
4185
|
+
{ root: peek.weave, head: encodeBase64(head), signature: encodeBase64(bytes.subarray(signatureAt, tableAt)), key_id: new TextDecoder().decode(bytes.subarray(keyAt, signatureAt)) },
|
|
4186
|
+
trust
|
|
4187
|
+
);
|
|
4188
|
+
} catch {
|
|
4189
|
+
throw new BootBundleError(BootBundleRefusal.signature);
|
|
4190
|
+
}
|
|
4191
|
+
if (parsed.interactive_id !== launch.interactive_id || parsed.revision_id !== launch.revision_id) throw new BootBundleError(BootBundleRefusal.launch);
|
|
4192
|
+
let boot = bootSection(parsed);
|
|
4193
|
+
if (boot === null) throw new BootBundleError(BootBundleRefusal.head);
|
|
4194
|
+
let may = allowed(boot, parsed, flavour, bytecode), parts = [], refused = [], digest = new Uint8Array(SHA256_BYTES), next = 0, at = bodiesAt;
|
|
4195
|
+
for (let k = 0; k < count; k++) {
|
|
4196
|
+
let name = hex(bytes.subarray(tableAt + k * (36), tableAt + k * (36) + SHA256_BYTES));
|
|
4197
|
+
for (; next < boot.parts.length && boot.parts[next].digest !== name; ) next++;
|
|
4198
|
+
if (next === boot.parts.length || !may[next] || boot.parts[next].size !== sizes[k]) throw new BootBundleError(BootBundleRefusal.table);
|
|
4199
|
+
next++;
|
|
4200
|
+
let body = bytes.subarray(at, at + sizes[k]);
|
|
4201
|
+
at += sizes[k], sha256Into(body, digest), hex(digest) === name ? parts.push({ digest: name, body }) : refused.push(name);
|
|
4202
|
+
}
|
|
4203
|
+
return { head: parsed, boot, flavour, bytecode, parts, refused };
|
|
4204
|
+
}
|
|
4205
|
+
async function fetchBootBundle(fetcher, url) {
|
|
4206
|
+
let twin = await fetchTwin(fetcher, url, MAX_BOOT_BUNDLE_BYTES);
|
|
4207
|
+
if (twin !== null) return twin;
|
|
4208
|
+
let response = await fetcher(url);
|
|
4209
|
+
if (!response.ok) return null;
|
|
4210
|
+
let bytes = new Uint8Array(await response.arrayBuffer());
|
|
4211
|
+
return { bytes, wire: bytes.length };
|
|
4212
|
+
}
|
|
4213
|
+
|
|
4214
|
+
// src/interactives/hosts/chrome/prefetch.ts
|
|
4215
|
+
var PREFETCH_BATCH = 24, MILESTONE_MARK_PREFIX = "cimplify:", FEED_DWELL_MS = 300, FEED_SESSION_BYTES = 96 * 1024 * 1024, LAZY_GROUP_PREFIX2 = "lazy:";
|
|
4216
|
+
function abortError() {
|
|
4217
|
+
let error = new Error("the chunk fetch was aborted");
|
|
4218
|
+
return error.name = "AbortError", error;
|
|
4219
|
+
}
|
|
4220
|
+
var ChunkCache = class {
|
|
4221
|
+
constructor(origin) {
|
|
4222
|
+
this.origin = origin;
|
|
4223
|
+
this.bodies = /* @__PURE__ */ new Map();
|
|
4224
|
+
this.flights = /* @__PURE__ */ new Map();
|
|
4225
|
+
this.abortedCount = 0;
|
|
4226
|
+
}
|
|
4227
|
+
cached(digest) {
|
|
4228
|
+
return this.bodies.has(digest) || this.flights.has(digest);
|
|
4229
|
+
}
|
|
4230
|
+
holders(digest) {
|
|
4231
|
+
return this.flights.get(digest)?.holders ?? 0;
|
|
4232
|
+
}
|
|
4233
|
+
get aborted() {
|
|
4234
|
+
return this.abortedCount;
|
|
4235
|
+
}
|
|
4236
|
+
from(base) {
|
|
4237
|
+
let source = this.origin(base);
|
|
4238
|
+
return {
|
|
4239
|
+
...source.fetchTwin === void 0 ? {} : { fetchTwin: source.fetchTwin.bind(source) },
|
|
4240
|
+
fetch: (digest, signal) => {
|
|
4241
|
+
let done2 = this.bodies.get(digest);
|
|
4242
|
+
if (done2 !== void 0) return done2;
|
|
4243
|
+
if (signal?.aborted === true) return Promise.reject(abortError());
|
|
4244
|
+
let flight = this.flights.get(digest);
|
|
4245
|
+
return flight === void 0 && (flight = this.start(source, digest)), this.hold(digest, flight, signal);
|
|
4246
|
+
}
|
|
4247
|
+
};
|
|
4248
|
+
}
|
|
4249
|
+
start(source, digest) {
|
|
4250
|
+
let controller = typeof AbortController == "function" ? new AbortController() : null, body = source.fetch(digest, controller?.signal), flight = { body, controller, holders: 0 };
|
|
4251
|
+
return this.flights.set(digest, flight), body.then(
|
|
4252
|
+
() => {
|
|
4253
|
+
this.flights.get(digest) === flight && (this.flights.delete(digest), this.bodies.set(digest, body));
|
|
4254
|
+
},
|
|
4255
|
+
() => {
|
|
4256
|
+
this.flights.get(digest) === flight && this.flights.delete(digest);
|
|
4257
|
+
}
|
|
4258
|
+
), flight;
|
|
4259
|
+
}
|
|
4260
|
+
hold(digest, flight, signal) {
|
|
4261
|
+
return flight.holders++, signal === void 0 ? flight.body.finally(() => {
|
|
4262
|
+
flight.holders--;
|
|
4263
|
+
}) : new Promise((resolve, reject) => {
|
|
4264
|
+
let settled = false, leave = () => {
|
|
4265
|
+
settled || (settled = true, signal.removeEventListener("abort", aborted), flight.holders--);
|
|
4266
|
+
}, aborted = () => {
|
|
4267
|
+
settled || (leave(), reject(abortError()), flight.holders === 0 && this.flights.get(digest) === flight && (this.flights.delete(digest), flight.controller?.abort(), this.abortedCount++));
|
|
4268
|
+
};
|
|
4269
|
+
signal.addEventListener("abort", aborted), flight.body.then(
|
|
4270
|
+
(bytes) => {
|
|
4271
|
+
settled || (leave(), resolve(bytes));
|
|
4272
|
+
},
|
|
4273
|
+
(error) => {
|
|
4274
|
+
settled || (leave(), reject(error));
|
|
4275
|
+
}
|
|
4276
|
+
);
|
|
4277
|
+
});
|
|
4278
|
+
}
|
|
4279
|
+
}, IDLE_SCHEDULER = {
|
|
4280
|
+
defer(run) {
|
|
4281
|
+
let scope = globalThis;
|
|
4282
|
+
typeof scope.requestIdleCallback == "function" ? scope.requestIdleCallback(run) : setTimeout(run, 0);
|
|
4283
|
+
}
|
|
4284
|
+
}, DEFAULT_TIMERS = {
|
|
4285
|
+
set: (run, ms) => setTimeout(run, ms),
|
|
4286
|
+
clear: (timer) => clearTimeout(timer)
|
|
4287
|
+
}, BOOT_RANGES = ["boot", "follow"];
|
|
4288
|
+
function decoratedChunks(head) {
|
|
4289
|
+
let out = [];
|
|
4290
|
+
for (let chunk of head.chunks) {
|
|
4291
|
+
let group = head.asset_groups[chunk.group];
|
|
4292
|
+
group === void 0 || typeof chunk.guest == "string" || out.push({
|
|
4293
|
+
digest: chunk.digest,
|
|
4294
|
+
size: chunk.size,
|
|
4295
|
+
asset_group: group.name,
|
|
4296
|
+
before_play: group.before_play,
|
|
4297
|
+
lazy: group.name.startsWith(LAZY_GROUP_PREFIX2),
|
|
4298
|
+
runtime: chunk.runtime ?? null,
|
|
4299
|
+
payload_digest: chunk.payload_digest ?? null,
|
|
4300
|
+
...typeof chunk.brotli_bytes == "number" ? { twinned: true } : {}
|
|
4301
|
+
});
|
|
4302
|
+
}
|
|
4303
|
+
return out;
|
|
4304
|
+
}
|
|
4305
|
+
function feedChunks(chunks, depth, tier, isolated, threads) {
|
|
4306
|
+
if (depth.feed === "none" || depth.feed_bytes <= 0) return [];
|
|
4307
|
+
let hosted = chunksForHost(chunks, null, isolated, tier, threads).filter(
|
|
4308
|
+
(chunk) => chunk.before_play && chunk.lazy !== true && !(chunk.asset_group ?? "").startsWith(LAZY_GROUP_PREFIX2)
|
|
4309
|
+
), lead = hosted.filter(linksBeforeStart), ordered = depth.feed === "lead" ? lead : [...lead, ...hosted.filter((chunk) => !linksBeforeStart(chunk))], out = [], bytes = 0;
|
|
4310
|
+
for (let chunk of ordered) {
|
|
4311
|
+
let size = chunk.size ?? 0;
|
|
4312
|
+
if (bytes + size > depth.feed_bytes) break;
|
|
4313
|
+
bytes += size, out.push(chunk);
|
|
4314
|
+
}
|
|
4315
|
+
return out;
|
|
4316
|
+
}
|
|
4317
|
+
var PackagePrefetcher = class {
|
|
4318
|
+
constructor(registry, chunks, channel = "live", scheduler = IDLE_SCHEDULER, options = {}) {
|
|
4319
|
+
this.registry = registry;
|
|
4320
|
+
this.chunks = chunks;
|
|
4321
|
+
this.channel = channel;
|
|
4322
|
+
this.scheduler = scheduler;
|
|
4323
|
+
this.options = options;
|
|
4324
|
+
this.states = /* @__PURE__ */ new Map();
|
|
4325
|
+
this.dwell = /* @__PURE__ */ new Map();
|
|
4326
|
+
this.indexing = [];
|
|
4327
|
+
this.ready = [];
|
|
4328
|
+
this.indexes = /* @__PURE__ */ new Map();
|
|
4329
|
+
this.roots = /* @__PURE__ */ new Map();
|
|
4330
|
+
this.boots = /* @__PURE__ */ new Map();
|
|
4331
|
+
this.tails = /* @__PURE__ */ new Map();
|
|
4332
|
+
this.transfers = /* @__PURE__ */ new Map();
|
|
4333
|
+
this.launches = /* @__PURE__ */ new Map();
|
|
4334
|
+
this.scheduled = false;
|
|
4335
|
+
this.running = 0;
|
|
4336
|
+
this.paused = false;
|
|
4337
|
+
this.fetched = 0;
|
|
4338
|
+
this.flush = () => {
|
|
4339
|
+
for (this.scheduled = false; this.indexing.length > 0; ) this.load(this.indexing.splice(0, (24)));
|
|
4340
|
+
};
|
|
4341
|
+
this.network = options.network ?? webNetworkHint, this.timers = options.timers ?? DEFAULT_TIMERS;
|
|
4342
|
+
}
|
|
4343
|
+
package(interactive_id) {
|
|
4344
|
+
return this.indexes.get(interactive_id) ?? null;
|
|
4345
|
+
}
|
|
4346
|
+
state(interactive_id) {
|
|
4347
|
+
return this.states.get(interactive_id) ?? "idle";
|
|
4348
|
+
}
|
|
4349
|
+
get bytesFetched() {
|
|
4350
|
+
return this.fetched;
|
|
4351
|
+
}
|
|
4352
|
+
get active() {
|
|
4353
|
+
return this.running;
|
|
4354
|
+
}
|
|
4355
|
+
depth() {
|
|
4356
|
+
return prefetchDepth(this.network());
|
|
4357
|
+
}
|
|
4358
|
+
visible(interactive_id, launch = null) {
|
|
4359
|
+
launch !== null && this.launches.set(interactive_id, launch);
|
|
4360
|
+
let state = this.state(interactive_id);
|
|
4361
|
+
if (state !== "idle" && state !== "cancelled" || this.depth().feed === "none") return;
|
|
4362
|
+
let dwell = this.options.dwell_ms ?? (300);
|
|
4363
|
+
if (this.states.set(interactive_id, "dwelling"), dwell <= 0) {
|
|
4364
|
+
this.dwelled(interactive_id);
|
|
4365
|
+
return;
|
|
4366
|
+
}
|
|
4367
|
+
this.dwell.set(
|
|
4368
|
+
interactive_id,
|
|
4369
|
+
this.timers.set(() => this.dwelled(interactive_id), dwell)
|
|
4370
|
+
);
|
|
4371
|
+
}
|
|
4372
|
+
hidden(interactive_id) {
|
|
4373
|
+
let timer = this.dwell.get(interactive_id);
|
|
4374
|
+
timer !== void 0 && (this.timers.clear(timer), this.dwell.delete(interactive_id));
|
|
4375
|
+
let state = this.state(interactive_id);
|
|
4376
|
+
(state === "dwelling" || state === "waiting" || state === "running") && this.states.set(interactive_id, "cancelled"), this.transfers.get(interactive_id)?.abort(), remove(this.indexing, interactive_id), remove(this.ready, interactive_id);
|
|
4377
|
+
}
|
|
4378
|
+
pause() {
|
|
4379
|
+
this.paused = true;
|
|
4380
|
+
for (let controller of this.transfers.values()) controller.abort();
|
|
4381
|
+
}
|
|
4382
|
+
resume() {
|
|
4383
|
+
this.paused = false, this.pump();
|
|
4384
|
+
}
|
|
4385
|
+
dwelled(interactive_id) {
|
|
4386
|
+
if (this.dwell.delete(interactive_id), this.state(interactive_id) === "dwelling") {
|
|
4387
|
+
if (this.states.set(interactive_id, "waiting"), this.indexes.has(interactive_id)) {
|
|
4388
|
+
this.ready.push(interactive_id), this.pump();
|
|
4389
|
+
return;
|
|
4390
|
+
}
|
|
4391
|
+
this.indexing.push(interactive_id), !this.scheduled && (this.scheduled = true, this.scheduler.defer(this.flush));
|
|
4392
|
+
}
|
|
4393
|
+
}
|
|
4394
|
+
async bundle(interactive_id) {
|
|
4395
|
+
let launch = this.launches.get(interactive_id), base = this.options.boot_bundle_base, trust = this.options.weave_trust, store = this.options.part_store;
|
|
4396
|
+
if (launch === void 0 || base === void 0 || trust === void 0 || store === void 0) return null;
|
|
4397
|
+
try {
|
|
4398
|
+
let fetched = await fetchBootBundle(this.options.fetcher ?? fetch, `${base}${bootBundleKey(launch.package_digest)}`);
|
|
4399
|
+
if (fetched === null) return null;
|
|
4400
|
+
let bytes = fetched.bytes, opened = openBootBundle(bytes, { interactive_id, revision_id: launch.revision_id }, trust);
|
|
4401
|
+
for (let part of opened.parts) await store.admit(part.digest, part.body.slice());
|
|
4402
|
+
this.fetched += fetched.wire, this.boots.set(interactive_id, opened.boot), this.tails.set(interactive_id, webBootTail(opened.boot, opened.head.asset_groups));
|
|
4403
|
+
let chunks = [...decoratedChunks(opened.head), ...bootChunks(opened.head, opened.boot)];
|
|
4404
|
+
return { interactive_id, package: { revision_id: launch.revision_id, package_digest: launch.package_digest, chunk_base_url: base, chunks } };
|
|
4405
|
+
} catch {
|
|
4406
|
+
return null;
|
|
4407
|
+
}
|
|
4408
|
+
}
|
|
4409
|
+
async load(ids) {
|
|
4410
|
+
let found;
|
|
4411
|
+
try {
|
|
4412
|
+
let launched = ids.filter((id) => this.launches.has(id)), bundled = launched.length === 0 ? [] : (await Promise.all(launched.map((id) => this.bundle(id)))).filter((entry) => entry !== null), rest = ids.filter((id) => !bundled.some((entry) => entry.interactive_id === id)), listed = [...bundled, ...rest.length === 0 ? [] : await this.registry.packages(rest, this.channel, this.options.form ?? "weave")];
|
|
4413
|
+
found = listed.some((entry) => woven(entry.package)) ? (await Promise.all(listed.map((entry) => this.unweave(entry)))).filter((entry) => entry !== null) : listed;
|
|
4414
|
+
} catch {
|
|
4415
|
+
for (let id of ids) this.state(id) === "waiting" && this.states.set(id, "cancelled");
|
|
4416
|
+
return;
|
|
4417
|
+
}
|
|
4418
|
+
for (let entry of found)
|
|
4419
|
+
this.indexes.set(entry.interactive_id, entry.package), this.state(entry.interactive_id) === "waiting" && this.ready.push(entry.interactive_id);
|
|
4420
|
+
for (let id of ids) this.state(id) === "waiting" && !this.indexes.has(id) && this.states.set(id, "done");
|
|
4421
|
+
this.pump();
|
|
4422
|
+
}
|
|
4423
|
+
async unweave(entry) {
|
|
4424
|
+
let index = entry.package;
|
|
4425
|
+
if (!woven(index) || index.weave === void 0) return entry;
|
|
4426
|
+
let id = entry.interactive_id;
|
|
4427
|
+
try {
|
|
4428
|
+
let head = openWeaveHead(index.weave, this.options.weave_trust ?? null), boot = bootSection(head);
|
|
4429
|
+
if (boot !== null)
|
|
4430
|
+
return this.boots.set(id, boot), this.tails.set(id, webBootTail(boot, head.asset_groups)), { interactive_id: id, package: { ...index, chunks: [...decoratedChunks(head), ...bootChunks(head, boot)] } };
|
|
4431
|
+
let upstream = this.chunks.from(index.chunk_base_url), store = this.options.part_store, nodes = store === void 0 ? chunkWeaveSource(upstream) : storeWeaveSource(store, upstream), { index: unwoven } = await unweaveIndex(index, nodes, this.options.weave_trust ?? null, this.roots.get(id) ?? null);
|
|
4432
|
+
return this.roots.set(id, index.weave.root), { interactive_id: id, package: unwoven };
|
|
4433
|
+
} catch {
|
|
4434
|
+
return (await this.registry.packages([id], this.channel, "full")).find((found) => found.interactive_id === id) ?? null;
|
|
4435
|
+
}
|
|
4436
|
+
}
|
|
4437
|
+
pump() {
|
|
4438
|
+
if (!this.paused)
|
|
4439
|
+
for (; this.ready.length > 0 && this.running < this.depth().feed_concurrency; ) {
|
|
4440
|
+
let id = this.ready.shift();
|
|
4441
|
+
this.state(id) === "waiting" && (this.running++, this.states.set(id, "running"), this.warm(id).finally(() => {
|
|
4442
|
+
this.running--, this.state(id) === "running" && this.paused ? (this.states.set(id, "waiting"), this.ready.unshift(id)) : this.state(id) === "running" && this.states.set(id, "done"), this.pump();
|
|
4443
|
+
}));
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4446
|
+
boot(interactive_id) {
|
|
4447
|
+
return this.boots.get(interactive_id) ?? null;
|
|
4448
|
+
}
|
|
4449
|
+
async warmBoot(interactive_id, index, boot, store) {
|
|
4450
|
+
let controller = typeof AbortController == "function" ? new AbortController() : null;
|
|
4451
|
+
controller !== null && this.transfers.set(interactive_id, controller);
|
|
4452
|
+
try {
|
|
4453
|
+
let ranges = cdnBootRanges(index.chunk_base_url, this.options.fetcher ?? fetch);
|
|
4454
|
+
for (let range of BOOT_RANGES) {
|
|
4455
|
+
if (this.state(interactive_id) !== "running" || this.paused || this.depth().feed === "none") return;
|
|
4456
|
+
let done2 = await installBootRange(store, boot, ranges, range, controller?.signal, this.tails.get(interactive_id));
|
|
4457
|
+
this.fetched += done2.bytes;
|
|
4458
|
+
}
|
|
4459
|
+
} catch {
|
|
4460
|
+
return;
|
|
4461
|
+
} finally {
|
|
4462
|
+
this.transfers.get(interactive_id) === controller && this.transfers.delete(interactive_id);
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
async warm(interactive_id) {
|
|
4466
|
+
let index = this.indexes.get(interactive_id);
|
|
4467
|
+
if (index === void 0) return;
|
|
4468
|
+
let boot = this.boots.get(interactive_id), store = this.options.part_store;
|
|
4469
|
+
if (boot !== void 0 && store !== void 0) {
|
|
4470
|
+
await this.warmBoot(interactive_id, index, boot, store);
|
|
4471
|
+
return;
|
|
4472
|
+
}
|
|
4473
|
+
let tier = this.options.tier ?? DEFAULT_HOST_TIER, refs = feedChunks(index.chunks, this.depth(), tier, this.options.isolated ?? hostIsolated(), this.options.threads ?? hostThreads()), source = this.chunks.from(index.chunk_base_url), cap = this.options.session_bytes ?? FEED_SESSION_BYTES;
|
|
4474
|
+
for (let ref of refs) {
|
|
4475
|
+
if (this.state(interactive_id) !== "running" || this.paused || this.depth().feed === "none") return;
|
|
4476
|
+
if (this.chunks.cached(ref.digest)) continue;
|
|
4477
|
+
let size = ref.size ?? 0;
|
|
4478
|
+
if (this.fetched + size > cap) return;
|
|
4479
|
+
this.fetched += size;
|
|
4480
|
+
let controller = typeof AbortController == "function" ? new AbortController() : null;
|
|
4481
|
+
controller !== null && this.transfers.set(interactive_id, controller);
|
|
4482
|
+
try {
|
|
4483
|
+
await source.fetch(ref.digest, controller?.signal);
|
|
4484
|
+
} catch {
|
|
4485
|
+
controller?.signal.aborted === true && (this.fetched -= size);
|
|
4486
|
+
return;
|
|
4487
|
+
} finally {
|
|
4488
|
+
this.transfers.get(interactive_id) === controller && this.transfers.delete(interactive_id);
|
|
4489
|
+
}
|
|
4490
|
+
}
|
|
4491
|
+
}
|
|
4492
|
+
transferring(interactive_id) {
|
|
4493
|
+
return this.transfers.has(interactive_id);
|
|
4494
|
+
}
|
|
4495
|
+
};
|
|
4496
|
+
function remove(list, value) {
|
|
4497
|
+
let at = list.indexOf(value);
|
|
4498
|
+
at >= 0 && list.splice(at, 1);
|
|
4499
|
+
}
|
|
4500
|
+
function milestoneMarks(prefix = MILESTONE_MARK_PREFIX) {
|
|
4501
|
+
return (milestone) => {
|
|
4502
|
+
globalThis.performance?.mark(prefix + milestone);
|
|
4503
|
+
};
|
|
4504
|
+
}
|
|
4505
|
+
|
|
4506
|
+
// src/interactives/hosts/chrome/registry.ts
|
|
4507
|
+
var RegistryError = class extends Error {
|
|
4508
|
+
constructor(status, route) {
|
|
4509
|
+
super(`${route} answered ${status}`);
|
|
4510
|
+
this.status = status;
|
|
4511
|
+
this.route = route;
|
|
4512
|
+
this.name = "RegistryError";
|
|
4513
|
+
}
|
|
4514
|
+
}, JSON_HEADERS = { "content-type": "application/json" };
|
|
4515
|
+
function httpRegistry(base, fetcher = fetch) {
|
|
4516
|
+
let url = (path) => new URL(path, base).href, call = async (method, path, body) => {
|
|
4517
|
+
let response = await fetcher(url(path), {
|
|
4518
|
+
method,
|
|
4519
|
+
credentials: "include",
|
|
4520
|
+
headers: body === void 0 ? void 0 : JSON_HEADERS,
|
|
4521
|
+
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
4522
|
+
});
|
|
4523
|
+
if (!response.ok) throw new RegistryError(response.status, path);
|
|
4524
|
+
if (response.status !== 204)
|
|
4525
|
+
return (await response.json()).data;
|
|
4526
|
+
}, segment = encodeURIComponent;
|
|
4527
|
+
return {
|
|
4528
|
+
async fileReport(interactive_id, filing) {
|
|
4529
|
+
await call("POST", `/v1/interactives/${segment(interactive_id)}/reports`, filing);
|
|
4530
|
+
},
|
|
4531
|
+
async blockHandle(handle) {
|
|
4532
|
+
await call("PUT", `/v1/me/blocks/by-handle/${segment(handle)}`);
|
|
4533
|
+
},
|
|
4534
|
+
decideAd: (interactive_id, body) => call("POST", `/v1/interactives/${segment(interactive_id)}/ads/decisions`, body),
|
|
4535
|
+
completeAd: (interactive_id, placement_id, attested) => call("POST", `/v1/interactives/${segment(interactive_id)}/ads/placements/${segment(placement_id)}/complete`, { attested }),
|
|
4536
|
+
packages: (ids, channel, form = "full") => call("GET", `/v1/interactives/packages?ids=${ids.map(segment).join(",")}&channel=${channel}${form === "full" ? "" : `&form=${form}`}`)
|
|
4537
|
+
};
|
|
4538
|
+
}
|
|
4539
|
+
|
|
4540
|
+
// src/interactives/hosts/local.ts
|
|
4541
|
+
var FAMILIES = Object.keys(CTX_CAPABILITIES), LOCAL_REVISION = "rev_local", LOCAL_INSTANCE = "instance_local", LOCAL_COUNTER_PREFIX = "counter_local_";
|
|
4542
|
+
function familyOf(operation) {
|
|
4543
|
+
let best = null;
|
|
4544
|
+
for (let family of FAMILIES)
|
|
4545
|
+
operation.startsWith(`${family}.`) && (best === null || family.length > best.length) && (best = family);
|
|
4546
|
+
return best;
|
|
4547
|
+
}
|
|
4548
|
+
function localProgram(options) {
|
|
4549
|
+
return {
|
|
4550
|
+
capabilities: [],
|
|
4551
|
+
contract_version: 1,
|
|
4552
|
+
data_lineage: null,
|
|
4553
|
+
features: [],
|
|
4554
|
+
instance: LOCAL_INSTANCE,
|
|
4555
|
+
interactive_id: options.interactive_id,
|
|
4556
|
+
kit_version: null,
|
|
4557
|
+
launch: { source: "direct", reference: null, selected: null },
|
|
4558
|
+
location: "client",
|
|
4559
|
+
profile: options.profile,
|
|
4560
|
+
revision: LOCAL_REVISION
|
|
4561
|
+
};
|
|
4562
|
+
}
|
|
4563
|
+
function localSession(options) {
|
|
4564
|
+
let writer = new MessageWriter(), now = options.now ?? (() => Date.now()), program = localProgram(options), listener = () => {
|
|
4565
|
+
}, closers = [], counters = /* @__PURE__ */ new Map(), respond2 = (request2) => {
|
|
4566
|
+
let call = request2.call, local = localAnswer(call, program, options, counters);
|
|
4567
|
+
if (local !== void 0)
|
|
4568
|
+
return {
|
|
4569
|
+
contract_version: 1,
|
|
4570
|
+
request_id: request2.request_id,
|
|
4571
|
+
outcome: { status: "ok", response: { operation: call.operation, result: local } }
|
|
4572
|
+
};
|
|
4573
|
+
let error = { code: "unavailable", family: familyOf(call.operation) ?? "program", retry_after_ms: null };
|
|
4574
|
+
return { contract_version: 1, request_id: request2.request_id, outcome: { status: "error", error } };
|
|
4575
|
+
}, deliver = (reply) => {
|
|
4576
|
+
let length = writer.json(MessageTag.response, reply);
|
|
4577
|
+
listener(writer.bytes.slice(0, length));
|
|
4578
|
+
}, settle = (request2, answer) => "error" in answer ? { contract_version: 1, request_id: request2.request_id, outcome: { status: "error", error: answer.error } } : {
|
|
4579
|
+
contract_version: 1,
|
|
4580
|
+
request_id: request2.request_id,
|
|
4581
|
+
outcome: { status: "ok", response: { operation: request2.call.operation, result: answer.result } }
|
|
4582
|
+
};
|
|
4583
|
+
return { transport: {
|
|
4584
|
+
send(bytes) {
|
|
4585
|
+
if (bytes[0] !== MessageTag.request) return;
|
|
4586
|
+
let request2 = readJson(bytes), pending = options.answerAsync?.(request2.call);
|
|
4587
|
+
if (pending !== void 0) {
|
|
4588
|
+
let family = familyOf(request2.call.operation) ?? "program";
|
|
4589
|
+
pending.catch(() => ({ error: { code: "unavailable", family, retry_after_ms: null } })).then((answer) => deliver(settle(request2, answer)));
|
|
4590
|
+
return;
|
|
4591
|
+
}
|
|
4592
|
+
let reply = respond2(request2);
|
|
4593
|
+
queueMicrotask(() => deliver(reply));
|
|
4594
|
+
},
|
|
4595
|
+
on_message(next) {
|
|
4596
|
+
listener = next;
|
|
4597
|
+
},
|
|
4598
|
+
on_close(next) {
|
|
4599
|
+
closers.push(next);
|
|
4600
|
+
},
|
|
4601
|
+
close() {
|
|
4602
|
+
for (let closer of closers) closer({ reason: "closed_by_host", detail: null });
|
|
4603
|
+
closers.length = 0;
|
|
4604
|
+
}
|
|
4605
|
+
}, hello: { protocol: 1, program, server_time_ms: now() } };
|
|
4606
|
+
}
|
|
4607
|
+
function localAnswer(call, program, options, counters) {
|
|
4608
|
+
let custom = options.answer?.(call);
|
|
4609
|
+
if (custom !== void 0) return custom;
|
|
4610
|
+
switch (call.operation) {
|
|
4611
|
+
case "program.describe":
|
|
4612
|
+
return program;
|
|
4613
|
+
case "program.set_status":
|
|
4614
|
+
return { text: call.arguments.text.length === 0 ? null : call.arguments.text, your_turn: call.arguments.your_turn };
|
|
4615
|
+
case "program.complete":
|
|
4616
|
+
return { recorded: false };
|
|
4617
|
+
case "identity.current":
|
|
4618
|
+
return options.persona;
|
|
4619
|
+
case "counter.open": {
|
|
4620
|
+
let counter_id = `${LOCAL_COUNTER_PREFIX}${call.arguments.name}`, slot = counters.get(counter_id) ?? counters.size;
|
|
4621
|
+
return counters.set(counter_id, slot), { counter_id, kind: call.arguments.kind, scope: call.arguments.scope, slot };
|
|
4622
|
+
}
|
|
4623
|
+
default:
|
|
4624
|
+
return;
|
|
4625
|
+
}
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4628
|
+
export { CAMERA_ON_COPY, CANVAS_PERMISSIONS, CANVAS_SANDBOX, CLIP_MP4_TYPE, CONTENT_BLOCKED_CLOSE, CONTENT_BLOCKED_ERROR, CONTENT_BLOCKED_STATUS, CacheStoragePartBackend, CameraGrants, ChunkCache, ClipRelay, DEFAULT_WARM_BOOT_MS, EncodedRing, FACE_LANDMARKER, FEED_DWELL_MS, FEED_SESSION_BYTES, FaceCameraRelay, HostChromeController, IDLE_SCHEDULER, ISOLATION_HEADERS, IdentityCopy, IdentityGuidance, IndexedDbPartBackend, MILESTONE_MARK_PREFIX, NETWORK_DIALERS, PART_STORE_NAME, PEER_SHARING_FEATURE, PREFETCH_BATCH, PackagePrefetcher, PortBridge, RegistryError, RoomRelay, RuntimePool, SHOAL_MAX_MESSAGE_BYTES, ShoalHoldings, ShoalSession, WEB_DISK_RESERVE_BYTES, animationFrameScheduler, blockedItems, cameraViewStyle, canvasDocument, canvasPolicy, cdnRepairs, completeZone, domIdentitySheet, familyOf, feedChunks, httpRegistry, iframeEngines, insetVideo, localProgram, localSession, manifestCredits, mediaPipeFaceRunner, milestoneMarks, muxMp4, openPeerSharing, openWebPartStore, peerSharingEnabled, planZone, readViewRect, repairDecoder, runOverChannel, runtimeImage, serveContent, shoalModule, webStorageDisk };
|