@genai-fi/nanogpt 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -10
- package/dist/Generator.d.ts +0 -82
- package/dist/Generator.js +0 -11941
- package/dist/RealDiv-CGwv0liw.js +0 -365
- package/dist/Reshape-BW__R4mZ.js +0 -79
- package/dist/Reshape-CPBkTIH2.js +0 -14
- package/dist/TeachableLLM.d.ts +0 -70
- package/dist/TeachableLLM.js +0 -273
- package/dist/Trainer.d.ts +0 -43
- package/dist/Trainer.js +0 -244
- package/dist/_commonjsHelpers-ByX85dGu.js +0 -33
- package/dist/axis_util-GTVlo58H.js +0 -55
- package/dist/backend.d.ts +0 -2
- package/dist/backend.js +0 -13
- package/dist/backend_util-GaFarB78.js +0 -425
- package/dist/backend_webgpu-BqASlsbV.js +0 -545
- package/dist/binary_op_util-pKXltfxI.js +0 -192
- package/dist/broadcast_to-eS93CCN_.js +0 -28
- package/dist/checks/appendCache.d.ts +0 -1
- package/dist/checks/appendCache.js +0 -22
- package/dist/checks/attentionMask.d.ts +0 -1
- package/dist/checks/attentionMask.js +0 -37
- package/dist/checks/check.d.ts +0 -9
- package/dist/checks/check.js +0 -20
- package/dist/checks/gelu.d.ts +0 -1
- package/dist/checks/gelu.js +0 -18
- package/dist/checks/index.d.ts +0 -26
- package/dist/checks/index.js +0 -28
- package/dist/checks/matMulGelu.d.ts +0 -1
- package/dist/checks/matMulGelu.js +0 -28
- package/dist/checks/normRMS.d.ts +0 -1
- package/dist/checks/normRMS.js +0 -16
- package/dist/checks/normRMSGrad.d.ts +0 -1
- package/dist/checks/normRMSGrad.js +0 -12
- package/dist/checks/packUnpack.d.ts +0 -1
- package/dist/checks/packUnpack.js +0 -18
- package/dist/checks/qkv.d.ts +0 -1
- package/dist/checks/qkv.js +0 -34
- package/dist/checks/rope.d.ts +0 -1
- package/dist/checks/rope.js +0 -36
- package/dist/checks/weights.d.ts +0 -14
- package/dist/checks/weights.js +0 -31
- package/dist/clip_by_value-DDA7rrcT.js +0 -12
- package/dist/complex-DI35Q-gW.js +0 -11
- package/dist/complex_util-Yc1A_gV1.js +0 -55
- package/dist/concat-CAQpCret.js +0 -17
- package/dist/concat_util-D18dJ4fD.js +0 -22
- package/dist/data/docx.d.ts +0 -2
- package/dist/data/docx.js +0 -15
- package/dist/data/parquet.d.ts +0 -2
- package/dist/data/parquet.js +0 -17
- package/dist/data/pdf.d.ts +0 -2
- package/dist/data/pdf.js +0 -14
- package/dist/data/textLoader.d.ts +0 -7
- package/dist/data/textLoader.js +0 -108
- package/dist/dataset-CGGp1z9P.js +0 -1124
- package/dist/dropout_util--NxWuYg2.js +0 -27
- package/dist/expand_dims-Bkd1YD5x.js +0 -11
- package/dist/exports_initializers-CYzKLjN7.js +0 -7
- package/dist/floor-BQtb-Azg.js +0 -9
- package/dist/gather-qIqEqaGn.js +0 -9
- package/dist/gelu-B220X1Go.js +0 -26
- package/dist/gpgpu_math-BwvV12df.js +0 -2022
- package/dist/index-CUXkjxiT.js +0 -3516
- package/dist/index-CieiGp4Y.js +0 -349
- package/dist/index-CjOWnMXP.js +0 -7308
- package/dist/index-Cp39cXWe.js +0 -1016
- package/dist/index-D5v913EJ.js +0 -4
- package/dist/index-DmeWGGmS.js +0 -1074
- package/dist/index-DvYrXKkX.js +0 -113
- package/dist/index-Ksja3su6.js +0 -151
- package/dist/index-xuotMAFm.js +0 -118
- package/dist/inference/types.d.ts +0 -16
- package/dist/inference/types.js +0 -1
- package/dist/jszip.min-BZhlzntC.js +0 -2313
- package/dist/kernel_funcs_utils-pq0CK9co.js +0 -306
- package/dist/layers/BaseLayer.d.ts +0 -44
- package/dist/layers/BaseLayer.js +0 -74
- package/dist/layers/CausalSelfAttention.d.ts +0 -39
- package/dist/layers/CausalSelfAttention.js +0 -86
- package/dist/layers/LoRA.d.ts +0 -14
- package/dist/layers/LoRA.js +0 -58
- package/dist/layers/MLP.d.ts +0 -17
- package/dist/layers/MLP.js +0 -44
- package/dist/layers/PositionEmbedding.d.ts +0 -8
- package/dist/layers/PositionEmbedding.js +0 -31
- package/dist/layers/RMSNorm.d.ts +0 -12
- package/dist/layers/RMSNorm.js +0 -22
- package/dist/layers/RoPECache.d.ts +0 -18
- package/dist/layers/RoPECache.js +0 -50
- package/dist/layers/TiedEmbedding.d.ts +0 -13
- package/dist/layers/TiedEmbedding.js +0 -36
- package/dist/layers/TransformerBlock.d.ts +0 -27
- package/dist/layers/TransformerBlock.js +0 -40
- package/dist/layers/WeightStore.d.ts +0 -20
- package/dist/layers/WeightStore.js +0 -76
- package/dist/loader/load.d.ts +0 -6
- package/dist/loader/load.js +0 -68
- package/dist/loader/loadHF.d.ts +0 -8
- package/dist/loader/loadHF.js +0 -22
- package/dist/loader/loadTransformers.d.ts +0 -4
- package/dist/loader/loadTransformers.js +0 -44
- package/dist/loader/loadZipMeta.d.ts +0 -3
- package/dist/loader/loadZipMeta.js +0 -16
- package/dist/loader/newZipLoad.d.ts +0 -3
- package/dist/loader/newZipLoad.js +0 -31
- package/dist/loader/oldZipLoad.d.ts +0 -9
- package/dist/loader/oldZipLoad.js +0 -80
- package/dist/loader/save.d.ts +0 -16
- package/dist/loader/save.js +0 -90
- package/dist/loader/types.d.ts +0 -67
- package/dist/loader/types.js +0 -1
- package/dist/main.d.ts +0 -50
- package/dist/main.js +0 -109
- package/dist/matMul16-BcVC_E62.js +0 -80
- package/dist/matMulGelu-JNLZqKQp.js +0 -163
- package/dist/mat_mul-DhG0Newp.js +0 -11
- package/dist/mod-CSdCpRjf.js +0 -11
- package/dist/models/NanoGPTV1.d.ts +0 -16
- package/dist/models/NanoGPTV1.js +0 -99
- package/dist/models/NanoGPTV2.d.ts +0 -16
- package/dist/models/NanoGPTV2.js +0 -90
- package/dist/models/config.d.ts +0 -27
- package/dist/models/config.js +0 -50
- package/dist/models/factory.d.ts +0 -3
- package/dist/models/factory.js +0 -16
- package/dist/models/model.d.ts +0 -44
- package/dist/models/model.js +0 -134
- package/dist/non_max_suppression_impl-B2W7YjZB.js +0 -102
- package/dist/not_equal-hurPF26l.js +0 -64
- package/dist/ones-BytntneX.js +0 -14
- package/dist/ops/adamAdjust.d.ts +0 -2
- package/dist/ops/adamAdjust.js +0 -9
- package/dist/ops/adamMoments.d.ts +0 -2
- package/dist/ops/adamMoments.js +0 -9
- package/dist/ops/add16.d.ts +0 -2
- package/dist/ops/add16.js +0 -9
- package/dist/ops/appendCache.d.ts +0 -2
- package/dist/ops/appendCache.js +0 -22
- package/dist/ops/attentionMask.d.ts +0 -2
- package/dist/ops/attentionMask.js +0 -10
- package/dist/ops/concat16.d.ts +0 -2
- package/dist/ops/concat16.js +0 -9
- package/dist/ops/cpu/adamAdjust.d.ts +0 -1
- package/dist/ops/cpu/adamAdjust.js +0 -18
- package/dist/ops/cpu/adamMoments.d.ts +0 -1
- package/dist/ops/cpu/adamMoments.js +0 -16
- package/dist/ops/cpu/appendCache.d.ts +0 -1
- package/dist/ops/cpu/appendCache.js +0 -23
- package/dist/ops/cpu/attentionMask.d.ts +0 -1
- package/dist/ops/cpu/attentionMask.js +0 -22
- package/dist/ops/cpu/fusedSoftmax.d.ts +0 -9
- package/dist/ops/cpu/fusedSoftmax.js +0 -29
- package/dist/ops/cpu/gatherSub.d.ts +0 -1
- package/dist/ops/cpu/gatherSub.js +0 -18
- package/dist/ops/cpu/gelu.d.ts +0 -1
- package/dist/ops/cpu/gelu.js +0 -40
- package/dist/ops/cpu/matMul16.d.ts +0 -1
- package/dist/ops/cpu/matMul16.js +0 -15
- package/dist/ops/cpu/matMulGelu.d.ts +0 -1
- package/dist/ops/cpu/matMulGelu.js +0 -53
- package/dist/ops/cpu/matMulMul.d.ts +0 -1
- package/dist/ops/cpu/matMulMul.js +0 -23
- package/dist/ops/cpu/mulDropout.d.ts +0 -1
- package/dist/ops/cpu/mulDropout.js +0 -23
- package/dist/ops/cpu/normRMS.d.ts +0 -1
- package/dist/ops/cpu/normRMS.js +0 -39
- package/dist/ops/cpu/qkv.d.ts +0 -5
- package/dist/ops/cpu/qkv.js +0 -41
- package/dist/ops/cpu/rope.d.ts +0 -6
- package/dist/ops/cpu/rope.js +0 -38
- package/dist/ops/cpu/scatterSub.d.ts +0 -1
- package/dist/ops/cpu/scatterSub.js +0 -23
- package/dist/ops/dot16.d.ts +0 -2
- package/dist/ops/dot16.js +0 -42
- package/dist/ops/dropout.d.ts +0 -2
- package/dist/ops/dropout.js +0 -14
- package/dist/ops/dropout16.d.ts +0 -2
- package/dist/ops/dropout16.js +0 -25
- package/dist/ops/gatherSub.d.ts +0 -2
- package/dist/ops/gatherSub.js +0 -9
- package/dist/ops/gelu.d.ts +0 -3
- package/dist/ops/gelu.js +0 -8
- package/dist/ops/globalNorm.d.ts +0 -2
- package/dist/ops/globalNorm.js +0 -13
- package/dist/ops/grads/add16.d.ts +0 -1
- package/dist/ops/grads/add16.js +0 -26
- package/dist/ops/grads/attentionMask.d.ts +0 -1
- package/dist/ops/grads/attentionMask.js +0 -21
- package/dist/ops/grads/dropout16.d.ts +0 -1
- package/dist/ops/grads/dropout16.js +0 -2
- package/dist/ops/grads/gelu.d.ts +0 -2
- package/dist/ops/grads/gelu.js +0 -5
- package/dist/ops/grads/matMul16.d.ts +0 -2
- package/dist/ops/grads/matMul16.js +0 -9
- package/dist/ops/grads/matMulGelu.d.ts +0 -1
- package/dist/ops/grads/matMulGelu.js +0 -17
- package/dist/ops/grads/mul16.d.ts +0 -1
- package/dist/ops/grads/mul16.js +0 -4
- package/dist/ops/grads/normRMS.d.ts +0 -3
- package/dist/ops/grads/normRMS.js +0 -33
- package/dist/ops/grads/pack16.d.ts +0 -2
- package/dist/ops/grads/pack16.js +0 -6
- package/dist/ops/grads/qkv.d.ts +0 -3
- package/dist/ops/grads/qkv.js +0 -34
- package/dist/ops/grads/rope.d.ts +0 -2
- package/dist/ops/grads/rope.js +0 -5
- package/dist/ops/grads/softmax16.d.ts +0 -2
- package/dist/ops/grads/softmax16.js +0 -25
- package/dist/ops/grads/unpack16.d.ts +0 -2
- package/dist/ops/grads/unpack16.js +0 -5
- package/dist/ops/grads/utils.d.ts +0 -4
- package/dist/ops/grads/utils.js +0 -14
- package/dist/ops/log.d.ts +0 -0
- package/dist/ops/log.js +0 -1
- package/dist/ops/matMul16.d.ts +0 -15
- package/dist/ops/matMul16.js +0 -13
- package/dist/ops/matMulGelu.d.ts +0 -3
- package/dist/ops/matMulGelu.js +0 -14
- package/dist/ops/matMulMul.d.ts +0 -2
- package/dist/ops/matMulMul.js +0 -9
- package/dist/ops/mul16.d.ts +0 -2
- package/dist/ops/mul16.js +0 -39
- package/dist/ops/mulDrop.d.ts +0 -2
- package/dist/ops/mulDrop.js +0 -9
- package/dist/ops/normRMS.d.ts +0 -2
- package/dist/ops/normRMS.js +0 -19
- package/dist/ops/pack16.d.ts +0 -2
- package/dist/ops/pack16.js +0 -5
- package/dist/ops/qkv.d.ts +0 -2
- package/dist/ops/qkv.js +0 -10
- package/dist/ops/reshape16.d.ts +0 -2
- package/dist/ops/reshape16.js +0 -41
- package/dist/ops/rope.d.ts +0 -3
- package/dist/ops/rope.js +0 -7
- package/dist/ops/scatterSub.d.ts +0 -2
- package/dist/ops/scatterSub.js +0 -9
- package/dist/ops/slice16.d.ts +0 -2
- package/dist/ops/slice16.js +0 -9
- package/dist/ops/softmax16.d.ts +0 -2
- package/dist/ops/softmax16.js +0 -9
- package/dist/ops/sub16.d.ts +0 -2
- package/dist/ops/sub16.js +0 -8
- package/dist/ops/sum16.d.ts +0 -2
- package/dist/ops/sum16.js +0 -13
- package/dist/ops/transpose16.d.ts +0 -3
- package/dist/ops/transpose16.js +0 -40
- package/dist/ops/unpack16.d.ts +0 -2
- package/dist/ops/unpack16.js +0 -6
- package/dist/ops/webgl/adamAdjust.d.ts +0 -1
- package/dist/ops/webgl/adamAdjust.js +0 -49
- package/dist/ops/webgl/adamMoments.d.ts +0 -1
- package/dist/ops/webgl/adamMoments.js +0 -40
- package/dist/ops/webgl/appendCache.d.ts +0 -1
- package/dist/ops/webgl/appendCache.js +0 -44
- package/dist/ops/webgl/attentionMask.d.ts +0 -1
- package/dist/ops/webgl/attentionMask.js +0 -45
- package/dist/ops/webgl/dropout16.d.ts +0 -1
- package/dist/ops/webgl/dropout16.js +0 -11
- package/dist/ops/webgl/fusedSoftmax.d.ts +0 -11
- package/dist/ops/webgl/fusedSoftmax.js +0 -80
- package/dist/ops/webgl/gatherSub.d.ts +0 -1
- package/dist/ops/webgl/gatherSub.js +0 -27
- package/dist/ops/webgl/gelu.d.ts +0 -2
- package/dist/ops/webgl/gelu.js +0 -50
- package/dist/ops/webgl/log.d.ts +0 -17
- package/dist/ops/webgl/log.js +0 -23
- package/dist/ops/webgl/matMul16.d.ts +0 -1
- package/dist/ops/webgl/matMul16.js +0 -45
- package/dist/ops/webgl/matMulGelu.d.ts +0 -21
- package/dist/ops/webgl/matMulGelu.js +0 -9
- package/dist/ops/webgl/matMulMul.d.ts +0 -14
- package/dist/ops/webgl/matMulMul.js +0 -28
- package/dist/ops/webgl/mulDropout.d.ts +0 -1
- package/dist/ops/webgl/mulDropout.js +0 -41
- package/dist/ops/webgl/normRMS.d.ts +0 -1
- package/dist/ops/webgl/normRMS.js +0 -93
- package/dist/ops/webgl/qkv.d.ts +0 -1
- package/dist/ops/webgl/qkv.js +0 -46
- package/dist/ops/webgl/rope.d.ts +0 -1
- package/dist/ops/webgl/rope.js +0 -56
- package/dist/ops/webgl/scatterSub.d.ts +0 -1
- package/dist/ops/webgl/scatterSub.js +0 -27
- package/dist/ops/webgpu/adamAdjust.d.ts +0 -1
- package/dist/ops/webgpu/adamAdjust.js +0 -57
- package/dist/ops/webgpu/adamMoments.d.ts +0 -1
- package/dist/ops/webgpu/adamMoments.js +0 -60
- package/dist/ops/webgpu/add16.d.ts +0 -1
- package/dist/ops/webgpu/add16.js +0 -13
- package/dist/ops/webgpu/appendCache.d.ts +0 -1
- package/dist/ops/webgpu/appendCache.js +0 -105
- package/dist/ops/webgpu/attentionMask.d.ts +0 -1
- package/dist/ops/webgpu/attentionMask.js +0 -26
- package/dist/ops/webgpu/attentionMask32_program.d.ts +0 -19
- package/dist/ops/webgpu/attentionMask32_program.js +0 -54
- package/dist/ops/webgpu/clipScale.d.ts +0 -1
- package/dist/ops/webgpu/clipScale.js +0 -58
- package/dist/ops/webgpu/concat16.d.ts +0 -19
- package/dist/ops/webgpu/concat16.js +0 -126
- package/dist/ops/webgpu/dropout16.d.ts +0 -1
- package/dist/ops/webgpu/dropout16.js +0 -51
- package/dist/ops/webgpu/gatherSub.d.ts +0 -1
- package/dist/ops/webgpu/gatherSub.js +0 -39
- package/dist/ops/webgpu/gelu.d.ts +0 -14
- package/dist/ops/webgpu/gelu.js +0 -141
- package/dist/ops/webgpu/index.d.ts +0 -0
- package/dist/ops/webgpu/index.js +0 -26
- package/dist/ops/webgpu/matMul16.d.ts +0 -1
- package/dist/ops/webgpu/matMul16.js +0 -65
- package/dist/ops/webgpu/matMul16_program.d.ts +0 -42
- package/dist/ops/webgpu/matMul16_program.js +0 -343
- package/dist/ops/webgpu/mul16.d.ts +0 -1
- package/dist/ops/webgpu/mul16.js +0 -13
- package/dist/ops/webgpu/norm2.d.ts +0 -1
- package/dist/ops/webgpu/norm2.js +0 -76
- package/dist/ops/webgpu/normRMS.d.ts +0 -1
- package/dist/ops/webgpu/normRMS.js +0 -34
- package/dist/ops/webgpu/normRMS16_program.d.ts +0 -10
- package/dist/ops/webgpu/normRMS16_program.js +0 -25
- package/dist/ops/webgpu/normRMS32_program.d.ts +0 -10
- package/dist/ops/webgpu/normRMS32_program.js +0 -25
- package/dist/ops/webgpu/normRMSGrad.d.ts +0 -1
- package/dist/ops/webgpu/normRMSGrad.js +0 -284
- package/dist/ops/webgpu/pack16.d.ts +0 -1
- package/dist/ops/webgpu/pack16.js +0 -18
- package/dist/ops/webgpu/pack16_program.d.ts +0 -19
- package/dist/ops/webgpu/pack16_program.js +0 -92
- package/dist/ops/webgpu/qkv.d.ts +0 -1
- package/dist/ops/webgpu/qkv.js +0 -24
- package/dist/ops/webgpu/rope.d.ts +0 -1
- package/dist/ops/webgpu/rope.js +0 -135
- package/dist/ops/webgpu/scatterSub.d.ts +0 -1
- package/dist/ops/webgpu/scatterSub.js +0 -40
- package/dist/ops/webgpu/slice16.d.ts +0 -7
- package/dist/ops/webgpu/slice16.js +0 -69
- package/dist/ops/webgpu/softmax16.d.ts +0 -17
- package/dist/ops/webgpu/softmax16.js +0 -21
- package/dist/ops/webgpu/softmax16_program.d.ts +0 -13
- package/dist/ops/webgpu/softmax16_program.js +0 -73
- package/dist/ops/webgpu/softmax16_subgroup_program.d.ts +0 -17
- package/dist/ops/webgpu/softmax16_subgroup_program.js +0 -75
- package/dist/ops/webgpu/softmax16grad.d.ts +0 -1
- package/dist/ops/webgpu/softmax16grad.js +0 -37
- package/dist/ops/webgpu/sub16.d.ts +0 -1
- package/dist/ops/webgpu/sub16.js +0 -13
- package/dist/ops/webgpu/sum16.d.ts +0 -1
- package/dist/ops/webgpu/sum16.js +0 -38
- package/dist/ops/webgpu/transpose16.d.ts +0 -1
- package/dist/ops/webgpu/transpose16.js +0 -34
- package/dist/ops/webgpu/transpose16_program.d.ts +0 -16
- package/dist/ops/webgpu/transpose16_program.js +0 -50
- package/dist/ops/webgpu/transpose16_shared_program.d.ts +0 -15
- package/dist/ops/webgpu/transpose16_shared_program.js +0 -70
- package/dist/ops/webgpu/unpack16.d.ts +0 -1
- package/dist/ops/webgpu/unpack16.js +0 -48
- package/dist/ops/webgpu/utils/binary_op.d.ts +0 -35
- package/dist/ops/webgpu/utils/binary_op.js +0 -139
- package/dist/ops/webgpu/utils/deviceInfo.d.ts +0 -7
- package/dist/ops/webgpu/utils/deviceInfo.js +0 -11
- package/dist/ops/webgpu/utils/reductions.d.ts +0 -43
- package/dist/ops/webgpu/utils/reductions.js +0 -275
- package/dist/ops-CsXeTq1P.js +0 -476
- package/dist/pack16-bqltoUlR.js +0 -39
- package/dist/papaparse.min-C0cScC2i.js +0 -418
- package/dist/parquet-Bqjmp2vo.js +0 -44231
- package/dist/patches/webgpu_backend.d.ts +0 -18
- package/dist/patches/webgpu_backend.js +0 -56
- package/dist/patches/webgpu_base.d.ts +0 -21
- package/dist/patches/webgpu_base.js +0 -34
- package/dist/patches/webgpu_program.d.ts +0 -36
- package/dist/patches/webgpu_program.js +0 -400
- package/dist/pdf-NIhmP3sq.js +0 -19477
- package/dist/rand_util-CZ7yLoUm.js +0 -50
- package/dist/random_normal-IBRrha8a.js +0 -14
- package/dist/random_width-DN5ZtQkM.js +0 -9796
- package/dist/range-C-CjF-LI.js +0 -10
- package/dist/relu-J_X6MUzx.js +0 -9
- package/dist/reshape-BDOuCSNW.js +0 -9
- package/dist/resize_nearest_neighbor-BojqlfRe.js +0 -150
- package/dist/rope-DcrZM_e6.js +0 -24
- package/dist/scatter_nd_util-ByNJaL6I.js +0 -46
- package/dist/segment_util-Dasb2Zaf.js +0 -43
- package/dist/selu_util-BLhIqRkw.js +0 -44
- package/dist/shared-3agzAqQ_.js +0 -53
- package/dist/shared-CagdqkLh.js +0 -2143
- package/dist/slice-BzS11Qh0.js +0 -12
- package/dist/slice_util-CC35pLmT.js +0 -153
- package/dist/softmax-D4q1LJN7.js +0 -12
- package/dist/split-C2Sj255c.js +0 -9
- package/dist/squeeze-ho4wLUek.js +0 -10
- package/dist/stack-DudVrtmG.js +0 -11
- package/dist/step-BTxPtq1r.js +0 -261
- package/dist/sum-BpiwSWvg.js +0 -11
- package/dist/tensor-BWFldCso.js +0 -8
- package/dist/tensor1d-LMGMIUlr.js +0 -11
- package/dist/tensor2d-BnXMKScO.js +0 -14
- package/dist/tensor4d-C6UCG_u8.js +0 -14
- package/dist/tfjs_backend-BGnG-ppu.js +0 -654
- package/dist/tile-CFy-xTO6.js +0 -11
- package/dist/tokeniser/BaseTokeniser.d.ts +0 -33
- package/dist/tokeniser/BaseTokeniser.js +0 -124
- package/dist/tokeniser/CharTokeniser.d.ts +0 -24
- package/dist/tokeniser/CharTokeniser.js +0 -107
- package/dist/tokeniser/bpe.d.ts +0 -28
- package/dist/tokeniser/bpe.js +0 -173
- package/dist/tokeniser/messages.d.ts +0 -61
- package/dist/tokeniser/messages.js +0 -1
- package/dist/tokeniser/type.d.ts +0 -34
- package/dist/tokeniser/type.js +0 -1
- package/dist/training/AdamW.d.ts +0 -36
- package/dist/training/AdamW.js +0 -138
- package/dist/training/BasicTrainer.d.ts +0 -63
- package/dist/training/BasicTrainer.js +0 -265
- package/dist/training/DatasetBuilder.d.ts +0 -26
- package/dist/training/DatasetBuilder.js +0 -86
- package/dist/training/Evaluator.d.ts +0 -19
- package/dist/training/Evaluator.js +0 -39
- package/dist/training/LRScheduler.d.ts +0 -12
- package/dist/training/LRScheduler.js +0 -34
- package/dist/training/PreTrainer.d.ts +0 -11
- package/dist/training/PreTrainer.js +0 -20
- package/dist/training/SFTTrainer.d.ts +0 -12
- package/dist/training/SFTTrainer.js +0 -22
- package/dist/training/loss.d.ts +0 -3
- package/dist/training/loss.js +0 -24
- package/dist/training/orthoGrad.d.ts +0 -2
- package/dist/training/orthoGrad.js +0 -10
- package/dist/training/sparseCrossEntropy.d.ts +0 -7
- package/dist/training/sparseCrossEntropy.js +0 -69
- package/dist/training/tasks/ConversationTask.d.ts +0 -18
- package/dist/training/tasks/ConversationTask.js +0 -40
- package/dist/training/tasks/PretrainingTask.d.ts +0 -17
- package/dist/training/tasks/PretrainingTask.js +0 -47
- package/dist/training/tasks/StartSentenceTask.d.ts +0 -18
- package/dist/training/tasks/StartSentenceTask.js +0 -49
- package/dist/training/tasks/Task.d.ts +0 -22
- package/dist/training/tasks/Task.js +0 -68
- package/dist/training/tasks/splitter.d.ts +0 -5
- package/dist/training/tasks/splitter.js +0 -21
- package/dist/training/types.d.ts +0 -78
- package/dist/training/types.js +0 -1
- package/dist/training/validation.d.ts +0 -17
- package/dist/training/validation.js +0 -84
- package/dist/transpose-9kRxIXWR.js +0 -36
- package/dist/unsorted_segment_sum-DJvk5xnh.js +0 -277
- package/dist/utilities/arrayClose.d.ts +0 -1
- package/dist/utilities/arrayClose.js +0 -20
- package/dist/utilities/datasetID.d.ts +0 -2
- package/dist/utilities/datasetID.js +0 -21
- package/dist/utilities/dummy.d.ts +0 -9
- package/dist/utilities/dummy.js +0 -43
- package/dist/utilities/multinomialCPU.d.ts +0 -2
- package/dist/utilities/multinomialCPU.js +0 -13
- package/dist/utilities/naming.d.ts +0 -4
- package/dist/utilities/naming.js +0 -1
- package/dist/utilities/packed.d.ts +0 -4
- package/dist/utilities/packed.js +0 -15
- package/dist/utilities/parameters.d.ts +0 -11
- package/dist/utilities/parameters.js +0 -57
- package/dist/utilities/performance.d.ts +0 -2
- package/dist/utilities/performance.js +0 -16
- package/dist/utilities/profile.d.ts +0 -17
- package/dist/utilities/profile.js +0 -38
- package/dist/utilities/safetensors.d.ts +0 -3
- package/dist/utilities/safetensors.js +0 -83
- package/dist/utilities/sentences.d.ts +0 -5
- package/dist/utilities/sentences.js +0 -41
- package/dist/utilities/tokenParse.d.ts +0 -1
- package/dist/utilities/tokenParse.js +0 -21
- package/dist/utilities/topP.d.ts +0 -1
- package/dist/utilities/topP.js +0 -13
- package/dist/utilities/waitForModel.d.ts +0 -2
- package/dist/utilities/waitForModel.js +0 -12
- package/dist/utilities/weights.d.ts +0 -12
- package/dist/utilities/weights.js +0 -45
- package/dist/utilities/yielder.d.ts +0 -1
- package/dist/utilities/yielder.js +0 -7
- package/dist/variable-Ck482e3n.js +0 -7
- package/dist/webgpu_program-B4HmApL1.js +0 -525
- package/dist/webgpu_util-DYlGSwOJ.js +0 -64
- package/dist/zeros-DvZpK8s6.js +0 -13
- package/dist/zeros_like-CWjDdwr-.js +0 -721
package/dist/index-DmeWGGmS.js
DELETED
|
@@ -1,1074 +0,0 @@
|
|
|
1
|
-
import { g as wt } from "./_commonjsHelpers-ByX85dGu.js";
|
|
2
|
-
import { p as gt } from "./index-xuotMAFm.js";
|
|
3
|
-
var xt = {}, bt, $t;
|
|
4
|
-
function _t() {
|
|
5
|
-
if ($t) return bt;
|
|
6
|
-
$t = 1;
|
|
7
|
-
const g = "\\\\/", y = `[^${g}]`, K = 0, L = "\\.", X = "\\+", i = "\\?", o = "\\/", l = "(?=.)", A = "[^/]", O = `(?:${o}|$)`, d = `(?:^|${o})`, B = `${L}{1,2}${O}`, P = `(?!${L})`, T = `(?!${d}${B})`, G = `(?!${L}{0,1}${O})`, ut = `(?!${B})`, Q = `[^.${o}]`, z = `${A}*?`, c = {
|
|
8
|
-
DOT_LITERAL: L,
|
|
9
|
-
PLUS_LITERAL: X,
|
|
10
|
-
QMARK_LITERAL: i,
|
|
11
|
-
SLASH_LITERAL: o,
|
|
12
|
-
ONE_CHAR: l,
|
|
13
|
-
QMARK: A,
|
|
14
|
-
END_ANCHOR: O,
|
|
15
|
-
DOTS_SLASH: B,
|
|
16
|
-
NO_DOT: P,
|
|
17
|
-
NO_DOTS: T,
|
|
18
|
-
NO_DOT_SLASH: G,
|
|
19
|
-
NO_DOTS_SLASH: ut,
|
|
20
|
-
QMARK_NO_DOT: Q,
|
|
21
|
-
STAR: z,
|
|
22
|
-
START_ANCHOR: d,
|
|
23
|
-
SEP: "/"
|
|
24
|
-
}, r = {
|
|
25
|
-
...c,
|
|
26
|
-
SLASH_LITERAL: `[${g}]`,
|
|
27
|
-
QMARK: y,
|
|
28
|
-
STAR: `${y}*?`,
|
|
29
|
-
DOTS_SLASH: `${L}{1,2}(?:[${g}]|$)`,
|
|
30
|
-
NO_DOT: `(?!${L})`,
|
|
31
|
-
NO_DOTS: `(?!(?:^|[${g}])${L}{1,2}(?:[${g}]|$))`,
|
|
32
|
-
NO_DOT_SLASH: `(?!${L}{0,1}(?:[${g}]|$))`,
|
|
33
|
-
NO_DOTS_SLASH: `(?!${L}{1,2}(?:[${g}]|$))`,
|
|
34
|
-
QMARK_NO_DOT: `[^.${g}]`,
|
|
35
|
-
START_ANCHOR: `(?:^|[${g}])`,
|
|
36
|
-
END_ANCHOR: `(?:[${g}]|$)`,
|
|
37
|
-
SEP: "\\"
|
|
38
|
-
}, p = {
|
|
39
|
-
__proto__: null,
|
|
40
|
-
alnum: "a-zA-Z0-9",
|
|
41
|
-
alpha: "a-zA-Z",
|
|
42
|
-
ascii: "\\x00-\\x7F",
|
|
43
|
-
blank: " \\t",
|
|
44
|
-
cntrl: "\\x00-\\x1F\\x7F",
|
|
45
|
-
digit: "0-9",
|
|
46
|
-
graph: "\\x21-\\x7E",
|
|
47
|
-
lower: "a-z",
|
|
48
|
-
print: "\\x20-\\x7E ",
|
|
49
|
-
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
50
|
-
space: " \\t\\r\\n\\v\\f",
|
|
51
|
-
upper: "A-Z",
|
|
52
|
-
word: "A-Za-z0-9_",
|
|
53
|
-
xdigit: "A-Fa-f0-9"
|
|
54
|
-
};
|
|
55
|
-
return bt = {
|
|
56
|
-
DEFAULT_MAX_EXTGLOB_RECURSION: K,
|
|
57
|
-
MAX_LENGTH: 1024 * 64,
|
|
58
|
-
POSIX_REGEX_SOURCE: p,
|
|
59
|
-
// regular expressions
|
|
60
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
61
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
62
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
63
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
64
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
65
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
66
|
-
// Replace globs with equivalent patterns to reduce parsing time.
|
|
67
|
-
REPLACEMENTS: {
|
|
68
|
-
__proto__: null,
|
|
69
|
-
"***": "*",
|
|
70
|
-
"**/**": "**",
|
|
71
|
-
"**/**/**": "**"
|
|
72
|
-
},
|
|
73
|
-
// Digits
|
|
74
|
-
CHAR_0: 48,
|
|
75
|
-
/* 0 */
|
|
76
|
-
CHAR_9: 57,
|
|
77
|
-
/* 9 */
|
|
78
|
-
// Alphabet chars.
|
|
79
|
-
CHAR_UPPERCASE_A: 65,
|
|
80
|
-
/* A */
|
|
81
|
-
CHAR_LOWERCASE_A: 97,
|
|
82
|
-
/* a */
|
|
83
|
-
CHAR_UPPERCASE_Z: 90,
|
|
84
|
-
/* Z */
|
|
85
|
-
CHAR_LOWERCASE_Z: 122,
|
|
86
|
-
/* z */
|
|
87
|
-
CHAR_LEFT_PARENTHESES: 40,
|
|
88
|
-
/* ( */
|
|
89
|
-
CHAR_RIGHT_PARENTHESES: 41,
|
|
90
|
-
/* ) */
|
|
91
|
-
CHAR_ASTERISK: 42,
|
|
92
|
-
/* * */
|
|
93
|
-
// Non-alphabetic chars.
|
|
94
|
-
CHAR_AMPERSAND: 38,
|
|
95
|
-
/* & */
|
|
96
|
-
CHAR_AT: 64,
|
|
97
|
-
/* @ */
|
|
98
|
-
CHAR_BACKWARD_SLASH: 92,
|
|
99
|
-
/* \ */
|
|
100
|
-
CHAR_CARRIAGE_RETURN: 13,
|
|
101
|
-
/* \r */
|
|
102
|
-
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
103
|
-
/* ^ */
|
|
104
|
-
CHAR_COLON: 58,
|
|
105
|
-
/* : */
|
|
106
|
-
CHAR_COMMA: 44,
|
|
107
|
-
/* , */
|
|
108
|
-
CHAR_DOT: 46,
|
|
109
|
-
/* . */
|
|
110
|
-
CHAR_DOUBLE_QUOTE: 34,
|
|
111
|
-
/* " */
|
|
112
|
-
CHAR_EQUAL: 61,
|
|
113
|
-
/* = */
|
|
114
|
-
CHAR_EXCLAMATION_MARK: 33,
|
|
115
|
-
/* ! */
|
|
116
|
-
CHAR_FORM_FEED: 12,
|
|
117
|
-
/* \f */
|
|
118
|
-
CHAR_FORWARD_SLASH: 47,
|
|
119
|
-
/* / */
|
|
120
|
-
CHAR_GRAVE_ACCENT: 96,
|
|
121
|
-
/* ` */
|
|
122
|
-
CHAR_HASH: 35,
|
|
123
|
-
/* # */
|
|
124
|
-
CHAR_HYPHEN_MINUS: 45,
|
|
125
|
-
/* - */
|
|
126
|
-
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
127
|
-
/* < */
|
|
128
|
-
CHAR_LEFT_CURLY_BRACE: 123,
|
|
129
|
-
/* { */
|
|
130
|
-
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
131
|
-
/* [ */
|
|
132
|
-
CHAR_LINE_FEED: 10,
|
|
133
|
-
/* \n */
|
|
134
|
-
CHAR_NO_BREAK_SPACE: 160,
|
|
135
|
-
/* \u00A0 */
|
|
136
|
-
CHAR_PERCENT: 37,
|
|
137
|
-
/* % */
|
|
138
|
-
CHAR_PLUS: 43,
|
|
139
|
-
/* + */
|
|
140
|
-
CHAR_QUESTION_MARK: 63,
|
|
141
|
-
/* ? */
|
|
142
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
143
|
-
/* > */
|
|
144
|
-
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
145
|
-
/* } */
|
|
146
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
147
|
-
/* ] */
|
|
148
|
-
CHAR_SEMICOLON: 59,
|
|
149
|
-
/* ; */
|
|
150
|
-
CHAR_SINGLE_QUOTE: 39,
|
|
151
|
-
/* ' */
|
|
152
|
-
CHAR_SPACE: 32,
|
|
153
|
-
/* */
|
|
154
|
-
CHAR_TAB: 9,
|
|
155
|
-
/* \t */
|
|
156
|
-
CHAR_UNDERSCORE: 95,
|
|
157
|
-
/* _ */
|
|
158
|
-
CHAR_VERTICAL_LINE: 124,
|
|
159
|
-
/* | */
|
|
160
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
161
|
-
/* \uFEFF */
|
|
162
|
-
/**
|
|
163
|
-
* Create EXTGLOB_CHARS
|
|
164
|
-
*/
|
|
165
|
-
extglobChars(f) {
|
|
166
|
-
return {
|
|
167
|
-
"!": { type: "negate", open: "(?:(?!(?:", close: `))${f.STAR})` },
|
|
168
|
-
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
169
|
-
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
170
|
-
"*": { type: "star", open: "(?:", close: ")*" },
|
|
171
|
-
"@": { type: "at", open: "(?:", close: ")" }
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* Create GLOB_CHARS
|
|
176
|
-
*/
|
|
177
|
-
globChars(f) {
|
|
178
|
-
return f === !0 ? r : c;
|
|
179
|
-
}
|
|
180
|
-
}, bt;
|
|
181
|
-
}
|
|
182
|
-
var Ht;
|
|
183
|
-
function Et() {
|
|
184
|
-
return Ht || (Ht = 1, (function(g) {
|
|
185
|
-
const {
|
|
186
|
-
REGEX_BACKSLASH: y,
|
|
187
|
-
REGEX_REMOVE_BACKSLASH: K,
|
|
188
|
-
REGEX_SPECIAL_CHARS: L,
|
|
189
|
-
REGEX_SPECIAL_CHARS_GLOBAL: X
|
|
190
|
-
} = /* @__PURE__ */ _t();
|
|
191
|
-
g.isObject = (i) => i !== null && typeof i == "object" && !Array.isArray(i), g.hasRegexChars = (i) => L.test(i), g.isRegexChar = (i) => i.length === 1 && g.hasRegexChars(i), g.escapeRegex = (i) => i.replace(X, "\\$1"), g.toPosixSlashes = (i) => i.replace(y, "/"), g.isWindows = () => {
|
|
192
|
-
if (typeof navigator < "u" && navigator.platform) {
|
|
193
|
-
const i = navigator.platform.toLowerCase();
|
|
194
|
-
return i === "win32" || i === "windows";
|
|
195
|
-
}
|
|
196
|
-
return typeof gt < "u" && gt.platform ? gt.platform === "win32" : !1;
|
|
197
|
-
}, g.removeBackslashes = (i) => i.replace(K, (o) => o === "\\" ? "" : o), g.escapeLast = (i, o, l) => {
|
|
198
|
-
const A = i.lastIndexOf(o, l);
|
|
199
|
-
return A === -1 ? i : i[A - 1] === "\\" ? g.escapeLast(i, o, A - 1) : `${i.slice(0, A)}\\${i.slice(A)}`;
|
|
200
|
-
}, g.removePrefix = (i, o = {}) => {
|
|
201
|
-
let l = i;
|
|
202
|
-
return l.startsWith("./") && (l = l.slice(2), o.prefix = "./"), l;
|
|
203
|
-
}, g.wrapOutput = (i, o = {}, l = {}) => {
|
|
204
|
-
const A = l.contains ? "" : "^", O = l.contains ? "" : "$";
|
|
205
|
-
let d = `${A}(?:${i})${O}`;
|
|
206
|
-
return o.negated === !0 && (d = `(?:^(?!${d}).*$)`), d;
|
|
207
|
-
}, g.basename = (i, { windows: o } = {}) => {
|
|
208
|
-
const l = i.split(o ? /[\\/]/ : "/"), A = l[l.length - 1];
|
|
209
|
-
return A === "" ? l[l.length - 2] : A;
|
|
210
|
-
};
|
|
211
|
-
})(xt)), xt;
|
|
212
|
-
}
|
|
213
|
-
var dt, mt;
|
|
214
|
-
function kt() {
|
|
215
|
-
if (mt) return dt;
|
|
216
|
-
mt = 1;
|
|
217
|
-
const g = /* @__PURE__ */ Et(), {
|
|
218
|
-
CHAR_ASTERISK: y,
|
|
219
|
-
/* * */
|
|
220
|
-
CHAR_AT: K,
|
|
221
|
-
/* @ */
|
|
222
|
-
CHAR_BACKWARD_SLASH: L,
|
|
223
|
-
/* \ */
|
|
224
|
-
CHAR_COMMA: X,
|
|
225
|
-
/* , */
|
|
226
|
-
CHAR_DOT: i,
|
|
227
|
-
/* . */
|
|
228
|
-
CHAR_EXCLAMATION_MARK: o,
|
|
229
|
-
/* ! */
|
|
230
|
-
CHAR_FORWARD_SLASH: l,
|
|
231
|
-
/* / */
|
|
232
|
-
CHAR_LEFT_CURLY_BRACE: A,
|
|
233
|
-
/* { */
|
|
234
|
-
CHAR_LEFT_PARENTHESES: O,
|
|
235
|
-
/* ( */
|
|
236
|
-
CHAR_LEFT_SQUARE_BRACKET: d,
|
|
237
|
-
/* [ */
|
|
238
|
-
CHAR_PLUS: B,
|
|
239
|
-
/* + */
|
|
240
|
-
CHAR_QUESTION_MARK: P,
|
|
241
|
-
/* ? */
|
|
242
|
-
CHAR_RIGHT_CURLY_BRACE: T,
|
|
243
|
-
/* } */
|
|
244
|
-
CHAR_RIGHT_PARENTHESES: G,
|
|
245
|
-
/* ) */
|
|
246
|
-
CHAR_RIGHT_SQUARE_BRACKET: ut
|
|
247
|
-
/* ] */
|
|
248
|
-
} = /* @__PURE__ */ _t(), Q = (c) => c === l || c === L, z = (c) => {
|
|
249
|
-
c.isPrefix !== !0 && (c.depth = c.isGlobstar ? 1 / 0 : 1);
|
|
250
|
-
};
|
|
251
|
-
return dt = (c, r) => {
|
|
252
|
-
const p = r || {}, f = c.length - 1, R = p.parts === !0 || p.scanToEnd === !0, E = [], _ = [], ot = [];
|
|
253
|
-
let q = c, D = -1, M = 0, W = 0, V = !1, Y = !1, k = !1, at = !1, it = !1, C = !1, j = !1, lt = !1, ft = !1, v = !1, Z = 0, st, h, t = { value: "", depth: 0, isGlob: !1 };
|
|
254
|
-
const U = () => D >= f, et = () => q.charCodeAt(D + 1), F = () => (st = h, q.charCodeAt(++D));
|
|
255
|
-
for (; D < f; ) {
|
|
256
|
-
h = F();
|
|
257
|
-
let I;
|
|
258
|
-
if (h === L) {
|
|
259
|
-
j = t.backslashes = !0, h = F(), h === A && (C = !0);
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
if (C === !0 || h === A) {
|
|
263
|
-
for (Z++; U() !== !0 && (h = F()); ) {
|
|
264
|
-
if (h === L) {
|
|
265
|
-
j = t.backslashes = !0, F();
|
|
266
|
-
continue;
|
|
267
|
-
}
|
|
268
|
-
if (h === A) {
|
|
269
|
-
Z++;
|
|
270
|
-
continue;
|
|
271
|
-
}
|
|
272
|
-
if (C !== !0 && h === i && (h = F()) === i) {
|
|
273
|
-
if (V = t.isBrace = !0, k = t.isGlob = !0, v = !0, R === !0)
|
|
274
|
-
continue;
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
if (C !== !0 && h === X) {
|
|
278
|
-
if (V = t.isBrace = !0, k = t.isGlob = !0, v = !0, R === !0)
|
|
279
|
-
continue;
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
if (h === T && (Z--, Z === 0)) {
|
|
283
|
-
C = !1, V = t.isBrace = !0, v = !0;
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
if (R === !0)
|
|
288
|
-
continue;
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
if (h === l) {
|
|
292
|
-
if (E.push(D), _.push(t), t = { value: "", depth: 0, isGlob: !1 }, v === !0) continue;
|
|
293
|
-
if (st === i && D === M + 1) {
|
|
294
|
-
M += 2;
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
W = D + 1;
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
if (p.noext !== !0 && (h === B || h === K || h === y || h === P || h === o) === !0 && et() === O) {
|
|
301
|
-
if (k = t.isGlob = !0, at = t.isExtglob = !0, v = !0, h === o && D === M && (ft = !0), R === !0) {
|
|
302
|
-
for (; U() !== !0 && (h = F()); ) {
|
|
303
|
-
if (h === L) {
|
|
304
|
-
j = t.backslashes = !0, h = F();
|
|
305
|
-
continue;
|
|
306
|
-
}
|
|
307
|
-
if (h === G) {
|
|
308
|
-
k = t.isGlob = !0, v = !0;
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
continue;
|
|
313
|
-
}
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
if (h === y) {
|
|
317
|
-
if (st === y && (it = t.isGlobstar = !0), k = t.isGlob = !0, v = !0, R === !0)
|
|
318
|
-
continue;
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
if (h === P) {
|
|
322
|
-
if (k = t.isGlob = !0, v = !0, R === !0)
|
|
323
|
-
continue;
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
if (h === d) {
|
|
327
|
-
for (; U() !== !0 && (I = F()); ) {
|
|
328
|
-
if (I === L) {
|
|
329
|
-
j = t.backslashes = !0, F();
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
if (I === ut) {
|
|
333
|
-
Y = t.isBracket = !0, k = t.isGlob = !0, v = !0;
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
if (R === !0)
|
|
338
|
-
continue;
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
if (p.nonegate !== !0 && h === o && D === M) {
|
|
342
|
-
lt = t.negated = !0, M++;
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
if (p.noparen !== !0 && h === O) {
|
|
346
|
-
if (k = t.isGlob = !0, R === !0) {
|
|
347
|
-
for (; U() !== !0 && (h = F()); ) {
|
|
348
|
-
if (h === O) {
|
|
349
|
-
j = t.backslashes = !0, h = F();
|
|
350
|
-
continue;
|
|
351
|
-
}
|
|
352
|
-
if (h === G) {
|
|
353
|
-
v = !0;
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
continue;
|
|
358
|
-
}
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
if (k === !0) {
|
|
362
|
-
if (v = !0, R === !0)
|
|
363
|
-
continue;
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
p.noext === !0 && (at = !1, k = !1);
|
|
368
|
-
let e = q, n = "", J = "";
|
|
369
|
-
M > 0 && (n = q.slice(0, M), q = q.slice(M), W -= M), e && k === !0 && W > 0 ? (e = q.slice(0, W), J = q.slice(W)) : k === !0 ? (e = "", J = q) : e = q, e && e !== "" && e !== "/" && e !== q && Q(e.charCodeAt(e.length - 1)) && (e = e.slice(0, -1)), p.unescape === !0 && (J && (J = g.removeBackslashes(J)), e && j === !0 && (e = g.removeBackslashes(e)));
|
|
370
|
-
const $ = {
|
|
371
|
-
prefix: n,
|
|
372
|
-
input: c,
|
|
373
|
-
start: M,
|
|
374
|
-
base: e,
|
|
375
|
-
glob: J,
|
|
376
|
-
isBrace: V,
|
|
377
|
-
isBracket: Y,
|
|
378
|
-
isGlob: k,
|
|
379
|
-
isExtglob: at,
|
|
380
|
-
isGlobstar: it,
|
|
381
|
-
negated: lt,
|
|
382
|
-
negatedExtglob: ft
|
|
383
|
-
};
|
|
384
|
-
if (p.tokens === !0 && ($.maxDepth = 0, Q(h) || _.push(t), $.tokens = _), p.parts === !0 || p.tokens === !0) {
|
|
385
|
-
let I;
|
|
386
|
-
for (let w = 0; w < E.length; w++) {
|
|
387
|
-
const tt = I ? I + 1 : M, pt = E[w], ht = c.slice(tt, pt);
|
|
388
|
-
p.tokens && (w === 0 && M !== 0 ? (_[w].isPrefix = !0, _[w].value = n) : _[w].value = ht, z(_[w]), $.maxDepth += _[w].depth), (w !== 0 || ht !== "") && ot.push(ht), I = pt;
|
|
389
|
-
}
|
|
390
|
-
if (I && I + 1 < c.length) {
|
|
391
|
-
const w = c.slice(I + 1);
|
|
392
|
-
ot.push(w), p.tokens && (_[_.length - 1].value = w, z(_[_.length - 1]), $.maxDepth += _[_.length - 1].depth);
|
|
393
|
-
}
|
|
394
|
-
$.slashes = E, $.parts = ot;
|
|
395
|
-
}
|
|
396
|
-
return $;
|
|
397
|
-
}, dt;
|
|
398
|
-
}
|
|
399
|
-
var yt, Lt;
|
|
400
|
-
function It() {
|
|
401
|
-
if (Lt) return yt;
|
|
402
|
-
Lt = 1;
|
|
403
|
-
const g = /* @__PURE__ */ _t(), y = /* @__PURE__ */ Et(), {
|
|
404
|
-
MAX_LENGTH: K,
|
|
405
|
-
POSIX_REGEX_SOURCE: L,
|
|
406
|
-
REGEX_NON_SPECIAL_CHARS: X,
|
|
407
|
-
REGEX_SPECIAL_CHARS_BACKREF: i,
|
|
408
|
-
REPLACEMENTS: o
|
|
409
|
-
} = g, l = (a, c) => {
|
|
410
|
-
if (typeof c.expandRange == "function")
|
|
411
|
-
return c.expandRange(...a, c);
|
|
412
|
-
a.sort();
|
|
413
|
-
const r = `[${a.join("-")}]`;
|
|
414
|
-
try {
|
|
415
|
-
new RegExp(r);
|
|
416
|
-
} catch {
|
|
417
|
-
return a.map((f) => y.escapeRegex(f)).join("..");
|
|
418
|
-
}
|
|
419
|
-
return r;
|
|
420
|
-
}, A = (a, c) => `Missing ${a}: "${c}" - use "\\\\${c}" to match literal characters`, O = (a) => {
|
|
421
|
-
const c = [];
|
|
422
|
-
let r = 0, p = 0, f = 0, R = "", E = !1;
|
|
423
|
-
for (const _ of a) {
|
|
424
|
-
if (E === !0) {
|
|
425
|
-
R += _, E = !1;
|
|
426
|
-
continue;
|
|
427
|
-
}
|
|
428
|
-
if (_ === "\\") {
|
|
429
|
-
R += _, E = !0;
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
if (_ === '"') {
|
|
433
|
-
f = f === 1 ? 0 : 1, R += _;
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
if (f === 0) {
|
|
437
|
-
if (_ === "[")
|
|
438
|
-
r++;
|
|
439
|
-
else if (_ === "]" && r > 0)
|
|
440
|
-
r--;
|
|
441
|
-
else if (r === 0) {
|
|
442
|
-
if (_ === "(")
|
|
443
|
-
p++;
|
|
444
|
-
else if (_ === ")" && p > 0)
|
|
445
|
-
p--;
|
|
446
|
-
else if (_ === "|" && p === 0) {
|
|
447
|
-
c.push(R), R = "";
|
|
448
|
-
continue;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
R += _;
|
|
453
|
-
}
|
|
454
|
-
return c.push(R), c;
|
|
455
|
-
}, d = (a) => {
|
|
456
|
-
let c = !1;
|
|
457
|
-
for (const r of a) {
|
|
458
|
-
if (c === !0) {
|
|
459
|
-
c = !1;
|
|
460
|
-
continue;
|
|
461
|
-
}
|
|
462
|
-
if (r === "\\") {
|
|
463
|
-
c = !0;
|
|
464
|
-
continue;
|
|
465
|
-
}
|
|
466
|
-
if (/[?*+@!()[\]{}]/.test(r))
|
|
467
|
-
return !1;
|
|
468
|
-
}
|
|
469
|
-
return !0;
|
|
470
|
-
}, B = (a) => {
|
|
471
|
-
let c = a.trim(), r = !0;
|
|
472
|
-
for (; r === !0; )
|
|
473
|
-
r = !1, /^@\([^\\()[\]{}|]+\)$/.test(c) && (c = c.slice(2, -1), r = !0);
|
|
474
|
-
if (d(c))
|
|
475
|
-
return c.replace(/\\(.)/g, "$1");
|
|
476
|
-
}, P = (a) => {
|
|
477
|
-
const c = a.map(B).filter(Boolean);
|
|
478
|
-
for (let r = 0; r < c.length; r++)
|
|
479
|
-
for (let p = r + 1; p < c.length; p++) {
|
|
480
|
-
const f = c[r], R = c[p], E = f[0];
|
|
481
|
-
if (!(!E || f !== E.repeat(f.length) || R !== E.repeat(R.length)) && (f === R || f.startsWith(R) || R.startsWith(f)))
|
|
482
|
-
return !0;
|
|
483
|
-
}
|
|
484
|
-
return !1;
|
|
485
|
-
}, T = (a, c = !0) => {
|
|
486
|
-
if (a[0] !== "+" && a[0] !== "*" || a[1] !== "(")
|
|
487
|
-
return;
|
|
488
|
-
let r = 0, p = 0, f = 0, R = !1;
|
|
489
|
-
for (let E = 1; E < a.length; E++) {
|
|
490
|
-
const _ = a[E];
|
|
491
|
-
if (R === !0) {
|
|
492
|
-
R = !1;
|
|
493
|
-
continue;
|
|
494
|
-
}
|
|
495
|
-
if (_ === "\\") {
|
|
496
|
-
R = !0;
|
|
497
|
-
continue;
|
|
498
|
-
}
|
|
499
|
-
if (_ === '"') {
|
|
500
|
-
f = f === 1 ? 0 : 1;
|
|
501
|
-
continue;
|
|
502
|
-
}
|
|
503
|
-
if (f !== 1) {
|
|
504
|
-
if (_ === "[") {
|
|
505
|
-
r++;
|
|
506
|
-
continue;
|
|
507
|
-
}
|
|
508
|
-
if (_ === "]" && r > 0) {
|
|
509
|
-
r--;
|
|
510
|
-
continue;
|
|
511
|
-
}
|
|
512
|
-
if (!(r > 0)) {
|
|
513
|
-
if (_ === "(") {
|
|
514
|
-
p++;
|
|
515
|
-
continue;
|
|
516
|
-
}
|
|
517
|
-
if (_ === ")" && (p--, p === 0))
|
|
518
|
-
return c === !0 && E !== a.length - 1 ? void 0 : {
|
|
519
|
-
type: a[0],
|
|
520
|
-
body: a.slice(2, E),
|
|
521
|
-
end: E
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}, G = (a) => {
|
|
527
|
-
let c = 0;
|
|
528
|
-
const r = [];
|
|
529
|
-
for (; c < a.length; ) {
|
|
530
|
-
const f = T(a.slice(c), !1);
|
|
531
|
-
if (!f || f.type !== "*")
|
|
532
|
-
return;
|
|
533
|
-
const R = O(f.body).map((_) => _.trim());
|
|
534
|
-
if (R.length !== 1)
|
|
535
|
-
return;
|
|
536
|
-
const E = B(R[0]);
|
|
537
|
-
if (!E || E.length !== 1)
|
|
538
|
-
return;
|
|
539
|
-
r.push(E), c += f.end + 1;
|
|
540
|
-
}
|
|
541
|
-
return r.length < 1 ? void 0 : `${r.length === 1 ? y.escapeRegex(r[0]) : `[${r.map((f) => y.escapeRegex(f)).join("")}]`}*`;
|
|
542
|
-
}, ut = (a) => {
|
|
543
|
-
let c = 0, r = a.trim(), p = T(r);
|
|
544
|
-
for (; p; )
|
|
545
|
-
c++, r = p.body.trim(), p = T(r);
|
|
546
|
-
return c;
|
|
547
|
-
}, Q = (a, c) => {
|
|
548
|
-
if (c.maxExtglobRecursion === !1)
|
|
549
|
-
return { risky: !1 };
|
|
550
|
-
const r = typeof c.maxExtglobRecursion == "number" ? c.maxExtglobRecursion : g.DEFAULT_MAX_EXTGLOB_RECURSION, p = O(a).map((f) => f.trim());
|
|
551
|
-
if (p.length > 1 && (p.some((f) => f === "") || p.some((f) => /^[*?]+$/.test(f)) || P(p)))
|
|
552
|
-
return { risky: !0 };
|
|
553
|
-
for (const f of p) {
|
|
554
|
-
const R = G(f);
|
|
555
|
-
if (R)
|
|
556
|
-
return { risky: !0, safeOutput: R };
|
|
557
|
-
if (ut(f) > r)
|
|
558
|
-
return { risky: !0 };
|
|
559
|
-
}
|
|
560
|
-
return { risky: !1 };
|
|
561
|
-
}, z = (a, c) => {
|
|
562
|
-
if (typeof a != "string")
|
|
563
|
-
throw new TypeError("Expected a string");
|
|
564
|
-
a = o[a] || a;
|
|
565
|
-
const r = { ...c }, p = typeof r.maxLength == "number" ? Math.min(K, r.maxLength) : K;
|
|
566
|
-
let f = a.length;
|
|
567
|
-
if (f > p)
|
|
568
|
-
throw new SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${p}`);
|
|
569
|
-
const R = { type: "bos", value: "", output: r.prepend || "" }, E = [R], _ = r.capture ? "" : "?:", ot = g.globChars(r.windows), q = g.extglobChars(ot), {
|
|
570
|
-
DOT_LITERAL: D,
|
|
571
|
-
PLUS_LITERAL: M,
|
|
572
|
-
SLASH_LITERAL: W,
|
|
573
|
-
ONE_CHAR: V,
|
|
574
|
-
DOTS_SLASH: Y,
|
|
575
|
-
NO_DOT: k,
|
|
576
|
-
NO_DOT_SLASH: at,
|
|
577
|
-
NO_DOTS_SLASH: it,
|
|
578
|
-
QMARK: C,
|
|
579
|
-
QMARK_NO_DOT: j,
|
|
580
|
-
STAR: lt,
|
|
581
|
-
START_ANCHOR: ft
|
|
582
|
-
} = ot, v = (u) => `(${_}(?:(?!${ft}${u.dot ? Y : D}).)*?)`, Z = r.dot ? "" : k, st = r.dot ? C : j;
|
|
583
|
-
let h = r.bash === !0 ? v(r) : lt;
|
|
584
|
-
r.capture && (h = `(${h})`), typeof r.noext == "boolean" && (r.noextglob = r.noext);
|
|
585
|
-
const t = {
|
|
586
|
-
input: a,
|
|
587
|
-
index: -1,
|
|
588
|
-
start: 0,
|
|
589
|
-
dot: r.dot === !0,
|
|
590
|
-
consumed: "",
|
|
591
|
-
output: "",
|
|
592
|
-
prefix: "",
|
|
593
|
-
backtrack: !1,
|
|
594
|
-
negated: !1,
|
|
595
|
-
brackets: 0,
|
|
596
|
-
braces: 0,
|
|
597
|
-
parens: 0,
|
|
598
|
-
quotes: 0,
|
|
599
|
-
globstar: !1,
|
|
600
|
-
tokens: E
|
|
601
|
-
};
|
|
602
|
-
a = y.removePrefix(a, t), f = a.length;
|
|
603
|
-
const U = [], et = [], F = [];
|
|
604
|
-
let e = R, n;
|
|
605
|
-
const J = () => t.index === f - 1, $ = t.peek = (u = 1) => a[t.index + u], I = t.advance = () => a[++t.index] || "", w = () => a.slice(t.index + 1), tt = (u = "", m = 0) => {
|
|
606
|
-
t.consumed += u, t.index += m;
|
|
607
|
-
}, pt = (u) => {
|
|
608
|
-
t.output += u.output != null ? u.output : u.value, tt(u.value);
|
|
609
|
-
}, ht = () => {
|
|
610
|
-
let u = 1;
|
|
611
|
-
for (; $() === "!" && ($(2) !== "(" || $(3) === "?"); )
|
|
612
|
-
I(), t.start++, u++;
|
|
613
|
-
return u % 2 === 0 ? !1 : (t.negated = !0, t.start++, !0);
|
|
614
|
-
}, At = (u) => {
|
|
615
|
-
t[u]++, F.push(u);
|
|
616
|
-
}, ct = (u) => {
|
|
617
|
-
t[u]--, F.pop();
|
|
618
|
-
}, x = (u) => {
|
|
619
|
-
if (e.type === "globstar") {
|
|
620
|
-
const m = t.braces > 0 && (u.type === "comma" || u.type === "brace"), s = u.extglob === !0 || U.length && (u.type === "pipe" || u.type === "paren");
|
|
621
|
-
u.type !== "slash" && u.type !== "paren" && !m && !s && (t.output = t.output.slice(0, -e.output.length), e.type = "star", e.value = "*", e.output = h, t.output += e.output);
|
|
622
|
-
}
|
|
623
|
-
if (U.length && u.type !== "paren" && (U[U.length - 1].inner += u.value), (u.value || u.output) && pt(u), e && e.type === "text" && u.type === "text") {
|
|
624
|
-
e.output = (e.output || e.value) + u.value, e.value += u.value;
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
u.prev = e, E.push(u), e = u;
|
|
628
|
-
}, Rt = (u, m) => {
|
|
629
|
-
const s = { ...q[m], conditions: 1, inner: "" };
|
|
630
|
-
s.prev = e, s.parens = t.parens, s.output = t.output, s.startIndex = t.index, s.tokensIndex = E.length;
|
|
631
|
-
const b = (r.capture ? "(" : "") + s.open;
|
|
632
|
-
At("parens"), x({ type: u, value: m, output: t.output ? "" : V }), x({ type: "paren", extglob: !0, value: I(), output: b }), U.push(s);
|
|
633
|
-
}, vt = (u) => {
|
|
634
|
-
const m = a.slice(u.startIndex, t.index + 1), s = a.slice(u.startIndex + 2, t.index), b = Q(s, r);
|
|
635
|
-
if ((u.type === "plus" || u.type === "star") && b.risky) {
|
|
636
|
-
const S = b.safeOutput ? (u.output ? "" : V) + (r.capture ? `(${b.safeOutput})` : b.safeOutput) : void 0, rt = E[u.tokensIndex];
|
|
637
|
-
rt.type = "text", rt.value = m, rt.output = S || y.escapeRegex(m);
|
|
638
|
-
for (let nt = u.tokensIndex + 1; nt < E.length; nt++)
|
|
639
|
-
E[nt].value = "", E[nt].output = "", delete E[nt].suffix;
|
|
640
|
-
t.output = u.output + rt.output, t.backtrack = !0, x({ type: "paren", extglob: !0, value: n, output: "" }), ct("parens");
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
let H = u.close + (r.capture ? ")" : ""), N;
|
|
644
|
-
if (u.type === "negate") {
|
|
645
|
-
let S = h;
|
|
646
|
-
if (u.inner && u.inner.length > 1 && u.inner.includes("/") && (S = v(r)), (S !== h || J() || /^\)+$/.test(w())) && (H = u.close = `)$))${S}`), u.inner.includes("*") && (N = w()) && /^\.[^\\/.]+$/.test(N)) {
|
|
647
|
-
const rt = z(N, { ...c, fastpaths: !1 }).output;
|
|
648
|
-
H = u.close = `)${rt})${S})`;
|
|
649
|
-
}
|
|
650
|
-
u.prev.type === "bos" && (t.negatedExtglob = !0);
|
|
651
|
-
}
|
|
652
|
-
x({ type: "paren", extglob: !0, value: n, output: H }), ct("parens");
|
|
653
|
-
};
|
|
654
|
-
if (r.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(a)) {
|
|
655
|
-
let u = !1, m = a.replace(i, (s, b, H, N, S, rt) => N === "\\" ? (u = !0, s) : N === "?" ? b ? b + N + (S ? C.repeat(S.length) : "") : rt === 0 ? st + (S ? C.repeat(S.length) : "") : C.repeat(H.length) : N === "." ? D.repeat(H.length) : N === "*" ? b ? b + N + (S ? h : "") : h : b ? s : `\\${s}`);
|
|
656
|
-
return u === !0 && (r.unescape === !0 ? m = m.replace(/\\/g, "") : m = m.replace(/\\+/g, (s) => s.length % 2 === 0 ? "\\\\" : s ? "\\" : "")), m === a && r.contains === !0 ? (t.output = a, t) : (t.output = y.wrapOutput(m, t, c), t);
|
|
657
|
-
}
|
|
658
|
-
for (; !J(); ) {
|
|
659
|
-
if (n = I(), n === "\0")
|
|
660
|
-
continue;
|
|
661
|
-
if (n === "\\") {
|
|
662
|
-
const s = $();
|
|
663
|
-
if (s === "/" && r.bash !== !0 || s === "." || s === ";")
|
|
664
|
-
continue;
|
|
665
|
-
if (!s) {
|
|
666
|
-
n += "\\", x({ type: "text", value: n });
|
|
667
|
-
continue;
|
|
668
|
-
}
|
|
669
|
-
const b = /^\\+/.exec(w());
|
|
670
|
-
let H = 0;
|
|
671
|
-
if (b && b[0].length > 2 && (H = b[0].length, t.index += H, H % 2 !== 0 && (n += "\\")), r.unescape === !0 ? n = I() : n += I(), t.brackets === 0) {
|
|
672
|
-
x({ type: "text", value: n });
|
|
673
|
-
continue;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
if (t.brackets > 0 && (n !== "]" || e.value === "[" || e.value === "[^")) {
|
|
677
|
-
if (r.posix !== !1 && n === ":") {
|
|
678
|
-
const s = e.value.slice(1);
|
|
679
|
-
if (s.includes("[") && (e.posix = !0, s.includes(":"))) {
|
|
680
|
-
const b = e.value.lastIndexOf("["), H = e.value.slice(0, b), N = e.value.slice(b + 2), S = L[N];
|
|
681
|
-
if (S) {
|
|
682
|
-
e.value = H + S, t.backtrack = !0, I(), !R.output && E.indexOf(e) === 1 && (R.output = V);
|
|
683
|
-
continue;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
(n === "[" && $() !== ":" || n === "-" && $() === "]") && (n = `\\${n}`), n === "]" && (e.value === "[" || e.value === "[^") && (n = `\\${n}`), r.posix === !0 && n === "!" && e.value === "[" && (n = "^"), e.value += n, pt({ value: n });
|
|
688
|
-
continue;
|
|
689
|
-
}
|
|
690
|
-
if (t.quotes === 1 && n !== '"') {
|
|
691
|
-
n = y.escapeRegex(n), e.value += n, pt({ value: n });
|
|
692
|
-
continue;
|
|
693
|
-
}
|
|
694
|
-
if (n === '"') {
|
|
695
|
-
t.quotes = t.quotes === 1 ? 0 : 1, r.keepQuotes === !0 && x({ type: "text", value: n });
|
|
696
|
-
continue;
|
|
697
|
-
}
|
|
698
|
-
if (n === "(") {
|
|
699
|
-
At("parens"), x({ type: "paren", value: n });
|
|
700
|
-
continue;
|
|
701
|
-
}
|
|
702
|
-
if (n === ")") {
|
|
703
|
-
if (t.parens === 0 && r.strictBrackets === !0)
|
|
704
|
-
throw new SyntaxError(A("opening", "("));
|
|
705
|
-
const s = U[U.length - 1];
|
|
706
|
-
if (s && t.parens === s.parens + 1) {
|
|
707
|
-
vt(U.pop());
|
|
708
|
-
continue;
|
|
709
|
-
}
|
|
710
|
-
x({ type: "paren", value: n, output: t.parens ? ")" : "\\)" }), ct("parens");
|
|
711
|
-
continue;
|
|
712
|
-
}
|
|
713
|
-
if (n === "[") {
|
|
714
|
-
if (r.nobracket === !0 || !w().includes("]")) {
|
|
715
|
-
if (r.nobracket !== !0 && r.strictBrackets === !0)
|
|
716
|
-
throw new SyntaxError(A("closing", "]"));
|
|
717
|
-
n = `\\${n}`;
|
|
718
|
-
} else
|
|
719
|
-
At("brackets");
|
|
720
|
-
x({ type: "bracket", value: n });
|
|
721
|
-
continue;
|
|
722
|
-
}
|
|
723
|
-
if (n === "]") {
|
|
724
|
-
if (r.nobracket === !0 || e && e.type === "bracket" && e.value.length === 1) {
|
|
725
|
-
x({ type: "text", value: n, output: `\\${n}` });
|
|
726
|
-
continue;
|
|
727
|
-
}
|
|
728
|
-
if (t.brackets === 0) {
|
|
729
|
-
if (r.strictBrackets === !0)
|
|
730
|
-
throw new SyntaxError(A("opening", "["));
|
|
731
|
-
x({ type: "text", value: n, output: `\\${n}` });
|
|
732
|
-
continue;
|
|
733
|
-
}
|
|
734
|
-
ct("brackets");
|
|
735
|
-
const s = e.value.slice(1);
|
|
736
|
-
if (e.posix !== !0 && s[0] === "^" && !s.includes("/") && (n = `/${n}`), e.value += n, pt({ value: n }), r.literalBrackets === !1 || y.hasRegexChars(s))
|
|
737
|
-
continue;
|
|
738
|
-
const b = y.escapeRegex(e.value);
|
|
739
|
-
if (t.output = t.output.slice(0, -e.value.length), r.literalBrackets === !0) {
|
|
740
|
-
t.output += b, e.value = b;
|
|
741
|
-
continue;
|
|
742
|
-
}
|
|
743
|
-
e.value = `(${_}${b}|${e.value})`, t.output += e.value;
|
|
744
|
-
continue;
|
|
745
|
-
}
|
|
746
|
-
if (n === "{" && r.nobrace !== !0) {
|
|
747
|
-
At("braces");
|
|
748
|
-
const s = {
|
|
749
|
-
type: "brace",
|
|
750
|
-
value: n,
|
|
751
|
-
output: "(",
|
|
752
|
-
outputIndex: t.output.length,
|
|
753
|
-
tokensIndex: t.tokens.length
|
|
754
|
-
};
|
|
755
|
-
et.push(s), x(s);
|
|
756
|
-
continue;
|
|
757
|
-
}
|
|
758
|
-
if (n === "}") {
|
|
759
|
-
const s = et[et.length - 1];
|
|
760
|
-
if (r.nobrace === !0 || !s) {
|
|
761
|
-
x({ type: "text", value: n, output: n });
|
|
762
|
-
continue;
|
|
763
|
-
}
|
|
764
|
-
let b = ")";
|
|
765
|
-
if (s.dots === !0) {
|
|
766
|
-
const H = E.slice(), N = [];
|
|
767
|
-
for (let S = H.length - 1; S >= 0 && (E.pop(), H[S].type !== "brace"); S--)
|
|
768
|
-
H[S].type !== "dots" && N.unshift(H[S].value);
|
|
769
|
-
b = l(N, r), t.backtrack = !0;
|
|
770
|
-
}
|
|
771
|
-
if (s.comma !== !0 && s.dots !== !0) {
|
|
772
|
-
const H = t.output.slice(0, s.outputIndex), N = t.tokens.slice(s.tokensIndex);
|
|
773
|
-
s.value = s.output = "\\{", n = b = "\\}", t.output = H;
|
|
774
|
-
for (const S of N)
|
|
775
|
-
t.output += S.output || S.value;
|
|
776
|
-
}
|
|
777
|
-
x({ type: "brace", value: n, output: b }), ct("braces"), et.pop();
|
|
778
|
-
continue;
|
|
779
|
-
}
|
|
780
|
-
if (n === "|") {
|
|
781
|
-
U.length > 0 && U[U.length - 1].conditions++, x({ type: "text", value: n });
|
|
782
|
-
continue;
|
|
783
|
-
}
|
|
784
|
-
if (n === ",") {
|
|
785
|
-
let s = n;
|
|
786
|
-
const b = et[et.length - 1];
|
|
787
|
-
b && F[F.length - 1] === "braces" && (b.comma = !0, s = "|"), x({ type: "comma", value: n, output: s });
|
|
788
|
-
continue;
|
|
789
|
-
}
|
|
790
|
-
if (n === "/") {
|
|
791
|
-
if (e.type === "dot" && t.index === t.start + 1) {
|
|
792
|
-
t.start = t.index + 1, t.consumed = "", t.output = "", E.pop(), e = R;
|
|
793
|
-
continue;
|
|
794
|
-
}
|
|
795
|
-
x({ type: "slash", value: n, output: W });
|
|
796
|
-
continue;
|
|
797
|
-
}
|
|
798
|
-
if (n === ".") {
|
|
799
|
-
if (t.braces > 0 && e.type === "dot") {
|
|
800
|
-
e.value === "." && (e.output = D);
|
|
801
|
-
const s = et[et.length - 1];
|
|
802
|
-
e.type = "dots", e.output += n, e.value += n, s.dots = !0;
|
|
803
|
-
continue;
|
|
804
|
-
}
|
|
805
|
-
if (t.braces + t.parens === 0 && e.type !== "bos" && e.type !== "slash") {
|
|
806
|
-
x({ type: "text", value: n, output: D });
|
|
807
|
-
continue;
|
|
808
|
-
}
|
|
809
|
-
x({ type: "dot", value: n, output: D });
|
|
810
|
-
continue;
|
|
811
|
-
}
|
|
812
|
-
if (n === "?") {
|
|
813
|
-
if (!(e && e.value === "(") && r.noextglob !== !0 && $() === "(" && $(2) !== "?") {
|
|
814
|
-
Rt("qmark", n);
|
|
815
|
-
continue;
|
|
816
|
-
}
|
|
817
|
-
if (e && e.type === "paren") {
|
|
818
|
-
const b = $();
|
|
819
|
-
let H = n;
|
|
820
|
-
(e.value === "(" && !/[!=<:]/.test(b) || b === "<" && !/<([!=]|\w+>)/.test(w())) && (H = `\\${n}`), x({ type: "text", value: n, output: H });
|
|
821
|
-
continue;
|
|
822
|
-
}
|
|
823
|
-
if (r.dot !== !0 && (e.type === "slash" || e.type === "bos")) {
|
|
824
|
-
x({ type: "qmark", value: n, output: j });
|
|
825
|
-
continue;
|
|
826
|
-
}
|
|
827
|
-
x({ type: "qmark", value: n, output: C });
|
|
828
|
-
continue;
|
|
829
|
-
}
|
|
830
|
-
if (n === "!") {
|
|
831
|
-
if (r.noextglob !== !0 && $() === "(" && ($(2) !== "?" || !/[!=<:]/.test($(3)))) {
|
|
832
|
-
Rt("negate", n);
|
|
833
|
-
continue;
|
|
834
|
-
}
|
|
835
|
-
if (r.nonegate !== !0 && t.index === 0) {
|
|
836
|
-
ht();
|
|
837
|
-
continue;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
if (n === "+") {
|
|
841
|
-
if (r.noextglob !== !0 && $() === "(" && $(2) !== "?") {
|
|
842
|
-
Rt("plus", n);
|
|
843
|
-
continue;
|
|
844
|
-
}
|
|
845
|
-
if (e && e.value === "(" || r.regex === !1) {
|
|
846
|
-
x({ type: "plus", value: n, output: M });
|
|
847
|
-
continue;
|
|
848
|
-
}
|
|
849
|
-
if (e && (e.type === "bracket" || e.type === "paren" || e.type === "brace") || t.parens > 0) {
|
|
850
|
-
x({ type: "plus", value: n });
|
|
851
|
-
continue;
|
|
852
|
-
}
|
|
853
|
-
x({ type: "plus", value: M });
|
|
854
|
-
continue;
|
|
855
|
-
}
|
|
856
|
-
if (n === "@") {
|
|
857
|
-
if (r.noextglob !== !0 && $() === "(" && $(2) !== "?") {
|
|
858
|
-
x({ type: "at", extglob: !0, value: n, output: "" });
|
|
859
|
-
continue;
|
|
860
|
-
}
|
|
861
|
-
x({ type: "text", value: n });
|
|
862
|
-
continue;
|
|
863
|
-
}
|
|
864
|
-
if (n !== "*") {
|
|
865
|
-
(n === "$" || n === "^") && (n = `\\${n}`);
|
|
866
|
-
const s = X.exec(w());
|
|
867
|
-
s && (n += s[0], t.index += s[0].length), x({ type: "text", value: n });
|
|
868
|
-
continue;
|
|
869
|
-
}
|
|
870
|
-
if (e && (e.type === "globstar" || e.star === !0)) {
|
|
871
|
-
e.type = "star", e.star = !0, e.value += n, e.output = h, t.backtrack = !0, t.globstar = !0, tt(n);
|
|
872
|
-
continue;
|
|
873
|
-
}
|
|
874
|
-
let u = w();
|
|
875
|
-
if (r.noextglob !== !0 && /^\([^?]/.test(u)) {
|
|
876
|
-
Rt("star", n);
|
|
877
|
-
continue;
|
|
878
|
-
}
|
|
879
|
-
if (e.type === "star") {
|
|
880
|
-
if (r.noglobstar === !0) {
|
|
881
|
-
tt(n);
|
|
882
|
-
continue;
|
|
883
|
-
}
|
|
884
|
-
const s = e.prev, b = s.prev, H = s.type === "slash" || s.type === "bos", N = b && (b.type === "star" || b.type === "globstar");
|
|
885
|
-
if (r.bash === !0 && (!H || u[0] && u[0] !== "/")) {
|
|
886
|
-
x({ type: "star", value: n, output: "" });
|
|
887
|
-
continue;
|
|
888
|
-
}
|
|
889
|
-
const S = t.braces > 0 && (s.type === "comma" || s.type === "brace"), rt = U.length && (s.type === "pipe" || s.type === "paren");
|
|
890
|
-
if (!H && s.type !== "paren" && !S && !rt) {
|
|
891
|
-
x({ type: "star", value: n, output: "" });
|
|
892
|
-
continue;
|
|
893
|
-
}
|
|
894
|
-
for (; u.slice(0, 3) === "/**"; ) {
|
|
895
|
-
const nt = a[t.index + 4];
|
|
896
|
-
if (nt && nt !== "/")
|
|
897
|
-
break;
|
|
898
|
-
u = u.slice(3), tt("/**", 3);
|
|
899
|
-
}
|
|
900
|
-
if (s.type === "bos" && J()) {
|
|
901
|
-
e.type = "globstar", e.value += n, e.output = v(r), t.output = e.output, t.globstar = !0, tt(n);
|
|
902
|
-
continue;
|
|
903
|
-
}
|
|
904
|
-
if (s.type === "slash" && s.prev.type !== "bos" && !N && J()) {
|
|
905
|
-
t.output = t.output.slice(0, -(s.output + e.output).length), s.output = `(?:${s.output}`, e.type = "globstar", e.output = v(r) + (r.strictSlashes ? ")" : "|$)"), e.value += n, t.globstar = !0, t.output += s.output + e.output, tt(n);
|
|
906
|
-
continue;
|
|
907
|
-
}
|
|
908
|
-
if (s.type === "slash" && s.prev.type !== "bos" && u[0] === "/") {
|
|
909
|
-
const nt = u[1] !== void 0 ? "|$" : "";
|
|
910
|
-
t.output = t.output.slice(0, -(s.output + e.output).length), s.output = `(?:${s.output}`, e.type = "globstar", e.output = `${v(r)}${W}|${W}${nt})`, e.value += n, t.output += s.output + e.output, t.globstar = !0, tt(n + I()), x({ type: "slash", value: "/", output: "" });
|
|
911
|
-
continue;
|
|
912
|
-
}
|
|
913
|
-
if (s.type === "bos" && u[0] === "/") {
|
|
914
|
-
e.type = "globstar", e.value += n, e.output = `(?:^|${W}|${v(r)}${W})`, t.output = e.output, t.globstar = !0, tt(n + I()), x({ type: "slash", value: "/", output: "" });
|
|
915
|
-
continue;
|
|
916
|
-
}
|
|
917
|
-
t.output = t.output.slice(0, -e.output.length), e.type = "globstar", e.output = v(r), e.value += n, t.output += e.output, t.globstar = !0, tt(n);
|
|
918
|
-
continue;
|
|
919
|
-
}
|
|
920
|
-
const m = { type: "star", value: n, output: h };
|
|
921
|
-
if (r.bash === !0) {
|
|
922
|
-
m.output = ".*?", (e.type === "bos" || e.type === "slash") && (m.output = Z + m.output), x(m);
|
|
923
|
-
continue;
|
|
924
|
-
}
|
|
925
|
-
if (e && (e.type === "bracket" || e.type === "paren") && r.regex === !0) {
|
|
926
|
-
m.output = n, x(m);
|
|
927
|
-
continue;
|
|
928
|
-
}
|
|
929
|
-
(t.index === t.start || e.type === "slash" || e.type === "dot") && (e.type === "dot" ? (t.output += at, e.output += at) : r.dot === !0 ? (t.output += it, e.output += it) : (t.output += Z, e.output += Z), $() !== "*" && (t.output += V, e.output += V)), x(m);
|
|
930
|
-
}
|
|
931
|
-
for (; t.brackets > 0; ) {
|
|
932
|
-
if (r.strictBrackets === !0) throw new SyntaxError(A("closing", "]"));
|
|
933
|
-
t.output = y.escapeLast(t.output, "["), ct("brackets");
|
|
934
|
-
}
|
|
935
|
-
for (; t.parens > 0; ) {
|
|
936
|
-
if (r.strictBrackets === !0) throw new SyntaxError(A("closing", ")"));
|
|
937
|
-
t.output = y.escapeLast(t.output, "("), ct("parens");
|
|
938
|
-
}
|
|
939
|
-
for (; t.braces > 0; ) {
|
|
940
|
-
if (r.strictBrackets === !0) throw new SyntaxError(A("closing", "}"));
|
|
941
|
-
t.output = y.escapeLast(t.output, "{"), ct("braces");
|
|
942
|
-
}
|
|
943
|
-
if (r.strictSlashes !== !0 && (e.type === "star" || e.type === "bracket") && x({ type: "maybe_slash", value: "", output: `${W}?` }), t.backtrack === !0) {
|
|
944
|
-
t.output = "";
|
|
945
|
-
for (const u of t.tokens)
|
|
946
|
-
t.output += u.output != null ? u.output : u.value, u.suffix && (t.output += u.suffix);
|
|
947
|
-
}
|
|
948
|
-
return t;
|
|
949
|
-
};
|
|
950
|
-
return z.fastpaths = (a, c) => {
|
|
951
|
-
const r = { ...c }, p = typeof r.maxLength == "number" ? Math.min(K, r.maxLength) : K, f = a.length;
|
|
952
|
-
if (f > p)
|
|
953
|
-
throw new SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${p}`);
|
|
954
|
-
a = o[a] || a;
|
|
955
|
-
const {
|
|
956
|
-
DOT_LITERAL: R,
|
|
957
|
-
SLASH_LITERAL: E,
|
|
958
|
-
ONE_CHAR: _,
|
|
959
|
-
DOTS_SLASH: ot,
|
|
960
|
-
NO_DOT: q,
|
|
961
|
-
NO_DOTS: D,
|
|
962
|
-
NO_DOTS_SLASH: M,
|
|
963
|
-
STAR: W,
|
|
964
|
-
START_ANCHOR: V
|
|
965
|
-
} = g.globChars(r.windows), Y = r.dot ? D : q, k = r.dot ? M : q, at = r.capture ? "" : "?:", it = { negated: !1, prefix: "" };
|
|
966
|
-
let C = r.bash === !0 ? ".*?" : W;
|
|
967
|
-
r.capture && (C = `(${C})`);
|
|
968
|
-
const j = (Z) => Z.noglobstar === !0 ? C : `(${at}(?:(?!${V}${Z.dot ? ot : R}).)*?)`, lt = (Z) => {
|
|
969
|
-
switch (Z) {
|
|
970
|
-
case "*":
|
|
971
|
-
return `${Y}${_}${C}`;
|
|
972
|
-
case ".*":
|
|
973
|
-
return `${R}${_}${C}`;
|
|
974
|
-
case "*.*":
|
|
975
|
-
return `${Y}${C}${R}${_}${C}`;
|
|
976
|
-
case "*/*":
|
|
977
|
-
return `${Y}${C}${E}${_}${k}${C}`;
|
|
978
|
-
case "**":
|
|
979
|
-
return Y + j(r);
|
|
980
|
-
case "**/*":
|
|
981
|
-
return `(?:${Y}${j(r)}${E})?${k}${_}${C}`;
|
|
982
|
-
case "**/*.*":
|
|
983
|
-
return `(?:${Y}${j(r)}${E})?${k}${C}${R}${_}${C}`;
|
|
984
|
-
case "**/.*":
|
|
985
|
-
return `(?:${Y}${j(r)}${E})?${R}${_}${C}`;
|
|
986
|
-
default: {
|
|
987
|
-
const st = /^(.*?)\.(\w+)$/.exec(Z);
|
|
988
|
-
if (!st) return;
|
|
989
|
-
const h = lt(st[1]);
|
|
990
|
-
return h ? h + R + st[2] : void 0;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
}, ft = y.removePrefix(a, it);
|
|
994
|
-
let v = lt(ft);
|
|
995
|
-
return v && r.strictSlashes !== !0 && (v += `${E}?`), v;
|
|
996
|
-
}, yt = z, yt;
|
|
997
|
-
}
|
|
998
|
-
var St, Ot;
|
|
999
|
-
function Nt() {
|
|
1000
|
-
if (Ot) return St;
|
|
1001
|
-
Ot = 1;
|
|
1002
|
-
const g = /* @__PURE__ */ kt(), y = /* @__PURE__ */ It(), K = /* @__PURE__ */ Et(), L = /* @__PURE__ */ _t(), X = (o) => o && typeof o == "object" && !Array.isArray(o), i = (o, l, A = !1) => {
|
|
1003
|
-
if (Array.isArray(o)) {
|
|
1004
|
-
const Q = o.map((a) => i(a, l, A));
|
|
1005
|
-
return (a) => {
|
|
1006
|
-
for (const c of Q) {
|
|
1007
|
-
const r = c(a);
|
|
1008
|
-
if (r) return r;
|
|
1009
|
-
}
|
|
1010
|
-
return !1;
|
|
1011
|
-
};
|
|
1012
|
-
}
|
|
1013
|
-
const O = X(o) && o.tokens && o.input;
|
|
1014
|
-
if (o === "" || typeof o != "string" && !O)
|
|
1015
|
-
throw new TypeError("Expected pattern to be a non-empty string");
|
|
1016
|
-
const d = l || {}, B = d.windows, P = O ? i.compileRe(o, l) : i.makeRe(o, l, !1, !0), T = P.state;
|
|
1017
|
-
delete P.state;
|
|
1018
|
-
let G = () => !1;
|
|
1019
|
-
if (d.ignore) {
|
|
1020
|
-
const Q = { ...l, ignore: null, onMatch: null, onResult: null };
|
|
1021
|
-
G = i(d.ignore, Q, A);
|
|
1022
|
-
}
|
|
1023
|
-
const ut = (Q, z = !1) => {
|
|
1024
|
-
const { isMatch: a, match: c, output: r } = i.test(Q, P, l, { glob: o, posix: B }), p = { glob: o, state: T, regex: P, posix: B, input: Q, output: r, match: c, isMatch: a };
|
|
1025
|
-
return typeof d.onResult == "function" && d.onResult(p), a === !1 ? (p.isMatch = !1, z ? p : !1) : G(Q) ? (typeof d.onIgnore == "function" && d.onIgnore(p), p.isMatch = !1, z ? p : !1) : (typeof d.onMatch == "function" && d.onMatch(p), z ? p : !0);
|
|
1026
|
-
};
|
|
1027
|
-
return A && (ut.state = T), ut;
|
|
1028
|
-
};
|
|
1029
|
-
return i.test = (o, l, A, { glob: O, posix: d } = {}) => {
|
|
1030
|
-
if (typeof o != "string")
|
|
1031
|
-
throw new TypeError("Expected input to be a string");
|
|
1032
|
-
if (o === "")
|
|
1033
|
-
return { isMatch: !1, output: "" };
|
|
1034
|
-
const B = A || {}, P = B.format || (d ? K.toPosixSlashes : null);
|
|
1035
|
-
let T = o === O, G = T && P ? P(o) : o;
|
|
1036
|
-
return T === !1 && (G = P ? P(o) : o, T = G === O), (T === !1 || B.capture === !0) && (B.matchBase === !0 || B.basename === !0 ? T = i.matchBase(o, l, A, d) : T = l.exec(G)), { isMatch: !!T, match: T, output: G };
|
|
1037
|
-
}, i.matchBase = (o, l, A) => (l instanceof RegExp ? l : i.makeRe(l, A)).test(K.basename(o)), i.isMatch = (o, l, A) => i(l, A)(o), i.parse = (o, l) => Array.isArray(o) ? o.map((A) => i.parse(A, l)) : y(o, { ...l, fastpaths: !1 }), i.scan = (o, l) => g(o, l), i.compileRe = (o, l, A = !1, O = !1) => {
|
|
1038
|
-
if (A === !0)
|
|
1039
|
-
return o.output;
|
|
1040
|
-
const d = l || {}, B = d.contains ? "" : "^", P = d.contains ? "" : "$";
|
|
1041
|
-
let T = `${B}(?:${o.output})${P}`;
|
|
1042
|
-
o && o.negated === !0 && (T = `^(?!${T}).*$`);
|
|
1043
|
-
const G = i.toRegex(T, l);
|
|
1044
|
-
return O === !0 && (G.state = o), G;
|
|
1045
|
-
}, i.makeRe = (o, l = {}, A = !1, O = !1) => {
|
|
1046
|
-
if (!o || typeof o != "string")
|
|
1047
|
-
throw new TypeError("Expected a non-empty string");
|
|
1048
|
-
let d = { negated: !1, fastpaths: !0 };
|
|
1049
|
-
return l.fastpaths !== !1 && (o[0] === "." || o[0] === "*") && (d.output = y.fastpaths(o, l)), d.output || (d = y(o, l)), i.compileRe(d, l, A, O);
|
|
1050
|
-
}, i.toRegex = (o, l) => {
|
|
1051
|
-
try {
|
|
1052
|
-
const A = l || {};
|
|
1053
|
-
return new RegExp(o, A.flags || (A.nocase ? "i" : ""));
|
|
1054
|
-
} catch (A) {
|
|
1055
|
-
if (l && l.debug === !0) throw A;
|
|
1056
|
-
return /$^/;
|
|
1057
|
-
}
|
|
1058
|
-
}, i.constants = L, St = i, St;
|
|
1059
|
-
}
|
|
1060
|
-
var Ct, Tt;
|
|
1061
|
-
function Bt() {
|
|
1062
|
-
if (Tt) return Ct;
|
|
1063
|
-
Tt = 1;
|
|
1064
|
-
const g = /* @__PURE__ */ Nt(), y = /* @__PURE__ */ Et();
|
|
1065
|
-
function K(L, X, i = !1) {
|
|
1066
|
-
return X && (X.windows === null || X.windows === void 0) && (X = { ...X, windows: y.isWindows() }), g(L, X, i);
|
|
1067
|
-
}
|
|
1068
|
-
return Object.assign(K, g), Ct = K, Ct;
|
|
1069
|
-
}
|
|
1070
|
-
var Pt = /* @__PURE__ */ Bt();
|
|
1071
|
-
const Mt = /* @__PURE__ */ wt(Pt);
|
|
1072
|
-
export {
|
|
1073
|
-
Mt as p
|
|
1074
|
-
};
|