....................................../////.===Hehe-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 159.198.67.129  /  Your IP : 216.73.216.244
Web Server : LiteSpeed
System : Linux server166.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : trooaisr ( 4033)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/alt-nodejs19/root/lib/node_modules/npm/node_modules.bundled/minimatch/dist/mjs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/alt-nodejs19/root/lib/node_modules/npm/node_modules.bundled/minimatch/dist/mjs/parse.js
// parse a single path portion
import { parseClass } from './brace-expressions';
const types = new Set(['!', '?', '+', '*', '@']);
const isExtglobType = (c) => types.has(c);
// characters that indicate a start of pattern needs the "no dots" bit
const addPatternStart = new Set(['[', '.']);
const justDots = new Set(['..', '.']);
const reSpecials = new Set('().*{}+?[]^$\\!');
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
// any single thing other than /
// don't need to escape / when using new RegExp()
const qmark = '[^/]';
// * => any number of characters
const star = qmark + '*?';
export class AST {
    type;
    #root;
    #parts = [];
    #parent;
    #parentIndex;
    #negs;
    #filledNegs = false;
    #options;
    constructor(type, parent, options = {}) {
        this.type = type;
        this.#parent = parent;
        this.#root = this.#parent ? this.#parent.#root : this;
        this.#options = this.#root === this ? options : this.#root.#options;
        this.#negs = this.#root === this ? [] : this.#root.#negs;
        if (type === '!' && !this.#root.#filledNegs)
            this.#negs.push(this);
        this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
    }
    fillNegs() {
        if (this !== this.#root) {
            this.#root.fillNegs();
            return this;
        }
        if (this.#filledNegs)
            return this;
        this.#filledNegs = true;
        let n;
        while ((n = this.#negs.pop())) {
            if (n.type !== '!')
                continue;
            // walk up the tree, appending everthing that comes AFTER parentIndex
            let p = n;
            let pp = p.#parent;
            while (pp) {
                for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
                    for (const part of n.#parts) {
                        /* c8 ignore start */
                        if (typeof part === 'string') {
                            throw new Error('string part in extglob AST??');
                        }
                        /* c8 ignore stop */
                        part.copyIn(pp.#parts[i]);
                    }
                }
                p = pp;
                pp = p.#parent;
            }
        }
        return this;
    }
    push(...parts) {
        for (const p of parts) {
            if (p === '')
                continue;
            /* c8 ignore start */
            if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {
                throw new Error('invalid part: ' + p);
            }
            /* c8 ignore stop */
            this.#parts.push(p);
        }
    }
    toJSON() {
        const ret = this.type === null ? this.#parts.slice() : [this.type, ...this.#parts];
        if (this.isStart() && !this.type)
            ret.unshift([]);
        if (this.isEnd() &&
            (this === this.#root ||
                (this.#root.#filledNegs && this.#parent?.type === '!'))) {
            ret.push({});
        }
        return ret;
    }
    isStart() {
        if (this.#root === this)
            return true;
        // if (this.type) return !!this.#parent?.isStart()
        if (!this.#parent?.isStart())
            return false;
        return this.#parentIndex === 0;
    }
    isEnd() {
        if (this.#root === this)
            return true;
        if (this.#parent?.type === '!')
            return true;
        if (!this.#parent?.isEnd())
            return false;
        if (!this.type)
            return this.#parent?.isEnd();
        return (this.#parentIndex === (this.#parent ? this.#parent.#parts.length : 0) - 1);
    }
    copyIn(part) {
        if (typeof part === 'string')
            this.push(part);
        else
            this.push(part.clone(this));
    }
    clone(parent) {
        const c = new AST(this.type, parent);
        for (const p of this.#parts) {
            c.copyIn(p);
        }
        return c;
    }
    static #parseAST(str, ast, pos, opt) {
        let escaping = false;
        if (ast.type === null) {
            // outside of a extglob, append until we find a start
            let i = pos;
            let acc = '';
            while (i < str.length) {
                const c = str.charAt(i++);
                // still accumulate escapes at this point, but we do ignore
                // starts that are escaped
                if (escaping || c === '\\') {
                    escaping = !escaping;
                    acc += c;
                    continue;
                }
                if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
                    ast.push(acc);
                    acc = '';
                    const ext = new AST(c, ast);
                    i = AST.#parseAST(str, ext, i, opt);
                    ast.push(ext);
                    continue;
                }
                acc += c;
            }
            ast.push(acc);
            return i;
        }
        // some kind of extglob, pos is at the (
        // find the next | or )
        let i = pos + 1;
        let part = new AST(null, ast);
        const parts = [];
        let acc = '';
        while (i < str.length) {
            const c = str.charAt(i++);
            // still accumulate escapes at this point, but we do ignore
            // starts that are escaped
            if (escaping || c === '\\') {
                escaping = !escaping;
                acc += c;
                continue;
            }
            if (isExtglobType(c) && str.charAt(i) === '(') {
                part.push(acc);
                acc = '';
                const ext = new AST(c, part);
                part.push(ext);
                i = AST.#parseAST(str, ext, i, opt);
                continue;
            }
            if (c === '|') {
                part.push(acc);
                acc = '';
                parts.push(part);
                part = new AST(null, ast);
                continue;
            }
            if (c === ')') {
                part.push(acc);
                acc = '';
                ast.push(...parts, part);
                return i;
            }
            acc += c;
        }
        // if we got here, it was a malformed extglob! not an extglob, but
        // maybe something else in there.
        ast.type = null;
        ast.#parts = [str.substring(pos)];
        return i;
    }
    static fromGlob(pattern, options = {}) {
        const ast = new AST(null, undefined, options);
        AST.#parseAST(pattern, ast, 0, options);
        console.log('parsed', pattern, JSON.stringify(ast));
        return ast;
    }
    toRegExpSource() {
        if (this.#root === this)
            this.fillNegs();
        if (!this.type) {
            const src = this.#parts
                .map(p => {
                if (typeof p === 'string')
                    return AST.#parseGlob(p, this.#options);
                else
                    return p.toRegExpSource();
            })
                .join('');
            let start = '';
            if (this.isStart() && typeof this.#parts[0] === 'string') {
                // '.' and '..' cannot match unless the pattern is that exactly
                const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
                if (dotTravAllowed) {
                    start = '(?:^|\\/)';
                }
                else {
                    const dotsAllowed = this.#options.dot ||
                        // no need to prevent dots if it can't match a dot, or if a sub-pattern
                        // will be preventing it anyway.
                        !addPatternStart.has(src.charAt(0));
                    start = dotsAllowed ? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))' : '(?!\\.)';
                }
            }
            let end = '';
            if (this.isEnd() &&
                (this === this.#root ||
                    (this.#root.#filledNegs && this.#parent?.type === '!'))) {
                end = '(?:$|\\/)';
            }
            return start + src + end;
        }
        // some kind of extglob
        const start = this.type === '!' ? '(?:(?!(?:' : '(?:';
        const body = this.#parts
            .map(p => {
            /* c8 ignore start */
            if (typeof p === 'string') {
                throw new Error('string type in extglob ast??');
            }
            /* c8 ignore stop */
            return p.toRegExpSource();
        })
            .join('|');
        const close = this.type === '!'
            ? '))[^/]*?)'
            : this.type === '@'
                ? ')'
                : `)${this.type}`;
        return start + body + close;
    }
    static #parseGlob(glob, options) {
        let escaping = false;
        let re = '';
        let uflag = false;
        let hasMagic = false;
        for (let i = 0; i < glob.length; i++) {
            const c = glob.charAt(i);
            if (escaping) {
                escaping = false;
                re += (reSpecials.has(c) ? '\\' : '') + c;
                continue;
            }
            if (c === '\\') {
                if (i === glob.length - 1) {
                    re += '\\\\';
                }
                else {
                    escaping = true;
                }
                continue;
            }
            if (c === '[') {
                const [src, needUflag, consumed, magic] = parseClass(glob, i);
                if (consumed) {
                    re += src;
                    uflag = uflag || needUflag;
                    i += consumed - 1;
                    hasMagic = hasMagic || magic;
                    continue;
                }
            }
            if (c === '*') {
                re += star;
                hasMagic = true;
                continue;
            }
            if (c === '?') {
                re += qmark;
                hasMagic = true;
                continue;
            }
            re += regExpEscape(c);
        }
        return re;
    }
}
const pattern = 'a@(i|w!(x|y)z+(l|m)|j)';
const ast = AST.fromGlob(pattern).fillNegs();
console.log('negged', pattern, JSON.stringify(ast));
console.log('to re src', pattern, ast.toRegExpSource());
// // the type (exttype or null for strings), and array of children tokens
//
// // append everything after a negative extglob to each of the parts
// // of the negative extglob node.  So, eg, [a, [!, x, y], z]
//
// //
// //
// //
// //
//
// const globUnescape = (s: string) => s.replace(/\\(.)/g, '$1')
// const regExpEscape = (s: string) =>
//   s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
//
// // "abc" -> { a:true, b:true, c:true }
// const charSet = (s: string) =>
//   s.split('').reduce((set: { [k: string]: boolean }, c) => {
//     set[c] = true
//     return set
//   }, {})
//
// // characters that need to be escaped in RegExp.
// const reSpecials = charSet('().*{}+?[]^$\\!')
//
// // characters that indicate we have to add the pattern start
// const addPatternStartSet = charSet('[.(')
//
// // any single thing other than /
// // don't need to escape / when using new RegExp()
// const qmark = '[^/]'
//
// // * => any number of characters
// const star = qmark + '*?'
//
// // TODO: take an offset and length, so we can sub-parse the extglobs
// const parse = (
//   options: MinimatchOptions,
//   pattern: string,
//   debug: (...a: any[]) => void
// ): false | string => {
//   assertValidPattern(pattern)
//
//   if (pattern === '') return ''
//
//   let re = ''
//   let hasMagic = false
//   let escaping = false
//   // ? => one single character
//   let uflag = false
//
//   // . and .. never match anything that doesn't start with .,
//   // even when options.dot is set.  However, if the pattern
//   // starts with ., then traversal patterns can match.
//   let dotTravAllowed = pattern.charAt(0) === '.'
//   let dotFileAllowed = options.dot || dotTravAllowed
//   const patternStart = () =>
//     dotTravAllowed
//       ? ''
//       : dotFileAllowed
//       ? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))'
//       : '(?!\\.)'
//   const subPatternStart = (p: string) =>
//     p.charAt(0) === '.'
//       ? ''
//       : options.dot
//       ? '(?!(?:^|\\/)\\.{1,2}(?:$|\\/))'
//       : '(?!\\.)'
//
//   const clearStateChar = () => {
//     if (stateChar) {
//       // we had some state-tracking character
//       // that wasn't consumed by this pass.
//       switch (stateChar) {
//         case '*':
//           re += star
//           hasMagic = true
//           break
//         case '?':
//           re += qmark
//           hasMagic = true
//           break
//         default:
//           re += '\\' + stateChar
//           break
//       }
//       debug('clearStateChar %j %j', stateChar, re)
//       stateChar = false
//     }
//   }
//
//   for (
//     let i = 0, c: string;
//     i < pattern.length && (c = pattern.charAt(i));
//     i++
//   ) {
//     debug('%s\t%s %s %j', pattern, i, re, c)
//
//     // skip over any that are escaped.
//     if (escaping) {
//       // completely not allowed, even escaped.
//       // should be impossible.
//       /* c8 ignore start */
//       if (c === '/') {
//         return false
//       }
//       /* c8 ignore stop */
//
//       if (reSpecials[c]) {
//         re += '\\'
//       }
//       re += c
//       escaping = false
//       continue
//     }
//
//     switch (c) {
//       // Should already be path-split by now.
//       /* c8 ignore start */
//       case '/': {
//         return false
//       }
//       /* c8 ignore stop */
//
//       case '\\':
//         clearStateChar()
//         escaping = true
//         continue
//
//       // the various stateChar values
//       // for the "extglob" stuff.
//       case '?':
//       case '*':
//       case '+':
//       case '@':
//       case '!':
//         debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
//
//         // if we already have a stateChar, then it means
//         // that there was something like ** or +? in there.
//         // Handle the stateChar, then proceed with this one.
//         debug('call clearStateChar %j', stateChar)
//         clearStateChar()
//         stateChar = c
//         // if extglob is disabled, then +(asdf|foo) isn't a thing.
//         // just clear the statechar *now*, rather than even diving into
//         // the patternList stuff.
//         if (options.noext) clearStateChar()
//         continue
//
//       case '(': {
//         if (!stateChar) {
//           re += '\\('
//           continue
//         }
//
//         const plEntry: PatternListEntry = {
//           type: stateChar,
//           start: i - 1,
//           reStart: re.length,
//           open: plTypes[stateChar].open,
//           close: plTypes[stateChar].close,
//         }
//         debug(pattern, '\t', plEntry)
//         patternListStack.push(plEntry)
//         // negation is (?:(?!(?:js)(?:<rest>))[^/]*)
//         re += plEntry.open
//         // next entry starts with a dot maybe?
//         if (plEntry.start === 0 && plEntry.type !== '!') {
//           dotTravAllowed = true
//           re += subPatternStart(pattern.slice(i + 1))
//         }
//         debug('plType %j %j', stateChar, re)
//         stateChar = false
//         continue
//       }
//
//       case ')': {
//         const plEntry = patternListStack[patternListStack.length - 1]
//         if (!plEntry) {
//           re += '\\)'
//           continue
//         }
//         patternListStack.pop()
//
//         // closing an extglob
//         clearStateChar()
//         hasMagic = true
//         pl = plEntry
//         // negation is (?:(?!js)[^/]*)
//         // The others are (?:<pattern>)<type>
//         re += pl.close
//         if (pl.type === '!') {
//           negativeLists.push(Object.assign(pl, { reEnd: re.length }))
//         }
//         continue
//       }
//
//       case '|': {
//         const plEntry = patternListStack[patternListStack.length - 1]
//         if (!plEntry) {
//           re += '\\|'
//           continue
//         }
//
//         clearStateChar()
//         re += '|'
//         // next subpattern can start with a dot?
//         if (plEntry.start === 0 && plEntry.type !== '!') {
//           dotTravAllowed = true
//           re += subPatternStart(pattern.slice(i + 1))
//         }
//         continue
//       }
//
//       // these are mostly the same in regexp and glob
//       case '[':
//         // swallow any state-tracking char before the [
//         clearStateChar()
//         const [src, needUflag, consumed, magic] = parseClass(pattern, i)
//         if (consumed) {
//           re += src
//           uflag = uflag || needUflag
//           i += consumed - 1
//           hasMagic = hasMagic || magic
//         } else {
//           re += '\\['
//         }
//         continue
//
//       case ']':
//         re += '\\' + c
//         continue
//
//       default:
//         // swallow any state char that wasn't consumed
//         clearStateChar()
//
//         re += regExpEscape(c)
//         break
//     } // switch
//   } // for
//
//   // handle the case where we had a +( thing at the *end*
//   // of the pattern.
//   // each pattern list stack adds 3 chars, and we need to go through
//   // and escape any | chars that were passed through as-is for the regexp.
//   // Go through and escape them, taking care not to double-escape any
//   // | chars that were already escaped.
//   for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
//     let tail: string
//     tail = re.slice(pl.reStart + pl.open.length)
//     debug(pattern, 'setting tail', re, pl)
//     // maybe some even number of \, then maybe 1 \, followed by a |
//     tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
//       if (!$2) {
//         // the | isn't already escaped, so escape it.
//         $2 = '\\'
//         // should already be done
//         /* c8 ignore start */
//       }
//       /* c8 ignore stop */
//
//       // need to escape all those slashes *again*, without escaping the
//       // one that we need for escaping the | character.  As it works out,
//       // escaping an even number of slashes can be done by simply repeating
//       // it exactly after itself.  That's why this trick works.
//       //
//       // I am sorry that you have to see this.
//       return $1 + $1 + $2 + '|'
//     })
//
//     debug('tail=%j\n   %s', tail, tail, pl, re)
//     const t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\' + pl.type
//
//     hasMagic = true
//     re = re.slice(0, pl.reStart) + t + '\\(' + tail
//   }
//
//   // handle trailing things that only matter at the very end.
//   clearStateChar()
//   if (escaping) {
//     // trailing \\
//     re += '\\\\'
//   }
//
//   // only need to apply the nodot start if the re starts with
//   // something that could conceivably capture a dot
//   const addPatternStart = addPatternStartSet[re.charAt(0)]
//
//   // Hack to work around lack of negative lookbehind in JS
//   // A pattern like: *.!(x).!(y|z) needs to ensure that a name
//   // like 'a.xyz.yz' doesn't match.  So, the first negative
//   // lookahead, has to look ALL the way ahead, to the end of
//   // the pattern.
//   for (let n = negativeLists.length - 1; n > -1; n--) {
//     const nl = negativeLists[n]
//
//     const nlBefore = re.slice(0, nl.reStart)
//     const nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
//     let nlAfter = re.slice(nl.reEnd)
//     const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter
//
//     // Handle nested stuff like *(*.js|!(*.json)), where open parens
//     // mean that we should *not* include the ) in the bit that is considered
//     // "after" the negated section.
//     const closeParensBefore = nlBefore.split(')').length
//     const openParensBefore = nlBefore.split('(').length - closeParensBefore
//     let cleanAfter = nlAfter
//     for (let i = 0; i < openParensBefore; i++) {
//       cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
//     }
//     nlAfter = cleanAfter
//
//     const dollar = nlAfter === '' ? '(?:$|\\/)' : ''
//
//     re = nlBefore + nlFirst + nlAfter + dollar + nlLast
//   }
//
//   // if the re is not "" at this point, then we need to make sure
//   // it doesn't match against an empty path part.
//   // Otherwise a/* will match a/, which it should not.
//   if (re !== '' && hasMagic) {
//     re = '(?=.)' + re
//   }
//
//   if (addPatternStart) {
//     re = patternStart() + re
//   }
//
//   // if it's nocase, and the lcase/uppercase don't match, it's magic
//   if (options.nocase && !hasMagic && !options.nocaseMagicOnly) {
//     hasMagic = pattern.toUpperCase() !== pattern.toLowerCase()
//   }
//
//   // skip the regexp for non-magical patterns
//   // unescape anything in it, though, so that it'll be
//   // an exact match against a file etc.
//   if (!hasMagic) {
//     return globUnescape(re)
//   }
//
//   return re
// }
//# sourceMappingURL=parse.js.map

Youez - 2016 - github.com/yon3zu
LinuXploit