dom-to-svg.bundle.js 235 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547
  1. (() => {
  2. var __create = Object.create;
  3. var __defProp = Object.defineProperty;
  4. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  5. var __getOwnPropNames = Object.getOwnPropertyNames;
  6. var __getProtoOf = Object.getPrototypeOf;
  7. var __hasOwnProp = Object.prototype.hasOwnProperty;
  8. var __commonJS = (cb, mod) => function __require() {
  9. try {
  10. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  11. } catch (e) {
  12. throw mod = 0, e;
  13. }
  14. };
  15. var __copyProps = (to, from, except, desc) => {
  16. if (from && typeof from === "object" || typeof from === "function") {
  17. for (let key of __getOwnPropNames(from))
  18. if (!__hasOwnProp.call(to, key) && key !== except)
  19. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  20. }
  21. return to;
  22. };
  23. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  24. // If the importer is in node compatibility mode or this is not an ESM
  25. // file that has been converted to a CommonJS file using a Babel-
  26. // compatible transform (i.e. "__esModule" has not been set), then set
  27. // "default" to the CommonJS "module.exports" for node compatibility.
  28. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  29. mod
  30. ));
  31. // node_modules/picocolors/picocolors.browser.js
  32. var require_picocolors_browser = __commonJS({
  33. "node_modules/picocolors/picocolors.browser.js"(exports, module) {
  34. var x = String;
  35. var create = function() {
  36. return { isColorSupported: false, reset: x, bold: x, dim: x, italic: x, underline: x, inverse: x, hidden: x, strikethrough: x, black: x, red: x, green: x, yellow: x, blue: x, magenta: x, cyan: x, white: x, gray: x, bgBlack: x, bgRed: x, bgGreen: x, bgYellow: x, bgBlue: x, bgMagenta: x, bgCyan: x, bgWhite: x, blackBright: x, redBright: x, greenBright: x, yellowBright: x, blueBright: x, magentaBright: x, cyanBright: x, whiteBright: x, bgBlackBright: x, bgRedBright: x, bgGreenBright: x, bgYellowBright: x, bgBlueBright: x, bgMagentaBright: x, bgCyanBright: x, bgWhiteBright: x };
  37. };
  38. module.exports = create();
  39. module.exports.createColors = create;
  40. }
  41. });
  42. // (disabled):node_modules/postcss/lib/terminal-highlight
  43. var require_terminal_highlight = __commonJS({
  44. "(disabled):node_modules/postcss/lib/terminal-highlight"() {
  45. }
  46. });
  47. // node_modules/postcss/lib/css-syntax-error.js
  48. var require_css_syntax_error = __commonJS({
  49. "node_modules/postcss/lib/css-syntax-error.js"(exports, module) {
  50. "use strict";
  51. var pico = require_picocolors_browser();
  52. var terminalHighlight = require_terminal_highlight();
  53. var CssSyntaxError2 = class _CssSyntaxError extends Error {
  54. constructor(message, line, column, source, file, plugin2) {
  55. super(message);
  56. this.name = "CssSyntaxError";
  57. this.reason = message;
  58. if (file) {
  59. this.file = file;
  60. }
  61. if (source) {
  62. this.source = source;
  63. }
  64. if (plugin2) {
  65. this.plugin = plugin2;
  66. }
  67. if (typeof line !== "undefined" && typeof column !== "undefined") {
  68. if (typeof line === "number") {
  69. this.line = line;
  70. this.column = column;
  71. } else {
  72. this.line = line.line;
  73. this.column = line.column;
  74. this.endLine = column.line;
  75. this.endColumn = column.column;
  76. }
  77. }
  78. this.setMessage();
  79. if (Error.captureStackTrace) {
  80. Error.captureStackTrace(this, _CssSyntaxError);
  81. }
  82. }
  83. setMessage() {
  84. this.message = this.plugin ? this.plugin + ": " : "";
  85. this.message += this.file ? this.file : "<css input>";
  86. if (typeof this.line !== "undefined") {
  87. this.message += ":" + this.line + ":" + this.column;
  88. }
  89. this.message += ": " + this.reason;
  90. }
  91. showSourceCode(color) {
  92. if (!this.source) return "";
  93. let css = this.source;
  94. if (color == null) color = pico.isColorSupported;
  95. let aside = (text) => text;
  96. let mark = (text) => text;
  97. let highlight = (text) => text;
  98. if (color) {
  99. let { bold, gray, red } = pico.createColors(true);
  100. mark = (text) => bold(red(text));
  101. aside = (text) => gray(text);
  102. if (terminalHighlight) {
  103. highlight = (text) => terminalHighlight(text);
  104. }
  105. }
  106. let lines = css.split(/\r?\n/);
  107. let start = Math.max(this.line - 3, 0);
  108. let end = Math.min(this.line + 2, lines.length);
  109. let maxWidth = String(end).length;
  110. return lines.slice(start, end).map((line, index) => {
  111. let number = start + 1 + index;
  112. let gutter = " " + (" " + number).slice(-maxWidth) + " | ";
  113. if (number === this.line) {
  114. if (line.length > 160) {
  115. let padding = 20;
  116. let subLineStart = Math.max(0, this.column - padding);
  117. let subLineEnd = Math.max(
  118. this.column + padding,
  119. this.endColumn + padding
  120. );
  121. let subLine = line.slice(subLineStart, subLineEnd);
  122. let spacing2 = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, padding - 1)).replace(/[^\t]/g, " ");
  123. return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing2 + mark("^");
  124. }
  125. let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
  126. return mark(">") + aside(gutter) + highlight(line) + "\n " + spacing + mark("^");
  127. }
  128. return " " + aside(gutter) + highlight(line);
  129. }).join("\n");
  130. }
  131. toString() {
  132. let code = this.showSourceCode();
  133. if (code) {
  134. code = "\n\n" + code + "\n";
  135. }
  136. return this.name + ": " + this.message + code;
  137. }
  138. };
  139. module.exports = CssSyntaxError2;
  140. CssSyntaxError2.default = CssSyntaxError2;
  141. }
  142. });
  143. // node_modules/postcss/lib/stringifier.js
  144. var require_stringifier = __commonJS({
  145. "node_modules/postcss/lib/stringifier.js"(exports, module) {
  146. "use strict";
  147. var STYLE_TAG = /(<)(\/?style\b)/gi;
  148. var COMMENT_OPEN = /(<)(!--)/g;
  149. var AT_NAME_END = /[\t\n\f\r "#'()/;[\\\]{}]/;
  150. function escapeHTMLInCSS(str) {
  151. if (typeof str !== "string") return str;
  152. if (!str.includes("<")) return str;
  153. return str.replace(STYLE_TAG, "\\3c $2").replace(COMMENT_OPEN, "\\3c $2");
  154. }
  155. var DEFAULT_RAW = {
  156. after: "\n",
  157. beforeClose: "\n",
  158. beforeComment: "\n",
  159. beforeDecl: "\n",
  160. beforeOpen: " ",
  161. beforeRule: "\n",
  162. colon: ": ",
  163. commentLeft: " ",
  164. commentRight: " ",
  165. emptyBody: "",
  166. indent: " ",
  167. semicolon: false
  168. };
  169. function capitalize(str) {
  170. return str[0].toUpperCase() + str.slice(1);
  171. }
  172. function atruleStart(str, node) {
  173. let name = "@" + node.name;
  174. let params = node.params ? str.rawValue(node, "params") : "";
  175. let afterName = node.raws.afterName;
  176. if (typeof afterName === "undefined") {
  177. afterName = params ? " " : "";
  178. } else if (afterName === "" && params && !AT_NAME_END.test(params[0])) {
  179. afterName = " ";
  180. }
  181. return name + afterName + params;
  182. }
  183. function pushBody(str, stack, node) {
  184. let nodes = node.nodes;
  185. let last = nodes.length - 1;
  186. while (last > 0) {
  187. if (nodes[last].type !== "comment") break;
  188. last -= 1;
  189. }
  190. let semicolon = str.raw(node, "semicolon");
  191. let isDocument = node.type === "document";
  192. for (let i = nodes.length - 1; i >= 0; i--) {
  193. let child = nodes[i];
  194. let childSemicolon = last !== i || semicolon;
  195. if (!childSemicolon && i < nodes.length - 1 && (child.type === "atrule" && !child.nodes || child.type === "decl" && child.prop.startsWith("--"))) {
  196. childSemicolon = true;
  197. }
  198. stack.push({
  199. document: isDocument,
  200. node: child,
  201. semicolon: childSemicolon
  202. });
  203. }
  204. }
  205. function pushBlock(str, stack, node, start) {
  206. let between = str.raw(node, "between", "beforeOpen");
  207. str.builder(escapeHTMLInCSS(start + between) + "{", node, "start");
  208. let hasNodes = node.nodes && node.nodes.length;
  209. let close = () => {
  210. let after = hasNodes ? str.raw(node, "after") : str.raw(node, "after", "emptyBody");
  211. if (after) str.builder(escapeHTMLInCSS(after));
  212. str.builder("}", node, "end");
  213. if (node.type === "rule" && node.raws.ownSemicolon) {
  214. str.builder(escapeHTMLInCSS(node.raws.ownSemicolon), node, "end");
  215. }
  216. };
  217. if (hasNodes) {
  218. stack.push(close);
  219. pushBody(str, stack, node);
  220. } else {
  221. close();
  222. }
  223. }
  224. var Stringifier = class _Stringifier {
  225. constructor(builder) {
  226. this.builder = builder;
  227. }
  228. atrule(node, semicolon) {
  229. let start = atruleStart(this, node);
  230. if (node.nodes) {
  231. this.block(node, start);
  232. } else {
  233. let end = (node.raws.between || "") + (semicolon ? ";" : "");
  234. this.builder(escapeHTMLInCSS(start + end), node);
  235. }
  236. }
  237. beforeAfter(node, detect) {
  238. let value;
  239. if (node.type === "decl") {
  240. value = this.raw(node, null, "beforeDecl");
  241. } else if (node.type === "comment") {
  242. value = this.raw(node, null, "beforeComment");
  243. } else if (detect === "before") {
  244. value = this.raw(node, null, "beforeRule");
  245. } else {
  246. value = this.raw(node, null, "beforeClose");
  247. }
  248. let buf = node.parent;
  249. let depth = 0;
  250. while (buf && buf.type !== "root") {
  251. depth += 1;
  252. buf = buf.parent;
  253. }
  254. if (value.includes("\n")) {
  255. let indent = this.raw(node, null, "indent");
  256. if (indent.length) {
  257. for (let step = 0; step < depth; step++) value += indent;
  258. }
  259. }
  260. return value;
  261. }
  262. block(node, start) {
  263. let between = this.raw(node, "between", "beforeOpen");
  264. this.builder(escapeHTMLInCSS(start + between) + "{", node, "start");
  265. let after;
  266. if (node.nodes && node.nodes.length) {
  267. this.body(node);
  268. after = this.raw(node, "after");
  269. } else {
  270. after = this.raw(node, "after", "emptyBody");
  271. }
  272. if (after) this.builder(escapeHTMLInCSS(after));
  273. this.builder("}", node, "end");
  274. }
  275. body(node) {
  276. let proto = _Stringifier.prototype;
  277. let expandable = ["atrule", "block", "body", "rule", "stringify"].every(
  278. (method) => this[method] === proto[method]
  279. );
  280. let stack = [];
  281. pushBody(this, stack, node);
  282. while (stack.length > 0) {
  283. let entry = stack.pop();
  284. if (typeof entry === "function") {
  285. entry();
  286. continue;
  287. }
  288. let child = entry.node;
  289. let before = this.raw(child, "before");
  290. if (before) {
  291. this.builder(entry.document ? before : escapeHTMLInCSS(before));
  292. }
  293. if (expandable && child.type === "rule") {
  294. pushBlock(this, stack, child, this.rawValue(child, "selector"));
  295. } else if (expandable && child.type === "atrule" && child.nodes) {
  296. pushBlock(this, stack, child, atruleStart(this, child));
  297. } else {
  298. this.stringify(child, entry.semicolon);
  299. }
  300. }
  301. }
  302. comment(node) {
  303. let left = this.raw(node, "left", "commentLeft");
  304. let right = this.raw(node, "right", "commentRight");
  305. this.builder(escapeHTMLInCSS("/*" + left + node.text + right + "*/"), node);
  306. }
  307. decl(node, semicolon) {
  308. let raws = node.raws;
  309. let between = this.raw(node, "between", "colon");
  310. let string = node.prop + between + this.rawValue(node, "value");
  311. if (node.important) {
  312. string += raws.important || " !important";
  313. }
  314. if (semicolon) string += ";";
  315. this.builder(escapeHTMLInCSS(string), node);
  316. }
  317. document(node) {
  318. this.body(node);
  319. }
  320. raw(node, own, detect) {
  321. let value;
  322. if (!detect) detect = own;
  323. if (own) {
  324. value = node.raws[own];
  325. if (typeof value !== "undefined") return value;
  326. }
  327. let parent = node.parent;
  328. if (detect === "before") {
  329. if (!parent || parent.type === "root" && parent.first === node) {
  330. return "";
  331. }
  332. if (parent && parent.type === "document") {
  333. return "";
  334. }
  335. }
  336. if (!parent) return DEFAULT_RAW[detect];
  337. let root2 = node.root();
  338. let cache = root2.rawCache || (root2.rawCache = {});
  339. if (typeof cache[detect] !== "undefined") {
  340. return cache[detect];
  341. }
  342. if (detect === "before" || detect === "after") {
  343. return this.beforeAfter(node, detect);
  344. } else {
  345. let method = "raw" + capitalize(detect);
  346. if (this[method]) {
  347. value = this[method](root2, node);
  348. } else {
  349. root2.walk((i) => {
  350. value = i.raws[own];
  351. if (typeof value !== "undefined") return false;
  352. });
  353. }
  354. }
  355. if (typeof value === "undefined") value = DEFAULT_RAW[detect];
  356. cache[detect] = value;
  357. return value;
  358. }
  359. rawBeforeClose(root2) {
  360. let value;
  361. root2.walk((i) => {
  362. if (i.nodes && i.nodes.length > 0) {
  363. if (typeof i.raws.after !== "undefined") {
  364. value = i.raws.after;
  365. if (value.includes("\n")) {
  366. value = value.replace(/[^\n]+$/, "");
  367. }
  368. return false;
  369. }
  370. }
  371. });
  372. if (value) value = value.replace(/\S/g, "");
  373. return value;
  374. }
  375. rawBeforeComment(root2, node) {
  376. let value;
  377. root2.walkComments((i) => {
  378. if (typeof i.raws.before !== "undefined") {
  379. value = i.raws.before;
  380. if (value.includes("\n")) {
  381. value = value.replace(/[^\n]+$/, "");
  382. }
  383. return false;
  384. }
  385. });
  386. if (typeof value === "undefined") {
  387. value = this.raw(node, null, "beforeDecl");
  388. } else if (value) {
  389. value = value.replace(/\S/g, "");
  390. }
  391. return value;
  392. }
  393. rawBeforeDecl(root2, node) {
  394. let value;
  395. root2.walkDecls((i) => {
  396. if (typeof i.raws.before !== "undefined") {
  397. value = i.raws.before;
  398. if (value.includes("\n")) {
  399. value = value.replace(/[^\n]+$/, "");
  400. }
  401. return false;
  402. }
  403. });
  404. if (typeof value === "undefined") {
  405. value = this.raw(node, null, "beforeRule");
  406. } else if (value) {
  407. value = value.replace(/\S/g, "");
  408. }
  409. return value;
  410. }
  411. rawBeforeOpen(root2) {
  412. let value;
  413. root2.walk((i) => {
  414. if (i.type !== "decl") {
  415. value = i.raws.between;
  416. if (typeof value !== "undefined") return false;
  417. }
  418. });
  419. return value;
  420. }
  421. rawBeforeRule(root2) {
  422. let value;
  423. root2.walk((i) => {
  424. if (i.nodes && (i.parent !== root2 || root2.first !== i)) {
  425. if (typeof i.raws.before !== "undefined") {
  426. value = i.raws.before;
  427. if (value.includes("\n")) {
  428. value = value.replace(/[^\n]+$/, "");
  429. }
  430. return false;
  431. }
  432. }
  433. });
  434. if (value) value = value.replace(/\S/g, "");
  435. return value;
  436. }
  437. rawColon(root2) {
  438. let value;
  439. root2.walkDecls((i) => {
  440. if (typeof i.raws.between !== "undefined") {
  441. value = i.raws.between.replace(/[^\s:]/g, "");
  442. return false;
  443. }
  444. });
  445. return value;
  446. }
  447. rawEmptyBody(root2) {
  448. let value;
  449. root2.walk((i) => {
  450. if (i.nodes && i.nodes.length === 0) {
  451. value = i.raws.after;
  452. if (typeof value !== "undefined") return false;
  453. }
  454. });
  455. return value;
  456. }
  457. rawIndent(root2) {
  458. if (root2.raws.indent) return root2.raws.indent;
  459. let value;
  460. root2.walk((i) => {
  461. let p = i.parent;
  462. if (p && p !== root2 && p.parent && p.parent === root2) {
  463. if (typeof i.raws.before !== "undefined") {
  464. let parts = i.raws.before.split("\n");
  465. value = parts[parts.length - 1];
  466. value = value.replace(/\S/g, "");
  467. return false;
  468. }
  469. }
  470. });
  471. return value;
  472. }
  473. rawSemicolon(root2) {
  474. let value;
  475. root2.walk((i) => {
  476. if (i.nodes && i.nodes.length && i.last.type === "decl") {
  477. value = i.raws.semicolon;
  478. if (typeof value !== "undefined") return false;
  479. }
  480. });
  481. return value;
  482. }
  483. rawValue(node, prop) {
  484. let value = node[prop];
  485. let raw = node.raws[prop];
  486. if (raw && raw.value === value) {
  487. return raw.raw;
  488. }
  489. return value;
  490. }
  491. root(node) {
  492. if (node.source && node.source.input.hasBOM) {
  493. this.builder("\uFEFF", node, "start");
  494. }
  495. this.body(node);
  496. if (node.raws.after) {
  497. let after = node.raws.after;
  498. let isDocument = node.parent && node.parent.type === "document";
  499. this.builder(isDocument ? after : escapeHTMLInCSS(after));
  500. }
  501. }
  502. rule(node) {
  503. this.block(node, this.rawValue(node, "selector"));
  504. if (node.raws.ownSemicolon) {
  505. this.builder(escapeHTMLInCSS(node.raws.ownSemicolon), node, "end");
  506. }
  507. }
  508. stringify(node, semicolon) {
  509. if (!this[node.type]) {
  510. throw new Error(
  511. "Unknown AST node type " + node.type + ". Maybe you need to change PostCSS stringifier."
  512. );
  513. }
  514. this[node.type](node, semicolon);
  515. }
  516. };
  517. module.exports = Stringifier;
  518. Stringifier.default = Stringifier;
  519. }
  520. });
  521. // node_modules/postcss/lib/stringify.js
  522. var require_stringify = __commonJS({
  523. "node_modules/postcss/lib/stringify.js"(exports, module) {
  524. "use strict";
  525. var Stringifier = require_stringifier();
  526. function stringify3(node, builder) {
  527. let str = new Stringifier(builder);
  528. str.stringify(node);
  529. }
  530. module.exports = stringify3;
  531. stringify3.default = stringify3;
  532. }
  533. });
  534. // node_modules/postcss/lib/symbols.js
  535. var require_symbols = __commonJS({
  536. "node_modules/postcss/lib/symbols.js"(exports, module) {
  537. "use strict";
  538. module.exports.isClean = /* @__PURE__ */ Symbol("isClean");
  539. module.exports.my = /* @__PURE__ */ Symbol("my");
  540. }
  541. });
  542. // node_modules/postcss/lib/node.js
  543. var require_node = __commonJS({
  544. "node_modules/postcss/lib/node.js"(exports, module) {
  545. "use strict";
  546. var CssSyntaxError2 = require_css_syntax_error();
  547. var Stringifier = require_stringifier();
  548. var stringify3 = require_stringify();
  549. var { isClean, my } = require_symbols();
  550. function cloneNode(obj, parent) {
  551. let cloned = new obj.constructor();
  552. let stack = [[obj, cloned, parent]];
  553. while (stack.length > 0) {
  554. let [source, target, targetParent] = stack.pop();
  555. for (let i in source) {
  556. if (!Object.prototype.hasOwnProperty.call(source, i)) {
  557. continue;
  558. }
  559. if (i === "proxyCache") continue;
  560. let value = source[i];
  561. let type = typeof value;
  562. if (i === "parent" && type === "object") {
  563. if (targetParent) target[i] = targetParent;
  564. } else if (i === "source") {
  565. target[i] = value;
  566. } else if (Array.isArray(value)) {
  567. let children = [];
  568. target[i] = children;
  569. for (let j of value) {
  570. let childClone = new j.constructor();
  571. children.push(childClone);
  572. stack.push([j, childClone, target]);
  573. }
  574. } else {
  575. if (type === "object" && value !== null) {
  576. let valueClone = new value.constructor();
  577. stack.push([value, valueClone, void 0]);
  578. value = valueClone;
  579. }
  580. target[i] = value;
  581. }
  582. }
  583. }
  584. return cloned;
  585. }
  586. function sourceOffset(inputCSS, position) {
  587. if (position && typeof position.offset !== "undefined") {
  588. return position.offset;
  589. }
  590. let column = 1;
  591. let line = 1;
  592. let offset = 0;
  593. for (let i = 0; i < inputCSS.length; i++) {
  594. if (line === position.line && column === position.column) {
  595. offset = i;
  596. break;
  597. }
  598. if (inputCSS[i] === "\n") {
  599. column = 1;
  600. line += 1;
  601. } else {
  602. column += 1;
  603. }
  604. }
  605. return offset;
  606. }
  607. var Node3 = class _Node {
  608. get proxyOf() {
  609. return this;
  610. }
  611. constructor(defaults2 = {}) {
  612. this.raws = {};
  613. this[isClean] = false;
  614. this[my] = true;
  615. for (let name of Object.keys(defaults2)) {
  616. if (name === "__proto__") continue;
  617. if (name === "nodes") {
  618. this.nodes = [];
  619. for (let node of defaults2[name]) {
  620. if (typeof node.clone === "function" && node.parent) {
  621. this.append(node.clone());
  622. } else {
  623. this.append(node);
  624. }
  625. }
  626. } else {
  627. this[name] = defaults2[name];
  628. }
  629. }
  630. }
  631. addToError(error) {
  632. error.postcssNode = this;
  633. if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
  634. let s = this.source;
  635. error.stack = error.stack.replace(
  636. /\n\s{4}at /,
  637. `$&${s.input.from}:${s.start.line}:${s.start.column}$&`
  638. );
  639. }
  640. return error;
  641. }
  642. after(add) {
  643. this.parent.insertAfter(this, add);
  644. return this;
  645. }
  646. assign(overrides = {}) {
  647. for (let name in overrides) {
  648. this[name] = overrides[name];
  649. }
  650. return this;
  651. }
  652. before(add) {
  653. this.parent.insertBefore(this, add);
  654. return this;
  655. }
  656. cleanRaws(keepBetween) {
  657. delete this.raws.before;
  658. delete this.raws.after;
  659. if (!keepBetween) delete this.raws.between;
  660. }
  661. clone(overrides = {}) {
  662. let cloned = cloneNode(this);
  663. for (let name in overrides) {
  664. cloned[name] = overrides[name];
  665. }
  666. return cloned;
  667. }
  668. cloneAfter(overrides = {}) {
  669. let cloned = this.clone(overrides);
  670. this.parent.insertAfter(this, cloned);
  671. return cloned;
  672. }
  673. cloneBefore(overrides = {}) {
  674. let cloned = this.clone(overrides);
  675. this.parent.insertBefore(this, cloned);
  676. return cloned;
  677. }
  678. error(message, opts = {}) {
  679. if (this.source) {
  680. let { end, start } = this.rangeBy(opts);
  681. return this.source.input.error(
  682. message,
  683. { column: start.column, line: start.line },
  684. { column: end.column, line: end.line },
  685. opts
  686. );
  687. }
  688. return new CssSyntaxError2(message);
  689. }
  690. getProxyProcessor() {
  691. return {
  692. get(node, prop) {
  693. if (prop === "proxyOf") {
  694. return node;
  695. } else if (prop === "root") {
  696. return () => node.root().toProxy();
  697. } else {
  698. return node[prop];
  699. }
  700. },
  701. set(node, prop, value) {
  702. if (node[prop] === value) return true;
  703. node[prop] = value;
  704. if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" || /* c8 ignore next */
  705. prop === "text") {
  706. node.markDirty();
  707. }
  708. return true;
  709. }
  710. };
  711. }
  712. /* c8 ignore next 3 */
  713. markClean() {
  714. this[isClean] = true;
  715. }
  716. markDirty() {
  717. if (this[isClean]) {
  718. this[isClean] = false;
  719. let next = this;
  720. while (next = next.parent) {
  721. next[isClean] = false;
  722. }
  723. }
  724. }
  725. next() {
  726. if (!this.parent) return void 0;
  727. let index = this.parent.index(this);
  728. return this.parent.nodes[index + 1];
  729. }
  730. positionBy(opts = {}) {
  731. let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
  732. let pos = {
  733. column: this.source.start.column,
  734. line: this.source.start.line,
  735. offset: sourceOffset(inputString, this.source.start)
  736. };
  737. if (opts.index) {
  738. pos = this.positionInside(opts.index);
  739. } else if (opts.word) {
  740. let stringRepresentation = inputString.slice(
  741. sourceOffset(inputString, this.source.start),
  742. sourceOffset(inputString, this.source.end)
  743. );
  744. let index = stringRepresentation.indexOf(opts.word);
  745. if (index !== -1) pos = this.positionInside(index);
  746. }
  747. return pos;
  748. }
  749. positionInside(index) {
  750. let column = this.source.start.column;
  751. let line = this.source.start.line;
  752. let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
  753. let offset = sourceOffset(inputString, this.source.start);
  754. let end = offset + index;
  755. for (let i = offset; i < end; i++) {
  756. if (inputString[i] === "\n") {
  757. column = 1;
  758. line += 1;
  759. } else {
  760. column += 1;
  761. }
  762. }
  763. return { column, line, offset: end };
  764. }
  765. prev() {
  766. if (!this.parent) return void 0;
  767. let index = this.parent.index(this);
  768. return this.parent.nodes[index - 1];
  769. }
  770. rangeBy(opts = {}) {
  771. let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
  772. let start = {
  773. column: this.source.start.column,
  774. line: this.source.start.line,
  775. offset: sourceOffset(inputString, this.source.start)
  776. };
  777. let end = this.source.end ? {
  778. column: this.source.end.column + 1,
  779. line: this.source.end.line,
  780. offset: typeof this.source.end.offset === "number" ? (
  781. // `source.end.offset` is exclusive, so we don't need to add 1
  782. this.source.end.offset
  783. ) : (
  784. // Since line/column in this.source.end is inclusive,
  785. // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
  786. // So, we add 1 to convert it to exclusive.
  787. sourceOffset(inputString, this.source.end) + 1
  788. )
  789. } : {
  790. column: start.column + 1,
  791. line: start.line,
  792. offset: start.offset + 1
  793. };
  794. if (opts.word) {
  795. let stringRepresentation = inputString.slice(
  796. sourceOffset(inputString, this.source.start),
  797. sourceOffset(inputString, this.source.end)
  798. );
  799. let index = stringRepresentation.indexOf(opts.word);
  800. if (index !== -1) {
  801. start = this.positionInside(index);
  802. end = this.positionInside(index + opts.word.length);
  803. }
  804. } else {
  805. if (opts.start) {
  806. start = {
  807. column: opts.start.column,
  808. line: opts.start.line,
  809. offset: sourceOffset(inputString, opts.start)
  810. };
  811. } else if (typeof opts.index === "number") {
  812. start = this.positionInside(opts.index);
  813. }
  814. if (opts.end) {
  815. end = {
  816. column: opts.end.column,
  817. line: opts.end.line,
  818. offset: sourceOffset(inputString, opts.end)
  819. };
  820. } else if (typeof opts.endIndex === "number") {
  821. end = this.positionInside(opts.endIndex);
  822. } else if (typeof opts.index === "number") {
  823. end = this.positionInside(opts.index + 1);
  824. }
  825. }
  826. if (end.line < start.line || end.line === start.line && end.column <= start.column) {
  827. end = {
  828. column: start.column + 1,
  829. line: start.line,
  830. offset: start.offset + 1
  831. };
  832. }
  833. return { end, start };
  834. }
  835. raw(prop, defaultType) {
  836. let str = new Stringifier();
  837. return str.raw(this, prop, defaultType);
  838. }
  839. remove() {
  840. if (this.parent) {
  841. this.parent.removeChild(this);
  842. }
  843. this.parent = void 0;
  844. return this;
  845. }
  846. replaceWith(...nodes) {
  847. if (this.parent) {
  848. let bookmark = this;
  849. let foundSelf = false;
  850. for (let node of nodes) {
  851. if (node === this) {
  852. foundSelf = true;
  853. } else if (foundSelf) {
  854. this.parent.insertAfter(bookmark, node);
  855. bookmark = node;
  856. } else {
  857. this.parent.insertBefore(bookmark, node);
  858. }
  859. }
  860. if (!foundSelf) {
  861. this.remove();
  862. }
  863. }
  864. return this;
  865. }
  866. root() {
  867. let result = this;
  868. while (result.parent && result.parent.type !== "document") {
  869. result = result.parent;
  870. }
  871. return result;
  872. }
  873. toJSON(_, inputs) {
  874. let emitInputs = inputs == null;
  875. inputs = inputs || /* @__PURE__ */ new Map();
  876. let holderOfRoot = [];
  877. let queue = [[this, holderOfRoot, 0]];
  878. for (let step = 0; step < queue.length; step++) {
  879. let [node, holder, key] = queue[step];
  880. let fixed2 = {};
  881. holder[key] = fixed2;
  882. for (let name in node) {
  883. if (!Object.prototype.hasOwnProperty.call(node, name)) {
  884. continue;
  885. }
  886. if (name === "parent" || name === "proxyCache") continue;
  887. let value = node[name];
  888. if (Array.isArray(value)) {
  889. let fixedArray = [];
  890. fixed2[name] = fixedArray;
  891. for (let i = 0; i < value.length; i++) {
  892. let item = value[i];
  893. if (typeof item === "object" && item.toJSON) {
  894. if (item.toJSON === _Node.prototype.toJSON) {
  895. queue.push([item, fixedArray, i]);
  896. } else {
  897. fixedArray[i] = item.toJSON(null, inputs);
  898. }
  899. } else {
  900. fixedArray[i] = item;
  901. }
  902. }
  903. } else if (typeof value === "object" && value.toJSON) {
  904. if (value.toJSON === _Node.prototype.toJSON) {
  905. queue.push([value, fixed2, name]);
  906. } else {
  907. fixed2[name] = value.toJSON(null, inputs);
  908. }
  909. } else if (name === "source") {
  910. if (value == null) continue;
  911. let inputId = inputs.get(value.input);
  912. if (inputId == null) {
  913. inputId = inputs.size;
  914. inputs.set(value.input, inputId);
  915. }
  916. fixed2[name] = {
  917. end: value.end,
  918. inputId,
  919. start: value.start
  920. };
  921. } else {
  922. fixed2[name] = value;
  923. }
  924. }
  925. }
  926. let fixed = holderOfRoot[0];
  927. if (emitInputs) {
  928. fixed.inputs = [...inputs.keys()].map((input) => input.toJSON());
  929. }
  930. return fixed;
  931. }
  932. toProxy() {
  933. if (!this.proxyCache) {
  934. this.proxyCache = new Proxy(this, this.getProxyProcessor());
  935. }
  936. return this.proxyCache;
  937. }
  938. toString(stringifier = stringify3) {
  939. if (stringifier.stringify) stringifier = stringifier.stringify;
  940. let result = "";
  941. stringifier(this, (i) => {
  942. result += i;
  943. });
  944. return result;
  945. }
  946. warn(result, text, opts = {}) {
  947. let data = { node: this };
  948. for (let i in opts) data[i] = opts[i];
  949. return result.warn(text, data);
  950. }
  951. };
  952. module.exports = Node3;
  953. Node3.default = Node3;
  954. }
  955. });
  956. // node_modules/postcss/lib/comment.js
  957. var require_comment = __commonJS({
  958. "node_modules/postcss/lib/comment.js"(exports, module) {
  959. "use strict";
  960. var Node3 = require_node();
  961. var Comment2 = class extends Node3 {
  962. constructor(defaults2) {
  963. super(defaults2);
  964. this.type = "comment";
  965. }
  966. };
  967. module.exports = Comment2;
  968. Comment2.default = Comment2;
  969. }
  970. });
  971. // node_modules/postcss/lib/declaration.js
  972. var require_declaration = __commonJS({
  973. "node_modules/postcss/lib/declaration.js"(exports, module) {
  974. "use strict";
  975. var Node3 = require_node();
  976. var Declaration2 = class extends Node3 {
  977. get variable() {
  978. return this.prop.startsWith("--") || this.prop[0] === "$";
  979. }
  980. constructor(defaults2) {
  981. if (defaults2 && typeof defaults2.value !== "undefined" && typeof defaults2.value !== "string") {
  982. defaults2 = { ...defaults2, value: String(defaults2.value) };
  983. }
  984. super(defaults2);
  985. this.type = "decl";
  986. }
  987. };
  988. module.exports = Declaration2;
  989. Declaration2.default = Declaration2;
  990. }
  991. });
  992. // node_modules/postcss/lib/container.js
  993. var require_container = __commonJS({
  994. "node_modules/postcss/lib/container.js"(exports, module) {
  995. "use strict";
  996. var Comment2 = require_comment();
  997. var Declaration2 = require_declaration();
  998. var Node3 = require_node();
  999. var { isClean, my } = require_symbols();
  1000. var AtRule2;
  1001. var parse3;
  1002. var Root2;
  1003. var Rule2;
  1004. function cleanSource(nodes) {
  1005. let stack = nodes.slice();
  1006. while (stack.length > 0) {
  1007. let node = stack.pop();
  1008. delete node.source;
  1009. if (node.nodes) {
  1010. node.nodes = node.nodes.slice();
  1011. for (let i of node.nodes) stack.push(i);
  1012. }
  1013. }
  1014. return nodes.slice();
  1015. }
  1016. function markTreeDirty(node) {
  1017. let stack = [node];
  1018. while (stack.length > 0) {
  1019. let next = stack.pop();
  1020. next[isClean] = false;
  1021. if (next.proxyOf.nodes) {
  1022. for (let i of next.proxyOf.nodes) stack.push(i);
  1023. }
  1024. }
  1025. }
  1026. var Container2 = class _Container extends Node3 {
  1027. get first() {
  1028. if (!this.proxyOf.nodes) return void 0;
  1029. return this.proxyOf.nodes[0];
  1030. }
  1031. get last() {
  1032. if (!this.proxyOf.nodes) return void 0;
  1033. return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
  1034. }
  1035. append(...children) {
  1036. for (let child of children) {
  1037. let nodes = this.normalize(child, this.last);
  1038. for (let node of nodes) this.proxyOf.nodes.push(node);
  1039. }
  1040. this.markDirty();
  1041. return this;
  1042. }
  1043. cleanRaws(keepBetween) {
  1044. let stack = [this];
  1045. while (stack.length > 0) {
  1046. let node = stack.pop();
  1047. if (node !== this && node.cleanRaws !== _Container.prototype.cleanRaws) {
  1048. node.cleanRaws(keepBetween);
  1049. continue;
  1050. }
  1051. Node3.prototype.cleanRaws.call(node, keepBetween);
  1052. if (node.nodes) {
  1053. for (let child of node.nodes) stack.push(child);
  1054. }
  1055. }
  1056. }
  1057. each(callback) {
  1058. if (!this.proxyOf.nodes) return void 0;
  1059. let iterator = this.getIterator();
  1060. let index, result;
  1061. while (this.indexes[iterator] < this.proxyOf.nodes.length) {
  1062. index = this.indexes[iterator];
  1063. result = callback(this.proxyOf.nodes[index], index);
  1064. if (result === false) break;
  1065. this.indexes[iterator] += 1;
  1066. }
  1067. delete this.indexes[iterator];
  1068. return result;
  1069. }
  1070. every(condition) {
  1071. return this.nodes.every(condition);
  1072. }
  1073. getIterator() {
  1074. if (!this.lastEach) this.lastEach = 0;
  1075. if (!this.indexes) this.indexes = {};
  1076. this.lastEach += 1;
  1077. let iterator = this.lastEach;
  1078. this.indexes[iterator] = 0;
  1079. return iterator;
  1080. }
  1081. getProxyProcessor() {
  1082. return {
  1083. get(node, prop) {
  1084. if (prop === "proxyOf") {
  1085. return node;
  1086. } else if (!node[prop]) {
  1087. return node[prop];
  1088. } else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
  1089. return (...args) => {
  1090. return node[prop](
  1091. ...args.map((i) => {
  1092. if (typeof i === "function") {
  1093. return (child, index) => i(child.toProxy(), index);
  1094. } else {
  1095. return i;
  1096. }
  1097. })
  1098. );
  1099. };
  1100. } else if (prop === "every" || prop === "some") {
  1101. return (cb) => {
  1102. return node[prop](
  1103. (child, ...other) => cb(child.toProxy(), ...other)
  1104. );
  1105. };
  1106. } else if (prop === "root") {
  1107. return () => node.root().toProxy();
  1108. } else if (prop === "nodes") {
  1109. return node.nodes.map((i) => i.toProxy());
  1110. } else if (prop === "first" || prop === "last") {
  1111. return node[prop].toProxy();
  1112. } else {
  1113. return node[prop];
  1114. }
  1115. },
  1116. set(node, prop, value) {
  1117. if (node[prop] === value) return true;
  1118. node[prop] = value;
  1119. if (prop === "name" || prop === "params" || prop === "selector") {
  1120. node.markDirty();
  1121. }
  1122. return true;
  1123. }
  1124. };
  1125. }
  1126. index(child) {
  1127. if (typeof child === "number") return child;
  1128. if (child.proxyOf) child = child.proxyOf;
  1129. return this.proxyOf.nodes.indexOf(child);
  1130. }
  1131. insertAfter(exist, add) {
  1132. let existIndex = this.index(exist);
  1133. let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
  1134. existIndex = this.index(exist);
  1135. for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node);
  1136. let index;
  1137. for (let id in this.indexes) {
  1138. index = this.indexes[id];
  1139. if (existIndex < index) {
  1140. this.indexes[id] = index + nodes.length;
  1141. }
  1142. }
  1143. this.markDirty();
  1144. return this;
  1145. }
  1146. insertBefore(exist, add) {
  1147. let existIndex = this.index(exist);
  1148. let type = existIndex === 0 ? "prepend" : false;
  1149. let nodes = this.normalize(
  1150. add,
  1151. this.proxyOf.nodes[existIndex],
  1152. type
  1153. ).reverse();
  1154. existIndex = this.index(exist);
  1155. for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node);
  1156. let index;
  1157. for (let id in this.indexes) {
  1158. index = this.indexes[id];
  1159. if (existIndex <= index) {
  1160. this.indexes[id] = index + nodes.length;
  1161. }
  1162. }
  1163. this.markDirty();
  1164. return this;
  1165. }
  1166. normalize(nodes, sample) {
  1167. if (typeof nodes === "string") {
  1168. nodes = cleanSource(parse3(nodes).nodes);
  1169. } else if (typeof nodes === "undefined") {
  1170. nodes = [];
  1171. } else if (Array.isArray(nodes)) {
  1172. nodes = nodes.slice(0);
  1173. for (let i of nodes) {
  1174. if (i.parent) i.parent.removeChild(i, "ignore");
  1175. }
  1176. } else if (nodes.type === "root" && this.type !== "document") {
  1177. nodes = nodes.nodes.slice(0);
  1178. for (let i of nodes) {
  1179. if (i.parent) i.parent.removeChild(i, "ignore");
  1180. }
  1181. } else if (nodes.type) {
  1182. nodes = [nodes];
  1183. } else if (nodes.prop) {
  1184. if (typeof nodes.value === "undefined") {
  1185. throw new Error("Value field is missed in node creation");
  1186. } else if (typeof nodes.value !== "string") {
  1187. nodes.value = String(nodes.value);
  1188. }
  1189. nodes = [new Declaration2(nodes)];
  1190. } else if (nodes.selector || nodes.selectors) {
  1191. nodes = [new Rule2(nodes)];
  1192. } else if (nodes.name) {
  1193. nodes = [new AtRule2(nodes)];
  1194. } else if (nodes.text) {
  1195. nodes = [new Comment2(nodes)];
  1196. } else {
  1197. throw new Error("Unknown node type in node creation");
  1198. }
  1199. let processed = nodes.map((i) => {
  1200. if (!i[my]) _Container.rebuild(i);
  1201. i = i.proxyOf;
  1202. if (i.parent) i.parent.removeChild(i);
  1203. if (i[isClean]) markTreeDirty(i);
  1204. if (!i.raws) i.raws = {};
  1205. if (typeof i.raws.before === "undefined") {
  1206. if (sample && typeof sample.raws.before !== "undefined") {
  1207. i.raws.before = sample.raws.before.replace(/\S/g, "");
  1208. }
  1209. }
  1210. i.parent = this.proxyOf;
  1211. return i;
  1212. });
  1213. return processed;
  1214. }
  1215. prepend(...children) {
  1216. children = children.reverse();
  1217. for (let child of children) {
  1218. let nodes = this.normalize(child, this.first, "prepend").reverse();
  1219. for (let node of nodes) this.proxyOf.nodes.unshift(node);
  1220. for (let id in this.indexes) {
  1221. this.indexes[id] = this.indexes[id] + nodes.length;
  1222. }
  1223. }
  1224. this.markDirty();
  1225. return this;
  1226. }
  1227. push(child) {
  1228. child.parent = this;
  1229. this.proxyOf.nodes.push(child);
  1230. return this;
  1231. }
  1232. removeAll() {
  1233. for (let node of this.proxyOf.nodes) node.parent = void 0;
  1234. this.proxyOf.nodes = [];
  1235. this.markDirty();
  1236. return this;
  1237. }
  1238. removeChild(child) {
  1239. child = this.index(child);
  1240. this.proxyOf.nodes[child].parent = void 0;
  1241. this.proxyOf.nodes.splice(child, 1);
  1242. let index;
  1243. for (let id in this.indexes) {
  1244. index = this.indexes[id];
  1245. if (index >= child) {
  1246. this.indexes[id] = index - 1;
  1247. }
  1248. }
  1249. this.markDirty();
  1250. return this;
  1251. }
  1252. replaceValues(pattern, opts, callback) {
  1253. if (!callback) {
  1254. callback = opts;
  1255. opts = {};
  1256. }
  1257. this.walkDecls((decl2) => {
  1258. if (opts.props && !opts.props.includes(decl2.prop)) return;
  1259. if (opts.fast && !decl2.value.includes(opts.fast)) return;
  1260. decl2.value = decl2.value.replace(pattern, callback);
  1261. });
  1262. this.markDirty();
  1263. return this;
  1264. }
  1265. some(condition) {
  1266. return this.nodes.some(condition);
  1267. }
  1268. walk(callback) {
  1269. if (!this.proxyOf.nodes) return void 0;
  1270. let stack = [{ iterator: this.getIterator(), node: this.proxyOf }];
  1271. while (stack.length > 0) {
  1272. let { iterator, node } = stack[stack.length - 1];
  1273. let index = node.indexes[iterator];
  1274. if (index >= node.proxyOf.nodes.length) {
  1275. delete node.indexes[iterator];
  1276. stack.pop();
  1277. let parent = stack[stack.length - 1];
  1278. if (parent) parent.node.indexes[parent.iterator] += 1;
  1279. continue;
  1280. }
  1281. let child = node.proxyOf.nodes[index];
  1282. let result;
  1283. try {
  1284. result = callback(child, index);
  1285. } catch (e) {
  1286. throw child.addToError(e);
  1287. }
  1288. if (result === false) {
  1289. for (let opened of stack) {
  1290. delete opened.node.indexes[opened.iterator];
  1291. }
  1292. return false;
  1293. }
  1294. if (child.walk && child.proxyOf.nodes) {
  1295. stack.push({ iterator: child.getIterator(), node: child });
  1296. } else {
  1297. node.indexes[iterator] += 1;
  1298. }
  1299. }
  1300. return void 0;
  1301. }
  1302. walkAtRules(name, callback) {
  1303. if (!callback) {
  1304. callback = name;
  1305. return this.walk((child, i) => {
  1306. if (child.type === "atrule") {
  1307. return callback(child, i);
  1308. }
  1309. });
  1310. }
  1311. if (name instanceof RegExp) {
  1312. return this.walk((child, i) => {
  1313. if (child.type === "atrule" && name.test(child.name)) {
  1314. return callback(child, i);
  1315. }
  1316. });
  1317. }
  1318. return this.walk((child, i) => {
  1319. if (child.type === "atrule" && child.name === name) {
  1320. return callback(child, i);
  1321. }
  1322. });
  1323. }
  1324. walkComments(callback) {
  1325. return this.walk((child, i) => {
  1326. if (child.type === "comment") {
  1327. return callback(child, i);
  1328. }
  1329. });
  1330. }
  1331. walkDecls(prop, callback) {
  1332. if (!callback) {
  1333. callback = prop;
  1334. return this.walk((child, i) => {
  1335. if (child.type === "decl") {
  1336. return callback(child, i);
  1337. }
  1338. });
  1339. }
  1340. if (prop instanceof RegExp) {
  1341. return this.walk((child, i) => {
  1342. if (child.type === "decl" && prop.test(child.prop)) {
  1343. return callback(child, i);
  1344. }
  1345. });
  1346. }
  1347. return this.walk((child, i) => {
  1348. if (child.type === "decl" && child.prop === prop) {
  1349. return callback(child, i);
  1350. }
  1351. });
  1352. }
  1353. walkRules(selector, callback) {
  1354. if (!callback) {
  1355. callback = selector;
  1356. return this.walk((child, i) => {
  1357. if (child.type === "rule") {
  1358. return callback(child, i);
  1359. }
  1360. });
  1361. }
  1362. if (selector instanceof RegExp) {
  1363. return this.walk((child, i) => {
  1364. if (child.type === "rule" && selector.test(child.selector)) {
  1365. return callback(child, i);
  1366. }
  1367. });
  1368. }
  1369. return this.walk((child, i) => {
  1370. if (child.type === "rule" && child.selector === selector) {
  1371. return callback(child, i);
  1372. }
  1373. });
  1374. }
  1375. };
  1376. Container2.registerParse = (dependant) => {
  1377. parse3 = dependant;
  1378. };
  1379. Container2.registerRule = (dependant) => {
  1380. Rule2 = dependant;
  1381. };
  1382. Container2.registerAtRule = (dependant) => {
  1383. AtRule2 = dependant;
  1384. };
  1385. Container2.registerRoot = (dependant) => {
  1386. Root2 = dependant;
  1387. };
  1388. module.exports = Container2;
  1389. Container2.default = Container2;
  1390. Container2.rebuild = (node) => {
  1391. let stack = [node];
  1392. while (stack.length > 0) {
  1393. let next = stack.pop();
  1394. if (next.type === "atrule") {
  1395. Object.setPrototypeOf(next, AtRule2.prototype);
  1396. } else if (next.type === "rule") {
  1397. Object.setPrototypeOf(next, Rule2.prototype);
  1398. } else if (next.type === "decl") {
  1399. Object.setPrototypeOf(next, Declaration2.prototype);
  1400. } else if (next.type === "comment") {
  1401. Object.setPrototypeOf(next, Comment2.prototype);
  1402. } else if (next.type === "root") {
  1403. Object.setPrototypeOf(next, Root2.prototype);
  1404. }
  1405. next[my] = true;
  1406. if (next.nodes) {
  1407. for (let child of next.nodes) stack.push(child);
  1408. }
  1409. }
  1410. };
  1411. }
  1412. });
  1413. // node_modules/postcss/lib/at-rule.js
  1414. var require_at_rule = __commonJS({
  1415. "node_modules/postcss/lib/at-rule.js"(exports, module) {
  1416. "use strict";
  1417. var Container2 = require_container();
  1418. var AtRule2 = class extends Container2 {
  1419. constructor(defaults2) {
  1420. super(defaults2);
  1421. this.type = "atrule";
  1422. }
  1423. append(...children) {
  1424. if (!this.proxyOf.nodes) this.nodes = [];
  1425. return super.append(...children);
  1426. }
  1427. prepend(...children) {
  1428. if (!this.proxyOf.nodes) this.nodes = [];
  1429. return super.prepend(...children);
  1430. }
  1431. };
  1432. module.exports = AtRule2;
  1433. AtRule2.default = AtRule2;
  1434. Container2.registerAtRule(AtRule2);
  1435. }
  1436. });
  1437. // node_modules/postcss/lib/document.js
  1438. var require_document = __commonJS({
  1439. "node_modules/postcss/lib/document.js"(exports, module) {
  1440. "use strict";
  1441. var Container2 = require_container();
  1442. var LazyResult;
  1443. var Processor2;
  1444. var Document2 = class extends Container2 {
  1445. constructor(defaults2) {
  1446. super({ type: "document", ...defaults2 });
  1447. if (!this.nodes) {
  1448. this.nodes = [];
  1449. }
  1450. }
  1451. toResult(opts = {}) {
  1452. let lazy = new LazyResult(new Processor2(), this, opts);
  1453. return lazy.stringify();
  1454. }
  1455. };
  1456. Document2.registerLazyResult = (dependant) => {
  1457. LazyResult = dependant;
  1458. };
  1459. Document2.registerProcessor = (dependant) => {
  1460. Processor2 = dependant;
  1461. };
  1462. module.exports = Document2;
  1463. Document2.default = Document2;
  1464. }
  1465. });
  1466. // node_modules/nanoid/non-secure/index.cjs
  1467. var require_non_secure = __commonJS({
  1468. "node_modules/nanoid/non-secure/index.cjs"(exports, module) {
  1469. var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
  1470. var customAlphabet = (alphabet, defaultSize = 21) => {
  1471. return (size = defaultSize) => {
  1472. let id = "";
  1473. let i = size | 0;
  1474. while (i-- > 0) {
  1475. id += alphabet[Math.random() * alphabet.length | 0];
  1476. }
  1477. return id;
  1478. };
  1479. };
  1480. var nanoid = (size = 21) => {
  1481. let id = "";
  1482. let i = size | 0;
  1483. while (i-- > 0) {
  1484. id += urlAlphabet[Math.random() * 64 | 0];
  1485. }
  1486. return id;
  1487. };
  1488. module.exports = { nanoid, customAlphabet };
  1489. }
  1490. });
  1491. // (disabled):path
  1492. var require_path = __commonJS({
  1493. "(disabled):path"() {
  1494. }
  1495. });
  1496. // (disabled):node_modules/source-map-js/source-map.js
  1497. var require_source_map = __commonJS({
  1498. "(disabled):node_modules/source-map-js/source-map.js"() {
  1499. }
  1500. });
  1501. // (disabled):url
  1502. var require_url = __commonJS({
  1503. "(disabled):url"() {
  1504. }
  1505. });
  1506. // (disabled):fs
  1507. var require_fs = __commonJS({
  1508. "(disabled):fs"() {
  1509. }
  1510. });
  1511. // node_modules/postcss/lib/previous-map.js
  1512. var require_previous_map = __commonJS({
  1513. "node_modules/postcss/lib/previous-map.js"(exports, module) {
  1514. "use strict";
  1515. var { existsSync, readFileSync } = require_fs();
  1516. var { dirname, isAbsolute, join, relative, sep } = require_path();
  1517. var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
  1518. function fromBase64(str) {
  1519. if (Buffer) {
  1520. return Buffer.from(str, "base64").toString();
  1521. } else {
  1522. return window.atob(str);
  1523. }
  1524. }
  1525. var PreviousMap = class {
  1526. constructor(css, opts) {
  1527. if (opts.map === false) return;
  1528. if (opts.unsafeMap) this.unsafeMap = true;
  1529. this.loadAnnotation(css);
  1530. this.inline = this.startWith(this.annotation, "data:");
  1531. let prev = opts.map ? opts.map.prev : void 0;
  1532. let text = this.loadMap(opts.from, prev);
  1533. if (!this.mapFile && opts.from) {
  1534. this.mapFile = opts.from;
  1535. }
  1536. if (this.mapFile) this.root = dirname(this.mapFile);
  1537. if (text) this.text = text;
  1538. }
  1539. consumer() {
  1540. if (!this.consumerCache) {
  1541. this.consumerCache = new SourceMapConsumer(this.json || this.text);
  1542. }
  1543. return this.consumerCache;
  1544. }
  1545. decodeInline(text) {
  1546. let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
  1547. let baseUri = /^data:application\/json;base64,/;
  1548. let charsetUri = /^data:application\/json;charset=utf-?8,/;
  1549. let uri = /^data:application\/json,/;
  1550. let uriMatch = text.match(charsetUri) || text.match(uri);
  1551. if (uriMatch) {
  1552. return decodeURIComponent(text.substr(uriMatch[0].length));
  1553. }
  1554. let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri);
  1555. if (baseUriMatch) {
  1556. return fromBase64(text.substr(baseUriMatch[0].length));
  1557. }
  1558. let encoding = text.slice("data:application/json;".length);
  1559. encoding = encoding.slice(0, encoding.indexOf(","));
  1560. throw new Error("Unsupported source map encoding " + encoding);
  1561. }
  1562. getAnnotationURL(sourceMapString) {
  1563. return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
  1564. }
  1565. isMap(map) {
  1566. if (typeof map !== "object") return false;
  1567. return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
  1568. }
  1569. loadAnnotation(css) {
  1570. let comments = css.match(/\/\*\s*# sourceMappingURL=/g);
  1571. if (!comments) return;
  1572. let start = css.lastIndexOf(comments.pop());
  1573. let end = css.indexOf("*/", start);
  1574. if (start > -1 && end > -1) {
  1575. this.annotation = this.getAnnotationURL(css.substring(start, end));
  1576. }
  1577. }
  1578. loadFile(path, cssFile, trusted) {
  1579. if (!trusted && !this.unsafeMap) {
  1580. if (!/\.map$/i.test(path)) return void 0;
  1581. if (!cssFile) return void 0;
  1582. let rel = relative(dirname(cssFile), path);
  1583. if (rel === ".." || rel.startsWith(".." + sep) || isAbsolute(rel)) {
  1584. return void 0;
  1585. }
  1586. }
  1587. this.root = dirname(path);
  1588. if (existsSync(path)) {
  1589. this.mapFile = path;
  1590. return readFileSync(path, "utf-8").toString().trim();
  1591. }
  1592. }
  1593. loadMap(file, prev) {
  1594. if (prev === false) return false;
  1595. if (prev) {
  1596. if (typeof prev === "string") {
  1597. return prev;
  1598. } else if (typeof prev === "function") {
  1599. let prevPath = prev(file);
  1600. if (prevPath) {
  1601. let map = this.loadFile(prevPath, file, true);
  1602. if (!map) {
  1603. throw new Error(
  1604. "Unable to load previous source map: " + prevPath.toString()
  1605. );
  1606. }
  1607. return map;
  1608. }
  1609. } else if (prev instanceof SourceMapConsumer) {
  1610. return SourceMapGenerator.fromSourceMap(prev).toString();
  1611. } else if (prev instanceof SourceMapGenerator) {
  1612. return prev.toString();
  1613. } else if (this.isMap(prev)) {
  1614. return JSON.stringify(prev);
  1615. } else {
  1616. throw new Error(
  1617. "Unsupported previous source map format: " + prev.toString()
  1618. );
  1619. }
  1620. } else if (this.inline) {
  1621. return this.decodeInline(this.annotation);
  1622. } else if (this.annotation) {
  1623. let map = this.annotation;
  1624. if (file) map = join(dirname(file), map);
  1625. let unknown = this.loadFile(map, file, false);
  1626. if (unknown) {
  1627. try {
  1628. this.json = JSON.parse(unknown.replace(/^\)]}'[^\n]*\n/, ""));
  1629. } catch {
  1630. return void 0;
  1631. }
  1632. }
  1633. return unknown;
  1634. }
  1635. }
  1636. startWith(string, start) {
  1637. if (!string) return false;
  1638. return string.substr(0, start.length) === start;
  1639. }
  1640. withContent() {
  1641. return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
  1642. }
  1643. };
  1644. module.exports = PreviousMap;
  1645. PreviousMap.default = PreviousMap;
  1646. }
  1647. });
  1648. // node_modules/postcss/lib/input.js
  1649. var require_input = __commonJS({
  1650. "node_modules/postcss/lib/input.js"(exports, module) {
  1651. "use strict";
  1652. var { nanoid } = require_non_secure();
  1653. var { isAbsolute, resolve } = require_path();
  1654. var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
  1655. var { fileURLToPath, pathToFileURL } = require_url();
  1656. var CssSyntaxError2 = require_css_syntax_error();
  1657. var PreviousMap = require_previous_map();
  1658. var terminalHighlight = require_terminal_highlight();
  1659. var lineToIndexCache = /* @__PURE__ */ Symbol("lineToIndexCache");
  1660. var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
  1661. var pathAvailable = Boolean(resolve && isAbsolute);
  1662. function getLineToIndex(input) {
  1663. if (input[lineToIndexCache]) return input[lineToIndexCache];
  1664. let lines = input.css.split("\n");
  1665. let lineToIndex = new Array(lines.length);
  1666. let prevIndex = 0;
  1667. for (let i = 0, l = lines.length; i < l; i++) {
  1668. lineToIndex[i] = prevIndex;
  1669. prevIndex += lines[i].length + 1;
  1670. }
  1671. input[lineToIndexCache] = lineToIndex;
  1672. return lineToIndex;
  1673. }
  1674. var Input2 = class {
  1675. get from() {
  1676. return this.file || this.id;
  1677. }
  1678. constructor(css, opts = {}) {
  1679. if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
  1680. throw new Error(`PostCSS received ${css} instead of CSS string`);
  1681. }
  1682. this.css = css.toString();
  1683. if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
  1684. this.hasBOM = true;
  1685. this.css = this.css.slice(1);
  1686. } else {
  1687. this.hasBOM = false;
  1688. }
  1689. this.document = this.css;
  1690. if (opts.document) this.document = opts.document.toString();
  1691. if (opts.from) {
  1692. if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
  1693. this.file = opts.from;
  1694. } else {
  1695. this.file = resolve(opts.from);
  1696. }
  1697. }
  1698. if (pathAvailable && sourceMapAvailable) {
  1699. let map = new PreviousMap(this.css, opts);
  1700. if (map.text) {
  1701. this.map = map;
  1702. let file = map.consumer().file;
  1703. if (!this.file && file) this.file = this.mapResolve(file);
  1704. }
  1705. }
  1706. if (!this.file) {
  1707. this.id = "<input css " + nanoid(6) + ">";
  1708. }
  1709. if (this.map) this.map.file = this.from;
  1710. }
  1711. error(message, line, column, opts = {}) {
  1712. let endColumn, endLine, endOffset, offset, result;
  1713. if (line && typeof line === "object") {
  1714. let start = line;
  1715. let end = column;
  1716. if (typeof start.offset === "number") {
  1717. offset = start.offset;
  1718. let pos = this.fromOffset(offset);
  1719. line = pos.line;
  1720. column = pos.col;
  1721. } else {
  1722. line = start.line;
  1723. column = start.column;
  1724. offset = this.fromLineAndColumn(line, column);
  1725. }
  1726. if (typeof end.offset === "number") {
  1727. endOffset = end.offset;
  1728. let pos = this.fromOffset(endOffset);
  1729. endLine = pos.line;
  1730. endColumn = pos.col;
  1731. } else {
  1732. endLine = end.line;
  1733. endColumn = end.column;
  1734. endOffset = this.fromLineAndColumn(end.line, end.column);
  1735. }
  1736. } else if (!column) {
  1737. offset = line;
  1738. let pos = this.fromOffset(offset);
  1739. line = pos.line;
  1740. column = pos.col;
  1741. } else {
  1742. offset = this.fromLineAndColumn(line, column);
  1743. }
  1744. let origin = this.origin(line, column, endLine, endColumn);
  1745. if (origin) {
  1746. result = new CssSyntaxError2(
  1747. message,
  1748. origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
  1749. origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
  1750. origin.source,
  1751. origin.file,
  1752. opts.plugin
  1753. );
  1754. } else {
  1755. result = new CssSyntaxError2(
  1756. message,
  1757. endLine === void 0 ? line : { column, line },
  1758. endLine === void 0 ? column : { column: endColumn, line: endLine },
  1759. this.css,
  1760. this.file,
  1761. opts.plugin
  1762. );
  1763. }
  1764. result.input = {
  1765. column,
  1766. endColumn,
  1767. endLine,
  1768. endOffset,
  1769. line,
  1770. offset,
  1771. source: this.css
  1772. };
  1773. if (this.file) {
  1774. if (pathToFileURL) {
  1775. result.input.url = pathToFileURL(this.file).toString();
  1776. }
  1777. result.input.file = this.file;
  1778. }
  1779. return result;
  1780. }
  1781. fromLineAndColumn(line, column) {
  1782. let lineToIndex = getLineToIndex(this);
  1783. let index = lineToIndex[line - 1];
  1784. return index + column - 1;
  1785. }
  1786. fromOffset(offset) {
  1787. let lineToIndex = getLineToIndex(this);
  1788. let lastLine = lineToIndex[lineToIndex.length - 1];
  1789. let min = 0;
  1790. if (offset >= lastLine) {
  1791. min = lineToIndex.length - 1;
  1792. } else {
  1793. let max = lineToIndex.length - 2;
  1794. let mid;
  1795. while (min < max) {
  1796. mid = min + (max - min >> 1);
  1797. if (offset < lineToIndex[mid]) {
  1798. max = mid - 1;
  1799. } else if (offset >= lineToIndex[mid + 1]) {
  1800. min = mid + 1;
  1801. } else {
  1802. min = mid;
  1803. break;
  1804. }
  1805. }
  1806. }
  1807. return {
  1808. col: offset - lineToIndex[min] + 1,
  1809. line: min + 1
  1810. };
  1811. }
  1812. mapResolve(file) {
  1813. if (/^\w+:\/\//.test(file)) {
  1814. return file;
  1815. }
  1816. return resolve(this.map.consumer().sourceRoot || this.map.root || ".", file);
  1817. }
  1818. origin(line, column, endLine, endColumn) {
  1819. if (!this.map) return false;
  1820. let consumer = this.map.consumer();
  1821. let from = consumer.originalPositionFor({ column: column - 1, line });
  1822. if (!from.source) return false;
  1823. let to;
  1824. if (typeof endLine === "number") {
  1825. let toPosition = consumer.originalPositionFor({
  1826. column: endColumn - 1,
  1827. line: endLine
  1828. });
  1829. if (toPosition.source) to = toPosition;
  1830. }
  1831. let fromUrl;
  1832. if (isAbsolute(from.source)) {
  1833. fromUrl = pathToFileURL(from.source);
  1834. } else {
  1835. fromUrl = new URL(
  1836. from.source,
  1837. this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile)
  1838. );
  1839. }
  1840. let result = {
  1841. column: from.column + 1,
  1842. endColumn: to && to.column + 1,
  1843. endLine: to && to.line,
  1844. line: from.line,
  1845. url: fromUrl.toString()
  1846. };
  1847. if (fromUrl.protocol === "file:") {
  1848. if (fileURLToPath) {
  1849. result.file = fileURLToPath(fromUrl);
  1850. } else {
  1851. throw new Error(`file: protocol is not available in this PostCSS build`);
  1852. }
  1853. }
  1854. let source = consumer.sourceContentFor(from.source);
  1855. if (source) result.source = source;
  1856. return result;
  1857. }
  1858. toJSON() {
  1859. let json = {};
  1860. for (let name of ["hasBOM", "css", "file", "id"]) {
  1861. if (this[name] != null) {
  1862. json[name] = this[name];
  1863. }
  1864. }
  1865. if (this.map) {
  1866. json.map = { ...this.map };
  1867. if (json.map.consumerCache) {
  1868. json.map.consumerCache = void 0;
  1869. }
  1870. }
  1871. return json;
  1872. }
  1873. };
  1874. module.exports = Input2;
  1875. Input2.default = Input2;
  1876. if (terminalHighlight && terminalHighlight.registerInput) {
  1877. terminalHighlight.registerInput(Input2);
  1878. }
  1879. }
  1880. });
  1881. // node_modules/postcss/lib/root.js
  1882. var require_root = __commonJS({
  1883. "node_modules/postcss/lib/root.js"(exports, module) {
  1884. "use strict";
  1885. var Container2 = require_container();
  1886. var LazyResult;
  1887. var Processor2;
  1888. var Root2 = class extends Container2 {
  1889. constructor(defaults2) {
  1890. super(defaults2);
  1891. this.type = "root";
  1892. if (!this.nodes) this.nodes = [];
  1893. }
  1894. normalize(child, sample, type) {
  1895. let keepBefore = /* @__PURE__ */ new Set();
  1896. for (let node of Array.isArray(child) ? child : [child]) {
  1897. if (node && typeof node === "object" && !node.parent && node.raws && typeof node.raws.before !== "undefined") {
  1898. keepBefore.add(node.raws);
  1899. }
  1900. }
  1901. let nodes = super.normalize(child);
  1902. if (sample) {
  1903. if (type === "prepend") {
  1904. if (this.nodes.length > 1) {
  1905. sample.raws.before = this.nodes[1].raws.before;
  1906. } else {
  1907. delete sample.raws.before;
  1908. }
  1909. } else if (this.first !== sample) {
  1910. for (let node of nodes) {
  1911. if (!keepBefore.has(node.raws)) {
  1912. node.raws.before = sample.raws.before;
  1913. }
  1914. }
  1915. }
  1916. }
  1917. return nodes;
  1918. }
  1919. removeChild(child, ignore) {
  1920. let index = this.index(child);
  1921. if (!ignore && index === 0 && this.nodes.length > 1) {
  1922. this.nodes[1].raws.before = this.nodes[index].raws.before;
  1923. }
  1924. return super.removeChild(child);
  1925. }
  1926. toResult(opts = {}) {
  1927. let lazy = new LazyResult(new Processor2(), this, opts);
  1928. return lazy.stringify();
  1929. }
  1930. };
  1931. Root2.registerLazyResult = (dependant) => {
  1932. LazyResult = dependant;
  1933. };
  1934. Root2.registerProcessor = (dependant) => {
  1935. Processor2 = dependant;
  1936. };
  1937. module.exports = Root2;
  1938. Root2.default = Root2;
  1939. Container2.registerRoot(Root2);
  1940. }
  1941. });
  1942. // node_modules/postcss/lib/list.js
  1943. var require_list = __commonJS({
  1944. "node_modules/postcss/lib/list.js"(exports, module) {
  1945. "use strict";
  1946. var list2 = {
  1947. comma(string) {
  1948. return list2.split(string, [","], true);
  1949. },
  1950. space(string) {
  1951. let spaces = [" ", "\n", " "];
  1952. return list2.split(string, spaces);
  1953. },
  1954. split(string, separators, last) {
  1955. if (!string) return [];
  1956. let array = [];
  1957. let current = "";
  1958. let split = false;
  1959. let func = 0;
  1960. let inQuote = false;
  1961. let prevQuote = "";
  1962. let escape = false;
  1963. for (let letter of string) {
  1964. if (escape) {
  1965. escape = false;
  1966. } else if (letter === "\\") {
  1967. escape = true;
  1968. } else if (inQuote) {
  1969. if (letter === prevQuote) {
  1970. inQuote = false;
  1971. }
  1972. } else if (letter === '"' || letter === "'") {
  1973. inQuote = true;
  1974. prevQuote = letter;
  1975. } else if (letter === "(") {
  1976. func += 1;
  1977. } else if (letter === ")") {
  1978. if (func > 0) func -= 1;
  1979. } else if (func === 0) {
  1980. if (separators.includes(letter)) split = true;
  1981. }
  1982. if (split) {
  1983. if (current !== "") array.push(current.trim());
  1984. current = "";
  1985. split = false;
  1986. } else {
  1987. current += letter;
  1988. }
  1989. }
  1990. if (last || current !== "") array.push(current.trim());
  1991. return array;
  1992. }
  1993. };
  1994. module.exports = list2;
  1995. list2.default = list2;
  1996. }
  1997. });
  1998. // node_modules/postcss/lib/rule.js
  1999. var require_rule = __commonJS({
  2000. "node_modules/postcss/lib/rule.js"(exports, module) {
  2001. "use strict";
  2002. var Container2 = require_container();
  2003. var list2 = require_list();
  2004. var Rule2 = class extends Container2 {
  2005. get selectors() {
  2006. return list2.comma(this.selector);
  2007. }
  2008. set selectors(values) {
  2009. let match = this.selector ? this.selector.match(/,\s*/) : null;
  2010. let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
  2011. this.selector = values.join(sep);
  2012. }
  2013. constructor(defaults2) {
  2014. super(defaults2);
  2015. this.type = "rule";
  2016. if (!this.nodes) this.nodes = [];
  2017. }
  2018. };
  2019. module.exports = Rule2;
  2020. Rule2.default = Rule2;
  2021. Container2.registerRule(Rule2);
  2022. }
  2023. });
  2024. // node_modules/postcss/lib/fromJSON.js
  2025. var require_fromJSON = __commonJS({
  2026. "node_modules/postcss/lib/fromJSON.js"(exports, module) {
  2027. "use strict";
  2028. var AtRule2 = require_at_rule();
  2029. var Comment2 = require_comment();
  2030. var Declaration2 = require_declaration();
  2031. var Input2 = require_input();
  2032. var PreviousMap = require_previous_map();
  2033. var Root2 = require_root();
  2034. var Rule2 = require_rule();
  2035. function hydrateInputs(json, inputs) {
  2036. if (!json.inputs) return inputs;
  2037. return json.inputs.map((input) => {
  2038. let inputHydrated = { ...input, __proto__: Input2.prototype };
  2039. if (inputHydrated.map) {
  2040. inputHydrated.map = {
  2041. ...inputHydrated.map,
  2042. __proto__: PreviousMap.prototype
  2043. };
  2044. }
  2045. return inputHydrated;
  2046. });
  2047. }
  2048. function constructNode(json, inputs, children) {
  2049. let defaults2 = { ...json };
  2050. delete defaults2.inputs;
  2051. delete defaults2.nodes;
  2052. if (defaults2.source) {
  2053. let { inputId, ...source } = defaults2.source;
  2054. defaults2.source = source;
  2055. if (inputId != null) {
  2056. defaults2.source.input = inputs[inputId];
  2057. }
  2058. }
  2059. let node;
  2060. if (defaults2.type === "root") {
  2061. node = new Root2(defaults2);
  2062. } else if (defaults2.type === "decl") {
  2063. node = new Declaration2(defaults2);
  2064. } else if (defaults2.type === "rule") {
  2065. node = new Rule2(defaults2);
  2066. } else if (defaults2.type === "comment") {
  2067. node = new Comment2(defaults2);
  2068. } else if (defaults2.type === "atrule") {
  2069. node = new AtRule2(defaults2);
  2070. } else {
  2071. throw new Error("Unknown node type: " + json.type);
  2072. }
  2073. if (children) {
  2074. node.nodes = children;
  2075. for (let child of children) child.parent = node;
  2076. }
  2077. return node;
  2078. }
  2079. function fromJSON2(json, inputs) {
  2080. if (Array.isArray(json)) return json.map((n) => fromJSON2(n));
  2081. let result;
  2082. let stack = [
  2083. { childIndex: 0, children: [], inputs: hydrateInputs(json, inputs), json }
  2084. ];
  2085. while (stack.length > 0) {
  2086. let frame = stack[stack.length - 1];
  2087. let jsonNodes = frame.json.nodes;
  2088. if (jsonNodes && frame.childIndex < jsonNodes.length) {
  2089. let childJson = jsonNodes[frame.childIndex];
  2090. frame.childIndex += 1;
  2091. stack.push({
  2092. childIndex: 0,
  2093. children: [],
  2094. inputs: hydrateInputs(childJson, frame.inputs),
  2095. json: childJson
  2096. });
  2097. continue;
  2098. }
  2099. stack.pop();
  2100. let node = constructNode(
  2101. frame.json,
  2102. frame.inputs,
  2103. jsonNodes ? frame.children : void 0
  2104. );
  2105. if (stack.length > 0) {
  2106. stack[stack.length - 1].children.push(node);
  2107. } else {
  2108. result = node;
  2109. }
  2110. }
  2111. return result;
  2112. }
  2113. module.exports = fromJSON2;
  2114. fromJSON2.default = fromJSON2;
  2115. }
  2116. });
  2117. // node_modules/postcss/lib/map-generator.js
  2118. var require_map_generator = __commonJS({
  2119. "node_modules/postcss/lib/map-generator.js"(exports, module) {
  2120. "use strict";
  2121. var { dirname, relative, resolve, sep } = require_path();
  2122. var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
  2123. var { pathToFileURL } = require_url();
  2124. var Input2 = require_input();
  2125. var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
  2126. var pathAvailable = Boolean(dirname && resolve && relative && sep);
  2127. var MapGenerator = class {
  2128. constructor(stringify3, root2, opts, cssString) {
  2129. this.stringify = stringify3;
  2130. this.mapOpts = opts.map || {};
  2131. this.root = root2;
  2132. this.opts = opts;
  2133. this.css = cssString;
  2134. this.originalCSS = cssString;
  2135. this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
  2136. this.memoizedFileURLs = /* @__PURE__ */ new Map();
  2137. this.memoizedPaths = /* @__PURE__ */ new Map();
  2138. this.memoizedURLs = /* @__PURE__ */ new Map();
  2139. }
  2140. addAnnotation() {
  2141. let content;
  2142. if (this.isInline()) {
  2143. content = "data:application/json;base64," + this.toBase64(this.map.toString());
  2144. } else if (typeof this.mapOpts.annotation === "string") {
  2145. content = this.mapOpts.annotation;
  2146. } else if (typeof this.mapOpts.annotation === "function") {
  2147. content = this.mapOpts.annotation(this.opts.to, this.root);
  2148. } else {
  2149. content = this.outputFile() + ".map";
  2150. }
  2151. let eol = "\n";
  2152. if (this.css.includes("\r\n")) eol = "\r\n";
  2153. this.css += eol + "/*# sourceMappingURL=" + content + " */";
  2154. }
  2155. applyPrevMaps() {
  2156. for (let prev of this.previous()) {
  2157. let from = this.toUrl(this.path(prev.file));
  2158. let root2 = prev.root || dirname(prev.file);
  2159. let map;
  2160. if (this.mapOpts.sourcesContent === false) {
  2161. map = new SourceMapConsumer(prev.text);
  2162. if (map.sourcesContent) {
  2163. map.sourcesContent = null;
  2164. }
  2165. } else {
  2166. map = prev.consumer();
  2167. }
  2168. this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
  2169. }
  2170. }
  2171. clearAnnotation() {
  2172. if (this.mapOpts.annotation === false) return;
  2173. if (this.root) {
  2174. let node;
  2175. for (let i = this.root.nodes.length - 1; i >= 0; i--) {
  2176. node = this.root.nodes[i];
  2177. if (node.type !== "comment") continue;
  2178. if (node.text.startsWith("# sourceMappingURL=")) {
  2179. this.root.removeChild(i);
  2180. }
  2181. }
  2182. } else if (this.css) {
  2183. let startIndex;
  2184. while ((startIndex = this.css.lastIndexOf("/*#")) !== -1) {
  2185. let endIndex = this.css.indexOf("*/", startIndex + 3);
  2186. if (endIndex === -1) break;
  2187. while (startIndex > 0 && this.css[startIndex - 1] === "\n") {
  2188. startIndex--;
  2189. }
  2190. this.css = this.css.slice(0, startIndex) + this.css.slice(endIndex + 2);
  2191. }
  2192. }
  2193. }
  2194. generate() {
  2195. this.clearAnnotation();
  2196. if (pathAvailable && sourceMapAvailable && this.isMap()) {
  2197. return this.generateMap();
  2198. } else {
  2199. let result = "";
  2200. this.stringify(this.root, (i) => {
  2201. result += i;
  2202. });
  2203. return [result];
  2204. }
  2205. }
  2206. generateMap() {
  2207. if (this.root) {
  2208. this.generateString();
  2209. } else if (this.previous().length === 1) {
  2210. let prev = this.previous()[0].consumer();
  2211. prev.file = this.outputFile();
  2212. this.map = SourceMapGenerator.fromSourceMap(prev, {
  2213. ignoreInvalidMapping: true
  2214. });
  2215. } else {
  2216. this.map = new SourceMapGenerator({
  2217. file: this.outputFile(),
  2218. ignoreInvalidMapping: true
  2219. });
  2220. this.map.addMapping({
  2221. generated: { column: 0, line: 1 },
  2222. original: { column: 0, line: 1 },
  2223. source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
  2224. });
  2225. }
  2226. if (this.isSourcesContent()) this.setSourcesContent();
  2227. if (this.root && this.previous().length > 0) this.applyPrevMaps();
  2228. if (this.isAnnotation()) this.addAnnotation();
  2229. if (this.isInline()) {
  2230. return [this.css];
  2231. } else {
  2232. return [this.css, this.map];
  2233. }
  2234. }
  2235. generateString() {
  2236. this.css = "";
  2237. this.map = new SourceMapGenerator({
  2238. file: this.outputFile(),
  2239. ignoreInvalidMapping: true
  2240. });
  2241. let line = 1;
  2242. let column = 1;
  2243. let noSource = "<no source>";
  2244. let mapping = {
  2245. generated: { column: 0, line: 0 },
  2246. original: { column: 0, line: 0 },
  2247. source: ""
  2248. };
  2249. let last, lines;
  2250. this.stringify(this.root, (str, node, type) => {
  2251. this.css += str;
  2252. if (node && type !== "end") {
  2253. mapping.generated.line = line;
  2254. mapping.generated.column = column - 1;
  2255. if (node.source && node.source.start) {
  2256. mapping.source = this.sourcePath(node);
  2257. mapping.original.line = node.source.start.line;
  2258. mapping.original.column = node.source.start.column - 1;
  2259. this.map.addMapping(mapping);
  2260. } else {
  2261. mapping.source = noSource;
  2262. mapping.original.line = 1;
  2263. mapping.original.column = 0;
  2264. this.map.addMapping(mapping);
  2265. }
  2266. }
  2267. lines = str.match(/\n/g);
  2268. if (lines) {
  2269. line += lines.length;
  2270. last = str.lastIndexOf("\n");
  2271. column = str.length - last;
  2272. } else {
  2273. column += str.length;
  2274. }
  2275. if (node && type !== "start") {
  2276. let p = node.parent || { raws: {} };
  2277. let childless = node.type === "decl" || node.type === "atrule" && !node.nodes;
  2278. if (!childless || node !== p.last || p.raws.semicolon) {
  2279. if (node.source && node.source.end) {
  2280. mapping.source = this.sourcePath(node);
  2281. mapping.original.line = node.source.end.line;
  2282. mapping.original.column = node.source.end.column - 1;
  2283. mapping.generated.line = line;
  2284. mapping.generated.column = column - 2;
  2285. this.map.addMapping(mapping);
  2286. } else {
  2287. mapping.source = noSource;
  2288. mapping.original.line = 1;
  2289. mapping.original.column = 0;
  2290. mapping.generated.line = line;
  2291. mapping.generated.column = column - 1;
  2292. this.map.addMapping(mapping);
  2293. }
  2294. }
  2295. }
  2296. });
  2297. }
  2298. isAnnotation() {
  2299. if (this.isInline()) {
  2300. return true;
  2301. }
  2302. if (typeof this.mapOpts.annotation !== "undefined") {
  2303. return this.mapOpts.annotation;
  2304. }
  2305. if (this.previous().length) {
  2306. return this.previous().some((i) => i.annotation);
  2307. }
  2308. return true;
  2309. }
  2310. isInline() {
  2311. if (typeof this.mapOpts.inline !== "undefined") {
  2312. return this.mapOpts.inline;
  2313. }
  2314. let annotation = this.mapOpts.annotation;
  2315. if (typeof annotation !== "undefined" && annotation !== true) {
  2316. return false;
  2317. }
  2318. if (this.previous().length) {
  2319. return this.previous().some((i) => i.inline);
  2320. }
  2321. return true;
  2322. }
  2323. isMap() {
  2324. if (typeof this.opts.map !== "undefined") {
  2325. return !!this.opts.map;
  2326. }
  2327. return this.previous().length > 0;
  2328. }
  2329. isSourcesContent() {
  2330. if (typeof this.mapOpts.sourcesContent !== "undefined") {
  2331. return this.mapOpts.sourcesContent;
  2332. }
  2333. if (this.previous().length) {
  2334. return this.previous().some((i) => i.withContent());
  2335. }
  2336. return true;
  2337. }
  2338. outputFile() {
  2339. if (this.opts.to) {
  2340. return this.path(this.opts.to);
  2341. } else if (this.opts.from) {
  2342. return this.path(this.opts.from);
  2343. } else {
  2344. return "to.css";
  2345. }
  2346. }
  2347. path(file) {
  2348. if (this.mapOpts.absolute) return file;
  2349. if (file.charCodeAt(0) === 60) return file;
  2350. if (/^\w+:\/\//.test(file)) return file;
  2351. let cached = this.memoizedPaths.get(file);
  2352. if (cached) return cached;
  2353. let from = this.opts.to ? dirname(this.opts.to) : ".";
  2354. if (typeof this.mapOpts.annotation === "string") {
  2355. from = dirname(resolve(from, this.mapOpts.annotation));
  2356. }
  2357. let path = relative(from, file);
  2358. this.memoizedPaths.set(file, path);
  2359. return path;
  2360. }
  2361. previous() {
  2362. if (!this.previousMaps) {
  2363. this.previousMaps = [];
  2364. if (this.root) {
  2365. this.root.walk((node) => {
  2366. if (node.source && node.source.input.map) {
  2367. let map = node.source.input.map;
  2368. if (!this.previousMaps.includes(map)) {
  2369. this.previousMaps.push(map);
  2370. }
  2371. }
  2372. });
  2373. } else {
  2374. let input = new Input2(this.originalCSS, this.opts);
  2375. if (input.map) this.previousMaps.push(input.map);
  2376. }
  2377. }
  2378. return this.previousMaps;
  2379. }
  2380. setSourcesContent() {
  2381. let already = {};
  2382. if (this.root) {
  2383. this.root.walk((node) => {
  2384. if (node.source) {
  2385. let from = node.source.input.from;
  2386. if (from && !already[from]) {
  2387. already[from] = true;
  2388. let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
  2389. this.map.setSourceContent(fromUrl, node.source.input.css);
  2390. }
  2391. }
  2392. });
  2393. } else if (this.css) {
  2394. let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
  2395. this.map.setSourceContent(from, this.css);
  2396. }
  2397. }
  2398. sourcePath(node) {
  2399. if (this.mapOpts.from) {
  2400. return this.toUrl(this.mapOpts.from);
  2401. } else if (this.usesFileUrls) {
  2402. return this.toFileUrl(node.source.input.from);
  2403. } else {
  2404. return this.toUrl(this.path(node.source.input.from));
  2405. }
  2406. }
  2407. toBase64(str) {
  2408. if (Buffer) {
  2409. return Buffer.from(str).toString("base64");
  2410. } else {
  2411. return window.btoa(unescape(encodeURIComponent(str)));
  2412. }
  2413. }
  2414. toFileUrl(path) {
  2415. let cached = this.memoizedFileURLs.get(path);
  2416. if (cached) return cached;
  2417. if (pathToFileURL) {
  2418. let fileURL = pathToFileURL(path).toString();
  2419. this.memoizedFileURLs.set(path, fileURL);
  2420. return fileURL;
  2421. } else {
  2422. throw new Error(
  2423. "`map.absolute` option is not available in this PostCSS build"
  2424. );
  2425. }
  2426. }
  2427. toUrl(path) {
  2428. let cached = this.memoizedURLs.get(path);
  2429. if (cached) return cached;
  2430. if (sep === "\\") {
  2431. path = path.replace(/\\/g, "/");
  2432. }
  2433. let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
  2434. this.memoizedURLs.set(path, url);
  2435. return url;
  2436. }
  2437. };
  2438. module.exports = MapGenerator;
  2439. }
  2440. });
  2441. // node_modules/postcss/lib/tokenize.js
  2442. var require_tokenize = __commonJS({
  2443. "node_modules/postcss/lib/tokenize.js"(exports, module) {
  2444. "use strict";
  2445. var SINGLE_QUOTE = "'".charCodeAt(0);
  2446. var DOUBLE_QUOTE = '"'.charCodeAt(0);
  2447. var BACKSLASH = "\\".charCodeAt(0);
  2448. var SLASH = "/".charCodeAt(0);
  2449. var NEWLINE = "\n".charCodeAt(0);
  2450. var SPACE = " ".charCodeAt(0);
  2451. var FEED = "\f".charCodeAt(0);
  2452. var TAB = " ".charCodeAt(0);
  2453. var CR = "\r".charCodeAt(0);
  2454. var OPEN_SQUARE = "[".charCodeAt(0);
  2455. var CLOSE_SQUARE = "]".charCodeAt(0);
  2456. var OPEN_PARENTHESES = "(".charCodeAt(0);
  2457. var CLOSE_PARENTHESES = ")".charCodeAt(0);
  2458. var OPEN_CURLY = "{".charCodeAt(0);
  2459. var CLOSE_CURLY = "}".charCodeAt(0);
  2460. var SEMICOLON = ";".charCodeAt(0);
  2461. var ASTERISK = "*".charCodeAt(0);
  2462. var COLON = ":".charCodeAt(0);
  2463. var AT = "@".charCodeAt(0);
  2464. var RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g;
  2465. var RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g;
  2466. var RE_BAD_BRACKET = /.[\r\n"'(/\\]/;
  2467. var RE_HEX_ESCAPE = /[\da-f]/i;
  2468. module.exports = function tokenizer(input, options = {}) {
  2469. let css = input.css.valueOf();
  2470. let ignore = options.ignoreErrors;
  2471. let code, content, escape, next, quote;
  2472. let currentToken, escaped, escapePos, n, prev;
  2473. let length = css.length;
  2474. let pos = 0;
  2475. let buffer = [];
  2476. let returned = [];
  2477. let lastBadParen = -1;
  2478. function position() {
  2479. return pos;
  2480. }
  2481. function unclosed(what) {
  2482. throw input.error("Unclosed " + what, pos);
  2483. }
  2484. function endOfFile() {
  2485. return returned.length === 0 && pos >= length;
  2486. }
  2487. function nextToken(opts) {
  2488. if (returned.length) return returned.pop();
  2489. if (pos >= length) return;
  2490. let ignoreUnclosed = opts ? opts.ignoreUnclosed : false;
  2491. code = css.charCodeAt(pos);
  2492. switch (code) {
  2493. case NEWLINE:
  2494. case SPACE:
  2495. case TAB:
  2496. case CR:
  2497. case FEED: {
  2498. next = pos;
  2499. do {
  2500. next += 1;
  2501. code = css.charCodeAt(next);
  2502. } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);
  2503. currentToken = ["space", css.slice(pos, next)];
  2504. pos = next - 1;
  2505. break;
  2506. }
  2507. case OPEN_SQUARE:
  2508. case CLOSE_SQUARE:
  2509. case OPEN_CURLY:
  2510. case CLOSE_CURLY:
  2511. case COLON:
  2512. case SEMICOLON:
  2513. case CLOSE_PARENTHESES: {
  2514. let controlChar = String.fromCharCode(code);
  2515. currentToken = [controlChar, controlChar, pos];
  2516. break;
  2517. }
  2518. case OPEN_PARENTHESES: {
  2519. prev = buffer.length ? buffer.pop()[1] : "";
  2520. n = css.charCodeAt(pos + 1);
  2521. if (prev === "url" && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {
  2522. next = pos;
  2523. do {
  2524. escaped = false;
  2525. next = css.indexOf(")", next + 1);
  2526. if (next === -1) {
  2527. if (ignore || ignoreUnclosed) {
  2528. next = pos;
  2529. break;
  2530. } else {
  2531. unclosed("bracket");
  2532. }
  2533. }
  2534. escapePos = next;
  2535. while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
  2536. escapePos -= 1;
  2537. escaped = !escaped;
  2538. }
  2539. } while (escaped);
  2540. currentToken = ["brackets", css.slice(pos, next + 1), pos, next];
  2541. pos = next;
  2542. } else if (pos <= lastBadParen) {
  2543. currentToken = ["(", "(", pos];
  2544. } else {
  2545. next = css.indexOf(")", pos + 1);
  2546. content = css.slice(pos, next + 1);
  2547. if (next === -1 || RE_BAD_BRACKET.test(content)) {
  2548. lastBadParen = next === -1 ? length : next;
  2549. currentToken = ["(", "(", pos];
  2550. } else {
  2551. currentToken = ["brackets", content, pos, next];
  2552. pos = next;
  2553. }
  2554. }
  2555. break;
  2556. }
  2557. case SINGLE_QUOTE:
  2558. case DOUBLE_QUOTE: {
  2559. quote = code === SINGLE_QUOTE ? "'" : '"';
  2560. next = pos;
  2561. do {
  2562. escaped = false;
  2563. next = css.indexOf(quote, next + 1);
  2564. if (next === -1) {
  2565. if (ignore || ignoreUnclosed) {
  2566. next = pos + 1;
  2567. break;
  2568. } else {
  2569. unclosed("string");
  2570. }
  2571. }
  2572. escapePos = next;
  2573. while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
  2574. escapePos -= 1;
  2575. escaped = !escaped;
  2576. }
  2577. } while (escaped);
  2578. currentToken = ["string", css.slice(pos, next + 1), pos, next];
  2579. pos = next;
  2580. break;
  2581. }
  2582. case AT: {
  2583. RE_AT_END.lastIndex = pos + 1;
  2584. RE_AT_END.test(css);
  2585. if (RE_AT_END.lastIndex === 0) {
  2586. next = css.length - 1;
  2587. } else {
  2588. next = RE_AT_END.lastIndex - 2;
  2589. }
  2590. currentToken = ["at-word", css.slice(pos, next + 1), pos, next];
  2591. pos = next;
  2592. break;
  2593. }
  2594. case BACKSLASH: {
  2595. next = pos;
  2596. escape = true;
  2597. while (css.charCodeAt(next + 1) === BACKSLASH) {
  2598. next += 1;
  2599. escape = !escape;
  2600. }
  2601. code = css.charCodeAt(next + 1);
  2602. if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
  2603. next += 1;
  2604. if (RE_HEX_ESCAPE.test(css.charAt(next))) {
  2605. while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
  2606. next += 1;
  2607. }
  2608. if (css.charCodeAt(next + 1) === SPACE) {
  2609. next += 1;
  2610. }
  2611. }
  2612. }
  2613. currentToken = ["word", css.slice(pos, next + 1), pos, next];
  2614. pos = next;
  2615. break;
  2616. }
  2617. default: {
  2618. if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
  2619. next = css.indexOf("*/", pos + 2) + 1;
  2620. if (next === 0) {
  2621. if (ignore || ignoreUnclosed) {
  2622. next = css.length;
  2623. } else {
  2624. unclosed("comment");
  2625. }
  2626. }
  2627. currentToken = ["comment", css.slice(pos, next + 1), pos, next];
  2628. pos = next;
  2629. } else {
  2630. RE_WORD_END.lastIndex = pos + 1;
  2631. RE_WORD_END.test(css);
  2632. if (RE_WORD_END.lastIndex === 0) {
  2633. next = css.length - 1;
  2634. } else {
  2635. next = RE_WORD_END.lastIndex - 2;
  2636. }
  2637. currentToken = ["word", css.slice(pos, next + 1), pos, next];
  2638. buffer.push(currentToken);
  2639. pos = next;
  2640. }
  2641. break;
  2642. }
  2643. }
  2644. pos++;
  2645. return currentToken;
  2646. }
  2647. function back(token) {
  2648. returned.push(token);
  2649. }
  2650. return {
  2651. back,
  2652. endOfFile,
  2653. nextToken,
  2654. position
  2655. };
  2656. };
  2657. }
  2658. });
  2659. // node_modules/postcss/lib/parser.js
  2660. var require_parser = __commonJS({
  2661. "node_modules/postcss/lib/parser.js"(exports, module) {
  2662. "use strict";
  2663. var AtRule2 = require_at_rule();
  2664. var Comment2 = require_comment();
  2665. var Declaration2 = require_declaration();
  2666. var Root2 = require_root();
  2667. var Rule2 = require_rule();
  2668. var tokenizer = require_tokenize();
  2669. var SAFE_COMMENT_NEIGHBOR = {
  2670. empty: true,
  2671. space: true
  2672. };
  2673. function findLastWithPosition(tokens) {
  2674. for (let i = tokens.length - 1; i >= 0; i--) {
  2675. let token = tokens[i];
  2676. let pos = token[3] || token[2];
  2677. if (pos) return pos;
  2678. }
  2679. }
  2680. function tokensToString(tokens, from, to) {
  2681. let result = "";
  2682. for (let i = from; i < to; i++) result += tokens[i][1];
  2683. return result;
  2684. }
  2685. var Parser = class {
  2686. constructor(input) {
  2687. this.input = input;
  2688. this.root = new Root2();
  2689. this.current = this.root;
  2690. this.spaces = "";
  2691. this.semicolon = false;
  2692. this.createTokenizer();
  2693. this.root.source = { input, start: { column: 1, line: 1, offset: 0 } };
  2694. }
  2695. atrule(token) {
  2696. let node = new AtRule2();
  2697. node.name = token[1].slice(1);
  2698. if (node.name === "") {
  2699. this.unnamedAtrule(node, token);
  2700. }
  2701. this.init(node, token[2]);
  2702. let type;
  2703. let prev;
  2704. let shift;
  2705. let last = false;
  2706. let open = false;
  2707. let params = [];
  2708. let brackets = [];
  2709. while (!this.tokenizer.endOfFile()) {
  2710. token = this.tokenizer.nextToken();
  2711. type = token[0];
  2712. if (type === "(" || type === "[") {
  2713. brackets.push(type === "(" ? ")" : "]");
  2714. } else if (type === "{" && brackets.length > 0) {
  2715. brackets.push("}");
  2716. } else if (type === brackets[brackets.length - 1]) {
  2717. brackets.pop();
  2718. }
  2719. if (brackets.length === 0) {
  2720. if (type === ";") {
  2721. node.source.end = this.getPosition(token[2]);
  2722. node.source.end.offset++;
  2723. this.semicolon = true;
  2724. break;
  2725. } else if (type === "{") {
  2726. open = true;
  2727. break;
  2728. } else if (type === "}") {
  2729. if (params.length > 0) {
  2730. shift = params.length - 1;
  2731. prev = params[shift];
  2732. while (prev && prev[0] === "space") {
  2733. prev = params[--shift];
  2734. }
  2735. if (prev) {
  2736. node.source.end = this.getPosition(prev[3] || prev[2]);
  2737. node.source.end.offset++;
  2738. }
  2739. }
  2740. this.end(token);
  2741. break;
  2742. } else {
  2743. params.push(token);
  2744. }
  2745. } else {
  2746. params.push(token);
  2747. }
  2748. if (this.tokenizer.endOfFile()) {
  2749. last = true;
  2750. break;
  2751. }
  2752. }
  2753. node.raws.between = this.spacesAndCommentsFromEnd(params);
  2754. if (params.length) {
  2755. node.raws.afterName = this.spacesAndCommentsFromStart(params);
  2756. this.raw(node, "params", params);
  2757. if (last) {
  2758. token = params[params.length - 1];
  2759. node.source.end = this.getPosition(token[3] || token[2]);
  2760. node.source.end.offset++;
  2761. this.spaces = node.raws.between;
  2762. node.raws.between = "";
  2763. }
  2764. } else {
  2765. node.raws.afterName = "";
  2766. node.params = "";
  2767. }
  2768. if (open) {
  2769. node.nodes = [];
  2770. this.current = node;
  2771. }
  2772. }
  2773. checkMissedSemicolon(tokens) {
  2774. let colon = this.colon(tokens);
  2775. if (colon === false) return;
  2776. let founded = 0;
  2777. let token;
  2778. for (let j = colon - 1; j >= 0; j--) {
  2779. token = tokens[j];
  2780. if (token[0] !== "space") {
  2781. founded += 1;
  2782. if (founded === 2) break;
  2783. }
  2784. }
  2785. throw this.input.error(
  2786. "Missed semicolon",
  2787. token[0] === "word" ? token[3] + 1 : token[2]
  2788. );
  2789. }
  2790. colon(tokens) {
  2791. let brackets = 0;
  2792. let prev, token, type;
  2793. for (let [i, element] of tokens.entries()) {
  2794. token = element;
  2795. type = token[0];
  2796. if (type === "(") {
  2797. brackets += 1;
  2798. }
  2799. if (type === ")") {
  2800. brackets -= 1;
  2801. }
  2802. if (brackets === 0 && type === ":") {
  2803. if (!prev) {
  2804. this.doubleColon(token);
  2805. } else if (prev[0] === "word" && prev[1] === "progid") {
  2806. continue;
  2807. } else {
  2808. return i;
  2809. }
  2810. }
  2811. prev = token;
  2812. }
  2813. return false;
  2814. }
  2815. comment(token) {
  2816. let node = new Comment2();
  2817. this.init(node, token[2]);
  2818. node.source.end = this.getPosition(token[3] || token[2]);
  2819. node.source.end.offset++;
  2820. let text = token[1].slice(2, -2);
  2821. if (!text.trim()) {
  2822. node.text = "";
  2823. node.raws.left = text;
  2824. node.raws.right = "";
  2825. } else {
  2826. let match = text.match(/^(\s*)([^]*\S)(\s*)$/);
  2827. node.text = match[2];
  2828. node.raws.left = match[1];
  2829. node.raws.right = match[3];
  2830. }
  2831. }
  2832. createTokenizer() {
  2833. this.tokenizer = tokenizer(this.input);
  2834. }
  2835. decl(tokens, customProperty) {
  2836. let node = new Declaration2();
  2837. this.init(node, tokens[0][2]);
  2838. let last = tokens[tokens.length - 1];
  2839. if (last[0] === ";") {
  2840. this.semicolon = true;
  2841. tokens.pop();
  2842. }
  2843. node.source.end = this.getPosition(
  2844. last[3] || last[2] || findLastWithPosition(tokens)
  2845. );
  2846. node.source.end.offset++;
  2847. let start = 0;
  2848. while (tokens[start][0] !== "word") {
  2849. if (start === tokens.length - 1) this.unknownWord([tokens[start]]);
  2850. start++;
  2851. }
  2852. node.raws.before += tokensToString(tokens, 0, start);
  2853. node.source.start = this.getPosition(tokens[start][2]);
  2854. let propStart = start;
  2855. while (start < tokens.length) {
  2856. let type = tokens[start][0];
  2857. if (type === ":" || type === "space" || type === "comment") {
  2858. break;
  2859. }
  2860. start++;
  2861. }
  2862. node.prop = tokensToString(tokens, propStart, start);
  2863. let betweenStart = start;
  2864. let token;
  2865. while (start < tokens.length) {
  2866. token = tokens[start];
  2867. start++;
  2868. if (token[0] === ":") break;
  2869. if (token[0] === "word" && /\w/.test(token[1])) {
  2870. this.unknownWord([token]);
  2871. }
  2872. }
  2873. node.raws.between = tokensToString(tokens, betweenStart, start);
  2874. if (node.prop[0] === "_" || node.prop[0] === "*") {
  2875. node.raws.before += node.prop[0];
  2876. node.prop = node.prop.slice(1);
  2877. }
  2878. let firstSpacesStart = start;
  2879. while (start < tokens.length) {
  2880. let next = tokens[start][0];
  2881. if (next !== "space" && next !== "comment") break;
  2882. start++;
  2883. }
  2884. let firstSpaces = tokens.slice(firstSpacesStart, start);
  2885. tokens = tokens.slice(start);
  2886. this.precheckMissedSemicolon(tokens);
  2887. for (let i = tokens.length - 1; i >= 0; i--) {
  2888. token = tokens[i];
  2889. if (token[1].toLowerCase() === "!important") {
  2890. node.important = true;
  2891. let string = this.stringFrom(tokens, i);
  2892. string = this.spacesFromEnd(tokens) + string;
  2893. if (string !== " !important") node.raws.important = string;
  2894. break;
  2895. } else if (token[1].toLowerCase() === "important") {
  2896. let cache = tokens.slice(0);
  2897. let str = "";
  2898. for (let j = i; j > 0; j--) {
  2899. let type = cache[j][0];
  2900. if (str.trim().startsWith("!") && type !== "space") {
  2901. break;
  2902. }
  2903. str = cache.pop()[1] + str;
  2904. }
  2905. if (str.trim().startsWith("!")) {
  2906. node.important = true;
  2907. node.raws.important = str;
  2908. tokens = cache;
  2909. }
  2910. }
  2911. if (token[0] !== "space" && token[0] !== "comment") {
  2912. break;
  2913. }
  2914. }
  2915. let hasWord = tokens.some((i) => i[0] !== "space" && i[0] !== "comment");
  2916. if (hasWord) {
  2917. node.raws.between += firstSpaces.map((i) => i[1]).join("");
  2918. firstSpaces = [];
  2919. }
  2920. this.raw(node, "value", firstSpaces.concat(tokens), customProperty);
  2921. if (node.value.includes(":") && !customProperty) {
  2922. this.checkMissedSemicolon(tokens);
  2923. }
  2924. }
  2925. doubleColon(token) {
  2926. throw this.input.error(
  2927. "Double colon",
  2928. { offset: token[2] },
  2929. { offset: token[2] + token[1].length }
  2930. );
  2931. }
  2932. emptyRule(token) {
  2933. let node = new Rule2();
  2934. this.init(node, token[2]);
  2935. node.selector = "";
  2936. node.raws.between = "";
  2937. this.current = node;
  2938. }
  2939. end(token) {
  2940. if (this.current.nodes && this.current.nodes.length) {
  2941. this.current.raws.semicolon = this.semicolon;
  2942. }
  2943. this.semicolon = false;
  2944. this.current.raws.after = (this.current.raws.after || "") + this.spaces;
  2945. this.spaces = "";
  2946. if (this.current.parent) {
  2947. this.current.source.end = this.getPosition(token[2]);
  2948. this.current.source.end.offset++;
  2949. this.current = this.current.parent;
  2950. } else {
  2951. this.unexpectedClose(token);
  2952. }
  2953. }
  2954. endFile() {
  2955. if (this.current.parent) this.unclosedBlock();
  2956. if (this.current.nodes && this.current.nodes.length) {
  2957. this.current.raws.semicolon = this.semicolon;
  2958. }
  2959. this.current.raws.after = (this.current.raws.after || "") + this.spaces;
  2960. this.root.source.end = this.getPosition(this.tokenizer.position());
  2961. }
  2962. freeSemicolon(token) {
  2963. this.spaces += token[1];
  2964. if (this.current.nodes) {
  2965. let prev = this.current.nodes[this.current.nodes.length - 1];
  2966. if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
  2967. prev.raws.ownSemicolon = this.spaces;
  2968. this.spaces = "";
  2969. prev.source.end = this.getPosition(token[2]);
  2970. prev.source.end.offset += prev.raws.ownSemicolon.length;
  2971. }
  2972. }
  2973. }
  2974. // Helpers
  2975. getPosition(offset) {
  2976. let pos = this.input.fromOffset(offset);
  2977. return {
  2978. column: pos.col,
  2979. line: pos.line,
  2980. offset
  2981. };
  2982. }
  2983. init(node, offset) {
  2984. this.current.push(node);
  2985. node.source = {
  2986. input: this.input,
  2987. start: this.getPosition(offset)
  2988. };
  2989. node.raws.before = this.spaces;
  2990. this.spaces = "";
  2991. if (node.type !== "comment") this.semicolon = false;
  2992. }
  2993. other(start) {
  2994. let end = false;
  2995. let type = null;
  2996. let colon = false;
  2997. let bracket = null;
  2998. let brackets = [];
  2999. let customProperty = start[1].startsWith("--");
  3000. let tokens = [];
  3001. let token = start;
  3002. while (token) {
  3003. type = token[0];
  3004. tokens.push(token);
  3005. if (type === "(" || type === "[") {
  3006. if (!bracket) bracket = token;
  3007. brackets.push(type === "(" ? ")" : "]");
  3008. } else if (customProperty && colon && type === "{") {
  3009. if (!bracket) bracket = token;
  3010. brackets.push("}");
  3011. } else if (brackets.length === 0) {
  3012. if (type === ";") {
  3013. if (colon) {
  3014. this.decl(tokens, customProperty);
  3015. return;
  3016. } else {
  3017. break;
  3018. }
  3019. } else if (type === "{") {
  3020. this.rule(tokens);
  3021. return;
  3022. } else if (type === "}") {
  3023. this.tokenizer.back(tokens.pop());
  3024. end = true;
  3025. break;
  3026. } else if (type === ":") {
  3027. colon = true;
  3028. }
  3029. } else if (type === brackets[brackets.length - 1]) {
  3030. brackets.pop();
  3031. if (brackets.length === 0) bracket = null;
  3032. }
  3033. token = this.tokenizer.nextToken();
  3034. }
  3035. if (this.tokenizer.endOfFile()) end = true;
  3036. if (brackets.length > 0) this.unclosedBracket(bracket);
  3037. if (end && colon) {
  3038. if (!customProperty) {
  3039. while (tokens.length) {
  3040. token = tokens[tokens.length - 1][0];
  3041. if (token !== "space" && token !== "comment") break;
  3042. this.tokenizer.back(tokens.pop());
  3043. }
  3044. }
  3045. this.decl(tokens, customProperty);
  3046. } else {
  3047. this.unknownWord(tokens);
  3048. }
  3049. }
  3050. parse() {
  3051. let token;
  3052. while (!this.tokenizer.endOfFile()) {
  3053. token = this.tokenizer.nextToken();
  3054. switch (token[0]) {
  3055. case "space":
  3056. this.spaces += token[1];
  3057. break;
  3058. case ";":
  3059. this.freeSemicolon(token);
  3060. break;
  3061. case "}":
  3062. this.end(token);
  3063. break;
  3064. case "comment":
  3065. this.comment(token);
  3066. break;
  3067. case "at-word":
  3068. this.atrule(token);
  3069. break;
  3070. case "{":
  3071. this.emptyRule(token);
  3072. break;
  3073. default:
  3074. this.other(token);
  3075. break;
  3076. }
  3077. }
  3078. this.endFile();
  3079. }
  3080. precheckMissedSemicolon() {
  3081. }
  3082. raw(node, prop, tokens, customProperty) {
  3083. let token, type;
  3084. let length = tokens.length;
  3085. let value = "";
  3086. let clean = true;
  3087. let next, prev;
  3088. for (let i = 0; i < length; i += 1) {
  3089. token = tokens[i];
  3090. type = token[0];
  3091. if (type === "space" && i === length - 1 && !customProperty) {
  3092. clean = false;
  3093. } else if (type === "comment") {
  3094. prev = tokens[i - 1] ? tokens[i - 1][0] : "empty";
  3095. next = tokens[i + 1] ? tokens[i + 1][0] : "empty";
  3096. if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
  3097. if (value.slice(-1) === ",") {
  3098. clean = false;
  3099. } else {
  3100. value += token[1];
  3101. }
  3102. } else {
  3103. clean = false;
  3104. }
  3105. } else {
  3106. value += token[1];
  3107. }
  3108. }
  3109. if (!clean) {
  3110. let raw = tokens.reduce((all, i) => all + i[1], "");
  3111. node.raws[prop] = { raw, value };
  3112. }
  3113. node[prop] = value;
  3114. }
  3115. rule(tokens) {
  3116. tokens.pop();
  3117. let node = new Rule2();
  3118. this.init(node, tokens[0][2]);
  3119. node.raws.between = this.spacesAndCommentsFromEnd(tokens);
  3120. this.raw(node, "selector", tokens);
  3121. this.current = node;
  3122. }
  3123. spacesAndCommentsFromEnd(tokens) {
  3124. let lastTokenType;
  3125. let spaces = "";
  3126. while (tokens.length) {
  3127. lastTokenType = tokens[tokens.length - 1][0];
  3128. if (lastTokenType !== "space" && lastTokenType !== "comment") break;
  3129. spaces = tokens.pop()[1] + spaces;
  3130. }
  3131. return spaces;
  3132. }
  3133. // Errors
  3134. spacesAndCommentsFromStart(tokens) {
  3135. let next;
  3136. let spaces = "";
  3137. while (tokens.length) {
  3138. next = tokens[0][0];
  3139. if (next !== "space" && next !== "comment") break;
  3140. spaces += tokens.shift()[1];
  3141. }
  3142. return spaces;
  3143. }
  3144. spacesFromEnd(tokens) {
  3145. let lastTokenType;
  3146. let spaces = "";
  3147. while (tokens.length) {
  3148. lastTokenType = tokens[tokens.length - 1][0];
  3149. if (lastTokenType !== "space") break;
  3150. spaces = tokens.pop()[1] + spaces;
  3151. }
  3152. return spaces;
  3153. }
  3154. stringFrom(tokens, from) {
  3155. let result = "";
  3156. for (let i = from; i < tokens.length; i++) {
  3157. result += tokens[i][1];
  3158. }
  3159. tokens.splice(from, tokens.length - from);
  3160. return result;
  3161. }
  3162. unclosedBlock() {
  3163. let pos = this.current.source.start;
  3164. throw this.input.error("Unclosed block", pos.line, pos.column);
  3165. }
  3166. unclosedBracket(bracket) {
  3167. throw this.input.error(
  3168. "Unclosed bracket",
  3169. { offset: bracket[2] },
  3170. { offset: bracket[2] + 1 }
  3171. );
  3172. }
  3173. unexpectedClose(token) {
  3174. throw this.input.error(
  3175. "Unexpected }",
  3176. { offset: token[2] },
  3177. { offset: token[2] + 1 }
  3178. );
  3179. }
  3180. unknownWord(tokens) {
  3181. throw this.input.error(
  3182. "Unknown word " + tokens[0][1],
  3183. { offset: tokens[0][2] },
  3184. { offset: tokens[0][2] + tokens[0][1].length }
  3185. );
  3186. }
  3187. unnamedAtrule(node, token) {
  3188. throw this.input.error(
  3189. "At-rule without name",
  3190. { offset: token[2] },
  3191. { offset: token[2] + token[1].length }
  3192. );
  3193. }
  3194. };
  3195. module.exports = Parser;
  3196. }
  3197. });
  3198. // node_modules/postcss/lib/parse.js
  3199. var require_parse = __commonJS({
  3200. "node_modules/postcss/lib/parse.js"(exports, module) {
  3201. "use strict";
  3202. var Container2 = require_container();
  3203. var Input2 = require_input();
  3204. var Parser = require_parser();
  3205. function parse3(css, opts) {
  3206. let input = new Input2(css, opts);
  3207. let parser = new Parser(input);
  3208. try {
  3209. parser.parse();
  3210. } catch (e) {
  3211. if (true) {
  3212. if (e.name === "CssSyntaxError" && opts && opts.from) {
  3213. if (/\.scss$/i.test(opts.from)) {
  3214. e.message += "\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";
  3215. } else if (/\.sass/i.test(opts.from)) {
  3216. e.message += "\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser";
  3217. } else if (/\.less$/i.test(opts.from)) {
  3218. e.message += "\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser";
  3219. }
  3220. }
  3221. }
  3222. throw e;
  3223. }
  3224. return parser.root;
  3225. }
  3226. module.exports = parse3;
  3227. parse3.default = parse3;
  3228. Container2.registerParse(parse3);
  3229. }
  3230. });
  3231. // node_modules/postcss/lib/warning.js
  3232. var require_warning = __commonJS({
  3233. "node_modules/postcss/lib/warning.js"(exports, module) {
  3234. "use strict";
  3235. var Container2 = require_container();
  3236. var { my } = require_symbols();
  3237. var Warning2 = class {
  3238. constructor(text, opts = {}) {
  3239. this.type = "warning";
  3240. this.text = text;
  3241. if (opts.node && opts.node.source) {
  3242. if (!opts.node[my]) {
  3243. Container2.rebuild(opts.node);
  3244. }
  3245. let range = opts.node.rangeBy(opts);
  3246. this.line = range.start.line;
  3247. this.column = range.start.column;
  3248. this.endLine = range.end.line;
  3249. this.endColumn = range.end.column;
  3250. }
  3251. for (let opt in opts) this[opt] = opts[opt];
  3252. }
  3253. toString() {
  3254. if (this.node) {
  3255. return this.node.error(this.text, {
  3256. index: this.index,
  3257. plugin: this.plugin,
  3258. word: this.word
  3259. }).message;
  3260. }
  3261. if (this.plugin) {
  3262. return this.plugin + ": " + this.text;
  3263. }
  3264. return this.text;
  3265. }
  3266. };
  3267. module.exports = Warning2;
  3268. Warning2.default = Warning2;
  3269. }
  3270. });
  3271. // node_modules/postcss/lib/result.js
  3272. var require_result = __commonJS({
  3273. "node_modules/postcss/lib/result.js"(exports, module) {
  3274. "use strict";
  3275. var Warning2 = require_warning();
  3276. var Result2 = class {
  3277. get content() {
  3278. return this.css;
  3279. }
  3280. constructor(processor, root2, opts) {
  3281. this.processor = processor;
  3282. this.messages = [];
  3283. this.root = root2;
  3284. this.opts = opts;
  3285. this.css = "";
  3286. this.map = void 0;
  3287. }
  3288. toString() {
  3289. return this.css;
  3290. }
  3291. warn(text, opts = {}) {
  3292. if (!opts.plugin) {
  3293. if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
  3294. opts.plugin = this.lastPlugin.postcssPlugin;
  3295. }
  3296. }
  3297. let warning = new Warning2(text, opts);
  3298. this.messages.push(warning);
  3299. return warning;
  3300. }
  3301. warnings() {
  3302. return this.messages.filter((i) => i.type === "warning");
  3303. }
  3304. };
  3305. module.exports = Result2;
  3306. Result2.default = Result2;
  3307. }
  3308. });
  3309. // node_modules/postcss/lib/warn-once.js
  3310. var require_warn_once = __commonJS({
  3311. "node_modules/postcss/lib/warn-once.js"(exports, module) {
  3312. "use strict";
  3313. var printed = {};
  3314. module.exports = function warnOnce(message) {
  3315. if (printed[message]) return;
  3316. printed[message] = true;
  3317. if (typeof console !== "undefined" && console.warn) {
  3318. console.warn(message);
  3319. }
  3320. };
  3321. }
  3322. });
  3323. // node_modules/postcss/lib/lazy-result.js
  3324. var require_lazy_result = __commonJS({
  3325. "node_modules/postcss/lib/lazy-result.js"(exports, module) {
  3326. "use strict";
  3327. var Container2 = require_container();
  3328. var Document2 = require_document();
  3329. var MapGenerator = require_map_generator();
  3330. var parse3 = require_parse();
  3331. var Result2 = require_result();
  3332. var Root2 = require_root();
  3333. var stringify3 = require_stringify();
  3334. var { isClean, my } = require_symbols();
  3335. var warnOnce = require_warn_once();
  3336. var TYPE_TO_CLASS_NAME = {
  3337. atrule: "AtRule",
  3338. comment: "Comment",
  3339. decl: "Declaration",
  3340. document: "Document",
  3341. root: "Root",
  3342. rule: "Rule"
  3343. };
  3344. var PLUGIN_PROPS = {
  3345. AtRule: true,
  3346. AtRuleExit: true,
  3347. Comment: true,
  3348. CommentExit: true,
  3349. Declaration: true,
  3350. DeclarationExit: true,
  3351. Document: true,
  3352. DocumentExit: true,
  3353. Once: true,
  3354. OnceExit: true,
  3355. postcssPlugin: true,
  3356. prepare: true,
  3357. Root: true,
  3358. RootExit: true,
  3359. Rule: true,
  3360. RuleExit: true
  3361. };
  3362. var NOT_VISITORS = {
  3363. Once: true,
  3364. postcssPlugin: true,
  3365. prepare: true
  3366. };
  3367. var CHILDREN = 0;
  3368. function isPromise(obj) {
  3369. return typeof obj === "object" && typeof obj.then === "function";
  3370. }
  3371. function getEvents(node) {
  3372. let key = false;
  3373. let type = TYPE_TO_CLASS_NAME[node.type];
  3374. if (node.type === "decl") {
  3375. key = node.prop.toLowerCase();
  3376. } else if (node.type === "atrule") {
  3377. key = node.name.toLowerCase();
  3378. }
  3379. if (key && node.append) {
  3380. return [
  3381. type,
  3382. type + "-" + key,
  3383. CHILDREN,
  3384. type + "Exit",
  3385. type + "Exit-" + key
  3386. ];
  3387. } else if (key) {
  3388. return [type, type + "-" + key, type + "Exit", type + "Exit-" + key];
  3389. } else if (node.append) {
  3390. return [type, CHILDREN, type + "Exit"];
  3391. } else {
  3392. return [type, type + "Exit"];
  3393. }
  3394. }
  3395. function toStack(node) {
  3396. let events;
  3397. if (node.type === "document") {
  3398. events = ["Document", CHILDREN, "DocumentExit"];
  3399. } else if (node.type === "root") {
  3400. events = ["Root", CHILDREN, "RootExit"];
  3401. } else {
  3402. events = getEvents(node);
  3403. }
  3404. return {
  3405. eventIndex: 0,
  3406. events,
  3407. iterator: 0,
  3408. node,
  3409. visitorIndex: 0,
  3410. visitors: []
  3411. };
  3412. }
  3413. function cleanMarks(node) {
  3414. let stack = [node];
  3415. while (stack.length > 0) {
  3416. let next = stack.pop();
  3417. next[isClean] = false;
  3418. if (next.nodes) {
  3419. for (let i of next.nodes) stack.push(i);
  3420. }
  3421. }
  3422. return node;
  3423. }
  3424. var postcss2 = {};
  3425. var LazyResult = class _LazyResult {
  3426. get content() {
  3427. return this.stringify().content;
  3428. }
  3429. get css() {
  3430. return this.stringify().css;
  3431. }
  3432. get map() {
  3433. return this.stringify().map;
  3434. }
  3435. get messages() {
  3436. return this.sync().messages;
  3437. }
  3438. get opts() {
  3439. return this.result.opts;
  3440. }
  3441. get processor() {
  3442. return this.result.processor;
  3443. }
  3444. get root() {
  3445. return this.sync().root;
  3446. }
  3447. get [Symbol.toStringTag]() {
  3448. return "LazyResult";
  3449. }
  3450. constructor(processor, css, opts) {
  3451. this.stringified = false;
  3452. this.processed = false;
  3453. let root2;
  3454. if (typeof css === "object" && css !== null && (css.type === "root" || css.type === "document")) {
  3455. root2 = cleanMarks(css);
  3456. } else if (css instanceof _LazyResult || css instanceof Result2) {
  3457. root2 = cleanMarks(css.root);
  3458. if (css.map) {
  3459. if (typeof opts.map === "undefined") opts.map = {};
  3460. if (!opts.map.inline) opts.map.inline = false;
  3461. opts.map.prev = css.map;
  3462. }
  3463. } else {
  3464. let parser = parse3;
  3465. if (opts.syntax) parser = opts.syntax.parse;
  3466. if (opts.parser) parser = opts.parser;
  3467. if (parser.parse) parser = parser.parse;
  3468. try {
  3469. root2 = parser(css, opts);
  3470. } catch (error) {
  3471. this.processed = true;
  3472. this.error = error;
  3473. }
  3474. if (root2 && !root2[my]) {
  3475. Container2.rebuild(root2);
  3476. }
  3477. }
  3478. this.result = new Result2(processor, root2, opts);
  3479. this.helpers = { ...postcss2, postcss: postcss2, result: this.result };
  3480. this.plugins = this.processor.plugins.map((plugin2) => {
  3481. if (typeof plugin2 === "object" && plugin2.prepare) {
  3482. return { ...plugin2, ...plugin2.prepare(this.result) };
  3483. } else {
  3484. return plugin2;
  3485. }
  3486. });
  3487. }
  3488. async() {
  3489. if (this.error) return Promise.reject(this.error);
  3490. if (this.processed) return Promise.resolve(this.result);
  3491. if (!this.processing) {
  3492. this.processing = this.runAsync();
  3493. }
  3494. return this.processing;
  3495. }
  3496. catch(onRejected) {
  3497. return this.async().catch(onRejected);
  3498. }
  3499. finally(onFinally) {
  3500. return this.async().then(onFinally, onFinally);
  3501. }
  3502. getAsyncError() {
  3503. throw new Error("Use process(css).then(cb) to work with async plugins");
  3504. }
  3505. handleError(error, node) {
  3506. let plugin2 = this.result.lastPlugin;
  3507. try {
  3508. if (node) node.addToError(error);
  3509. this.error = error;
  3510. if (error.name === "CssSyntaxError" && !error.plugin) {
  3511. error.plugin = plugin2.postcssPlugin;
  3512. error.setMessage();
  3513. } else if (plugin2.postcssVersion) {
  3514. if (true) {
  3515. let pluginName = plugin2.postcssPlugin;
  3516. let pluginVer = plugin2.postcssVersion;
  3517. let runtimeVer = this.result.processor.version;
  3518. let a = pluginVer.split(".");
  3519. let b = runtimeVer.split(".");
  3520. if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
  3521. console.error(
  3522. "Unknown error from PostCSS plugin. Your current PostCSS version is " + runtimeVer + ", but " + pluginName + " uses " + pluginVer + ". Perhaps this is the source of the error below."
  3523. );
  3524. }
  3525. }
  3526. }
  3527. } catch (err) {
  3528. if (console && console.error) console.error(err);
  3529. }
  3530. return error;
  3531. }
  3532. prepareVisitors() {
  3533. this.listeners = {};
  3534. let add = (plugin2, type, cb) => {
  3535. if (!this.listeners[type]) this.listeners[type] = [];
  3536. this.listeners[type].push([plugin2, cb]);
  3537. };
  3538. for (let plugin2 of this.plugins) {
  3539. if (typeof plugin2 === "object") {
  3540. for (let event in plugin2) {
  3541. if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
  3542. throw new Error(
  3543. `Unknown event ${event} in ${plugin2.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`
  3544. );
  3545. }
  3546. if (!NOT_VISITORS[event]) {
  3547. if (typeof plugin2[event] === "object") {
  3548. for (let filter in plugin2[event]) {
  3549. if (filter === "*") {
  3550. add(plugin2, event, plugin2[event][filter]);
  3551. } else {
  3552. add(
  3553. plugin2,
  3554. event + "-" + filter.toLowerCase(),
  3555. plugin2[event][filter]
  3556. );
  3557. }
  3558. }
  3559. } else if (typeof plugin2[event] === "function") {
  3560. add(plugin2, event, plugin2[event]);
  3561. }
  3562. }
  3563. }
  3564. }
  3565. }
  3566. this.hasListener = Object.keys(this.listeners).length > 0;
  3567. }
  3568. async runAsync() {
  3569. this.plugin = 0;
  3570. for (let i = 0; i < this.plugins.length; i++) {
  3571. let plugin2 = this.plugins[i];
  3572. let promise = this.runOnRoot(plugin2);
  3573. if (isPromise(promise)) {
  3574. try {
  3575. await promise;
  3576. } catch (error) {
  3577. throw this.handleError(error);
  3578. }
  3579. }
  3580. }
  3581. this.prepareVisitors();
  3582. if (this.hasListener) {
  3583. let root2 = this.result.root;
  3584. while (!root2[isClean]) {
  3585. root2[isClean] = true;
  3586. let stack = [toStack(root2)];
  3587. while (stack.length > 0) {
  3588. let promise = this.visitTick(stack);
  3589. if (isPromise(promise)) {
  3590. try {
  3591. await promise;
  3592. } catch (e) {
  3593. let node = stack[stack.length - 1].node;
  3594. throw this.handleError(e, node);
  3595. }
  3596. }
  3597. }
  3598. }
  3599. if (this.listeners.OnceExit) {
  3600. for (let [plugin2, visitor] of this.listeners.OnceExit) {
  3601. this.result.lastPlugin = plugin2;
  3602. try {
  3603. if (root2.type === "document") {
  3604. let roots = root2.nodes.map(
  3605. (subRoot) => visitor(subRoot, this.helpers)
  3606. );
  3607. await Promise.all(roots);
  3608. } else {
  3609. await visitor(root2, this.helpers);
  3610. }
  3611. } catch (e) {
  3612. throw this.handleError(e);
  3613. }
  3614. }
  3615. }
  3616. }
  3617. this.processed = true;
  3618. return this.stringify();
  3619. }
  3620. runOnRoot(plugin2) {
  3621. this.result.lastPlugin = plugin2;
  3622. try {
  3623. if (typeof plugin2 === "object" && plugin2.Once) {
  3624. if (this.result.root.type === "document") {
  3625. let roots = this.result.root.nodes.map(
  3626. (root2) => plugin2.Once(root2, this.helpers)
  3627. );
  3628. if (isPromise(roots[0])) {
  3629. return Promise.all(roots);
  3630. }
  3631. return roots;
  3632. }
  3633. return plugin2.Once(this.result.root, this.helpers);
  3634. } else if (typeof plugin2 === "function") {
  3635. return plugin2(this.result.root, this.result);
  3636. }
  3637. } catch (error) {
  3638. throw this.handleError(error);
  3639. }
  3640. }
  3641. stringify() {
  3642. if (this.error) throw this.error;
  3643. if (this.stringified) return this.result;
  3644. this.stringified = true;
  3645. this.sync();
  3646. let opts = this.result.opts;
  3647. let str = stringify3;
  3648. if (opts.syntax) str = opts.syntax.stringify;
  3649. if (opts.stringifier) str = opts.stringifier;
  3650. if (str.stringify) str = str.stringify;
  3651. let rootSource = this.result.root.source;
  3652. if (opts.map === void 0 && !(rootSource && rootSource.input && rootSource.input.map)) {
  3653. let result = "";
  3654. str(this.result.root, (i) => {
  3655. result += i;
  3656. });
  3657. this.result.css = result;
  3658. return this.result;
  3659. }
  3660. let map = new MapGenerator(str, this.result.root, this.result.opts);
  3661. let data = map.generate();
  3662. this.result.css = data[0];
  3663. this.result.map = data[1];
  3664. return this.result;
  3665. }
  3666. sync() {
  3667. if (this.error) throw this.error;
  3668. if (this.processed) return this.result;
  3669. this.processed = true;
  3670. if (this.processing) {
  3671. throw this.getAsyncError();
  3672. }
  3673. for (let plugin2 of this.plugins) {
  3674. let promise = this.runOnRoot(plugin2);
  3675. if (isPromise(promise)) {
  3676. throw this.getAsyncError();
  3677. }
  3678. }
  3679. this.prepareVisitors();
  3680. if (this.hasListener) {
  3681. let root2 = this.result.root;
  3682. while (!root2[isClean]) {
  3683. root2[isClean] = true;
  3684. this.walkSync(root2);
  3685. }
  3686. if (this.listeners.OnceExit) {
  3687. if (root2.type === "document") {
  3688. for (let subRoot of root2.nodes) {
  3689. this.visitSync(this.listeners.OnceExit, subRoot);
  3690. }
  3691. } else {
  3692. this.visitSync(this.listeners.OnceExit, root2);
  3693. }
  3694. }
  3695. }
  3696. return this.result;
  3697. }
  3698. then(onFulfilled, onRejected) {
  3699. if (true) {
  3700. if (!("from" in this.opts)) {
  3701. warnOnce(
  3702. "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."
  3703. );
  3704. }
  3705. }
  3706. return this.async().then(onFulfilled, onRejected);
  3707. }
  3708. toString() {
  3709. return this.css;
  3710. }
  3711. visitSync(visitors, node) {
  3712. for (let [plugin2, visitor] of visitors) {
  3713. this.result.lastPlugin = plugin2;
  3714. let promise;
  3715. try {
  3716. promise = visitor(node, this.helpers);
  3717. } catch (e) {
  3718. throw this.handleError(e, node.proxyOf);
  3719. }
  3720. if (node.type !== "root" && node.type !== "document" && !node.parent) {
  3721. return true;
  3722. }
  3723. if (isPromise(promise)) {
  3724. throw this.getAsyncError();
  3725. }
  3726. }
  3727. }
  3728. visitTick(stack) {
  3729. let visit = stack[stack.length - 1];
  3730. let { node, visitors } = visit;
  3731. if (node.type !== "root" && node.type !== "document" && !node.parent) {
  3732. stack.pop();
  3733. return;
  3734. }
  3735. if (visitors.length > 0 && visit.visitorIndex < visitors.length) {
  3736. let [plugin2, visitor] = visitors[visit.visitorIndex];
  3737. visit.visitorIndex += 1;
  3738. if (visit.visitorIndex === visitors.length) {
  3739. visit.visitors = [];
  3740. visit.visitorIndex = 0;
  3741. }
  3742. this.result.lastPlugin = plugin2;
  3743. try {
  3744. return visitor(node.toProxy(), this.helpers);
  3745. } catch (e) {
  3746. throw this.handleError(e, node);
  3747. }
  3748. }
  3749. if (visit.iterator !== 0) {
  3750. let iterator = visit.iterator;
  3751. if (visit.descending) {
  3752. visit.descending = false;
  3753. node.indexes[iterator] += 1;
  3754. }
  3755. let child;
  3756. while (child = node.nodes[node.indexes[iterator]]) {
  3757. if (!child[isClean]) {
  3758. child[isClean] = true;
  3759. visit.descending = true;
  3760. stack.push(toStack(child));
  3761. return;
  3762. }
  3763. node.indexes[iterator] += 1;
  3764. }
  3765. visit.iterator = 0;
  3766. delete node.indexes[iterator];
  3767. }
  3768. let events = visit.events;
  3769. while (visit.eventIndex < events.length) {
  3770. let event = events[visit.eventIndex];
  3771. visit.eventIndex += 1;
  3772. if (event === CHILDREN) {
  3773. if (node.nodes && node.nodes.length) {
  3774. node[isClean] = true;
  3775. visit.iterator = node.getIterator();
  3776. }
  3777. return;
  3778. } else if (this.listeners[event]) {
  3779. visit.visitors = this.listeners[event];
  3780. return;
  3781. }
  3782. }
  3783. stack.pop();
  3784. }
  3785. walkSync(node) {
  3786. node[isClean] = true;
  3787. let stack = [{ eventIndex: 0, events: getEvents(node), iterator: 0, node }];
  3788. while (stack.length > 0) {
  3789. let visit = stack[stack.length - 1];
  3790. let visitNode = visit.node;
  3791. if (visit.iterator !== 0) {
  3792. let iterator = visit.iterator;
  3793. if (visit.descending) {
  3794. visit.descending = false;
  3795. visitNode.indexes[iterator] += 1;
  3796. }
  3797. let child;
  3798. let descended = false;
  3799. while (child = visitNode.nodes[visitNode.indexes[iterator]]) {
  3800. if (!child[isClean]) {
  3801. child[isClean] = true;
  3802. visit.descending = true;
  3803. stack.push({
  3804. eventIndex: 0,
  3805. events: getEvents(child),
  3806. iterator: 0,
  3807. node: child
  3808. });
  3809. descended = true;
  3810. break;
  3811. }
  3812. visitNode.indexes[iterator] += 1;
  3813. }
  3814. if (descended) continue;
  3815. visit.iterator = 0;
  3816. delete visitNode.indexes[iterator];
  3817. }
  3818. if (visit.eventIndex < visit.events.length) {
  3819. let event = visit.events[visit.eventIndex];
  3820. visit.eventIndex += 1;
  3821. if (event === CHILDREN) {
  3822. if (visitNode.nodes && visitNode.nodes.length) {
  3823. visit.iterator = visitNode.getIterator();
  3824. }
  3825. } else {
  3826. let visitors = this.listeners[event];
  3827. if (visitors) {
  3828. if (this.visitSync(visitors, visitNode.toProxy())) stack.pop();
  3829. }
  3830. }
  3831. continue;
  3832. }
  3833. stack.pop();
  3834. }
  3835. }
  3836. warnings() {
  3837. return this.sync().warnings();
  3838. }
  3839. };
  3840. LazyResult.registerPostcss = (dependant) => {
  3841. postcss2 = dependant;
  3842. };
  3843. module.exports = LazyResult;
  3844. LazyResult.default = LazyResult;
  3845. Root2.registerLazyResult(LazyResult);
  3846. Document2.registerLazyResult(LazyResult);
  3847. }
  3848. });
  3849. // node_modules/postcss/lib/no-work-result.js
  3850. var require_no_work_result = __commonJS({
  3851. "node_modules/postcss/lib/no-work-result.js"(exports, module) {
  3852. "use strict";
  3853. var MapGenerator = require_map_generator();
  3854. var parse3 = require_parse();
  3855. var Result2 = require_result();
  3856. var stringify3 = require_stringify();
  3857. var warnOnce = require_warn_once();
  3858. var NoWorkResult = class {
  3859. get content() {
  3860. return this.result.css;
  3861. }
  3862. get css() {
  3863. return this.result.css;
  3864. }
  3865. get map() {
  3866. return this.result.map;
  3867. }
  3868. get messages() {
  3869. return [];
  3870. }
  3871. get opts() {
  3872. return this.result.opts;
  3873. }
  3874. get processor() {
  3875. return this.result.processor;
  3876. }
  3877. get root() {
  3878. if (this._root) {
  3879. return this._root;
  3880. }
  3881. let root2;
  3882. let parser = parse3;
  3883. try {
  3884. root2 = parser(this._css, this._opts);
  3885. } catch (error) {
  3886. this.error = error;
  3887. }
  3888. if (this.error) {
  3889. throw this.error;
  3890. } else {
  3891. this._root = root2;
  3892. return root2;
  3893. }
  3894. }
  3895. get [Symbol.toStringTag]() {
  3896. return "NoWorkResult";
  3897. }
  3898. constructor(processor, css, opts) {
  3899. css = css.toString();
  3900. this.stringified = false;
  3901. this._processor = processor;
  3902. this._css = css;
  3903. this._opts = opts;
  3904. this._map = void 0;
  3905. let str = stringify3;
  3906. this.result = new Result2(this._processor, void 0, this._opts);
  3907. this.result.css = css;
  3908. let self = this;
  3909. Object.defineProperty(this.result, "root", {
  3910. get() {
  3911. return self.root;
  3912. }
  3913. });
  3914. let map = new MapGenerator(str, void 0, this._opts, css);
  3915. if (map.isMap()) {
  3916. let [generatedCSS, generatedMap] = map.generate();
  3917. if (generatedCSS) {
  3918. this.result.css = generatedCSS;
  3919. }
  3920. if (generatedMap) {
  3921. this.result.map = generatedMap;
  3922. }
  3923. } else {
  3924. map.clearAnnotation();
  3925. this.result.css = map.css;
  3926. }
  3927. }
  3928. async() {
  3929. if (this.error) return Promise.reject(this.error);
  3930. return Promise.resolve(this.result);
  3931. }
  3932. catch(onRejected) {
  3933. return this.async().catch(onRejected);
  3934. }
  3935. finally(onFinally) {
  3936. return this.async().then(onFinally, onFinally);
  3937. }
  3938. sync() {
  3939. if (this.error) throw this.error;
  3940. return this.result;
  3941. }
  3942. then(onFulfilled, onRejected) {
  3943. if (true) {
  3944. if (!("from" in this._opts)) {
  3945. warnOnce(
  3946. "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."
  3947. );
  3948. }
  3949. }
  3950. return this.async().then(onFulfilled, onRejected);
  3951. }
  3952. toString() {
  3953. return this._css;
  3954. }
  3955. warnings() {
  3956. return [];
  3957. }
  3958. };
  3959. module.exports = NoWorkResult;
  3960. NoWorkResult.default = NoWorkResult;
  3961. }
  3962. });
  3963. // node_modules/postcss/lib/processor.js
  3964. var require_processor = __commonJS({
  3965. "node_modules/postcss/lib/processor.js"(exports, module) {
  3966. "use strict";
  3967. var Document2 = require_document();
  3968. var LazyResult = require_lazy_result();
  3969. var NoWorkResult = require_no_work_result();
  3970. var Root2 = require_root();
  3971. var Processor2 = class {
  3972. constructor(plugins = []) {
  3973. this.version = "8.5.25";
  3974. this.plugins = this.normalize(plugins);
  3975. }
  3976. normalize(plugins) {
  3977. let normalized = [];
  3978. for (let i of plugins) {
  3979. if (i.postcss === true) {
  3980. i = i();
  3981. } else if (i.postcss) {
  3982. i = i.postcss;
  3983. }
  3984. if (typeof i === "object" && Array.isArray(i.plugins)) {
  3985. normalized = normalized.concat(i.plugins);
  3986. } else if (typeof i === "object" && i.postcssPlugin) {
  3987. normalized.push(i);
  3988. } else if (typeof i === "function") {
  3989. normalized.push(i);
  3990. } else if (typeof i === "object" && (i.parse || i.stringify)) {
  3991. if (true) {
  3992. throw new Error(
  3993. "PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation."
  3994. );
  3995. }
  3996. } else {
  3997. throw new Error(i + " is not a PostCSS plugin");
  3998. }
  3999. }
  4000. return normalized;
  4001. }
  4002. process(css, opts = {}) {
  4003. if (!this.plugins.length && !opts.parser && !opts.stringifier && !opts.syntax) {
  4004. return new NoWorkResult(this, css, opts);
  4005. } else {
  4006. return new LazyResult(this, css, opts);
  4007. }
  4008. }
  4009. use(plugin2) {
  4010. this.plugins = this.plugins.concat(this.normalize([plugin2]));
  4011. return this;
  4012. }
  4013. };
  4014. module.exports = Processor2;
  4015. Processor2.default = Processor2;
  4016. Root2.registerProcessor(Processor2);
  4017. Document2.registerProcessor(Processor2);
  4018. }
  4019. });
  4020. // node_modules/postcss/lib/postcss.js
  4021. var require_postcss = __commonJS({
  4022. "node_modules/postcss/lib/postcss.js"(exports, module) {
  4023. "use strict";
  4024. var AtRule2 = require_at_rule();
  4025. var Comment2 = require_comment();
  4026. var Container2 = require_container();
  4027. var CssSyntaxError2 = require_css_syntax_error();
  4028. var Declaration2 = require_declaration();
  4029. var Document2 = require_document();
  4030. var fromJSON2 = require_fromJSON();
  4031. var Input2 = require_input();
  4032. var LazyResult = require_lazy_result();
  4033. var list2 = require_list();
  4034. var Node3 = require_node();
  4035. var parse3 = require_parse();
  4036. var Processor2 = require_processor();
  4037. var Result2 = require_result();
  4038. var Root2 = require_root();
  4039. var Rule2 = require_rule();
  4040. var stringify3 = require_stringify();
  4041. var Warning2 = require_warning();
  4042. function postcss2(...plugins) {
  4043. if (plugins.length === 1 && Array.isArray(plugins[0])) {
  4044. plugins = plugins[0];
  4045. }
  4046. return new Processor2(plugins);
  4047. }
  4048. postcss2.plugin = function plugin2(name, initializer) {
  4049. let warningPrinted = false;
  4050. function creator(...args) {
  4051. if (console && console.warn && !warningPrinted) {
  4052. warningPrinted = true;
  4053. console.warn(
  4054. name + ": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"
  4055. );
  4056. if (process.env.LANG && process.env.LANG.startsWith("cn")) {
  4057. console.warn(
  4058. name + ": \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:\nhttps://www.w3ctech.com/topic/2226"
  4059. );
  4060. }
  4061. }
  4062. let transformer = initializer(...args);
  4063. transformer.postcssPlugin = name;
  4064. transformer.postcssVersion = new Processor2().version;
  4065. return transformer;
  4066. }
  4067. let cache;
  4068. Object.defineProperty(creator, "postcss", {
  4069. get() {
  4070. if (!cache) cache = creator();
  4071. return cache;
  4072. }
  4073. });
  4074. creator.process = function(css, processOpts, pluginOpts) {
  4075. return postcss2([creator(pluginOpts)]).process(css, processOpts);
  4076. };
  4077. return creator;
  4078. };
  4079. postcss2.stringify = stringify3;
  4080. postcss2.parse = parse3;
  4081. postcss2.fromJSON = fromJSON2;
  4082. postcss2.list = list2;
  4083. postcss2.comment = (defaults2) => new Comment2(defaults2);
  4084. postcss2.atRule = (defaults2) => new AtRule2(defaults2);
  4085. postcss2.decl = (defaults2) => new Declaration2(defaults2);
  4086. postcss2.rule = (defaults2) => new Rule2(defaults2);
  4087. postcss2.root = (defaults2) => new Root2(defaults2);
  4088. postcss2.document = (defaults2) => new Document2(defaults2);
  4089. postcss2.CssSyntaxError = CssSyntaxError2;
  4090. postcss2.Declaration = Declaration2;
  4091. postcss2.Container = Container2;
  4092. postcss2.Processor = Processor2;
  4093. postcss2.Document = Document2;
  4094. postcss2.Comment = Comment2;
  4095. postcss2.Warning = Warning2;
  4096. postcss2.AtRule = AtRule2;
  4097. postcss2.Result = Result2;
  4098. postcss2.Input = Input2;
  4099. postcss2.Rule = Rule2;
  4100. postcss2.Root = Root2;
  4101. postcss2.Node = Node3;
  4102. LazyResult.registerPostcss(postcss2);
  4103. module.exports = postcss2;
  4104. postcss2.default = postcss2;
  4105. }
  4106. });
  4107. // node_modules/postcss-value-parser/lib/parse.js
  4108. var require_parse2 = __commonJS({
  4109. "node_modules/postcss-value-parser/lib/parse.js"(exports, module) {
  4110. var openParentheses = "(".charCodeAt(0);
  4111. var closeParentheses = ")".charCodeAt(0);
  4112. var singleQuote = "'".charCodeAt(0);
  4113. var doubleQuote = '"'.charCodeAt(0);
  4114. var backslash = "\\".charCodeAt(0);
  4115. var slash = "/".charCodeAt(0);
  4116. var comma = ",".charCodeAt(0);
  4117. var colon = ":".charCodeAt(0);
  4118. var star = "*".charCodeAt(0);
  4119. var uLower = "u".charCodeAt(0);
  4120. var uUpper = "U".charCodeAt(0);
  4121. var plus = "+".charCodeAt(0);
  4122. var isUnicodeRange = /^[a-f0-9?-]+$/i;
  4123. module.exports = function(input) {
  4124. var tokens = [];
  4125. var value = input;
  4126. var next, quote, prev, token, escape, escapePos, whitespacePos, parenthesesOpenPos;
  4127. var pos = 0;
  4128. var code = value.charCodeAt(pos);
  4129. var max = value.length;
  4130. var stack = [{ nodes: tokens }];
  4131. var balanced = 0;
  4132. var parent;
  4133. var name = "";
  4134. var before = "";
  4135. var after = "";
  4136. while (pos < max) {
  4137. if (code <= 32) {
  4138. next = pos;
  4139. do {
  4140. next += 1;
  4141. code = value.charCodeAt(next);
  4142. } while (code <= 32);
  4143. token = value.slice(pos, next);
  4144. prev = tokens[tokens.length - 1];
  4145. if (code === closeParentheses && balanced) {
  4146. after = token;
  4147. } else if (prev && prev.type === "div") {
  4148. prev.after = token;
  4149. prev.sourceEndIndex += token.length;
  4150. } else if (code === comma || code === colon || code === slash && value.charCodeAt(next + 1) !== star && (!parent || parent && parent.type === "function" && parent.value !== "calc")) {
  4151. before = token;
  4152. } else {
  4153. tokens.push({
  4154. type: "space",
  4155. sourceIndex: pos,
  4156. sourceEndIndex: next,
  4157. value: token
  4158. });
  4159. }
  4160. pos = next;
  4161. } else if (code === singleQuote || code === doubleQuote) {
  4162. next = pos;
  4163. quote = code === singleQuote ? "'" : '"';
  4164. token = {
  4165. type: "string",
  4166. sourceIndex: pos,
  4167. quote
  4168. };
  4169. do {
  4170. escape = false;
  4171. next = value.indexOf(quote, next + 1);
  4172. if (~next) {
  4173. escapePos = next;
  4174. while (value.charCodeAt(escapePos - 1) === backslash) {
  4175. escapePos -= 1;
  4176. escape = !escape;
  4177. }
  4178. } else {
  4179. value += quote;
  4180. next = value.length - 1;
  4181. token.unclosed = true;
  4182. }
  4183. } while (escape);
  4184. token.value = value.slice(pos + 1, next);
  4185. token.sourceEndIndex = token.unclosed ? next : next + 1;
  4186. tokens.push(token);
  4187. pos = next + 1;
  4188. code = value.charCodeAt(pos);
  4189. } else if (code === slash && value.charCodeAt(pos + 1) === star) {
  4190. next = value.indexOf("*/", pos);
  4191. token = {
  4192. type: "comment",
  4193. sourceIndex: pos,
  4194. sourceEndIndex: next + 2
  4195. };
  4196. if (next === -1) {
  4197. token.unclosed = true;
  4198. next = value.length;
  4199. token.sourceEndIndex = next;
  4200. }
  4201. token.value = value.slice(pos + 2, next);
  4202. tokens.push(token);
  4203. pos = next + 2;
  4204. code = value.charCodeAt(pos);
  4205. } else if ((code === slash || code === star) && parent && parent.type === "function" && parent.value === "calc") {
  4206. token = value[pos];
  4207. tokens.push({
  4208. type: "word",
  4209. sourceIndex: pos - before.length,
  4210. sourceEndIndex: pos + token.length,
  4211. value: token
  4212. });
  4213. pos += 1;
  4214. code = value.charCodeAt(pos);
  4215. } else if (code === slash || code === comma || code === colon) {
  4216. token = value[pos];
  4217. tokens.push({
  4218. type: "div",
  4219. sourceIndex: pos - before.length,
  4220. sourceEndIndex: pos + token.length,
  4221. value: token,
  4222. before,
  4223. after: ""
  4224. });
  4225. before = "";
  4226. pos += 1;
  4227. code = value.charCodeAt(pos);
  4228. } else if (openParentheses === code) {
  4229. next = pos;
  4230. do {
  4231. next += 1;
  4232. code = value.charCodeAt(next);
  4233. } while (code <= 32);
  4234. parenthesesOpenPos = pos;
  4235. token = {
  4236. type: "function",
  4237. sourceIndex: pos - name.length,
  4238. value: name,
  4239. before: value.slice(parenthesesOpenPos + 1, next)
  4240. };
  4241. pos = next;
  4242. if (name === "url" && code !== singleQuote && code !== doubleQuote) {
  4243. next -= 1;
  4244. do {
  4245. escape = false;
  4246. next = value.indexOf(")", next + 1);
  4247. if (~next) {
  4248. escapePos = next;
  4249. while (value.charCodeAt(escapePos - 1) === backslash) {
  4250. escapePos -= 1;
  4251. escape = !escape;
  4252. }
  4253. } else {
  4254. value += ")";
  4255. next = value.length - 1;
  4256. token.unclosed = true;
  4257. }
  4258. } while (escape);
  4259. whitespacePos = next;
  4260. do {
  4261. whitespacePos -= 1;
  4262. code = value.charCodeAt(whitespacePos);
  4263. } while (code <= 32);
  4264. if (parenthesesOpenPos < whitespacePos) {
  4265. if (pos !== whitespacePos + 1) {
  4266. token.nodes = [
  4267. {
  4268. type: "word",
  4269. sourceIndex: pos,
  4270. sourceEndIndex: whitespacePos + 1,
  4271. value: value.slice(pos, whitespacePos + 1)
  4272. }
  4273. ];
  4274. } else {
  4275. token.nodes = [];
  4276. }
  4277. if (token.unclosed && whitespacePos + 1 !== next) {
  4278. token.after = "";
  4279. token.nodes.push({
  4280. type: "space",
  4281. sourceIndex: whitespacePos + 1,
  4282. sourceEndIndex: next,
  4283. value: value.slice(whitespacePos + 1, next)
  4284. });
  4285. } else {
  4286. token.after = value.slice(whitespacePos + 1, next);
  4287. token.sourceEndIndex = next;
  4288. }
  4289. } else {
  4290. token.after = "";
  4291. token.nodes = [];
  4292. }
  4293. pos = next + 1;
  4294. token.sourceEndIndex = token.unclosed ? next : pos;
  4295. code = value.charCodeAt(pos);
  4296. tokens.push(token);
  4297. } else {
  4298. balanced += 1;
  4299. token.after = "";
  4300. token.sourceEndIndex = pos + 1;
  4301. tokens.push(token);
  4302. stack.push(token);
  4303. tokens = token.nodes = [];
  4304. parent = token;
  4305. }
  4306. name = "";
  4307. } else if (closeParentheses === code && balanced) {
  4308. pos += 1;
  4309. code = value.charCodeAt(pos);
  4310. parent.after = after;
  4311. parent.sourceEndIndex += after.length;
  4312. after = "";
  4313. balanced -= 1;
  4314. stack[stack.length - 1].sourceEndIndex = pos;
  4315. stack.pop();
  4316. parent = stack[balanced];
  4317. tokens = parent.nodes;
  4318. } else {
  4319. next = pos;
  4320. do {
  4321. if (code === backslash) {
  4322. next += 1;
  4323. }
  4324. next += 1;
  4325. code = value.charCodeAt(next);
  4326. } while (next < max && !(code <= 32 || code === singleQuote || code === doubleQuote || code === comma || code === colon || code === slash || code === openParentheses || code === star && parent && parent.type === "function" && parent.value === "calc" || code === slash && parent.type === "function" && parent.value === "calc" || code === closeParentheses && balanced));
  4327. token = value.slice(pos, next);
  4328. if (openParentheses === code) {
  4329. name = token;
  4330. } else if ((uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) && plus === token.charCodeAt(1) && isUnicodeRange.test(token.slice(2))) {
  4331. tokens.push({
  4332. type: "unicode-range",
  4333. sourceIndex: pos,
  4334. sourceEndIndex: next,
  4335. value: token
  4336. });
  4337. } else {
  4338. tokens.push({
  4339. type: "word",
  4340. sourceIndex: pos,
  4341. sourceEndIndex: next,
  4342. value: token
  4343. });
  4344. }
  4345. pos = next;
  4346. }
  4347. }
  4348. for (pos = stack.length - 1; pos; pos -= 1) {
  4349. stack[pos].unclosed = true;
  4350. stack[pos].sourceEndIndex = value.length;
  4351. }
  4352. return stack[0].nodes;
  4353. };
  4354. }
  4355. });
  4356. // node_modules/postcss-value-parser/lib/walk.js
  4357. var require_walk = __commonJS({
  4358. "node_modules/postcss-value-parser/lib/walk.js"(exports, module) {
  4359. module.exports = function walk(nodes, cb, bubble) {
  4360. var i, max, node, result;
  4361. for (i = 0, max = nodes.length; i < max; i += 1) {
  4362. node = nodes[i];
  4363. if (!bubble) {
  4364. result = cb(node, i, nodes);
  4365. }
  4366. if (result !== false && node.type === "function" && Array.isArray(node.nodes)) {
  4367. walk(node.nodes, cb, bubble);
  4368. }
  4369. if (bubble) {
  4370. cb(node, i, nodes);
  4371. }
  4372. }
  4373. };
  4374. }
  4375. });
  4376. // node_modules/postcss-value-parser/lib/stringify.js
  4377. var require_stringify2 = __commonJS({
  4378. "node_modules/postcss-value-parser/lib/stringify.js"(exports, module) {
  4379. function stringifyNode(node, custom) {
  4380. var type = node.type;
  4381. var value = node.value;
  4382. var buf;
  4383. var customResult;
  4384. if (custom && (customResult = custom(node)) !== void 0) {
  4385. return customResult;
  4386. } else if (type === "word" || type === "space") {
  4387. return value;
  4388. } else if (type === "string") {
  4389. buf = node.quote || "";
  4390. return buf + value + (node.unclosed ? "" : buf);
  4391. } else if (type === "comment") {
  4392. return "/*" + value + (node.unclosed ? "" : "*/");
  4393. } else if (type === "div") {
  4394. return (node.before || "") + value + (node.after || "");
  4395. } else if (Array.isArray(node.nodes)) {
  4396. buf = stringify3(node.nodes, custom);
  4397. if (type !== "function") {
  4398. return buf;
  4399. }
  4400. return value + "(" + (node.before || "") + buf + (node.after || "") + (node.unclosed ? "" : ")");
  4401. }
  4402. return value;
  4403. }
  4404. function stringify3(nodes, custom) {
  4405. var result, i;
  4406. if (Array.isArray(nodes)) {
  4407. result = "";
  4408. for (i = nodes.length - 1; ~i; i -= 1) {
  4409. result = stringifyNode(nodes[i], custom) + result;
  4410. }
  4411. return result;
  4412. }
  4413. return stringifyNode(nodes, custom);
  4414. }
  4415. module.exports = stringify3;
  4416. }
  4417. });
  4418. // node_modules/postcss-value-parser/lib/unit.js
  4419. var require_unit = __commonJS({
  4420. "node_modules/postcss-value-parser/lib/unit.js"(exports, module) {
  4421. var minus = "-".charCodeAt(0);
  4422. var plus = "+".charCodeAt(0);
  4423. var dot = ".".charCodeAt(0);
  4424. var exp = "e".charCodeAt(0);
  4425. var EXP = "E".charCodeAt(0);
  4426. function likeNumber(value) {
  4427. var code = value.charCodeAt(0);
  4428. var nextCode;
  4429. if (code === plus || code === minus) {
  4430. nextCode = value.charCodeAt(1);
  4431. if (nextCode >= 48 && nextCode <= 57) {
  4432. return true;
  4433. }
  4434. var nextNextCode = value.charCodeAt(2);
  4435. if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
  4436. return true;
  4437. }
  4438. return false;
  4439. }
  4440. if (code === dot) {
  4441. nextCode = value.charCodeAt(1);
  4442. if (nextCode >= 48 && nextCode <= 57) {
  4443. return true;
  4444. }
  4445. return false;
  4446. }
  4447. if (code >= 48 && code <= 57) {
  4448. return true;
  4449. }
  4450. return false;
  4451. }
  4452. module.exports = function(value) {
  4453. var pos = 0;
  4454. var length = value.length;
  4455. var code;
  4456. var nextCode;
  4457. var nextNextCode;
  4458. if (length === 0 || !likeNumber(value)) {
  4459. return false;
  4460. }
  4461. code = value.charCodeAt(pos);
  4462. if (code === plus || code === minus) {
  4463. pos++;
  4464. }
  4465. while (pos < length) {
  4466. code = value.charCodeAt(pos);
  4467. if (code < 48 || code > 57) {
  4468. break;
  4469. }
  4470. pos += 1;
  4471. }
  4472. code = value.charCodeAt(pos);
  4473. nextCode = value.charCodeAt(pos + 1);
  4474. if (code === dot && nextCode >= 48 && nextCode <= 57) {
  4475. pos += 2;
  4476. while (pos < length) {
  4477. code = value.charCodeAt(pos);
  4478. if (code < 48 || code > 57) {
  4479. break;
  4480. }
  4481. pos += 1;
  4482. }
  4483. }
  4484. code = value.charCodeAt(pos);
  4485. nextCode = value.charCodeAt(pos + 1);
  4486. nextNextCode = value.charCodeAt(pos + 2);
  4487. if ((code === exp || code === EXP) && (nextCode >= 48 && nextCode <= 57 || (nextCode === plus || nextCode === minus) && nextNextCode >= 48 && nextNextCode <= 57)) {
  4488. pos += nextCode === plus || nextCode === minus ? 3 : 2;
  4489. while (pos < length) {
  4490. code = value.charCodeAt(pos);
  4491. if (code < 48 || code > 57) {
  4492. break;
  4493. }
  4494. pos += 1;
  4495. }
  4496. }
  4497. return {
  4498. number: value.slice(0, pos),
  4499. unit: value.slice(pos)
  4500. };
  4501. };
  4502. }
  4503. });
  4504. // node_modules/postcss-value-parser/lib/index.js
  4505. var require_lib = __commonJS({
  4506. "node_modules/postcss-value-parser/lib/index.js"(exports, module) {
  4507. var parse3 = require_parse2();
  4508. var walk = require_walk();
  4509. var stringify3 = require_stringify2();
  4510. function ValueParser(value) {
  4511. if (this instanceof ValueParser) {
  4512. this.nodes = parse3(value);
  4513. return this;
  4514. }
  4515. return new ValueParser(value);
  4516. }
  4517. ValueParser.prototype.toString = function() {
  4518. return Array.isArray(this.nodes) ? stringify3(this.nodes) : "";
  4519. };
  4520. ValueParser.prototype.walk = function(cb, bubble) {
  4521. walk(this.nodes, cb, bubble);
  4522. return this;
  4523. };
  4524. ValueParser.unit = require_unit();
  4525. ValueParser.walk = walk;
  4526. ValueParser.stringify = stringify3;
  4527. module.exports = ValueParser;
  4528. }
  4529. });
  4530. // node_modules/postcss/lib/postcss.mjs
  4531. var import_postcss = __toESM(require_postcss(), 1);
  4532. var stringify = import_postcss.default.stringify;
  4533. var fromJSON = import_postcss.default.fromJSON;
  4534. var plugin = import_postcss.default.plugin;
  4535. var parse = import_postcss.default.parse;
  4536. var list = import_postcss.default.list;
  4537. var document = import_postcss.default.document;
  4538. var comment = import_postcss.default.comment;
  4539. var atRule = import_postcss.default.atRule;
  4540. var rule = import_postcss.default.rule;
  4541. var decl = import_postcss.default.decl;
  4542. var root = import_postcss.default.root;
  4543. var CssSyntaxError = import_postcss.default.CssSyntaxError;
  4544. var Declaration = import_postcss.default.Declaration;
  4545. var Container = import_postcss.default.Container;
  4546. var Processor = import_postcss.default.Processor;
  4547. var Document = import_postcss.default.Document;
  4548. var Comment = import_postcss.default.Comment;
  4549. var Warning = import_postcss.default.Warning;
  4550. var AtRule = import_postcss.default.AtRule;
  4551. var Result = import_postcss.default.Result;
  4552. var Input = import_postcss.default.Input;
  4553. var Rule = import_postcss.default.Rule;
  4554. var Root = import_postcss.default.Root;
  4555. var Node2 = import_postcss.default.Node;
  4556. // node_modules/dom-to-svg/lib/index.js
  4557. var import_postcss_value_parser4 = __toESM(require_lib(), 1);
  4558. // node_modules/dom-to-svg/lib/css.js
  4559. var isCSSFontFaceRule = (rule2) => rule2.type === CSSRule.FONT_FACE_RULE;
  4560. var isInline = (styles) => styles.displayOutside === "inline" || styles.display.startsWith("inline-");
  4561. var isPositioned = (styles) => styles.position !== "static";
  4562. var isInFlow = (styles) => styles.float !== "none" && styles.position !== "absolute" && styles.position !== "fixed";
  4563. var isTransparent = (color) => color === "transparent" || color === "rgba(0, 0, 0, 0)";
  4564. var hasUniformBorder = (styles) => parseFloat(styles.borderTopWidth) !== 0 && styles.borderTopStyle !== "none" && styles.borderTopStyle !== "inset" && styles.borderTopStyle !== "outset" && !isTransparent(styles.borderTopColor) && // Cannot use border property directly as in Firefox those are empty strings.
  4565. // Need to get the specific border properties from the specific sides.
  4566. // https://stackoverflow.com/questions/41696063/getcomputedstyle-returns-empty-strings-on-ff-when-instead-crome-returns-a-comp
  4567. styles.borderTopWidth === styles.borderLeftWidth && styles.borderTopWidth === styles.borderRightWidth && styles.borderTopWidth === styles.borderBottomWidth && styles.borderTopColor === styles.borderLeftColor && styles.borderTopColor === styles.borderRightColor && styles.borderTopColor === styles.borderBottomColor && styles.borderTopStyle === styles.borderLeftStyle && styles.borderTopStyle === styles.borderRightStyle && styles.borderTopStyle === styles.borderBottomStyle;
  4568. var SIDES = ["top", "bottom", "right", "left"];
  4569. var isHorizontal = (side) => side === "bottom" || side === "top";
  4570. var CORNERS = {
  4571. top: ["left", "right"],
  4572. bottom: ["left", "right"],
  4573. left: ["top", "bottom"],
  4574. right: ["top", "bottom"]
  4575. };
  4576. function getBorderRadiiForSide(side, styles, bounds) {
  4577. var _a, _b, _c, _d;
  4578. const [horizontalStyle1, verticalStyle1] = styles.getPropertyValue(isHorizontal(side) ? `border-${side}-${CORNERS[side][0]}-radius` : `border-${CORNERS[side][0]}-${side}-radius`).split(" ");
  4579. const [horizontalStyle2, verticalStyle2] = styles.getPropertyValue(isHorizontal(side) ? `border-${side}-${CORNERS[side][1]}-radius` : `border-${CORNERS[side][1]}-${side}-radius`).split(" ");
  4580. if (isHorizontal(side)) {
  4581. return [
  4582. (_a = parseCSSLength(horizontalStyle1 || "0px", bounds.width)) !== null && _a !== void 0 ? _a : 0,
  4583. (_b = parseCSSLength(horizontalStyle2 || "0px", bounds.width)) !== null && _b !== void 0 ? _b : 0
  4584. ];
  4585. }
  4586. return [
  4587. (_c = parseCSSLength(verticalStyle1 || horizontalStyle1 || "0px", bounds.height)) !== null && _c !== void 0 ? _c : 0,
  4588. (_d = parseCSSLength(verticalStyle2 || horizontalStyle2 || "0px", bounds.height)) !== null && _d !== void 0 ? _d : 0
  4589. ];
  4590. }
  4591. var calculateOverlappingCurvesFactor = (styles, bounds) => Math.min(...SIDES.map((side) => {
  4592. const length = isHorizontal(side) ? bounds.width : bounds.height;
  4593. const radiiSum = getBorderRadiiForSide(side, styles, bounds).reduce((sum, radius) => sum + radius, 0);
  4594. return length / radiiSum;
  4595. }), 1);
  4596. var isVisible = (styles) => styles.displayOutside !== "none" && styles.display !== "none" && styles.visibility !== "hidden" && styles.opacity !== "0";
  4597. function parseCSSLength(length, containerLength) {
  4598. if (length.endsWith("px")) {
  4599. return parseFloat(length);
  4600. }
  4601. if (length.endsWith("%")) {
  4602. return parseFloat(length) / 100 * containerLength;
  4603. }
  4604. return void 0;
  4605. }
  4606. var unescapeStringValue = (value) => value.replace(/\\([\da-f]{1,2})/gi, (substring, codePoint) => String.fromCodePoint(parseInt(codePoint, 16))).replace(/\\(.)/g, "$1");
  4607. function copyCssStyles(from, to) {
  4608. for (const property of from) {
  4609. to.setProperty(property, from.getPropertyValue(property), from.getPropertyPriority(property));
  4610. }
  4611. }
  4612. // node_modules/dom-to-svg/lib/dom.js
  4613. var svgNamespace = "http://www.w3.org/2000/svg";
  4614. var xlinkNamespace = "http://www.w3.org/1999/xlink";
  4615. var xhtmlNamespace = "http://www.w3.org/1999/xhtml";
  4616. var isElement = (node) => node.nodeType === Node.ELEMENT_NODE;
  4617. var isTextNode = (node) => node.nodeType === Node.TEXT_NODE;
  4618. var isSVGElement = (element) => element.namespaceURI === svgNamespace;
  4619. var isSVGSVGElement = (element) => isSVGElement(element) && element.tagName === "svg";
  4620. var isSVGGraphicsElement = (element) => isSVGElement(element) && "getCTM" in element && "getScreenCTM" in element;
  4621. var isSVGAnchorElement = (element) => isSVGElement(element) && element.tagName === "a";
  4622. var isSVGTextContentElement = (element) => isSVGElement(element) && "textLength" in element;
  4623. var isSVGImageElement = (element) => element.tagName === "image" && isSVGElement(element);
  4624. var isSVGStyleElement = (element) => element.tagName === "style" && isSVGElement(element);
  4625. var isHTMLElement = (element) => element.namespaceURI === xhtmlNamespace;
  4626. var isHTMLAnchorElement = (element) => element.tagName === "A" && isHTMLElement(element);
  4627. var isHTMLImageElement = (element) => element.tagName === "IMG" && isHTMLElement(element);
  4628. var isHTMLInputElement = (element) => element.tagName === "INPUT" && isHTMLElement(element);
  4629. var hasLabels = (element) => "labels" in element;
  4630. // node_modules/dom-to-svg/lib/stacking.js
  4631. var stackingContextEstablishingProperties = /* @__PURE__ */ new Set([
  4632. "clipPath",
  4633. "contain",
  4634. "filter",
  4635. "isolation",
  4636. "mask",
  4637. "maskBorder",
  4638. "maskImage",
  4639. "mixBlendMode",
  4640. "opacity",
  4641. "perspective",
  4642. "position",
  4643. "transform",
  4644. "webkitOverflowScrolling",
  4645. "zIndex"
  4646. ]);
  4647. function establishesStackingContext(styles, parentStyles) {
  4648. return !!((styles.position === "absolute" || styles.position === "relative") && styles.zIndex !== "auto" || styles.position === "fixed" || styles.position === "sticky" || parentStyles && (parentStyles.display === "flex" || parentStyles.display === "grid") && styles.zIndex !== "auto" || parseFloat(styles.opacity) !== 1 || styles.mixBlendMode !== "normal" || styles.transform !== "none" || styles.filter !== "none" || styles.perspective !== "none" || styles.clipPath !== "none" || styles.mask !== "none" || styles.maskImage !== "none" || styles.maskBorder !== "none" || styles.isolation === "isolate" || styles.webkitOverflowScrolling === "touch" || styles.contain === "layout" || styles.contain === "paint" || styles.contain === "strict" || styles.contain === "content" || styles.willChange.split(",").some((property) => stackingContextEstablishingProperties.has(property.trim())));
  4649. }
  4650. var STACKING_LAYER_NAMES = [
  4651. "rootBackgroundAndBorders",
  4652. "childStackingContextsWithNegativeStackLevels",
  4653. "inFlowNonInlineNonPositionedDescendants",
  4654. "nonPositionedFloats",
  4655. "inFlowInlineLevelNonPositionedDescendants",
  4656. "childStackingContextsWithStackLevelZeroAndPositionedDescendantsWithStackLevelZero",
  4657. "childStackingContextsWithPositiveStackLevels"
  4658. ];
  4659. function createStackingLayer(parent, layerName) {
  4660. const layer = parent.ownerDocument.createElementNS(svgNamespace, "g");
  4661. layer.dataset.stackingLayer = layerName;
  4662. parent.append(layer);
  4663. return layer;
  4664. }
  4665. function createStackingLayers(container) {
  4666. container.dataset.stackingContext = "true";
  4667. return {
  4668. rootBackgroundAndBorders: createStackingLayer(container, "rootBackgroundAndBorders"),
  4669. childStackingContextsWithNegativeStackLevels: createStackingLayer(container, "childStackingContextsWithNegativeStackLevels"),
  4670. inFlowNonInlineNonPositionedDescendants: createStackingLayer(container, "inFlowNonInlineNonPositionedDescendants"),
  4671. nonPositionedFloats: createStackingLayer(container, "nonPositionedFloats"),
  4672. inFlowInlineLevelNonPositionedDescendants: createStackingLayer(container, "inFlowInlineLevelNonPositionedDescendants"),
  4673. childStackingContextsWithStackLevelZeroAndPositionedDescendantsWithStackLevelZero: createStackingLayer(container, "childStackingContextsWithStackLevelZeroAndPositionedDescendantsWithStackLevelZero"),
  4674. childStackingContextsWithPositiveStackLevels: createStackingLayer(container, "childStackingContextsWithPositiveStackLevels")
  4675. };
  4676. }
  4677. function determineStackingLayer(styles, parentStyles) {
  4678. const zIndex = styles.zIndex !== "auto" ? parseInt(styles.zIndex, 10) : void 0;
  4679. if (zIndex !== void 0 && zIndex < 0 && establishesStackingContext(styles, parentStyles)) {
  4680. return "childStackingContextsWithNegativeStackLevels";
  4681. }
  4682. if (isInFlow(styles) && !isInline(styles) && !isPositioned(styles)) {
  4683. return "inFlowNonInlineNonPositionedDescendants";
  4684. }
  4685. if (!isPositioned(styles) && styles.float !== "none") {
  4686. return "nonPositionedFloats";
  4687. }
  4688. if (isInFlow(styles) && isInline(styles) && !isPositioned(styles)) {
  4689. return "inFlowInlineLevelNonPositionedDescendants";
  4690. }
  4691. if (zIndex === 0 && (isPositioned(styles) || establishesStackingContext(styles, parentStyles))) {
  4692. return "childStackingContextsWithStackLevelZeroAndPositionedDescendantsWithStackLevelZero";
  4693. }
  4694. if (zIndex !== void 0 && zIndex > 0 && establishesStackingContext(styles, parentStyles)) {
  4695. return "childStackingContextsWithPositiveStackLevels";
  4696. }
  4697. return void 0;
  4698. }
  4699. function sortChildrenByZIndex(parent) {
  4700. const sorted = [...parent.children].sort((a, b) => {
  4701. const zIndexA = a.dataset.zIndex;
  4702. const zIndexB = b.dataset.zIndex;
  4703. if (!zIndexA || !zIndexB) {
  4704. return 0;
  4705. }
  4706. return parseInt(zIndexA, 10) - parseInt(zIndexB, 10);
  4707. });
  4708. for (const child of sorted) {
  4709. parent.append(child);
  4710. }
  4711. }
  4712. function sortStackingLayerChildren(stackingLayers) {
  4713. sortChildrenByZIndex(stackingLayers.childStackingContextsWithNegativeStackLevels);
  4714. sortChildrenByZIndex(stackingLayers.childStackingContextsWithPositiveStackLevels);
  4715. }
  4716. function cleanupStackingLayerChildren(stackingLayers) {
  4717. for (const name of STACKING_LAYER_NAMES) {
  4718. const layer = stackingLayers[name];
  4719. if (!layer.hasChildNodes()) {
  4720. layer.remove();
  4721. }
  4722. }
  4723. }
  4724. // node_modules/dom-to-svg/lib/element.js
  4725. var import_postcss_value_parser2 = __toESM(require_lib(), 1);
  4726. // node_modules/dom-to-svg/lib/accessibility.js
  4727. var isStandaloneFooter = (element) => !element.closest('article, aside, main, nav, section, [role="article"], [role="complementary"], [role="main"], [role="navigation"], [role="region"]');
  4728. function getAccessibilityAttributes(element, { labels, getUniqueId }) {
  4729. var _a, _b, _c;
  4730. const attributes = /* @__PURE__ */ new Map();
  4731. switch (element.tagName) {
  4732. case "A":
  4733. attributes.set("role", "link");
  4734. break;
  4735. case "ARTICLE":
  4736. attributes.set("role", "article");
  4737. break;
  4738. case "ASIDE":
  4739. attributes.set("role", "complementary");
  4740. break;
  4741. case "BODY":
  4742. attributes.set("role", "document");
  4743. break;
  4744. case "BUTTON":
  4745. case "SUMMARY":
  4746. attributes.set("role", "button");
  4747. break;
  4748. case "DD":
  4749. attributes.set("role", "definition");
  4750. break;
  4751. case "DETAILS":
  4752. attributes.set("role", "group");
  4753. break;
  4754. case "DFN":
  4755. attributes.set("role", "term");
  4756. break;
  4757. case "DIALOG":
  4758. attributes.set("role", "dialog");
  4759. break;
  4760. case "DT":
  4761. attributes.set("role", "term");
  4762. break;
  4763. case "FIELDSET":
  4764. attributes.set("role", "group");
  4765. break;
  4766. case "FIGURE":
  4767. attributes.set("role", "figure");
  4768. break;
  4769. case "FOOTER":
  4770. if (isStandaloneFooter(element)) {
  4771. attributes.set("role", "contentinfo");
  4772. }
  4773. break;
  4774. case "FORM":
  4775. attributes.set("role", "form");
  4776. break;
  4777. case "H1":
  4778. case "H2":
  4779. case "H3":
  4780. case "H4":
  4781. case "H5":
  4782. case "H6":
  4783. attributes.set("role", "heading");
  4784. attributes.set("aria-level", element.tagName.slice(1));
  4785. break;
  4786. case "HEADER":
  4787. if (isStandaloneFooter(element)) {
  4788. attributes.set("role", "banner");
  4789. }
  4790. break;
  4791. case "HR":
  4792. attributes.set("role", "separator");
  4793. break;
  4794. case "IMG": {
  4795. const alt = element.getAttribute("alt");
  4796. if (alt === null || alt !== "") {
  4797. attributes.set("role", "img");
  4798. if (alt) {
  4799. attributes.set("aria-label", alt);
  4800. }
  4801. }
  4802. break;
  4803. }
  4804. case "INPUT":
  4805. switch (element.type) {
  4806. case "button":
  4807. case "image":
  4808. case "reset":
  4809. case "submit":
  4810. attributes.set("role", "button");
  4811. break;
  4812. case "number":
  4813. attributes.set("role", "spinbutton");
  4814. break;
  4815. case "range":
  4816. attributes.set("role", "slider");
  4817. break;
  4818. case "checkbox":
  4819. attributes.set("role", "checkbox");
  4820. break;
  4821. case "radio":
  4822. attributes.set("role", "radio");
  4823. break;
  4824. case "email":
  4825. case "tel":
  4826. if (!element.hasAttribute("list")) {
  4827. attributes.set("role", "textbox");
  4828. }
  4829. break;
  4830. }
  4831. break;
  4832. case "LI":
  4833. if (((_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === "OL" || ((_b = element.parentElement) === null || _b === void 0 ? void 0 : _b.tagName) === "UL" || ((_c = element.parentElement) === null || _c === void 0 ? void 0 : _c.tagName) === "MENU") {
  4834. attributes.set("role", "listitem");
  4835. }
  4836. break;
  4837. case "LINK":
  4838. if (element.href) {
  4839. attributes.set("role", "link");
  4840. }
  4841. break;
  4842. case "MAIN":
  4843. attributes.set("role", "main");
  4844. break;
  4845. case "MATH":
  4846. attributes.set("role", "math");
  4847. break;
  4848. case "OL":
  4849. case "UL":
  4850. case "MENU":
  4851. attributes.set("role", "list");
  4852. break;
  4853. case "NAV":
  4854. attributes.set("role", "navigation");
  4855. break;
  4856. case "OPTION":
  4857. attributes.set("role", "option");
  4858. break;
  4859. case "PROGRESS":
  4860. attributes.set("role", "progressbar");
  4861. break;
  4862. case "SECTION":
  4863. attributes.set("role", "region");
  4864. break;
  4865. case "SELECT":
  4866. attributes.set("role", !element.hasAttribute("multiple") && element.size <= 1 ? "combobox" : "listbox");
  4867. break;
  4868. case "TABLE":
  4869. attributes.set("role", "table");
  4870. break;
  4871. case "THEAD":
  4872. case "TBODY":
  4873. case "TFOOT":
  4874. attributes.set("role", "rowgroup");
  4875. break;
  4876. case "TEXTAREA":
  4877. attributes.set("role", "textbox");
  4878. break;
  4879. case "TD":
  4880. attributes.set("role", "cell");
  4881. break;
  4882. case "TH":
  4883. attributes.set("role", element.closest("thead") ? "columnheader" : "rowheader");
  4884. break;
  4885. case "TR":
  4886. attributes.set("role", "tablerow");
  4887. break;
  4888. }
  4889. if (element.hasAttribute("disabled")) {
  4890. attributes.set("aria-disabled", "true");
  4891. }
  4892. if (element.hasAttribute("placeholder")) {
  4893. attributes.set("aria-placeholder", element.getAttribute("placeholder") || "");
  4894. }
  4895. const tabIndex = element.getAttribute("tabindex");
  4896. if (tabIndex) {
  4897. attributes.set("tabindex", tabIndex);
  4898. }
  4899. if (isHTMLElement(element) && hasLabels(element) && element.labels) {
  4900. attributes.set("aria-labelledby", [...element.labels].map((label) => {
  4901. let labelId = label.id || labels.get(label);
  4902. if (!labelId) {
  4903. labelId = getUniqueId("label");
  4904. labels.set(label, labelId);
  4905. }
  4906. return labelId;
  4907. }).join(" "));
  4908. }
  4909. for (const attribute of element.attributes) {
  4910. if (attribute.name.startsWith("aria-")) {
  4911. attributes.set(attribute.name, attribute.value);
  4912. }
  4913. }
  4914. const customRole = element.getAttribute("role");
  4915. if (customRole) {
  4916. attributes.set("role", customRole);
  4917. }
  4918. return attributes;
  4919. }
  4920. // node_modules/gradient-parser/build/esm.mjs
  4921. var GradientParser = GradientParser || {};
  4922. GradientParser.stringify = /* @__PURE__ */ (function() {
  4923. var visitor = {
  4924. "visit_linear-gradient": function(node) {
  4925. return visitor.visit_gradient(node);
  4926. },
  4927. "visit_repeating-linear-gradient": function(node) {
  4928. return visitor.visit_gradient(node);
  4929. },
  4930. "visit_radial-gradient": function(node) {
  4931. return visitor.visit_gradient(node);
  4932. },
  4933. "visit_repeating-radial-gradient": function(node) {
  4934. return visitor.visit_gradient(node);
  4935. },
  4936. "visit_conic-gradient": function(node) {
  4937. return visitor.visit_gradient(node);
  4938. },
  4939. "visit_repeating-conic-gradient": function(node) {
  4940. return visitor.visit_gradient(node);
  4941. },
  4942. "visit_gradient": function(node) {
  4943. var orientation = visitor.visit(node.orientation);
  4944. if (orientation) {
  4945. orientation += ", ";
  4946. }
  4947. return node.type + "(" + orientation + visitor.visit(node.colorStops) + ")";
  4948. },
  4949. "visit_shape": function(node) {
  4950. var result = node.value, at = visitor.visit(node.at), style = visitor.visit(node.style);
  4951. if (style) {
  4952. result += " " + style;
  4953. }
  4954. if (at) {
  4955. result += " at " + at;
  4956. }
  4957. return result;
  4958. },
  4959. "visit_default-radial": function(node) {
  4960. var result = "", at = visitor.visit(node.at);
  4961. if (at) {
  4962. if (node.hasAtKeyword) {
  4963. result += "at " + at;
  4964. } else {
  4965. result += at;
  4966. }
  4967. }
  4968. return result;
  4969. },
  4970. "visit_extent-keyword": function(node) {
  4971. var result = node.value, at = visitor.visit(node.at);
  4972. if (at) {
  4973. result += " at " + at;
  4974. }
  4975. return result;
  4976. },
  4977. "visit_position-keyword": function(node) {
  4978. return node.value;
  4979. },
  4980. "visit_position": function(node) {
  4981. return visitor.visit(node.value.x) + " " + visitor.visit(node.value.y);
  4982. },
  4983. "visit_%": function(node) {
  4984. return node.value + "%";
  4985. },
  4986. "visit_em": function(node) {
  4987. return node.value + "em";
  4988. },
  4989. "visit_px": function(node) {
  4990. return node.value + "px";
  4991. },
  4992. "visit_rem": function(node) {
  4993. return node.value + "rem";
  4994. },
  4995. "visit_vw": function(node) {
  4996. return node.value + "vw";
  4997. },
  4998. "visit_vh": function(node) {
  4999. return node.value + "vh";
  5000. },
  5001. "visit_vmin": function(node) {
  5002. return node.value + "vmin";
  5003. },
  5004. "visit_vmax": function(node) {
  5005. return node.value + "vmax";
  5006. },
  5007. "visit_ch": function(node) {
  5008. return node.value + "ch";
  5009. },
  5010. "visit_ex": function(node) {
  5011. return node.value + "ex";
  5012. },
  5013. "visit_calc": function(node) {
  5014. return "calc(" + node.value + ")";
  5015. },
  5016. "visit_literal": function(node) {
  5017. return visitor.visit_color(node.value, node);
  5018. },
  5019. "visit_hex": function(node) {
  5020. return visitor.visit_color("#" + node.value, node);
  5021. },
  5022. "visit_rgb": function(node) {
  5023. return visitor.visit_color("rgb(" + node.value.join(", ") + ")", node);
  5024. },
  5025. "visit_rgba": function(node) {
  5026. return visitor.visit_color("rgba(" + node.value.join(", ") + ")", node);
  5027. },
  5028. "visit_hsl": function(node) {
  5029. return visitor.visit_color("hsl(" + node.value[0] + ", " + node.value[1] + "%, " + node.value[2] + "%)", node);
  5030. },
  5031. "visit_hsla": function(node) {
  5032. return visitor.visit_color("hsla(" + node.value[0] + ", " + node.value[1] + "%, " + node.value[2] + "%, " + node.value[3] + ")", node);
  5033. },
  5034. "visit_var": function(node) {
  5035. return visitor.visit_color("var(" + node.value + ")", node);
  5036. },
  5037. "visit_color": function(resultColor, node) {
  5038. var result = resultColor, length = visitor.visit(node.length);
  5039. if (length) {
  5040. result += " " + length;
  5041. }
  5042. var length2 = visitor.visit(node.length2);
  5043. if (length2) {
  5044. result += " " + length2;
  5045. }
  5046. return result;
  5047. },
  5048. "visit_angular": function(node) {
  5049. return node.value + (node.unit || "deg");
  5050. },
  5051. "visit_directional": function(node) {
  5052. return "to " + node.value;
  5053. },
  5054. "visit_conic": function(node) {
  5055. var result = "";
  5056. if (node.angle) {
  5057. result += "from " + visitor.visit(node.angle);
  5058. }
  5059. if (node.at) {
  5060. if (result) {
  5061. result += " ";
  5062. }
  5063. result += "at " + visitor.visit(node.at);
  5064. }
  5065. return result;
  5066. },
  5067. "visit_array": function(elements) {
  5068. var result = "", size = elements.length;
  5069. elements.forEach(function(element, i) {
  5070. result += visitor.visit(element);
  5071. if (i < size - 1) {
  5072. result += ", ";
  5073. }
  5074. });
  5075. return result;
  5076. },
  5077. "visit_object": function(obj) {
  5078. if (obj.width && obj.height) {
  5079. return visitor.visit(obj.width) + " " + visitor.visit(obj.height);
  5080. }
  5081. return "";
  5082. },
  5083. "visit": function(element) {
  5084. if (!element) {
  5085. return "";
  5086. }
  5087. var result = "";
  5088. if (element instanceof Array) {
  5089. return visitor.visit_array(element);
  5090. } else if (typeof element === "object" && !element.type) {
  5091. return visitor.visit_object(element);
  5092. } else if (element.type) {
  5093. var nodeVisitor = visitor["visit_" + element.type];
  5094. if (nodeVisitor) {
  5095. return nodeVisitor(element);
  5096. } else {
  5097. throw Error("Missing visitor visit_" + element.type);
  5098. }
  5099. } else {
  5100. throw Error("Invalid node.");
  5101. }
  5102. }
  5103. };
  5104. return function(root2) {
  5105. return visitor.visit(root2);
  5106. };
  5107. })();
  5108. var GradientParser = GradientParser || {};
  5109. GradientParser.parse = /* @__PURE__ */ (function() {
  5110. var tokens = {
  5111. linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
  5112. repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
  5113. radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
  5114. repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
  5115. conicGradient: /^(\-(webkit|o|ms|moz)\-)?(conic\-gradient)/i,
  5116. repeatingConicGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-conic\-gradient)/i,
  5117. sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
  5118. extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
  5119. positionKeywords: /^(left|center|right|top|bottom)/i,
  5120. pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
  5121. percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
  5122. emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
  5123. remValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rem/,
  5124. vwValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))vw/,
  5125. vhValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))vh/,
  5126. vminValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))vmin/,
  5127. vmaxValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))vmax/,
  5128. chValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))ch/,
  5129. exValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))ex/,
  5130. angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
  5131. radianValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rad/,
  5132. gradianValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))grad/,
  5133. turnValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))turn/,
  5134. startCall: /^\(/,
  5135. endCall: /^\)/,
  5136. comma: /^,/,
  5137. slash: /^\//,
  5138. hexColor: /^\#([0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{4}|[0-9a-fA-F]{3})(?![0-9a-fA-F])/,
  5139. literalColor: /^([a-zA-Z]+)/,
  5140. rgbColor: /^rgb/i,
  5141. rgbaColor: /^rgba/i,
  5142. varColor: /^var/i,
  5143. calcValue: /^calc/i,
  5144. variableName: /^(--[a-zA-Z0-9-,\s\#]+)/,
  5145. number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,
  5146. hslColor: /^hsl/i,
  5147. hslaColor: /^hsla/i
  5148. };
  5149. var input = "";
  5150. function error(msg) {
  5151. var err = new Error(input + ": " + msg);
  5152. err.source = input;
  5153. throw err;
  5154. }
  5155. function getAST() {
  5156. var ast = matchListDefinitions();
  5157. if (input.length > 0) {
  5158. error("Invalid input not EOF");
  5159. }
  5160. return ast;
  5161. }
  5162. function matchListDefinitions() {
  5163. return matchListing(matchDefinition);
  5164. }
  5165. function matchDefinition() {
  5166. return matchGradient(
  5167. "linear-gradient",
  5168. tokens.linearGradient,
  5169. matchLinearOrientation
  5170. ) || matchGradient(
  5171. "repeating-linear-gradient",
  5172. tokens.repeatingLinearGradient,
  5173. matchLinearOrientation
  5174. ) || matchGradient(
  5175. "radial-gradient",
  5176. tokens.radialGradient,
  5177. matchListRadialOrientations
  5178. ) || matchGradient(
  5179. "repeating-radial-gradient",
  5180. tokens.repeatingRadialGradient,
  5181. matchListRadialOrientations
  5182. ) || matchGradient(
  5183. "conic-gradient",
  5184. tokens.conicGradient,
  5185. matchConicOrientation
  5186. ) || matchGradient(
  5187. "repeating-conic-gradient",
  5188. tokens.repeatingConicGradient,
  5189. matchConicOrientation
  5190. );
  5191. }
  5192. function matchGradient(gradientType, pattern, orientationMatcher) {
  5193. return matchCall(pattern, function(captures) {
  5194. var orientation = orientationMatcher();
  5195. if (orientation) {
  5196. if (!scan(tokens.comma)) {
  5197. error("Missing comma before color stops");
  5198. }
  5199. }
  5200. return {
  5201. type: gradientType,
  5202. orientation,
  5203. colorStops: matchListing(matchColorStop)
  5204. };
  5205. });
  5206. }
  5207. function matchCall(pattern, callback) {
  5208. var captures = scan(pattern);
  5209. if (captures) {
  5210. if (!scan(tokens.startCall)) {
  5211. error("Missing (");
  5212. }
  5213. var result = callback(captures);
  5214. if (!scan(tokens.endCall)) {
  5215. error("Missing )");
  5216. }
  5217. return result;
  5218. }
  5219. }
  5220. function matchLinearOrientation() {
  5221. var sideOrCorner = matchSideOrCorner();
  5222. if (sideOrCorner) {
  5223. return sideOrCorner;
  5224. }
  5225. var legacyDirection = match("position-keyword", tokens.positionKeywords, 1);
  5226. if (legacyDirection) {
  5227. return {
  5228. type: "directional",
  5229. value: legacyDirection.value
  5230. };
  5231. }
  5232. return matchAngle();
  5233. }
  5234. function matchConicOrientation() {
  5235. var angle = matchFrom();
  5236. var atPosition = matchAtPosition();
  5237. if (angle || atPosition) {
  5238. return {
  5239. type: "conic",
  5240. angle: angle || void 0,
  5241. at: atPosition || void 0
  5242. };
  5243. }
  5244. }
  5245. function matchFrom() {
  5246. if (match("from", /^from/, 0)) {
  5247. var angle = matchAngle();
  5248. if (!angle) {
  5249. error('Missing angle after "from" in conic-gradient');
  5250. }
  5251. return angle;
  5252. }
  5253. }
  5254. function matchSideOrCorner() {
  5255. return match("directional", tokens.sideOrCorner, 1);
  5256. }
  5257. function matchAngle() {
  5258. return matchAngularWithUnit("deg", tokens.angleValue) || matchAngularWithUnit("rad", tokens.radianValue) || matchAngularWithUnit("grad", tokens.gradianValue) || matchAngularWithUnit("turn", tokens.turnValue);
  5259. }
  5260. function matchAngularWithUnit(unit, pattern) {
  5261. var captures = scan(pattern);
  5262. if (captures) {
  5263. return {
  5264. type: "angular",
  5265. value: captures[1],
  5266. unit
  5267. };
  5268. }
  5269. }
  5270. function matchListRadialOrientations() {
  5271. var radialOrientations, radialOrientation = matchRadialOrientation(), lookaheadCache;
  5272. if (radialOrientation) {
  5273. radialOrientations = [];
  5274. radialOrientations.push(radialOrientation);
  5275. lookaheadCache = input;
  5276. if (scan(tokens.comma)) {
  5277. radialOrientation = matchRadialOrientation();
  5278. if (radialOrientation) {
  5279. radialOrientations.push(radialOrientation);
  5280. } else {
  5281. input = lookaheadCache;
  5282. }
  5283. }
  5284. }
  5285. return radialOrientations;
  5286. }
  5287. function matchRadialOrientation() {
  5288. var radialType = matchCircle() || matchEllipse();
  5289. if (radialType) {
  5290. radialType.at = matchAtPosition();
  5291. } else {
  5292. var extent = matchExtentKeyword();
  5293. if (extent) {
  5294. radialType = extent;
  5295. var positionAt = matchAtPosition();
  5296. if (positionAt) {
  5297. radialType.at = positionAt;
  5298. }
  5299. } else {
  5300. var atPosition = matchAtPosition();
  5301. if (atPosition) {
  5302. radialType = {
  5303. type: "default-radial",
  5304. at: atPosition,
  5305. hasAtKeyword: true
  5306. };
  5307. } else {
  5308. var defaultPosition = matchPositioning();
  5309. if (defaultPosition) {
  5310. radialType = {
  5311. type: "default-radial",
  5312. at: defaultPosition
  5313. };
  5314. }
  5315. }
  5316. }
  5317. }
  5318. return radialType;
  5319. }
  5320. function matchCircle() {
  5321. var circle = match("shape", /^(circle)/i, 0);
  5322. if (circle) {
  5323. circle.style = matchLength() || matchExtentKeyword();
  5324. }
  5325. return circle;
  5326. }
  5327. function matchEllipse() {
  5328. var ellipse = match("shape", /^(ellipse)/i, 0);
  5329. if (ellipse) {
  5330. ellipse.style = matchPositioning() || matchDistance() || matchExtentKeyword();
  5331. }
  5332. return ellipse;
  5333. }
  5334. function matchExtentKeyword() {
  5335. return match("extent-keyword", tokens.extentKeywords, 1);
  5336. }
  5337. function matchAtPosition() {
  5338. if (match("position", /^at/, 0)) {
  5339. var positioning = matchPositioning();
  5340. if (!positioning) {
  5341. error("Missing positioning value");
  5342. }
  5343. return positioning;
  5344. }
  5345. }
  5346. function matchPositioning() {
  5347. var location = matchCoordinates();
  5348. if (location.x || location.y) {
  5349. return {
  5350. type: "position",
  5351. value: location
  5352. };
  5353. }
  5354. }
  5355. function matchCoordinates() {
  5356. return {
  5357. x: matchDistance(),
  5358. y: matchDistance()
  5359. };
  5360. }
  5361. function matchListing(matcher) {
  5362. var captures = matcher(), result = [];
  5363. if (captures) {
  5364. result.push(captures);
  5365. while (scan(tokens.comma)) {
  5366. captures = matcher();
  5367. if (captures) {
  5368. result.push(captures);
  5369. } else {
  5370. error("One extra comma");
  5371. }
  5372. }
  5373. }
  5374. return result;
  5375. }
  5376. function matchColorStop() {
  5377. var color = matchColor();
  5378. if (!color) {
  5379. error("Expected color definition");
  5380. }
  5381. color.length = matchDistance();
  5382. if (color.length) {
  5383. color.length2 = matchDistance();
  5384. }
  5385. return color;
  5386. }
  5387. function matchColor() {
  5388. return matchHexColor() || matchHSLAColor() || matchHSLColor() || matchRGBAColor() || matchRGBColor() || matchVarColor() || matchLiteralColor();
  5389. }
  5390. function matchLiteralColor() {
  5391. return match("literal", tokens.literalColor, 0);
  5392. }
  5393. function matchHexColor() {
  5394. return match("hex", tokens.hexColor, 1);
  5395. }
  5396. function matchRGBColor() {
  5397. return matchCall(tokens.rgbColor, function() {
  5398. return matchRGBValues("rgb");
  5399. });
  5400. }
  5401. function matchRGBAColor() {
  5402. return matchCall(tokens.rgbaColor, function() {
  5403. return matchRGBValues("rgba");
  5404. });
  5405. }
  5406. function matchRGBValues(baseType) {
  5407. var r = matchNumber();
  5408. if (scan(tokens.comma)) {
  5409. var g = matchNumber();
  5410. scan(tokens.comma);
  5411. var b = matchNumber();
  5412. var values = [r, g, b];
  5413. if (scan(tokens.comma)) {
  5414. values.push(matchNumber());
  5415. return { type: "rgba", value: values };
  5416. }
  5417. return { type: baseType, value: values };
  5418. } else {
  5419. var g = matchNumber();
  5420. var b = matchNumber();
  5421. var values = [r, g, b];
  5422. if (scan(tokens.slash)) {
  5423. values.push(matchNumber());
  5424. return { type: "rgba", value: values };
  5425. }
  5426. return { type: baseType, value: values };
  5427. }
  5428. }
  5429. function matchVarColor() {
  5430. return matchCall(tokens.varColor, function() {
  5431. return {
  5432. type: "var",
  5433. value: matchVariableName()
  5434. };
  5435. });
  5436. }
  5437. function matchHSLColor() {
  5438. return matchCall(tokens.hslColor, function() {
  5439. return matchHSLValues("hsl");
  5440. });
  5441. }
  5442. function matchHSLAColor() {
  5443. return matchCall(tokens.hslaColor, function() {
  5444. return matchHSLValues("hsla");
  5445. });
  5446. }
  5447. function matchHSLValues(baseType) {
  5448. var lookahead = scan(tokens.percentageValue);
  5449. if (lookahead) {
  5450. error("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");
  5451. }
  5452. var hue = matchNumber();
  5453. if (scan(tokens.comma)) {
  5454. var captures = scan(tokens.percentageValue);
  5455. var sat = captures ? captures[1] : null;
  5456. scan(tokens.comma);
  5457. captures = scan(tokens.percentageValue);
  5458. var light = captures ? captures[1] : null;
  5459. if (!sat || !light) {
  5460. error("Expected percentage value for saturation and lightness in HSL");
  5461. }
  5462. if (scan(tokens.comma)) {
  5463. var alpha = matchNumber();
  5464. return { type: "hsla", value: [hue, sat, light, alpha] };
  5465. }
  5466. return { type: baseType, value: [hue, sat, light] };
  5467. } else {
  5468. var captures = scan(tokens.percentageValue);
  5469. var sat = captures ? captures[1] : null;
  5470. captures = scan(tokens.percentageValue);
  5471. var light = captures ? captures[1] : null;
  5472. if (!sat || !light) {
  5473. error("Expected percentage value for saturation and lightness in HSL");
  5474. }
  5475. if (scan(tokens.slash)) {
  5476. var alpha = matchNumber();
  5477. return { type: "hsla", value: [hue, sat, light, alpha] };
  5478. }
  5479. return { type: baseType, value: [hue, sat, light] };
  5480. }
  5481. }
  5482. function matchPercentage() {
  5483. var captures = scan(tokens.percentageValue);
  5484. return captures ? captures[1] : null;
  5485. }
  5486. function matchVariableName() {
  5487. return scan(tokens.variableName)[1];
  5488. }
  5489. function matchNumber() {
  5490. return scan(tokens.number)[1];
  5491. }
  5492. function matchDistance() {
  5493. return match("%", tokens.percentageValue, 1) || matchPositionKeyword() || matchCalc() || matchLength();
  5494. }
  5495. function matchPositionKeyword() {
  5496. return match("position-keyword", tokens.positionKeywords, 1);
  5497. }
  5498. function matchCalc() {
  5499. return matchCall(tokens.calcValue, function() {
  5500. var openParenCount = 1;
  5501. var i = 0;
  5502. while (openParenCount > 0 && i < input.length) {
  5503. var char = input.charAt(i);
  5504. if (char === "(") {
  5505. openParenCount++;
  5506. } else if (char === ")") {
  5507. openParenCount--;
  5508. }
  5509. i++;
  5510. }
  5511. if (openParenCount > 0) {
  5512. error("Missing closing parenthesis in calc() expression");
  5513. }
  5514. var calcContent = input.substring(0, i - 1);
  5515. consume(i - 1);
  5516. return {
  5517. type: "calc",
  5518. value: calcContent
  5519. };
  5520. });
  5521. }
  5522. function matchLength() {
  5523. return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1) || match("rem", tokens.remValue, 1) || match("vw", tokens.vwValue, 1) || match("vh", tokens.vhValue, 1) || match("vmin", tokens.vminValue, 1) || match("vmax", tokens.vmaxValue, 1) || match("ch", tokens.chValue, 1) || match("ex", tokens.exValue, 1);
  5524. }
  5525. function match(type, pattern, captureIndex) {
  5526. var captures = scan(pattern);
  5527. if (captures) {
  5528. return {
  5529. type,
  5530. value: captures[captureIndex]
  5531. };
  5532. }
  5533. }
  5534. function scan(regexp) {
  5535. var captures, blankCaptures;
  5536. blankCaptures = /^[\n\r\t\s]+/.exec(input);
  5537. if (blankCaptures) {
  5538. consume(blankCaptures[0].length);
  5539. }
  5540. captures = regexp.exec(input);
  5541. if (captures) {
  5542. consume(captures[0].length);
  5543. }
  5544. return captures;
  5545. }
  5546. function consume(size) {
  5547. input = input.substring(size);
  5548. }
  5549. return function(code) {
  5550. input = code.toString().trim();
  5551. if (input.endsWith(";")) {
  5552. input = input.slice(0, -1);
  5553. }
  5554. return getAST();
  5555. };
  5556. })();
  5557. var parse2 = GradientParser.parse;
  5558. var stringify2 = GradientParser.stringify;
  5559. var esm_default = { parse: GradientParser.parse, stringify: GradientParser.stringify };
  5560. // node_modules/dom-to-svg/lib/gradients.js
  5561. var positionsForOrientation = (orientation) => {
  5562. const positions = {
  5563. x1: "0%",
  5564. x2: "0%",
  5565. y1: "0%",
  5566. y2: "0%"
  5567. };
  5568. if ((orientation === null || orientation === void 0 ? void 0 : orientation.type) === "angular") {
  5569. const anglePI = orientation.value * (Math.PI / 180);
  5570. positions.x1 = `${Math.round(50 + Math.sin(anglePI + Math.PI) * 50)}%`;
  5571. positions.y1 = `${Math.round(50 + Math.cos(anglePI) * 50)}%`;
  5572. positions.x2 = `${Math.round(50 + Math.sin(anglePI) * 50)}%`;
  5573. positions.y2 = `${Math.round(50 + Math.cos(anglePI + Math.PI) * 50)}%`;
  5574. } else if ((orientation === null || orientation === void 0 ? void 0 : orientation.type) === "directional") {
  5575. switch (orientation.value) {
  5576. case "left":
  5577. positions.x1 = "100%";
  5578. break;
  5579. case "top":
  5580. positions.y1 = "100%";
  5581. break;
  5582. case "right":
  5583. positions.x2 = "100%";
  5584. break;
  5585. case "bottom":
  5586. positions.y2 = "100%";
  5587. break;
  5588. }
  5589. }
  5590. return positions;
  5591. };
  5592. function convertLinearGradient(css, { svgDocument }) {
  5593. const { orientation, colorStops } = parse2(css)[0];
  5594. const { x1, x2, y1, y2 } = positionsForOrientation(orientation);
  5595. const getColorStops = (colorStop, index) => {
  5596. const offset = `${index / (colorStops.length - 1) * 100}%`;
  5597. let stopColor = "rgb(0,0,0)";
  5598. let stopOpacity = 1;
  5599. switch (colorStop.type) {
  5600. case "rgb": {
  5601. const [red, green, blue] = colorStop.value;
  5602. stopColor = `rgb(${red},${green},${blue})`;
  5603. break;
  5604. }
  5605. case "rgba": {
  5606. const [red, green, blue, alpha] = colorStop.value;
  5607. stopColor = `rgb(${red},${green},${blue})`;
  5608. stopOpacity = alpha;
  5609. break;
  5610. }
  5611. case "hex": {
  5612. stopColor = `#${colorStop.value}`;
  5613. break;
  5614. }
  5615. case "literal": {
  5616. stopColor = colorStop.value;
  5617. break;
  5618. }
  5619. }
  5620. const stop = svgDocument.createElementNS(svgNamespace, "stop");
  5621. stop.setAttribute("offset", offset);
  5622. stop.setAttribute("stop-color", stopColor);
  5623. stop.setAttribute("stop-opacity", stopOpacity.toString());
  5624. return stop;
  5625. };
  5626. const linearGradient = svgDocument.createElementNS(svgNamespace, "linearGradient");
  5627. linearGradient.setAttribute("x1", x1);
  5628. linearGradient.setAttribute("y1", y1);
  5629. linearGradient.setAttribute("x2", x2);
  5630. linearGradient.setAttribute("y2", y2);
  5631. linearGradient.append(...colorStops.map(getColorStops));
  5632. return linearGradient;
  5633. }
  5634. // node_modules/dom-to-svg/lib/svg.js
  5635. var import_postcss_value_parser = __toESM(require_lib(), 1);
  5636. // node_modules/dom-to-svg/lib/util.js
  5637. var createIdGenerator = () => {
  5638. const nextCounts = /* @__PURE__ */ new Map();
  5639. return (prefix) => {
  5640. var _a;
  5641. const count = (_a = nextCounts.get(prefix)) !== null && _a !== void 0 ? _a : 1;
  5642. nextCounts.set(prefix, count + 1);
  5643. return `${prefix}${count}`;
  5644. };
  5645. };
  5646. var doRectanglesIntersect = (a, b) => !(a.bottom < b.top || // A is above B
  5647. a.top > b.bottom || // A is below B
  5648. a.right < b.left || // A is left of B
  5649. // A is right of B
  5650. a.left > b.right);
  5651. function diagonale(box) {
  5652. return Math.sqrt(box.width ** 2 + box.height ** 2);
  5653. }
  5654. function withTimeout(timeout, message, func) {
  5655. return Promise.race([
  5656. func(),
  5657. new Promise((resolve, reject) => setTimeout(() => reject(new Error(message)), timeout))
  5658. ]);
  5659. }
  5660. var isTaggedUnionMember = (key, value) => (object) => object[key] === value;
  5661. function assert(condition, message) {
  5662. if (!condition) {
  5663. throw new Error(message);
  5664. }
  5665. }
  5666. // node_modules/dom-to-svg/lib/text.js
  5667. function handleTextNode(textNode, context) {
  5668. if (!textNode.ownerDocument.defaultView) {
  5669. throw new Error("Element's ownerDocument has no defaultView");
  5670. }
  5671. const window2 = textNode.ownerDocument.defaultView;
  5672. const parentElement = textNode.parentElement;
  5673. const styles = window2.getComputedStyle(parentElement);
  5674. if (!isVisible(styles)) {
  5675. return;
  5676. }
  5677. const selection = window2.getSelection();
  5678. assert(selection, "Could not obtain selection from window. Selection is needed for detecting whitespace collapsing in text.");
  5679. const svgTextElement = context.svgDocument.createElementNS(svgNamespace, "text");
  5680. copyTextStyles(styles, svgTextElement);
  5681. const tabSize = parseInt(styles.tabSize, 10);
  5682. svgTextElement.setAttribute("dominant-baseline", "text-after-edge");
  5683. const lineRange = textNode.ownerDocument.createRange();
  5684. lineRange.setStart(textNode, 0);
  5685. lineRange.setEnd(textNode, 0);
  5686. while (true) {
  5687. const addTextSpanForLineRange = () => {
  5688. if (lineRange.collapsed) {
  5689. return;
  5690. }
  5691. const lineRectangle = lineRange.getClientRects()[0];
  5692. if (!doRectanglesIntersect(lineRectangle, context.options.captureArea)) {
  5693. return;
  5694. }
  5695. const textSpan = context.svgDocument.createElementNS(svgNamespace, "tspan");
  5696. textSpan.setAttribute("xml:space", "preserve");
  5697. const previousUserSelect = parentElement.style.userSelect;
  5698. parentElement.style.userSelect = "all";
  5699. try {
  5700. selection.removeAllRanges();
  5701. selection.addRange(lineRange);
  5702. textSpan.textContent = selection.toString().replace(/\t/g, " ".repeat(tabSize));
  5703. } finally {
  5704. parentElement.style.userSelect = previousUserSelect;
  5705. selection.removeAllRanges();
  5706. }
  5707. textSpan.setAttribute("x", lineRectangle.x.toString());
  5708. textSpan.setAttribute("y", lineRectangle.bottom.toString());
  5709. textSpan.setAttribute("textLength", lineRectangle.width.toString());
  5710. textSpan.setAttribute("lengthAdjust", "spacingAndGlyphs");
  5711. svgTextElement.append(textSpan);
  5712. };
  5713. try {
  5714. lineRange.setEnd(textNode, lineRange.endOffset + 1);
  5715. } catch (error) {
  5716. if (error.code === DOMException.INDEX_SIZE_ERR) {
  5717. addTextSpanForLineRange();
  5718. break;
  5719. }
  5720. throw error;
  5721. }
  5722. const lineRectangles = lineRange.getClientRects();
  5723. if (!lineRectangles[0]) {
  5724. return;
  5725. }
  5726. if (lineRectangles[1] && lineRectangles[0].top !== lineRectangles[1].top) {
  5727. lineRange.setEnd(textNode, lineRange.endOffset - 1);
  5728. addTextSpanForLineRange();
  5729. lineRange.setStart(textNode, lineRange.endOffset);
  5730. }
  5731. }
  5732. context.currentSvgParent.append(svgTextElement);
  5733. }
  5734. var textAttributes = /* @__PURE__ */ new Set([
  5735. "color",
  5736. "dominant-baseline",
  5737. "font-family",
  5738. "font-size",
  5739. "font-size-adjust",
  5740. "font-stretch",
  5741. "font-style",
  5742. "font-variant",
  5743. "font-weight",
  5744. "direction",
  5745. "letter-spacing",
  5746. "text-decoration",
  5747. "text-anchor",
  5748. "text-decoration",
  5749. "text-rendering",
  5750. "unicode-bidi",
  5751. "word-spacing",
  5752. "writing-mode",
  5753. "user-select"
  5754. ]);
  5755. function copyTextStyles(styles, svgElement) {
  5756. for (const textProperty of textAttributes) {
  5757. const value = styles.getPropertyValue(textProperty);
  5758. if (value) {
  5759. svgElement.setAttribute(textProperty, value);
  5760. }
  5761. }
  5762. svgElement.setAttribute("fill", styles.color);
  5763. }
  5764. // node_modules/dom-to-svg/lib/svg.js
  5765. function handleSvgNode(node, context) {
  5766. if (isElement(node)) {
  5767. if (!isSVGElement(node)) {
  5768. return;
  5769. }
  5770. handleSvgElement(node, context);
  5771. } else if (isTextNode(node)) {
  5772. const clonedTextNode = node.cloneNode(true);
  5773. context.currentSvgParent.append(clonedTextNode);
  5774. }
  5775. }
  5776. var ignoredElements = /* @__PURE__ */ new Set(["script", "style", "foreignElement"]);
  5777. var URL_ID_REFERENCE_REGEX = /\burl\(["']?#/;
  5778. function handleSvgElement(element, context) {
  5779. var _a, _b, _c, _d;
  5780. if (ignoredElements.has(element.tagName)) {
  5781. return;
  5782. }
  5783. let elementToAppend;
  5784. if (isSVGSVGElement(element)) {
  5785. const contentContainer = context.svgDocument.createElementNS(svgNamespace, "g");
  5786. elementToAppend = contentContainer;
  5787. contentContainer.classList.add("svg-content", ...element.classList);
  5788. contentContainer.dataset.viewBox = (_a = element.getAttribute("viewBox")) !== null && _a !== void 0 ? _a : "";
  5789. contentContainer.dataset.width = (_b = element.getAttribute("width")) !== null && _b !== void 0 ? _b : "";
  5790. contentContainer.dataset.height = (_c = element.getAttribute("height")) !== null && _c !== void 0 ? _c : "";
  5791. for (const child of element.children) {
  5792. if (!isSVGGraphicsElement(child)) {
  5793. continue;
  5794. }
  5795. let viewBoxTransformMatrix = (
  5796. // When this function is called on an inline <svg> element in the original DOM, we want
  5797. // getScreenCTM() to map it to the DOM coordinate system. When this function is called from
  5798. // inlineResources() the <svg> is already embedded into the output <svg>. In that case the output
  5799. // SVG already has a viewBox, and the coordinate system of the SVG is not equal to the coordinate
  5800. // system of the screen, therefor we need to use getCTM() to map it into the output SVG's
  5801. // coordinate system.
  5802. child.ownerDocument !== context.svgDocument && // When we inline an SVG, we put a transform on it for the getScreenCTM(). When that SVG also
  5803. // contains another SVG, the inner SVG should just get transformed relative to the outer SVG, not
  5804. // relative to the screen, because the transforms will stack in the output SVG.
  5805. !((_d = element.parentElement) === null || _d === void 0 ? void 0 : _d.closest("svg")) ? child.getScreenCTM() : child.getCTM()
  5806. );
  5807. if (!viewBoxTransformMatrix) {
  5808. break;
  5809. }
  5810. if (child.transform.baseVal.numberOfItems > 0) {
  5811. child.transform.baseVal.consolidate();
  5812. const existingTransform = child.transform.baseVal.getItem(0).matrix;
  5813. viewBoxTransformMatrix = viewBoxTransformMatrix.multiply(existingTransform.inverse());
  5814. }
  5815. contentContainer.transform.baseVal.appendItem(contentContainer.transform.baseVal.createSVGTransformFromMatrix(viewBoxTransformMatrix));
  5816. break;
  5817. }
  5818. } else {
  5819. if (isSVGAnchorElement(element) && !context.options.keepLinks) {
  5820. elementToAppend = context.svgDocument.createElementNS(svgNamespace, "g");
  5821. } else {
  5822. elementToAppend = element.cloneNode(false);
  5823. }
  5824. for (const attribute of elementToAppend.attributes) {
  5825. if (attribute.localName.startsWith("on")) {
  5826. elementToAppend.attributes.removeNamedItemNS(attribute.namespaceURI, attribute.localName);
  5827. } else if (attribute.localName === "href" && attribute.value.startsWith("javascript:")) {
  5828. elementToAppend.attributes.removeNamedItemNS(attribute.namespaceURI, attribute.localName);
  5829. }
  5830. }
  5831. const window2 = element.ownerDocument.defaultView;
  5832. assert(window2, "Element's ownerDocument has no defaultView");
  5833. const svgViewportElement = element.ownerSVGElement;
  5834. assert(svgViewportElement, "Expected element to have ownerSVGElement");
  5835. const styles = window2.getComputedStyle(element);
  5836. if (isSVGGraphicsElement(element)) {
  5837. copyGraphicalPresentationAttributes(styles, elementToAppend, svgViewportElement.viewBox.animVal);
  5838. if (isSVGTextContentElement(element)) {
  5839. copyTextStyles(styles, elementToAppend);
  5840. }
  5841. }
  5842. for (const attribute of elementToAppend.attributes) {
  5843. if (attribute.localName === "href") {
  5844. if (attribute.value.startsWith("#")) {
  5845. attribute.value = attribute.value.replace("#", `#${context.idPrefix}`);
  5846. }
  5847. } else if (URL_ID_REFERENCE_REGEX.test(attribute.value)) {
  5848. attribute.value = rewriteUrlIdReferences(attribute.value, context);
  5849. }
  5850. }
  5851. for (const property of elementToAppend.style) {
  5852. const value = elementToAppend.style.getPropertyValue(property);
  5853. if (URL_ID_REFERENCE_REGEX.test(value)) {
  5854. elementToAppend.style.setProperty(property, rewriteUrlIdReferences(value, context), elementToAppend.style.getPropertyPriority(property));
  5855. }
  5856. }
  5857. }
  5858. if (elementToAppend.id) {
  5859. elementToAppend.id = context.idPrefix + elementToAppend.id;
  5860. }
  5861. context.currentSvgParent.append(elementToAppend);
  5862. for (const child of element.childNodes) {
  5863. handleSvgNode(child, { ...context, currentSvgParent: elementToAppend });
  5864. }
  5865. }
  5866. var graphicalPresentationAttributes = [
  5867. "alignment-baseline",
  5868. "baseline-shift",
  5869. // 'clip',
  5870. "clip-path",
  5871. "clip-rule",
  5872. "color",
  5873. "color-interpolation",
  5874. "color-interpolation-filters",
  5875. // 'color-profile',
  5876. "color-rendering",
  5877. // 'cursor',
  5878. "direction",
  5879. // 'display',
  5880. // 'enable-background',
  5881. "fill",
  5882. "fill-opacity",
  5883. "fill-rule",
  5884. "filter",
  5885. "flood-color",
  5886. "flood-opacity",
  5887. "image-rendering",
  5888. "lighting-color",
  5889. "marker-end",
  5890. "marker-mid",
  5891. "marker-start",
  5892. "mask",
  5893. "opacity",
  5894. // 'overflow',
  5895. "pointer-events",
  5896. "shape-rendering",
  5897. // 'solid-color',
  5898. // 'solid-opacity',
  5899. "stop-color",
  5900. "stop-opacity",
  5901. "stroke",
  5902. "stroke-dasharray",
  5903. "stroke-dashoffset",
  5904. "stroke-linecap",
  5905. "stroke-linejoin",
  5906. "stroke-miterlimit",
  5907. "stroke-opacity",
  5908. "stroke-width",
  5909. "transform",
  5910. "vector-effect",
  5911. "visibility"
  5912. ];
  5913. var defaults = {
  5914. "alignment-baseline": "auto",
  5915. "baseline-shift": "0px",
  5916. "clip-path": "none",
  5917. "clip-rule": "nonzero",
  5918. "color-interpolation-filters": "linearrgb",
  5919. "color-interpolation": "srgb",
  5920. "color-rendering": "auto",
  5921. "fill-opacity": "1",
  5922. "fill-rule": "nonzero",
  5923. "flood-color": "rgb(0, 0, 0)",
  5924. "flood-opacity": "1",
  5925. "image-rendering": "auto",
  5926. "lighting-color": "rgb(255, 255, 255)",
  5927. "marker-end": "none",
  5928. "marker-mid": "none",
  5929. "marker-start": "none",
  5930. "pointer-events": "auto",
  5931. "shape-rendering": "auto",
  5932. "stop-color": "rgb(0, 0, 0)",
  5933. "stop-opacity": "1",
  5934. "stroke-dasharray": "none",
  5935. "stroke-dashoffset": "0px",
  5936. "stroke-linecap": "butt",
  5937. "stroke-linejoin": "miter",
  5938. "stroke-miterlimit": "4",
  5939. "stroke-opacity": "1",
  5940. "stroke-width": "1px",
  5941. "vector-effect": "none",
  5942. color: "",
  5943. direction: "ltr",
  5944. fill: "",
  5945. filter: "none",
  5946. mask: "none",
  5947. opacity: "1",
  5948. stroke: "",
  5949. transform: "none",
  5950. visibility: "visible"
  5951. };
  5952. function rewriteUrlIdReferences(value, { idPrefix }) {
  5953. const parsedValue = (0, import_postcss_value_parser.default)(value);
  5954. parsedValue.walk((node) => {
  5955. if (node.type !== "function" || node.value !== "url") {
  5956. return;
  5957. }
  5958. const urlArgument = node.nodes[0];
  5959. if (!urlArgument) {
  5960. return;
  5961. }
  5962. urlArgument.value = urlArgument.value.replace("#", `#${idPrefix}`);
  5963. });
  5964. return import_postcss_value_parser.default.stringify(parsedValue.nodes);
  5965. }
  5966. function copyGraphicalPresentationAttributes(styles, target, viewBox) {
  5967. var _a;
  5968. for (const attribute of graphicalPresentationAttributes) {
  5969. let value = styles.getPropertyValue(attribute);
  5970. if (value && value !== defaults[attribute]) {
  5971. if (value.endsWith("%")) {
  5972. value = (_a = parseCSSLength(value, diagonale(viewBox))) !== null && _a !== void 0 ? _a : 0;
  5973. }
  5974. target.setAttribute(attribute, value.toString());
  5975. }
  5976. }
  5977. }
  5978. // node_modules/dom-to-svg/lib/element.js
  5979. function handleElement(element, context) {
  5980. var _a, _b, _c, _d, _e, _f, _g;
  5981. const cleanupFunctions = [];
  5982. try {
  5983. const window2 = element.ownerDocument.defaultView;
  5984. if (!window2) {
  5985. throw new Error("Element's ownerDocument has no defaultView");
  5986. }
  5987. const bounds = element.getBoundingClientRect();
  5988. const rectanglesIntersect = doRectanglesIntersect(bounds, context.options.captureArea);
  5989. const styles = window2.getComputedStyle(element);
  5990. const parentStyles = element.parentElement && window2.getComputedStyle(element.parentElement);
  5991. const svgContainer = isHTMLAnchorElement(element) && context.options.keepLinks ? createSvgAnchor(element, context) : context.svgDocument.createElementNS(svgNamespace, "g");
  5992. svgContainer.dataset.tag = element.tagName.toLowerCase();
  5993. const id = element.id || context.getUniqueId(element.classList[0] || element.tagName.toLowerCase());
  5994. svgContainer.id = id;
  5995. const className = element.getAttribute("class");
  5996. if (className) {
  5997. svgContainer.setAttribute("class", className);
  5998. }
  5999. if (isHTMLElement(element) && element.title) {
  6000. const svgTitle = context.svgDocument.createElementNS(svgNamespace, "title");
  6001. svgTitle.textContent = element.title;
  6002. svgContainer.prepend(svgTitle);
  6003. }
  6004. const stackingLayerName = determineStackingLayer(styles, parentStyles);
  6005. const stackingLayer = stackingLayerName ? context.stackingLayers[stackingLayerName] : context.parentStackingLayer;
  6006. if (stackingLayer) {
  6007. context.currentSvgParent.setAttribute("aria-owns", [context.currentSvgParent.getAttribute("aria-owns"), svgContainer.id].filter(Boolean).join(" "));
  6008. }
  6009. const elementToAppendTo = context.parentStackingLayer === stackingLayer ? context.currentSvgParent : stackingLayer;
  6010. svgContainer.dataset.zIndex = styles.zIndex;
  6011. elementToAppendTo.append(svgContainer);
  6012. let childContext;
  6013. let backgroundContainer;
  6014. let ownStackingLayers;
  6015. if (establishesStackingContext(styles, parentStyles)) {
  6016. ownStackingLayers = createStackingLayers(svgContainer);
  6017. backgroundContainer = ownStackingLayers.rootBackgroundAndBorders;
  6018. childContext = {
  6019. ...context,
  6020. currentSvgParent: svgContainer,
  6021. stackingLayers: ownStackingLayers,
  6022. parentStackingLayer: stackingLayer
  6023. };
  6024. } else {
  6025. backgroundContainer = svgContainer;
  6026. childContext = {
  6027. ...context,
  6028. currentSvgParent: svgContainer,
  6029. parentStackingLayer: stackingLayer
  6030. };
  6031. }
  6032. if (styles.opacity !== "1") {
  6033. svgContainer.setAttribute("opacity", styles.opacity);
  6034. }
  6035. for (const [name, value] of getAccessibilityAttributes(element, context)) {
  6036. svgContainer.setAttribute(name, value);
  6037. }
  6038. if (isHTMLElement(element) && !element.dataset.pseudoElement) {
  6039. const handlePseudoElement = (pseudoSelector, position) => {
  6040. const pseudoElementStyles = window2.getComputedStyle(element, pseudoSelector);
  6041. const content = (0, import_postcss_value_parser2.default)(pseudoElementStyles.content).nodes.find(isTaggedUnionMember("type", "string"));
  6042. if (!content) {
  6043. return;
  6044. }
  6045. const span = element.ownerDocument.createElement("span");
  6046. span.dataset.pseudoElement = pseudoSelector;
  6047. copyCssStyles(pseudoElementStyles, span.style);
  6048. span.textContent = unescapeStringValue(content.value);
  6049. element.dataset.pseudoElementOwner = id;
  6050. cleanupFunctions.push(() => element.removeAttribute("data-pseudo-element-owner"));
  6051. const style = element.ownerDocument.createElement("style");
  6052. style.textContent = `[data-pseudo-element-owner="${id}"]${pseudoSelector} { display: none !important; }`;
  6053. element.before(style);
  6054. cleanupFunctions.push(() => style.remove());
  6055. element[position](span);
  6056. cleanupFunctions.push(() => span.remove());
  6057. };
  6058. handlePseudoElement("::before", "prepend");
  6059. handlePseudoElement("::after", "append");
  6060. }
  6061. if (rectanglesIntersect) {
  6062. addBackgroundAndBorders(styles, bounds, backgroundContainer, window2, context);
  6063. }
  6064. if (styles.overflow !== "visible") {
  6065. const mask = context.svgDocument.createElementNS(svgNamespace, "mask");
  6066. mask.id = context.getUniqueId("mask-for-" + id);
  6067. const visibleRectangle = createBox(bounds, context);
  6068. visibleRectangle.setAttribute("fill", "#ffffff");
  6069. mask.append(visibleRectangle);
  6070. svgContainer.append(mask);
  6071. svgContainer.setAttribute("mask", `url(#${mask.id})`);
  6072. childContext = {
  6073. ...childContext,
  6074. ancestorMasks: [{ mask, forElement: element }, ...childContext.ancestorMasks]
  6075. };
  6076. }
  6077. if (isHTMLElement(element) && (styles.position === "absolute" || styles.position === "fixed") && context.ancestorMasks.length > 0 && element.offsetParent) {
  6078. for (const { mask, forElement } of context.ancestorMasks) {
  6079. if (element.offsetParent.contains(forElement) || element.offsetParent === forElement) {
  6080. const visibleRectangle = createBox(bounds, context);
  6081. visibleRectangle.setAttribute("fill", "#ffffff");
  6082. mask.append(visibleRectangle);
  6083. } else {
  6084. break;
  6085. }
  6086. }
  6087. }
  6088. if (rectanglesIntersect && isHTMLImageElement(element) && // Make sure the element has a src/srcset attribute (the relative URL). `element.src` is absolute and always defined.
  6089. (element.getAttribute("src") || element.getAttribute("srcset"))) {
  6090. const svgImage = context.svgDocument.createElementNS(svgNamespace, "image");
  6091. svgImage.id = `${id}-image`;
  6092. svgImage.setAttribute("xlink:href", element.currentSrc || element.src);
  6093. const paddingLeft = (_a = parseCSSLength(styles.paddingLeft, bounds.width)) !== null && _a !== void 0 ? _a : 0;
  6094. const paddingRight = (_b = parseCSSLength(styles.paddingRight, bounds.width)) !== null && _b !== void 0 ? _b : 0;
  6095. const paddingTop = (_c = parseCSSLength(styles.paddingTop, bounds.height)) !== null && _c !== void 0 ? _c : 0;
  6096. const paddingBottom = (_d = parseCSSLength(styles.paddingBottom, bounds.height)) !== null && _d !== void 0 ? _d : 0;
  6097. svgImage.setAttribute("x", (bounds.x + paddingLeft).toString());
  6098. svgImage.setAttribute("y", (bounds.y + paddingTop).toString());
  6099. svgImage.setAttribute("width", (bounds.width - paddingLeft - paddingRight).toString());
  6100. svgImage.setAttribute("height", (bounds.height - paddingTop - paddingBottom).toString());
  6101. if (element.alt) {
  6102. svgImage.setAttribute("aria-label", element.alt);
  6103. }
  6104. svgContainer.append(svgImage);
  6105. } else if (rectanglesIntersect && isHTMLInputElement(element) && bounds.width > 0 && bounds.height > 0) {
  6106. if (element.value) {
  6107. const svgTextElement = context.svgDocument.createElementNS(svgNamespace, "text");
  6108. copyTextStyles(styles, svgTextElement);
  6109. svgTextElement.setAttribute("dominant-baseline", "central");
  6110. svgTextElement.setAttribute("xml:space", "preserve");
  6111. svgTextElement.setAttribute("x", (bounds.x + ((_e = parseCSSLength(styles.paddingLeft, bounds.width)) !== null && _e !== void 0 ? _e : 0)).toString());
  6112. const top = bounds.top + ((_f = parseCSSLength(styles.paddingTop, bounds.height)) !== null && _f !== void 0 ? _f : 0);
  6113. const bottom = bounds.bottom + ((_g = parseCSSLength(styles.paddingBottom, bounds.height)) !== null && _g !== void 0 ? _g : 0);
  6114. const middle = (top + bottom) / 2;
  6115. svgTextElement.setAttribute("y", middle.toString());
  6116. svgTextElement.textContent = element.value;
  6117. childContext.stackingLayers.inFlowInlineLevelNonPositionedDescendants.append(svgTextElement);
  6118. }
  6119. } else if (rectanglesIntersect && isSVGSVGElement(element) && isVisible(styles)) {
  6120. handleSvgNode(element, { ...childContext, idPrefix: `${id}-` });
  6121. } else {
  6122. for (const child of element.childNodes) {
  6123. walkNode(child, childContext);
  6124. }
  6125. if (ownStackingLayers) {
  6126. sortStackingLayerChildren(ownStackingLayers);
  6127. cleanupStackingLayerChildren(ownStackingLayers);
  6128. }
  6129. }
  6130. } finally {
  6131. for (const cleanup of cleanupFunctions) {
  6132. cleanup();
  6133. }
  6134. }
  6135. }
  6136. function addBackgroundAndBorders(styles, bounds, backgroundAndBordersContainer, window2, context) {
  6137. var _a, _b, _c, _d;
  6138. if (isVisible(styles)) {
  6139. if (bounds.width > 0 && bounds.height > 0 && (!isTransparent(styles.backgroundColor) || hasUniformBorder(styles) || styles.backgroundImage !== "none")) {
  6140. const box = createBackgroundAndBorderBox(bounds, styles, context);
  6141. backgroundAndBordersContainer.append(box);
  6142. if (styles.backgroundImage !== "none") {
  6143. const backgrounds = (0, import_postcss_value_parser2.default)(styles.backgroundImage).nodes.filter(isTaggedUnionMember("type", "function")).reverse();
  6144. const xBackgroundPositions = styles.backgroundPositionX.split(/\s*,\s*/g);
  6145. const yBackgroundPositions = styles.backgroundPositionY.split(/\s*,\s*/g);
  6146. const backgroundRepeats = styles.backgroundRepeat.split(/\s*,\s*/g);
  6147. for (const [index, backgroundNode] of backgrounds.entries()) {
  6148. const backgroundPositionX = (_a = parseCSSLength(xBackgroundPositions[index], bounds.width)) !== null && _a !== void 0 ? _a : 0;
  6149. const backgroundPositionY = (_b = parseCSSLength(yBackgroundPositions[index], bounds.height)) !== null && _b !== void 0 ? _b : 0;
  6150. const backgroundRepeat = backgroundRepeats[index];
  6151. if (backgroundNode.value === "url" && backgroundNode.nodes[0]) {
  6152. const urlArgument = backgroundNode.nodes[0];
  6153. const image = context.svgDocument.createElementNS(svgNamespace, "image");
  6154. image.id = context.getUniqueId("background-image");
  6155. const [cssWidth = "auto", cssHeight = "auto"] = styles.backgroundSize.split(" ");
  6156. const backgroundWidth = (_c = parseCSSLength(cssWidth, bounds.width)) !== null && _c !== void 0 ? _c : bounds.width;
  6157. const backgroundHeight = (_d = parseCSSLength(cssHeight, bounds.height)) !== null && _d !== void 0 ? _d : bounds.height;
  6158. image.setAttribute("width", backgroundWidth.toString());
  6159. image.setAttribute("height", backgroundHeight.toString());
  6160. if (cssWidth !== "auto" && cssHeight !== "auto") {
  6161. image.setAttribute("preserveAspectRatio", "none");
  6162. } else if (styles.backgroundSize === "contain") {
  6163. image.setAttribute("preserveAspectRatio", "xMidYMid meet");
  6164. } else if (styles.backgroundSize === "cover") {
  6165. image.setAttribute("preserveAspectRatio", "xMidYMid slice");
  6166. }
  6167. const url = new URL(unescapeStringValue(urlArgument.value), window2.location.href);
  6168. image.setAttribute("xlink:href", url.href);
  6169. if (backgroundRepeat === "no-repeat" || backgroundPositionX === 0 && backgroundPositionY === 0 && backgroundWidth === bounds.width && backgroundHeight === bounds.height) {
  6170. image.setAttribute("x", bounds.x.toString());
  6171. image.setAttribute("y", bounds.y.toString());
  6172. backgroundAndBordersContainer.append(image);
  6173. } else {
  6174. image.setAttribute("x", "0");
  6175. image.setAttribute("y", "0");
  6176. const pattern = context.svgDocument.createElementNS(svgNamespace, "pattern");
  6177. pattern.setAttribute("patternUnits", "userSpaceOnUse");
  6178. pattern.setAttribute("patternContentUnits", "userSpaceOnUse");
  6179. pattern.setAttribute("x", (bounds.x + backgroundPositionX).toString());
  6180. pattern.setAttribute("y", (bounds.y + backgroundPositionY).toString());
  6181. pattern.setAttribute("width", (backgroundRepeat === "repeat" || backgroundRepeat === "repeat-x" ? backgroundWidth : (
  6182. // If background shouldn't repeat on this axis, make the tile as big as the element so the repetition is cut off.
  6183. backgroundWidth + bounds.x + backgroundPositionX
  6184. )).toString());
  6185. pattern.setAttribute("height", (backgroundRepeat === "repeat" || backgroundRepeat === "repeat-y" ? backgroundHeight : (
  6186. // If background shouldn't repeat on this axis, make the tile as big as the element so the repetition is cut off.
  6187. backgroundHeight + bounds.y + backgroundPositionY
  6188. )).toString());
  6189. pattern.id = context.getUniqueId("pattern");
  6190. pattern.append(image);
  6191. box.before(pattern);
  6192. box.setAttribute("fill", `url(#${pattern.id})`);
  6193. }
  6194. } else if (/^(-webkit-)?linear-gradient$/.test(backgroundNode.value)) {
  6195. const linearGradientCss = import_postcss_value_parser2.default.stringify(backgroundNode);
  6196. const svgLinearGradient = convertLinearGradient(linearGradientCss, context);
  6197. if (backgroundPositionX !== 0 || backgroundPositionY !== 0) {
  6198. svgLinearGradient.setAttribute("gradientTransform", `translate(${backgroundPositionX}, ${backgroundPositionY})`);
  6199. }
  6200. svgLinearGradient.id = context.getUniqueId("linear-gradient");
  6201. box.before(svgLinearGradient);
  6202. box.setAttribute("fill", `url(#${svgLinearGradient.id})`);
  6203. }
  6204. }
  6205. }
  6206. }
  6207. if (!hasUniformBorder(styles)) {
  6208. for (const borderLine of createBorders(styles, bounds, context)) {
  6209. backgroundAndBordersContainer.append(borderLine);
  6210. }
  6211. }
  6212. }
  6213. }
  6214. function createBox(bounds, context) {
  6215. const box = context.svgDocument.createElementNS(svgNamespace, "rect");
  6216. box.setAttribute("width", bounds.width.toString());
  6217. box.setAttribute("height", bounds.height.toString());
  6218. box.setAttribute("x", bounds.x.toString());
  6219. box.setAttribute("y", bounds.y.toString());
  6220. return box;
  6221. }
  6222. function createBackgroundAndBorderBox(bounds, styles, context) {
  6223. const background = createBox(bounds, context);
  6224. if (styles.backgroundColor) {
  6225. background.setAttribute("fill", styles.backgroundColor);
  6226. }
  6227. if (hasUniformBorder(styles)) {
  6228. background.setAttribute("stroke", styles.borderTopColor);
  6229. background.setAttribute("stroke-width", styles.borderTopWidth);
  6230. if (styles.borderTopStyle === "dashed") {
  6231. background.setAttribute("stroke-dasharray", "1");
  6232. }
  6233. }
  6234. const overlappingCurvesFactor = calculateOverlappingCurvesFactor(styles, bounds);
  6235. const radiusX = getBorderRadiiForSide("top", styles, bounds)[0] * overlappingCurvesFactor;
  6236. const radiusY = getBorderRadiiForSide("left", styles, bounds)[0] * overlappingCurvesFactor;
  6237. if (radiusX !== 0) {
  6238. background.setAttribute("rx", radiusX.toString());
  6239. }
  6240. if (radiusY !== 0) {
  6241. background.setAttribute("ry", radiusY.toString());
  6242. }
  6243. return background;
  6244. }
  6245. function* createBorders(styles, bounds, context) {
  6246. for (const side of ["top", "bottom", "right", "left"]) {
  6247. if (hasBorder(styles, side)) {
  6248. yield createBorder(styles, bounds, side, context);
  6249. }
  6250. }
  6251. }
  6252. function hasBorder(styles, side) {
  6253. return !!styles.getPropertyValue(`border-${side}-color`) && !isTransparent(styles.getPropertyValue(`border-${side}-color`)) && styles.getPropertyValue(`border-${side}-width`) !== "0px";
  6254. }
  6255. function createBorder(styles, bounds, side, context) {
  6256. const border = context.svgDocument.createElementNS(svgNamespace, "line");
  6257. border.setAttribute("stroke-linecap", "square");
  6258. const color = styles.getPropertyValue(`border-${side}-color`);
  6259. border.setAttribute("stroke", color);
  6260. border.setAttribute("stroke-width", styles.getPropertyValue(`border-${side}-width`));
  6261. const borderStyle = styles.getPropertyValue(`border-${side}-style`);
  6262. if (borderStyle === "inset" && (side === "top" || side === "left") || borderStyle === "outset" && (side === "right" || side === "bottom")) {
  6263. const match = color.match(/rgba?\((\d+), (\d+), (\d+)(?:, ([\d.]+))?\)/);
  6264. if (!match) {
  6265. throw new Error(`Unexpected color: ${color}`);
  6266. }
  6267. const components = match.slice(1, 4).map((value) => parseInt(value, 10) * 0.3);
  6268. if (match[4]) {
  6269. components.push(parseFloat(match[4]));
  6270. }
  6271. border.setAttribute("stroke", `rgba(${components.join(", ")})`);
  6272. }
  6273. if (side === "top") {
  6274. border.setAttribute("x1", bounds.left.toString());
  6275. border.setAttribute("x2", bounds.right.toString());
  6276. border.setAttribute("y1", bounds.top.toString());
  6277. border.setAttribute("y2", bounds.top.toString());
  6278. } else if (side === "left") {
  6279. border.setAttribute("x1", bounds.left.toString());
  6280. border.setAttribute("x2", bounds.left.toString());
  6281. border.setAttribute("y1", bounds.top.toString());
  6282. border.setAttribute("y2", bounds.bottom.toString());
  6283. } else if (side === "right") {
  6284. border.setAttribute("x1", bounds.right.toString());
  6285. border.setAttribute("x2", bounds.right.toString());
  6286. border.setAttribute("y1", bounds.top.toString());
  6287. border.setAttribute("y2", bounds.bottom.toString());
  6288. } else if (side === "bottom") {
  6289. border.setAttribute("x1", bounds.left.toString());
  6290. border.setAttribute("x2", bounds.right.toString());
  6291. border.setAttribute("y1", bounds.bottom.toString());
  6292. border.setAttribute("y2", bounds.bottom.toString());
  6293. }
  6294. return border;
  6295. }
  6296. function createSvgAnchor(element, context) {
  6297. const svgAnchor = context.svgDocument.createElementNS(svgNamespace, "a");
  6298. if (element.href && !element.href.startsWith("javascript:")) {
  6299. svgAnchor.setAttribute("href", element.href);
  6300. }
  6301. if (element.rel) {
  6302. svgAnchor.setAttribute("rel", element.rel);
  6303. }
  6304. if (element.target) {
  6305. svgAnchor.setAttribute("target", element.target);
  6306. }
  6307. if (element.download) {
  6308. svgAnchor.setAttribute("download", element.download);
  6309. }
  6310. return svgAnchor;
  6311. }
  6312. // node_modules/dom-to-svg/lib/traversal.js
  6313. function walkNode(node, context) {
  6314. if (isElement(node)) {
  6315. handleElement(node, context);
  6316. } else if (isTextNode(node)) {
  6317. handleTextNode(node, context);
  6318. }
  6319. }
  6320. // node_modules/dom-to-svg/lib/inline.js
  6321. var import_postcss_value_parser3 = __toESM(require_lib(), 1);
  6322. async function inlineResources(element) {
  6323. await Promise.all([
  6324. ...[...element.children].map(inlineResources),
  6325. (async () => {
  6326. var _a;
  6327. if (isSVGImageElement(element)) {
  6328. const blob = await withTimeout(1e4, `Timeout fetching ${element.href.baseVal}`, () => fetchResource(element.href.baseVal));
  6329. if (blob.type === "image/svg+xml") {
  6330. assert(element.ownerDocument, "Expected <image> element to have ownerDocument");
  6331. const embeddedSvgDocument = new DOMParser().parseFromString(await blob.text(), "image/svg+xml");
  6332. const svgRoot = embeddedSvgDocument.documentElement;
  6333. svgRoot.setAttribute("x", element.getAttribute("x"));
  6334. svgRoot.setAttribute("y", element.getAttribute("y"));
  6335. svgRoot.setAttribute("width", element.getAttribute("width"));
  6336. svgRoot.setAttribute("height", element.getAttribute("height"));
  6337. svgRoot.remove();
  6338. element.replaceWith(svgRoot);
  6339. try {
  6340. const svgDocument = element.ownerDocument;
  6341. const mount = svgDocument.createElementNS(svgNamespace, "g");
  6342. assert(element.id, "<image> element must have ID");
  6343. handleSvgNode(svgRoot, {
  6344. currentSvgParent: mount,
  6345. svgDocument,
  6346. idPrefix: `${element.id}-`,
  6347. options: {
  6348. // SVGs embedded through <img> are never interactive.
  6349. keepLinks: false,
  6350. captureArea: svgRoot.viewBox.baseVal
  6351. }
  6352. });
  6353. mount.dataset.tag = "img";
  6354. mount.setAttribute("role", "img");
  6355. svgRoot.replaceWith(mount);
  6356. } finally {
  6357. svgRoot.remove();
  6358. }
  6359. } else {
  6360. const dataUrl = await blobToDataURL(blob);
  6361. element.dataset.src = element.href.baseVal;
  6362. element.setAttribute("xlink:href", dataUrl.href);
  6363. }
  6364. } else if (isSVGStyleElement(element)) {
  6365. try {
  6366. const promises = [];
  6367. const parsedSheet = parse((_a = element.textContent) !== null && _a !== void 0 ? _a : "");
  6368. parsedSheet.walkAtRules("font-face", (fontFaceRule) => {
  6369. fontFaceRule.walkDecls("src", (sourceDeclaration) => {
  6370. const parsedSourceValue = (0, import_postcss_value_parser3.default)(sourceDeclaration.value);
  6371. parsedSourceValue.walk((node) => {
  6372. if (node.type === "function" && node.value === "url" && node.nodes[0]) {
  6373. const urlArgumentNode = node.nodes[0];
  6374. if (urlArgumentNode.type === "string" || urlArgumentNode.type === "word") {
  6375. promises.push(inlineCssFontUrlArgumentNode(urlArgumentNode));
  6376. }
  6377. }
  6378. });
  6379. sourceDeclaration.value = import_postcss_value_parser3.default.stringify(parsedSourceValue.nodes);
  6380. });
  6381. });
  6382. await Promise.all(promises);
  6383. element.textContent = parsedSheet.toString();
  6384. } catch (error) {
  6385. console.error("Error inlining stylesheet", element.sheet, error);
  6386. }
  6387. }
  6388. })().catch((error) => {
  6389. console.error("Error inlining resource for element", element, error);
  6390. })
  6391. ]);
  6392. }
  6393. async function inlineCssFontUrlArgumentNode(urlArgumentNode) {
  6394. try {
  6395. const url = new URL(unescapeStringValue(urlArgumentNode.value));
  6396. const blob = await withTimeout(1e4, `Timeout fetching ${url.href}`, () => fetchResource(url.href));
  6397. if (!blob.type.startsWith("font/") && !blob.type.startsWith("application/font-") && !blob.type.startsWith("application/x-font-") && !blob.type.startsWith("image/svg+xml") && !blob.type.startsWith("application/vnd.ms-fontobject")) {
  6398. throw new Error(`Invalid response MIME type inlining font at ${url.href}: Expected font MIME type, got ${blob.type}`);
  6399. }
  6400. const dataUrl = await blobToDataURL(blob);
  6401. urlArgumentNode.value = dataUrl.href;
  6402. } catch (error) {
  6403. console.error(`Error inlining ${urlArgumentNode.value}`, error);
  6404. }
  6405. }
  6406. async function fetchResource(url) {
  6407. assert(url, "No URL passed");
  6408. const headers = new Headers();
  6409. const response = await fetch(url, { headers });
  6410. if (!response.ok) {
  6411. throw new Error(response.statusText);
  6412. }
  6413. const blob = await response.blob();
  6414. return blob;
  6415. }
  6416. async function blobToDataURL(blob) {
  6417. const reader = new FileReader();
  6418. await new Promise((resolve, reject) => {
  6419. reader.addEventListener("error", () => reject(new Error("Error loading resource with FileLoader")));
  6420. reader.addEventListener("load", () => resolve());
  6421. reader.readAsDataURL(blob);
  6422. });
  6423. return new URL(reader.result);
  6424. }
  6425. // node_modules/dom-to-svg/lib/index.js
  6426. function documentToSVG(document2, options) {
  6427. return elementToSVG(document2.documentElement, options);
  6428. }
  6429. function elementToSVG(element, options) {
  6430. var _a, _b, _c, _d;
  6431. const svgDocument = element.ownerDocument.implementation.createDocument(svgNamespace, "svg", null);
  6432. const svgElement = svgDocument.documentElement;
  6433. svgElement.setAttribute("xmlns", svgNamespace);
  6434. svgElement.setAttribute("xmlns:xlink", xlinkNamespace);
  6435. svgElement.append(svgDocument.createComment(
  6436. // "--" is invalid in comments, percent-encode.
  6437. ` Generated by dom-to-svg from ${element.ownerDocument.location.href.replace(/--/g, "%2D%2D")} `
  6438. ));
  6439. const styleElement = svgDocument.createElementNS(svgNamespace, "style");
  6440. for (const styleSheet of element.ownerDocument.styleSheets) {
  6441. try {
  6442. for (const rule2 of (_a = styleSheet.rules) !== null && _a !== void 0 ? _a : []) {
  6443. if (!isCSSFontFaceRule(rule2)) {
  6444. continue;
  6445. }
  6446. const styleSheetHref = (_b = rule2.parentStyleSheet) === null || _b === void 0 ? void 0 : _b.href;
  6447. if (styleSheetHref) {
  6448. const parsedSourceValue = (0, import_postcss_value_parser4.default)(rule2.style.getPropertyValue("src"));
  6449. parsedSourceValue.walk((node) => {
  6450. if (node.type === "function" && node.value === "url" && node.nodes[0]) {
  6451. const urlArgumentNode = node.nodes[0];
  6452. if (urlArgumentNode.type === "string" || urlArgumentNode.type === "word") {
  6453. urlArgumentNode.value = new URL(unescapeStringValue(urlArgumentNode.value), styleSheetHref).href;
  6454. }
  6455. }
  6456. });
  6457. const updatedFontFaceRule = parse(rule2.cssText);
  6458. updatedFontFaceRule.walkDecls("src", (declaration) => {
  6459. declaration.value = import_postcss_value_parser4.default.stringify(parsedSourceValue.nodes);
  6460. });
  6461. styleElement.append(updatedFontFaceRule.toString() + "\n");
  6462. }
  6463. }
  6464. } catch (error) {
  6465. console.error("Error resolving @font-face src URLs for styleSheet, skipping", styleSheet, error);
  6466. }
  6467. }
  6468. svgElement.append(styleElement);
  6469. walkNode(element, {
  6470. svgDocument,
  6471. currentSvgParent: svgElement,
  6472. stackingLayers: createStackingLayers(svgElement),
  6473. parentStackingLayer: svgElement,
  6474. getUniqueId: createIdGenerator(),
  6475. labels: /* @__PURE__ */ new Map(),
  6476. ancestorMasks: [],
  6477. options: {
  6478. captureArea: (_c = options === null || options === void 0 ? void 0 : options.captureArea) !== null && _c !== void 0 ? _c : element.getBoundingClientRect(),
  6479. keepLinks: (options === null || options === void 0 ? void 0 : options.keepLinks) !== false
  6480. }
  6481. });
  6482. const bounds = (_d = options === null || options === void 0 ? void 0 : options.captureArea) !== null && _d !== void 0 ? _d : element.getBoundingClientRect();
  6483. svgElement.setAttribute("width", bounds.width.toString());
  6484. svgElement.setAttribute("height", bounds.height.toString());
  6485. svgElement.setAttribute("viewBox", `${bounds.x} ${bounds.y} ${bounds.width} ${bounds.height}`);
  6486. return svgDocument;
  6487. }
  6488. // ppt-output/.bundle_entry.js
  6489. window.__domToSvg = { documentToSVG, elementToSVG, inlineResources };
  6490. })();