@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,1170 @@
|
|
|
1
|
+
import { LuaTable, Args, register, LuaState, blobEvaluator, BudgetExceeded, LuaError, compileBytecode } from './chunk-Y7JWLB25.mjs';
|
|
2
|
+
import './chunk-MN3YETVN.mjs';
|
|
3
|
+
import './chunk-KDQOR4QQ.mjs';
|
|
4
|
+
import './chunk-V7ZRH3PY.mjs';
|
|
5
|
+
import './chunk-N4RGGDEL.mjs';
|
|
6
|
+
import './chunk-25T4JHEA.mjs';
|
|
7
|
+
|
|
8
|
+
// src/interactives/production/source.ts
|
|
9
|
+
var ProductionSourceError = class extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message), this.name = "ProductionSourceError";
|
|
12
|
+
}
|
|
13
|
+
}, ID = /^\d+$/;
|
|
14
|
+
function idText(id) {
|
|
15
|
+
return id.toString();
|
|
16
|
+
}
|
|
17
|
+
function fail(message) {
|
|
18
|
+
throw new ProductionSourceError(`the production source is malformed: ${message}`);
|
|
19
|
+
}
|
|
20
|
+
function nodeId(value) {
|
|
21
|
+
return typeof value != "string" || !ID.test(value) ? fail(`"${String(value)}" is not a node id`) : BigInt(value);
|
|
22
|
+
}
|
|
23
|
+
var ProductionSource = class _ProductionSource {
|
|
24
|
+
constructor(tree) {
|
|
25
|
+
this.byId = /* @__PURE__ */ new Map();
|
|
26
|
+
let visit = (value, parent) => {
|
|
27
|
+
if (typeof value != "object" || value === null || Array.isArray(value)) return fail("a node is not an object");
|
|
28
|
+
let raw = value, id = nodeId(raw.id);
|
|
29
|
+
if (typeof raw.kind != "string") return fail(`node ${id} has no kind`);
|
|
30
|
+
if (this.byId.has(id)) return fail(`node ${id} appears twice`);
|
|
31
|
+
let fields = typeof raw.fields == "object" && raw.fields !== null && !Array.isArray(raw.fields) ? raw.fields : {}, children = [], order = Array.isArray(raw.order) ? raw.order.filter((b) => typeof b == "number") : [], node2 = { id, kind: raw.kind, parent: parent ?? id, order, fields, children };
|
|
32
|
+
this.byId.set(id, node2);
|
|
33
|
+
let list2 = Array.isArray(raw.children) ? raw.children : [];
|
|
34
|
+
for (let child of list2) children.push(visit(child, id));
|
|
35
|
+
return id;
|
|
36
|
+
};
|
|
37
|
+
this.root = visit(tree, null);
|
|
38
|
+
}
|
|
39
|
+
static parse(json) {
|
|
40
|
+
let tree;
|
|
41
|
+
try {
|
|
42
|
+
tree = JSON.parse(json);
|
|
43
|
+
} catch {
|
|
44
|
+
return fail("not JSON");
|
|
45
|
+
}
|
|
46
|
+
return new _ProductionSource(tree);
|
|
47
|
+
}
|
|
48
|
+
get size() {
|
|
49
|
+
return this.byId.size;
|
|
50
|
+
}
|
|
51
|
+
get(id) {
|
|
52
|
+
return this.byId.get(id) ?? null;
|
|
53
|
+
}
|
|
54
|
+
children(parent) {
|
|
55
|
+
return this.byId.get(parent)?.children ?? [];
|
|
56
|
+
}
|
|
57
|
+
field(id, name) {
|
|
58
|
+
return this.byId.get(id)?.fields[name] ?? null;
|
|
59
|
+
}
|
|
60
|
+
isWithin(id, ancestor) {
|
|
61
|
+
let at = this.byId.get(id) ?? null;
|
|
62
|
+
for (; at !== null; ) {
|
|
63
|
+
if (at.id === ancestor) return true;
|
|
64
|
+
if (at.id === this.root) return false;
|
|
65
|
+
at = this.byId.get(at.parent) ?? null;
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
json(id = this.root, depth = 1) {
|
|
70
|
+
let node2 = this.byId.get(id);
|
|
71
|
+
if (node2 === void 0) return null;
|
|
72
|
+
let out = { id: idText(node2.id), kind: node2.kind, fields: node2.fields };
|
|
73
|
+
if (depth <= 0) return out;
|
|
74
|
+
let children = [];
|
|
75
|
+
for (let child of node2.children) {
|
|
76
|
+
let json = this.json(child, depth - 1);
|
|
77
|
+
json !== null && children.push(json);
|
|
78
|
+
}
|
|
79
|
+
return { ...out, children };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// src/interactives/production/documents.ts
|
|
84
|
+
var THING_KIND = "thing", WORLD_KIND = "world", BINDING_KIND = "binding", MUSIC_KIND = "music", CROWD_KIND = "crowd";
|
|
85
|
+
function node(kind, fields, children = []) {
|
|
86
|
+
let kept = {};
|
|
87
|
+
for (let [name, value] of Object.entries(fields)) value != null && (kept[name] = value);
|
|
88
|
+
return { kind, fields: kept, children };
|
|
89
|
+
}
|
|
90
|
+
function num(fields, name, fallback) {
|
|
91
|
+
let value = fields[name];
|
|
92
|
+
return typeof value == "number" ? value : fallback;
|
|
93
|
+
}
|
|
94
|
+
function maybe(fields, name) {
|
|
95
|
+
let value = fields[name];
|
|
96
|
+
return typeof value == "number" ? value : null;
|
|
97
|
+
}
|
|
98
|
+
function text(fields, name, fallback = "") {
|
|
99
|
+
let value = fields[name];
|
|
100
|
+
return typeof value == "string" ? value : fallback;
|
|
101
|
+
}
|
|
102
|
+
function texts(fields, name) {
|
|
103
|
+
let value = fields[name];
|
|
104
|
+
return Array.isArray(value) ? value.filter((item) => typeof item == "string") : [];
|
|
105
|
+
}
|
|
106
|
+
function nums(fields, name) {
|
|
107
|
+
let value = fields[name];
|
|
108
|
+
return Array.isArray(value) ? value.filter((item) => typeof item == "number") : [];
|
|
109
|
+
}
|
|
110
|
+
function vec3(fields, name) {
|
|
111
|
+
let [x = 0, y = 0, z = 0] = nums(fields, name);
|
|
112
|
+
return [x, y, z];
|
|
113
|
+
}
|
|
114
|
+
function point(fields, name) {
|
|
115
|
+
let [x = 0, y = 0] = nums(fields, name);
|
|
116
|
+
return [x, y];
|
|
117
|
+
}
|
|
118
|
+
var CAP_TIERS = ["low", "mid", "high"];
|
|
119
|
+
function of(children, kind) {
|
|
120
|
+
return children.filter((child) => child.kind === kind);
|
|
121
|
+
}
|
|
122
|
+
function shapeFields(shape) {
|
|
123
|
+
switch (shape.kind) {
|
|
124
|
+
case "box":
|
|
125
|
+
return { shape: "box", size: [...shape.size] };
|
|
126
|
+
case "rounded":
|
|
127
|
+
return { shape: "rounded", size: [...shape.size], radius: shape.radius };
|
|
128
|
+
case "sphere":
|
|
129
|
+
return { shape: "sphere", radius: shape.radius };
|
|
130
|
+
case "cylinder":
|
|
131
|
+
return { shape: "cylinder", radius: shape.radius, height: shape.height };
|
|
132
|
+
case "tube":
|
|
133
|
+
return { shape: "tube", radius: shape.radius, length: shape.length };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function shapeOf(fields) {
|
|
137
|
+
let size = vec3(fields, "size"), radius = num(fields, "radius", 0);
|
|
138
|
+
switch (text(fields, "shape")) {
|
|
139
|
+
case "rounded":
|
|
140
|
+
return { kind: "rounded", size, radius };
|
|
141
|
+
case "sphere":
|
|
142
|
+
return { kind: "sphere", radius };
|
|
143
|
+
case "cylinder":
|
|
144
|
+
return { kind: "cylinder", radius, height: num(fields, "height", 0) };
|
|
145
|
+
case "tube":
|
|
146
|
+
return { kind: "tube", radius, length: num(fields, "length", 0) };
|
|
147
|
+
default:
|
|
148
|
+
return { kind: "box", size };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function thingSpec(thing) {
|
|
152
|
+
let parts = thing.parts.map(
|
|
153
|
+
(part) => node("thing_part", { name: part.name, id: part.id, ...shapeFields(part.shape), at: [...part.at], turn: [...part.turn], material: part.material, combine: part.combine, mirror: part.mirror })
|
|
154
|
+
), effects = thing.effects.map(
|
|
155
|
+
(effect) => node("thing_effect", {
|
|
156
|
+
kind: effect.kind,
|
|
157
|
+
at: [...effect.at],
|
|
158
|
+
size: effect.size,
|
|
159
|
+
starts_after: effect.startsAfter ?? null,
|
|
160
|
+
lasts: effect.lasts !== void 0 && effect.lasts > 0 ? effect.lasts : null,
|
|
161
|
+
color: effect.color ?? null,
|
|
162
|
+
sound: effect.sound ?? null
|
|
163
|
+
})
|
|
164
|
+
);
|
|
165
|
+
return node(THING_KIND, { name: thing.name }, [...parts, ...effects]);
|
|
166
|
+
}
|
|
167
|
+
function thingOf(spec) {
|
|
168
|
+
let parts = of(spec.children, "thing_part").map(
|
|
169
|
+
({ fields }) => ({
|
|
170
|
+
id: text(fields, "id"),
|
|
171
|
+
name: text(fields, "name"),
|
|
172
|
+
shape: shapeOf(fields),
|
|
173
|
+
at: vec3(fields, "at"),
|
|
174
|
+
turn: vec3(fields, "turn"),
|
|
175
|
+
material: text(fields, "material"),
|
|
176
|
+
combine: text(fields, "combine", "join"),
|
|
177
|
+
mirror: text(fields, "mirror", "none")
|
|
178
|
+
})
|
|
179
|
+
), effects = of(spec.children, "thing_effect").map(({ fields }) => {
|
|
180
|
+
let effect = { kind: text(fields, "kind", "fire"), at: vec3(fields, "at"), size: num(fields, "size", 0) }, startsAfter = maybe(fields, "starts_after"), lasts = maybe(fields, "lasts"), color = maybe(fields, "color"), sound = fields.sound;
|
|
181
|
+
return {
|
|
182
|
+
...effect,
|
|
183
|
+
...startsAfter === null ? {} : { startsAfter },
|
|
184
|
+
...lasts === null ? {} : { lasts },
|
|
185
|
+
...color === null ? {} : { color },
|
|
186
|
+
sound: typeof sound == "string" ? sound : null
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
return { name: text(spec.fields, "name"), parts, effects };
|
|
190
|
+
}
|
|
191
|
+
function worldSpec(world) {
|
|
192
|
+
let placement = (layer) => (entry) => node("placement", { layer, kind: entry.kind, at: [...entry.at], yaw: entry.yaw }), children = [
|
|
193
|
+
...world.ground.map((stroke) => node("ground_stroke", { op: stroke.op, at: [...stroke.at], radius: stroke.radius, strength: stroke.strength, target: stroke.target, layer: stroke.layer })),
|
|
194
|
+
...world.roads.map(
|
|
195
|
+
(road) => node(
|
|
196
|
+
"road",
|
|
197
|
+
{ width: road.width },
|
|
198
|
+
road.points.map((at) => node("road_point", { at: [...at] }))
|
|
199
|
+
)
|
|
200
|
+
),
|
|
201
|
+
...world.buildings.map(placement("buildings")),
|
|
202
|
+
...world.props.map(placement("props")),
|
|
203
|
+
...world.scatters.map((s) => node("scatter", { layer: s.layer, kinds: [...s.kinds], at: [...s.at], radius: s.radius, count: s.count, spacing: s.spacing, seed: s.seed })),
|
|
204
|
+
...world.crowds.map((c) => node("crowd_area", { at: [...c.at], radius: c.radius, count: c.count, kinds: [...c.kinds] })),
|
|
205
|
+
...world.lights.map((l) => node("world_light", { at: [...l.at], height: l.height, color: l.color, intensity: l.intensity })),
|
|
206
|
+
...world.sounds.map((s) => node("sound_zone", { at: [...s.at], radius: s.radius, sound: s.sound })),
|
|
207
|
+
...world.gates.map((at) => node("gate", { at: [...at] })),
|
|
208
|
+
...CAP_TIERS.flatMap((tier) => {
|
|
209
|
+
let cap = world.crowdCaps?.[tier];
|
|
210
|
+
return cap == null ? [] : [node("crowd_cap", { tier, cap })];
|
|
211
|
+
})
|
|
212
|
+
];
|
|
213
|
+
return node(WORLD_KIND, { name: world.name, place: world.place, size: [...world.size], hour: world.sky.hour, weather: world.sky.weather, day_minutes: world.sky.dayMinutes }, children);
|
|
214
|
+
}
|
|
215
|
+
function worldOf(spec) {
|
|
216
|
+
let f = spec.fields, placements = (layer) => of(spec.children, "placement").filter((child) => text(child.fields, "layer") === layer).map(({ fields }) => ({ kind: text(fields, "kind"), at: point(fields, "at"), yaw: num(fields, "yaw", 0) })), caps = {};
|
|
217
|
+
for (let { fields } of of(spec.children, "crowd_cap")) {
|
|
218
|
+
let tier = text(fields, "tier");
|
|
219
|
+
CAP_TIERS.includes(tier) && (caps[tier] = num(fields, "cap", 0));
|
|
220
|
+
}
|
|
221
|
+
let place = f.place;
|
|
222
|
+
return {
|
|
223
|
+
name: text(f, "name"),
|
|
224
|
+
place: typeof place == "string" ? place : null,
|
|
225
|
+
size: point(f, "size"),
|
|
226
|
+
ground: of(spec.children, "ground_stroke").map(
|
|
227
|
+
({ fields }) => ({
|
|
228
|
+
op: text(fields, "op", "raise"),
|
|
229
|
+
at: point(fields, "at"),
|
|
230
|
+
radius: num(fields, "radius", 0),
|
|
231
|
+
strength: num(fields, "strength", 0),
|
|
232
|
+
target: maybe(fields, "target"),
|
|
233
|
+
layer: num(fields, "layer", 0)
|
|
234
|
+
})
|
|
235
|
+
),
|
|
236
|
+
roads: of(spec.children, "road").map(({ fields, children }) => ({ points: of(children, "road_point").map((p) => point(p.fields, "at")), width: num(fields, "width", 0) })),
|
|
237
|
+
buildings: placements("buildings"),
|
|
238
|
+
props: placements("props"),
|
|
239
|
+
scatters: of(spec.children, "scatter").map(
|
|
240
|
+
({ fields }) => ({
|
|
241
|
+
layer: text(fields, "layer", "props"),
|
|
242
|
+
kinds: texts(fields, "kinds"),
|
|
243
|
+
at: point(fields, "at"),
|
|
244
|
+
radius: num(fields, "radius", 0),
|
|
245
|
+
count: num(fields, "count", 0),
|
|
246
|
+
spacing: num(fields, "spacing", 0),
|
|
247
|
+
seed: num(fields, "seed", 0)
|
|
248
|
+
})
|
|
249
|
+
),
|
|
250
|
+
crowds: of(spec.children, "crowd_area").map(({ fields }) => ({ at: point(fields, "at"), radius: num(fields, "radius", 0), count: num(fields, "count", 0), kinds: texts(fields, "kinds") })),
|
|
251
|
+
lights: of(spec.children, "world_light").map(({ fields }) => ({ at: point(fields, "at"), height: num(fields, "height", 0), color: num(fields, "color", 0), intensity: num(fields, "intensity", 0) })),
|
|
252
|
+
sounds: of(spec.children, "sound_zone").map(({ fields }) => ({ at: point(fields, "at"), radius: num(fields, "radius", 0), sound: text(fields, "sound") })),
|
|
253
|
+
gates: of(spec.children, "gate").map((gate) => point(gate.fields, "at")),
|
|
254
|
+
sky: { hour: num(f, "hour", 0), weather: text(f, "weather", "clear"), dayMinutes: num(f, "day_minutes", 0) },
|
|
255
|
+
...Object.keys(caps).length > 0 ? { crowdCaps: caps } : {}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function stepSpec(step) {
|
|
259
|
+
switch (step.kind) {
|
|
260
|
+
case "pop":
|
|
261
|
+
return node("motion_step", { kind: step.kind, seconds: step.seconds, scale: step.scale });
|
|
262
|
+
case "flash":
|
|
263
|
+
return node("motion_step", { kind: step.kind, seconds: step.seconds, color: step.color });
|
|
264
|
+
default:
|
|
265
|
+
return node("motion_step", { kind: step.kind, seconds: step.seconds });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function stepOf({ fields }) {
|
|
269
|
+
let seconds = num(fields, "seconds", 0);
|
|
270
|
+
switch (text(fields, "kind")) {
|
|
271
|
+
case "pop":
|
|
272
|
+
return { kind: "pop", scale: num(fields, "scale", 1), seconds };
|
|
273
|
+
case "flash":
|
|
274
|
+
return { kind: "flash", color: num(fields, "color", 0), seconds };
|
|
275
|
+
case "settle":
|
|
276
|
+
return { kind: "settle", seconds };
|
|
277
|
+
default:
|
|
278
|
+
return { kind: "count_up", seconds };
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function bindingSpec(name, binding) {
|
|
282
|
+
let motions = (binding.motions ?? []).map((motion) => node("motion", { on: motion.on, when: motion.when }, motion.steps.map(stepSpec)));
|
|
283
|
+
return node(BINDING_KIND, { name, shows: binding.shows, as: binding.as, format: binding.format ?? null, decimals: binding.decimals ?? null, vector_path: binding.vectorPath ?? null }, motions);
|
|
284
|
+
}
|
|
285
|
+
function bindingOf(spec) {
|
|
286
|
+
let f = spec.fields, motions = of(spec.children, "motion").map(({ fields, children }) => {
|
|
287
|
+
let when = fields.when;
|
|
288
|
+
return { on: text(fields, "on", "change"), when: typeof when == "string" ? when : null, steps: of(children, "motion_step").map(stepOf) };
|
|
289
|
+
}), format = f.format, decimals = maybe(f, "decimals"), vectorPath = f.vector_path, binding = {
|
|
290
|
+
shows: text(f, "shows"),
|
|
291
|
+
as: text(f, "as", "number"),
|
|
292
|
+
...typeof format == "string" ? { format } : {},
|
|
293
|
+
...decimals === null ? {} : { decimals },
|
|
294
|
+
...typeof vectorPath == "string" ? { vectorPath } : {},
|
|
295
|
+
...motions.length > 0 ? { motions } : {}
|
|
296
|
+
};
|
|
297
|
+
return { name: text(f, "name"), binding };
|
|
298
|
+
}
|
|
299
|
+
function musicSpec(music) {
|
|
300
|
+
return node(
|
|
301
|
+
MUSIC_KIND,
|
|
302
|
+
{ bpm: music.bpm, beats_per_bar: music.beatsPerBar, bars: music.bars, follows_path: music.follows.path, follows_wraps: music.follows.wraps, ramp_seconds: music.rampSeconds },
|
|
303
|
+
[
|
|
304
|
+
...music.stems.map((stem) => node("stem", { id: stem.id, sound: stem.sound, label: stem.label })),
|
|
305
|
+
...music.moods.map((mood) => node("mood", { id: mood.id, label: mood.label, bpm: mood.bpm, layer_names: Object.keys(mood.layers), layer_gains: Object.values(mood.layers) })),
|
|
306
|
+
...music.follows.bands.map((band) => node("mood_band", { from: band.from, to: band.to, mood: band.mood })),
|
|
307
|
+
...music.cues.map((cue) => node("cue", { moment: cue.moment, sound: cue.sound, quantize: cue.quantize, gain: cue.gain }))
|
|
308
|
+
]
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
function musicOf(spec) {
|
|
312
|
+
let f = spec.fields;
|
|
313
|
+
return {
|
|
314
|
+
bpm: num(f, "bpm", 0),
|
|
315
|
+
beatsPerBar: num(f, "beats_per_bar", 0),
|
|
316
|
+
bars: num(f, "bars", 0),
|
|
317
|
+
stems: of(spec.children, "stem").map(({ fields }) => ({ id: text(fields, "id"), sound: text(fields, "sound"), label: text(fields, "label") })),
|
|
318
|
+
moods: of(spec.children, "mood").map(({ fields }) => {
|
|
319
|
+
let names = texts(fields, "layer_names"), gains = nums(fields, "layer_gains"), layers = {};
|
|
320
|
+
return names.forEach((name, i) => {
|
|
321
|
+
layers[name] = gains[i] ?? 0;
|
|
322
|
+
}), { id: text(fields, "id"), label: text(fields, "label"), bpm: maybe(fields, "bpm"), layers };
|
|
323
|
+
}),
|
|
324
|
+
follows: { path: text(f, "follows_path"), wraps: maybe(f, "follows_wraps"), bands: of(spec.children, "mood_band").map(({ fields }) => ({ from: num(fields, "from", 0), to: num(fields, "to", 0), mood: text(fields, "mood") })) },
|
|
325
|
+
cues: of(spec.children, "cue").map(({ fields }) => ({ moment: text(fields, "moment"), sound: text(fields, "sound"), quantize: text(fields, "quantize", "now"), gain: num(fields, "gain", 0) })),
|
|
326
|
+
rampSeconds: num(f, "ramp_seconds", 0)
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function crowdSpec(crowd) {
|
|
330
|
+
return node(
|
|
331
|
+
CROWD_KIND,
|
|
332
|
+
{ cheer_on: crowd.cheer.on, cheer_per_tap: crowd.cheer.perTap, cheer_drain_per_second: crowd.cheer.drainPerSecond, max_watchers: crowd.maxWatchers },
|
|
333
|
+
[
|
|
334
|
+
...crowd.votes.map((vote) => node("vote", { id: vote.id, question: vote.question, choices: [...vote.choices], opens_on: vote.opensOn, seconds: vote.seconds })),
|
|
335
|
+
...crowd.gifts.map((gift) => node("gift", { gift: gift.gift, moment: gift.moment, label: gift.label }))
|
|
336
|
+
]
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
function crowdOf(spec) {
|
|
340
|
+
let f = spec.fields;
|
|
341
|
+
return {
|
|
342
|
+
votes: of(spec.children, "vote").map(({ fields }) => ({ id: text(fields, "id"), question: text(fields, "question"), choices: texts(fields, "choices"), opensOn: text(fields, "opens_on"), seconds: num(fields, "seconds", 0) })),
|
|
343
|
+
gifts: of(spec.children, "gift").map(({ fields }) => ({ gift: text(fields, "gift"), moment: text(fields, "moment"), label: text(fields, "label") })),
|
|
344
|
+
cheer: { on: f.cheer_on === true, perTap: num(f, "cheer_per_tap", 0), drainPerSecond: num(f, "cheer_drain_per_second", 0) },
|
|
345
|
+
maxWatchers: num(f, "max_watchers", 0)
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function specAt(source, id) {
|
|
349
|
+
let found = source.get(id);
|
|
350
|
+
if (found === null) return null;
|
|
351
|
+
let children = [];
|
|
352
|
+
for (let child of found.children) {
|
|
353
|
+
let spec = specAt(source, child);
|
|
354
|
+
spec !== null && children.push(spec);
|
|
355
|
+
}
|
|
356
|
+
return { kind: found.kind, fields: found.fields, children };
|
|
357
|
+
}
|
|
358
|
+
function documentsOf(source, kind) {
|
|
359
|
+
let out = [];
|
|
360
|
+
for (let child of source.children(source.root)) {
|
|
361
|
+
let spec = specAt(source, child);
|
|
362
|
+
spec !== null && spec.kind === kind && out.push({ id: idText(child), spec });
|
|
363
|
+
}
|
|
364
|
+
return out;
|
|
365
|
+
}
|
|
366
|
+
function canonical(value) {
|
|
367
|
+
if (Array.isArray(value)) return value.map(canonical);
|
|
368
|
+
if (typeof value != "object" || value === null) return value;
|
|
369
|
+
let out = {};
|
|
370
|
+
for (let key of Object.keys(value).sort()) out[key] = canonical(value[key]);
|
|
371
|
+
return out;
|
|
372
|
+
}
|
|
373
|
+
function same(a, b) {
|
|
374
|
+
return JSON.stringify(canonical(a)) === JSON.stringify(canonical(b));
|
|
375
|
+
}
|
|
376
|
+
function createAll(spec, parent, id, newId, out) {
|
|
377
|
+
out.push({ op: "create", kind: spec.kind, id, parent, fields: spec.fields });
|
|
378
|
+
for (let child of spec.children) createAll(child, id, newId(), newId, out);
|
|
379
|
+
}
|
|
380
|
+
function documentRequests(source, id, spec, newId) {
|
|
381
|
+
let out = [], current = specAt(source, BigInt(id));
|
|
382
|
+
if (current === null)
|
|
383
|
+
return createAll(spec, idText(source.root), id, newId, out), out;
|
|
384
|
+
for (let name of /* @__PURE__ */ new Set([...Object.keys(current.fields), ...Object.keys(spec.fields)])) {
|
|
385
|
+
let next = spec.fields[name];
|
|
386
|
+
next === void 0 ? out.push({ op: "set", id, field: name, value: null }) : same(current.fields[name], next) || out.push({ op: "set", id, field: name, value: next });
|
|
387
|
+
}
|
|
388
|
+
if (!same(current.children, spec.children)) {
|
|
389
|
+
for (let child of source.children(BigInt(id))) out.push({ op: "remove", id: idText(child) });
|
|
390
|
+
for (let child of spec.children) createAll(child, id, newId(), newId, out);
|
|
391
|
+
}
|
|
392
|
+
return out;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// src/interactives/production/edit.ts
|
|
396
|
+
var ProductionEditError = class extends Error {
|
|
397
|
+
constructor(message) {
|
|
398
|
+
super(message), this.name = "ProductionEditError";
|
|
399
|
+
}
|
|
400
|
+
}, DIGEST_BYTES = 32, DIGEST_HEX = /^[0-9a-f]{64}$/i, RGB_HEX = /^#([0-9a-f]{6})$/i, DECIMAL = /^-?\d+$/, ID2 = /^\d+$/, HEX_RADIX = 16, MAX_COLOR = 4294967295, MAX_BYTE = 255, COMPONENTS = { vec2: 2, vec3: 3, quat: 4 };
|
|
401
|
+
function fail2(message) {
|
|
402
|
+
throw new ProductionEditError(message);
|
|
403
|
+
}
|
|
404
|
+
function parseId(value) {
|
|
405
|
+
return typeof value == "bigint" && value >= 0n ? value : typeof value == "number" && Number.isSafeInteger(value) && value >= 0 || typeof value == "string" && ID2.test(value) ? BigInt(value) : fail2(`"${String(value)}" is not a node id`);
|
|
406
|
+
}
|
|
407
|
+
function finiteList(value, what, length) {
|
|
408
|
+
return !Array.isArray(value) || length !== null && value.length !== length || !value.every((x) => typeof x == "number" && Number.isFinite(x)) ? fail2(length === null ? `${what} takes a list of finite numbers` : `${what} takes ${length} finite numbers`) : value;
|
|
409
|
+
}
|
|
410
|
+
function integer(value, what) {
|
|
411
|
+
return typeof value == "number" && Number.isSafeInteger(value) ? String(value) : typeof value == "string" && DECIMAL.test(value) ? value : fail2(`${what} takes a whole number`);
|
|
412
|
+
}
|
|
413
|
+
function digest(value, what) {
|
|
414
|
+
return typeof value == "string" && DIGEST_HEX.test(value) ? value.toLowerCase() : Array.isArray(value) && value.length === (32) && value.every((b) => typeof b == "number" && Number.isInteger(b) && b >= 0 && b <= (255)) ? value.map((b) => b.toString((16)).padStart(2, "0")).join("") : fail2(`${what} takes a ${(32) * 2}-character hex digest`);
|
|
415
|
+
}
|
|
416
|
+
function typed(spec, value) {
|
|
417
|
+
let what = spec.name;
|
|
418
|
+
switch (spec.type) {
|
|
419
|
+
case "bool":
|
|
420
|
+
return typeof value != "boolean" ? fail2(`${what} takes true or false`) : value;
|
|
421
|
+
case "int":
|
|
422
|
+
case "time":
|
|
423
|
+
return integer(value, what);
|
|
424
|
+
case "num":
|
|
425
|
+
return typeof value != "number" || !Number.isFinite(value) ? fail2(`${what} takes a finite number`) : value;
|
|
426
|
+
case "text":
|
|
427
|
+
return typeof value != "string" ? fail2(`${what} takes text`) : value;
|
|
428
|
+
case "digest":
|
|
429
|
+
return digest(value, what);
|
|
430
|
+
case "ref":
|
|
431
|
+
return idText(parseId(value));
|
|
432
|
+
case "vec2":
|
|
433
|
+
case "vec3":
|
|
434
|
+
case "quat":
|
|
435
|
+
return finiteList(value, what, COMPONENTS[spec.type]);
|
|
436
|
+
case "nums":
|
|
437
|
+
return finiteList(value, what, null);
|
|
438
|
+
case "texts":
|
|
439
|
+
return !Array.isArray(value) || !value.every((x) => typeof x == "string") ? fail2(`${what} takes a list of text`) : value;
|
|
440
|
+
case "color": {
|
|
441
|
+
if (typeof value == "string") {
|
|
442
|
+
let match = RGB_HEX.exec(value);
|
|
443
|
+
return match === null ? fail2(`${what} takes a colour like #10b981`) : Number.parseInt(match[1], (16));
|
|
444
|
+
}
|
|
445
|
+
return typeof value != "number" || !Number.isInteger(value) || value < 0 || value > (4294967295) ? fail2(`${what} takes a colour`) : value;
|
|
446
|
+
}
|
|
447
|
+
default:
|
|
448
|
+
return fail2(`${what} holds a ${spec.type}, which this version cannot write`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function numbersOf(value) {
|
|
452
|
+
return typeof value == "number" ? [value] : typeof value == "string" && DECIMAL.test(value) ? [Number(value)] : Array.isArray(value) ? value.filter((x) => typeof x == "number") : [];
|
|
453
|
+
}
|
|
454
|
+
function limited(spec, value) {
|
|
455
|
+
let limit = spec.limit;
|
|
456
|
+
if (limit === null) return;
|
|
457
|
+
let what = spec.name;
|
|
458
|
+
switch (limit.kind) {
|
|
459
|
+
case "one_of":
|
|
460
|
+
(typeof value != "string" || !limit.names.includes(value)) && fail2(`${what} is one of ${limit.names.join(", ")}`);
|
|
461
|
+
return;
|
|
462
|
+
case "positive":
|
|
463
|
+
numbersOf(value).every((x) => x > 0) || fail2(`${what} must be above 0`);
|
|
464
|
+
return;
|
|
465
|
+
case "non_negative":
|
|
466
|
+
numbersOf(value).every((x) => x >= 0) || fail2(`${what} cannot be below 0`);
|
|
467
|
+
return;
|
|
468
|
+
case "range":
|
|
469
|
+
numbersOf(value).every((x) => x >= limit.min && x <= limit.max) || fail2(`${what} runs from ${limit.min} to ${limit.max}`);
|
|
470
|
+
return;
|
|
471
|
+
case "items":
|
|
472
|
+
(!Array.isArray(value) || value.length > limit.max) && fail2(`${what} holds at most ${limit.max} items`);
|
|
473
|
+
return;
|
|
474
|
+
case "codes":
|
|
475
|
+
numbersOf(value).every((x) => Number.isInteger(x) && x >= 0 && x < limit.names.length) || fail2(`${what} is one of ${limit.names.join(", ")}`);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function coded(spec, value) {
|
|
480
|
+
if (spec.limit?.kind !== "codes" || typeof value != "string" || DECIMAL.test(value)) return value;
|
|
481
|
+
let code = spec.limit.names.indexOf(value);
|
|
482
|
+
return code < 0 ? fail2(`${spec.name} is one of ${spec.limit.names.join(", ")}`) : code;
|
|
483
|
+
}
|
|
484
|
+
function valueFor(kinds, kind, field, value) {
|
|
485
|
+
let spec = kinds.field(kind, field);
|
|
486
|
+
if (spec === null) return fail2(`a ${kind} has no field "${field}"`);
|
|
487
|
+
let out = typed(spec, coded(spec, value));
|
|
488
|
+
return limited(spec, out), { type: spec.type, value: out };
|
|
489
|
+
}
|
|
490
|
+
var ProductionEdit = class {
|
|
491
|
+
constructor(source, kinds, ids) {
|
|
492
|
+
this.source = source;
|
|
493
|
+
this.kinds = kinds;
|
|
494
|
+
this.ids = ids;
|
|
495
|
+
this.list = [];
|
|
496
|
+
this.placed = /* @__PURE__ */ new Map();
|
|
497
|
+
this.removed = /* @__PURE__ */ new Set();
|
|
498
|
+
}
|
|
499
|
+
get changes() {
|
|
500
|
+
return this.list;
|
|
501
|
+
}
|
|
502
|
+
get size() {
|
|
503
|
+
return this.list.length;
|
|
504
|
+
}
|
|
505
|
+
kindOf(id) {
|
|
506
|
+
return this.removed.has(id) ? null : this.placed.get(id)?.kind ?? this.source.get(id)?.kind ?? null;
|
|
507
|
+
}
|
|
508
|
+
parentOf(id) {
|
|
509
|
+
return id === this.source.root ? null : this.placed.get(id)?.parent ?? this.source.get(id)?.parent ?? null;
|
|
510
|
+
}
|
|
511
|
+
exists(id) {
|
|
512
|
+
for (let at = id; at !== null; at = this.parentOf(at))
|
|
513
|
+
if (this.removed.has(at) || this.kindOf(at) === null) return false;
|
|
514
|
+
return true;
|
|
515
|
+
}
|
|
516
|
+
within(id, ancestor) {
|
|
517
|
+
for (let at = id; at !== null; at = this.parentOf(at)) if (at === ancestor) return true;
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
checkParent(kind, parent) {
|
|
521
|
+
let parentKind = this.exists(parent) ? this.kindOf(parent) : null;
|
|
522
|
+
parentKind === null && fail2(`node ${parent} does not exist`), this.kinds.parentAllowed(kind, parentKind) || fail2(`a ${kind} cannot go inside a ${parentKind}`);
|
|
523
|
+
}
|
|
524
|
+
sibling(parent, sibling, moving) {
|
|
525
|
+
if (sibling != null)
|
|
526
|
+
return (sibling === moving || !this.exists(sibling) || this.parentOf(sibling) !== parent) && fail2(`node ${sibling} is not a child of ${parent}`), idText(sibling);
|
|
527
|
+
}
|
|
528
|
+
placement(parent, place, moving) {
|
|
529
|
+
place.after !== void 0 && place.after !== null && place.before !== void 0 && place.before !== null && fail2("place a thing after a sibling or before one, not both");
|
|
530
|
+
let after = this.sibling(parent, place.after, moving), before = this.sibling(parent, place.before, moving);
|
|
531
|
+
return after !== void 0 ? { after } : before !== void 0 ? { before } : {};
|
|
532
|
+
}
|
|
533
|
+
create(kind, parent, fields = {}, place = {}, named = null) {
|
|
534
|
+
this.kinds.has(kind) || fail2(`"${kind}" is not a kind of thing`), this.checkParent(kind, parent);
|
|
535
|
+
let values = Object.entries(fields).map(([name, value]) => [this.kinds.field(kind, name)?.key ?? -1, valueFor(this.kinds, kind, name, value)]), where = this.placement(parent, place, null);
|
|
536
|
+
named !== null && (this.placed.has(named) || this.source.get(named) !== null) && fail2(`node ${named} already exists`);
|
|
537
|
+
let id = named ?? this.ids.newId();
|
|
538
|
+
this.placed.set(id, { kind, parent }), this.list.push({ op: "create", id: idText(id), kind, parent: idText(parent), ...where });
|
|
539
|
+
for (let [key, value] of values) this.list.push({ op: "set", id: idText(id), field: key, value });
|
|
540
|
+
return id;
|
|
541
|
+
}
|
|
542
|
+
set(id, field, value) {
|
|
543
|
+
let kind = this.exists(id) ? this.kindOf(id) : null;
|
|
544
|
+
kind === null && fail2(`node ${id} does not exist`);
|
|
545
|
+
let spec = this.kinds.field(kind, field);
|
|
546
|
+
spec === null && fail2(`a ${kind} has no field "${field}"`), this.list.push({ op: "set", id: idText(id), field: spec.key, value: value === null ? null : valueFor(this.kinds, kind, field, value) });
|
|
547
|
+
}
|
|
548
|
+
move(id, parent, place = {}) {
|
|
549
|
+
id === this.source.root && fail2("the production root cannot move");
|
|
550
|
+
let kind = this.exists(id) ? this.kindOf(id) : null;
|
|
551
|
+
kind === null && fail2(`node ${id} does not exist`), this.checkParent(kind, parent), this.within(parent, id) && fail2("a thing cannot move inside itself");
|
|
552
|
+
let where = this.placement(parent, place, id);
|
|
553
|
+
this.placed.set(id, { kind, parent }), this.list.push({ op: "move", id: idText(id), parent: idText(parent), ...where });
|
|
554
|
+
}
|
|
555
|
+
remove(id) {
|
|
556
|
+
id === this.source.root && fail2("the production root cannot be removed"), this.exists(id) || fail2(`node ${id} does not exist`), this.removed.add(id), this.list.push({ op: "delete", id: idText(id) });
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// src/interactives/production/kinds.ts
|
|
561
|
+
var ProductionKindsError = class extends Error {
|
|
562
|
+
constructor(message) {
|
|
563
|
+
super(message), this.name = "ProductionKindsError";
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
function fail3(message) {
|
|
567
|
+
throw new ProductionKindsError(`the production kinds are malformed: ${message}`);
|
|
568
|
+
}
|
|
569
|
+
function record(value, what) {
|
|
570
|
+
return typeof value != "object" || value === null || Array.isArray(value) ? fail3(`${what} is not an object`) : value;
|
|
571
|
+
}
|
|
572
|
+
function list(value, what) {
|
|
573
|
+
return Array.isArray(value) ? value : fail3(`${what} is not a list`);
|
|
574
|
+
}
|
|
575
|
+
function text2(value, what) {
|
|
576
|
+
return typeof value != "string" ? fail3(`${what} is not text`) : value;
|
|
577
|
+
}
|
|
578
|
+
function whole(value, what) {
|
|
579
|
+
return typeof value != "number" || !Number.isSafeInteger(value) || value < 0 ? fail3(`${what} is not a whole number`) : value;
|
|
580
|
+
}
|
|
581
|
+
function finite(value, what) {
|
|
582
|
+
return typeof value != "number" || !Number.isFinite(value) ? fail3(`${what} is not a number`) : value;
|
|
583
|
+
}
|
|
584
|
+
function limitOf(value, what) {
|
|
585
|
+
if (value == null) return null;
|
|
586
|
+
let raw = record(value, what);
|
|
587
|
+
switch (raw.kind) {
|
|
588
|
+
case "one_of":
|
|
589
|
+
case "codes":
|
|
590
|
+
return { kind: raw.kind, names: list(raw.names, `${what}.names`).map((name, i) => text2(name, `${what}.names[${i}]`)) };
|
|
591
|
+
case "positive":
|
|
592
|
+
case "non_negative":
|
|
593
|
+
return { kind: raw.kind };
|
|
594
|
+
case "range":
|
|
595
|
+
return { kind: "range", min: finite(raw.min, `${what}.min`), max: finite(raw.max, `${what}.max`) };
|
|
596
|
+
case "items":
|
|
597
|
+
return { kind: "items", max: whole(raw.max, `${what}.max`) };
|
|
598
|
+
default:
|
|
599
|
+
return fail3(`${what} has an unknown limit`);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
function kindOf(value, index) {
|
|
603
|
+
let what = `kind ${index}`, raw = record(value, what), name = text2(raw.name, `${what}.name`);
|
|
604
|
+
return {
|
|
605
|
+
code: whole(raw.code, `${name}.code`),
|
|
606
|
+
name,
|
|
607
|
+
parents: list(raw.parents, `${name}.parents`).map((parent, i) => text2(parent, `${name}.parents[${i}]`)),
|
|
608
|
+
document: raw.document === true,
|
|
609
|
+
fields: list(raw.fields, `${name}.fields`).map((field, i) => {
|
|
610
|
+
let at = `${name}.fields[${i}]`, spec = record(field, at);
|
|
611
|
+
return { key: whole(spec.key, `${at}.key`), name: text2(spec.name, `${at}.name`), type: text2(spec.type, `${at}.type`), limit: limitOf(spec.limit, `${at}.limit`) };
|
|
612
|
+
})
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
var ProductionKinds = class _ProductionKinds {
|
|
616
|
+
constructor(list2) {
|
|
617
|
+
this.list = list2;
|
|
618
|
+
this.byName = /* @__PURE__ */ new Map();
|
|
619
|
+
for (let kind of list2) this.byName.set(kind.name, kind);
|
|
620
|
+
}
|
|
621
|
+
static parse(json) {
|
|
622
|
+
let raw;
|
|
623
|
+
try {
|
|
624
|
+
raw = JSON.parse(json);
|
|
625
|
+
} catch {
|
|
626
|
+
return fail3("not JSON");
|
|
627
|
+
}
|
|
628
|
+
return new _ProductionKinds(list(raw, "the kind list").map(kindOf));
|
|
629
|
+
}
|
|
630
|
+
get names() {
|
|
631
|
+
return this.list.map((kind) => kind.name);
|
|
632
|
+
}
|
|
633
|
+
get editable() {
|
|
634
|
+
return this.list.filter((kind) => kind.parents.length > 0).map((kind) => kind.name);
|
|
635
|
+
}
|
|
636
|
+
has(name) {
|
|
637
|
+
return typeof name == "string" && this.byName.has(name);
|
|
638
|
+
}
|
|
639
|
+
kind(name) {
|
|
640
|
+
return this.byName.get(name) ?? null;
|
|
641
|
+
}
|
|
642
|
+
field(kind, name) {
|
|
643
|
+
return this.byName.get(kind)?.fields.find((field) => field.name === name) ?? null;
|
|
644
|
+
}
|
|
645
|
+
fieldByKey(kind, key) {
|
|
646
|
+
return this.byName.get(kind)?.fields.find((field) => field.key === key) ?? null;
|
|
647
|
+
}
|
|
648
|
+
parentAllowed(kind, parent) {
|
|
649
|
+
return this.byName.get(kind)?.parents.includes(parent) ?? false;
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
// src/interactives/production/limits.ts
|
|
654
|
+
var EVERY_KIND = "every", PLUGIN_LIMITS = {
|
|
655
|
+
origin: "plugin",
|
|
656
|
+
kinds: EVERY_KIND,
|
|
657
|
+
fields: {},
|
|
658
|
+
create: true,
|
|
659
|
+
remove: true,
|
|
660
|
+
move: true,
|
|
661
|
+
maxChanges: 200,
|
|
662
|
+
maxCreates: 50,
|
|
663
|
+
maxTextBytes: 4096
|
|
664
|
+
}, OUTSIDE_AGENT_LIMITS = {
|
|
665
|
+
origin: "system",
|
|
666
|
+
kinds: EVERY_KIND,
|
|
667
|
+
fields: {},
|
|
668
|
+
create: true,
|
|
669
|
+
remove: true,
|
|
670
|
+
move: true,
|
|
671
|
+
maxChanges: 500,
|
|
672
|
+
maxCreates: 200,
|
|
673
|
+
maxTextBytes: 16384
|
|
674
|
+
}, PERSON_LIMITS = {
|
|
675
|
+
origin: "person",
|
|
676
|
+
kinds: EVERY_KIND,
|
|
677
|
+
fields: {},
|
|
678
|
+
create: true,
|
|
679
|
+
remove: true,
|
|
680
|
+
move: true,
|
|
681
|
+
maxChanges: 2e4,
|
|
682
|
+
maxCreates: 1e4,
|
|
683
|
+
maxTextBytes: 16384,
|
|
684
|
+
root: true
|
|
685
|
+
}, READ_ONLY_LIMITS = {
|
|
686
|
+
...PLUGIN_LIMITS,
|
|
687
|
+
kinds: [],
|
|
688
|
+
create: false,
|
|
689
|
+
remove: false,
|
|
690
|
+
move: false,
|
|
691
|
+
maxChanges: 0,
|
|
692
|
+
maxCreates: 0
|
|
693
|
+
};
|
|
694
|
+
function narrowLimits(base, granted) {
|
|
695
|
+
let wanted = granted.kinds ?? base.kinds, kinds = base.kinds === EVERY_KIND ? wanted : wanted === EVERY_KIND ? base.kinds : wanted.filter((kind) => base.kinds.includes(kind));
|
|
696
|
+
return {
|
|
697
|
+
origin: base.origin,
|
|
698
|
+
kinds,
|
|
699
|
+
fields: { ...base.fields, ...granted.fields },
|
|
700
|
+
create: base.create && (granted.create ?? true),
|
|
701
|
+
remove: base.remove && (granted.remove ?? true),
|
|
702
|
+
move: base.move && (granted.move ?? true),
|
|
703
|
+
maxChanges: Math.min(base.maxChanges, granted.maxChanges ?? base.maxChanges),
|
|
704
|
+
maxCreates: Math.min(base.maxCreates, granted.maxCreates ?? base.maxCreates),
|
|
705
|
+
maxTextBytes: Math.min(base.maxTextBytes, granted.maxTextBytes ?? base.maxTextBytes),
|
|
706
|
+
root: base.root === true && (granted.root ?? true)
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
function textBytes(value) {
|
|
710
|
+
let encoder = new TextEncoder();
|
|
711
|
+
return typeof value == "string" ? encoder.encode(value).length : Array.isArray(value) ? value.reduce((sum, item) => sum + (typeof item == "string" ? encoder.encode(item).length : 0), 0) : 0;
|
|
712
|
+
}
|
|
713
|
+
function checkLimits(changes, limits, kinds, kindOf2) {
|
|
714
|
+
let refusals = [];
|
|
715
|
+
changes.length > limits.maxChanges && refusals.push({ index: limits.maxChanges, reason: `at most ${limits.maxChanges} changes at a time` });
|
|
716
|
+
let allowed = (kind2) => limits.kinds === EVERY_KIND ? kinds.editable.includes(kind2) : limits.kinds.includes(kind2), creates = 0, createdKinds = /* @__PURE__ */ new Map(), kind = (id) => createdKinds.get(id) ?? kindOf2(id);
|
|
717
|
+
return changes.forEach((change, index) => {
|
|
718
|
+
let refuse = (reason) => refusals.push({ index, reason });
|
|
719
|
+
switch (change.op) {
|
|
720
|
+
case "create":
|
|
721
|
+
createdKinds.set(change.id, change.kind), limits.create ? ++creates > limits.maxCreates && refuse(`at most ${limits.maxCreates} new things at a time`) : refuse("cannot add new things"), allowed(change.kind) || refuse(`cannot add a ${change.kind}`);
|
|
722
|
+
return;
|
|
723
|
+
case "delete": {
|
|
724
|
+
let k = kind(change.id);
|
|
725
|
+
limits.remove || refuse("cannot remove things"), k !== null && !allowed(k) && refuse(`cannot remove a ${k}`);
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
case "move": {
|
|
729
|
+
let k = kind(change.id);
|
|
730
|
+
limits.move || refuse("cannot move things"), k !== null && !allowed(k) && refuse(`cannot move a ${k}`);
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
case "set": {
|
|
734
|
+
let k = kind(change.id);
|
|
735
|
+
if (k === null) return;
|
|
736
|
+
if (kinds.kind(k)?.parents.length === 0 ? limits.root !== true : !allowed(k)) {
|
|
737
|
+
refuse(`cannot change a ${k}`);
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
let spec = kinds.fieldByKey(k, change.field), fields = limits.fields[k];
|
|
741
|
+
spec !== null && fields !== void 0 && !fields.includes(spec.name) && refuse(`cannot change the ${spec.name} of a ${k}`), change.value !== null && (change.value.type === "text" || change.value.type === "texts") && textBytes(change.value.value) > limits.maxTextBytes && refuse(`text longer than ${limits.maxTextBytes} bytes`);
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}), refusals;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// src/interactives/production/operations.ts
|
|
749
|
+
var NEW_REF_PREFIX = "$", NEW_REF = /^\$(\d+)$/, ProductionOperations = class {
|
|
750
|
+
constructor(target, author, limits) {
|
|
751
|
+
this.target = target;
|
|
752
|
+
this.author = author;
|
|
753
|
+
this.limits = limits;
|
|
754
|
+
}
|
|
755
|
+
get kinds() {
|
|
756
|
+
return this.target.kinds;
|
|
757
|
+
}
|
|
758
|
+
snapshot() {
|
|
759
|
+
return ProductionSource.parse(this.target.sourceJson());
|
|
760
|
+
}
|
|
761
|
+
read(id = null, depth = 1) {
|
|
762
|
+
let source = this.snapshot();
|
|
763
|
+
return source.json(id === null ? source.root : parseId(id), depth);
|
|
764
|
+
}
|
|
765
|
+
apply(requests2) {
|
|
766
|
+
let source = this.snapshot(), edit = new ProductionEdit(source, this.target.kinds, { newId: () => this.target.newId(this.author) }), created = [], resolve = (ref) => {
|
|
767
|
+
let match = typeof ref == "string" ? NEW_REF.exec(ref) : null;
|
|
768
|
+
if (match === null) return parseId(ref);
|
|
769
|
+
let id = created[Number(match[1]) - 1];
|
|
770
|
+
if (id === void 0) throw new ProductionEditError(`${ref} names a thing this request has not added yet`);
|
|
771
|
+
return id;
|
|
772
|
+
}, place = (after, before) => ({
|
|
773
|
+
after: after === void 0 ? null : resolve(after),
|
|
774
|
+
before: before === void 0 ? null : resolve(before)
|
|
775
|
+
});
|
|
776
|
+
for (let index = 0; index < requests2.length; index++) {
|
|
777
|
+
let request = requests2[index];
|
|
778
|
+
try {
|
|
779
|
+
switch (request.op) {
|
|
780
|
+
case "create":
|
|
781
|
+
created.push(
|
|
782
|
+
edit.create(request.kind, request.parent === void 0 ? source.root : resolve(request.parent), request.fields ?? {}, place(request.after, request.before), request.id === void 0 ? null : parseId(request.id))
|
|
783
|
+
);
|
|
784
|
+
break;
|
|
785
|
+
case "set":
|
|
786
|
+
edit.set(resolve(request.id), request.field, request.value);
|
|
787
|
+
break;
|
|
788
|
+
case "move":
|
|
789
|
+
edit.move(resolve(request.id), resolve(request.parent), place(request.after, request.before));
|
|
790
|
+
break;
|
|
791
|
+
case "remove":
|
|
792
|
+
edit.remove(resolve(request.id));
|
|
793
|
+
break;
|
|
794
|
+
default:
|
|
795
|
+
throw new ProductionEditError(`"${String(request.op)}" is not a change`);
|
|
796
|
+
}
|
|
797
|
+
} catch (error) {
|
|
798
|
+
if (error instanceof ProductionEditError) return { ok: false, refusals: [{ index, reason: error.message }] };
|
|
799
|
+
throw error;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
let refusals = checkLimits(edit.changes, this.limits, this.target.kinds, (id) => source.get(BigInt(id))?.kind ?? null);
|
|
803
|
+
if (refusals.length > 0) return { ok: false, refusals };
|
|
804
|
+
if (edit.size > 0)
|
|
805
|
+
try {
|
|
806
|
+
this.target.editJson(this.author, this.limits.origin, JSON.stringify(edit.changes));
|
|
807
|
+
} catch (error) {
|
|
808
|
+
return { ok: false, refusals: [{ index: requests2.length, reason: error instanceof Error ? error.message : String(error) }] };
|
|
809
|
+
}
|
|
810
|
+
return { ok: true, created: created.map(idText), changes: edit.size };
|
|
811
|
+
}
|
|
812
|
+
undo() {
|
|
813
|
+
return this.target.undo(this.author);
|
|
814
|
+
}
|
|
815
|
+
redo() {
|
|
816
|
+
return this.target.redo(this.author);
|
|
817
|
+
}
|
|
818
|
+
compile() {
|
|
819
|
+
return this.target.compile();
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
// src/interactives/production/tools.ts
|
|
824
|
+
var NODE_REF = {
|
|
825
|
+
oneOf: [{ type: "string" }, { type: "integer", minimum: 0 }],
|
|
826
|
+
description: "A node id, or $1, $2, ... for things added earlier in the same request."
|
|
827
|
+
};
|
|
828
|
+
function changeSchema(kinds) {
|
|
829
|
+
return {
|
|
830
|
+
type: "object",
|
|
831
|
+
required: ["op"],
|
|
832
|
+
properties: {
|
|
833
|
+
op: { enum: ["create", "set", "move", "remove"] },
|
|
834
|
+
kind: { enum: kinds.editable },
|
|
835
|
+
id: NODE_REF,
|
|
836
|
+
parent: NODE_REF,
|
|
837
|
+
after: NODE_REF,
|
|
838
|
+
before: NODE_REF,
|
|
839
|
+
field: { type: "string" },
|
|
840
|
+
value: {},
|
|
841
|
+
fields: { type: "object" }
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
var MAX_DEPTH = 8;
|
|
846
|
+
function describeKinds(kinds) {
|
|
847
|
+
return kinds.list.map((kind) => ({
|
|
848
|
+
kind: kind.name,
|
|
849
|
+
document: kind.document,
|
|
850
|
+
fields: kind.fields.map((field) => field.limit === null ? { name: field.name, type: field.type } : { name: field.name, type: field.type, limit: field.limit }),
|
|
851
|
+
goesInside: kind.parents
|
|
852
|
+
}));
|
|
853
|
+
}
|
|
854
|
+
function requests(args) {
|
|
855
|
+
let changes = args.changes;
|
|
856
|
+
if (!Array.isArray(changes)) throw new Error("changes must be a list");
|
|
857
|
+
return changes;
|
|
858
|
+
}
|
|
859
|
+
function productionTools(operations) {
|
|
860
|
+
return [
|
|
861
|
+
{
|
|
862
|
+
name: "production_kinds",
|
|
863
|
+
title: "Production kinds",
|
|
864
|
+
description: "Lists every kind of thing in a production (scenes, cast and props, things and their parts, places and their ground, roads and crowds, music, live crowds, votes and gifts, and more), their fields with the values each allows, and where each can go.",
|
|
865
|
+
inputSchema: { type: "object", properties: {} },
|
|
866
|
+
readOnly: true,
|
|
867
|
+
run: () => describeKinds(operations.kinds)
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
name: "production_read",
|
|
871
|
+
title: "Read the production",
|
|
872
|
+
description: "Reads a node of the production and its children to a depth, with field values by name. Leave id out for the root.",
|
|
873
|
+
inputSchema: {
|
|
874
|
+
type: "object",
|
|
875
|
+
properties: { id: NODE_REF, depth: { type: "integer", minimum: 0, maximum: (8) } }
|
|
876
|
+
},
|
|
877
|
+
readOnly: true,
|
|
878
|
+
run: (args) => operations.read(
|
|
879
|
+
args.id ?? null,
|
|
880
|
+
Math.min((8), Number(args.depth ?? 1))
|
|
881
|
+
)
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
name: "production_edit",
|
|
885
|
+
title: "Edit the production",
|
|
886
|
+
description: "Applies a list of changes as one undoable edit: create a thing inside a parent (optionally after or before a sibling) with fields, set or clear a field, move a thing, or remove it with everything inside. Refuses the whole list when any change is not allowed.",
|
|
887
|
+
inputSchema: {
|
|
888
|
+
type: "object",
|
|
889
|
+
required: ["changes"],
|
|
890
|
+
properties: { changes: { type: "array", items: changeSchema(operations.kinds) } }
|
|
891
|
+
},
|
|
892
|
+
readOnly: false,
|
|
893
|
+
run: (args) => operations.apply(requests(args))
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
name: "production_undo",
|
|
897
|
+
title: "Undo",
|
|
898
|
+
description: "Undoes this author's last edit.",
|
|
899
|
+
inputSchema: { type: "object", properties: {} },
|
|
900
|
+
readOnly: false,
|
|
901
|
+
run: () => ({ undone: operations.undo() })
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
name: "production_redo",
|
|
905
|
+
title: "Redo",
|
|
906
|
+
description: "Redoes this author's last undone edit.",
|
|
907
|
+
inputSchema: { type: "object", properties: {} },
|
|
908
|
+
readOnly: false,
|
|
909
|
+
run: () => ({ redone: operations.redo() })
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
name: "production_check",
|
|
913
|
+
title: "Check the production",
|
|
914
|
+
description: "Builds the production and reports how many problems it has.",
|
|
915
|
+
inputSchema: { type: "object", properties: {} },
|
|
916
|
+
readOnly: true,
|
|
917
|
+
run: () => operations.compile()
|
|
918
|
+
}
|
|
919
|
+
];
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// src/interactives/production/plugin.ts
|
|
923
|
+
var PLUGIN_CALLS = ["kinds", "read", "edit", "undo", "redo"], PLUGIN_CALLS_PER_SECOND = 30, PLUGIN_EDITS_PER_SECOND = 10, MS_PER_SECOND = 1e3, PLUGIN_ID = /^[a-z0-9][a-z0-9-]{0,62}\/[a-z0-9][a-z0-9-]{0,62}$/, MAX_NAME = 60, PluginManifestError = class extends Error {
|
|
924
|
+
constructor(message) {
|
|
925
|
+
super(message), this.name = "PluginManifestError";
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
function boolOr(value, what) {
|
|
929
|
+
if (value !== void 0) {
|
|
930
|
+
if (typeof value != "boolean") throw new PluginManifestError(`${what} must be true or false`);
|
|
931
|
+
return value;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
function parsePluginManifest(value, known) {
|
|
935
|
+
if (typeof value != "object" || value === null)
|
|
936
|
+
throw new PluginManifestError("a plugin manifest is an object");
|
|
937
|
+
let raw = value;
|
|
938
|
+
if (typeof raw.id != "string" || !PLUGIN_ID.test(raw.id))
|
|
939
|
+
throw new PluginManifestError("id is owner/name in lowercase letters, digits and dashes");
|
|
940
|
+
if (typeof raw.name != "string" || raw.name.trim().length === 0 || raw.name.length > (60))
|
|
941
|
+
throw new PluginManifestError(`name is 1 to ${(60)} characters`);
|
|
942
|
+
if (typeof raw.version != "string" || raw.version.length === 0)
|
|
943
|
+
throw new PluginManifestError("version is required");
|
|
944
|
+
let grant = raw.grant ?? {}, kinds = grant.kinds;
|
|
945
|
+
if (kinds !== void 0 && (!Array.isArray(kinds) || !kinds.every((kind) => typeof kind == "string" && known.editable.includes(kind))))
|
|
946
|
+
throw new PluginManifestError("grant.kinds lists kinds of thing, not the production itself");
|
|
947
|
+
return {
|
|
948
|
+
id: raw.id,
|
|
949
|
+
name: raw.name.trim(),
|
|
950
|
+
version: raw.version,
|
|
951
|
+
grant: {
|
|
952
|
+
kinds,
|
|
953
|
+
fields: grant.fields,
|
|
954
|
+
create: boolOr(grant.create, "grant.create"),
|
|
955
|
+
remove: boolOr(grant.remove, "grant.remove"),
|
|
956
|
+
move: boolOr(grant.move, "grant.move")
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
function pluginLimits(manifest) {
|
|
961
|
+
return narrowLimits(PLUGIN_LIMITS, manifest.grant);
|
|
962
|
+
}
|
|
963
|
+
var PluginSession = class {
|
|
964
|
+
constructor(target, author, manifest) {
|
|
965
|
+
this.manifest = manifest;
|
|
966
|
+
this.windowStart = 0;
|
|
967
|
+
this.calls = 0;
|
|
968
|
+
this.edits = 0;
|
|
969
|
+
this.operations = new ProductionOperations(target, author, pluginLimits(manifest));
|
|
970
|
+
}
|
|
971
|
+
handle(request, nowMs) {
|
|
972
|
+
if (nowMs - this.windowStart >= (1e3) && (this.windowStart = nowMs, this.calls = 0, this.edits = 0), ++this.calls > (30))
|
|
973
|
+
return { id: request.id, ok: false, error: "too many calls; wait a moment" };
|
|
974
|
+
let args = request.args ?? {};
|
|
975
|
+
try {
|
|
976
|
+
switch (request.call) {
|
|
977
|
+
case "kinds":
|
|
978
|
+
return { id: request.id, ok: !0, result: describeKinds(this.operations.kinds) };
|
|
979
|
+
case "read":
|
|
980
|
+
return {
|
|
981
|
+
id: request.id,
|
|
982
|
+
ok: !0,
|
|
983
|
+
result: this.operations.read(
|
|
984
|
+
args.id ?? null,
|
|
985
|
+
Number(args.depth ?? 1)
|
|
986
|
+
)
|
|
987
|
+
};
|
|
988
|
+
case "edit":
|
|
989
|
+
return ++this.edits > (10) ? { id: request.id, ok: !1, error: "too many edits; wait a moment" } : Array.isArray(args.changes) ? {
|
|
990
|
+
id: request.id,
|
|
991
|
+
ok: !0,
|
|
992
|
+
result: this.operations.apply(args.changes)
|
|
993
|
+
} : { id: request.id, ok: !1, error: "edit takes a list of changes" };
|
|
994
|
+
case "undo":
|
|
995
|
+
return { id: request.id, ok: !0, result: this.operations.undo() };
|
|
996
|
+
case "redo":
|
|
997
|
+
return { id: request.id, ok: !0, result: this.operations.redo() };
|
|
998
|
+
default:
|
|
999
|
+
return {
|
|
1000
|
+
id: request.id,
|
|
1001
|
+
ok: !1,
|
|
1002
|
+
error: `"${request.call}" is not something a plugin can ask for`
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
} catch (error) {
|
|
1006
|
+
return {
|
|
1007
|
+
id: request.id,
|
|
1008
|
+
ok: false,
|
|
1009
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
// src/interactives/production/luau.ts
|
|
1016
|
+
var PLUGIN_GLOBAL = "production", MAX_PLUGIN_DEPTH = 16;
|
|
1017
|
+
function tableToPlain(value, depth = 0) {
|
|
1018
|
+
if (value === void 0) return null;
|
|
1019
|
+
if (typeof value == "string" || typeof value == "number" || typeof value == "boolean")
|
|
1020
|
+
return value;
|
|
1021
|
+
if (typeof value == "bigint") return value.toString();
|
|
1022
|
+
if (!(value instanceof LuaTable) || depth > (16)) return null;
|
|
1023
|
+
let pair = [void 0, void 0], entries = [], key;
|
|
1024
|
+
for (; value.next(key, pair); )
|
|
1025
|
+
key = pair[0], entries.push([pair[0], pair[1]]);
|
|
1026
|
+
let length = value.length();
|
|
1027
|
+
if (length > 0 && entries.length === length) {
|
|
1028
|
+
let list2 = [];
|
|
1029
|
+
for (let i = 1; i <= length; i++) list2.push(tableToPlain(value.getInt(i), depth + 1));
|
|
1030
|
+
return list2;
|
|
1031
|
+
}
|
|
1032
|
+
let out = {};
|
|
1033
|
+
for (let [k, v] of entries)
|
|
1034
|
+
(typeof k == "string" || typeof k == "number") && (out[String(k)] = tableToPlain(v, depth + 1));
|
|
1035
|
+
return out;
|
|
1036
|
+
}
|
|
1037
|
+
function plainToTable(value, depth = 0) {
|
|
1038
|
+
if (value == null || depth > (16)) return;
|
|
1039
|
+
if (typeof value == "string" || typeof value == "number" || typeof value == "boolean")
|
|
1040
|
+
return value;
|
|
1041
|
+
if (typeof value == "bigint") return value.toString();
|
|
1042
|
+
let table = new LuaTable();
|
|
1043
|
+
if (Array.isArray(value))
|
|
1044
|
+
return value.forEach((item, index) => table.set(index + 1, plainToTable(item, depth + 1))), table;
|
|
1045
|
+
if (typeof value == "object") {
|
|
1046
|
+
for (let [key, item] of Object.entries(value)) table.set(key, plainToTable(item, depth + 1));
|
|
1047
|
+
return table;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
function openProductionApi(state, session, now) {
|
|
1051
|
+
let rt = state.rt, api = new LuaTable(), next = 0;
|
|
1052
|
+
for (let call of PLUGIN_CALLS) {
|
|
1053
|
+
let args = new Args(rt, `${PLUGIN_GLOBAL}.${call}`);
|
|
1054
|
+
register(api, call, function(input) {
|
|
1055
|
+
let count = arguments.length, plain = count === 0 || input === void 0 ? {} : tableToPlain(args.table(1, count, input)), request = call === "edit" && Array.isArray(plain) ? { changes: plain } : typeof plain == "object" && plain !== null && !Array.isArray(plain) ? plain : {}, reply = session.handle({ id: ++next, call, args: request }, now());
|
|
1056
|
+
return rt.n = 2, rt.r[1] = reply.ok ? void 0 : reply.error, reply.ok ? plainToTable(reply.result) : void 0;
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
state.globals.set(PLUGIN_GLOBAL, api);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// src/interactives/production/runner.ts
|
|
1063
|
+
var PLUGIN_CHUNK = "plugin", DEFAULT_PLUGIN_BUDGET = 5e6, PLUGIN_BUDGET_MESSAGE = "the tool took too long and was stopped", SINGLE_OPERATION = "run", PluginLoadError = class extends Error {
|
|
1064
|
+
constructor(message) {
|
|
1065
|
+
super(message), this.name = "PluginLoadError";
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
function loaderFor(evaluate) {
|
|
1069
|
+
return (bytecode) => evaluate(compileBytecode(bytecode, { chunkname: PLUGIN_CHUNK }).source);
|
|
1070
|
+
}
|
|
1071
|
+
var ProductionPlugin = class _ProductionPlugin {
|
|
1072
|
+
constructor(state, table, session, budget) {
|
|
1073
|
+
this.state = state;
|
|
1074
|
+
this.table = table;
|
|
1075
|
+
this.session = session;
|
|
1076
|
+
this.budget = budget;
|
|
1077
|
+
let names = [], pair = [void 0, void 0], key;
|
|
1078
|
+
for (; table.next(key, pair); )
|
|
1079
|
+
key = pair[0], typeof pair[0] == "string" && typeof pair[1] == "function" && names.push(pair[0]);
|
|
1080
|
+
this.operations = names.sort();
|
|
1081
|
+
}
|
|
1082
|
+
static async open(options) {
|
|
1083
|
+
let state = new LuaState({ profile: "rive", seed: options.seed ?? 0 }), session = new PluginSession(options.target, options.author, options.manifest);
|
|
1084
|
+
openProductionApi(state, session, options.now ?? (() => Date.now()));
|
|
1085
|
+
let load = options.load ?? loaderFor(options.evaluate ?? blobEvaluator()), factory;
|
|
1086
|
+
try {
|
|
1087
|
+
factory = await load(options.bytecode);
|
|
1088
|
+
} catch (error) {
|
|
1089
|
+
throw new PluginLoadError(error instanceof Error ? error.message : String(error));
|
|
1090
|
+
}
|
|
1091
|
+
let budget = options.budget ?? (5e6);
|
|
1092
|
+
state.rt.budget = budget;
|
|
1093
|
+
let result;
|
|
1094
|
+
try {
|
|
1095
|
+
result = state.run(factory);
|
|
1096
|
+
} catch (error) {
|
|
1097
|
+
throw new PluginLoadError(_ProductionPlugin.message(state, error));
|
|
1098
|
+
}
|
|
1099
|
+
if (!result.ok) throw new PluginLoadError(state.rt.tostringValue(result.error));
|
|
1100
|
+
let value = result.values[0], table;
|
|
1101
|
+
if (value instanceof LuaTable)
|
|
1102
|
+
table = value;
|
|
1103
|
+
else if (typeof value == "function")
|
|
1104
|
+
table = new LuaTable(), table.set(SINGLE_OPERATION, value);
|
|
1105
|
+
else
|
|
1106
|
+
throw new PluginLoadError("a tool returns a table of operations");
|
|
1107
|
+
return new _ProductionPlugin(state, table, session, budget);
|
|
1108
|
+
}
|
|
1109
|
+
run(name, input = null) {
|
|
1110
|
+
let fn = this.table.get(name);
|
|
1111
|
+
if (typeof fn != "function") return { ok: false, error: `the tool has no operation ${name}` };
|
|
1112
|
+
let rt = this.state.rt;
|
|
1113
|
+
rt.budget = this.budget;
|
|
1114
|
+
let previous = this.state.enter();
|
|
1115
|
+
try {
|
|
1116
|
+
let first = fn(plainToTable(input));
|
|
1117
|
+
return { ok: !0, result: rt.n > 0 ? tableToPlain(first) : null };
|
|
1118
|
+
} catch (error) {
|
|
1119
|
+
return { ok: false, error: _ProductionPlugin.message(this.state, error) };
|
|
1120
|
+
} finally {
|
|
1121
|
+
this.state.exit(previous);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
static message(state, error) {
|
|
1125
|
+
if (error instanceof BudgetExceeded) return PLUGIN_BUDGET_MESSAGE;
|
|
1126
|
+
let native = state.rt.native(error);
|
|
1127
|
+
return native instanceof LuaError ? state.rt.tostringValue(native.value) : native instanceof Error ? native.message : String(native);
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
function openProductionPlugin(options) {
|
|
1131
|
+
return ProductionPlugin.open(options);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
// src/interactives/production/target.ts
|
|
1135
|
+
var ProductionRulesUnavailableError = class extends Error {
|
|
1136
|
+
constructor() {
|
|
1137
|
+
super("This production core cannot show rules as code.");
|
|
1138
|
+
this.name = "ProductionRulesUnavailableError";
|
|
1139
|
+
}
|
|
1140
|
+
}, parsed = /* @__PURE__ */ new WeakMap();
|
|
1141
|
+
function productionKinds(core) {
|
|
1142
|
+
let known = parsed.get(core);
|
|
1143
|
+
if (known !== void 0) return known;
|
|
1144
|
+
let kinds = ProductionKinds.parse(core.kinds());
|
|
1145
|
+
return parsed.set(core, kinds), kinds;
|
|
1146
|
+
}
|
|
1147
|
+
function productionTarget(core, draft) {
|
|
1148
|
+
return {
|
|
1149
|
+
kinds: productionKinds(core),
|
|
1150
|
+
sourceJson: () => draft.sourceJson(),
|
|
1151
|
+
editJson: (author, origin, changes) => draft.editJson(author, origin, changes),
|
|
1152
|
+
newId: (author) => draft.newId(author),
|
|
1153
|
+
undo: (author) => draft.undo(author),
|
|
1154
|
+
redo: (author) => draft.redo(author),
|
|
1155
|
+
compile: () => {
|
|
1156
|
+
let compiled = draft.compile();
|
|
1157
|
+
return { bytes: compiled.program.length, diagnostics: compiled.diagnostics.length };
|
|
1158
|
+
},
|
|
1159
|
+
rulesCode: () => {
|
|
1160
|
+
if (draft.rulesCode === void 0) throw new ProductionRulesUnavailableError();
|
|
1161
|
+
return draft.rulesCode();
|
|
1162
|
+
},
|
|
1163
|
+
applyRulesCode: (author, origin, code) => {
|
|
1164
|
+
if (draft.applyRulesCode === void 0) throw new ProductionRulesUnavailableError();
|
|
1165
|
+
return draft.applyRulesCode(author, origin, code);
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
export { BINDING_KIND, CROWD_KIND, DEFAULT_PLUGIN_BUDGET, EVERY_KIND, MAX_PLUGIN_DEPTH, MUSIC_KIND, NEW_REF_PREFIX, OUTSIDE_AGENT_LIMITS, PERSON_LIMITS, PLUGIN_BUDGET_MESSAGE, PLUGIN_CALLS, PLUGIN_CALLS_PER_SECOND, PLUGIN_CHUNK, PLUGIN_EDITS_PER_SECOND, PLUGIN_GLOBAL, PLUGIN_LIMITS, PluginLoadError, PluginManifestError, PluginSession, ProductionEdit, ProductionEditError, ProductionKinds, ProductionKindsError, ProductionOperations, ProductionPlugin, ProductionRulesUnavailableError, ProductionSource, ProductionSourceError, READ_ONLY_LIMITS, SINGLE_OPERATION, THING_KIND, WORLD_KIND, bindingOf, bindingSpec, checkLimits, crowdOf, crowdSpec, describeKinds, documentRequests, documentsOf, idText, musicOf, musicSpec, narrowLimits, openProductionApi, openProductionPlugin, parseId, parsePluginManifest, plainToTable, pluginLimits, productionKinds, productionTarget, productionTools, specAt, tableToPlain, thingOf, thingSpec, valueFor, worldOf, worldSpec };
|