livewire.esm.js 388 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139
  1. var __create = Object.create;
  2. var __defProp = Object.defineProperty;
  3. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4. var __getOwnPropNames = Object.getOwnPropertyNames;
  5. var __getProtoOf = Object.getPrototypeOf;
  6. var __hasOwnProp = Object.prototype.hasOwnProperty;
  7. var __commonJS = (cb, mod) => function __require() {
  8. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  9. };
  10. var __copyProps = (to, from, except, desc) => {
  11. if (from && typeof from === "object" || typeof from === "function") {
  12. for (let key of __getOwnPropNames(from))
  13. if (!__hasOwnProp.call(to, key) && key !== except)
  14. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15. }
  16. return to;
  17. };
  18. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
  19. // ../alpine/packages/alpinejs/dist/module.cjs.js
  20. var require_module_cjs = __commonJS({
  21. "../alpine/packages/alpinejs/dist/module.cjs.js"(exports, module) {
  22. var __create2 = Object.create;
  23. var __defProp2 = Object.defineProperty;
  24. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  25. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  26. var __getProtoOf2 = Object.getPrototypeOf;
  27. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  28. var __commonJS2 = (cb, mod) => function __require() {
  29. return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  30. };
  31. var __export = (target, all2) => {
  32. for (var name in all2)
  33. __defProp2(target, name, { get: all2[name], enumerable: true });
  34. };
  35. var __copyProps2 = (to, from, except, desc) => {
  36. if (from && typeof from === "object" || typeof from === "function") {
  37. for (let key of __getOwnPropNames2(from))
  38. if (!__hasOwnProp2.call(to, key) && key !== except)
  39. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  40. }
  41. return to;
  42. };
  43. var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod));
  44. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  45. var require_shared_cjs = __commonJS2({
  46. "node_modules/@vue/shared/dist/shared.cjs.js"(exports2) {
  47. "use strict";
  48. Object.defineProperty(exports2, "__esModule", { value: true });
  49. function makeMap(str, expectsLowerCase) {
  50. const map = /* @__PURE__ */ Object.create(null);
  51. const list = str.split(",");
  52. for (let i = 0; i < list.length; i++) {
  53. map[list[i]] = true;
  54. }
  55. return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
  56. }
  57. var PatchFlagNames = {
  58. [1]: `TEXT`,
  59. [2]: `CLASS`,
  60. [4]: `STYLE`,
  61. [8]: `PROPS`,
  62. [16]: `FULL_PROPS`,
  63. [32]: `HYDRATE_EVENTS`,
  64. [64]: `STABLE_FRAGMENT`,
  65. [128]: `KEYED_FRAGMENT`,
  66. [256]: `UNKEYED_FRAGMENT`,
  67. [512]: `NEED_PATCH`,
  68. [1024]: `DYNAMIC_SLOTS`,
  69. [2048]: `DEV_ROOT_FRAGMENT`,
  70. [-1]: `HOISTED`,
  71. [-2]: `BAIL`
  72. };
  73. var slotFlagsText = {
  74. [1]: "STABLE",
  75. [2]: "DYNAMIC",
  76. [3]: "FORWARDED"
  77. };
  78. var GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
  79. var isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
  80. var range = 2;
  81. function generateCodeFrame(source, start22 = 0, end = source.length) {
  82. let lines = source.split(/(\r?\n)/);
  83. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  84. lines = lines.filter((_, idx) => idx % 2 === 0);
  85. let count = 0;
  86. const res = [];
  87. for (let i = 0; i < lines.length; i++) {
  88. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  89. if (count >= start22) {
  90. for (let j = i - range; j <= i + range || end > count; j++) {
  91. if (j < 0 || j >= lines.length)
  92. continue;
  93. const line = j + 1;
  94. res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
  95. const lineLength = lines[j].length;
  96. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  97. if (j === i) {
  98. const pad = start22 - (count - (lineLength + newLineSeqLength));
  99. const length = Math.max(1, end > count ? lineLength - pad : end - start22);
  100. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  101. } else if (j > i) {
  102. if (end > count) {
  103. const length = Math.max(Math.min(end - count, lineLength), 1);
  104. res.push(` | ` + "^".repeat(length));
  105. }
  106. count += lineLength + newLineSeqLength;
  107. }
  108. }
  109. break;
  110. }
  111. }
  112. return res.join("\n");
  113. }
  114. var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  115. var isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  116. var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
  117. var unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
  118. var attrValidationCache = {};
  119. function isSSRSafeAttrName(name) {
  120. if (attrValidationCache.hasOwnProperty(name)) {
  121. return attrValidationCache[name];
  122. }
  123. const isUnsafe = unsafeAttrCharRE.test(name);
  124. if (isUnsafe) {
  125. console.error(`unsafe attribute name: ${name}`);
  126. }
  127. return attrValidationCache[name] = !isUnsafe;
  128. }
  129. var propsToAttrMap = {
  130. acceptCharset: "accept-charset",
  131. className: "class",
  132. htmlFor: "for",
  133. httpEquiv: "http-equiv"
  134. };
  135. var isNoUnitNumericStyleProp = /* @__PURE__ */ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,stroke-miterlimit,stroke-opacity,stroke-width`);
  136. var isKnownAttr = /* @__PURE__ */ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`);
  137. function normalizeStyle(value) {
  138. if (isArray2(value)) {
  139. const res = {};
  140. for (let i = 0; i < value.length; i++) {
  141. const item = value[i];
  142. const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
  143. if (normalized) {
  144. for (const key in normalized) {
  145. res[key] = normalized[key];
  146. }
  147. }
  148. }
  149. return res;
  150. } else if (isObject2(value)) {
  151. return value;
  152. }
  153. }
  154. var listDelimiterRE = /;(?![^(]*\))/g;
  155. var propertyDelimiterRE = /:(.+)/;
  156. function parseStringStyle(cssText) {
  157. const ret = {};
  158. cssText.split(listDelimiterRE).forEach((item) => {
  159. if (item) {
  160. const tmp = item.split(propertyDelimiterRE);
  161. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  162. }
  163. });
  164. return ret;
  165. }
  166. function stringifyStyle(styles) {
  167. let ret = "";
  168. if (!styles) {
  169. return ret;
  170. }
  171. for (const key in styles) {
  172. const value = styles[key];
  173. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  174. if (isString(value) || typeof value === "number" && isNoUnitNumericStyleProp(normalizedKey)) {
  175. ret += `${normalizedKey}:${value};`;
  176. }
  177. }
  178. return ret;
  179. }
  180. function normalizeClass(value) {
  181. let res = "";
  182. if (isString(value)) {
  183. res = value;
  184. } else if (isArray2(value)) {
  185. for (let i = 0; i < value.length; i++) {
  186. const normalized = normalizeClass(value[i]);
  187. if (normalized) {
  188. res += normalized + " ";
  189. }
  190. }
  191. } else if (isObject2(value)) {
  192. for (const name in value) {
  193. if (value[name]) {
  194. res += name + " ";
  195. }
  196. }
  197. }
  198. return res.trim();
  199. }
  200. var HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  201. var SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
  202. var VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  203. var isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  204. var isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  205. var isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  206. var escapeRE = /["'&<>]/;
  207. function escapeHtml(string) {
  208. const str = "" + string;
  209. const match = escapeRE.exec(str);
  210. if (!match) {
  211. return str;
  212. }
  213. let html = "";
  214. let escaped;
  215. let index;
  216. let lastIndex = 0;
  217. for (index = match.index; index < str.length; index++) {
  218. switch (str.charCodeAt(index)) {
  219. case 34:
  220. escaped = "&quot;";
  221. break;
  222. case 38:
  223. escaped = "&amp;";
  224. break;
  225. case 39:
  226. escaped = "&#39;";
  227. break;
  228. case 60:
  229. escaped = "&lt;";
  230. break;
  231. case 62:
  232. escaped = "&gt;";
  233. break;
  234. default:
  235. continue;
  236. }
  237. if (lastIndex !== index) {
  238. html += str.substring(lastIndex, index);
  239. }
  240. lastIndex = index + 1;
  241. html += escaped;
  242. }
  243. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  244. }
  245. var commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
  246. function escapeHtmlComment(src) {
  247. return src.replace(commentStripRE, "");
  248. }
  249. function looseCompareArrays(a, b) {
  250. if (a.length !== b.length)
  251. return false;
  252. let equal = true;
  253. for (let i = 0; equal && i < a.length; i++) {
  254. equal = looseEqual(a[i], b[i]);
  255. }
  256. return equal;
  257. }
  258. function looseEqual(a, b) {
  259. if (a === b)
  260. return true;
  261. let aValidType = isDate(a);
  262. let bValidType = isDate(b);
  263. if (aValidType || bValidType) {
  264. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  265. }
  266. aValidType = isArray2(a);
  267. bValidType = isArray2(b);
  268. if (aValidType || bValidType) {
  269. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  270. }
  271. aValidType = isObject2(a);
  272. bValidType = isObject2(b);
  273. if (aValidType || bValidType) {
  274. if (!aValidType || !bValidType) {
  275. return false;
  276. }
  277. const aKeysCount = Object.keys(a).length;
  278. const bKeysCount = Object.keys(b).length;
  279. if (aKeysCount !== bKeysCount) {
  280. return false;
  281. }
  282. for (const key in a) {
  283. const aHasKey = a.hasOwnProperty(key);
  284. const bHasKey = b.hasOwnProperty(key);
  285. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  286. return false;
  287. }
  288. }
  289. }
  290. return String(a) === String(b);
  291. }
  292. function looseIndexOf(arr, val) {
  293. return arr.findIndex((item) => looseEqual(item, val));
  294. }
  295. var toDisplayString = (val) => {
  296. return val == null ? "" : isObject2(val) ? JSON.stringify(val, replacer, 2) : String(val);
  297. };
  298. var replacer = (_key, val) => {
  299. if (isMap(val)) {
  300. return {
  301. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
  302. entries[`${key} =>`] = val2;
  303. return entries;
  304. }, {})
  305. };
  306. } else if (isSet(val)) {
  307. return {
  308. [`Set(${val.size})`]: [...val.values()]
  309. };
  310. } else if (isObject2(val) && !isArray2(val) && !isPlainObject(val)) {
  311. return String(val);
  312. }
  313. return val;
  314. };
  315. var babelParserDefaultPlugins = [
  316. "bigInt",
  317. "optionalChaining",
  318. "nullishCoalescingOperator"
  319. ];
  320. var EMPTY_OBJ = Object.freeze({});
  321. var EMPTY_ARR = Object.freeze([]);
  322. var NOOP = () => {
  323. };
  324. var NO = () => false;
  325. var onRE = /^on[^a-z]/;
  326. var isOn = (key) => onRE.test(key);
  327. var isModelListener = (key) => key.startsWith("onUpdate:");
  328. var extend = Object.assign;
  329. var remove = (arr, el) => {
  330. const i = arr.indexOf(el);
  331. if (i > -1) {
  332. arr.splice(i, 1);
  333. }
  334. };
  335. var hasOwnProperty = Object.prototype.hasOwnProperty;
  336. var hasOwn = (val, key) => hasOwnProperty.call(val, key);
  337. var isArray2 = Array.isArray;
  338. var isMap = (val) => toTypeString(val) === "[object Map]";
  339. var isSet = (val) => toTypeString(val) === "[object Set]";
  340. var isDate = (val) => val instanceof Date;
  341. var isFunction2 = (val) => typeof val === "function";
  342. var isString = (val) => typeof val === "string";
  343. var isSymbol = (val) => typeof val === "symbol";
  344. var isObject2 = (val) => val !== null && typeof val === "object";
  345. var isPromise = (val) => {
  346. return isObject2(val) && isFunction2(val.then) && isFunction2(val.catch);
  347. };
  348. var objectToString = Object.prototype.toString;
  349. var toTypeString = (value) => objectToString.call(value);
  350. var toRawType = (value) => {
  351. return toTypeString(value).slice(8, -1);
  352. };
  353. var isPlainObject = (val) => toTypeString(val) === "[object Object]";
  354. var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  355. var isReservedProp = /* @__PURE__ */ makeMap(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
  356. var cacheStringFunction = (fn) => {
  357. const cache = /* @__PURE__ */ Object.create(null);
  358. return (str) => {
  359. const hit = cache[str];
  360. return hit || (cache[str] = fn(str));
  361. };
  362. };
  363. var camelizeRE = /-(\w)/g;
  364. var camelize = cacheStringFunction((str) => {
  365. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  366. });
  367. var hyphenateRE = /\B([A-Z])/g;
  368. var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  369. var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  370. var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
  371. var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
  372. var invokeArrayFns = (fns, arg) => {
  373. for (let i = 0; i < fns.length; i++) {
  374. fns[i](arg);
  375. }
  376. };
  377. var def = (obj, key, value) => {
  378. Object.defineProperty(obj, key, {
  379. configurable: true,
  380. enumerable: false,
  381. value
  382. });
  383. };
  384. var toNumber = (val) => {
  385. const n = parseFloat(val);
  386. return isNaN(n) ? val : n;
  387. };
  388. var _globalThis;
  389. var getGlobalThis = () => {
  390. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  391. };
  392. exports2.EMPTY_ARR = EMPTY_ARR;
  393. exports2.EMPTY_OBJ = EMPTY_OBJ;
  394. exports2.NO = NO;
  395. exports2.NOOP = NOOP;
  396. exports2.PatchFlagNames = PatchFlagNames;
  397. exports2.babelParserDefaultPlugins = babelParserDefaultPlugins;
  398. exports2.camelize = camelize;
  399. exports2.capitalize = capitalize;
  400. exports2.def = def;
  401. exports2.escapeHtml = escapeHtml;
  402. exports2.escapeHtmlComment = escapeHtmlComment;
  403. exports2.extend = extend;
  404. exports2.generateCodeFrame = generateCodeFrame;
  405. exports2.getGlobalThis = getGlobalThis;
  406. exports2.hasChanged = hasChanged;
  407. exports2.hasOwn = hasOwn;
  408. exports2.hyphenate = hyphenate;
  409. exports2.invokeArrayFns = invokeArrayFns;
  410. exports2.isArray = isArray2;
  411. exports2.isBooleanAttr = isBooleanAttr2;
  412. exports2.isDate = isDate;
  413. exports2.isFunction = isFunction2;
  414. exports2.isGloballyWhitelisted = isGloballyWhitelisted;
  415. exports2.isHTMLTag = isHTMLTag;
  416. exports2.isIntegerKey = isIntegerKey;
  417. exports2.isKnownAttr = isKnownAttr;
  418. exports2.isMap = isMap;
  419. exports2.isModelListener = isModelListener;
  420. exports2.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp;
  421. exports2.isObject = isObject2;
  422. exports2.isOn = isOn;
  423. exports2.isPlainObject = isPlainObject;
  424. exports2.isPromise = isPromise;
  425. exports2.isReservedProp = isReservedProp;
  426. exports2.isSSRSafeAttrName = isSSRSafeAttrName;
  427. exports2.isSVGTag = isSVGTag;
  428. exports2.isSet = isSet;
  429. exports2.isSpecialBooleanAttr = isSpecialBooleanAttr;
  430. exports2.isString = isString;
  431. exports2.isSymbol = isSymbol;
  432. exports2.isVoidTag = isVoidTag;
  433. exports2.looseEqual = looseEqual;
  434. exports2.looseIndexOf = looseIndexOf;
  435. exports2.makeMap = makeMap;
  436. exports2.normalizeClass = normalizeClass;
  437. exports2.normalizeStyle = normalizeStyle;
  438. exports2.objectToString = objectToString;
  439. exports2.parseStringStyle = parseStringStyle;
  440. exports2.propsToAttrMap = propsToAttrMap;
  441. exports2.remove = remove;
  442. exports2.slotFlagsText = slotFlagsText;
  443. exports2.stringifyStyle = stringifyStyle;
  444. exports2.toDisplayString = toDisplayString;
  445. exports2.toHandlerKey = toHandlerKey;
  446. exports2.toNumber = toNumber;
  447. exports2.toRawType = toRawType;
  448. exports2.toTypeString = toTypeString;
  449. }
  450. });
  451. var require_shared = __commonJS2({
  452. "node_modules/@vue/shared/index.js"(exports2, module2) {
  453. "use strict";
  454. if (false) {
  455. module2.exports = null;
  456. } else {
  457. module2.exports = require_shared_cjs();
  458. }
  459. }
  460. });
  461. var require_reactivity_cjs = __commonJS2({
  462. "node_modules/@vue/reactivity/dist/reactivity.cjs.js"(exports2) {
  463. "use strict";
  464. Object.defineProperty(exports2, "__esModule", { value: true });
  465. var shared = require_shared();
  466. var targetMap = /* @__PURE__ */ new WeakMap();
  467. var effectStack = [];
  468. var activeEffect;
  469. var ITERATE_KEY = Symbol("iterate");
  470. var MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
  471. function isEffect(fn) {
  472. return fn && fn._isEffect === true;
  473. }
  474. function effect3(fn, options = shared.EMPTY_OBJ) {
  475. if (isEffect(fn)) {
  476. fn = fn.raw;
  477. }
  478. const effect4 = createReactiveEffect(fn, options);
  479. if (!options.lazy) {
  480. effect4();
  481. }
  482. return effect4;
  483. }
  484. function stop2(effect4) {
  485. if (effect4.active) {
  486. cleanup(effect4);
  487. if (effect4.options.onStop) {
  488. effect4.options.onStop();
  489. }
  490. effect4.active = false;
  491. }
  492. }
  493. var uid = 0;
  494. function createReactiveEffect(fn, options) {
  495. const effect4 = function reactiveEffect() {
  496. if (!effect4.active) {
  497. return fn();
  498. }
  499. if (!effectStack.includes(effect4)) {
  500. cleanup(effect4);
  501. try {
  502. enableTracking();
  503. effectStack.push(effect4);
  504. activeEffect = effect4;
  505. return fn();
  506. } finally {
  507. effectStack.pop();
  508. resetTracking();
  509. activeEffect = effectStack[effectStack.length - 1];
  510. }
  511. }
  512. };
  513. effect4.id = uid++;
  514. effect4.allowRecurse = !!options.allowRecurse;
  515. effect4._isEffect = true;
  516. effect4.active = true;
  517. effect4.raw = fn;
  518. effect4.deps = [];
  519. effect4.options = options;
  520. return effect4;
  521. }
  522. function cleanup(effect4) {
  523. const { deps } = effect4;
  524. if (deps.length) {
  525. for (let i = 0; i < deps.length; i++) {
  526. deps[i].delete(effect4);
  527. }
  528. deps.length = 0;
  529. }
  530. }
  531. var shouldTrack = true;
  532. var trackStack = [];
  533. function pauseTracking() {
  534. trackStack.push(shouldTrack);
  535. shouldTrack = false;
  536. }
  537. function enableTracking() {
  538. trackStack.push(shouldTrack);
  539. shouldTrack = true;
  540. }
  541. function resetTracking() {
  542. const last = trackStack.pop();
  543. shouldTrack = last === void 0 ? true : last;
  544. }
  545. function track2(target, type, key) {
  546. if (!shouldTrack || activeEffect === void 0) {
  547. return;
  548. }
  549. let depsMap = targetMap.get(target);
  550. if (!depsMap) {
  551. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  552. }
  553. let dep = depsMap.get(key);
  554. if (!dep) {
  555. depsMap.set(key, dep = /* @__PURE__ */ new Set());
  556. }
  557. if (!dep.has(activeEffect)) {
  558. dep.add(activeEffect);
  559. activeEffect.deps.push(dep);
  560. if (activeEffect.options.onTrack) {
  561. activeEffect.options.onTrack({
  562. effect: activeEffect,
  563. target,
  564. type,
  565. key
  566. });
  567. }
  568. }
  569. }
  570. function trigger2(target, type, key, newValue, oldValue, oldTarget) {
  571. const depsMap = targetMap.get(target);
  572. if (!depsMap) {
  573. return;
  574. }
  575. const effects = /* @__PURE__ */ new Set();
  576. const add2 = (effectsToAdd) => {
  577. if (effectsToAdd) {
  578. effectsToAdd.forEach((effect4) => {
  579. if (effect4 !== activeEffect || effect4.allowRecurse) {
  580. effects.add(effect4);
  581. }
  582. });
  583. }
  584. };
  585. if (type === "clear") {
  586. depsMap.forEach(add2);
  587. } else if (key === "length" && shared.isArray(target)) {
  588. depsMap.forEach((dep, key2) => {
  589. if (key2 === "length" || key2 >= newValue) {
  590. add2(dep);
  591. }
  592. });
  593. } else {
  594. if (key !== void 0) {
  595. add2(depsMap.get(key));
  596. }
  597. switch (type) {
  598. case "add":
  599. if (!shared.isArray(target)) {
  600. add2(depsMap.get(ITERATE_KEY));
  601. if (shared.isMap(target)) {
  602. add2(depsMap.get(MAP_KEY_ITERATE_KEY));
  603. }
  604. } else if (shared.isIntegerKey(key)) {
  605. add2(depsMap.get("length"));
  606. }
  607. break;
  608. case "delete":
  609. if (!shared.isArray(target)) {
  610. add2(depsMap.get(ITERATE_KEY));
  611. if (shared.isMap(target)) {
  612. add2(depsMap.get(MAP_KEY_ITERATE_KEY));
  613. }
  614. }
  615. break;
  616. case "set":
  617. if (shared.isMap(target)) {
  618. add2(depsMap.get(ITERATE_KEY));
  619. }
  620. break;
  621. }
  622. }
  623. const run = (effect4) => {
  624. if (effect4.options.onTrigger) {
  625. effect4.options.onTrigger({
  626. effect: effect4,
  627. target,
  628. key,
  629. type,
  630. newValue,
  631. oldValue,
  632. oldTarget
  633. });
  634. }
  635. if (effect4.options.scheduler) {
  636. effect4.options.scheduler(effect4);
  637. } else {
  638. effect4();
  639. }
  640. };
  641. effects.forEach(run);
  642. }
  643. var isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
  644. var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(shared.isSymbol));
  645. var get2 = /* @__PURE__ */ createGetter();
  646. var shallowGet = /* @__PURE__ */ createGetter(false, true);
  647. var readonlyGet = /* @__PURE__ */ createGetter(true);
  648. var shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
  649. var arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  650. function createArrayInstrumentations() {
  651. const instrumentations = {};
  652. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  653. instrumentations[key] = function(...args) {
  654. const arr = toRaw2(this);
  655. for (let i = 0, l = this.length; i < l; i++) {
  656. track2(arr, "get", i + "");
  657. }
  658. const res = arr[key](...args);
  659. if (res === -1 || res === false) {
  660. return arr[key](...args.map(toRaw2));
  661. } else {
  662. return res;
  663. }
  664. };
  665. });
  666. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  667. instrumentations[key] = function(...args) {
  668. pauseTracking();
  669. const res = toRaw2(this)[key].apply(this, args);
  670. resetTracking();
  671. return res;
  672. };
  673. });
  674. return instrumentations;
  675. }
  676. function createGetter(isReadonly2 = false, shallow = false) {
  677. return function get3(target, key, receiver) {
  678. if (key === "__v_isReactive") {
  679. return !isReadonly2;
  680. } else if (key === "__v_isReadonly") {
  681. return isReadonly2;
  682. } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
  683. return target;
  684. }
  685. const targetIsArray = shared.isArray(target);
  686. if (!isReadonly2 && targetIsArray && shared.hasOwn(arrayInstrumentations, key)) {
  687. return Reflect.get(arrayInstrumentations, key, receiver);
  688. }
  689. const res = Reflect.get(target, key, receiver);
  690. if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  691. return res;
  692. }
  693. if (!isReadonly2) {
  694. track2(target, "get", key);
  695. }
  696. if (shallow) {
  697. return res;
  698. }
  699. if (isRef(res)) {
  700. const shouldUnwrap = !targetIsArray || !shared.isIntegerKey(key);
  701. return shouldUnwrap ? res.value : res;
  702. }
  703. if (shared.isObject(res)) {
  704. return isReadonly2 ? readonly(res) : reactive3(res);
  705. }
  706. return res;
  707. };
  708. }
  709. var set2 = /* @__PURE__ */ createSetter();
  710. var shallowSet = /* @__PURE__ */ createSetter(true);
  711. function createSetter(shallow = false) {
  712. return function set3(target, key, value, receiver) {
  713. let oldValue = target[key];
  714. if (!shallow) {
  715. value = toRaw2(value);
  716. oldValue = toRaw2(oldValue);
  717. if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
  718. oldValue.value = value;
  719. return true;
  720. }
  721. }
  722. const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
  723. const result = Reflect.set(target, key, value, receiver);
  724. if (target === toRaw2(receiver)) {
  725. if (!hadKey) {
  726. trigger2(target, "add", key, value);
  727. } else if (shared.hasChanged(value, oldValue)) {
  728. trigger2(target, "set", key, value, oldValue);
  729. }
  730. }
  731. return result;
  732. };
  733. }
  734. function deleteProperty(target, key) {
  735. const hadKey = shared.hasOwn(target, key);
  736. const oldValue = target[key];
  737. const result = Reflect.deleteProperty(target, key);
  738. if (result && hadKey) {
  739. trigger2(target, "delete", key, void 0, oldValue);
  740. }
  741. return result;
  742. }
  743. function has(target, key) {
  744. const result = Reflect.has(target, key);
  745. if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
  746. track2(target, "has", key);
  747. }
  748. return result;
  749. }
  750. function ownKeys(target) {
  751. track2(target, "iterate", shared.isArray(target) ? "length" : ITERATE_KEY);
  752. return Reflect.ownKeys(target);
  753. }
  754. var mutableHandlers = {
  755. get: get2,
  756. set: set2,
  757. deleteProperty,
  758. has,
  759. ownKeys
  760. };
  761. var readonlyHandlers = {
  762. get: readonlyGet,
  763. set(target, key) {
  764. {
  765. console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
  766. }
  767. return true;
  768. },
  769. deleteProperty(target, key) {
  770. {
  771. console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
  772. }
  773. return true;
  774. }
  775. };
  776. var shallowReactiveHandlers = /* @__PURE__ */ shared.extend({}, mutableHandlers, {
  777. get: shallowGet,
  778. set: shallowSet
  779. });
  780. var shallowReadonlyHandlers = /* @__PURE__ */ shared.extend({}, readonlyHandlers, {
  781. get: shallowReadonlyGet
  782. });
  783. var toReactive = (value) => shared.isObject(value) ? reactive3(value) : value;
  784. var toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
  785. var toShallow = (value) => value;
  786. var getProto = (v) => Reflect.getPrototypeOf(v);
  787. function get$1(target, key, isReadonly2 = false, isShallow = false) {
  788. target = target["__v_raw"];
  789. const rawTarget = toRaw2(target);
  790. const rawKey = toRaw2(key);
  791. if (key !== rawKey) {
  792. !isReadonly2 && track2(rawTarget, "get", key);
  793. }
  794. !isReadonly2 && track2(rawTarget, "get", rawKey);
  795. const { has: has2 } = getProto(rawTarget);
  796. const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
  797. if (has2.call(rawTarget, key)) {
  798. return wrap(target.get(key));
  799. } else if (has2.call(rawTarget, rawKey)) {
  800. return wrap(target.get(rawKey));
  801. } else if (target !== rawTarget) {
  802. target.get(key);
  803. }
  804. }
  805. function has$1(key, isReadonly2 = false) {
  806. const target = this["__v_raw"];
  807. const rawTarget = toRaw2(target);
  808. const rawKey = toRaw2(key);
  809. if (key !== rawKey) {
  810. !isReadonly2 && track2(rawTarget, "has", key);
  811. }
  812. !isReadonly2 && track2(rawTarget, "has", rawKey);
  813. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  814. }
  815. function size(target, isReadonly2 = false) {
  816. target = target["__v_raw"];
  817. !isReadonly2 && track2(toRaw2(target), "iterate", ITERATE_KEY);
  818. return Reflect.get(target, "size", target);
  819. }
  820. function add(value) {
  821. value = toRaw2(value);
  822. const target = toRaw2(this);
  823. const proto = getProto(target);
  824. const hadKey = proto.has.call(target, value);
  825. if (!hadKey) {
  826. target.add(value);
  827. trigger2(target, "add", value, value);
  828. }
  829. return this;
  830. }
  831. function set$1(key, value) {
  832. value = toRaw2(value);
  833. const target = toRaw2(this);
  834. const { has: has2, get: get3 } = getProto(target);
  835. let hadKey = has2.call(target, key);
  836. if (!hadKey) {
  837. key = toRaw2(key);
  838. hadKey = has2.call(target, key);
  839. } else {
  840. checkIdentityKeys(target, has2, key);
  841. }
  842. const oldValue = get3.call(target, key);
  843. target.set(key, value);
  844. if (!hadKey) {
  845. trigger2(target, "add", key, value);
  846. } else if (shared.hasChanged(value, oldValue)) {
  847. trigger2(target, "set", key, value, oldValue);
  848. }
  849. return this;
  850. }
  851. function deleteEntry(key) {
  852. const target = toRaw2(this);
  853. const { has: has2, get: get3 } = getProto(target);
  854. let hadKey = has2.call(target, key);
  855. if (!hadKey) {
  856. key = toRaw2(key);
  857. hadKey = has2.call(target, key);
  858. } else {
  859. checkIdentityKeys(target, has2, key);
  860. }
  861. const oldValue = get3 ? get3.call(target, key) : void 0;
  862. const result = target.delete(key);
  863. if (hadKey) {
  864. trigger2(target, "delete", key, void 0, oldValue);
  865. }
  866. return result;
  867. }
  868. function clear() {
  869. const target = toRaw2(this);
  870. const hadItems = target.size !== 0;
  871. const oldTarget = shared.isMap(target) ? new Map(target) : new Set(target);
  872. const result = target.clear();
  873. if (hadItems) {
  874. trigger2(target, "clear", void 0, void 0, oldTarget);
  875. }
  876. return result;
  877. }
  878. function createForEach(isReadonly2, isShallow) {
  879. return function forEach(callback, thisArg) {
  880. const observed = this;
  881. const target = observed["__v_raw"];
  882. const rawTarget = toRaw2(target);
  883. const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
  884. !isReadonly2 && track2(rawTarget, "iterate", ITERATE_KEY);
  885. return target.forEach((value, key) => {
  886. return callback.call(thisArg, wrap(value), wrap(key), observed);
  887. });
  888. };
  889. }
  890. function createIterableMethod(method, isReadonly2, isShallow) {
  891. return function(...args) {
  892. const target = this["__v_raw"];
  893. const rawTarget = toRaw2(target);
  894. const targetIsMap = shared.isMap(rawTarget);
  895. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  896. const isKeyOnly = method === "keys" && targetIsMap;
  897. const innerIterator = target[method](...args);
  898. const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
  899. !isReadonly2 && track2(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
  900. return {
  901. next() {
  902. const { value, done } = innerIterator.next();
  903. return done ? { value, done } : {
  904. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  905. done
  906. };
  907. },
  908. [Symbol.iterator]() {
  909. return this;
  910. }
  911. };
  912. };
  913. }
  914. function createReadonlyMethod(type) {
  915. return function(...args) {
  916. {
  917. const key = args[0] ? `on key "${args[0]}" ` : ``;
  918. console.warn(`${shared.capitalize(type)} operation ${key}failed: target is readonly.`, toRaw2(this));
  919. }
  920. return type === "delete" ? false : this;
  921. };
  922. }
  923. function createInstrumentations() {
  924. const mutableInstrumentations2 = {
  925. get(key) {
  926. return get$1(this, key);
  927. },
  928. get size() {
  929. return size(this);
  930. },
  931. has: has$1,
  932. add,
  933. set: set$1,
  934. delete: deleteEntry,
  935. clear,
  936. forEach: createForEach(false, false)
  937. };
  938. const shallowInstrumentations2 = {
  939. get(key) {
  940. return get$1(this, key, false, true);
  941. },
  942. get size() {
  943. return size(this);
  944. },
  945. has: has$1,
  946. add,
  947. set: set$1,
  948. delete: deleteEntry,
  949. clear,
  950. forEach: createForEach(false, true)
  951. };
  952. const readonlyInstrumentations2 = {
  953. get(key) {
  954. return get$1(this, key, true);
  955. },
  956. get size() {
  957. return size(this, true);
  958. },
  959. has(key) {
  960. return has$1.call(this, key, true);
  961. },
  962. add: createReadonlyMethod("add"),
  963. set: createReadonlyMethod("set"),
  964. delete: createReadonlyMethod("delete"),
  965. clear: createReadonlyMethod("clear"),
  966. forEach: createForEach(true, false)
  967. };
  968. const shallowReadonlyInstrumentations2 = {
  969. get(key) {
  970. return get$1(this, key, true, true);
  971. },
  972. get size() {
  973. return size(this, true);
  974. },
  975. has(key) {
  976. return has$1.call(this, key, true);
  977. },
  978. add: createReadonlyMethod("add"),
  979. set: createReadonlyMethod("set"),
  980. delete: createReadonlyMethod("delete"),
  981. clear: createReadonlyMethod("clear"),
  982. forEach: createForEach(true, true)
  983. };
  984. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  985. iteratorMethods.forEach((method) => {
  986. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  987. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  988. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  989. shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true);
  990. });
  991. return [
  992. mutableInstrumentations2,
  993. readonlyInstrumentations2,
  994. shallowInstrumentations2,
  995. shallowReadonlyInstrumentations2
  996. ];
  997. }
  998. var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */ createInstrumentations();
  999. function createInstrumentationGetter(isReadonly2, shallow) {
  1000. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  1001. return (target, key, receiver) => {
  1002. if (key === "__v_isReactive") {
  1003. return !isReadonly2;
  1004. } else if (key === "__v_isReadonly") {
  1005. return isReadonly2;
  1006. } else if (key === "__v_raw") {
  1007. return target;
  1008. }
  1009. return Reflect.get(shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
  1010. };
  1011. }
  1012. var mutableCollectionHandlers = {
  1013. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1014. };
  1015. var shallowCollectionHandlers = {
  1016. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1017. };
  1018. var readonlyCollectionHandlers = {
  1019. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1020. };
  1021. var shallowReadonlyCollectionHandlers = {
  1022. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1023. };
  1024. function checkIdentityKeys(target, has2, key) {
  1025. const rawKey = toRaw2(key);
  1026. if (rawKey !== key && has2.call(target, rawKey)) {
  1027. const type = shared.toRawType(target);
  1028. console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
  1029. }
  1030. }
  1031. var reactiveMap = /* @__PURE__ */ new WeakMap();
  1032. var shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1033. var readonlyMap = /* @__PURE__ */ new WeakMap();
  1034. var shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1035. function targetTypeMap(rawType) {
  1036. switch (rawType) {
  1037. case "Object":
  1038. case "Array":
  1039. return 1;
  1040. case "Map":
  1041. case "Set":
  1042. case "WeakMap":
  1043. case "WeakSet":
  1044. return 2;
  1045. default:
  1046. return 0;
  1047. }
  1048. }
  1049. function getTargetType(value) {
  1050. return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(shared.toRawType(value));
  1051. }
  1052. function reactive3(target) {
  1053. if (target && target["__v_isReadonly"]) {
  1054. return target;
  1055. }
  1056. return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
  1057. }
  1058. function shallowReactive(target) {
  1059. return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
  1060. }
  1061. function readonly(target) {
  1062. return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
  1063. }
  1064. function shallowReadonly(target) {
  1065. return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
  1066. }
  1067. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1068. if (!shared.isObject(target)) {
  1069. {
  1070. console.warn(`value cannot be made reactive: ${String(target)}`);
  1071. }
  1072. return target;
  1073. }
  1074. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1075. return target;
  1076. }
  1077. const existingProxy = proxyMap.get(target);
  1078. if (existingProxy) {
  1079. return existingProxy;
  1080. }
  1081. const targetType = getTargetType(target);
  1082. if (targetType === 0) {
  1083. return target;
  1084. }
  1085. const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
  1086. proxyMap.set(target, proxy);
  1087. return proxy;
  1088. }
  1089. function isReactive2(value) {
  1090. if (isReadonly(value)) {
  1091. return isReactive2(value["__v_raw"]);
  1092. }
  1093. return !!(value && value["__v_isReactive"]);
  1094. }
  1095. function isReadonly(value) {
  1096. return !!(value && value["__v_isReadonly"]);
  1097. }
  1098. function isProxy(value) {
  1099. return isReactive2(value) || isReadonly(value);
  1100. }
  1101. function toRaw2(observed) {
  1102. return observed && toRaw2(observed["__v_raw"]) || observed;
  1103. }
  1104. function markRaw(value) {
  1105. shared.def(value, "__v_skip", true);
  1106. return value;
  1107. }
  1108. var convert = (val) => shared.isObject(val) ? reactive3(val) : val;
  1109. function isRef(r) {
  1110. return Boolean(r && r.__v_isRef === true);
  1111. }
  1112. function ref(value) {
  1113. return createRef(value);
  1114. }
  1115. function shallowRef(value) {
  1116. return createRef(value, true);
  1117. }
  1118. var RefImpl = class {
  1119. constructor(value, _shallow = false) {
  1120. this._shallow = _shallow;
  1121. this.__v_isRef = true;
  1122. this._rawValue = _shallow ? value : toRaw2(value);
  1123. this._value = _shallow ? value : convert(value);
  1124. }
  1125. get value() {
  1126. track2(toRaw2(this), "get", "value");
  1127. return this._value;
  1128. }
  1129. set value(newVal) {
  1130. newVal = this._shallow ? newVal : toRaw2(newVal);
  1131. if (shared.hasChanged(newVal, this._rawValue)) {
  1132. this._rawValue = newVal;
  1133. this._value = this._shallow ? newVal : convert(newVal);
  1134. trigger2(toRaw2(this), "set", "value", newVal);
  1135. }
  1136. }
  1137. };
  1138. function createRef(rawValue, shallow = false) {
  1139. if (isRef(rawValue)) {
  1140. return rawValue;
  1141. }
  1142. return new RefImpl(rawValue, shallow);
  1143. }
  1144. function triggerRef(ref2) {
  1145. trigger2(toRaw2(ref2), "set", "value", ref2.value);
  1146. }
  1147. function unref(ref2) {
  1148. return isRef(ref2) ? ref2.value : ref2;
  1149. }
  1150. var shallowUnwrapHandlers = {
  1151. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1152. set: (target, key, value, receiver) => {
  1153. const oldValue = target[key];
  1154. if (isRef(oldValue) && !isRef(value)) {
  1155. oldValue.value = value;
  1156. return true;
  1157. } else {
  1158. return Reflect.set(target, key, value, receiver);
  1159. }
  1160. }
  1161. };
  1162. function proxyRefs(objectWithRefs) {
  1163. return isReactive2(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1164. }
  1165. var CustomRefImpl = class {
  1166. constructor(factory) {
  1167. this.__v_isRef = true;
  1168. const { get: get3, set: set3 } = factory(() => track2(this, "get", "value"), () => trigger2(this, "set", "value"));
  1169. this._get = get3;
  1170. this._set = set3;
  1171. }
  1172. get value() {
  1173. return this._get();
  1174. }
  1175. set value(newVal) {
  1176. this._set(newVal);
  1177. }
  1178. };
  1179. function customRef(factory) {
  1180. return new CustomRefImpl(factory);
  1181. }
  1182. function toRefs(object) {
  1183. if (!isProxy(object)) {
  1184. console.warn(`toRefs() expects a reactive object but received a plain one.`);
  1185. }
  1186. const ret = shared.isArray(object) ? new Array(object.length) : {};
  1187. for (const key in object) {
  1188. ret[key] = toRef(object, key);
  1189. }
  1190. return ret;
  1191. }
  1192. var ObjectRefImpl = class {
  1193. constructor(_object, _key) {
  1194. this._object = _object;
  1195. this._key = _key;
  1196. this.__v_isRef = true;
  1197. }
  1198. get value() {
  1199. return this._object[this._key];
  1200. }
  1201. set value(newVal) {
  1202. this._object[this._key] = newVal;
  1203. }
  1204. };
  1205. function toRef(object, key) {
  1206. return isRef(object[key]) ? object[key] : new ObjectRefImpl(object, key);
  1207. }
  1208. var ComputedRefImpl = class {
  1209. constructor(getter, _setter, isReadonly2) {
  1210. this._setter = _setter;
  1211. this._dirty = true;
  1212. this.__v_isRef = true;
  1213. this.effect = effect3(getter, {
  1214. lazy: true,
  1215. scheduler: () => {
  1216. if (!this._dirty) {
  1217. this._dirty = true;
  1218. trigger2(toRaw2(this), "set", "value");
  1219. }
  1220. }
  1221. });
  1222. this["__v_isReadonly"] = isReadonly2;
  1223. }
  1224. get value() {
  1225. const self2 = toRaw2(this);
  1226. if (self2._dirty) {
  1227. self2._value = this.effect();
  1228. self2._dirty = false;
  1229. }
  1230. track2(self2, "get", "value");
  1231. return self2._value;
  1232. }
  1233. set value(newValue) {
  1234. this._setter(newValue);
  1235. }
  1236. };
  1237. function computed(getterOrOptions) {
  1238. let getter;
  1239. let setter;
  1240. if (shared.isFunction(getterOrOptions)) {
  1241. getter = getterOrOptions;
  1242. setter = () => {
  1243. console.warn("Write operation failed: computed value is readonly");
  1244. };
  1245. } else {
  1246. getter = getterOrOptions.get;
  1247. setter = getterOrOptions.set;
  1248. }
  1249. return new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
  1250. }
  1251. exports2.ITERATE_KEY = ITERATE_KEY;
  1252. exports2.computed = computed;
  1253. exports2.customRef = customRef;
  1254. exports2.effect = effect3;
  1255. exports2.enableTracking = enableTracking;
  1256. exports2.isProxy = isProxy;
  1257. exports2.isReactive = isReactive2;
  1258. exports2.isReadonly = isReadonly;
  1259. exports2.isRef = isRef;
  1260. exports2.markRaw = markRaw;
  1261. exports2.pauseTracking = pauseTracking;
  1262. exports2.proxyRefs = proxyRefs;
  1263. exports2.reactive = reactive3;
  1264. exports2.readonly = readonly;
  1265. exports2.ref = ref;
  1266. exports2.resetTracking = resetTracking;
  1267. exports2.shallowReactive = shallowReactive;
  1268. exports2.shallowReadonly = shallowReadonly;
  1269. exports2.shallowRef = shallowRef;
  1270. exports2.stop = stop2;
  1271. exports2.toRaw = toRaw2;
  1272. exports2.toRef = toRef;
  1273. exports2.toRefs = toRefs;
  1274. exports2.track = track2;
  1275. exports2.trigger = trigger2;
  1276. exports2.triggerRef = triggerRef;
  1277. exports2.unref = unref;
  1278. }
  1279. });
  1280. var require_reactivity = __commonJS2({
  1281. "node_modules/@vue/reactivity/index.js"(exports2, module2) {
  1282. "use strict";
  1283. if (false) {
  1284. module2.exports = null;
  1285. } else {
  1286. module2.exports = require_reactivity_cjs();
  1287. }
  1288. }
  1289. });
  1290. var module_exports = {};
  1291. __export(module_exports, {
  1292. Alpine: () => src_default,
  1293. default: () => module_default
  1294. });
  1295. module.exports = __toCommonJS(module_exports);
  1296. var flushPending = false;
  1297. var flushing = false;
  1298. var queue = [];
  1299. var lastFlushedIndex = -1;
  1300. function scheduler(callback) {
  1301. queueJob(callback);
  1302. }
  1303. function queueJob(job) {
  1304. if (!queue.includes(job))
  1305. queue.push(job);
  1306. queueFlush();
  1307. }
  1308. function dequeueJob(job) {
  1309. let index = queue.indexOf(job);
  1310. if (index !== -1 && index > lastFlushedIndex)
  1311. queue.splice(index, 1);
  1312. }
  1313. function queueFlush() {
  1314. if (!flushing && !flushPending) {
  1315. flushPending = true;
  1316. queueMicrotask(flushJobs);
  1317. }
  1318. }
  1319. function flushJobs() {
  1320. flushPending = false;
  1321. flushing = true;
  1322. for (let i = 0; i < queue.length; i++) {
  1323. queue[i]();
  1324. lastFlushedIndex = i;
  1325. }
  1326. queue.length = 0;
  1327. lastFlushedIndex = -1;
  1328. flushing = false;
  1329. }
  1330. var reactive;
  1331. var effect;
  1332. var release;
  1333. var raw;
  1334. var shouldSchedule = true;
  1335. function disableEffectScheduling(callback) {
  1336. shouldSchedule = false;
  1337. callback();
  1338. shouldSchedule = true;
  1339. }
  1340. function setReactivityEngine(engine) {
  1341. reactive = engine.reactive;
  1342. release = engine.release;
  1343. effect = (callback) => engine.effect(callback, { scheduler: (task) => {
  1344. if (shouldSchedule) {
  1345. scheduler(task);
  1346. } else {
  1347. task();
  1348. }
  1349. } });
  1350. raw = engine.raw;
  1351. }
  1352. function overrideEffect(override) {
  1353. effect = override;
  1354. }
  1355. function elementBoundEffect(el) {
  1356. let cleanup = () => {
  1357. };
  1358. let wrappedEffect = (callback) => {
  1359. let effectReference = effect(callback);
  1360. if (!el._x_effects) {
  1361. el._x_effects = /* @__PURE__ */ new Set();
  1362. el._x_runEffects = () => {
  1363. el._x_effects.forEach((i) => i());
  1364. };
  1365. }
  1366. el._x_effects.add(effectReference);
  1367. cleanup = () => {
  1368. if (effectReference === void 0)
  1369. return;
  1370. el._x_effects.delete(effectReference);
  1371. release(effectReference);
  1372. };
  1373. return effectReference;
  1374. };
  1375. return [wrappedEffect, () => {
  1376. cleanup();
  1377. }];
  1378. }
  1379. function watch(getter, callback) {
  1380. let firstTime = true;
  1381. let oldValue;
  1382. let effectReference = effect(() => {
  1383. let value = getter();
  1384. JSON.stringify(value);
  1385. if (!firstTime) {
  1386. queueMicrotask(() => {
  1387. callback(value, oldValue);
  1388. oldValue = value;
  1389. });
  1390. } else {
  1391. oldValue = value;
  1392. }
  1393. firstTime = false;
  1394. });
  1395. return () => release(effectReference);
  1396. }
  1397. var onAttributeAddeds = [];
  1398. var onElRemoveds = [];
  1399. var onElAddeds = [];
  1400. function onElAdded(callback) {
  1401. onElAddeds.push(callback);
  1402. }
  1403. function onElRemoved(el, callback) {
  1404. if (typeof callback === "function") {
  1405. if (!el._x_cleanups)
  1406. el._x_cleanups = [];
  1407. el._x_cleanups.push(callback);
  1408. } else {
  1409. callback = el;
  1410. onElRemoveds.push(callback);
  1411. }
  1412. }
  1413. function onAttributesAdded(callback) {
  1414. onAttributeAddeds.push(callback);
  1415. }
  1416. function onAttributeRemoved(el, name, callback) {
  1417. if (!el._x_attributeCleanups)
  1418. el._x_attributeCleanups = {};
  1419. if (!el._x_attributeCleanups[name])
  1420. el._x_attributeCleanups[name] = [];
  1421. el._x_attributeCleanups[name].push(callback);
  1422. }
  1423. function cleanupAttributes(el, names) {
  1424. if (!el._x_attributeCleanups)
  1425. return;
  1426. Object.entries(el._x_attributeCleanups).forEach(([name, value]) => {
  1427. if (names === void 0 || names.includes(name)) {
  1428. value.forEach((i) => i());
  1429. delete el._x_attributeCleanups[name];
  1430. }
  1431. });
  1432. }
  1433. function cleanupElement(el) {
  1434. var _a, _b;
  1435. (_a = el._x_effects) == null ? void 0 : _a.forEach(dequeueJob);
  1436. while ((_b = el._x_cleanups) == null ? void 0 : _b.length)
  1437. el._x_cleanups.pop()();
  1438. }
  1439. var observer = new MutationObserver(onMutate);
  1440. var currentlyObserving = false;
  1441. function startObservingMutations() {
  1442. observer.observe(document, { subtree: true, childList: true, attributes: true, attributeOldValue: true });
  1443. currentlyObserving = true;
  1444. }
  1445. function stopObservingMutations() {
  1446. flushObserver();
  1447. observer.disconnect();
  1448. currentlyObserving = false;
  1449. }
  1450. var queuedMutations = [];
  1451. function flushObserver() {
  1452. let records = observer.takeRecords();
  1453. queuedMutations.push(() => records.length > 0 && onMutate(records));
  1454. let queueLengthWhenTriggered = queuedMutations.length;
  1455. queueMicrotask(() => {
  1456. if (queuedMutations.length === queueLengthWhenTriggered) {
  1457. while (queuedMutations.length > 0)
  1458. queuedMutations.shift()();
  1459. }
  1460. });
  1461. }
  1462. function mutateDom(callback) {
  1463. if (!currentlyObserving)
  1464. return callback();
  1465. stopObservingMutations();
  1466. let result = callback();
  1467. startObservingMutations();
  1468. return result;
  1469. }
  1470. var isCollecting = false;
  1471. var deferredMutations = [];
  1472. function deferMutations() {
  1473. isCollecting = true;
  1474. }
  1475. function flushAndStopDeferringMutations() {
  1476. isCollecting = false;
  1477. onMutate(deferredMutations);
  1478. deferredMutations = [];
  1479. }
  1480. function onMutate(mutations) {
  1481. if (isCollecting) {
  1482. deferredMutations = deferredMutations.concat(mutations);
  1483. return;
  1484. }
  1485. let addedNodes = [];
  1486. let removedNodes = /* @__PURE__ */ new Set();
  1487. let addedAttributes = /* @__PURE__ */ new Map();
  1488. let removedAttributes = /* @__PURE__ */ new Map();
  1489. for (let i = 0; i < mutations.length; i++) {
  1490. if (mutations[i].target._x_ignoreMutationObserver)
  1491. continue;
  1492. if (mutations[i].type === "childList") {
  1493. mutations[i].removedNodes.forEach((node) => {
  1494. if (node.nodeType !== 1)
  1495. return;
  1496. if (!node._x_marker)
  1497. return;
  1498. removedNodes.add(node);
  1499. });
  1500. mutations[i].addedNodes.forEach((node) => {
  1501. if (node.nodeType !== 1)
  1502. return;
  1503. if (removedNodes.has(node)) {
  1504. removedNodes.delete(node);
  1505. return;
  1506. }
  1507. if (node._x_marker)
  1508. return;
  1509. addedNodes.push(node);
  1510. });
  1511. }
  1512. if (mutations[i].type === "attributes") {
  1513. let el = mutations[i].target;
  1514. let name = mutations[i].attributeName;
  1515. let oldValue = mutations[i].oldValue;
  1516. let add = () => {
  1517. if (!addedAttributes.has(el))
  1518. addedAttributes.set(el, []);
  1519. addedAttributes.get(el).push({ name, value: el.getAttribute(name) });
  1520. };
  1521. let remove = () => {
  1522. if (!removedAttributes.has(el))
  1523. removedAttributes.set(el, []);
  1524. removedAttributes.get(el).push(name);
  1525. };
  1526. if (el.hasAttribute(name) && oldValue === null) {
  1527. add();
  1528. } else if (el.hasAttribute(name)) {
  1529. remove();
  1530. add();
  1531. } else {
  1532. remove();
  1533. }
  1534. }
  1535. }
  1536. removedAttributes.forEach((attrs, el) => {
  1537. cleanupAttributes(el, attrs);
  1538. });
  1539. addedAttributes.forEach((attrs, el) => {
  1540. onAttributeAddeds.forEach((i) => i(el, attrs));
  1541. });
  1542. for (let node of removedNodes) {
  1543. if (addedNodes.some((i) => i.contains(node)))
  1544. continue;
  1545. onElRemoveds.forEach((i) => i(node));
  1546. }
  1547. for (let node of addedNodes) {
  1548. if (!node.isConnected)
  1549. continue;
  1550. onElAddeds.forEach((i) => i(node));
  1551. }
  1552. addedNodes = null;
  1553. removedNodes = null;
  1554. addedAttributes = null;
  1555. removedAttributes = null;
  1556. }
  1557. function scope(node) {
  1558. return mergeProxies(closestDataStack(node));
  1559. }
  1560. function addScopeToNode(node, data2, referenceNode) {
  1561. node._x_dataStack = [data2, ...closestDataStack(referenceNode || node)];
  1562. return () => {
  1563. node._x_dataStack = node._x_dataStack.filter((i) => i !== data2);
  1564. };
  1565. }
  1566. function closestDataStack(node) {
  1567. if (node._x_dataStack)
  1568. return node._x_dataStack;
  1569. if (typeof ShadowRoot === "function" && node instanceof ShadowRoot) {
  1570. return closestDataStack(node.host);
  1571. }
  1572. if (!node.parentNode) {
  1573. return [];
  1574. }
  1575. return closestDataStack(node.parentNode);
  1576. }
  1577. function mergeProxies(objects) {
  1578. return new Proxy({ objects }, mergeProxyTrap);
  1579. }
  1580. var mergeProxyTrap = {
  1581. ownKeys({ objects }) {
  1582. return Array.from(new Set(objects.flatMap((i) => Object.keys(i))));
  1583. },
  1584. has({ objects }, name) {
  1585. if (name == Symbol.unscopables)
  1586. return false;
  1587. return objects.some((obj) => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name));
  1588. },
  1589. get({ objects }, name, thisProxy) {
  1590. if (name == "toJSON")
  1591. return collapseProxies;
  1592. return Reflect.get(objects.find((obj) => Reflect.has(obj, name)) || {}, name, thisProxy);
  1593. },
  1594. set({ objects }, name, value, thisProxy) {
  1595. const target = objects.find((obj) => Object.prototype.hasOwnProperty.call(obj, name)) || objects[objects.length - 1];
  1596. const descriptor = Object.getOwnPropertyDescriptor(target, name);
  1597. if ((descriptor == null ? void 0 : descriptor.set) && (descriptor == null ? void 0 : descriptor.get))
  1598. return descriptor.set.call(thisProxy, value) || true;
  1599. return Reflect.set(target, name, value);
  1600. }
  1601. };
  1602. function collapseProxies() {
  1603. let keys = Reflect.ownKeys(this);
  1604. return keys.reduce((acc, key) => {
  1605. acc[key] = Reflect.get(this, key);
  1606. return acc;
  1607. }, {});
  1608. }
  1609. function initInterceptors(data2) {
  1610. let isObject2 = (val) => typeof val === "object" && !Array.isArray(val) && val !== null;
  1611. let recurse = (obj, basePath = "") => {
  1612. Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => {
  1613. if (enumerable === false || value === void 0)
  1614. return;
  1615. if (typeof value === "object" && value !== null && value.__v_skip)
  1616. return;
  1617. let path = basePath === "" ? key : `${basePath}.${key}`;
  1618. if (typeof value === "object" && value !== null && value._x_interceptor) {
  1619. obj[key] = value.initialize(data2, path, key);
  1620. } else {
  1621. if (isObject2(value) && value !== obj && !(value instanceof Element)) {
  1622. recurse(value, path);
  1623. }
  1624. }
  1625. });
  1626. };
  1627. return recurse(data2);
  1628. }
  1629. function interceptor(callback, mutateObj = () => {
  1630. }) {
  1631. let obj = {
  1632. initialValue: void 0,
  1633. _x_interceptor: true,
  1634. initialize(data2, path, key) {
  1635. return callback(this.initialValue, () => get(data2, path), (value) => set(data2, path, value), path, key);
  1636. }
  1637. };
  1638. mutateObj(obj);
  1639. return (initialValue) => {
  1640. if (typeof initialValue === "object" && initialValue !== null && initialValue._x_interceptor) {
  1641. let initialize = obj.initialize.bind(obj);
  1642. obj.initialize = (data2, path, key) => {
  1643. let innerValue = initialValue.initialize(data2, path, key);
  1644. obj.initialValue = innerValue;
  1645. return initialize(data2, path, key);
  1646. };
  1647. } else {
  1648. obj.initialValue = initialValue;
  1649. }
  1650. return obj;
  1651. };
  1652. }
  1653. function get(obj, path) {
  1654. return path.split(".").reduce((carry, segment) => carry[segment], obj);
  1655. }
  1656. function set(obj, path, value) {
  1657. if (typeof path === "string")
  1658. path = path.split(".");
  1659. if (path.length === 1)
  1660. obj[path[0]] = value;
  1661. else if (path.length === 0)
  1662. throw error;
  1663. else {
  1664. if (obj[path[0]])
  1665. return set(obj[path[0]], path.slice(1), value);
  1666. else {
  1667. obj[path[0]] = {};
  1668. return set(obj[path[0]], path.slice(1), value);
  1669. }
  1670. }
  1671. }
  1672. var magics = {};
  1673. function magic(name, callback) {
  1674. magics[name] = callback;
  1675. }
  1676. function injectMagics(obj, el) {
  1677. let memoizedUtilities = getUtilities(el);
  1678. Object.entries(magics).forEach(([name, callback]) => {
  1679. Object.defineProperty(obj, `$${name}`, {
  1680. get() {
  1681. return callback(el, memoizedUtilities);
  1682. },
  1683. enumerable: false
  1684. });
  1685. });
  1686. return obj;
  1687. }
  1688. function getUtilities(el) {
  1689. let [utilities, cleanup] = getElementBoundUtilities(el);
  1690. let utils = { interceptor, ...utilities };
  1691. onElRemoved(el, cleanup);
  1692. return utils;
  1693. }
  1694. function tryCatch(el, expression, callback, ...args) {
  1695. try {
  1696. return callback(...args);
  1697. } catch (e) {
  1698. handleError(e, el, expression);
  1699. }
  1700. }
  1701. function handleError(error2, el, expression = void 0) {
  1702. error2 = Object.assign(error2 != null ? error2 : { message: "No error message given." }, { el, expression });
  1703. console.warn(`Alpine Expression Error: ${error2.message}
  1704. ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
  1705. setTimeout(() => {
  1706. throw error2;
  1707. }, 0);
  1708. }
  1709. var shouldAutoEvaluateFunctions = true;
  1710. function dontAutoEvaluateFunctions(callback) {
  1711. let cache = shouldAutoEvaluateFunctions;
  1712. shouldAutoEvaluateFunctions = false;
  1713. let result = callback();
  1714. shouldAutoEvaluateFunctions = cache;
  1715. return result;
  1716. }
  1717. function evaluate(el, expression, extras = {}) {
  1718. let result;
  1719. evaluateLater(el, expression)((value) => result = value, extras);
  1720. return result;
  1721. }
  1722. function evaluateLater(...args) {
  1723. return theEvaluatorFunction(...args);
  1724. }
  1725. var theEvaluatorFunction = normalEvaluator;
  1726. function setEvaluator(newEvaluator) {
  1727. theEvaluatorFunction = newEvaluator;
  1728. }
  1729. function normalEvaluator(el, expression) {
  1730. let overriddenMagics = {};
  1731. injectMagics(overriddenMagics, el);
  1732. let dataStack = [overriddenMagics, ...closestDataStack(el)];
  1733. let evaluator = typeof expression === "function" ? generateEvaluatorFromFunction(dataStack, expression) : generateEvaluatorFromString(dataStack, expression, el);
  1734. return tryCatch.bind(null, el, expression, evaluator);
  1735. }
  1736. function generateEvaluatorFromFunction(dataStack, func) {
  1737. return (receiver = () => {
  1738. }, { scope: scope2 = {}, params = [] } = {}) => {
  1739. let result = func.apply(mergeProxies([scope2, ...dataStack]), params);
  1740. runIfTypeOfFunction(receiver, result);
  1741. };
  1742. }
  1743. var evaluatorMemo = {};
  1744. function generateFunctionFromString(expression, el) {
  1745. if (evaluatorMemo[expression]) {
  1746. return evaluatorMemo[expression];
  1747. }
  1748. let AsyncFunction = Object.getPrototypeOf(async function() {
  1749. }).constructor;
  1750. let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression;
  1751. const safeAsyncFunction = () => {
  1752. try {
  1753. let func2 = new AsyncFunction(["__self", "scope"], `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;`);
  1754. Object.defineProperty(func2, "name", {
  1755. value: `[Alpine] ${expression}`
  1756. });
  1757. return func2;
  1758. } catch (error2) {
  1759. handleError(error2, el, expression);
  1760. return Promise.resolve();
  1761. }
  1762. };
  1763. let func = safeAsyncFunction();
  1764. evaluatorMemo[expression] = func;
  1765. return func;
  1766. }
  1767. function generateEvaluatorFromString(dataStack, expression, el) {
  1768. let func = generateFunctionFromString(expression, el);
  1769. return (receiver = () => {
  1770. }, { scope: scope2 = {}, params = [] } = {}) => {
  1771. func.result = void 0;
  1772. func.finished = false;
  1773. let completeScope = mergeProxies([scope2, ...dataStack]);
  1774. if (typeof func === "function") {
  1775. let promise = func(func, completeScope).catch((error2) => handleError(error2, el, expression));
  1776. if (func.finished) {
  1777. runIfTypeOfFunction(receiver, func.result, completeScope, params, el);
  1778. func.result = void 0;
  1779. } else {
  1780. promise.then((result) => {
  1781. runIfTypeOfFunction(receiver, result, completeScope, params, el);
  1782. }).catch((error2) => handleError(error2, el, expression)).finally(() => func.result = void 0);
  1783. }
  1784. }
  1785. };
  1786. }
  1787. function runIfTypeOfFunction(receiver, value, scope2, params, el) {
  1788. if (shouldAutoEvaluateFunctions && typeof value === "function") {
  1789. let result = value.apply(scope2, params);
  1790. if (result instanceof Promise) {
  1791. result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));
  1792. } else {
  1793. receiver(result);
  1794. }
  1795. } else if (typeof value === "object" && value instanceof Promise) {
  1796. value.then((i) => receiver(i));
  1797. } else {
  1798. receiver(value);
  1799. }
  1800. }
  1801. var prefixAsString = "x-";
  1802. function prefix(subject = "") {
  1803. return prefixAsString + subject;
  1804. }
  1805. function setPrefix(newPrefix) {
  1806. prefixAsString = newPrefix;
  1807. }
  1808. var directiveHandlers = {};
  1809. function directive2(name, callback) {
  1810. directiveHandlers[name] = callback;
  1811. return {
  1812. before(directive22) {
  1813. if (!directiveHandlers[directive22]) {
  1814. console.warn(String.raw`Cannot find directive \`${directive22}\`. \`${name}\` will use the default order of execution`);
  1815. return;
  1816. }
  1817. const pos = directiveOrder.indexOf(directive22);
  1818. directiveOrder.splice(pos >= 0 ? pos : directiveOrder.indexOf("DEFAULT"), 0, name);
  1819. }
  1820. };
  1821. }
  1822. function directiveExists(name) {
  1823. return Object.keys(directiveHandlers).includes(name);
  1824. }
  1825. function directives(el, attributes, originalAttributeOverride) {
  1826. attributes = Array.from(attributes);
  1827. if (el._x_virtualDirectives) {
  1828. let vAttributes = Object.entries(el._x_virtualDirectives).map(([name, value]) => ({ name, value }));
  1829. let staticAttributes = attributesOnly(vAttributes);
  1830. vAttributes = vAttributes.map((attribute) => {
  1831. if (staticAttributes.find((attr) => attr.name === attribute.name)) {
  1832. return {
  1833. name: `x-bind:${attribute.name}`,
  1834. value: `"${attribute.value}"`
  1835. };
  1836. }
  1837. return attribute;
  1838. });
  1839. attributes = attributes.concat(vAttributes);
  1840. }
  1841. let transformedAttributeMap = {};
  1842. let directives2 = attributes.map(toTransformedAttributes((newName, oldName) => transformedAttributeMap[newName] = oldName)).filter(outNonAlpineAttributes).map(toParsedDirectives(transformedAttributeMap, originalAttributeOverride)).sort(byPriority);
  1843. return directives2.map((directive22) => {
  1844. return getDirectiveHandler(el, directive22);
  1845. });
  1846. }
  1847. function attributesOnly(attributes) {
  1848. return Array.from(attributes).map(toTransformedAttributes()).filter((attr) => !outNonAlpineAttributes(attr));
  1849. }
  1850. var isDeferringHandlers = false;
  1851. var directiveHandlerStacks = /* @__PURE__ */ new Map();
  1852. var currentHandlerStackKey = Symbol();
  1853. function deferHandlingDirectives(callback) {
  1854. isDeferringHandlers = true;
  1855. let key = Symbol();
  1856. currentHandlerStackKey = key;
  1857. directiveHandlerStacks.set(key, []);
  1858. let flushHandlers = () => {
  1859. while (directiveHandlerStacks.get(key).length)
  1860. directiveHandlerStacks.get(key).shift()();
  1861. directiveHandlerStacks.delete(key);
  1862. };
  1863. let stopDeferring = () => {
  1864. isDeferringHandlers = false;
  1865. flushHandlers();
  1866. };
  1867. callback(flushHandlers);
  1868. stopDeferring();
  1869. }
  1870. function getElementBoundUtilities(el) {
  1871. let cleanups2 = [];
  1872. let cleanup = (callback) => cleanups2.push(callback);
  1873. let [effect3, cleanupEffect] = elementBoundEffect(el);
  1874. cleanups2.push(cleanupEffect);
  1875. let utilities = {
  1876. Alpine: alpine_default,
  1877. effect: effect3,
  1878. cleanup,
  1879. evaluateLater: evaluateLater.bind(evaluateLater, el),
  1880. evaluate: evaluate.bind(evaluate, el)
  1881. };
  1882. let doCleanup = () => cleanups2.forEach((i) => i());
  1883. return [utilities, doCleanup];
  1884. }
  1885. function getDirectiveHandler(el, directive22) {
  1886. let noop = () => {
  1887. };
  1888. let handler4 = directiveHandlers[directive22.type] || noop;
  1889. let [utilities, cleanup] = getElementBoundUtilities(el);
  1890. onAttributeRemoved(el, directive22.original, cleanup);
  1891. let fullHandler = () => {
  1892. if (el._x_ignore || el._x_ignoreSelf)
  1893. return;
  1894. handler4.inline && handler4.inline(el, directive22, utilities);
  1895. handler4 = handler4.bind(handler4, el, directive22, utilities);
  1896. isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler4) : handler4();
  1897. };
  1898. fullHandler.runCleanups = cleanup;
  1899. return fullHandler;
  1900. }
  1901. var startingWith = (subject, replacement) => ({ name, value }) => {
  1902. if (name.startsWith(subject))
  1903. name = name.replace(subject, replacement);
  1904. return { name, value };
  1905. };
  1906. var into = (i) => i;
  1907. function toTransformedAttributes(callback = () => {
  1908. }) {
  1909. return ({ name, value }) => {
  1910. let { name: newName, value: newValue } = attributeTransformers.reduce((carry, transform) => {
  1911. return transform(carry);
  1912. }, { name, value });
  1913. if (newName !== name)
  1914. callback(newName, name);
  1915. return { name: newName, value: newValue };
  1916. };
  1917. }
  1918. var attributeTransformers = [];
  1919. function mapAttributes(callback) {
  1920. attributeTransformers.push(callback);
  1921. }
  1922. function outNonAlpineAttributes({ name }) {
  1923. return alpineAttributeRegex().test(name);
  1924. }
  1925. var alpineAttributeRegex = () => new RegExp(`^${prefixAsString}([^:^.]+)\\b`);
  1926. function toParsedDirectives(transformedAttributeMap, originalAttributeOverride) {
  1927. return ({ name, value }) => {
  1928. let typeMatch = name.match(alpineAttributeRegex());
  1929. let valueMatch = name.match(/:([a-zA-Z0-9\-_:]+)/);
  1930. let modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || [];
  1931. let original = originalAttributeOverride || transformedAttributeMap[name] || name;
  1932. return {
  1933. type: typeMatch ? typeMatch[1] : null,
  1934. value: valueMatch ? valueMatch[1] : null,
  1935. modifiers: modifiers.map((i) => i.replace(".", "")),
  1936. expression: value,
  1937. original
  1938. };
  1939. };
  1940. }
  1941. var DEFAULT = "DEFAULT";
  1942. var directiveOrder = [
  1943. "ignore",
  1944. "ref",
  1945. "data",
  1946. "id",
  1947. "anchor",
  1948. "bind",
  1949. "init",
  1950. "for",
  1951. "model",
  1952. "modelable",
  1953. "transition",
  1954. "show",
  1955. "if",
  1956. DEFAULT,
  1957. "teleport"
  1958. ];
  1959. function byPriority(a, b) {
  1960. let typeA = directiveOrder.indexOf(a.type) === -1 ? DEFAULT : a.type;
  1961. let typeB = directiveOrder.indexOf(b.type) === -1 ? DEFAULT : b.type;
  1962. return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);
  1963. }
  1964. function dispatch3(el, name, detail = {}) {
  1965. el.dispatchEvent(new CustomEvent(name, {
  1966. detail,
  1967. bubbles: true,
  1968. composed: true,
  1969. cancelable: true
  1970. }));
  1971. }
  1972. function walk(el, callback) {
  1973. if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) {
  1974. Array.from(el.children).forEach((el2) => walk(el2, callback));
  1975. return;
  1976. }
  1977. let skip = false;
  1978. callback(el, () => skip = true);
  1979. if (skip)
  1980. return;
  1981. let node = el.firstElementChild;
  1982. while (node) {
  1983. walk(node, callback, false);
  1984. node = node.nextElementSibling;
  1985. }
  1986. }
  1987. function warn(message, ...args) {
  1988. console.warn(`Alpine Warning: ${message}`, ...args);
  1989. }
  1990. var started = false;
  1991. function start2() {
  1992. if (started)
  1993. warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems.");
  1994. started = true;
  1995. if (!document.body)
  1996. warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?");
  1997. dispatch3(document, "alpine:init");
  1998. dispatch3(document, "alpine:initializing");
  1999. startObservingMutations();
  2000. onElAdded((el) => initTree(el, walk));
  2001. onElRemoved((el) => destroyTree(el));
  2002. onAttributesAdded((el, attrs) => {
  2003. directives(el, attrs).forEach((handle) => handle());
  2004. });
  2005. let outNestedComponents = (el) => !closestRoot(el.parentElement, true);
  2006. Array.from(document.querySelectorAll(allSelectors().join(","))).filter(outNestedComponents).forEach((el) => {
  2007. initTree(el);
  2008. });
  2009. dispatch3(document, "alpine:initialized");
  2010. setTimeout(() => {
  2011. warnAboutMissingPlugins();
  2012. });
  2013. }
  2014. var rootSelectorCallbacks = [];
  2015. var initSelectorCallbacks = [];
  2016. function rootSelectors() {
  2017. return rootSelectorCallbacks.map((fn) => fn());
  2018. }
  2019. function allSelectors() {
  2020. return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn) => fn());
  2021. }
  2022. function addRootSelector(selectorCallback) {
  2023. rootSelectorCallbacks.push(selectorCallback);
  2024. }
  2025. function addInitSelector(selectorCallback) {
  2026. initSelectorCallbacks.push(selectorCallback);
  2027. }
  2028. function closestRoot(el, includeInitSelectors = false) {
  2029. return findClosest(el, (element) => {
  2030. const selectors = includeInitSelectors ? allSelectors() : rootSelectors();
  2031. if (selectors.some((selector) => element.matches(selector)))
  2032. return true;
  2033. });
  2034. }
  2035. function findClosest(el, callback) {
  2036. if (!el)
  2037. return;
  2038. if (callback(el))
  2039. return el;
  2040. if (el._x_teleportBack)
  2041. el = el._x_teleportBack;
  2042. if (!el.parentElement)
  2043. return;
  2044. return findClosest(el.parentElement, callback);
  2045. }
  2046. function isRoot(el) {
  2047. return rootSelectors().some((selector) => el.matches(selector));
  2048. }
  2049. var initInterceptors2 = [];
  2050. function interceptInit(callback) {
  2051. initInterceptors2.push(callback);
  2052. }
  2053. var markerDispenser = 1;
  2054. function initTree(el, walker = walk, intercept = () => {
  2055. }) {
  2056. if (findClosest(el, (i) => i._x_ignore))
  2057. return;
  2058. deferHandlingDirectives(() => {
  2059. walker(el, (el2, skip) => {
  2060. if (el2._x_marker)
  2061. return;
  2062. intercept(el2, skip);
  2063. initInterceptors2.forEach((i) => i(el2, skip));
  2064. directives(el2, el2.attributes).forEach((handle) => handle());
  2065. if (!el2._x_ignore)
  2066. el2._x_marker = markerDispenser++;
  2067. el2._x_ignore && skip();
  2068. });
  2069. });
  2070. }
  2071. function destroyTree(root, walker = walk) {
  2072. walker(root, (el) => {
  2073. cleanupElement(el);
  2074. cleanupAttributes(el);
  2075. delete el._x_marker;
  2076. });
  2077. }
  2078. function warnAboutMissingPlugins() {
  2079. let pluginDirectives = [
  2080. ["ui", "dialog", ["[x-dialog], [x-popover]"]],
  2081. ["anchor", "anchor", ["[x-anchor]"]],
  2082. ["sort", "sort", ["[x-sort]"]]
  2083. ];
  2084. pluginDirectives.forEach(([plugin2, directive22, selectors]) => {
  2085. if (directiveExists(directive22))
  2086. return;
  2087. selectors.some((selector) => {
  2088. if (document.querySelector(selector)) {
  2089. warn(`found "${selector}", but missing ${plugin2} plugin`);
  2090. return true;
  2091. }
  2092. });
  2093. });
  2094. }
  2095. var tickStack = [];
  2096. var isHolding = false;
  2097. function nextTick(callback = () => {
  2098. }) {
  2099. queueMicrotask(() => {
  2100. isHolding || setTimeout(() => {
  2101. releaseNextTicks();
  2102. });
  2103. });
  2104. return new Promise((res) => {
  2105. tickStack.push(() => {
  2106. callback();
  2107. res();
  2108. });
  2109. });
  2110. }
  2111. function releaseNextTicks() {
  2112. isHolding = false;
  2113. while (tickStack.length)
  2114. tickStack.shift()();
  2115. }
  2116. function holdNextTicks() {
  2117. isHolding = true;
  2118. }
  2119. function setClasses(el, value) {
  2120. if (Array.isArray(value)) {
  2121. return setClassesFromString(el, value.join(" "));
  2122. } else if (typeof value === "object" && value !== null) {
  2123. return setClassesFromObject(el, value);
  2124. } else if (typeof value === "function") {
  2125. return setClasses(el, value());
  2126. }
  2127. return setClassesFromString(el, value);
  2128. }
  2129. function setClassesFromString(el, classString) {
  2130. let split = (classString2) => classString2.split(" ").filter(Boolean);
  2131. let missingClasses = (classString2) => classString2.split(" ").filter((i) => !el.classList.contains(i)).filter(Boolean);
  2132. let addClassesAndReturnUndo = (classes) => {
  2133. el.classList.add(...classes);
  2134. return () => {
  2135. el.classList.remove(...classes);
  2136. };
  2137. };
  2138. classString = classString === true ? classString = "" : classString || "";
  2139. return addClassesAndReturnUndo(missingClasses(classString));
  2140. }
  2141. function setClassesFromObject(el, classObject) {
  2142. let split = (classString) => classString.split(" ").filter(Boolean);
  2143. let forAdd = Object.entries(classObject).flatMap(([classString, bool]) => bool ? split(classString) : false).filter(Boolean);
  2144. let forRemove = Object.entries(classObject).flatMap(([classString, bool]) => !bool ? split(classString) : false).filter(Boolean);
  2145. let added = [];
  2146. let removed = [];
  2147. forRemove.forEach((i) => {
  2148. if (el.classList.contains(i)) {
  2149. el.classList.remove(i);
  2150. removed.push(i);
  2151. }
  2152. });
  2153. forAdd.forEach((i) => {
  2154. if (!el.classList.contains(i)) {
  2155. el.classList.add(i);
  2156. added.push(i);
  2157. }
  2158. });
  2159. return () => {
  2160. removed.forEach((i) => el.classList.add(i));
  2161. added.forEach((i) => el.classList.remove(i));
  2162. };
  2163. }
  2164. function setStyles(el, value) {
  2165. if (typeof value === "object" && value !== null) {
  2166. return setStylesFromObject(el, value);
  2167. }
  2168. return setStylesFromString(el, value);
  2169. }
  2170. function setStylesFromObject(el, value) {
  2171. let previousStyles = {};
  2172. Object.entries(value).forEach(([key, value2]) => {
  2173. previousStyles[key] = el.style[key];
  2174. if (!key.startsWith("--")) {
  2175. key = kebabCase(key);
  2176. }
  2177. el.style.setProperty(key, value2);
  2178. });
  2179. setTimeout(() => {
  2180. if (el.style.length === 0) {
  2181. el.removeAttribute("style");
  2182. }
  2183. });
  2184. return () => {
  2185. setStyles(el, previousStyles);
  2186. };
  2187. }
  2188. function setStylesFromString(el, value) {
  2189. let cache = el.getAttribute("style", value);
  2190. el.setAttribute("style", value);
  2191. return () => {
  2192. el.setAttribute("style", cache || "");
  2193. };
  2194. }
  2195. function kebabCase(subject) {
  2196. return subject.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
  2197. }
  2198. function once(callback, fallback2 = () => {
  2199. }) {
  2200. let called = false;
  2201. return function() {
  2202. if (!called) {
  2203. called = true;
  2204. callback.apply(this, arguments);
  2205. } else {
  2206. fallback2.apply(this, arguments);
  2207. }
  2208. };
  2209. }
  2210. directive2("transition", (el, { value, modifiers, expression }, { evaluate: evaluate2 }) => {
  2211. if (typeof expression === "function")
  2212. expression = evaluate2(expression);
  2213. if (expression === false)
  2214. return;
  2215. if (!expression || typeof expression === "boolean") {
  2216. registerTransitionsFromHelper(el, modifiers, value);
  2217. } else {
  2218. registerTransitionsFromClassString(el, expression, value);
  2219. }
  2220. });
  2221. function registerTransitionsFromClassString(el, classString, stage) {
  2222. registerTransitionObject(el, setClasses, "");
  2223. let directiveStorageMap = {
  2224. "enter": (classes) => {
  2225. el._x_transition.enter.during = classes;
  2226. },
  2227. "enter-start": (classes) => {
  2228. el._x_transition.enter.start = classes;
  2229. },
  2230. "enter-end": (classes) => {
  2231. el._x_transition.enter.end = classes;
  2232. },
  2233. "leave": (classes) => {
  2234. el._x_transition.leave.during = classes;
  2235. },
  2236. "leave-start": (classes) => {
  2237. el._x_transition.leave.start = classes;
  2238. },
  2239. "leave-end": (classes) => {
  2240. el._x_transition.leave.end = classes;
  2241. }
  2242. };
  2243. directiveStorageMap[stage](classString);
  2244. }
  2245. function registerTransitionsFromHelper(el, modifiers, stage) {
  2246. registerTransitionObject(el, setStyles);
  2247. let doesntSpecify = !modifiers.includes("in") && !modifiers.includes("out") && !stage;
  2248. let transitioningIn = doesntSpecify || modifiers.includes("in") || ["enter"].includes(stage);
  2249. let transitioningOut = doesntSpecify || modifiers.includes("out") || ["leave"].includes(stage);
  2250. if (modifiers.includes("in") && !doesntSpecify) {
  2251. modifiers = modifiers.filter((i, index) => index < modifiers.indexOf("out"));
  2252. }
  2253. if (modifiers.includes("out") && !doesntSpecify) {
  2254. modifiers = modifiers.filter((i, index) => index > modifiers.indexOf("out"));
  2255. }
  2256. let wantsAll = !modifiers.includes("opacity") && !modifiers.includes("scale");
  2257. let wantsOpacity = wantsAll || modifiers.includes("opacity");
  2258. let wantsScale = wantsAll || modifiers.includes("scale");
  2259. let opacityValue = wantsOpacity ? 0 : 1;
  2260. let scaleValue = wantsScale ? modifierValue(modifiers, "scale", 95) / 100 : 1;
  2261. let delay = modifierValue(modifiers, "delay", 0) / 1e3;
  2262. let origin = modifierValue(modifiers, "origin", "center");
  2263. let property = "opacity, transform";
  2264. let durationIn = modifierValue(modifiers, "duration", 150) / 1e3;
  2265. let durationOut = modifierValue(modifiers, "duration", 75) / 1e3;
  2266. let easing = `cubic-bezier(0.4, 0.0, 0.2, 1)`;
  2267. if (transitioningIn) {
  2268. el._x_transition.enter.during = {
  2269. transformOrigin: origin,
  2270. transitionDelay: `${delay}s`,
  2271. transitionProperty: property,
  2272. transitionDuration: `${durationIn}s`,
  2273. transitionTimingFunction: easing
  2274. };
  2275. el._x_transition.enter.start = {
  2276. opacity: opacityValue,
  2277. transform: `scale(${scaleValue})`
  2278. };
  2279. el._x_transition.enter.end = {
  2280. opacity: 1,
  2281. transform: `scale(1)`
  2282. };
  2283. }
  2284. if (transitioningOut) {
  2285. el._x_transition.leave.during = {
  2286. transformOrigin: origin,
  2287. transitionDelay: `${delay}s`,
  2288. transitionProperty: property,
  2289. transitionDuration: `${durationOut}s`,
  2290. transitionTimingFunction: easing
  2291. };
  2292. el._x_transition.leave.start = {
  2293. opacity: 1,
  2294. transform: `scale(1)`
  2295. };
  2296. el._x_transition.leave.end = {
  2297. opacity: opacityValue,
  2298. transform: `scale(${scaleValue})`
  2299. };
  2300. }
  2301. }
  2302. function registerTransitionObject(el, setFunction, defaultValue = {}) {
  2303. if (!el._x_transition)
  2304. el._x_transition = {
  2305. enter: { during: defaultValue, start: defaultValue, end: defaultValue },
  2306. leave: { during: defaultValue, start: defaultValue, end: defaultValue },
  2307. in(before = () => {
  2308. }, after = () => {
  2309. }) {
  2310. transition(el, setFunction, {
  2311. during: this.enter.during,
  2312. start: this.enter.start,
  2313. end: this.enter.end
  2314. }, before, after);
  2315. },
  2316. out(before = () => {
  2317. }, after = () => {
  2318. }) {
  2319. transition(el, setFunction, {
  2320. during: this.leave.during,
  2321. start: this.leave.start,
  2322. end: this.leave.end
  2323. }, before, after);
  2324. }
  2325. };
  2326. }
  2327. window.Element.prototype._x_toggleAndCascadeWithTransitions = function(el, value, show, hide) {
  2328. const nextTick2 = document.visibilityState === "visible" ? requestAnimationFrame : setTimeout;
  2329. let clickAwayCompatibleShow = () => nextTick2(show);
  2330. if (value) {
  2331. if (el._x_transition && (el._x_transition.enter || el._x_transition.leave)) {
  2332. el._x_transition.enter && (Object.entries(el._x_transition.enter.during).length || Object.entries(el._x_transition.enter.start).length || Object.entries(el._x_transition.enter.end).length) ? el._x_transition.in(show) : clickAwayCompatibleShow();
  2333. } else {
  2334. el._x_transition ? el._x_transition.in(show) : clickAwayCompatibleShow();
  2335. }
  2336. return;
  2337. }
  2338. el._x_hidePromise = el._x_transition ? new Promise((resolve, reject) => {
  2339. el._x_transition.out(() => {
  2340. }, () => resolve(hide));
  2341. el._x_transitioning && el._x_transitioning.beforeCancel(() => reject({ isFromCancelledTransition: true }));
  2342. }) : Promise.resolve(hide);
  2343. queueMicrotask(() => {
  2344. let closest = closestHide(el);
  2345. if (closest) {
  2346. if (!closest._x_hideChildren)
  2347. closest._x_hideChildren = [];
  2348. closest._x_hideChildren.push(el);
  2349. } else {
  2350. nextTick2(() => {
  2351. let hideAfterChildren = (el2) => {
  2352. let carry = Promise.all([
  2353. el2._x_hidePromise,
  2354. ...(el2._x_hideChildren || []).map(hideAfterChildren)
  2355. ]).then(([i]) => i == null ? void 0 : i());
  2356. delete el2._x_hidePromise;
  2357. delete el2._x_hideChildren;
  2358. return carry;
  2359. };
  2360. hideAfterChildren(el).catch((e) => {
  2361. if (!e.isFromCancelledTransition)
  2362. throw e;
  2363. });
  2364. });
  2365. }
  2366. });
  2367. };
  2368. function closestHide(el) {
  2369. let parent = el.parentNode;
  2370. if (!parent)
  2371. return;
  2372. return parent._x_hidePromise ? parent : closestHide(parent);
  2373. }
  2374. function transition(el, setFunction, { during, start: start22, end } = {}, before = () => {
  2375. }, after = () => {
  2376. }) {
  2377. if (el._x_transitioning)
  2378. el._x_transitioning.cancel();
  2379. if (Object.keys(during).length === 0 && Object.keys(start22).length === 0 && Object.keys(end).length === 0) {
  2380. before();
  2381. after();
  2382. return;
  2383. }
  2384. let undoStart, undoDuring, undoEnd;
  2385. performTransition(el, {
  2386. start() {
  2387. undoStart = setFunction(el, start22);
  2388. },
  2389. during() {
  2390. undoDuring = setFunction(el, during);
  2391. },
  2392. before,
  2393. end() {
  2394. undoStart();
  2395. undoEnd = setFunction(el, end);
  2396. },
  2397. after,
  2398. cleanup() {
  2399. undoDuring();
  2400. undoEnd();
  2401. }
  2402. });
  2403. }
  2404. function performTransition(el, stages) {
  2405. let interrupted, reachedBefore, reachedEnd;
  2406. let finish = once(() => {
  2407. mutateDom(() => {
  2408. interrupted = true;
  2409. if (!reachedBefore)
  2410. stages.before();
  2411. if (!reachedEnd) {
  2412. stages.end();
  2413. releaseNextTicks();
  2414. }
  2415. stages.after();
  2416. if (el.isConnected)
  2417. stages.cleanup();
  2418. delete el._x_transitioning;
  2419. });
  2420. });
  2421. el._x_transitioning = {
  2422. beforeCancels: [],
  2423. beforeCancel(callback) {
  2424. this.beforeCancels.push(callback);
  2425. },
  2426. cancel: once(function() {
  2427. while (this.beforeCancels.length) {
  2428. this.beforeCancels.shift()();
  2429. }
  2430. ;
  2431. finish();
  2432. }),
  2433. finish
  2434. };
  2435. mutateDom(() => {
  2436. stages.start();
  2437. stages.during();
  2438. });
  2439. holdNextTicks();
  2440. requestAnimationFrame(() => {
  2441. if (interrupted)
  2442. return;
  2443. let duration = Number(getComputedStyle(el).transitionDuration.replace(/,.*/, "").replace("s", "")) * 1e3;
  2444. let delay = Number(getComputedStyle(el).transitionDelay.replace(/,.*/, "").replace("s", "")) * 1e3;
  2445. if (duration === 0)
  2446. duration = Number(getComputedStyle(el).animationDuration.replace("s", "")) * 1e3;
  2447. mutateDom(() => {
  2448. stages.before();
  2449. });
  2450. reachedBefore = true;
  2451. requestAnimationFrame(() => {
  2452. if (interrupted)
  2453. return;
  2454. mutateDom(() => {
  2455. stages.end();
  2456. });
  2457. releaseNextTicks();
  2458. setTimeout(el._x_transitioning.finish, duration + delay);
  2459. reachedEnd = true;
  2460. });
  2461. });
  2462. }
  2463. function modifierValue(modifiers, key, fallback2) {
  2464. if (modifiers.indexOf(key) === -1)
  2465. return fallback2;
  2466. const rawValue = modifiers[modifiers.indexOf(key) + 1];
  2467. if (!rawValue)
  2468. return fallback2;
  2469. if (key === "scale") {
  2470. if (isNaN(rawValue))
  2471. return fallback2;
  2472. }
  2473. if (key === "duration" || key === "delay") {
  2474. let match = rawValue.match(/([0-9]+)ms/);
  2475. if (match)
  2476. return match[1];
  2477. }
  2478. if (key === "origin") {
  2479. if (["top", "right", "left", "center", "bottom"].includes(modifiers[modifiers.indexOf(key) + 2])) {
  2480. return [rawValue, modifiers[modifiers.indexOf(key) + 2]].join(" ");
  2481. }
  2482. }
  2483. return rawValue;
  2484. }
  2485. var isCloning = false;
  2486. function skipDuringClone(callback, fallback2 = () => {
  2487. }) {
  2488. return (...args) => isCloning ? fallback2(...args) : callback(...args);
  2489. }
  2490. function onlyDuringClone(callback) {
  2491. return (...args) => isCloning && callback(...args);
  2492. }
  2493. var interceptors = [];
  2494. function interceptClone(callback) {
  2495. interceptors.push(callback);
  2496. }
  2497. function cloneNode(from, to) {
  2498. interceptors.forEach((i) => i(from, to));
  2499. isCloning = true;
  2500. dontRegisterReactiveSideEffects(() => {
  2501. initTree(to, (el, callback) => {
  2502. callback(el, () => {
  2503. });
  2504. });
  2505. });
  2506. isCloning = false;
  2507. }
  2508. var isCloningLegacy = false;
  2509. function clone(oldEl, newEl) {
  2510. if (!newEl._x_dataStack)
  2511. newEl._x_dataStack = oldEl._x_dataStack;
  2512. isCloning = true;
  2513. isCloningLegacy = true;
  2514. dontRegisterReactiveSideEffects(() => {
  2515. cloneTree(newEl);
  2516. });
  2517. isCloning = false;
  2518. isCloningLegacy = false;
  2519. }
  2520. function cloneTree(el) {
  2521. let hasRunThroughFirstEl = false;
  2522. let shallowWalker = (el2, callback) => {
  2523. walk(el2, (el3, skip) => {
  2524. if (hasRunThroughFirstEl && isRoot(el3))
  2525. return skip();
  2526. hasRunThroughFirstEl = true;
  2527. callback(el3, skip);
  2528. });
  2529. };
  2530. initTree(el, shallowWalker);
  2531. }
  2532. function dontRegisterReactiveSideEffects(callback) {
  2533. let cache = effect;
  2534. overrideEffect((callback2, el) => {
  2535. let storedEffect = cache(callback2);
  2536. release(storedEffect);
  2537. return () => {
  2538. };
  2539. });
  2540. callback();
  2541. overrideEffect(cache);
  2542. }
  2543. function bind(el, name, value, modifiers = []) {
  2544. if (!el._x_bindings)
  2545. el._x_bindings = reactive({});
  2546. el._x_bindings[name] = value;
  2547. name = modifiers.includes("camel") ? camelCase(name) : name;
  2548. switch (name) {
  2549. case "value":
  2550. bindInputValue(el, value);
  2551. break;
  2552. case "style":
  2553. bindStyles(el, value);
  2554. break;
  2555. case "class":
  2556. bindClasses(el, value);
  2557. break;
  2558. case "selected":
  2559. case "checked":
  2560. bindAttributeAndProperty(el, name, value);
  2561. break;
  2562. default:
  2563. bindAttribute(el, name, value);
  2564. break;
  2565. }
  2566. }
  2567. function bindInputValue(el, value) {
  2568. if (isRadio(el)) {
  2569. if (el.attributes.value === void 0) {
  2570. el.value = value;
  2571. }
  2572. if (window.fromModel) {
  2573. if (typeof value === "boolean") {
  2574. el.checked = safeParseBoolean(el.value) === value;
  2575. } else {
  2576. el.checked = checkedAttrLooseCompare(el.value, value);
  2577. }
  2578. }
  2579. } else if (isCheckbox(el)) {
  2580. if (Number.isInteger(value)) {
  2581. el.value = value;
  2582. } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) {
  2583. el.value = String(value);
  2584. } else {
  2585. if (Array.isArray(value)) {
  2586. el.checked = value.some((val) => checkedAttrLooseCompare(val, el.value));
  2587. } else {
  2588. el.checked = !!value;
  2589. }
  2590. }
  2591. } else if (el.tagName === "SELECT") {
  2592. updateSelect(el, value);
  2593. } else {
  2594. if (el.value === value)
  2595. return;
  2596. el.value = value === void 0 ? "" : value;
  2597. }
  2598. }
  2599. function bindClasses(el, value) {
  2600. if (el._x_undoAddedClasses)
  2601. el._x_undoAddedClasses();
  2602. el._x_undoAddedClasses = setClasses(el, value);
  2603. }
  2604. function bindStyles(el, value) {
  2605. if (el._x_undoAddedStyles)
  2606. el._x_undoAddedStyles();
  2607. el._x_undoAddedStyles = setStyles(el, value);
  2608. }
  2609. function bindAttributeAndProperty(el, name, value) {
  2610. bindAttribute(el, name, value);
  2611. setPropertyIfChanged(el, name, value);
  2612. }
  2613. function bindAttribute(el, name, value) {
  2614. if ([null, void 0, false].includes(value) && attributeShouldntBePreservedIfFalsy(name)) {
  2615. el.removeAttribute(name);
  2616. } else {
  2617. if (isBooleanAttr(name))
  2618. value = name;
  2619. setIfChanged(el, name, value);
  2620. }
  2621. }
  2622. function setIfChanged(el, attrName, value) {
  2623. if (el.getAttribute(attrName) != value) {
  2624. el.setAttribute(attrName, value);
  2625. }
  2626. }
  2627. function setPropertyIfChanged(el, propName, value) {
  2628. if (el[propName] !== value) {
  2629. el[propName] = value;
  2630. }
  2631. }
  2632. function updateSelect(el, value) {
  2633. const arrayWrappedValue = [].concat(value).map((value2) => {
  2634. return value2 + "";
  2635. });
  2636. Array.from(el.options).forEach((option) => {
  2637. option.selected = arrayWrappedValue.includes(option.value);
  2638. });
  2639. }
  2640. function camelCase(subject) {
  2641. return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase());
  2642. }
  2643. function checkedAttrLooseCompare(valueA, valueB) {
  2644. return valueA == valueB;
  2645. }
  2646. function safeParseBoolean(rawValue) {
  2647. if ([1, "1", "true", "on", "yes", true].includes(rawValue)) {
  2648. return true;
  2649. }
  2650. if ([0, "0", "false", "off", "no", false].includes(rawValue)) {
  2651. return false;
  2652. }
  2653. return rawValue ? Boolean(rawValue) : null;
  2654. }
  2655. var booleanAttributes = /* @__PURE__ */ new Set([
  2656. "allowfullscreen",
  2657. "async",
  2658. "autofocus",
  2659. "autoplay",
  2660. "checked",
  2661. "controls",
  2662. "default",
  2663. "defer",
  2664. "disabled",
  2665. "formnovalidate",
  2666. "inert",
  2667. "ismap",
  2668. "itemscope",
  2669. "loop",
  2670. "multiple",
  2671. "muted",
  2672. "nomodule",
  2673. "novalidate",
  2674. "open",
  2675. "playsinline",
  2676. "readonly",
  2677. "required",
  2678. "reversed",
  2679. "selected",
  2680. "shadowrootclonable",
  2681. "shadowrootdelegatesfocus",
  2682. "shadowrootserializable"
  2683. ]);
  2684. function isBooleanAttr(attrName) {
  2685. return booleanAttributes.has(attrName);
  2686. }
  2687. function attributeShouldntBePreservedIfFalsy(name) {
  2688. return !["aria-pressed", "aria-checked", "aria-expanded", "aria-selected"].includes(name);
  2689. }
  2690. function getBinding(el, name, fallback2) {
  2691. if (el._x_bindings && el._x_bindings[name] !== void 0)
  2692. return el._x_bindings[name];
  2693. return getAttributeBinding(el, name, fallback2);
  2694. }
  2695. function extractProp(el, name, fallback2, extract = true) {
  2696. if (el._x_bindings && el._x_bindings[name] !== void 0)
  2697. return el._x_bindings[name];
  2698. if (el._x_inlineBindings && el._x_inlineBindings[name] !== void 0) {
  2699. let binding = el._x_inlineBindings[name];
  2700. binding.extract = extract;
  2701. return dontAutoEvaluateFunctions(() => {
  2702. return evaluate(el, binding.expression);
  2703. });
  2704. }
  2705. return getAttributeBinding(el, name, fallback2);
  2706. }
  2707. function getAttributeBinding(el, name, fallback2) {
  2708. let attr = el.getAttribute(name);
  2709. if (attr === null)
  2710. return typeof fallback2 === "function" ? fallback2() : fallback2;
  2711. if (attr === "")
  2712. return true;
  2713. if (isBooleanAttr(name)) {
  2714. return !![name, "true"].includes(attr);
  2715. }
  2716. return attr;
  2717. }
  2718. function isCheckbox(el) {
  2719. return el.type === "checkbox" || el.localName === "ui-checkbox" || el.localName === "ui-switch";
  2720. }
  2721. function isRadio(el) {
  2722. return el.type === "radio" || el.localName === "ui-radio";
  2723. }
  2724. function debounce2(func, wait) {
  2725. var timeout;
  2726. return function() {
  2727. var context = this, args = arguments;
  2728. var later = function() {
  2729. timeout = null;
  2730. func.apply(context, args);
  2731. };
  2732. clearTimeout(timeout);
  2733. timeout = setTimeout(later, wait);
  2734. };
  2735. }
  2736. function throttle(func, limit) {
  2737. let inThrottle;
  2738. return function() {
  2739. let context = this, args = arguments;
  2740. if (!inThrottle) {
  2741. func.apply(context, args);
  2742. inThrottle = true;
  2743. setTimeout(() => inThrottle = false, limit);
  2744. }
  2745. };
  2746. }
  2747. function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) {
  2748. let firstRun = true;
  2749. let outerHash;
  2750. let innerHash;
  2751. let reference = effect(() => {
  2752. let outer = outerGet();
  2753. let inner = innerGet();
  2754. if (firstRun) {
  2755. innerSet(cloneIfObject2(outer));
  2756. firstRun = false;
  2757. } else {
  2758. let outerHashLatest = JSON.stringify(outer);
  2759. let innerHashLatest = JSON.stringify(inner);
  2760. if (outerHashLatest !== outerHash) {
  2761. innerSet(cloneIfObject2(outer));
  2762. } else if (outerHashLatest !== innerHashLatest) {
  2763. outerSet(cloneIfObject2(inner));
  2764. } else {
  2765. }
  2766. }
  2767. outerHash = JSON.stringify(outerGet());
  2768. innerHash = JSON.stringify(innerGet());
  2769. });
  2770. return () => {
  2771. release(reference);
  2772. };
  2773. }
  2774. function cloneIfObject2(value) {
  2775. return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value;
  2776. }
  2777. function plugin(callback) {
  2778. let callbacks = Array.isArray(callback) ? callback : [callback];
  2779. callbacks.forEach((i) => i(alpine_default));
  2780. }
  2781. var stores = {};
  2782. var isReactive = false;
  2783. function store(name, value) {
  2784. if (!isReactive) {
  2785. stores = reactive(stores);
  2786. isReactive = true;
  2787. }
  2788. if (value === void 0) {
  2789. return stores[name];
  2790. }
  2791. stores[name] = value;
  2792. initInterceptors(stores[name]);
  2793. if (typeof value === "object" && value !== null && value.hasOwnProperty("init") && typeof value.init === "function") {
  2794. stores[name].init();
  2795. }
  2796. }
  2797. function getStores() {
  2798. return stores;
  2799. }
  2800. var binds = {};
  2801. function bind2(name, bindings) {
  2802. let getBindings = typeof bindings !== "function" ? () => bindings : bindings;
  2803. if (name instanceof Element) {
  2804. return applyBindingsObject(name, getBindings());
  2805. } else {
  2806. binds[name] = getBindings;
  2807. }
  2808. return () => {
  2809. };
  2810. }
  2811. function injectBindingProviders(obj) {
  2812. Object.entries(binds).forEach(([name, callback]) => {
  2813. Object.defineProperty(obj, name, {
  2814. get() {
  2815. return (...args) => {
  2816. return callback(...args);
  2817. };
  2818. }
  2819. });
  2820. });
  2821. return obj;
  2822. }
  2823. function applyBindingsObject(el, obj, original) {
  2824. let cleanupRunners = [];
  2825. while (cleanupRunners.length)
  2826. cleanupRunners.pop()();
  2827. let attributes = Object.entries(obj).map(([name, value]) => ({ name, value }));
  2828. let staticAttributes = attributesOnly(attributes);
  2829. attributes = attributes.map((attribute) => {
  2830. if (staticAttributes.find((attr) => attr.name === attribute.name)) {
  2831. return {
  2832. name: `x-bind:${attribute.name}`,
  2833. value: `"${attribute.value}"`
  2834. };
  2835. }
  2836. return attribute;
  2837. });
  2838. directives(el, attributes, original).map((handle) => {
  2839. cleanupRunners.push(handle.runCleanups);
  2840. handle();
  2841. });
  2842. return () => {
  2843. while (cleanupRunners.length)
  2844. cleanupRunners.pop()();
  2845. };
  2846. }
  2847. var datas = {};
  2848. function data(name, callback) {
  2849. datas[name] = callback;
  2850. }
  2851. function injectDataProviders(obj, context) {
  2852. Object.entries(datas).forEach(([name, callback]) => {
  2853. Object.defineProperty(obj, name, {
  2854. get() {
  2855. return (...args) => {
  2856. return callback.bind(context)(...args);
  2857. };
  2858. },
  2859. enumerable: false
  2860. });
  2861. });
  2862. return obj;
  2863. }
  2864. var Alpine23 = {
  2865. get reactive() {
  2866. return reactive;
  2867. },
  2868. get release() {
  2869. return release;
  2870. },
  2871. get effect() {
  2872. return effect;
  2873. },
  2874. get raw() {
  2875. return raw;
  2876. },
  2877. version: "3.14.9",
  2878. flushAndStopDeferringMutations,
  2879. dontAutoEvaluateFunctions,
  2880. disableEffectScheduling,
  2881. startObservingMutations,
  2882. stopObservingMutations,
  2883. setReactivityEngine,
  2884. onAttributeRemoved,
  2885. onAttributesAdded,
  2886. closestDataStack,
  2887. skipDuringClone,
  2888. onlyDuringClone,
  2889. addRootSelector,
  2890. addInitSelector,
  2891. interceptClone,
  2892. addScopeToNode,
  2893. deferMutations,
  2894. mapAttributes,
  2895. evaluateLater,
  2896. interceptInit,
  2897. setEvaluator,
  2898. mergeProxies,
  2899. extractProp,
  2900. findClosest,
  2901. onElRemoved,
  2902. closestRoot,
  2903. destroyTree,
  2904. interceptor,
  2905. transition,
  2906. setStyles,
  2907. mutateDom,
  2908. directive: directive2,
  2909. entangle,
  2910. throttle,
  2911. debounce: debounce2,
  2912. evaluate,
  2913. initTree,
  2914. nextTick,
  2915. prefixed: prefix,
  2916. prefix: setPrefix,
  2917. plugin,
  2918. magic,
  2919. store,
  2920. start: start2,
  2921. clone,
  2922. cloneNode,
  2923. bound: getBinding,
  2924. $data: scope,
  2925. watch,
  2926. walk,
  2927. data,
  2928. bind: bind2
  2929. };
  2930. var alpine_default = Alpine23;
  2931. var import_reactivity10 = __toESM2(require_reactivity());
  2932. magic("nextTick", () => nextTick);
  2933. magic("dispatch", (el) => dispatch3.bind(dispatch3, el));
  2934. magic("watch", (el, { evaluateLater: evaluateLater2, cleanup }) => (key, callback) => {
  2935. let evaluate2 = evaluateLater2(key);
  2936. let getter = () => {
  2937. let value;
  2938. evaluate2((i) => value = i);
  2939. return value;
  2940. };
  2941. let unwatch = watch(getter, callback);
  2942. cleanup(unwatch);
  2943. });
  2944. magic("store", getStores);
  2945. magic("data", (el) => scope(el));
  2946. magic("root", (el) => closestRoot(el));
  2947. magic("refs", (el) => {
  2948. if (el._x_refs_proxy)
  2949. return el._x_refs_proxy;
  2950. el._x_refs_proxy = mergeProxies(getArrayOfRefObject(el));
  2951. return el._x_refs_proxy;
  2952. });
  2953. function getArrayOfRefObject(el) {
  2954. let refObjects = [];
  2955. findClosest(el, (i) => {
  2956. if (i._x_refs)
  2957. refObjects.push(i._x_refs);
  2958. });
  2959. return refObjects;
  2960. }
  2961. var globalIdMemo = {};
  2962. function findAndIncrementId(name) {
  2963. if (!globalIdMemo[name])
  2964. globalIdMemo[name] = 0;
  2965. return ++globalIdMemo[name];
  2966. }
  2967. function closestIdRoot(el, name) {
  2968. return findClosest(el, (element) => {
  2969. if (element._x_ids && element._x_ids[name])
  2970. return true;
  2971. });
  2972. }
  2973. function setIdRoot(el, name) {
  2974. if (!el._x_ids)
  2975. el._x_ids = {};
  2976. if (!el._x_ids[name])
  2977. el._x_ids[name] = findAndIncrementId(name);
  2978. }
  2979. magic("id", (el, { cleanup }) => (name, key = null) => {
  2980. let cacheKey = `${name}${key ? `-${key}` : ""}`;
  2981. return cacheIdByNameOnElement(el, cacheKey, cleanup, () => {
  2982. let root = closestIdRoot(el, name);
  2983. let id = root ? root._x_ids[name] : findAndIncrementId(name);
  2984. return key ? `${name}-${id}-${key}` : `${name}-${id}`;
  2985. });
  2986. });
  2987. interceptClone((from, to) => {
  2988. if (from._x_id) {
  2989. to._x_id = from._x_id;
  2990. }
  2991. });
  2992. function cacheIdByNameOnElement(el, cacheKey, cleanup, callback) {
  2993. if (!el._x_id)
  2994. el._x_id = {};
  2995. if (el._x_id[cacheKey])
  2996. return el._x_id[cacheKey];
  2997. let output = callback();
  2998. el._x_id[cacheKey] = output;
  2999. cleanup(() => {
  3000. delete el._x_id[cacheKey];
  3001. });
  3002. return output;
  3003. }
  3004. magic("el", (el) => el);
  3005. warnMissingPluginMagic("Focus", "focus", "focus");
  3006. warnMissingPluginMagic("Persist", "persist", "persist");
  3007. function warnMissingPluginMagic(name, magicName, slug) {
  3008. magic(magicName, (el) => warn(`You can't use [$${magicName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
  3009. }
  3010. directive2("modelable", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup }) => {
  3011. let func = evaluateLater2(expression);
  3012. let innerGet = () => {
  3013. let result;
  3014. func((i) => result = i);
  3015. return result;
  3016. };
  3017. let evaluateInnerSet = evaluateLater2(`${expression} = __placeholder`);
  3018. let innerSet = (val) => evaluateInnerSet(() => {
  3019. }, { scope: { "__placeholder": val } });
  3020. let initialValue = innerGet();
  3021. innerSet(initialValue);
  3022. queueMicrotask(() => {
  3023. if (!el._x_model)
  3024. return;
  3025. el._x_removeModelListeners["default"]();
  3026. let outerGet = el._x_model.get;
  3027. let outerSet = el._x_model.set;
  3028. let releaseEntanglement = entangle({
  3029. get() {
  3030. return outerGet();
  3031. },
  3032. set(value) {
  3033. outerSet(value);
  3034. }
  3035. }, {
  3036. get() {
  3037. return innerGet();
  3038. },
  3039. set(value) {
  3040. innerSet(value);
  3041. }
  3042. });
  3043. cleanup(releaseEntanglement);
  3044. });
  3045. });
  3046. directive2("teleport", (el, { modifiers, expression }, { cleanup }) => {
  3047. if (el.tagName.toLowerCase() !== "template")
  3048. warn("x-teleport can only be used on a <template> tag", el);
  3049. let target = getTarget(expression);
  3050. let clone2 = el.content.cloneNode(true).firstElementChild;
  3051. el._x_teleport = clone2;
  3052. clone2._x_teleportBack = el;
  3053. el.setAttribute("data-teleport-template", true);
  3054. clone2.setAttribute("data-teleport-target", true);
  3055. if (el._x_forwardEvents) {
  3056. el._x_forwardEvents.forEach((eventName) => {
  3057. clone2.addEventListener(eventName, (e) => {
  3058. e.stopPropagation();
  3059. el.dispatchEvent(new e.constructor(e.type, e));
  3060. });
  3061. });
  3062. }
  3063. addScopeToNode(clone2, {}, el);
  3064. let placeInDom = (clone3, target2, modifiers2) => {
  3065. if (modifiers2.includes("prepend")) {
  3066. target2.parentNode.insertBefore(clone3, target2);
  3067. } else if (modifiers2.includes("append")) {
  3068. target2.parentNode.insertBefore(clone3, target2.nextSibling);
  3069. } else {
  3070. target2.appendChild(clone3);
  3071. }
  3072. };
  3073. mutateDom(() => {
  3074. placeInDom(clone2, target, modifiers);
  3075. skipDuringClone(() => {
  3076. initTree(clone2);
  3077. })();
  3078. });
  3079. el._x_teleportPutBack = () => {
  3080. let target2 = getTarget(expression);
  3081. mutateDom(() => {
  3082. placeInDom(el._x_teleport, target2, modifiers);
  3083. });
  3084. };
  3085. cleanup(() => mutateDom(() => {
  3086. clone2.remove();
  3087. destroyTree(clone2);
  3088. }));
  3089. });
  3090. var teleportContainerDuringClone = document.createElement("div");
  3091. function getTarget(expression) {
  3092. let target = skipDuringClone(() => {
  3093. return document.querySelector(expression);
  3094. }, () => {
  3095. return teleportContainerDuringClone;
  3096. })();
  3097. if (!target)
  3098. warn(`Cannot find x-teleport element for selector: "${expression}"`);
  3099. return target;
  3100. }
  3101. var handler = () => {
  3102. };
  3103. handler.inline = (el, { modifiers }, { cleanup }) => {
  3104. modifiers.includes("self") ? el._x_ignoreSelf = true : el._x_ignore = true;
  3105. cleanup(() => {
  3106. modifiers.includes("self") ? delete el._x_ignoreSelf : delete el._x_ignore;
  3107. });
  3108. };
  3109. directive2("ignore", handler);
  3110. directive2("effect", skipDuringClone((el, { expression }, { effect: effect3 }) => {
  3111. effect3(evaluateLater(el, expression));
  3112. }));
  3113. function on3(el, event, modifiers, callback) {
  3114. let listenerTarget = el;
  3115. let handler4 = (e) => callback(e);
  3116. let options = {};
  3117. let wrapHandler = (callback2, wrapper) => (e) => wrapper(callback2, e);
  3118. if (modifiers.includes("dot"))
  3119. event = dotSyntax(event);
  3120. if (modifiers.includes("camel"))
  3121. event = camelCase2(event);
  3122. if (modifiers.includes("passive"))
  3123. options.passive = true;
  3124. if (modifiers.includes("capture"))
  3125. options.capture = true;
  3126. if (modifiers.includes("window"))
  3127. listenerTarget = window;
  3128. if (modifiers.includes("document"))
  3129. listenerTarget = document;
  3130. if (modifiers.includes("debounce")) {
  3131. let nextModifier = modifiers[modifiers.indexOf("debounce") + 1] || "invalid-wait";
  3132. let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
  3133. handler4 = debounce2(handler4, wait);
  3134. }
  3135. if (modifiers.includes("throttle")) {
  3136. let nextModifier = modifiers[modifiers.indexOf("throttle") + 1] || "invalid-wait";
  3137. let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
  3138. handler4 = throttle(handler4, wait);
  3139. }
  3140. if (modifiers.includes("prevent"))
  3141. handler4 = wrapHandler(handler4, (next, e) => {
  3142. e.preventDefault();
  3143. next(e);
  3144. });
  3145. if (modifiers.includes("stop"))
  3146. handler4 = wrapHandler(handler4, (next, e) => {
  3147. e.stopPropagation();
  3148. next(e);
  3149. });
  3150. if (modifiers.includes("once")) {
  3151. handler4 = wrapHandler(handler4, (next, e) => {
  3152. next(e);
  3153. listenerTarget.removeEventListener(event, handler4, options);
  3154. });
  3155. }
  3156. if (modifiers.includes("away") || modifiers.includes("outside")) {
  3157. listenerTarget = document;
  3158. handler4 = wrapHandler(handler4, (next, e) => {
  3159. if (el.contains(e.target))
  3160. return;
  3161. if (e.target.isConnected === false)
  3162. return;
  3163. if (el.offsetWidth < 1 && el.offsetHeight < 1)
  3164. return;
  3165. if (el._x_isShown === false)
  3166. return;
  3167. next(e);
  3168. });
  3169. }
  3170. if (modifiers.includes("self"))
  3171. handler4 = wrapHandler(handler4, (next, e) => {
  3172. e.target === el && next(e);
  3173. });
  3174. if (isKeyEvent(event) || isClickEvent(event)) {
  3175. handler4 = wrapHandler(handler4, (next, e) => {
  3176. if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
  3177. return;
  3178. }
  3179. next(e);
  3180. });
  3181. }
  3182. listenerTarget.addEventListener(event, handler4, options);
  3183. return () => {
  3184. listenerTarget.removeEventListener(event, handler4, options);
  3185. };
  3186. }
  3187. function dotSyntax(subject) {
  3188. return subject.replace(/-/g, ".");
  3189. }
  3190. function camelCase2(subject) {
  3191. return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase());
  3192. }
  3193. function isNumeric(subject) {
  3194. return !Array.isArray(subject) && !isNaN(subject);
  3195. }
  3196. function kebabCase2(subject) {
  3197. if ([" ", "_"].includes(subject))
  3198. return subject;
  3199. return subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase();
  3200. }
  3201. function isKeyEvent(event) {
  3202. return ["keydown", "keyup"].includes(event);
  3203. }
  3204. function isClickEvent(event) {
  3205. return ["contextmenu", "click", "mouse"].some((i) => event.includes(i));
  3206. }
  3207. function isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers) {
  3208. let keyModifiers = modifiers.filter((i) => {
  3209. return !["window", "document", "prevent", "stop", "once", "capture", "self", "away", "outside", "passive"].includes(i);
  3210. });
  3211. if (keyModifiers.includes("debounce")) {
  3212. let debounceIndex = keyModifiers.indexOf("debounce");
  3213. keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1);
  3214. }
  3215. if (keyModifiers.includes("throttle")) {
  3216. let debounceIndex = keyModifiers.indexOf("throttle");
  3217. keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1);
  3218. }
  3219. if (keyModifiers.length === 0)
  3220. return false;
  3221. if (keyModifiers.length === 1 && keyToModifiers(e.key).includes(keyModifiers[0]))
  3222. return false;
  3223. const systemKeyModifiers = ["ctrl", "shift", "alt", "meta", "cmd", "super"];
  3224. const selectedSystemKeyModifiers = systemKeyModifiers.filter((modifier) => keyModifiers.includes(modifier));
  3225. keyModifiers = keyModifiers.filter((i) => !selectedSystemKeyModifiers.includes(i));
  3226. if (selectedSystemKeyModifiers.length > 0) {
  3227. const activelyPressedKeyModifiers = selectedSystemKeyModifiers.filter((modifier) => {
  3228. if (modifier === "cmd" || modifier === "super")
  3229. modifier = "meta";
  3230. return e[`${modifier}Key`];
  3231. });
  3232. if (activelyPressedKeyModifiers.length === selectedSystemKeyModifiers.length) {
  3233. if (isClickEvent(e.type))
  3234. return false;
  3235. if (keyToModifiers(e.key).includes(keyModifiers[0]))
  3236. return false;
  3237. }
  3238. }
  3239. return true;
  3240. }
  3241. function keyToModifiers(key) {
  3242. if (!key)
  3243. return [];
  3244. key = kebabCase2(key);
  3245. let modifierToKeyMap = {
  3246. "ctrl": "control",
  3247. "slash": "/",
  3248. "space": " ",
  3249. "spacebar": " ",
  3250. "cmd": "meta",
  3251. "esc": "escape",
  3252. "up": "arrow-up",
  3253. "down": "arrow-down",
  3254. "left": "arrow-left",
  3255. "right": "arrow-right",
  3256. "period": ".",
  3257. "comma": ",",
  3258. "equal": "=",
  3259. "minus": "-",
  3260. "underscore": "_"
  3261. };
  3262. modifierToKeyMap[key] = key;
  3263. return Object.keys(modifierToKeyMap).map((modifier) => {
  3264. if (modifierToKeyMap[modifier] === key)
  3265. return modifier;
  3266. }).filter((modifier) => modifier);
  3267. }
  3268. directive2("model", (el, { modifiers, expression }, { effect: effect3, cleanup }) => {
  3269. let scopeTarget = el;
  3270. if (modifiers.includes("parent")) {
  3271. scopeTarget = el.parentNode;
  3272. }
  3273. let evaluateGet = evaluateLater(scopeTarget, expression);
  3274. let evaluateSet;
  3275. if (typeof expression === "string") {
  3276. evaluateSet = evaluateLater(scopeTarget, `${expression} = __placeholder`);
  3277. } else if (typeof expression === "function" && typeof expression() === "string") {
  3278. evaluateSet = evaluateLater(scopeTarget, `${expression()} = __placeholder`);
  3279. } else {
  3280. evaluateSet = () => {
  3281. };
  3282. }
  3283. let getValue = () => {
  3284. let result;
  3285. evaluateGet((value) => result = value);
  3286. return isGetterSetter(result) ? result.get() : result;
  3287. };
  3288. let setValue = (value) => {
  3289. let result;
  3290. evaluateGet((value2) => result = value2);
  3291. if (isGetterSetter(result)) {
  3292. result.set(value);
  3293. } else {
  3294. evaluateSet(() => {
  3295. }, {
  3296. scope: { "__placeholder": value }
  3297. });
  3298. }
  3299. };
  3300. if (typeof expression === "string" && el.type === "radio") {
  3301. mutateDom(() => {
  3302. if (!el.hasAttribute("name"))
  3303. el.setAttribute("name", expression);
  3304. });
  3305. }
  3306. var event = el.tagName.toLowerCase() === "select" || ["checkbox", "radio"].includes(el.type) || modifiers.includes("lazy") ? "change" : "input";
  3307. let removeListener = isCloning ? () => {
  3308. } : on3(el, event, modifiers, (e) => {
  3309. setValue(getInputValue(el, modifiers, e, getValue()));
  3310. });
  3311. if (modifiers.includes("fill")) {
  3312. if ([void 0, null, ""].includes(getValue()) || isCheckbox(el) && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) {
  3313. setValue(getInputValue(el, modifiers, { target: el }, getValue()));
  3314. }
  3315. }
  3316. if (!el._x_removeModelListeners)
  3317. el._x_removeModelListeners = {};
  3318. el._x_removeModelListeners["default"] = removeListener;
  3319. cleanup(() => el._x_removeModelListeners["default"]());
  3320. if (el.form) {
  3321. let removeResetListener = on3(el.form, "reset", [], (e) => {
  3322. nextTick(() => el._x_model && el._x_model.set(getInputValue(el, modifiers, { target: el }, getValue())));
  3323. });
  3324. cleanup(() => removeResetListener());
  3325. }
  3326. el._x_model = {
  3327. get() {
  3328. return getValue();
  3329. },
  3330. set(value) {
  3331. setValue(value);
  3332. }
  3333. };
  3334. el._x_forceModelUpdate = (value) => {
  3335. if (value === void 0 && typeof expression === "string" && expression.match(/\./))
  3336. value = "";
  3337. window.fromModel = true;
  3338. mutateDom(() => bind(el, "value", value));
  3339. delete window.fromModel;
  3340. };
  3341. effect3(() => {
  3342. let value = getValue();
  3343. if (modifiers.includes("unintrusive") && document.activeElement.isSameNode(el))
  3344. return;
  3345. el._x_forceModelUpdate(value);
  3346. });
  3347. });
  3348. function getInputValue(el, modifiers, event, currentValue) {
  3349. return mutateDom(() => {
  3350. if (event instanceof CustomEvent && event.detail !== void 0)
  3351. return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value;
  3352. else if (isCheckbox(el)) {
  3353. if (Array.isArray(currentValue)) {
  3354. let newValue = null;
  3355. if (modifiers.includes("number")) {
  3356. newValue = safeParseNumber(event.target.value);
  3357. } else if (modifiers.includes("boolean")) {
  3358. newValue = safeParseBoolean(event.target.value);
  3359. } else {
  3360. newValue = event.target.value;
  3361. }
  3362. return event.target.checked ? currentValue.includes(newValue) ? currentValue : currentValue.concat([newValue]) : currentValue.filter((el2) => !checkedAttrLooseCompare2(el2, newValue));
  3363. } else {
  3364. return event.target.checked;
  3365. }
  3366. } else if (el.tagName.toLowerCase() === "select" && el.multiple) {
  3367. if (modifiers.includes("number")) {
  3368. return Array.from(event.target.selectedOptions).map((option) => {
  3369. let rawValue = option.value || option.text;
  3370. return safeParseNumber(rawValue);
  3371. });
  3372. } else if (modifiers.includes("boolean")) {
  3373. return Array.from(event.target.selectedOptions).map((option) => {
  3374. let rawValue = option.value || option.text;
  3375. return safeParseBoolean(rawValue);
  3376. });
  3377. }
  3378. return Array.from(event.target.selectedOptions).map((option) => {
  3379. return option.value || option.text;
  3380. });
  3381. } else {
  3382. let newValue;
  3383. if (isRadio(el)) {
  3384. if (event.target.checked) {
  3385. newValue = event.target.value;
  3386. } else {
  3387. newValue = currentValue;
  3388. }
  3389. } else {
  3390. newValue = event.target.value;
  3391. }
  3392. if (modifiers.includes("number")) {
  3393. return safeParseNumber(newValue);
  3394. } else if (modifiers.includes("boolean")) {
  3395. return safeParseBoolean(newValue);
  3396. } else if (modifiers.includes("trim")) {
  3397. return newValue.trim();
  3398. } else {
  3399. return newValue;
  3400. }
  3401. }
  3402. });
  3403. }
  3404. function safeParseNumber(rawValue) {
  3405. let number = rawValue ? parseFloat(rawValue) : null;
  3406. return isNumeric2(number) ? number : rawValue;
  3407. }
  3408. function checkedAttrLooseCompare2(valueA, valueB) {
  3409. return valueA == valueB;
  3410. }
  3411. function isNumeric2(subject) {
  3412. return !Array.isArray(subject) && !isNaN(subject);
  3413. }
  3414. function isGetterSetter(value) {
  3415. return value !== null && typeof value === "object" && typeof value.get === "function" && typeof value.set === "function";
  3416. }
  3417. directive2("cloak", (el) => queueMicrotask(() => mutateDom(() => el.removeAttribute(prefix("cloak")))));
  3418. addInitSelector(() => `[${prefix("init")}]`);
  3419. directive2("init", skipDuringClone((el, { expression }, { evaluate: evaluate2 }) => {
  3420. if (typeof expression === "string") {
  3421. return !!expression.trim() && evaluate2(expression, {}, false);
  3422. }
  3423. return evaluate2(expression, {}, false);
  3424. }));
  3425. directive2("text", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => {
  3426. let evaluate2 = evaluateLater2(expression);
  3427. effect3(() => {
  3428. evaluate2((value) => {
  3429. mutateDom(() => {
  3430. el.textContent = value;
  3431. });
  3432. });
  3433. });
  3434. });
  3435. directive2("html", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => {
  3436. let evaluate2 = evaluateLater2(expression);
  3437. effect3(() => {
  3438. evaluate2((value) => {
  3439. mutateDom(() => {
  3440. el.innerHTML = value;
  3441. el._x_ignoreSelf = true;
  3442. initTree(el);
  3443. delete el._x_ignoreSelf;
  3444. });
  3445. });
  3446. });
  3447. });
  3448. mapAttributes(startingWith(":", into(prefix("bind:"))));
  3449. var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3, cleanup }) => {
  3450. if (!value) {
  3451. let bindingProviders = {};
  3452. injectBindingProviders(bindingProviders);
  3453. let getBindings = evaluateLater(el, expression);
  3454. getBindings((bindings) => {
  3455. applyBindingsObject(el, bindings, original);
  3456. }, { scope: bindingProviders });
  3457. return;
  3458. }
  3459. if (value === "key")
  3460. return storeKeyForXFor(el, expression);
  3461. if (el._x_inlineBindings && el._x_inlineBindings[value] && el._x_inlineBindings[value].extract) {
  3462. return;
  3463. }
  3464. let evaluate2 = evaluateLater(el, expression);
  3465. effect3(() => evaluate2((result) => {
  3466. if (result === void 0 && typeof expression === "string" && expression.match(/\./)) {
  3467. result = "";
  3468. }
  3469. mutateDom(() => bind(el, value, result, modifiers));
  3470. }));
  3471. cleanup(() => {
  3472. el._x_undoAddedClasses && el._x_undoAddedClasses();
  3473. el._x_undoAddedStyles && el._x_undoAddedStyles();
  3474. });
  3475. };
  3476. handler2.inline = (el, { value, modifiers, expression }) => {
  3477. if (!value)
  3478. return;
  3479. if (!el._x_inlineBindings)
  3480. el._x_inlineBindings = {};
  3481. el._x_inlineBindings[value] = { expression, extract: false };
  3482. };
  3483. directive2("bind", handler2);
  3484. function storeKeyForXFor(el, expression) {
  3485. el._x_keyExpression = expression;
  3486. }
  3487. addRootSelector(() => `[${prefix("data")}]`);
  3488. directive2("data", (el, { expression }, { cleanup }) => {
  3489. if (shouldSkipRegisteringDataDuringClone(el))
  3490. return;
  3491. expression = expression === "" ? "{}" : expression;
  3492. let magicContext = {};
  3493. injectMagics(magicContext, el);
  3494. let dataProviderContext = {};
  3495. injectDataProviders(dataProviderContext, magicContext);
  3496. let data2 = evaluate(el, expression, { scope: dataProviderContext });
  3497. if (data2 === void 0 || data2 === true)
  3498. data2 = {};
  3499. injectMagics(data2, el);
  3500. let reactiveData = reactive(data2);
  3501. initInterceptors(reactiveData);
  3502. let undo = addScopeToNode(el, reactiveData);
  3503. reactiveData["init"] && evaluate(el, reactiveData["init"]);
  3504. cleanup(() => {
  3505. reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
  3506. undo();
  3507. });
  3508. });
  3509. interceptClone((from, to) => {
  3510. if (from._x_dataStack) {
  3511. to._x_dataStack = from._x_dataStack;
  3512. to.setAttribute("data-has-alpine-state", true);
  3513. }
  3514. });
  3515. function shouldSkipRegisteringDataDuringClone(el) {
  3516. if (!isCloning)
  3517. return false;
  3518. if (isCloningLegacy)
  3519. return true;
  3520. return el.hasAttribute("data-has-alpine-state");
  3521. }
  3522. directive2("show", (el, { modifiers, expression }, { effect: effect3 }) => {
  3523. let evaluate2 = evaluateLater(el, expression);
  3524. if (!el._x_doHide)
  3525. el._x_doHide = () => {
  3526. mutateDom(() => {
  3527. el.style.setProperty("display", "none", modifiers.includes("important") ? "important" : void 0);
  3528. });
  3529. };
  3530. if (!el._x_doShow)
  3531. el._x_doShow = () => {
  3532. mutateDom(() => {
  3533. if (el.style.length === 1 && el.style.display === "none") {
  3534. el.removeAttribute("style");
  3535. } else {
  3536. el.style.removeProperty("display");
  3537. }
  3538. });
  3539. };
  3540. let hide = () => {
  3541. el._x_doHide();
  3542. el._x_isShown = false;
  3543. };
  3544. let show = () => {
  3545. el._x_doShow();
  3546. el._x_isShown = true;
  3547. };
  3548. let clickAwayCompatibleShow = () => setTimeout(show);
  3549. let toggle = once((value) => value ? show() : hide(), (value) => {
  3550. if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
  3551. el._x_toggleAndCascadeWithTransitions(el, value, show, hide);
  3552. } else {
  3553. value ? clickAwayCompatibleShow() : hide();
  3554. }
  3555. });
  3556. let oldValue;
  3557. let firstTime = true;
  3558. effect3(() => evaluate2((value) => {
  3559. if (!firstTime && value === oldValue)
  3560. return;
  3561. if (modifiers.includes("immediate"))
  3562. value ? clickAwayCompatibleShow() : hide();
  3563. toggle(value);
  3564. oldValue = value;
  3565. firstTime = false;
  3566. }));
  3567. });
  3568. directive2("for", (el, { expression }, { effect: effect3, cleanup }) => {
  3569. let iteratorNames = parseForExpression(expression);
  3570. let evaluateItems = evaluateLater(el, iteratorNames.items);
  3571. let evaluateKey = evaluateLater(el, el._x_keyExpression || "index");
  3572. el._x_prevKeys = [];
  3573. el._x_lookup = {};
  3574. effect3(() => loop(el, iteratorNames, evaluateItems, evaluateKey));
  3575. cleanup(() => {
  3576. Object.values(el._x_lookup).forEach((el2) => mutateDom(() => {
  3577. destroyTree(el2);
  3578. el2.remove();
  3579. }));
  3580. delete el._x_prevKeys;
  3581. delete el._x_lookup;
  3582. });
  3583. });
  3584. function loop(el, iteratorNames, evaluateItems, evaluateKey) {
  3585. let isObject2 = (i) => typeof i === "object" && !Array.isArray(i);
  3586. let templateEl = el;
  3587. evaluateItems((items) => {
  3588. if (isNumeric3(items) && items >= 0) {
  3589. items = Array.from(Array(items).keys(), (i) => i + 1);
  3590. }
  3591. if (items === void 0)
  3592. items = [];
  3593. let lookup = el._x_lookup;
  3594. let prevKeys = el._x_prevKeys;
  3595. let scopes = [];
  3596. let keys = [];
  3597. if (isObject2(items)) {
  3598. items = Object.entries(items).map(([key, value]) => {
  3599. let scope2 = getIterationScopeVariables(iteratorNames, value, key, items);
  3600. evaluateKey((value2) => {
  3601. if (keys.includes(value2))
  3602. warn("Duplicate key on x-for", el);
  3603. keys.push(value2);
  3604. }, { scope: { index: key, ...scope2 } });
  3605. scopes.push(scope2);
  3606. });
  3607. } else {
  3608. for (let i = 0; i < items.length; i++) {
  3609. let scope2 = getIterationScopeVariables(iteratorNames, items[i], i, items);
  3610. evaluateKey((value) => {
  3611. if (keys.includes(value))
  3612. warn("Duplicate key on x-for", el);
  3613. keys.push(value);
  3614. }, { scope: { index: i, ...scope2 } });
  3615. scopes.push(scope2);
  3616. }
  3617. }
  3618. let adds = [];
  3619. let moves = [];
  3620. let removes = [];
  3621. let sames = [];
  3622. for (let i = 0; i < prevKeys.length; i++) {
  3623. let key = prevKeys[i];
  3624. if (keys.indexOf(key) === -1)
  3625. removes.push(key);
  3626. }
  3627. prevKeys = prevKeys.filter((key) => !removes.includes(key));
  3628. let lastKey = "template";
  3629. for (let i = 0; i < keys.length; i++) {
  3630. let key = keys[i];
  3631. let prevIndex = prevKeys.indexOf(key);
  3632. if (prevIndex === -1) {
  3633. prevKeys.splice(i, 0, key);
  3634. adds.push([lastKey, i]);
  3635. } else if (prevIndex !== i) {
  3636. let keyInSpot = prevKeys.splice(i, 1)[0];
  3637. let keyForSpot = prevKeys.splice(prevIndex - 1, 1)[0];
  3638. prevKeys.splice(i, 0, keyForSpot);
  3639. prevKeys.splice(prevIndex, 0, keyInSpot);
  3640. moves.push([keyInSpot, keyForSpot]);
  3641. } else {
  3642. sames.push(key);
  3643. }
  3644. lastKey = key;
  3645. }
  3646. for (let i = 0; i < removes.length; i++) {
  3647. let key = removes[i];
  3648. if (!(key in lookup))
  3649. continue;
  3650. mutateDom(() => {
  3651. destroyTree(lookup[key]);
  3652. lookup[key].remove();
  3653. });
  3654. delete lookup[key];
  3655. }
  3656. for (let i = 0; i < moves.length; i++) {
  3657. let [keyInSpot, keyForSpot] = moves[i];
  3658. let elInSpot = lookup[keyInSpot];
  3659. let elForSpot = lookup[keyForSpot];
  3660. let marker = document.createElement("div");
  3661. mutateDom(() => {
  3662. if (!elForSpot)
  3663. warn(`x-for ":key" is undefined or invalid`, templateEl, keyForSpot, lookup);
  3664. elForSpot.after(marker);
  3665. elInSpot.after(elForSpot);
  3666. elForSpot._x_currentIfEl && elForSpot.after(elForSpot._x_currentIfEl);
  3667. marker.before(elInSpot);
  3668. elInSpot._x_currentIfEl && elInSpot.after(elInSpot._x_currentIfEl);
  3669. marker.remove();
  3670. });
  3671. elForSpot._x_refreshXForScope(scopes[keys.indexOf(keyForSpot)]);
  3672. }
  3673. for (let i = 0; i < adds.length; i++) {
  3674. let [lastKey2, index] = adds[i];
  3675. let lastEl = lastKey2 === "template" ? templateEl : lookup[lastKey2];
  3676. if (lastEl._x_currentIfEl)
  3677. lastEl = lastEl._x_currentIfEl;
  3678. let scope2 = scopes[index];
  3679. let key = keys[index];
  3680. let clone2 = document.importNode(templateEl.content, true).firstElementChild;
  3681. let reactiveScope = reactive(scope2);
  3682. addScopeToNode(clone2, reactiveScope, templateEl);
  3683. clone2._x_refreshXForScope = (newScope) => {
  3684. Object.entries(newScope).forEach(([key2, value]) => {
  3685. reactiveScope[key2] = value;
  3686. });
  3687. };
  3688. mutateDom(() => {
  3689. lastEl.after(clone2);
  3690. skipDuringClone(() => initTree(clone2))();
  3691. });
  3692. if (typeof key === "object") {
  3693. warn("x-for key cannot be an object, it must be a string or an integer", templateEl);
  3694. }
  3695. lookup[key] = clone2;
  3696. }
  3697. for (let i = 0; i < sames.length; i++) {
  3698. lookup[sames[i]]._x_refreshXForScope(scopes[keys.indexOf(sames[i])]);
  3699. }
  3700. templateEl._x_prevKeys = keys;
  3701. });
  3702. }
  3703. function parseForExpression(expression) {
  3704. let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  3705. let stripParensRE = /^\s*\(|\)\s*$/g;
  3706. let forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  3707. let inMatch = expression.match(forAliasRE);
  3708. if (!inMatch)
  3709. return;
  3710. let res = {};
  3711. res.items = inMatch[2].trim();
  3712. let item = inMatch[1].replace(stripParensRE, "").trim();
  3713. let iteratorMatch = item.match(forIteratorRE);
  3714. if (iteratorMatch) {
  3715. res.item = item.replace(forIteratorRE, "").trim();
  3716. res.index = iteratorMatch[1].trim();
  3717. if (iteratorMatch[2]) {
  3718. res.collection = iteratorMatch[2].trim();
  3719. }
  3720. } else {
  3721. res.item = item;
  3722. }
  3723. return res;
  3724. }
  3725. function getIterationScopeVariables(iteratorNames, item, index, items) {
  3726. let scopeVariables = {};
  3727. if (/^\[.*\]$/.test(iteratorNames.item) && Array.isArray(item)) {
  3728. let names = iteratorNames.item.replace("[", "").replace("]", "").split(",").map((i) => i.trim());
  3729. names.forEach((name, i) => {
  3730. scopeVariables[name] = item[i];
  3731. });
  3732. } else if (/^\{.*\}$/.test(iteratorNames.item) && !Array.isArray(item) && typeof item === "object") {
  3733. let names = iteratorNames.item.replace("{", "").replace("}", "").split(",").map((i) => i.trim());
  3734. names.forEach((name) => {
  3735. scopeVariables[name] = item[name];
  3736. });
  3737. } else {
  3738. scopeVariables[iteratorNames.item] = item;
  3739. }
  3740. if (iteratorNames.index)
  3741. scopeVariables[iteratorNames.index] = index;
  3742. if (iteratorNames.collection)
  3743. scopeVariables[iteratorNames.collection] = items;
  3744. return scopeVariables;
  3745. }
  3746. function isNumeric3(subject) {
  3747. return !Array.isArray(subject) && !isNaN(subject);
  3748. }
  3749. function handler3() {
  3750. }
  3751. handler3.inline = (el, { expression }, { cleanup }) => {
  3752. let root = closestRoot(el);
  3753. if (!root._x_refs)
  3754. root._x_refs = {};
  3755. root._x_refs[expression] = el;
  3756. cleanup(() => delete root._x_refs[expression]);
  3757. };
  3758. directive2("ref", handler3);
  3759. directive2("if", (el, { expression }, { effect: effect3, cleanup }) => {
  3760. if (el.tagName.toLowerCase() !== "template")
  3761. warn("x-if can only be used on a <template> tag", el);
  3762. let evaluate2 = evaluateLater(el, expression);
  3763. let show = () => {
  3764. if (el._x_currentIfEl)
  3765. return el._x_currentIfEl;
  3766. let clone2 = el.content.cloneNode(true).firstElementChild;
  3767. addScopeToNode(clone2, {}, el);
  3768. mutateDom(() => {
  3769. el.after(clone2);
  3770. skipDuringClone(() => initTree(clone2))();
  3771. });
  3772. el._x_currentIfEl = clone2;
  3773. el._x_undoIf = () => {
  3774. mutateDom(() => {
  3775. destroyTree(clone2);
  3776. clone2.remove();
  3777. });
  3778. delete el._x_currentIfEl;
  3779. };
  3780. return clone2;
  3781. };
  3782. let hide = () => {
  3783. if (!el._x_undoIf)
  3784. return;
  3785. el._x_undoIf();
  3786. delete el._x_undoIf;
  3787. };
  3788. effect3(() => evaluate2((value) => {
  3789. value ? show() : hide();
  3790. }));
  3791. cleanup(() => el._x_undoIf && el._x_undoIf());
  3792. });
  3793. directive2("id", (el, { expression }, { evaluate: evaluate2 }) => {
  3794. let names = evaluate2(expression);
  3795. names.forEach((name) => setIdRoot(el, name));
  3796. });
  3797. interceptClone((from, to) => {
  3798. if (from._x_ids) {
  3799. to._x_ids = from._x_ids;
  3800. }
  3801. });
  3802. mapAttributes(startingWith("@", into(prefix("on:"))));
  3803. directive2("on", skipDuringClone((el, { value, modifiers, expression }, { cleanup }) => {
  3804. let evaluate2 = expression ? evaluateLater(el, expression) : () => {
  3805. };
  3806. if (el.tagName.toLowerCase() === "template") {
  3807. if (!el._x_forwardEvents)
  3808. el._x_forwardEvents = [];
  3809. if (!el._x_forwardEvents.includes(value))
  3810. el._x_forwardEvents.push(value);
  3811. }
  3812. let removeListener = on3(el, value, modifiers, (e) => {
  3813. evaluate2(() => {
  3814. }, { scope: { "$event": e }, params: [e] });
  3815. });
  3816. cleanup(() => removeListener());
  3817. }));
  3818. warnMissingPluginDirective("Collapse", "collapse", "collapse");
  3819. warnMissingPluginDirective("Intersect", "intersect", "intersect");
  3820. warnMissingPluginDirective("Focus", "trap", "focus");
  3821. warnMissingPluginDirective("Mask", "mask", "mask");
  3822. function warnMissingPluginDirective(name, directiveName, slug) {
  3823. directive2(directiveName, (el) => warn(`You can't use [x-${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
  3824. }
  3825. alpine_default.setEvaluator(normalEvaluator);
  3826. alpine_default.setReactivityEngine({ reactive: import_reactivity10.reactive, effect: import_reactivity10.effect, release: import_reactivity10.stop, raw: import_reactivity10.toRaw });
  3827. var src_default = alpine_default;
  3828. var module_default = src_default;
  3829. }
  3830. });
  3831. // ../alpine/packages/collapse/dist/module.cjs.js
  3832. var require_module_cjs2 = __commonJS({
  3833. "../alpine/packages/collapse/dist/module.cjs.js"(exports, module) {
  3834. var __defProp2 = Object.defineProperty;
  3835. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  3836. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  3837. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  3838. var __export = (target, all2) => {
  3839. for (var name in all2)
  3840. __defProp2(target, name, { get: all2[name], enumerable: true });
  3841. };
  3842. var __copyProps2 = (to, from, except, desc) => {
  3843. if (from && typeof from === "object" || typeof from === "function") {
  3844. for (let key of __getOwnPropNames2(from))
  3845. if (!__hasOwnProp2.call(to, key) && key !== except)
  3846. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  3847. }
  3848. return to;
  3849. };
  3850. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  3851. var module_exports = {};
  3852. __export(module_exports, {
  3853. collapse: () => src_default,
  3854. default: () => module_default
  3855. });
  3856. module.exports = __toCommonJS(module_exports);
  3857. function src_default(Alpine23) {
  3858. Alpine23.directive("collapse", collapse3);
  3859. collapse3.inline = (el, { modifiers }) => {
  3860. if (!modifiers.includes("min"))
  3861. return;
  3862. el._x_doShow = () => {
  3863. };
  3864. el._x_doHide = () => {
  3865. };
  3866. };
  3867. function collapse3(el, { modifiers }) {
  3868. let duration = modifierValue(modifiers, "duration", 250) / 1e3;
  3869. let floor = modifierValue(modifiers, "min", 0);
  3870. let fullyHide = !modifiers.includes("min");
  3871. if (!el._x_isShown)
  3872. el.style.height = `${floor}px`;
  3873. if (!el._x_isShown && fullyHide)
  3874. el.hidden = true;
  3875. if (!el._x_isShown)
  3876. el.style.overflow = "hidden";
  3877. let setFunction = (el2, styles) => {
  3878. let revertFunction = Alpine23.setStyles(el2, styles);
  3879. return styles.height ? () => {
  3880. } : revertFunction;
  3881. };
  3882. let transitionStyles = {
  3883. transitionProperty: "height",
  3884. transitionDuration: `${duration}s`,
  3885. transitionTimingFunction: "cubic-bezier(0.4, 0.0, 0.2, 1)"
  3886. };
  3887. el._x_transition = {
  3888. in(before = () => {
  3889. }, after = () => {
  3890. }) {
  3891. if (fullyHide)
  3892. el.hidden = false;
  3893. if (fullyHide)
  3894. el.style.display = null;
  3895. let current = el.getBoundingClientRect().height;
  3896. el.style.height = "auto";
  3897. let full = el.getBoundingClientRect().height;
  3898. if (current === full) {
  3899. current = floor;
  3900. }
  3901. Alpine23.transition(el, Alpine23.setStyles, {
  3902. during: transitionStyles,
  3903. start: { height: current + "px" },
  3904. end: { height: full + "px" }
  3905. }, () => el._x_isShown = true, () => {
  3906. if (Math.abs(el.getBoundingClientRect().height - full) < 1) {
  3907. el.style.overflow = null;
  3908. }
  3909. });
  3910. },
  3911. out(before = () => {
  3912. }, after = () => {
  3913. }) {
  3914. let full = el.getBoundingClientRect().height;
  3915. Alpine23.transition(el, setFunction, {
  3916. during: transitionStyles,
  3917. start: { height: full + "px" },
  3918. end: { height: floor + "px" }
  3919. }, () => el.style.overflow = "hidden", () => {
  3920. el._x_isShown = false;
  3921. if (el.style.height == `${floor}px` && fullyHide) {
  3922. el.style.display = "none";
  3923. el.hidden = true;
  3924. }
  3925. });
  3926. }
  3927. };
  3928. }
  3929. }
  3930. function modifierValue(modifiers, key, fallback2) {
  3931. if (modifiers.indexOf(key) === -1)
  3932. return fallback2;
  3933. const rawValue = modifiers[modifiers.indexOf(key) + 1];
  3934. if (!rawValue)
  3935. return fallback2;
  3936. if (key === "duration") {
  3937. let match = rawValue.match(/([0-9]+)ms/);
  3938. if (match)
  3939. return match[1];
  3940. }
  3941. if (key === "min") {
  3942. let match = rawValue.match(/([0-9]+)px/);
  3943. if (match)
  3944. return match[1];
  3945. }
  3946. return rawValue;
  3947. }
  3948. var module_default = src_default;
  3949. }
  3950. });
  3951. // ../alpine/packages/focus/dist/module.cjs.js
  3952. var require_module_cjs3 = __commonJS({
  3953. "../alpine/packages/focus/dist/module.cjs.js"(exports, module) {
  3954. var __create2 = Object.create;
  3955. var __defProp2 = Object.defineProperty;
  3956. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  3957. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  3958. var __getProtoOf2 = Object.getPrototypeOf;
  3959. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  3960. var __commonJS2 = (cb, mod) => function __require() {
  3961. return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  3962. };
  3963. var __export = (target, all2) => {
  3964. for (var name in all2)
  3965. __defProp2(target, name, { get: all2[name], enumerable: true });
  3966. };
  3967. var __copyProps2 = (to, from, except, desc) => {
  3968. if (from && typeof from === "object" || typeof from === "function") {
  3969. for (let key of __getOwnPropNames2(from))
  3970. if (!__hasOwnProp2.call(to, key) && key !== except)
  3971. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  3972. }
  3973. return to;
  3974. };
  3975. var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod));
  3976. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  3977. var require_dist = __commonJS2({
  3978. "node_modules/tabbable/dist/index.js"(exports2) {
  3979. "use strict";
  3980. Object.defineProperty(exports2, "__esModule", { value: true });
  3981. var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]:not(slot)", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
  3982. var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
  3983. var NoElement = typeof Element === "undefined";
  3984. var matches = NoElement ? function() {
  3985. } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
  3986. var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
  3987. return element.getRootNode();
  3988. } : function(element) {
  3989. return element.ownerDocument;
  3990. };
  3991. var getCandidates = function getCandidates2(el, includeContainer, filter) {
  3992. var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
  3993. if (includeContainer && matches.call(el, candidateSelector)) {
  3994. candidates.unshift(el);
  3995. }
  3996. candidates = candidates.filter(filter);
  3997. return candidates;
  3998. };
  3999. var getCandidatesIteratively = function getCandidatesIteratively2(elements, includeContainer, options) {
  4000. var candidates = [];
  4001. var elementsToCheck = Array.from(elements);
  4002. while (elementsToCheck.length) {
  4003. var element = elementsToCheck.shift();
  4004. if (element.tagName === "SLOT") {
  4005. var assigned = element.assignedElements();
  4006. var content = assigned.length ? assigned : element.children;
  4007. var nestedCandidates = getCandidatesIteratively2(content, true, options);
  4008. if (options.flatten) {
  4009. candidates.push.apply(candidates, nestedCandidates);
  4010. } else {
  4011. candidates.push({
  4012. scope: element,
  4013. candidates: nestedCandidates
  4014. });
  4015. }
  4016. } else {
  4017. var validCandidate = matches.call(element, candidateSelector);
  4018. if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
  4019. candidates.push(element);
  4020. }
  4021. var shadowRoot = element.shadowRoot || typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
  4022. var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);
  4023. if (shadowRoot && validShadowRoot) {
  4024. var _nestedCandidates = getCandidatesIteratively2(shadowRoot === true ? element.children : shadowRoot.children, true, options);
  4025. if (options.flatten) {
  4026. candidates.push.apply(candidates, _nestedCandidates);
  4027. } else {
  4028. candidates.push({
  4029. scope: element,
  4030. candidates: _nestedCandidates
  4031. });
  4032. }
  4033. } else {
  4034. elementsToCheck.unshift.apply(elementsToCheck, element.children);
  4035. }
  4036. }
  4037. }
  4038. return candidates;
  4039. };
  4040. var getTabindex = function getTabindex2(node, isScope) {
  4041. if (node.tabIndex < 0) {
  4042. if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute("tabindex"), 10))) {
  4043. return 0;
  4044. }
  4045. }
  4046. return node.tabIndex;
  4047. };
  4048. var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
  4049. return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
  4050. };
  4051. var isInput = function isInput2(node) {
  4052. return node.tagName === "INPUT";
  4053. };
  4054. var isHiddenInput = function isHiddenInput2(node) {
  4055. return isInput(node) && node.type === "hidden";
  4056. };
  4057. var isDetailsWithSummary = function isDetailsWithSummary2(node) {
  4058. var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
  4059. return child.tagName === "SUMMARY";
  4060. });
  4061. return r;
  4062. };
  4063. var getCheckedRadio = function getCheckedRadio2(nodes, form) {
  4064. for (var i = 0; i < nodes.length; i++) {
  4065. if (nodes[i].checked && nodes[i].form === form) {
  4066. return nodes[i];
  4067. }
  4068. }
  4069. };
  4070. var isTabbableRadio = function isTabbableRadio2(node) {
  4071. if (!node.name) {
  4072. return true;
  4073. }
  4074. var radioScope = node.form || getRootNode(node);
  4075. var queryRadios = function queryRadios2(name) {
  4076. return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
  4077. };
  4078. var radioSet;
  4079. if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
  4080. radioSet = queryRadios(window.CSS.escape(node.name));
  4081. } else {
  4082. try {
  4083. radioSet = queryRadios(node.name);
  4084. } catch (err) {
  4085. console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
  4086. return false;
  4087. }
  4088. }
  4089. var checked = getCheckedRadio(radioSet, node.form);
  4090. return !checked || checked === node;
  4091. };
  4092. var isRadio = function isRadio2(node) {
  4093. return isInput(node) && node.type === "radio";
  4094. };
  4095. var isNonTabbableRadio = function isNonTabbableRadio2(node) {
  4096. return isRadio(node) && !isTabbableRadio(node);
  4097. };
  4098. var isZeroArea = function isZeroArea2(node) {
  4099. var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
  4100. return width === 0 && height === 0;
  4101. };
  4102. var isHidden = function isHidden2(node, _ref) {
  4103. var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
  4104. if (getComputedStyle(node).visibility === "hidden") {
  4105. return true;
  4106. }
  4107. var isDirectSummary = matches.call(node, "details>summary:first-of-type");
  4108. var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
  4109. if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
  4110. return true;
  4111. }
  4112. var nodeRootHost = getRootNode(node).host;
  4113. var nodeIsAttached = (nodeRootHost === null || nodeRootHost === void 0 ? void 0 : nodeRootHost.ownerDocument.contains(nodeRootHost)) || node.ownerDocument.contains(node);
  4114. if (!displayCheck || displayCheck === "full") {
  4115. if (typeof getShadowRoot === "function") {
  4116. var originalNode = node;
  4117. while (node) {
  4118. var parentElement = node.parentElement;
  4119. var rootNode = getRootNode(node);
  4120. if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {
  4121. return isZeroArea(node);
  4122. } else if (node.assignedSlot) {
  4123. node = node.assignedSlot;
  4124. } else if (!parentElement && rootNode !== node.ownerDocument) {
  4125. node = rootNode.host;
  4126. } else {
  4127. node = parentElement;
  4128. }
  4129. }
  4130. node = originalNode;
  4131. }
  4132. if (nodeIsAttached) {
  4133. return !node.getClientRects().length;
  4134. }
  4135. } else if (displayCheck === "non-zero-area") {
  4136. return isZeroArea(node);
  4137. }
  4138. return false;
  4139. };
  4140. var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
  4141. if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
  4142. var parentNode = node.parentElement;
  4143. while (parentNode) {
  4144. if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
  4145. for (var i = 0; i < parentNode.children.length; i++) {
  4146. var child = parentNode.children.item(i);
  4147. if (child.tagName === "LEGEND") {
  4148. return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
  4149. }
  4150. }
  4151. return true;
  4152. }
  4153. parentNode = parentNode.parentElement;
  4154. }
  4155. }
  4156. return false;
  4157. };
  4158. var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
  4159. if (node.disabled || isHiddenInput(node) || isHidden(node, options) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
  4160. return false;
  4161. }
  4162. return true;
  4163. };
  4164. var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
  4165. if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
  4166. return false;
  4167. }
  4168. return true;
  4169. };
  4170. var isValidShadowRootTabbable = function isValidShadowRootTabbable2(shadowHostNode) {
  4171. var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
  4172. if (isNaN(tabIndex) || tabIndex >= 0) {
  4173. return true;
  4174. }
  4175. return false;
  4176. };
  4177. var sortByOrder = function sortByOrder2(candidates) {
  4178. var regularTabbables = [];
  4179. var orderedTabbables = [];
  4180. candidates.forEach(function(item, i) {
  4181. var isScope = !!item.scope;
  4182. var element = isScope ? item.scope : item;
  4183. var candidateTabindex = getTabindex(element, isScope);
  4184. var elements = isScope ? sortByOrder2(item.candidates) : element;
  4185. if (candidateTabindex === 0) {
  4186. isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
  4187. } else {
  4188. orderedTabbables.push({
  4189. documentOrder: i,
  4190. tabIndex: candidateTabindex,
  4191. item,
  4192. isScope,
  4193. content: elements
  4194. });
  4195. }
  4196. });
  4197. return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
  4198. sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
  4199. return acc;
  4200. }, []).concat(regularTabbables);
  4201. };
  4202. var tabbable = function tabbable2(el, options) {
  4203. options = options || {};
  4204. var candidates;
  4205. if (options.getShadowRoot) {
  4206. candidates = getCandidatesIteratively([el], options.includeContainer, {
  4207. filter: isNodeMatchingSelectorTabbable.bind(null, options),
  4208. flatten: false,
  4209. getShadowRoot: options.getShadowRoot,
  4210. shadowRootFilter: isValidShadowRootTabbable
  4211. });
  4212. } else {
  4213. candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
  4214. }
  4215. return sortByOrder(candidates);
  4216. };
  4217. var focusable2 = function focusable3(el, options) {
  4218. options = options || {};
  4219. var candidates;
  4220. if (options.getShadowRoot) {
  4221. candidates = getCandidatesIteratively([el], options.includeContainer, {
  4222. filter: isNodeMatchingSelectorFocusable.bind(null, options),
  4223. flatten: true,
  4224. getShadowRoot: options.getShadowRoot
  4225. });
  4226. } else {
  4227. candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
  4228. }
  4229. return candidates;
  4230. };
  4231. var isTabbable = function isTabbable2(node, options) {
  4232. options = options || {};
  4233. if (!node) {
  4234. throw new Error("No node provided");
  4235. }
  4236. if (matches.call(node, candidateSelector) === false) {
  4237. return false;
  4238. }
  4239. return isNodeMatchingSelectorTabbable(options, node);
  4240. };
  4241. var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
  4242. var isFocusable2 = function isFocusable3(node, options) {
  4243. options = options || {};
  4244. if (!node) {
  4245. throw new Error("No node provided");
  4246. }
  4247. if (matches.call(node, focusableCandidateSelector) === false) {
  4248. return false;
  4249. }
  4250. return isNodeMatchingSelectorFocusable(options, node);
  4251. };
  4252. exports2.focusable = focusable2;
  4253. exports2.isFocusable = isFocusable2;
  4254. exports2.isTabbable = isTabbable;
  4255. exports2.tabbable = tabbable;
  4256. }
  4257. });
  4258. var require_focus_trap = __commonJS2({
  4259. "node_modules/focus-trap/dist/focus-trap.js"(exports2) {
  4260. "use strict";
  4261. Object.defineProperty(exports2, "__esModule", { value: true });
  4262. var tabbable = require_dist();
  4263. function ownKeys(object, enumerableOnly) {
  4264. var keys = Object.keys(object);
  4265. if (Object.getOwnPropertySymbols) {
  4266. var symbols = Object.getOwnPropertySymbols(object);
  4267. enumerableOnly && (symbols = symbols.filter(function(sym) {
  4268. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  4269. })), keys.push.apply(keys, symbols);
  4270. }
  4271. return keys;
  4272. }
  4273. function _objectSpread2(target) {
  4274. for (var i = 1; i < arguments.length; i++) {
  4275. var source = null != arguments[i] ? arguments[i] : {};
  4276. i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
  4277. _defineProperty(target, key, source[key]);
  4278. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
  4279. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  4280. });
  4281. }
  4282. return target;
  4283. }
  4284. function _defineProperty(obj, key, value) {
  4285. if (key in obj) {
  4286. Object.defineProperty(obj, key, {
  4287. value,
  4288. enumerable: true,
  4289. configurable: true,
  4290. writable: true
  4291. });
  4292. } else {
  4293. obj[key] = value;
  4294. }
  4295. return obj;
  4296. }
  4297. var activeFocusTraps = function() {
  4298. var trapQueue = [];
  4299. return {
  4300. activateTrap: function activateTrap(trap) {
  4301. if (trapQueue.length > 0) {
  4302. var activeTrap = trapQueue[trapQueue.length - 1];
  4303. if (activeTrap !== trap) {
  4304. activeTrap.pause();
  4305. }
  4306. }
  4307. var trapIndex = trapQueue.indexOf(trap);
  4308. if (trapIndex === -1) {
  4309. trapQueue.push(trap);
  4310. } else {
  4311. trapQueue.splice(trapIndex, 1);
  4312. trapQueue.push(trap);
  4313. }
  4314. },
  4315. deactivateTrap: function deactivateTrap(trap) {
  4316. var trapIndex = trapQueue.indexOf(trap);
  4317. if (trapIndex !== -1) {
  4318. trapQueue.splice(trapIndex, 1);
  4319. }
  4320. if (trapQueue.length > 0) {
  4321. trapQueue[trapQueue.length - 1].unpause();
  4322. }
  4323. }
  4324. };
  4325. }();
  4326. var isSelectableInput = function isSelectableInput2(node) {
  4327. return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function";
  4328. };
  4329. var isEscapeEvent = function isEscapeEvent2(e) {
  4330. return e.key === "Escape" || e.key === "Esc" || e.keyCode === 27;
  4331. };
  4332. var isTabEvent = function isTabEvent2(e) {
  4333. return e.key === "Tab" || e.keyCode === 9;
  4334. };
  4335. var delay = function delay2(fn) {
  4336. return setTimeout(fn, 0);
  4337. };
  4338. var findIndex = function findIndex2(arr, fn) {
  4339. var idx = -1;
  4340. arr.every(function(value, i) {
  4341. if (fn(value)) {
  4342. idx = i;
  4343. return false;
  4344. }
  4345. return true;
  4346. });
  4347. return idx;
  4348. };
  4349. var valueOrHandler = function valueOrHandler2(value) {
  4350. for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  4351. params[_key - 1] = arguments[_key];
  4352. }
  4353. return typeof value === "function" ? value.apply(void 0, params) : value;
  4354. };
  4355. var getActualTarget = function getActualTarget2(event) {
  4356. return event.target.shadowRoot && typeof event.composedPath === "function" ? event.composedPath()[0] : event.target;
  4357. };
  4358. var createFocusTrap2 = function createFocusTrap3(elements, userOptions) {
  4359. var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
  4360. var config = _objectSpread2({
  4361. returnFocusOnDeactivate: true,
  4362. escapeDeactivates: true,
  4363. delayInitialFocus: true
  4364. }, userOptions);
  4365. var state = {
  4366. containers: [],
  4367. containerGroups: [],
  4368. tabbableGroups: [],
  4369. nodeFocusedBeforeActivation: null,
  4370. mostRecentlyFocusedNode: null,
  4371. active: false,
  4372. paused: false,
  4373. delayInitialFocusTimer: void 0
  4374. };
  4375. var trap;
  4376. var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
  4377. return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
  4378. };
  4379. var findContainerIndex = function findContainerIndex2(element) {
  4380. return state.containerGroups.findIndex(function(_ref) {
  4381. var container = _ref.container, tabbableNodes = _ref.tabbableNodes;
  4382. return container.contains(element) || tabbableNodes.find(function(node) {
  4383. return node === element;
  4384. });
  4385. });
  4386. };
  4387. var getNodeForOption = function getNodeForOption2(optionName) {
  4388. var optionValue = config[optionName];
  4389. if (typeof optionValue === "function") {
  4390. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  4391. params[_key2 - 1] = arguments[_key2];
  4392. }
  4393. optionValue = optionValue.apply(void 0, params);
  4394. }
  4395. if (optionValue === true) {
  4396. optionValue = void 0;
  4397. }
  4398. if (!optionValue) {
  4399. if (optionValue === void 0 || optionValue === false) {
  4400. return optionValue;
  4401. }
  4402. throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
  4403. }
  4404. var node = optionValue;
  4405. if (typeof optionValue === "string") {
  4406. node = doc.querySelector(optionValue);
  4407. if (!node) {
  4408. throw new Error("`".concat(optionName, "` as selector refers to no known node"));
  4409. }
  4410. }
  4411. return node;
  4412. };
  4413. var getInitialFocusNode = function getInitialFocusNode2() {
  4414. var node = getNodeForOption("initialFocus");
  4415. if (node === false) {
  4416. return false;
  4417. }
  4418. if (node === void 0) {
  4419. if (findContainerIndex(doc.activeElement) >= 0) {
  4420. node = doc.activeElement;
  4421. } else {
  4422. var firstTabbableGroup = state.tabbableGroups[0];
  4423. var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
  4424. node = firstTabbableNode || getNodeForOption("fallbackFocus");
  4425. }
  4426. }
  4427. if (!node) {
  4428. throw new Error("Your focus-trap needs to have at least one focusable element");
  4429. }
  4430. return node;
  4431. };
  4432. var updateTabbableNodes = function updateTabbableNodes2() {
  4433. state.containerGroups = state.containers.map(function(container) {
  4434. var tabbableNodes = tabbable.tabbable(container, config.tabbableOptions);
  4435. var focusableNodes = tabbable.focusable(container, config.tabbableOptions);
  4436. return {
  4437. container,
  4438. tabbableNodes,
  4439. focusableNodes,
  4440. firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
  4441. lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
  4442. nextTabbableNode: function nextTabbableNode(node) {
  4443. var forward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
  4444. var nodeIdx = focusableNodes.findIndex(function(n) {
  4445. return n === node;
  4446. });
  4447. if (nodeIdx < 0) {
  4448. return void 0;
  4449. }
  4450. if (forward) {
  4451. return focusableNodes.slice(nodeIdx + 1).find(function(n) {
  4452. return tabbable.isTabbable(n, config.tabbableOptions);
  4453. });
  4454. }
  4455. return focusableNodes.slice(0, nodeIdx).reverse().find(function(n) {
  4456. return tabbable.isTabbable(n, config.tabbableOptions);
  4457. });
  4458. }
  4459. };
  4460. });
  4461. state.tabbableGroups = state.containerGroups.filter(function(group) {
  4462. return group.tabbableNodes.length > 0;
  4463. });
  4464. if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
  4465. throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
  4466. }
  4467. };
  4468. var tryFocus = function tryFocus2(node) {
  4469. if (node === false) {
  4470. return;
  4471. }
  4472. if (node === doc.activeElement) {
  4473. return;
  4474. }
  4475. if (!node || !node.focus) {
  4476. tryFocus2(getInitialFocusNode());
  4477. return;
  4478. }
  4479. node.focus({
  4480. preventScroll: !!config.preventScroll
  4481. });
  4482. state.mostRecentlyFocusedNode = node;
  4483. if (isSelectableInput(node)) {
  4484. node.select();
  4485. }
  4486. };
  4487. var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
  4488. var node = getNodeForOption("setReturnFocus", previousActiveElement);
  4489. return node ? node : node === false ? false : previousActiveElement;
  4490. };
  4491. var checkPointerDown = function checkPointerDown2(e) {
  4492. var target = getActualTarget(e);
  4493. if (findContainerIndex(target) >= 0) {
  4494. return;
  4495. }
  4496. if (valueOrHandler(config.clickOutsideDeactivates, e)) {
  4497. trap.deactivate({
  4498. returnFocus: config.returnFocusOnDeactivate && !tabbable.isFocusable(target, config.tabbableOptions)
  4499. });
  4500. return;
  4501. }
  4502. if (valueOrHandler(config.allowOutsideClick, e)) {
  4503. return;
  4504. }
  4505. e.preventDefault();
  4506. };
  4507. var checkFocusIn = function checkFocusIn2(e) {
  4508. var target = getActualTarget(e);
  4509. var targetContained = findContainerIndex(target) >= 0;
  4510. if (targetContained || target instanceof Document) {
  4511. if (targetContained) {
  4512. state.mostRecentlyFocusedNode = target;
  4513. }
  4514. } else {
  4515. e.stopImmediatePropagation();
  4516. tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
  4517. }
  4518. };
  4519. var checkTab = function checkTab2(e) {
  4520. var target = getActualTarget(e);
  4521. updateTabbableNodes();
  4522. var destinationNode = null;
  4523. if (state.tabbableGroups.length > 0) {
  4524. var containerIndex = findContainerIndex(target);
  4525. var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0;
  4526. if (containerIndex < 0) {
  4527. if (e.shiftKey) {
  4528. destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
  4529. } else {
  4530. destinationNode = state.tabbableGroups[0].firstTabbableNode;
  4531. }
  4532. } else if (e.shiftKey) {
  4533. var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref2) {
  4534. var firstTabbableNode = _ref2.firstTabbableNode;
  4535. return target === firstTabbableNode;
  4536. });
  4537. if (startOfGroupIndex < 0 && (containerGroup.container === target || tabbable.isFocusable(target, config.tabbableOptions) && !tabbable.isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
  4538. startOfGroupIndex = containerIndex;
  4539. }
  4540. if (startOfGroupIndex >= 0) {
  4541. var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
  4542. var destinationGroup = state.tabbableGroups[destinationGroupIndex];
  4543. destinationNode = destinationGroup.lastTabbableNode;
  4544. }
  4545. } else {
  4546. var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {
  4547. var lastTabbableNode = _ref3.lastTabbableNode;
  4548. return target === lastTabbableNode;
  4549. });
  4550. if (lastOfGroupIndex < 0 && (containerGroup.container === target || tabbable.isFocusable(target, config.tabbableOptions) && !tabbable.isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
  4551. lastOfGroupIndex = containerIndex;
  4552. }
  4553. if (lastOfGroupIndex >= 0) {
  4554. var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
  4555. var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
  4556. destinationNode = _destinationGroup.firstTabbableNode;
  4557. }
  4558. }
  4559. } else {
  4560. destinationNode = getNodeForOption("fallbackFocus");
  4561. }
  4562. if (destinationNode) {
  4563. e.preventDefault();
  4564. tryFocus(destinationNode);
  4565. }
  4566. };
  4567. var checkKey = function checkKey2(e) {
  4568. if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates, e) !== false) {
  4569. e.preventDefault();
  4570. trap.deactivate();
  4571. return;
  4572. }
  4573. if (isTabEvent(e)) {
  4574. checkTab(e);
  4575. return;
  4576. }
  4577. };
  4578. var checkClick = function checkClick2(e) {
  4579. var target = getActualTarget(e);
  4580. if (findContainerIndex(target) >= 0) {
  4581. return;
  4582. }
  4583. if (valueOrHandler(config.clickOutsideDeactivates, e)) {
  4584. return;
  4585. }
  4586. if (valueOrHandler(config.allowOutsideClick, e)) {
  4587. return;
  4588. }
  4589. e.preventDefault();
  4590. e.stopImmediatePropagation();
  4591. };
  4592. var addListeners = function addListeners2() {
  4593. if (!state.active) {
  4594. return;
  4595. }
  4596. activeFocusTraps.activateTrap(trap);
  4597. state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {
  4598. tryFocus(getInitialFocusNode());
  4599. }) : tryFocus(getInitialFocusNode());
  4600. doc.addEventListener("focusin", checkFocusIn, true);
  4601. doc.addEventListener("mousedown", checkPointerDown, {
  4602. capture: true,
  4603. passive: false
  4604. });
  4605. doc.addEventListener("touchstart", checkPointerDown, {
  4606. capture: true,
  4607. passive: false
  4608. });
  4609. doc.addEventListener("click", checkClick, {
  4610. capture: true,
  4611. passive: false
  4612. });
  4613. doc.addEventListener("keydown", checkKey, {
  4614. capture: true,
  4615. passive: false
  4616. });
  4617. return trap;
  4618. };
  4619. var removeListeners = function removeListeners2() {
  4620. if (!state.active) {
  4621. return;
  4622. }
  4623. doc.removeEventListener("focusin", checkFocusIn, true);
  4624. doc.removeEventListener("mousedown", checkPointerDown, true);
  4625. doc.removeEventListener("touchstart", checkPointerDown, true);
  4626. doc.removeEventListener("click", checkClick, true);
  4627. doc.removeEventListener("keydown", checkKey, true);
  4628. return trap;
  4629. };
  4630. trap = {
  4631. get active() {
  4632. return state.active;
  4633. },
  4634. get paused() {
  4635. return state.paused;
  4636. },
  4637. activate: function activate(activateOptions) {
  4638. if (state.active) {
  4639. return this;
  4640. }
  4641. var onActivate = getOption(activateOptions, "onActivate");
  4642. var onPostActivate = getOption(activateOptions, "onPostActivate");
  4643. var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap");
  4644. if (!checkCanFocusTrap) {
  4645. updateTabbableNodes();
  4646. }
  4647. state.active = true;
  4648. state.paused = false;
  4649. state.nodeFocusedBeforeActivation = doc.activeElement;
  4650. if (onActivate) {
  4651. onActivate();
  4652. }
  4653. var finishActivation = function finishActivation2() {
  4654. if (checkCanFocusTrap) {
  4655. updateTabbableNodes();
  4656. }
  4657. addListeners();
  4658. if (onPostActivate) {
  4659. onPostActivate();
  4660. }
  4661. };
  4662. if (checkCanFocusTrap) {
  4663. checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
  4664. return this;
  4665. }
  4666. finishActivation();
  4667. return this;
  4668. },
  4669. deactivate: function deactivate(deactivateOptions) {
  4670. if (!state.active) {
  4671. return this;
  4672. }
  4673. var options = _objectSpread2({
  4674. onDeactivate: config.onDeactivate,
  4675. onPostDeactivate: config.onPostDeactivate,
  4676. checkCanReturnFocus: config.checkCanReturnFocus
  4677. }, deactivateOptions);
  4678. clearTimeout(state.delayInitialFocusTimer);
  4679. state.delayInitialFocusTimer = void 0;
  4680. removeListeners();
  4681. state.active = false;
  4682. state.paused = false;
  4683. activeFocusTraps.deactivateTrap(trap);
  4684. var onDeactivate = getOption(options, "onDeactivate");
  4685. var onPostDeactivate = getOption(options, "onPostDeactivate");
  4686. var checkCanReturnFocus = getOption(options, "checkCanReturnFocus");
  4687. var returnFocus = getOption(options, "returnFocus", "returnFocusOnDeactivate");
  4688. if (onDeactivate) {
  4689. onDeactivate();
  4690. }
  4691. var finishDeactivation = function finishDeactivation2() {
  4692. delay(function() {
  4693. if (returnFocus) {
  4694. tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
  4695. }
  4696. if (onPostDeactivate) {
  4697. onPostDeactivate();
  4698. }
  4699. });
  4700. };
  4701. if (returnFocus && checkCanReturnFocus) {
  4702. checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
  4703. return this;
  4704. }
  4705. finishDeactivation();
  4706. return this;
  4707. },
  4708. pause: function pause() {
  4709. if (state.paused || !state.active) {
  4710. return this;
  4711. }
  4712. state.paused = true;
  4713. removeListeners();
  4714. return this;
  4715. },
  4716. unpause: function unpause() {
  4717. if (!state.paused || !state.active) {
  4718. return this;
  4719. }
  4720. state.paused = false;
  4721. updateTabbableNodes();
  4722. addListeners();
  4723. return this;
  4724. },
  4725. updateContainerElements: function updateContainerElements(containerElements) {
  4726. var elementsAsArray = [].concat(containerElements).filter(Boolean);
  4727. state.containers = elementsAsArray.map(function(element) {
  4728. return typeof element === "string" ? doc.querySelector(element) : element;
  4729. });
  4730. if (state.active) {
  4731. updateTabbableNodes();
  4732. }
  4733. return this;
  4734. }
  4735. };
  4736. trap.updateContainerElements(elements);
  4737. return trap;
  4738. };
  4739. exports2.createFocusTrap = createFocusTrap2;
  4740. }
  4741. });
  4742. var module_exports = {};
  4743. __export(module_exports, {
  4744. default: () => module_default,
  4745. focus: () => src_default
  4746. });
  4747. module.exports = __toCommonJS(module_exports);
  4748. var import_focus_trap = __toESM2(require_focus_trap());
  4749. var import_tabbable = __toESM2(require_dist());
  4750. function src_default(Alpine23) {
  4751. let lastFocused;
  4752. let currentFocused;
  4753. window.addEventListener("focusin", () => {
  4754. lastFocused = currentFocused;
  4755. currentFocused = document.activeElement;
  4756. });
  4757. Alpine23.magic("focus", (el) => {
  4758. let within = el;
  4759. return {
  4760. __noscroll: false,
  4761. __wrapAround: false,
  4762. within(el2) {
  4763. within = el2;
  4764. return this;
  4765. },
  4766. withoutScrolling() {
  4767. this.__noscroll = true;
  4768. return this;
  4769. },
  4770. noscroll() {
  4771. this.__noscroll = true;
  4772. return this;
  4773. },
  4774. withWrapAround() {
  4775. this.__wrapAround = true;
  4776. return this;
  4777. },
  4778. wrap() {
  4779. return this.withWrapAround();
  4780. },
  4781. focusable(el2) {
  4782. return (0, import_tabbable.isFocusable)(el2);
  4783. },
  4784. previouslyFocused() {
  4785. return lastFocused;
  4786. },
  4787. lastFocused() {
  4788. return lastFocused;
  4789. },
  4790. focused() {
  4791. return currentFocused;
  4792. },
  4793. focusables() {
  4794. if (Array.isArray(within))
  4795. return within;
  4796. return (0, import_tabbable.focusable)(within, { displayCheck: "none" });
  4797. },
  4798. all() {
  4799. return this.focusables();
  4800. },
  4801. isFirst(el2) {
  4802. let els2 = this.all();
  4803. return els2[0] && els2[0].isSameNode(el2);
  4804. },
  4805. isLast(el2) {
  4806. let els2 = this.all();
  4807. return els2.length && els2.slice(-1)[0].isSameNode(el2);
  4808. },
  4809. getFirst() {
  4810. return this.all()[0];
  4811. },
  4812. getLast() {
  4813. return this.all().slice(-1)[0];
  4814. },
  4815. getNext() {
  4816. let list = this.all();
  4817. let current = document.activeElement;
  4818. if (list.indexOf(current) === -1)
  4819. return;
  4820. if (this.__wrapAround && list.indexOf(current) === list.length - 1) {
  4821. return list[0];
  4822. }
  4823. return list[list.indexOf(current) + 1];
  4824. },
  4825. getPrevious() {
  4826. let list = this.all();
  4827. let current = document.activeElement;
  4828. if (list.indexOf(current) === -1)
  4829. return;
  4830. if (this.__wrapAround && list.indexOf(current) === 0) {
  4831. return list.slice(-1)[0];
  4832. }
  4833. return list[list.indexOf(current) - 1];
  4834. },
  4835. first() {
  4836. this.focus(this.getFirst());
  4837. },
  4838. last() {
  4839. this.focus(this.getLast());
  4840. },
  4841. next() {
  4842. this.focus(this.getNext());
  4843. },
  4844. previous() {
  4845. this.focus(this.getPrevious());
  4846. },
  4847. prev() {
  4848. return this.previous();
  4849. },
  4850. focus(el2) {
  4851. if (!el2)
  4852. return;
  4853. setTimeout(() => {
  4854. if (!el2.hasAttribute("tabindex"))
  4855. el2.setAttribute("tabindex", "0");
  4856. el2.focus({ preventScroll: this.__noscroll });
  4857. });
  4858. }
  4859. };
  4860. });
  4861. Alpine23.directive("trap", Alpine23.skipDuringClone((el, { expression, modifiers }, { effect, evaluateLater, cleanup }) => {
  4862. let evaluator = evaluateLater(expression);
  4863. let oldValue = false;
  4864. let options = {
  4865. escapeDeactivates: false,
  4866. allowOutsideClick: true,
  4867. fallbackFocus: () => el
  4868. };
  4869. if (modifiers.includes("noautofocus")) {
  4870. options.initialFocus = false;
  4871. } else {
  4872. let autofocusEl = el.querySelector("[autofocus]");
  4873. if (autofocusEl)
  4874. options.initialFocus = autofocusEl;
  4875. }
  4876. let trap = (0, import_focus_trap.createFocusTrap)(el, options);
  4877. let undoInert = () => {
  4878. };
  4879. let undoDisableScrolling = () => {
  4880. };
  4881. const releaseFocus = () => {
  4882. undoInert();
  4883. undoInert = () => {
  4884. };
  4885. undoDisableScrolling();
  4886. undoDisableScrolling = () => {
  4887. };
  4888. trap.deactivate({
  4889. returnFocus: !modifiers.includes("noreturn")
  4890. });
  4891. };
  4892. effect(() => evaluator((value) => {
  4893. if (oldValue === value)
  4894. return;
  4895. if (value && !oldValue) {
  4896. if (modifiers.includes("noscroll"))
  4897. undoDisableScrolling = disableScrolling();
  4898. if (modifiers.includes("inert"))
  4899. undoInert = setInert(el);
  4900. setTimeout(() => {
  4901. trap.activate();
  4902. }, 15);
  4903. }
  4904. if (!value && oldValue) {
  4905. releaseFocus();
  4906. }
  4907. oldValue = !!value;
  4908. }));
  4909. cleanup(releaseFocus);
  4910. }, (el, { expression, modifiers }, { evaluate }) => {
  4911. if (modifiers.includes("inert") && evaluate(expression))
  4912. setInert(el);
  4913. }));
  4914. }
  4915. function setInert(el) {
  4916. let undos = [];
  4917. crawlSiblingsUp(el, (sibling) => {
  4918. let cache = sibling.hasAttribute("aria-hidden");
  4919. sibling.setAttribute("aria-hidden", "true");
  4920. undos.push(() => cache || sibling.removeAttribute("aria-hidden"));
  4921. });
  4922. return () => {
  4923. while (undos.length)
  4924. undos.pop()();
  4925. };
  4926. }
  4927. function crawlSiblingsUp(el, callback) {
  4928. if (el.isSameNode(document.body) || !el.parentNode)
  4929. return;
  4930. Array.from(el.parentNode.children).forEach((sibling) => {
  4931. if (sibling.isSameNode(el)) {
  4932. crawlSiblingsUp(el.parentNode, callback);
  4933. } else {
  4934. callback(sibling);
  4935. }
  4936. });
  4937. }
  4938. function disableScrolling() {
  4939. let overflow = document.documentElement.style.overflow;
  4940. let paddingRight = document.documentElement.style.paddingRight;
  4941. let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
  4942. document.documentElement.style.overflow = "hidden";
  4943. document.documentElement.style.paddingRight = `${scrollbarWidth}px`;
  4944. return () => {
  4945. document.documentElement.style.overflow = overflow;
  4946. document.documentElement.style.paddingRight = paddingRight;
  4947. };
  4948. }
  4949. var module_default = src_default;
  4950. }
  4951. });
  4952. // ../alpine/packages/persist/dist/module.cjs.js
  4953. var require_module_cjs4 = __commonJS({
  4954. "../alpine/packages/persist/dist/module.cjs.js"(exports, module) {
  4955. var __defProp2 = Object.defineProperty;
  4956. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  4957. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  4958. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  4959. var __export = (target, all2) => {
  4960. for (var name in all2)
  4961. __defProp2(target, name, { get: all2[name], enumerable: true });
  4962. };
  4963. var __copyProps2 = (to, from, except, desc) => {
  4964. if (from && typeof from === "object" || typeof from === "function") {
  4965. for (let key of __getOwnPropNames2(from))
  4966. if (!__hasOwnProp2.call(to, key) && key !== except)
  4967. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  4968. }
  4969. return to;
  4970. };
  4971. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  4972. var module_exports = {};
  4973. __export(module_exports, {
  4974. default: () => module_default,
  4975. persist: () => src_default
  4976. });
  4977. module.exports = __toCommonJS(module_exports);
  4978. function src_default(Alpine23) {
  4979. let persist3 = () => {
  4980. let alias;
  4981. let storage;
  4982. try {
  4983. storage = localStorage;
  4984. } catch (e) {
  4985. console.error(e);
  4986. console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable.");
  4987. let dummy = /* @__PURE__ */ new Map();
  4988. storage = {
  4989. getItem: dummy.get.bind(dummy),
  4990. setItem: dummy.set.bind(dummy)
  4991. };
  4992. }
  4993. return Alpine23.interceptor((initialValue, getter, setter, path, key) => {
  4994. let lookup = alias || `_x_${path}`;
  4995. let initial = storageHas(lookup, storage) ? storageGet(lookup, storage) : initialValue;
  4996. setter(initial);
  4997. Alpine23.effect(() => {
  4998. let value = getter();
  4999. storageSet(lookup, value, storage);
  5000. setter(value);
  5001. });
  5002. return initial;
  5003. }, (func) => {
  5004. func.as = (key) => {
  5005. alias = key;
  5006. return func;
  5007. }, func.using = (target) => {
  5008. storage = target;
  5009. return func;
  5010. };
  5011. });
  5012. };
  5013. Object.defineProperty(Alpine23, "$persist", { get: () => persist3() });
  5014. Alpine23.magic("persist", persist3);
  5015. Alpine23.persist = (key, { get, set }, storage = localStorage) => {
  5016. let initial = storageHas(key, storage) ? storageGet(key, storage) : get();
  5017. set(initial);
  5018. Alpine23.effect(() => {
  5019. let value = get();
  5020. storageSet(key, value, storage);
  5021. set(value);
  5022. });
  5023. };
  5024. }
  5025. function storageHas(key, storage) {
  5026. return storage.getItem(key) !== null;
  5027. }
  5028. function storageGet(key, storage) {
  5029. let value = storage.getItem(key, storage);
  5030. if (value === void 0)
  5031. return;
  5032. return JSON.parse(value);
  5033. }
  5034. function storageSet(key, value, storage) {
  5035. storage.setItem(key, JSON.stringify(value));
  5036. }
  5037. var module_default = src_default;
  5038. }
  5039. });
  5040. // ../alpine/packages/intersect/dist/module.cjs.js
  5041. var require_module_cjs5 = __commonJS({
  5042. "../alpine/packages/intersect/dist/module.cjs.js"(exports, module) {
  5043. var __defProp2 = Object.defineProperty;
  5044. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  5045. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  5046. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  5047. var __export = (target, all2) => {
  5048. for (var name in all2)
  5049. __defProp2(target, name, { get: all2[name], enumerable: true });
  5050. };
  5051. var __copyProps2 = (to, from, except, desc) => {
  5052. if (from && typeof from === "object" || typeof from === "function") {
  5053. for (let key of __getOwnPropNames2(from))
  5054. if (!__hasOwnProp2.call(to, key) && key !== except)
  5055. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  5056. }
  5057. return to;
  5058. };
  5059. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  5060. var module_exports = {};
  5061. __export(module_exports, {
  5062. default: () => module_default,
  5063. intersect: () => src_default
  5064. });
  5065. module.exports = __toCommonJS(module_exports);
  5066. function src_default(Alpine23) {
  5067. Alpine23.directive("intersect", Alpine23.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater, cleanup }) => {
  5068. let evaluate = evaluateLater(expression);
  5069. let options = {
  5070. rootMargin: getRootMargin(modifiers),
  5071. threshold: getThreshold(modifiers)
  5072. };
  5073. let observer = new IntersectionObserver((entries) => {
  5074. entries.forEach((entry) => {
  5075. if (entry.isIntersecting === (value === "leave"))
  5076. return;
  5077. evaluate();
  5078. modifiers.includes("once") && observer.disconnect();
  5079. });
  5080. }, options);
  5081. observer.observe(el);
  5082. cleanup(() => {
  5083. observer.disconnect();
  5084. });
  5085. }));
  5086. }
  5087. function getThreshold(modifiers) {
  5088. if (modifiers.includes("full"))
  5089. return 0.99;
  5090. if (modifiers.includes("half"))
  5091. return 0.5;
  5092. if (!modifiers.includes("threshold"))
  5093. return 0;
  5094. let threshold = modifiers[modifiers.indexOf("threshold") + 1];
  5095. if (threshold === "100")
  5096. return 1;
  5097. if (threshold === "0")
  5098. return 0;
  5099. return Number(`.${threshold}`);
  5100. }
  5101. function getLengthValue(rawValue) {
  5102. let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/);
  5103. return match ? match[1] + (match[2] || "px") : void 0;
  5104. }
  5105. function getRootMargin(modifiers) {
  5106. const key = "margin";
  5107. const fallback2 = "0px 0px 0px 0px";
  5108. const index = modifiers.indexOf(key);
  5109. if (index === -1)
  5110. return fallback2;
  5111. let values = [];
  5112. for (let i = 1; i < 5; i++) {
  5113. values.push(getLengthValue(modifiers[index + i] || ""));
  5114. }
  5115. values = values.filter((v) => v !== void 0);
  5116. return values.length ? values.join(" ").trim() : fallback2;
  5117. }
  5118. var module_default = src_default;
  5119. }
  5120. });
  5121. // node_modules/@alpinejs/resize/dist/module.cjs.js
  5122. var require_module_cjs6 = __commonJS({
  5123. "node_modules/@alpinejs/resize/dist/module.cjs.js"(exports, module) {
  5124. var __defProp2 = Object.defineProperty;
  5125. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  5126. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  5127. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  5128. var __export = (target, all2) => {
  5129. for (var name in all2)
  5130. __defProp2(target, name, { get: all2[name], enumerable: true });
  5131. };
  5132. var __copyProps2 = (to, from, except, desc) => {
  5133. if (from && typeof from === "object" || typeof from === "function") {
  5134. for (let key of __getOwnPropNames2(from))
  5135. if (!__hasOwnProp2.call(to, key) && key !== except)
  5136. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  5137. }
  5138. return to;
  5139. };
  5140. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  5141. var module_exports = {};
  5142. __export(module_exports, {
  5143. default: () => module_default,
  5144. resize: () => src_default
  5145. });
  5146. module.exports = __toCommonJS(module_exports);
  5147. function src_default(Alpine23) {
  5148. Alpine23.directive("resize", Alpine23.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater, cleanup }) => {
  5149. let evaluator = evaluateLater(expression);
  5150. let evaluate = (width, height) => {
  5151. evaluator(() => {
  5152. }, { scope: { "$width": width, "$height": height } });
  5153. };
  5154. let off = modifiers.includes("document") ? onDocumentResize(evaluate) : onElResize(el, evaluate);
  5155. cleanup(() => off());
  5156. }));
  5157. }
  5158. function onElResize(el, callback) {
  5159. let observer = new ResizeObserver((entries) => {
  5160. let [width, height] = dimensions(entries);
  5161. callback(width, height);
  5162. });
  5163. observer.observe(el);
  5164. return () => observer.disconnect();
  5165. }
  5166. var documentResizeObserver;
  5167. var documentResizeObserverCallbacks = /* @__PURE__ */ new Set();
  5168. function onDocumentResize(callback) {
  5169. documentResizeObserverCallbacks.add(callback);
  5170. if (!documentResizeObserver) {
  5171. documentResizeObserver = new ResizeObserver((entries) => {
  5172. let [width, height] = dimensions(entries);
  5173. documentResizeObserverCallbacks.forEach((i) => i(width, height));
  5174. });
  5175. documentResizeObserver.observe(document.documentElement);
  5176. }
  5177. return () => {
  5178. documentResizeObserverCallbacks.delete(callback);
  5179. };
  5180. }
  5181. function dimensions(entries) {
  5182. let width, height;
  5183. for (let entry of entries) {
  5184. width = entry.borderBoxSize[0].inlineSize;
  5185. height = entry.borderBoxSize[0].blockSize;
  5186. }
  5187. return [width, height];
  5188. }
  5189. var module_default = src_default;
  5190. }
  5191. });
  5192. // ../alpine/packages/anchor/dist/module.cjs.js
  5193. var require_module_cjs7 = __commonJS({
  5194. "../alpine/packages/anchor/dist/module.cjs.js"(exports, module) {
  5195. var __defProp2 = Object.defineProperty;
  5196. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  5197. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  5198. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  5199. var __export = (target, all2) => {
  5200. for (var name in all2)
  5201. __defProp2(target, name, { get: all2[name], enumerable: true });
  5202. };
  5203. var __copyProps2 = (to, from, except, desc) => {
  5204. if (from && typeof from === "object" || typeof from === "function") {
  5205. for (let key of __getOwnPropNames2(from))
  5206. if (!__hasOwnProp2.call(to, key) && key !== except)
  5207. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  5208. }
  5209. return to;
  5210. };
  5211. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  5212. var module_exports = {};
  5213. __export(module_exports, {
  5214. anchor: () => src_default,
  5215. default: () => module_default
  5216. });
  5217. module.exports = __toCommonJS(module_exports);
  5218. var min = Math.min;
  5219. var max = Math.max;
  5220. var round = Math.round;
  5221. var floor = Math.floor;
  5222. var createCoords = (v) => ({
  5223. x: v,
  5224. y: v
  5225. });
  5226. var oppositeSideMap = {
  5227. left: "right",
  5228. right: "left",
  5229. bottom: "top",
  5230. top: "bottom"
  5231. };
  5232. var oppositeAlignmentMap = {
  5233. start: "end",
  5234. end: "start"
  5235. };
  5236. function clamp(start2, value, end) {
  5237. return max(start2, min(value, end));
  5238. }
  5239. function evaluate(value, param) {
  5240. return typeof value === "function" ? value(param) : value;
  5241. }
  5242. function getSide(placement) {
  5243. return placement.split("-")[0];
  5244. }
  5245. function getAlignment(placement) {
  5246. return placement.split("-")[1];
  5247. }
  5248. function getOppositeAxis(axis) {
  5249. return axis === "x" ? "y" : "x";
  5250. }
  5251. function getAxisLength(axis) {
  5252. return axis === "y" ? "height" : "width";
  5253. }
  5254. function getSideAxis(placement) {
  5255. return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
  5256. }
  5257. function getAlignmentAxis(placement) {
  5258. return getOppositeAxis(getSideAxis(placement));
  5259. }
  5260. function getAlignmentSides(placement, rects, rtl) {
  5261. if (rtl === void 0) {
  5262. rtl = false;
  5263. }
  5264. const alignment = getAlignment(placement);
  5265. const alignmentAxis = getAlignmentAxis(placement);
  5266. const length = getAxisLength(alignmentAxis);
  5267. let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
  5268. if (rects.reference[length] > rects.floating[length]) {
  5269. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  5270. }
  5271. return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
  5272. }
  5273. function getExpandedPlacements(placement) {
  5274. const oppositePlacement = getOppositePlacement(placement);
  5275. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  5276. }
  5277. function getOppositeAlignmentPlacement(placement) {
  5278. return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
  5279. }
  5280. function getSideList(side, isStart, rtl) {
  5281. const lr = ["left", "right"];
  5282. const rl = ["right", "left"];
  5283. const tb = ["top", "bottom"];
  5284. const bt = ["bottom", "top"];
  5285. switch (side) {
  5286. case "top":
  5287. case "bottom":
  5288. if (rtl)
  5289. return isStart ? rl : lr;
  5290. return isStart ? lr : rl;
  5291. case "left":
  5292. case "right":
  5293. return isStart ? tb : bt;
  5294. default:
  5295. return [];
  5296. }
  5297. }
  5298. function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
  5299. const alignment = getAlignment(placement);
  5300. let list = getSideList(getSide(placement), direction === "start", rtl);
  5301. if (alignment) {
  5302. list = list.map((side) => side + "-" + alignment);
  5303. if (flipAlignment) {
  5304. list = list.concat(list.map(getOppositeAlignmentPlacement));
  5305. }
  5306. }
  5307. return list;
  5308. }
  5309. function getOppositePlacement(placement) {
  5310. return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
  5311. }
  5312. function expandPaddingObject(padding) {
  5313. return {
  5314. top: 0,
  5315. right: 0,
  5316. bottom: 0,
  5317. left: 0,
  5318. ...padding
  5319. };
  5320. }
  5321. function getPaddingObject(padding) {
  5322. return typeof padding !== "number" ? expandPaddingObject(padding) : {
  5323. top: padding,
  5324. right: padding,
  5325. bottom: padding,
  5326. left: padding
  5327. };
  5328. }
  5329. function rectToClientRect(rect) {
  5330. return {
  5331. ...rect,
  5332. top: rect.y,
  5333. left: rect.x,
  5334. right: rect.x + rect.width,
  5335. bottom: rect.y + rect.height
  5336. };
  5337. }
  5338. function computeCoordsFromPlacement(_ref, placement, rtl) {
  5339. let {
  5340. reference,
  5341. floating
  5342. } = _ref;
  5343. const sideAxis = getSideAxis(placement);
  5344. const alignmentAxis = getAlignmentAxis(placement);
  5345. const alignLength = getAxisLength(alignmentAxis);
  5346. const side = getSide(placement);
  5347. const isVertical = sideAxis === "y";
  5348. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  5349. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  5350. const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  5351. let coords;
  5352. switch (side) {
  5353. case "top":
  5354. coords = {
  5355. x: commonX,
  5356. y: reference.y - floating.height
  5357. };
  5358. break;
  5359. case "bottom":
  5360. coords = {
  5361. x: commonX,
  5362. y: reference.y + reference.height
  5363. };
  5364. break;
  5365. case "right":
  5366. coords = {
  5367. x: reference.x + reference.width,
  5368. y: commonY
  5369. };
  5370. break;
  5371. case "left":
  5372. coords = {
  5373. x: reference.x - floating.width,
  5374. y: commonY
  5375. };
  5376. break;
  5377. default:
  5378. coords = {
  5379. x: reference.x,
  5380. y: reference.y
  5381. };
  5382. }
  5383. switch (getAlignment(placement)) {
  5384. case "start":
  5385. coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  5386. break;
  5387. case "end":
  5388. coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  5389. break;
  5390. }
  5391. return coords;
  5392. }
  5393. var computePosition = async (reference, floating, config) => {
  5394. const {
  5395. placement = "bottom",
  5396. strategy = "absolute",
  5397. middleware = [],
  5398. platform: platform2
  5399. } = config;
  5400. const validMiddleware = middleware.filter(Boolean);
  5401. const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
  5402. let rects = await platform2.getElementRects({
  5403. reference,
  5404. floating,
  5405. strategy
  5406. });
  5407. let {
  5408. x,
  5409. y
  5410. } = computeCoordsFromPlacement(rects, placement, rtl);
  5411. let statefulPlacement = placement;
  5412. let middlewareData = {};
  5413. let resetCount = 0;
  5414. for (let i = 0; i < validMiddleware.length; i++) {
  5415. const {
  5416. name,
  5417. fn
  5418. } = validMiddleware[i];
  5419. const {
  5420. x: nextX,
  5421. y: nextY,
  5422. data,
  5423. reset
  5424. } = await fn({
  5425. x,
  5426. y,
  5427. initialPlacement: placement,
  5428. placement: statefulPlacement,
  5429. strategy,
  5430. middlewareData,
  5431. rects,
  5432. platform: platform2,
  5433. elements: {
  5434. reference,
  5435. floating
  5436. }
  5437. });
  5438. x = nextX != null ? nextX : x;
  5439. y = nextY != null ? nextY : y;
  5440. middlewareData = {
  5441. ...middlewareData,
  5442. [name]: {
  5443. ...middlewareData[name],
  5444. ...data
  5445. }
  5446. };
  5447. if (reset && resetCount <= 50) {
  5448. resetCount++;
  5449. if (typeof reset === "object") {
  5450. if (reset.placement) {
  5451. statefulPlacement = reset.placement;
  5452. }
  5453. if (reset.rects) {
  5454. rects = reset.rects === true ? await platform2.getElementRects({
  5455. reference,
  5456. floating,
  5457. strategy
  5458. }) : reset.rects;
  5459. }
  5460. ({
  5461. x,
  5462. y
  5463. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  5464. }
  5465. i = -1;
  5466. continue;
  5467. }
  5468. }
  5469. return {
  5470. x,
  5471. y,
  5472. placement: statefulPlacement,
  5473. strategy,
  5474. middlewareData
  5475. };
  5476. };
  5477. async function detectOverflow(state, options) {
  5478. var _await$platform$isEle;
  5479. if (options === void 0) {
  5480. options = {};
  5481. }
  5482. const {
  5483. x,
  5484. y,
  5485. platform: platform2,
  5486. rects,
  5487. elements,
  5488. strategy
  5489. } = state;
  5490. const {
  5491. boundary = "clippingAncestors",
  5492. rootBoundary = "viewport",
  5493. elementContext = "floating",
  5494. altBoundary = false,
  5495. padding = 0
  5496. } = evaluate(options, state);
  5497. const paddingObject = getPaddingObject(padding);
  5498. const altContext = elementContext === "floating" ? "reference" : "floating";
  5499. const element = elements[altBoundary ? altContext : elementContext];
  5500. const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
  5501. element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
  5502. boundary,
  5503. rootBoundary,
  5504. strategy
  5505. }));
  5506. const rect = elementContext === "floating" ? {
  5507. ...rects.floating,
  5508. x,
  5509. y
  5510. } : rects.reference;
  5511. const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
  5512. const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
  5513. x: 1,
  5514. y: 1
  5515. } : {
  5516. x: 1,
  5517. y: 1
  5518. };
  5519. const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
  5520. rect,
  5521. offsetParent,
  5522. strategy
  5523. }) : rect);
  5524. return {
  5525. top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
  5526. bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
  5527. left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
  5528. right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
  5529. };
  5530. }
  5531. var flip = function(options) {
  5532. if (options === void 0) {
  5533. options = {};
  5534. }
  5535. return {
  5536. name: "flip",
  5537. options,
  5538. async fn(state) {
  5539. var _middlewareData$arrow, _middlewareData$flip;
  5540. const {
  5541. placement,
  5542. middlewareData,
  5543. rects,
  5544. initialPlacement,
  5545. platform: platform2,
  5546. elements
  5547. } = state;
  5548. const {
  5549. mainAxis: checkMainAxis = true,
  5550. crossAxis: checkCrossAxis = true,
  5551. fallbackPlacements: specifiedFallbackPlacements,
  5552. fallbackStrategy = "bestFit",
  5553. fallbackAxisSideDirection = "none",
  5554. flipAlignment = true,
  5555. ...detectOverflowOptions
  5556. } = evaluate(options, state);
  5557. if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
  5558. return {};
  5559. }
  5560. const side = getSide(placement);
  5561. const isBasePlacement = getSide(initialPlacement) === initialPlacement;
  5562. const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
  5563. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  5564. if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
  5565. fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
  5566. }
  5567. const placements2 = [initialPlacement, ...fallbackPlacements];
  5568. const overflow = await detectOverflow(state, detectOverflowOptions);
  5569. const overflows = [];
  5570. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  5571. if (checkMainAxis) {
  5572. overflows.push(overflow[side]);
  5573. }
  5574. if (checkCrossAxis) {
  5575. const sides2 = getAlignmentSides(placement, rects, rtl);
  5576. overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
  5577. }
  5578. overflowsData = [...overflowsData, {
  5579. placement,
  5580. overflows
  5581. }];
  5582. if (!overflows.every((side2) => side2 <= 0)) {
  5583. var _middlewareData$flip2, _overflowsData$filter;
  5584. const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
  5585. const nextPlacement = placements2[nextIndex];
  5586. if (nextPlacement) {
  5587. return {
  5588. data: {
  5589. index: nextIndex,
  5590. overflows: overflowsData
  5591. },
  5592. reset: {
  5593. placement: nextPlacement
  5594. }
  5595. };
  5596. }
  5597. let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
  5598. if (!resetPlacement) {
  5599. switch (fallbackStrategy) {
  5600. case "bestFit": {
  5601. var _overflowsData$map$so;
  5602. const placement2 = (_overflowsData$map$so = overflowsData.map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
  5603. if (placement2) {
  5604. resetPlacement = placement2;
  5605. }
  5606. break;
  5607. }
  5608. case "initialPlacement":
  5609. resetPlacement = initialPlacement;
  5610. break;
  5611. }
  5612. }
  5613. if (placement !== resetPlacement) {
  5614. return {
  5615. reset: {
  5616. placement: resetPlacement
  5617. }
  5618. };
  5619. }
  5620. }
  5621. return {};
  5622. }
  5623. };
  5624. };
  5625. async function convertValueToCoords(state, options) {
  5626. const {
  5627. placement,
  5628. platform: platform2,
  5629. elements
  5630. } = state;
  5631. const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
  5632. const side = getSide(placement);
  5633. const alignment = getAlignment(placement);
  5634. const isVertical = getSideAxis(placement) === "y";
  5635. const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
  5636. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  5637. const rawValue = evaluate(options, state);
  5638. let {
  5639. mainAxis,
  5640. crossAxis,
  5641. alignmentAxis
  5642. } = typeof rawValue === "number" ? {
  5643. mainAxis: rawValue,
  5644. crossAxis: 0,
  5645. alignmentAxis: null
  5646. } : {
  5647. mainAxis: 0,
  5648. crossAxis: 0,
  5649. alignmentAxis: null,
  5650. ...rawValue
  5651. };
  5652. if (alignment && typeof alignmentAxis === "number") {
  5653. crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
  5654. }
  5655. return isVertical ? {
  5656. x: crossAxis * crossAxisMulti,
  5657. y: mainAxis * mainAxisMulti
  5658. } : {
  5659. x: mainAxis * mainAxisMulti,
  5660. y: crossAxis * crossAxisMulti
  5661. };
  5662. }
  5663. var offset = function(options) {
  5664. if (options === void 0) {
  5665. options = 0;
  5666. }
  5667. return {
  5668. name: "offset",
  5669. options,
  5670. async fn(state) {
  5671. const {
  5672. x,
  5673. y
  5674. } = state;
  5675. const diffCoords = await convertValueToCoords(state, options);
  5676. return {
  5677. x: x + diffCoords.x,
  5678. y: y + diffCoords.y,
  5679. data: diffCoords
  5680. };
  5681. }
  5682. };
  5683. };
  5684. var shift = function(options) {
  5685. if (options === void 0) {
  5686. options = {};
  5687. }
  5688. return {
  5689. name: "shift",
  5690. options,
  5691. async fn(state) {
  5692. const {
  5693. x,
  5694. y,
  5695. placement
  5696. } = state;
  5697. const {
  5698. mainAxis: checkMainAxis = true,
  5699. crossAxis: checkCrossAxis = false,
  5700. limiter = {
  5701. fn: (_ref) => {
  5702. let {
  5703. x: x2,
  5704. y: y2
  5705. } = _ref;
  5706. return {
  5707. x: x2,
  5708. y: y2
  5709. };
  5710. }
  5711. },
  5712. ...detectOverflowOptions
  5713. } = evaluate(options, state);
  5714. const coords = {
  5715. x,
  5716. y
  5717. };
  5718. const overflow = await detectOverflow(state, detectOverflowOptions);
  5719. const crossAxis = getSideAxis(getSide(placement));
  5720. const mainAxis = getOppositeAxis(crossAxis);
  5721. let mainAxisCoord = coords[mainAxis];
  5722. let crossAxisCoord = coords[crossAxis];
  5723. if (checkMainAxis) {
  5724. const minSide = mainAxis === "y" ? "top" : "left";
  5725. const maxSide = mainAxis === "y" ? "bottom" : "right";
  5726. const min2 = mainAxisCoord + overflow[minSide];
  5727. const max2 = mainAxisCoord - overflow[maxSide];
  5728. mainAxisCoord = clamp(min2, mainAxisCoord, max2);
  5729. }
  5730. if (checkCrossAxis) {
  5731. const minSide = crossAxis === "y" ? "top" : "left";
  5732. const maxSide = crossAxis === "y" ? "bottom" : "right";
  5733. const min2 = crossAxisCoord + overflow[minSide];
  5734. const max2 = crossAxisCoord - overflow[maxSide];
  5735. crossAxisCoord = clamp(min2, crossAxisCoord, max2);
  5736. }
  5737. const limitedCoords = limiter.fn({
  5738. ...state,
  5739. [mainAxis]: mainAxisCoord,
  5740. [crossAxis]: crossAxisCoord
  5741. });
  5742. return {
  5743. ...limitedCoords,
  5744. data: {
  5745. x: limitedCoords.x - x,
  5746. y: limitedCoords.y - y
  5747. }
  5748. };
  5749. }
  5750. };
  5751. };
  5752. function getNodeName(node) {
  5753. if (isNode(node)) {
  5754. return (node.nodeName || "").toLowerCase();
  5755. }
  5756. return "#document";
  5757. }
  5758. function getWindow(node) {
  5759. var _node$ownerDocument;
  5760. return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
  5761. }
  5762. function getDocumentElement(node) {
  5763. var _ref;
  5764. return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
  5765. }
  5766. function isNode(value) {
  5767. return value instanceof Node || value instanceof getWindow(value).Node;
  5768. }
  5769. function isElement(value) {
  5770. return value instanceof Element || value instanceof getWindow(value).Element;
  5771. }
  5772. function isHTMLElement(value) {
  5773. return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
  5774. }
  5775. function isShadowRoot(value) {
  5776. if (typeof ShadowRoot === "undefined") {
  5777. return false;
  5778. }
  5779. return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
  5780. }
  5781. function isOverflowElement(element) {
  5782. const {
  5783. overflow,
  5784. overflowX,
  5785. overflowY,
  5786. display
  5787. } = getComputedStyle2(element);
  5788. return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
  5789. }
  5790. function isTableElement(element) {
  5791. return ["table", "td", "th"].includes(getNodeName(element));
  5792. }
  5793. function isContainingBlock(element) {
  5794. const webkit = isWebKit();
  5795. const css = getComputedStyle2(element);
  5796. return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
  5797. }
  5798. function getContainingBlock(element) {
  5799. let currentNode = getParentNode(element);
  5800. while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
  5801. if (isContainingBlock(currentNode)) {
  5802. return currentNode;
  5803. } else {
  5804. currentNode = getParentNode(currentNode);
  5805. }
  5806. }
  5807. return null;
  5808. }
  5809. function isWebKit() {
  5810. if (typeof CSS === "undefined" || !CSS.supports)
  5811. return false;
  5812. return CSS.supports("-webkit-backdrop-filter", "none");
  5813. }
  5814. function isLastTraversableNode(node) {
  5815. return ["html", "body", "#document"].includes(getNodeName(node));
  5816. }
  5817. function getComputedStyle2(element) {
  5818. return getWindow(element).getComputedStyle(element);
  5819. }
  5820. function getNodeScroll(element) {
  5821. if (isElement(element)) {
  5822. return {
  5823. scrollLeft: element.scrollLeft,
  5824. scrollTop: element.scrollTop
  5825. };
  5826. }
  5827. return {
  5828. scrollLeft: element.pageXOffset,
  5829. scrollTop: element.pageYOffset
  5830. };
  5831. }
  5832. function getParentNode(node) {
  5833. if (getNodeName(node) === "html") {
  5834. return node;
  5835. }
  5836. const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
  5837. return isShadowRoot(result) ? result.host : result;
  5838. }
  5839. function getNearestOverflowAncestor(node) {
  5840. const parentNode = getParentNode(node);
  5841. if (isLastTraversableNode(parentNode)) {
  5842. return node.ownerDocument ? node.ownerDocument.body : node.body;
  5843. }
  5844. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  5845. return parentNode;
  5846. }
  5847. return getNearestOverflowAncestor(parentNode);
  5848. }
  5849. function getOverflowAncestors(node, list, traverseIframes) {
  5850. var _node$ownerDocument2;
  5851. if (list === void 0) {
  5852. list = [];
  5853. }
  5854. if (traverseIframes === void 0) {
  5855. traverseIframes = true;
  5856. }
  5857. const scrollableAncestor = getNearestOverflowAncestor(node);
  5858. const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  5859. const win = getWindow(scrollableAncestor);
  5860. if (isBody) {
  5861. return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
  5862. }
  5863. return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
  5864. }
  5865. function getCssDimensions(element) {
  5866. const css = getComputedStyle2(element);
  5867. let width = parseFloat(css.width) || 0;
  5868. let height = parseFloat(css.height) || 0;
  5869. const hasOffset = isHTMLElement(element);
  5870. const offsetWidth = hasOffset ? element.offsetWidth : width;
  5871. const offsetHeight = hasOffset ? element.offsetHeight : height;
  5872. const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
  5873. if (shouldFallback) {
  5874. width = offsetWidth;
  5875. height = offsetHeight;
  5876. }
  5877. return {
  5878. width,
  5879. height,
  5880. $: shouldFallback
  5881. };
  5882. }
  5883. function unwrapElement(element) {
  5884. return !isElement(element) ? element.contextElement : element;
  5885. }
  5886. function getScale(element) {
  5887. const domElement = unwrapElement(element);
  5888. if (!isHTMLElement(domElement)) {
  5889. return createCoords(1);
  5890. }
  5891. const rect = domElement.getBoundingClientRect();
  5892. const {
  5893. width,
  5894. height,
  5895. $
  5896. } = getCssDimensions(domElement);
  5897. let x = ($ ? round(rect.width) : rect.width) / width;
  5898. let y = ($ ? round(rect.height) : rect.height) / height;
  5899. if (!x || !Number.isFinite(x)) {
  5900. x = 1;
  5901. }
  5902. if (!y || !Number.isFinite(y)) {
  5903. y = 1;
  5904. }
  5905. return {
  5906. x,
  5907. y
  5908. };
  5909. }
  5910. var noOffsets = /* @__PURE__ */ createCoords(0);
  5911. function getVisualOffsets(element) {
  5912. const win = getWindow(element);
  5913. if (!isWebKit() || !win.visualViewport) {
  5914. return noOffsets;
  5915. }
  5916. return {
  5917. x: win.visualViewport.offsetLeft,
  5918. y: win.visualViewport.offsetTop
  5919. };
  5920. }
  5921. function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  5922. if (isFixed === void 0) {
  5923. isFixed = false;
  5924. }
  5925. if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
  5926. return false;
  5927. }
  5928. return isFixed;
  5929. }
  5930. function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
  5931. if (includeScale === void 0) {
  5932. includeScale = false;
  5933. }
  5934. if (isFixedStrategy === void 0) {
  5935. isFixedStrategy = false;
  5936. }
  5937. const clientRect = element.getBoundingClientRect();
  5938. const domElement = unwrapElement(element);
  5939. let scale = createCoords(1);
  5940. if (includeScale) {
  5941. if (offsetParent) {
  5942. if (isElement(offsetParent)) {
  5943. scale = getScale(offsetParent);
  5944. }
  5945. } else {
  5946. scale = getScale(element);
  5947. }
  5948. }
  5949. const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  5950. let x = (clientRect.left + visualOffsets.x) / scale.x;
  5951. let y = (clientRect.top + visualOffsets.y) / scale.y;
  5952. let width = clientRect.width / scale.x;
  5953. let height = clientRect.height / scale.y;
  5954. if (domElement) {
  5955. const win = getWindow(domElement);
  5956. const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
  5957. let currentIFrame = win.frameElement;
  5958. while (currentIFrame && offsetParent && offsetWin !== win) {
  5959. const iframeScale = getScale(currentIFrame);
  5960. const iframeRect = currentIFrame.getBoundingClientRect();
  5961. const css = getComputedStyle2(currentIFrame);
  5962. const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
  5963. const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
  5964. x *= iframeScale.x;
  5965. y *= iframeScale.y;
  5966. width *= iframeScale.x;
  5967. height *= iframeScale.y;
  5968. x += left;
  5969. y += top;
  5970. currentIFrame = getWindow(currentIFrame).frameElement;
  5971. }
  5972. }
  5973. return rectToClientRect({
  5974. width,
  5975. height,
  5976. x,
  5977. y
  5978. });
  5979. }
  5980. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  5981. let {
  5982. rect,
  5983. offsetParent,
  5984. strategy
  5985. } = _ref;
  5986. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  5987. const documentElement = getDocumentElement(offsetParent);
  5988. if (offsetParent === documentElement) {
  5989. return rect;
  5990. }
  5991. let scroll = {
  5992. scrollLeft: 0,
  5993. scrollTop: 0
  5994. };
  5995. let scale = createCoords(1);
  5996. const offsets = createCoords(0);
  5997. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
  5998. if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
  5999. scroll = getNodeScroll(offsetParent);
  6000. }
  6001. if (isHTMLElement(offsetParent)) {
  6002. const offsetRect = getBoundingClientRect(offsetParent);
  6003. scale = getScale(offsetParent);
  6004. offsets.x = offsetRect.x + offsetParent.clientLeft;
  6005. offsets.y = offsetRect.y + offsetParent.clientTop;
  6006. }
  6007. }
  6008. return {
  6009. width: rect.width * scale.x,
  6010. height: rect.height * scale.y,
  6011. x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
  6012. y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
  6013. };
  6014. }
  6015. function getClientRects(element) {
  6016. return Array.from(element.getClientRects());
  6017. }
  6018. function getWindowScrollBarX(element) {
  6019. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  6020. }
  6021. function getDocumentRect(element) {
  6022. const html = getDocumentElement(element);
  6023. const scroll = getNodeScroll(element);
  6024. const body = element.ownerDocument.body;
  6025. const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  6026. const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  6027. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  6028. const y = -scroll.scrollTop;
  6029. if (getComputedStyle2(body).direction === "rtl") {
  6030. x += max(html.clientWidth, body.clientWidth) - width;
  6031. }
  6032. return {
  6033. width,
  6034. height,
  6035. x,
  6036. y
  6037. };
  6038. }
  6039. function getViewportRect(element, strategy) {
  6040. const win = getWindow(element);
  6041. const html = getDocumentElement(element);
  6042. const visualViewport = win.visualViewport;
  6043. let width = html.clientWidth;
  6044. let height = html.clientHeight;
  6045. let x = 0;
  6046. let y = 0;
  6047. if (visualViewport) {
  6048. width = visualViewport.width;
  6049. height = visualViewport.height;
  6050. const visualViewportBased = isWebKit();
  6051. if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
  6052. x = visualViewport.offsetLeft;
  6053. y = visualViewport.offsetTop;
  6054. }
  6055. }
  6056. return {
  6057. width,
  6058. height,
  6059. x,
  6060. y
  6061. };
  6062. }
  6063. function getInnerBoundingClientRect(element, strategy) {
  6064. const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
  6065. const top = clientRect.top + element.clientTop;
  6066. const left = clientRect.left + element.clientLeft;
  6067. const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
  6068. const width = element.clientWidth * scale.x;
  6069. const height = element.clientHeight * scale.y;
  6070. const x = left * scale.x;
  6071. const y = top * scale.y;
  6072. return {
  6073. width,
  6074. height,
  6075. x,
  6076. y
  6077. };
  6078. }
  6079. function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
  6080. let rect;
  6081. if (clippingAncestor === "viewport") {
  6082. rect = getViewportRect(element, strategy);
  6083. } else if (clippingAncestor === "document") {
  6084. rect = getDocumentRect(getDocumentElement(element));
  6085. } else if (isElement(clippingAncestor)) {
  6086. rect = getInnerBoundingClientRect(clippingAncestor, strategy);
  6087. } else {
  6088. const visualOffsets = getVisualOffsets(element);
  6089. rect = {
  6090. ...clippingAncestor,
  6091. x: clippingAncestor.x - visualOffsets.x,
  6092. y: clippingAncestor.y - visualOffsets.y
  6093. };
  6094. }
  6095. return rectToClientRect(rect);
  6096. }
  6097. function hasFixedPositionAncestor(element, stopNode) {
  6098. const parentNode = getParentNode(element);
  6099. if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
  6100. return false;
  6101. }
  6102. return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
  6103. }
  6104. function getClippingElementAncestors(element, cache) {
  6105. const cachedResult = cache.get(element);
  6106. if (cachedResult) {
  6107. return cachedResult;
  6108. }
  6109. let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
  6110. let currentContainingBlockComputedStyle = null;
  6111. const elementIsFixed = getComputedStyle2(element).position === "fixed";
  6112. let currentNode = elementIsFixed ? getParentNode(element) : element;
  6113. while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
  6114. const computedStyle = getComputedStyle2(currentNode);
  6115. const currentNodeIsContaining = isContainingBlock(currentNode);
  6116. if (!currentNodeIsContaining && computedStyle.position === "fixed") {
  6117. currentContainingBlockComputedStyle = null;
  6118. }
  6119. const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
  6120. if (shouldDropCurrentNode) {
  6121. result = result.filter((ancestor) => ancestor !== currentNode);
  6122. } else {
  6123. currentContainingBlockComputedStyle = computedStyle;
  6124. }
  6125. currentNode = getParentNode(currentNode);
  6126. }
  6127. cache.set(element, result);
  6128. return result;
  6129. }
  6130. function getClippingRect(_ref) {
  6131. let {
  6132. element,
  6133. boundary,
  6134. rootBoundary,
  6135. strategy
  6136. } = _ref;
  6137. const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
  6138. const clippingAncestors = [...elementClippingAncestors, rootBoundary];
  6139. const firstClippingAncestor = clippingAncestors[0];
  6140. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  6141. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  6142. accRect.top = max(rect.top, accRect.top);
  6143. accRect.right = min(rect.right, accRect.right);
  6144. accRect.bottom = min(rect.bottom, accRect.bottom);
  6145. accRect.left = max(rect.left, accRect.left);
  6146. return accRect;
  6147. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  6148. return {
  6149. width: clippingRect.right - clippingRect.left,
  6150. height: clippingRect.bottom - clippingRect.top,
  6151. x: clippingRect.left,
  6152. y: clippingRect.top
  6153. };
  6154. }
  6155. function getDimensions(element) {
  6156. return getCssDimensions(element);
  6157. }
  6158. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  6159. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  6160. const documentElement = getDocumentElement(offsetParent);
  6161. const isFixed = strategy === "fixed";
  6162. const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
  6163. let scroll = {
  6164. scrollLeft: 0,
  6165. scrollTop: 0
  6166. };
  6167. const offsets = createCoords(0);
  6168. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6169. if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
  6170. scroll = getNodeScroll(offsetParent);
  6171. }
  6172. if (isOffsetParentAnElement) {
  6173. const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
  6174. offsets.x = offsetRect.x + offsetParent.clientLeft;
  6175. offsets.y = offsetRect.y + offsetParent.clientTop;
  6176. } else if (documentElement) {
  6177. offsets.x = getWindowScrollBarX(documentElement);
  6178. }
  6179. }
  6180. return {
  6181. x: rect.left + scroll.scrollLeft - offsets.x,
  6182. y: rect.top + scroll.scrollTop - offsets.y,
  6183. width: rect.width,
  6184. height: rect.height
  6185. };
  6186. }
  6187. function getTrueOffsetParent(element, polyfill) {
  6188. if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
  6189. return null;
  6190. }
  6191. if (polyfill) {
  6192. return polyfill(element);
  6193. }
  6194. return element.offsetParent;
  6195. }
  6196. function getOffsetParent(element, polyfill) {
  6197. const window2 = getWindow(element);
  6198. if (!isHTMLElement(element)) {
  6199. return window2;
  6200. }
  6201. let offsetParent = getTrueOffsetParent(element, polyfill);
  6202. while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") {
  6203. offsetParent = getTrueOffsetParent(offsetParent, polyfill);
  6204. }
  6205. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
  6206. return window2;
  6207. }
  6208. return offsetParent || getContainingBlock(element) || window2;
  6209. }
  6210. var getElementRects = async function(_ref) {
  6211. let {
  6212. reference,
  6213. floating,
  6214. strategy
  6215. } = _ref;
  6216. const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
  6217. const getDimensionsFn = this.getDimensions;
  6218. return {
  6219. reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
  6220. floating: {
  6221. x: 0,
  6222. y: 0,
  6223. ...await getDimensionsFn(floating)
  6224. }
  6225. };
  6226. };
  6227. function isRTL(element) {
  6228. return getComputedStyle2(element).direction === "rtl";
  6229. }
  6230. var platform = {
  6231. convertOffsetParentRelativeRectToViewportRelativeRect,
  6232. getDocumentElement,
  6233. getClippingRect,
  6234. getOffsetParent,
  6235. getElementRects,
  6236. getClientRects,
  6237. getDimensions,
  6238. getScale,
  6239. isElement,
  6240. isRTL
  6241. };
  6242. function observeMove(element, onMove) {
  6243. let io = null;
  6244. let timeoutId;
  6245. const root = getDocumentElement(element);
  6246. function cleanup() {
  6247. clearTimeout(timeoutId);
  6248. io && io.disconnect();
  6249. io = null;
  6250. }
  6251. function refresh(skip, threshold) {
  6252. if (skip === void 0) {
  6253. skip = false;
  6254. }
  6255. if (threshold === void 0) {
  6256. threshold = 1;
  6257. }
  6258. cleanup();
  6259. const {
  6260. left,
  6261. top,
  6262. width,
  6263. height
  6264. } = element.getBoundingClientRect();
  6265. if (!skip) {
  6266. onMove();
  6267. }
  6268. if (!width || !height) {
  6269. return;
  6270. }
  6271. const insetTop = floor(top);
  6272. const insetRight = floor(root.clientWidth - (left + width));
  6273. const insetBottom = floor(root.clientHeight - (top + height));
  6274. const insetLeft = floor(left);
  6275. const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
  6276. const options = {
  6277. rootMargin,
  6278. threshold: max(0, min(1, threshold)) || 1
  6279. };
  6280. let isFirstUpdate = true;
  6281. function handleObserve(entries) {
  6282. const ratio = entries[0].intersectionRatio;
  6283. if (ratio !== threshold) {
  6284. if (!isFirstUpdate) {
  6285. return refresh();
  6286. }
  6287. if (!ratio) {
  6288. timeoutId = setTimeout(() => {
  6289. refresh(false, 1e-7);
  6290. }, 100);
  6291. } else {
  6292. refresh(false, ratio);
  6293. }
  6294. }
  6295. isFirstUpdate = false;
  6296. }
  6297. try {
  6298. io = new IntersectionObserver(handleObserve, {
  6299. ...options,
  6300. root: root.ownerDocument
  6301. });
  6302. } catch (e) {
  6303. io = new IntersectionObserver(handleObserve, options);
  6304. }
  6305. io.observe(element);
  6306. }
  6307. refresh(true);
  6308. return cleanup;
  6309. }
  6310. function autoUpdate(reference, floating, update, options) {
  6311. if (options === void 0) {
  6312. options = {};
  6313. }
  6314. const {
  6315. ancestorScroll = true,
  6316. ancestorResize = true,
  6317. elementResize = typeof ResizeObserver === "function",
  6318. layoutShift = typeof IntersectionObserver === "function",
  6319. animationFrame = false
  6320. } = options;
  6321. const referenceEl = unwrapElement(reference);
  6322. const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
  6323. ancestors.forEach((ancestor) => {
  6324. ancestorScroll && ancestor.addEventListener("scroll", update, {
  6325. passive: true
  6326. });
  6327. ancestorResize && ancestor.addEventListener("resize", update);
  6328. });
  6329. const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
  6330. let reobserveFrame = -1;
  6331. let resizeObserver = null;
  6332. if (elementResize) {
  6333. resizeObserver = new ResizeObserver((_ref) => {
  6334. let [firstEntry] = _ref;
  6335. if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
  6336. resizeObserver.unobserve(floating);
  6337. cancelAnimationFrame(reobserveFrame);
  6338. reobserveFrame = requestAnimationFrame(() => {
  6339. resizeObserver && resizeObserver.observe(floating);
  6340. });
  6341. }
  6342. update();
  6343. });
  6344. if (referenceEl && !animationFrame) {
  6345. resizeObserver.observe(referenceEl);
  6346. }
  6347. resizeObserver.observe(floating);
  6348. }
  6349. let frameId;
  6350. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  6351. if (animationFrame) {
  6352. frameLoop();
  6353. }
  6354. function frameLoop() {
  6355. const nextRefRect = getBoundingClientRect(reference);
  6356. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  6357. update();
  6358. }
  6359. prevRefRect = nextRefRect;
  6360. frameId = requestAnimationFrame(frameLoop);
  6361. }
  6362. update();
  6363. return () => {
  6364. ancestors.forEach((ancestor) => {
  6365. ancestorScroll && ancestor.removeEventListener("scroll", update);
  6366. ancestorResize && ancestor.removeEventListener("resize", update);
  6367. });
  6368. cleanupIo && cleanupIo();
  6369. resizeObserver && resizeObserver.disconnect();
  6370. resizeObserver = null;
  6371. if (animationFrame) {
  6372. cancelAnimationFrame(frameId);
  6373. }
  6374. };
  6375. }
  6376. var computePosition2 = (reference, floating, options) => {
  6377. const cache = /* @__PURE__ */ new Map();
  6378. const mergedOptions = {
  6379. platform,
  6380. ...options
  6381. };
  6382. const platformWithCache = {
  6383. ...mergedOptions.platform,
  6384. _c: cache
  6385. };
  6386. return computePosition(reference, floating, {
  6387. ...mergedOptions,
  6388. platform: platformWithCache
  6389. });
  6390. };
  6391. function src_default(Alpine23) {
  6392. Alpine23.magic("anchor", (el) => {
  6393. if (!el._x_anchor)
  6394. throw "Alpine: No x-anchor directive found on element using $anchor...";
  6395. return el._x_anchor;
  6396. });
  6397. Alpine23.interceptClone((from, to) => {
  6398. if (from && from._x_anchor && !to._x_anchor) {
  6399. to._x_anchor = from._x_anchor;
  6400. }
  6401. });
  6402. Alpine23.directive("anchor", Alpine23.skipDuringClone((el, { expression, modifiers, value }, { cleanup, evaluate: evaluate2 }) => {
  6403. let { placement, offsetValue, unstyled } = getOptions(modifiers);
  6404. el._x_anchor = Alpine23.reactive({ x: 0, y: 0 });
  6405. let reference = evaluate2(expression);
  6406. if (!reference)
  6407. throw "Alpine: no element provided to x-anchor...";
  6408. let compute = () => {
  6409. let previousValue;
  6410. computePosition2(reference, el, {
  6411. placement,
  6412. middleware: [flip(), shift({ padding: 5 }), offset(offsetValue)]
  6413. }).then(({ x, y }) => {
  6414. unstyled || setStyles(el, x, y);
  6415. if (JSON.stringify({ x, y }) !== previousValue) {
  6416. el._x_anchor.x = x;
  6417. el._x_anchor.y = y;
  6418. }
  6419. previousValue = JSON.stringify({ x, y });
  6420. });
  6421. };
  6422. let release = autoUpdate(reference, el, () => compute());
  6423. cleanup(() => release());
  6424. }, (el, { expression, modifiers, value }, { cleanup, evaluate: evaluate2 }) => {
  6425. let { placement, offsetValue, unstyled } = getOptions(modifiers);
  6426. if (el._x_anchor) {
  6427. unstyled || setStyles(el, el._x_anchor.x, el._x_anchor.y);
  6428. }
  6429. }));
  6430. }
  6431. function setStyles(el, x, y) {
  6432. Object.assign(el.style, {
  6433. left: x + "px",
  6434. top: y + "px",
  6435. position: "absolute"
  6436. });
  6437. }
  6438. function getOptions(modifiers) {
  6439. let positions = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"];
  6440. let placement = positions.find((i) => modifiers.includes(i));
  6441. let offsetValue = 0;
  6442. if (modifiers.includes("offset")) {
  6443. let idx = modifiers.findIndex((i) => i === "offset");
  6444. offsetValue = modifiers[idx + 1] !== void 0 ? Number(modifiers[idx + 1]) : offsetValue;
  6445. }
  6446. let unstyled = modifiers.includes("no-style");
  6447. return { placement, offsetValue, unstyled };
  6448. }
  6449. var module_default = src_default;
  6450. }
  6451. });
  6452. // node_modules/nprogress/nprogress.js
  6453. var require_nprogress = __commonJS({
  6454. "node_modules/nprogress/nprogress.js"(exports, module) {
  6455. (function(root, factory) {
  6456. if (typeof define === "function" && define.amd) {
  6457. define(factory);
  6458. } else if (typeof exports === "object") {
  6459. module.exports = factory();
  6460. } else {
  6461. root.NProgress = factory();
  6462. }
  6463. })(exports, function() {
  6464. var NProgress2 = {};
  6465. NProgress2.version = "0.2.0";
  6466. var Settings = NProgress2.settings = {
  6467. minimum: 0.08,
  6468. easing: "ease",
  6469. positionUsing: "",
  6470. speed: 200,
  6471. trickle: true,
  6472. trickleRate: 0.02,
  6473. trickleSpeed: 800,
  6474. showSpinner: true,
  6475. barSelector: '[role="bar"]',
  6476. spinnerSelector: '[role="spinner"]',
  6477. parent: "body",
  6478. template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
  6479. };
  6480. NProgress2.configure = function(options) {
  6481. var key, value;
  6482. for (key in options) {
  6483. value = options[key];
  6484. if (value !== void 0 && options.hasOwnProperty(key))
  6485. Settings[key] = value;
  6486. }
  6487. return this;
  6488. };
  6489. NProgress2.status = null;
  6490. NProgress2.set = function(n) {
  6491. var started = NProgress2.isStarted();
  6492. n = clamp(n, Settings.minimum, 1);
  6493. NProgress2.status = n === 1 ? null : n;
  6494. var progress = NProgress2.render(!started), bar = progress.querySelector(Settings.barSelector), speed = Settings.speed, ease = Settings.easing;
  6495. progress.offsetWidth;
  6496. queue(function(next) {
  6497. if (Settings.positionUsing === "")
  6498. Settings.positionUsing = NProgress2.getPositioningCSS();
  6499. css(bar, barPositionCSS(n, speed, ease));
  6500. if (n === 1) {
  6501. css(progress, {
  6502. transition: "none",
  6503. opacity: 1
  6504. });
  6505. progress.offsetWidth;
  6506. setTimeout(function() {
  6507. css(progress, {
  6508. transition: "all " + speed + "ms linear",
  6509. opacity: 0
  6510. });
  6511. setTimeout(function() {
  6512. NProgress2.remove();
  6513. next();
  6514. }, speed);
  6515. }, speed);
  6516. } else {
  6517. setTimeout(next, speed);
  6518. }
  6519. });
  6520. return this;
  6521. };
  6522. NProgress2.isStarted = function() {
  6523. return typeof NProgress2.status === "number";
  6524. };
  6525. NProgress2.start = function() {
  6526. if (!NProgress2.status)
  6527. NProgress2.set(0);
  6528. var work = function() {
  6529. setTimeout(function() {
  6530. if (!NProgress2.status)
  6531. return;
  6532. NProgress2.trickle();
  6533. work();
  6534. }, Settings.trickleSpeed);
  6535. };
  6536. if (Settings.trickle)
  6537. work();
  6538. return this;
  6539. };
  6540. NProgress2.done = function(force) {
  6541. if (!force && !NProgress2.status)
  6542. return this;
  6543. return NProgress2.inc(0.3 + 0.5 * Math.random()).set(1);
  6544. };
  6545. NProgress2.inc = function(amount) {
  6546. var n = NProgress2.status;
  6547. if (!n) {
  6548. return NProgress2.start();
  6549. } else {
  6550. if (typeof amount !== "number") {
  6551. amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
  6552. }
  6553. n = clamp(n + amount, 0, 0.994);
  6554. return NProgress2.set(n);
  6555. }
  6556. };
  6557. NProgress2.trickle = function() {
  6558. return NProgress2.inc(Math.random() * Settings.trickleRate);
  6559. };
  6560. (function() {
  6561. var initial = 0, current = 0;
  6562. NProgress2.promise = function($promise) {
  6563. if (!$promise || $promise.state() === "resolved") {
  6564. return this;
  6565. }
  6566. if (current === 0) {
  6567. NProgress2.start();
  6568. }
  6569. initial++;
  6570. current++;
  6571. $promise.always(function() {
  6572. current--;
  6573. if (current === 0) {
  6574. initial = 0;
  6575. NProgress2.done();
  6576. } else {
  6577. NProgress2.set((initial - current) / initial);
  6578. }
  6579. });
  6580. return this;
  6581. };
  6582. })();
  6583. NProgress2.render = function(fromStart) {
  6584. if (NProgress2.isRendered())
  6585. return document.getElementById("nprogress");
  6586. addClass(document.documentElement, "nprogress-busy");
  6587. var progress = document.createElement("div");
  6588. progress.id = "nprogress";
  6589. progress.innerHTML = Settings.template;
  6590. var bar = progress.querySelector(Settings.barSelector), perc = fromStart ? "-100" : toBarPerc(NProgress2.status || 0), parent = document.querySelector(Settings.parent), spinner;
  6591. css(bar, {
  6592. transition: "all 0 linear",
  6593. transform: "translate3d(" + perc + "%,0,0)"
  6594. });
  6595. if (!Settings.showSpinner) {
  6596. spinner = progress.querySelector(Settings.spinnerSelector);
  6597. spinner && removeElement(spinner);
  6598. }
  6599. if (parent != document.body) {
  6600. addClass(parent, "nprogress-custom-parent");
  6601. }
  6602. parent.appendChild(progress);
  6603. return progress;
  6604. };
  6605. NProgress2.remove = function() {
  6606. removeClass(document.documentElement, "nprogress-busy");
  6607. removeClass(document.querySelector(Settings.parent), "nprogress-custom-parent");
  6608. var progress = document.getElementById("nprogress");
  6609. progress && removeElement(progress);
  6610. };
  6611. NProgress2.isRendered = function() {
  6612. return !!document.getElementById("nprogress");
  6613. };
  6614. NProgress2.getPositioningCSS = function() {
  6615. var bodyStyle = document.body.style;
  6616. var vendorPrefix = "WebkitTransform" in bodyStyle ? "Webkit" : "MozTransform" in bodyStyle ? "Moz" : "msTransform" in bodyStyle ? "ms" : "OTransform" in bodyStyle ? "O" : "";
  6617. if (vendorPrefix + "Perspective" in bodyStyle) {
  6618. return "translate3d";
  6619. } else if (vendorPrefix + "Transform" in bodyStyle) {
  6620. return "translate";
  6621. } else {
  6622. return "margin";
  6623. }
  6624. };
  6625. function clamp(n, min, max) {
  6626. if (n < min)
  6627. return min;
  6628. if (n > max)
  6629. return max;
  6630. return n;
  6631. }
  6632. function toBarPerc(n) {
  6633. return (-1 + n) * 100;
  6634. }
  6635. function barPositionCSS(n, speed, ease) {
  6636. var barCSS;
  6637. if (Settings.positionUsing === "translate3d") {
  6638. barCSS = { transform: "translate3d(" + toBarPerc(n) + "%,0,0)" };
  6639. } else if (Settings.positionUsing === "translate") {
  6640. barCSS = { transform: "translate(" + toBarPerc(n) + "%,0)" };
  6641. } else {
  6642. barCSS = { "margin-left": toBarPerc(n) + "%" };
  6643. }
  6644. barCSS.transition = "all " + speed + "ms " + ease;
  6645. return barCSS;
  6646. }
  6647. var queue = function() {
  6648. var pending = [];
  6649. function next() {
  6650. var fn = pending.shift();
  6651. if (fn) {
  6652. fn(next);
  6653. }
  6654. }
  6655. return function(fn) {
  6656. pending.push(fn);
  6657. if (pending.length == 1)
  6658. next();
  6659. };
  6660. }();
  6661. var css = function() {
  6662. var cssPrefixes = ["Webkit", "O", "Moz", "ms"], cssProps = {};
  6663. function camelCase(string) {
  6664. return string.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function(match, letter) {
  6665. return letter.toUpperCase();
  6666. });
  6667. }
  6668. function getVendorProp(name) {
  6669. var style = document.body.style;
  6670. if (name in style)
  6671. return name;
  6672. var i = cssPrefixes.length, capName = name.charAt(0).toUpperCase() + name.slice(1), vendorName;
  6673. while (i--) {
  6674. vendorName = cssPrefixes[i] + capName;
  6675. if (vendorName in style)
  6676. return vendorName;
  6677. }
  6678. return name;
  6679. }
  6680. function getStyleProp(name) {
  6681. name = camelCase(name);
  6682. return cssProps[name] || (cssProps[name] = getVendorProp(name));
  6683. }
  6684. function applyCss(element, prop, value) {
  6685. prop = getStyleProp(prop);
  6686. element.style[prop] = value;
  6687. }
  6688. return function(element, properties2) {
  6689. var args = arguments, prop, value;
  6690. if (args.length == 2) {
  6691. for (prop in properties2) {
  6692. value = properties2[prop];
  6693. if (value !== void 0 && properties2.hasOwnProperty(prop))
  6694. applyCss(element, prop, value);
  6695. }
  6696. } else {
  6697. applyCss(element, args[1], args[2]);
  6698. }
  6699. };
  6700. }();
  6701. function hasClass(element, name) {
  6702. var list = typeof element == "string" ? element : classList(element);
  6703. return list.indexOf(" " + name + " ") >= 0;
  6704. }
  6705. function addClass(element, name) {
  6706. var oldList = classList(element), newList = oldList + name;
  6707. if (hasClass(oldList, name))
  6708. return;
  6709. element.className = newList.substring(1);
  6710. }
  6711. function removeClass(element, name) {
  6712. var oldList = classList(element), newList;
  6713. if (!hasClass(element, name))
  6714. return;
  6715. newList = oldList.replace(" " + name + " ", " ");
  6716. element.className = newList.substring(1, newList.length - 1);
  6717. }
  6718. function classList(element) {
  6719. return (" " + (element.className || "") + " ").replace(/\s+/gi, " ");
  6720. }
  6721. function removeElement(element) {
  6722. element && element.parentNode && element.parentNode.removeChild(element);
  6723. }
  6724. return NProgress2;
  6725. });
  6726. }
  6727. });
  6728. // ../alpine/packages/morph/dist/module.cjs.js
  6729. var require_module_cjs8 = __commonJS({
  6730. "../alpine/packages/morph/dist/module.cjs.js"(exports, module) {
  6731. var __defProp2 = Object.defineProperty;
  6732. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  6733. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  6734. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  6735. var __export = (target, all2) => {
  6736. for (var name in all2)
  6737. __defProp2(target, name, { get: all2[name], enumerable: true });
  6738. };
  6739. var __copyProps2 = (to, from, except, desc) => {
  6740. if (from && typeof from === "object" || typeof from === "function") {
  6741. for (let key of __getOwnPropNames2(from))
  6742. if (!__hasOwnProp2.call(to, key) && key !== except)
  6743. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  6744. }
  6745. return to;
  6746. };
  6747. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  6748. var module_exports = {};
  6749. __export(module_exports, {
  6750. default: () => module_default,
  6751. morph: () => src_default
  6752. });
  6753. module.exports = __toCommonJS(module_exports);
  6754. function morph3(from, toHtml, options) {
  6755. monkeyPatchDomSetAttributeToAllowAtSymbols();
  6756. let fromEl;
  6757. let toEl;
  6758. let key, lookahead, updating, updated, removing, removed, adding, added;
  6759. function assignOptions(options2 = {}) {
  6760. let defaultGetKey = (el) => el.getAttribute("key");
  6761. let noop = () => {
  6762. };
  6763. updating = options2.updating || noop;
  6764. updated = options2.updated || noop;
  6765. removing = options2.removing || noop;
  6766. removed = options2.removed || noop;
  6767. adding = options2.adding || noop;
  6768. added = options2.added || noop;
  6769. key = options2.key || defaultGetKey;
  6770. lookahead = options2.lookahead || false;
  6771. }
  6772. function patch(from2, to) {
  6773. if (differentElementNamesTypesOrKeys(from2, to)) {
  6774. return swapElements(from2, to);
  6775. }
  6776. let updateChildrenOnly = false;
  6777. let skipChildren = false;
  6778. if (shouldSkipChildren(updating, () => skipChildren = true, from2, to, () => updateChildrenOnly = true))
  6779. return;
  6780. if (from2.nodeType === 1 && window.Alpine) {
  6781. window.Alpine.cloneNode(from2, to);
  6782. if (from2._x_teleport && to._x_teleport) {
  6783. patch(from2._x_teleport, to._x_teleport);
  6784. }
  6785. }
  6786. if (textOrComment(to)) {
  6787. patchNodeValue(from2, to);
  6788. updated(from2, to);
  6789. return;
  6790. }
  6791. if (!updateChildrenOnly) {
  6792. patchAttributes(from2, to);
  6793. }
  6794. updated(from2, to);
  6795. if (!skipChildren) {
  6796. patchChildren(from2, to);
  6797. }
  6798. }
  6799. function differentElementNamesTypesOrKeys(from2, to) {
  6800. return from2.nodeType != to.nodeType || from2.nodeName != to.nodeName || getKey(from2) != getKey(to);
  6801. }
  6802. function swapElements(from2, to) {
  6803. if (shouldSkip(removing, from2))
  6804. return;
  6805. let toCloned = to.cloneNode(true);
  6806. if (shouldSkip(adding, toCloned))
  6807. return;
  6808. from2.replaceWith(toCloned);
  6809. removed(from2);
  6810. added(toCloned);
  6811. }
  6812. function patchNodeValue(from2, to) {
  6813. let value = to.nodeValue;
  6814. if (from2.nodeValue !== value) {
  6815. from2.nodeValue = value;
  6816. }
  6817. }
  6818. function patchAttributes(from2, to) {
  6819. if (from2._x_transitioning)
  6820. return;
  6821. if (from2._x_isShown && !to._x_isShown) {
  6822. return;
  6823. }
  6824. if (!from2._x_isShown && to._x_isShown) {
  6825. return;
  6826. }
  6827. let domAttributes = Array.from(from2.attributes);
  6828. let toAttributes = Array.from(to.attributes);
  6829. for (let i = domAttributes.length - 1; i >= 0; i--) {
  6830. let name = domAttributes[i].name;
  6831. if (!to.hasAttribute(name)) {
  6832. from2.removeAttribute(name);
  6833. }
  6834. }
  6835. for (let i = toAttributes.length - 1; i >= 0; i--) {
  6836. let name = toAttributes[i].name;
  6837. let value = toAttributes[i].value;
  6838. if (from2.getAttribute(name) !== value) {
  6839. from2.setAttribute(name, value);
  6840. }
  6841. }
  6842. }
  6843. function patchChildren(from2, to) {
  6844. let fromKeys = keyToMap(from2.children);
  6845. let fromKeyHoldovers = {};
  6846. let currentTo = getFirstNode(to);
  6847. let currentFrom = getFirstNode(from2);
  6848. while (currentTo) {
  6849. seedingMatchingId(currentTo, currentFrom);
  6850. let toKey = getKey(currentTo);
  6851. let fromKey = getKey(currentFrom);
  6852. if (!currentFrom) {
  6853. if (toKey && fromKeyHoldovers[toKey]) {
  6854. let holdover = fromKeyHoldovers[toKey];
  6855. from2.appendChild(holdover);
  6856. currentFrom = holdover;
  6857. fromKey = getKey(currentFrom);
  6858. } else {
  6859. if (!shouldSkip(adding, currentTo)) {
  6860. let clone = currentTo.cloneNode(true);
  6861. from2.appendChild(clone);
  6862. added(clone);
  6863. }
  6864. currentTo = getNextSibling(to, currentTo);
  6865. continue;
  6866. }
  6867. }
  6868. let isIf = (node) => node && node.nodeType === 8 && node.textContent === "[if BLOCK]><![endif]";
  6869. let isEnd = (node) => node && node.nodeType === 8 && node.textContent === "[if ENDBLOCK]><![endif]";
  6870. if (isIf(currentTo) && isIf(currentFrom)) {
  6871. let nestedIfCount = 0;
  6872. let fromBlockStart = currentFrom;
  6873. while (currentFrom) {
  6874. let next = getNextSibling(from2, currentFrom);
  6875. if (isIf(next)) {
  6876. nestedIfCount++;
  6877. } else if (isEnd(next) && nestedIfCount > 0) {
  6878. nestedIfCount--;
  6879. } else if (isEnd(next) && nestedIfCount === 0) {
  6880. currentFrom = next;
  6881. break;
  6882. }
  6883. currentFrom = next;
  6884. }
  6885. let fromBlockEnd = currentFrom;
  6886. nestedIfCount = 0;
  6887. let toBlockStart = currentTo;
  6888. while (currentTo) {
  6889. let next = getNextSibling(to, currentTo);
  6890. if (isIf(next)) {
  6891. nestedIfCount++;
  6892. } else if (isEnd(next) && nestedIfCount > 0) {
  6893. nestedIfCount--;
  6894. } else if (isEnd(next) && nestedIfCount === 0) {
  6895. currentTo = next;
  6896. break;
  6897. }
  6898. currentTo = next;
  6899. }
  6900. let toBlockEnd = currentTo;
  6901. let fromBlock = new Block(fromBlockStart, fromBlockEnd);
  6902. let toBlock = new Block(toBlockStart, toBlockEnd);
  6903. patchChildren(fromBlock, toBlock);
  6904. continue;
  6905. }
  6906. if (currentFrom.nodeType === 1 && lookahead && !currentFrom.isEqualNode(currentTo)) {
  6907. let nextToElementSibling = getNextSibling(to, currentTo);
  6908. let found = false;
  6909. while (!found && nextToElementSibling) {
  6910. if (nextToElementSibling.nodeType === 1 && currentFrom.isEqualNode(nextToElementSibling)) {
  6911. found = true;
  6912. currentFrom = addNodeBefore(from2, currentTo, currentFrom);
  6913. fromKey = getKey(currentFrom);
  6914. }
  6915. nextToElementSibling = getNextSibling(to, nextToElementSibling);
  6916. }
  6917. }
  6918. if (toKey !== fromKey) {
  6919. if (!toKey && fromKey) {
  6920. fromKeyHoldovers[fromKey] = currentFrom;
  6921. currentFrom = addNodeBefore(from2, currentTo, currentFrom);
  6922. fromKeyHoldovers[fromKey].remove();
  6923. currentFrom = getNextSibling(from2, currentFrom);
  6924. currentTo = getNextSibling(to, currentTo);
  6925. continue;
  6926. }
  6927. if (toKey && !fromKey) {
  6928. if (fromKeys[toKey]) {
  6929. currentFrom.replaceWith(fromKeys[toKey]);
  6930. currentFrom = fromKeys[toKey];
  6931. fromKey = getKey(currentFrom);
  6932. }
  6933. }
  6934. if (toKey && fromKey) {
  6935. let fromKeyNode = fromKeys[toKey];
  6936. if (fromKeyNode) {
  6937. fromKeyHoldovers[fromKey] = currentFrom;
  6938. currentFrom.replaceWith(fromKeyNode);
  6939. currentFrom = fromKeyNode;
  6940. fromKey = getKey(currentFrom);
  6941. } else {
  6942. fromKeyHoldovers[fromKey] = currentFrom;
  6943. currentFrom = addNodeBefore(from2, currentTo, currentFrom);
  6944. fromKeyHoldovers[fromKey].remove();
  6945. currentFrom = getNextSibling(from2, currentFrom);
  6946. currentTo = getNextSibling(to, currentTo);
  6947. continue;
  6948. }
  6949. }
  6950. }
  6951. let currentFromNext = currentFrom && getNextSibling(from2, currentFrom);
  6952. patch(currentFrom, currentTo);
  6953. currentTo = currentTo && getNextSibling(to, currentTo);
  6954. currentFrom = currentFromNext;
  6955. }
  6956. let removals = [];
  6957. while (currentFrom) {
  6958. if (!shouldSkip(removing, currentFrom))
  6959. removals.push(currentFrom);
  6960. currentFrom = getNextSibling(from2, currentFrom);
  6961. }
  6962. while (removals.length) {
  6963. let domForRemoval = removals.shift();
  6964. domForRemoval.remove();
  6965. removed(domForRemoval);
  6966. }
  6967. }
  6968. function getKey(el) {
  6969. return el && el.nodeType === 1 && key(el);
  6970. }
  6971. function keyToMap(els2) {
  6972. let map = {};
  6973. for (let el of els2) {
  6974. let theKey = getKey(el);
  6975. if (theKey) {
  6976. map[theKey] = el;
  6977. }
  6978. }
  6979. return map;
  6980. }
  6981. function addNodeBefore(parent, node, beforeMe) {
  6982. if (!shouldSkip(adding, node)) {
  6983. let clone = node.cloneNode(true);
  6984. parent.insertBefore(clone, beforeMe);
  6985. added(clone);
  6986. return clone;
  6987. }
  6988. return node;
  6989. }
  6990. assignOptions(options);
  6991. fromEl = from;
  6992. toEl = typeof toHtml === "string" ? createElement(toHtml) : toHtml;
  6993. if (window.Alpine && window.Alpine.closestDataStack && !from._x_dataStack) {
  6994. toEl._x_dataStack = window.Alpine.closestDataStack(from);
  6995. toEl._x_dataStack && window.Alpine.cloneNode(from, toEl);
  6996. }
  6997. patch(from, toEl);
  6998. fromEl = void 0;
  6999. toEl = void 0;
  7000. return from;
  7001. }
  7002. morph3.step = () => {
  7003. };
  7004. morph3.log = () => {
  7005. };
  7006. function shouldSkip(hook, ...args) {
  7007. let skip = false;
  7008. hook(...args, () => skip = true);
  7009. return skip;
  7010. }
  7011. function shouldSkipChildren(hook, skipChildren, ...args) {
  7012. let skip = false;
  7013. hook(...args, () => skip = true, skipChildren);
  7014. return skip;
  7015. }
  7016. var patched = false;
  7017. function createElement(html) {
  7018. const template = document.createElement("template");
  7019. template.innerHTML = html;
  7020. return template.content.firstElementChild;
  7021. }
  7022. function textOrComment(el) {
  7023. return el.nodeType === 3 || el.nodeType === 8;
  7024. }
  7025. var Block = class {
  7026. constructor(start2, end) {
  7027. this.startComment = start2;
  7028. this.endComment = end;
  7029. }
  7030. get children() {
  7031. let children = [];
  7032. let currentNode = this.startComment.nextSibling;
  7033. while (currentNode && currentNode !== this.endComment) {
  7034. children.push(currentNode);
  7035. currentNode = currentNode.nextSibling;
  7036. }
  7037. return children;
  7038. }
  7039. appendChild(child) {
  7040. this.endComment.before(child);
  7041. }
  7042. get firstChild() {
  7043. let first2 = this.startComment.nextSibling;
  7044. if (first2 === this.endComment)
  7045. return;
  7046. return first2;
  7047. }
  7048. nextNode(reference) {
  7049. let next = reference.nextSibling;
  7050. if (next === this.endComment)
  7051. return;
  7052. return next;
  7053. }
  7054. insertBefore(newNode, reference) {
  7055. reference.before(newNode);
  7056. return newNode;
  7057. }
  7058. };
  7059. function getFirstNode(parent) {
  7060. return parent.firstChild;
  7061. }
  7062. function getNextSibling(parent, reference) {
  7063. let next;
  7064. if (parent instanceof Block) {
  7065. next = parent.nextNode(reference);
  7066. } else {
  7067. next = reference.nextSibling;
  7068. }
  7069. return next;
  7070. }
  7071. function monkeyPatchDomSetAttributeToAllowAtSymbols() {
  7072. if (patched)
  7073. return;
  7074. patched = true;
  7075. let original = Element.prototype.setAttribute;
  7076. let hostDiv = document.createElement("div");
  7077. Element.prototype.setAttribute = function newSetAttribute(name, value) {
  7078. if (!name.includes("@")) {
  7079. return original.call(this, name, value);
  7080. }
  7081. hostDiv.innerHTML = `<span ${name}="${value}"></span>`;
  7082. let attr = hostDiv.firstElementChild.getAttributeNode(name);
  7083. hostDiv.firstElementChild.removeAttributeNode(attr);
  7084. this.setAttributeNode(attr);
  7085. };
  7086. }
  7087. function seedingMatchingId(to, from) {
  7088. let fromId = from && from._x_bindings && from._x_bindings.id;
  7089. if (!fromId)
  7090. return;
  7091. if (!to.setAttribute)
  7092. return;
  7093. to.setAttribute("id", fromId);
  7094. to.id = fromId;
  7095. }
  7096. function src_default(Alpine23) {
  7097. Alpine23.morph = morph3;
  7098. }
  7099. var module_default = src_default;
  7100. }
  7101. });
  7102. // ../alpine/packages/mask/dist/module.cjs.js
  7103. var require_module_cjs9 = __commonJS({
  7104. "../alpine/packages/mask/dist/module.cjs.js"(exports, module) {
  7105. var __defProp2 = Object.defineProperty;
  7106. var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
  7107. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  7108. var __hasOwnProp2 = Object.prototype.hasOwnProperty;
  7109. var __export = (target, all2) => {
  7110. for (var name in all2)
  7111. __defProp2(target, name, { get: all2[name], enumerable: true });
  7112. };
  7113. var __copyProps2 = (to, from, except, desc) => {
  7114. if (from && typeof from === "object" || typeof from === "function") {
  7115. for (let key of __getOwnPropNames2(from))
  7116. if (!__hasOwnProp2.call(to, key) && key !== except)
  7117. __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
  7118. }
  7119. return to;
  7120. };
  7121. var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
  7122. var module_exports = {};
  7123. __export(module_exports, {
  7124. default: () => module_default,
  7125. mask: () => src_default,
  7126. stripDown: () => stripDown
  7127. });
  7128. module.exports = __toCommonJS(module_exports);
  7129. function src_default(Alpine23) {
  7130. Alpine23.directive("mask", (el, { value, expression }, { effect, evaluateLater, cleanup }) => {
  7131. let templateFn = () => expression;
  7132. let lastInputValue = "";
  7133. queueMicrotask(() => {
  7134. if (["function", "dynamic"].includes(value)) {
  7135. let evaluator = evaluateLater(expression);
  7136. effect(() => {
  7137. templateFn = (input) => {
  7138. let result;
  7139. Alpine23.dontAutoEvaluateFunctions(() => {
  7140. evaluator((value2) => {
  7141. result = typeof value2 === "function" ? value2(input) : value2;
  7142. }, { scope: {
  7143. "$input": input,
  7144. "$money": formatMoney.bind({ el })
  7145. } });
  7146. });
  7147. return result;
  7148. };
  7149. processInputValue(el, false);
  7150. });
  7151. } else {
  7152. processInputValue(el, false);
  7153. }
  7154. if (el._x_model) {
  7155. if (el._x_model.get() === el.value)
  7156. return;
  7157. if (el._x_model.get() === null && el.value === "")
  7158. return;
  7159. el._x_model.set(el.value);
  7160. }
  7161. });
  7162. const controller = new AbortController();
  7163. cleanup(() => {
  7164. controller.abort();
  7165. });
  7166. el.addEventListener("input", () => processInputValue(el), {
  7167. signal: controller.signal,
  7168. capture: true
  7169. });
  7170. el.addEventListener("blur", () => processInputValue(el, false), { signal: controller.signal });
  7171. function processInputValue(el2, shouldRestoreCursor = true) {
  7172. let input = el2.value;
  7173. let template = templateFn(input);
  7174. if (!template || template === "false")
  7175. return false;
  7176. if (lastInputValue.length - el2.value.length === 1) {
  7177. return lastInputValue = el2.value;
  7178. }
  7179. let setInput = () => {
  7180. lastInputValue = el2.value = formatInput(input, template);
  7181. };
  7182. if (shouldRestoreCursor) {
  7183. restoreCursorPosition(el2, template, () => {
  7184. setInput();
  7185. });
  7186. } else {
  7187. setInput();
  7188. }
  7189. }
  7190. function formatInput(input, template) {
  7191. if (input === "")
  7192. return "";
  7193. let strippedDownInput = stripDown(template, input);
  7194. let rebuiltInput = buildUp(template, strippedDownInput);
  7195. return rebuiltInput;
  7196. }
  7197. }).before("model");
  7198. }
  7199. function restoreCursorPosition(el, template, callback) {
  7200. let cursorPosition = el.selectionStart;
  7201. let unformattedValue = el.value;
  7202. callback();
  7203. let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition);
  7204. let newPosition = buildUp(template, stripDown(template, beforeLeftOfCursorBeforeFormatting)).length;
  7205. el.setSelectionRange(newPosition, newPosition);
  7206. }
  7207. function stripDown(template, input) {
  7208. let inputToBeStripped = input;
  7209. let output = "";
  7210. let regexes = {
  7211. "9": /[0-9]/,
  7212. "a": /[a-zA-Z]/,
  7213. "*": /[a-zA-Z0-9]/
  7214. };
  7215. let wildcardTemplate = "";
  7216. for (let i = 0; i < template.length; i++) {
  7217. if (["9", "a", "*"].includes(template[i])) {
  7218. wildcardTemplate += template[i];
  7219. continue;
  7220. }
  7221. for (let j = 0; j < inputToBeStripped.length; j++) {
  7222. if (inputToBeStripped[j] === template[i]) {
  7223. inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j + 1);
  7224. break;
  7225. }
  7226. }
  7227. }
  7228. for (let i = 0; i < wildcardTemplate.length; i++) {
  7229. let found = false;
  7230. for (let j = 0; j < inputToBeStripped.length; j++) {
  7231. if (regexes[wildcardTemplate[i]].test(inputToBeStripped[j])) {
  7232. output += inputToBeStripped[j];
  7233. inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j + 1);
  7234. found = true;
  7235. break;
  7236. }
  7237. }
  7238. if (!found)
  7239. break;
  7240. }
  7241. return output;
  7242. }
  7243. function buildUp(template, input) {
  7244. let clean = Array.from(input);
  7245. let output = "";
  7246. for (let i = 0; i < template.length; i++) {
  7247. if (!["9", "a", "*"].includes(template[i])) {
  7248. output += template[i];
  7249. continue;
  7250. }
  7251. if (clean.length === 0)
  7252. break;
  7253. output += clean.shift();
  7254. }
  7255. return output;
  7256. }
  7257. function formatMoney(input, delimiter = ".", thousands, precision = 2) {
  7258. if (input === "-")
  7259. return "-";
  7260. if (/^\D+$/.test(input))
  7261. return "9";
  7262. if (thousands === null || thousands === void 0) {
  7263. thousands = delimiter === "," ? "." : ",";
  7264. }
  7265. let addThousands = (input2, thousands2) => {
  7266. let output = "";
  7267. let counter = 0;
  7268. for (let i = input2.length - 1; i >= 0; i--) {
  7269. if (input2[i] === thousands2)
  7270. continue;
  7271. if (counter === 3) {
  7272. output = input2[i] + thousands2 + output;
  7273. counter = 0;
  7274. } else {
  7275. output = input2[i] + output;
  7276. }
  7277. counter++;
  7278. }
  7279. return output;
  7280. };
  7281. let minus = input.startsWith("-") ? "-" : "";
  7282. let strippedInput = input.replaceAll(new RegExp(`[^0-9\\${delimiter}]`, "g"), "");
  7283. let template = Array.from({ length: strippedInput.split(delimiter)[0].length }).fill("9").join("");
  7284. template = `${minus}${addThousands(template, thousands)}`;
  7285. if (precision > 0 && input.includes(delimiter))
  7286. template += `${delimiter}` + "9".repeat(precision);
  7287. queueMicrotask(() => {
  7288. if (this.el.value.endsWith(delimiter))
  7289. return;
  7290. if (this.el.value[this.el.selectionStart - 1] === delimiter) {
  7291. this.el.setSelectionRange(this.el.selectionStart - 1, this.el.selectionStart - 1);
  7292. }
  7293. });
  7294. return template;
  7295. }
  7296. var module_default = src_default;
  7297. }
  7298. });
  7299. // js/utils.js
  7300. var Bag = class {
  7301. constructor() {
  7302. this.arrays = {};
  7303. }
  7304. add(key, value) {
  7305. if (!this.arrays[key])
  7306. this.arrays[key] = [];
  7307. this.arrays[key].push(value);
  7308. }
  7309. remove(key) {
  7310. if (this.arrays[key])
  7311. delete this.arrays[key];
  7312. }
  7313. get(key) {
  7314. return this.arrays[key] || [];
  7315. }
  7316. each(key, callback) {
  7317. return this.get(key).forEach(callback);
  7318. }
  7319. };
  7320. var WeakBag = class {
  7321. constructor() {
  7322. this.arrays = /* @__PURE__ */ new WeakMap();
  7323. }
  7324. add(key, value) {
  7325. if (!this.arrays.has(key))
  7326. this.arrays.set(key, []);
  7327. this.arrays.get(key).push(value);
  7328. }
  7329. remove(key) {
  7330. if (this.arrays.has(key))
  7331. this.arrays.delete(key, []);
  7332. }
  7333. get(key) {
  7334. return this.arrays.has(key) ? this.arrays.get(key) : [];
  7335. }
  7336. each(key, callback) {
  7337. return this.get(key).forEach(callback);
  7338. }
  7339. };
  7340. function dispatch(target, name, detail = {}, bubbles = true) {
  7341. target.dispatchEvent(new CustomEvent(name, {
  7342. detail,
  7343. bubbles,
  7344. composed: true,
  7345. cancelable: true
  7346. }));
  7347. }
  7348. function listen(target, name, handler) {
  7349. target.addEventListener(name, handler);
  7350. return () => target.removeEventListener(name, handler);
  7351. }
  7352. function isObjecty(subject) {
  7353. return typeof subject === "object" && subject !== null;
  7354. }
  7355. function isObject(subject) {
  7356. return isObjecty(subject) && !isArray(subject);
  7357. }
  7358. function isArray(subject) {
  7359. return Array.isArray(subject);
  7360. }
  7361. function isFunction(subject) {
  7362. return typeof subject === "function";
  7363. }
  7364. function isPrimitive(subject) {
  7365. return typeof subject !== "object" || subject === null;
  7366. }
  7367. function deepClone(obj) {
  7368. return JSON.parse(JSON.stringify(obj));
  7369. }
  7370. function dataGet(object, key) {
  7371. if (key === "")
  7372. return object;
  7373. return key.split(".").reduce((carry, i) => {
  7374. return carry?.[i];
  7375. }, object);
  7376. }
  7377. function dataSet(object, key, value) {
  7378. let segments = key.split(".");
  7379. if (segments.length === 1) {
  7380. return object[key] = value;
  7381. }
  7382. let firstSegment = segments.shift();
  7383. let restOfSegments = segments.join(".");
  7384. if (object[firstSegment] === void 0) {
  7385. object[firstSegment] = {};
  7386. }
  7387. dataSet(object[firstSegment], restOfSegments, value);
  7388. }
  7389. function diff(left, right, diffs = {}, path = "") {
  7390. if (left === right)
  7391. return diffs;
  7392. if (typeof left !== typeof right || isObject(left) && isArray(right) || isArray(left) && isObject(right)) {
  7393. diffs[path] = right;
  7394. return diffs;
  7395. }
  7396. if (isPrimitive(left) || isPrimitive(right)) {
  7397. diffs[path] = right;
  7398. return diffs;
  7399. }
  7400. let leftKeys = Object.keys(left);
  7401. Object.entries(right).forEach(([key, value]) => {
  7402. diffs = { ...diffs, ...diff(left[key], right[key], diffs, path === "" ? key : `${path}.${key}`) };
  7403. leftKeys = leftKeys.filter((i) => i !== key);
  7404. });
  7405. leftKeys.forEach((key) => {
  7406. diffs[`${path}.${key}`] = "__rm__";
  7407. });
  7408. return diffs;
  7409. }
  7410. function extractData(payload) {
  7411. let value = isSynthetic(payload) ? payload[0] : payload;
  7412. let meta = isSynthetic(payload) ? payload[1] : void 0;
  7413. if (isObjecty(value)) {
  7414. Object.entries(value).forEach(([key, iValue]) => {
  7415. value[key] = extractData(iValue);
  7416. });
  7417. }
  7418. return value;
  7419. }
  7420. function isSynthetic(subject) {
  7421. return Array.isArray(subject) && subject.length === 2 && typeof subject[1] === "object" && Object.keys(subject[1]).includes("s");
  7422. }
  7423. function getCsrfToken() {
  7424. if (document.querySelector('meta[name="csrf-token"]')) {
  7425. return document.querySelector('meta[name="csrf-token"]').getAttribute("content");
  7426. }
  7427. if (document.querySelector("[data-csrf]")) {
  7428. return document.querySelector("[data-csrf]").getAttribute("data-csrf");
  7429. }
  7430. if (window.livewireScriptConfig["csrf"] ?? false) {
  7431. return window.livewireScriptConfig["csrf"];
  7432. }
  7433. throw "Livewire: No CSRF token detected";
  7434. }
  7435. var nonce;
  7436. function getNonce() {
  7437. if (nonce)
  7438. return nonce;
  7439. if (window.livewireScriptConfig && (window.livewireScriptConfig["nonce"] ?? false)) {
  7440. nonce = window.livewireScriptConfig["nonce"];
  7441. return nonce;
  7442. }
  7443. const elWithNonce = document.querySelector("style[data-livewire-style][nonce]");
  7444. if (elWithNonce) {
  7445. nonce = elWithNonce.nonce;
  7446. return nonce;
  7447. }
  7448. return null;
  7449. }
  7450. function getUpdateUri() {
  7451. return document.querySelector("[data-update-uri]")?.getAttribute("data-update-uri") ?? window.livewireScriptConfig["uri"] ?? null;
  7452. }
  7453. function contentIsFromDump(content) {
  7454. return !!content.match(/<script>Sfdump\(".+"\)<\/script>/);
  7455. }
  7456. function splitDumpFromContent(content) {
  7457. let dump = content.match(/.*<script>Sfdump\(".+"\)<\/script>/s);
  7458. return [dump, content.replace(dump, "")];
  7459. }
  7460. // js/features/supportFileUploads.js
  7461. var uploadManagers = /* @__PURE__ */ new WeakMap();
  7462. function getUploadManager(component) {
  7463. if (!uploadManagers.has(component)) {
  7464. let manager = new UploadManager(component);
  7465. uploadManagers.set(component, manager);
  7466. manager.registerListeners();
  7467. }
  7468. return uploadManagers.get(component);
  7469. }
  7470. function handleFileUpload(el, property, component, cleanup) {
  7471. let manager = getUploadManager(component);
  7472. let start2 = () => el.dispatchEvent(new CustomEvent("livewire-upload-start", { bubbles: true, detail: { id: component.id, property } }));
  7473. let finish = () => el.dispatchEvent(new CustomEvent("livewire-upload-finish", { bubbles: true, detail: { id: component.id, property } }));
  7474. let error2 = () => el.dispatchEvent(new CustomEvent("livewire-upload-error", { bubbles: true, detail: { id: component.id, property } }));
  7475. let cancel = () => el.dispatchEvent(new CustomEvent("livewire-upload-cancel", { bubbles: true, detail: { id: component.id, property } }));
  7476. let progress = (progressEvent) => {
  7477. var percentCompleted = Math.round(progressEvent.loaded * 100 / progressEvent.total);
  7478. el.dispatchEvent(new CustomEvent("livewire-upload-progress", {
  7479. bubbles: true,
  7480. detail: { progress: percentCompleted }
  7481. }));
  7482. };
  7483. let eventHandler = (e) => {
  7484. if (e.target.files.length === 0)
  7485. return;
  7486. start2();
  7487. if (e.target.multiple) {
  7488. manager.uploadMultiple(property, e.target.files, finish, error2, progress, cancel);
  7489. } else {
  7490. manager.upload(property, e.target.files[0], finish, error2, progress, cancel);
  7491. }
  7492. };
  7493. el.addEventListener("change", eventHandler);
  7494. component.$wire.$watch(property, (value) => {
  7495. if (!el.isConnected)
  7496. return;
  7497. if (value === null || value === "") {
  7498. el.value = "";
  7499. }
  7500. if (el.multiple && Array.isArray(value) && value.length === 0) {
  7501. el.value = "";
  7502. }
  7503. });
  7504. let clearFileInputValue = () => {
  7505. el.value = null;
  7506. };
  7507. el.addEventListener("click", clearFileInputValue);
  7508. el.addEventListener("livewire-upload-cancel", clearFileInputValue);
  7509. cleanup(() => {
  7510. el.removeEventListener("change", eventHandler);
  7511. el.removeEventListener("click", clearFileInputValue);
  7512. });
  7513. }
  7514. var UploadManager = class {
  7515. constructor(component) {
  7516. this.component = component;
  7517. this.uploadBag = new MessageBag();
  7518. this.removeBag = new MessageBag();
  7519. }
  7520. registerListeners() {
  7521. this.component.$wire.$on("upload:generatedSignedUrl", ({ name, url }) => {
  7522. setUploadLoading(this.component, name);
  7523. this.handleSignedUrl(name, url);
  7524. });
  7525. this.component.$wire.$on("upload:generatedSignedUrlForS3", ({ name, payload }) => {
  7526. setUploadLoading(this.component, name);
  7527. this.handleS3PreSignedUrl(name, payload);
  7528. });
  7529. this.component.$wire.$on("upload:finished", ({ name, tmpFilenames }) => this.markUploadFinished(name, tmpFilenames));
  7530. this.component.$wire.$on("upload:errored", ({ name }) => this.markUploadErrored(name));
  7531. this.component.$wire.$on("upload:removed", ({ name, tmpFilename }) => this.removeBag.shift(name).finishCallback(tmpFilename));
  7532. }
  7533. upload(name, file, finishCallback, errorCallback, progressCallback, cancelledCallback) {
  7534. this.setUpload(name, {
  7535. files: [file],
  7536. multiple: false,
  7537. finishCallback,
  7538. errorCallback,
  7539. progressCallback,
  7540. cancelledCallback
  7541. });
  7542. }
  7543. uploadMultiple(name, files, finishCallback, errorCallback, progressCallback, cancelledCallback) {
  7544. this.setUpload(name, {
  7545. files: Array.from(files),
  7546. multiple: true,
  7547. finishCallback,
  7548. errorCallback,
  7549. progressCallback,
  7550. cancelledCallback
  7551. });
  7552. }
  7553. removeUpload(name, tmpFilename, finishCallback) {
  7554. this.removeBag.push(name, {
  7555. tmpFilename,
  7556. finishCallback
  7557. });
  7558. this.component.$wire.call("_removeUpload", name, tmpFilename);
  7559. }
  7560. setUpload(name, uploadObject) {
  7561. this.uploadBag.add(name, uploadObject);
  7562. if (this.uploadBag.get(name).length === 1) {
  7563. this.startUpload(name, uploadObject);
  7564. }
  7565. }
  7566. handleSignedUrl(name, url) {
  7567. let formData = new FormData();
  7568. Array.from(this.uploadBag.first(name).files).forEach((file) => formData.append("files[]", file, file.name));
  7569. let headers = {
  7570. "Accept": "application/json"
  7571. };
  7572. let csrfToken = getCsrfToken();
  7573. if (csrfToken)
  7574. headers["X-CSRF-TOKEN"] = csrfToken;
  7575. this.makeRequest(name, formData, "post", url, headers, (response) => {
  7576. return response.paths;
  7577. });
  7578. }
  7579. handleS3PreSignedUrl(name, payload) {
  7580. let formData = this.uploadBag.first(name).files[0];
  7581. let headers = payload.headers;
  7582. if ("Host" in headers)
  7583. delete headers.Host;
  7584. let url = payload.url;
  7585. this.makeRequest(name, formData, "put", url, headers, (response) => {
  7586. return [payload.path];
  7587. });
  7588. }
  7589. makeRequest(name, formData, method, url, headers, retrievePaths) {
  7590. let request = new XMLHttpRequest();
  7591. request.open(method, url);
  7592. Object.entries(headers).forEach(([key, value]) => {
  7593. request.setRequestHeader(key, value);
  7594. });
  7595. request.upload.addEventListener("progress", (e) => {
  7596. e.detail = {};
  7597. e.detail.progress = Math.floor(e.loaded * 100 / e.total);
  7598. this.uploadBag.first(name).progressCallback(e);
  7599. });
  7600. request.addEventListener("load", () => {
  7601. if ((request.status + "")[0] === "2") {
  7602. let paths = retrievePaths(request.response && JSON.parse(request.response));
  7603. this.component.$wire.call("_finishUpload", name, paths, this.uploadBag.first(name).multiple);
  7604. return;
  7605. }
  7606. let errors = null;
  7607. if (request.status === 422) {
  7608. errors = request.response;
  7609. }
  7610. this.component.$wire.call("_uploadErrored", name, errors, this.uploadBag.first(name).multiple);
  7611. });
  7612. this.uploadBag.first(name).request = request;
  7613. request.send(formData);
  7614. }
  7615. startUpload(name, uploadObject) {
  7616. let fileInfos = uploadObject.files.map((file) => {
  7617. return { name: file.name, size: file.size, type: file.type };
  7618. });
  7619. this.component.$wire.call("_startUpload", name, fileInfos, uploadObject.multiple);
  7620. setUploadLoading(this.component, name);
  7621. }
  7622. markUploadFinished(name, tmpFilenames) {
  7623. unsetUploadLoading(this.component);
  7624. let uploadObject = this.uploadBag.shift(name);
  7625. uploadObject.finishCallback(uploadObject.multiple ? tmpFilenames : tmpFilenames[0]);
  7626. if (this.uploadBag.get(name).length > 0)
  7627. this.startUpload(name, this.uploadBag.last(name));
  7628. }
  7629. markUploadErrored(name) {
  7630. unsetUploadLoading(this.component);
  7631. this.uploadBag.shift(name).errorCallback();
  7632. if (this.uploadBag.get(name).length > 0)
  7633. this.startUpload(name, this.uploadBag.last(name));
  7634. }
  7635. cancelUpload(name, cancelledCallback = null) {
  7636. unsetUploadLoading(this.component);
  7637. let uploadItem = this.uploadBag.first(name);
  7638. if (uploadItem) {
  7639. if (uploadItem.request) {
  7640. uploadItem.request.abort();
  7641. }
  7642. this.uploadBag.shift(name).cancelledCallback();
  7643. if (cancelledCallback)
  7644. cancelledCallback();
  7645. }
  7646. }
  7647. };
  7648. var MessageBag = class {
  7649. constructor() {
  7650. this.bag = {};
  7651. }
  7652. add(name, thing) {
  7653. if (!this.bag[name]) {
  7654. this.bag[name] = [];
  7655. }
  7656. this.bag[name].push(thing);
  7657. }
  7658. push(name, thing) {
  7659. this.add(name, thing);
  7660. }
  7661. first(name) {
  7662. if (!this.bag[name])
  7663. return null;
  7664. return this.bag[name][0];
  7665. }
  7666. last(name) {
  7667. return this.bag[name].slice(-1)[0];
  7668. }
  7669. get(name) {
  7670. return this.bag[name];
  7671. }
  7672. shift(name) {
  7673. return this.bag[name].shift();
  7674. }
  7675. call(name, ...params) {
  7676. (this.listeners[name] || []).forEach((callback) => {
  7677. callback(...params);
  7678. });
  7679. }
  7680. has(name) {
  7681. return Object.keys(this.listeners).includes(name);
  7682. }
  7683. };
  7684. function setUploadLoading() {
  7685. }
  7686. function unsetUploadLoading() {
  7687. }
  7688. function upload(component, name, file, finishCallback = () => {
  7689. }, errorCallback = () => {
  7690. }, progressCallback = () => {
  7691. }, cancelledCallback = () => {
  7692. }) {
  7693. let uploadManager = getUploadManager(component);
  7694. uploadManager.upload(name, file, finishCallback, errorCallback, progressCallback, cancelledCallback);
  7695. }
  7696. function uploadMultiple(component, name, files, finishCallback = () => {
  7697. }, errorCallback = () => {
  7698. }, progressCallback = () => {
  7699. }, cancelledCallback = () => {
  7700. }) {
  7701. let uploadManager = getUploadManager(component);
  7702. uploadManager.uploadMultiple(name, files, finishCallback, errorCallback, progressCallback, cancelledCallback);
  7703. }
  7704. function removeUpload(component, name, tmpFilename, finishCallback = () => {
  7705. }, errorCallback = () => {
  7706. }) {
  7707. let uploadManager = getUploadManager(component);
  7708. uploadManager.removeUpload(name, tmpFilename, finishCallback, errorCallback);
  7709. }
  7710. function cancelUpload(component, name, cancelledCallback = () => {
  7711. }) {
  7712. let uploadManager = getUploadManager(component);
  7713. uploadManager.cancelUpload(name, cancelledCallback);
  7714. }
  7715. // js/features/supportEntangle.js
  7716. var import_alpinejs = __toESM(require_module_cjs());
  7717. function generateEntangleFunction(component, cleanup) {
  7718. if (!cleanup)
  7719. cleanup = () => {
  7720. };
  7721. return (name, live = false) => {
  7722. let isLive = live;
  7723. let livewireProperty = name;
  7724. let livewireComponent = component.$wire;
  7725. let livewirePropertyValue = livewireComponent.get(livewireProperty);
  7726. let interceptor = import_alpinejs.default.interceptor((initialValue, getter, setter, path, key) => {
  7727. if (typeof livewirePropertyValue === "undefined") {
  7728. console.error(`Livewire Entangle Error: Livewire property ['${livewireProperty}'] cannot be found on component: ['${component.name}']`);
  7729. return;
  7730. }
  7731. let release = import_alpinejs.default.entangle({
  7732. get() {
  7733. return livewireComponent.get(name);
  7734. },
  7735. set(value) {
  7736. livewireComponent.set(name, value, isLive);
  7737. }
  7738. }, {
  7739. get() {
  7740. return getter();
  7741. },
  7742. set(value) {
  7743. setter(value);
  7744. }
  7745. });
  7746. cleanup(() => release());
  7747. return cloneIfObject(livewireComponent.get(name));
  7748. }, (obj) => {
  7749. Object.defineProperty(obj, "live", {
  7750. get() {
  7751. isLive = true;
  7752. return obj;
  7753. }
  7754. });
  7755. });
  7756. return interceptor(livewirePropertyValue);
  7757. };
  7758. }
  7759. function cloneIfObject(value) {
  7760. return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value;
  7761. }
  7762. // js/hooks.js
  7763. var listeners = [];
  7764. function on(name, callback) {
  7765. if (!listeners[name])
  7766. listeners[name] = [];
  7767. listeners[name].push(callback);
  7768. return () => {
  7769. listeners[name] = listeners[name].filter((i) => i !== callback);
  7770. };
  7771. }
  7772. function trigger(name, ...params) {
  7773. let callbacks = listeners[name] || [];
  7774. let finishers = [];
  7775. for (let i = 0; i < callbacks.length; i++) {
  7776. let finisher = callbacks[i](...params);
  7777. if (isFunction(finisher))
  7778. finishers.push(finisher);
  7779. }
  7780. return (result) => {
  7781. return runFinishers(finishers, result);
  7782. };
  7783. }
  7784. async function triggerAsync(name, ...params) {
  7785. let callbacks = listeners[name] || [];
  7786. let finishers = [];
  7787. for (let i = 0; i < callbacks.length; i++) {
  7788. let finisher = await callbacks[i](...params);
  7789. if (isFunction(finisher))
  7790. finishers.push(finisher);
  7791. }
  7792. return (result) => {
  7793. return runFinishers(finishers, result);
  7794. };
  7795. }
  7796. function runFinishers(finishers, result) {
  7797. let latest = result;
  7798. for (let i = 0; i < finishers.length; i++) {
  7799. let iResult = finishers[i](latest);
  7800. if (iResult !== void 0) {
  7801. latest = iResult;
  7802. }
  7803. }
  7804. return latest;
  7805. }
  7806. // js/request/modal.js
  7807. function showHtmlModal(html) {
  7808. let page = document.createElement("html");
  7809. page.innerHTML = html;
  7810. page.querySelectorAll("a").forEach((a) => a.setAttribute("target", "_top"));
  7811. let modal = document.getElementById("livewire-error");
  7812. if (typeof modal != "undefined" && modal != null) {
  7813. modal.innerHTML = "";
  7814. } else {
  7815. modal = document.createElement("div");
  7816. modal.id = "livewire-error";
  7817. modal.style.position = "fixed";
  7818. modal.style.width = "100vw";
  7819. modal.style.height = "100vh";
  7820. modal.style.padding = "50px";
  7821. modal.style.backgroundColor = "rgba(0, 0, 0, .6)";
  7822. modal.style.zIndex = 2e5;
  7823. }
  7824. let iframe = document.createElement("iframe");
  7825. iframe.style.backgroundColor = "#17161A";
  7826. iframe.style.borderRadius = "5px";
  7827. iframe.style.width = "100%";
  7828. iframe.style.height = "100%";
  7829. modal.appendChild(iframe);
  7830. document.body.prepend(modal);
  7831. document.body.style.overflow = "hidden";
  7832. iframe.contentWindow.document.open();
  7833. iframe.contentWindow.document.write(page.outerHTML);
  7834. iframe.contentWindow.document.close();
  7835. modal.addEventListener("click", () => hideHtmlModal(modal));
  7836. modal.setAttribute("tabindex", 0);
  7837. modal.addEventListener("keydown", (e) => {
  7838. if (e.key === "Escape")
  7839. hideHtmlModal(modal);
  7840. });
  7841. modal.focus();
  7842. }
  7843. function hideHtmlModal(modal) {
  7844. modal.outerHTML = "";
  7845. document.body.style.overflow = "visible";
  7846. }
  7847. // js/request/pool.js
  7848. var RequestPool = class {
  7849. constructor() {
  7850. this.commits = /* @__PURE__ */ new Set();
  7851. }
  7852. add(commit) {
  7853. this.commits.add(commit);
  7854. }
  7855. delete(commit) {
  7856. this.commits.delete(commit);
  7857. }
  7858. hasCommitFor(component) {
  7859. return !!this.findCommitByComponent(component);
  7860. }
  7861. findCommitByComponent(component) {
  7862. for (let [idx, commit] of this.commits.entries()) {
  7863. if (commit.component === component)
  7864. return commit;
  7865. }
  7866. }
  7867. shouldHoldCommit(commit) {
  7868. return !commit.isolate;
  7869. }
  7870. empty() {
  7871. return this.commits.size === 0;
  7872. }
  7873. async send() {
  7874. this.prepare();
  7875. await sendRequest(this);
  7876. }
  7877. prepare() {
  7878. this.commits.forEach((i) => i.prepare());
  7879. }
  7880. payload() {
  7881. let commitPayloads = [];
  7882. let successReceivers = [];
  7883. let failureReceivers = [];
  7884. this.commits.forEach((commit) => {
  7885. let [payload, succeed2, fail2] = commit.toRequestPayload();
  7886. commitPayloads.push(payload);
  7887. successReceivers.push(succeed2);
  7888. failureReceivers.push(fail2);
  7889. });
  7890. let succeed = (components2) => successReceivers.forEach((receiver) => receiver(components2.shift()));
  7891. let fail = () => failureReceivers.forEach((receiver) => receiver());
  7892. return [commitPayloads, succeed, fail];
  7893. }
  7894. };
  7895. // js/request/commit.js
  7896. var Commit = class {
  7897. constructor(component) {
  7898. this.component = component;
  7899. this.isolate = false;
  7900. this.calls = [];
  7901. this.receivers = [];
  7902. this.resolvers = [];
  7903. }
  7904. addResolver(resolver) {
  7905. this.resolvers.push(resolver);
  7906. }
  7907. addCall(method, params, receiver) {
  7908. this.calls.push({
  7909. path: "",
  7910. method,
  7911. params,
  7912. handleReturn(value) {
  7913. receiver(value);
  7914. }
  7915. });
  7916. }
  7917. prepare() {
  7918. trigger("commit.prepare", { component: this.component });
  7919. }
  7920. toRequestPayload() {
  7921. let propertiesDiff = diff(this.component.canonical, this.component.ephemeral);
  7922. let updates = this.component.mergeQueuedUpdates(propertiesDiff);
  7923. let payload = {
  7924. snapshot: this.component.snapshotEncoded,
  7925. updates,
  7926. calls: this.calls.map((i) => ({
  7927. path: i.path,
  7928. method: i.method,
  7929. params: i.params
  7930. }))
  7931. };
  7932. let succeedCallbacks = [];
  7933. let failCallbacks = [];
  7934. let respondCallbacks = [];
  7935. let succeed = (fwd) => succeedCallbacks.forEach((i) => i(fwd));
  7936. let fail = () => failCallbacks.forEach((i) => i());
  7937. let respond = () => respondCallbacks.forEach((i) => i());
  7938. let finishTarget = trigger("commit", {
  7939. component: this.component,
  7940. commit: payload,
  7941. succeed: (callback) => {
  7942. succeedCallbacks.push(callback);
  7943. },
  7944. fail: (callback) => {
  7945. failCallbacks.push(callback);
  7946. },
  7947. respond: (callback) => {
  7948. respondCallbacks.push(callback);
  7949. }
  7950. });
  7951. let handleResponse = (response) => {
  7952. let { snapshot, effects } = response;
  7953. respond();
  7954. this.component.mergeNewSnapshot(snapshot, effects, updates);
  7955. this.component.processEffects(this.component.effects);
  7956. if (effects["returns"]) {
  7957. let returns = effects["returns"];
  7958. let returnHandlerStack = this.calls.map(({ handleReturn }) => handleReturn);
  7959. returnHandlerStack.forEach((handleReturn, index) => {
  7960. handleReturn(returns[index]);
  7961. });
  7962. }
  7963. let parsedSnapshot = JSON.parse(snapshot);
  7964. finishTarget({ snapshot: parsedSnapshot, effects });
  7965. this.resolvers.forEach((i) => i());
  7966. succeed(response);
  7967. };
  7968. let handleFailure = () => {
  7969. respond();
  7970. fail();
  7971. };
  7972. return [payload, handleResponse, handleFailure];
  7973. }
  7974. };
  7975. // js/request/bus.js
  7976. var CommitBus = class {
  7977. constructor() {
  7978. this.commits = /* @__PURE__ */ new Set();
  7979. this.pools = /* @__PURE__ */ new Set();
  7980. }
  7981. add(component) {
  7982. let commit = this.findCommitOr(component, () => {
  7983. let newCommit = new Commit(component);
  7984. this.commits.add(newCommit);
  7985. return newCommit;
  7986. });
  7987. bufferPoolingForFiveMs(commit, () => {
  7988. let pool = this.findPoolWithComponent(commit.component);
  7989. if (!pool) {
  7990. this.createAndSendNewPool();
  7991. }
  7992. });
  7993. return commit;
  7994. }
  7995. findCommitOr(component, callback) {
  7996. for (let [idx, commit] of this.commits.entries()) {
  7997. if (commit.component === component) {
  7998. return commit;
  7999. }
  8000. }
  8001. return callback();
  8002. }
  8003. findPoolWithComponent(component) {
  8004. for (let [idx, pool] of this.pools.entries()) {
  8005. if (pool.hasCommitFor(component))
  8006. return pool;
  8007. }
  8008. }
  8009. createAndSendNewPool() {
  8010. trigger("commit.pooling", { commits: this.commits });
  8011. let pools = this.corraleCommitsIntoPools();
  8012. this.commits.clear();
  8013. trigger("commit.pooled", { pools });
  8014. pools.forEach((pool) => {
  8015. if (pool.empty())
  8016. return;
  8017. this.pools.add(pool);
  8018. pool.send().then(() => {
  8019. this.pools.delete(pool);
  8020. this.sendAnyQueuedCommits();
  8021. });
  8022. });
  8023. }
  8024. corraleCommitsIntoPools() {
  8025. let pools = /* @__PURE__ */ new Set();
  8026. for (let [idx, commit] of this.commits.entries()) {
  8027. let hasFoundPool = false;
  8028. pools.forEach((pool) => {
  8029. if (pool.shouldHoldCommit(commit)) {
  8030. pool.add(commit);
  8031. hasFoundPool = true;
  8032. }
  8033. });
  8034. if (!hasFoundPool) {
  8035. let newPool = new RequestPool();
  8036. newPool.add(commit);
  8037. pools.add(newPool);
  8038. }
  8039. }
  8040. return pools;
  8041. }
  8042. sendAnyQueuedCommits() {
  8043. if (this.commits.size > 0) {
  8044. this.createAndSendNewPool();
  8045. }
  8046. }
  8047. };
  8048. var buffersByCommit = /* @__PURE__ */ new WeakMap();
  8049. function bufferPoolingForFiveMs(commit, callback) {
  8050. if (buffersByCommit.has(commit))
  8051. return;
  8052. buffersByCommit.set(commit, setTimeout(() => {
  8053. callback();
  8054. buffersByCommit.delete(commit);
  8055. }, 5));
  8056. }
  8057. // js/request/index.js
  8058. var commitBus = new CommitBus();
  8059. async function requestCommit(component) {
  8060. let commit = commitBus.add(component);
  8061. let promise = new Promise((resolve) => {
  8062. commit.addResolver(resolve);
  8063. });
  8064. promise.commit = commit;
  8065. return promise;
  8066. }
  8067. async function requestCall(component, method, params) {
  8068. let commit = commitBus.add(component);
  8069. let promise = new Promise((resolve) => {
  8070. commit.addCall(method, params, (value) => resolve(value));
  8071. });
  8072. promise.commit = commit;
  8073. return promise;
  8074. }
  8075. async function sendRequest(pool) {
  8076. let [payload, handleSuccess, handleFailure] = pool.payload();
  8077. let options = {
  8078. method: "POST",
  8079. body: JSON.stringify({
  8080. _token: getCsrfToken(),
  8081. components: payload
  8082. }),
  8083. headers: {
  8084. "Content-type": "application/json",
  8085. "X-Livewire": ""
  8086. }
  8087. };
  8088. let succeedCallbacks = [];
  8089. let failCallbacks = [];
  8090. let respondCallbacks = [];
  8091. let succeed = (fwd) => succeedCallbacks.forEach((i) => i(fwd));
  8092. let fail = (fwd) => failCallbacks.forEach((i) => i(fwd));
  8093. let respond = (fwd) => respondCallbacks.forEach((i) => i(fwd));
  8094. let finishProfile = trigger("request.profile", options);
  8095. let updateUri = getUpdateUri();
  8096. trigger("request", {
  8097. url: updateUri,
  8098. options,
  8099. payload: options.body,
  8100. respond: (i) => respondCallbacks.push(i),
  8101. succeed: (i) => succeedCallbacks.push(i),
  8102. fail: (i) => failCallbacks.push(i)
  8103. });
  8104. let response;
  8105. try {
  8106. response = await fetch(updateUri, options);
  8107. } catch (e) {
  8108. finishProfile({ content: "{}", failed: true });
  8109. handleFailure();
  8110. fail({
  8111. status: 503,
  8112. content: null,
  8113. preventDefault: () => {
  8114. }
  8115. });
  8116. return;
  8117. }
  8118. let mutableObject = {
  8119. status: response.status,
  8120. response
  8121. };
  8122. respond(mutableObject);
  8123. response = mutableObject.response;
  8124. let content = await response.text();
  8125. if (!response.ok) {
  8126. finishProfile({ content: "{}", failed: true });
  8127. let preventDefault = false;
  8128. handleFailure();
  8129. fail({
  8130. status: response.status,
  8131. content,
  8132. preventDefault: () => preventDefault = true
  8133. });
  8134. if (preventDefault)
  8135. return;
  8136. if (response.status === 419) {
  8137. handlePageExpiry();
  8138. }
  8139. return showFailureModal(content);
  8140. }
  8141. if (response.redirected) {
  8142. window.location.href = response.url;
  8143. }
  8144. if (contentIsFromDump(content)) {
  8145. let dump;
  8146. [dump, content] = splitDumpFromContent(content);
  8147. showHtmlModal(dump);
  8148. finishProfile({ content: "{}", failed: true });
  8149. } else {
  8150. finishProfile({ content, failed: false });
  8151. }
  8152. let { components: components2, assets } = JSON.parse(content);
  8153. await triggerAsync("payload.intercept", { components: components2, assets });
  8154. await handleSuccess(components2);
  8155. succeed({ status: response.status, json: JSON.parse(content) });
  8156. }
  8157. function handlePageExpiry() {
  8158. confirm("This page has expired.\nWould you like to refresh the page?") && window.location.reload();
  8159. }
  8160. function showFailureModal(content) {
  8161. let html = content;
  8162. showHtmlModal(html);
  8163. }
  8164. // js/$wire.js
  8165. var import_alpinejs2 = __toESM(require_module_cjs());
  8166. var properties = {};
  8167. var fallback;
  8168. function wireProperty(name, callback, component = null) {
  8169. properties[name] = callback;
  8170. }
  8171. function wireFallback(callback) {
  8172. fallback = callback;
  8173. }
  8174. var aliases = {
  8175. "on": "$on",
  8176. "el": "$el",
  8177. "id": "$id",
  8178. "js": "$js",
  8179. "get": "$get",
  8180. "set": "$set",
  8181. "call": "$call",
  8182. "hook": "$hook",
  8183. "commit": "$commit",
  8184. "watch": "$watch",
  8185. "entangle": "$entangle",
  8186. "dispatch": "$dispatch",
  8187. "dispatchTo": "$dispatchTo",
  8188. "dispatchSelf": "$dispatchSelf",
  8189. "upload": "$upload",
  8190. "uploadMultiple": "$uploadMultiple",
  8191. "removeUpload": "$removeUpload",
  8192. "cancelUpload": "$cancelUpload"
  8193. };
  8194. function generateWireObject(component, state) {
  8195. return new Proxy({}, {
  8196. get(target, property) {
  8197. if (property === "__instance")
  8198. return component;
  8199. if (property in aliases) {
  8200. return getProperty(component, aliases[property]);
  8201. } else if (property in properties) {
  8202. return getProperty(component, property);
  8203. } else if (property in state) {
  8204. return state[property];
  8205. } else if (!["then"].includes(property)) {
  8206. return getFallback(component)(property);
  8207. }
  8208. },
  8209. set(target, property, value) {
  8210. if (property in state) {
  8211. state[property] = value;
  8212. }
  8213. return true;
  8214. }
  8215. });
  8216. }
  8217. function getProperty(component, name) {
  8218. return properties[name](component);
  8219. }
  8220. function getFallback(component) {
  8221. return fallback(component);
  8222. }
  8223. import_alpinejs2.default.magic("wire", (el, { cleanup }) => {
  8224. let component;
  8225. return new Proxy({}, {
  8226. get(target, property) {
  8227. if (!component)
  8228. component = closestComponent(el);
  8229. if (["$entangle", "entangle"].includes(property)) {
  8230. return generateEntangleFunction(component, cleanup);
  8231. }
  8232. return component.$wire[property];
  8233. },
  8234. set(target, property, value) {
  8235. if (!component)
  8236. component = closestComponent(el);
  8237. component.$wire[property] = value;
  8238. return true;
  8239. }
  8240. });
  8241. });
  8242. wireProperty("__instance", (component) => component);
  8243. wireProperty("$get", (component) => (property, reactive = true) => dataGet(reactive ? component.reactive : component.ephemeral, property));
  8244. wireProperty("$el", (component) => {
  8245. return component.el;
  8246. });
  8247. wireProperty("$id", (component) => {
  8248. return component.id;
  8249. });
  8250. wireProperty("$js", (component) => {
  8251. let fn = component.addJsAction.bind(component);
  8252. let jsActions = component.getJsActions();
  8253. Object.keys(jsActions).forEach((name) => {
  8254. fn[name] = component.getJsAction(name);
  8255. });
  8256. return fn;
  8257. });
  8258. wireProperty("$set", (component) => async (property, value, live = true) => {
  8259. dataSet(component.reactive, property, value);
  8260. if (live) {
  8261. component.queueUpdate(property, value);
  8262. return await requestCommit(component);
  8263. }
  8264. return Promise.resolve();
  8265. });
  8266. wireProperty("$call", (component) => async (method, ...params) => {
  8267. return await component.$wire[method](...params);
  8268. });
  8269. wireProperty("$entangle", (component) => (name, live = false) => {
  8270. return generateEntangleFunction(component)(name, live);
  8271. });
  8272. wireProperty("$toggle", (component) => (name, live = true) => {
  8273. return component.$wire.set(name, !component.$wire.get(name), live);
  8274. });
  8275. wireProperty("$watch", (component) => (path, callback) => {
  8276. let getter = () => {
  8277. return dataGet(component.reactive, path);
  8278. };
  8279. let unwatch = import_alpinejs2.default.watch(getter, callback);
  8280. component.addCleanup(unwatch);
  8281. });
  8282. wireProperty("$refresh", (component) => component.$wire.$commit);
  8283. wireProperty("$commit", (component) => async () => await requestCommit(component));
  8284. wireProperty("$on", (component) => (...params) => listen2(component, ...params));
  8285. wireProperty("$hook", (component) => (name, callback) => {
  8286. let unhook = on(name, ({ component: hookComponent, ...params }) => {
  8287. if (hookComponent === void 0)
  8288. return callback(params);
  8289. if (hookComponent.id === component.id)
  8290. return callback({ component: hookComponent, ...params });
  8291. });
  8292. component.addCleanup(unhook);
  8293. return unhook;
  8294. });
  8295. wireProperty("$dispatch", (component) => (...params) => dispatch2(component, ...params));
  8296. wireProperty("$dispatchSelf", (component) => (...params) => dispatchSelf(component, ...params));
  8297. wireProperty("$dispatchTo", () => (...params) => dispatchTo(...params));
  8298. wireProperty("$upload", (component) => (...params) => upload(component, ...params));
  8299. wireProperty("$uploadMultiple", (component) => (...params) => uploadMultiple(component, ...params));
  8300. wireProperty("$removeUpload", (component) => (...params) => removeUpload(component, ...params));
  8301. wireProperty("$cancelUpload", (component) => (...params) => cancelUpload(component, ...params));
  8302. var parentMemo = /* @__PURE__ */ new WeakMap();
  8303. wireProperty("$parent", (component) => {
  8304. if (parentMemo.has(component))
  8305. return parentMemo.get(component).$wire;
  8306. let parent = component.parent;
  8307. parentMemo.set(component, parent);
  8308. return parent.$wire;
  8309. });
  8310. var overriddenMethods = /* @__PURE__ */ new WeakMap();
  8311. function overrideMethod(component, method, callback) {
  8312. if (!overriddenMethods.has(component)) {
  8313. overriddenMethods.set(component, {});
  8314. }
  8315. let obj = overriddenMethods.get(component);
  8316. obj[method] = callback;
  8317. overriddenMethods.set(component, obj);
  8318. }
  8319. wireFallback((component) => (property) => async (...params) => {
  8320. if (params.length === 1 && params[0] instanceof Event) {
  8321. params = [];
  8322. }
  8323. if (overriddenMethods.has(component)) {
  8324. let overrides = overriddenMethods.get(component);
  8325. if (typeof overrides[property] === "function") {
  8326. return overrides[property](params);
  8327. }
  8328. }
  8329. return await requestCall(component, property, params);
  8330. });
  8331. // js/component.js
  8332. var Component = class {
  8333. constructor(el) {
  8334. if (el.__livewire)
  8335. throw "Component already initialized";
  8336. el.__livewire = this;
  8337. this.el = el;
  8338. this.id = el.getAttribute("wire:id");
  8339. this.__livewireId = this.id;
  8340. this.snapshotEncoded = el.getAttribute("wire:snapshot");
  8341. this.snapshot = JSON.parse(this.snapshotEncoded);
  8342. if (!this.snapshot) {
  8343. throw `Snapshot missing on Livewire component with id: ` + this.id;
  8344. }
  8345. this.name = this.snapshot.memo.name;
  8346. this.effects = JSON.parse(el.getAttribute("wire:effects"));
  8347. this.originalEffects = deepClone(this.effects);
  8348. this.canonical = extractData(deepClone(this.snapshot.data));
  8349. this.ephemeral = extractData(deepClone(this.snapshot.data));
  8350. this.reactive = Alpine.reactive(this.ephemeral);
  8351. this.queuedUpdates = {};
  8352. this.jsActions = {};
  8353. this.$wire = generateWireObject(this, this.reactive);
  8354. this.cleanups = [];
  8355. this.processEffects(this.effects);
  8356. }
  8357. mergeNewSnapshot(snapshotEncoded, effects, updates = {}) {
  8358. let snapshot = JSON.parse(snapshotEncoded);
  8359. let oldCanonical = deepClone(this.canonical);
  8360. let updatedOldCanonical = this.applyUpdates(oldCanonical, updates);
  8361. let newCanonical = extractData(deepClone(snapshot.data));
  8362. let dirty = diff(updatedOldCanonical, newCanonical);
  8363. this.snapshotEncoded = snapshotEncoded;
  8364. this.snapshot = snapshot;
  8365. this.effects = effects;
  8366. this.canonical = extractData(deepClone(snapshot.data));
  8367. let newData = extractData(deepClone(snapshot.data));
  8368. Object.entries(dirty).forEach(([key, value]) => {
  8369. let rootKey = key.split(".")[0];
  8370. this.reactive[rootKey] = newData[rootKey];
  8371. });
  8372. return dirty;
  8373. }
  8374. queueUpdate(propertyName, value) {
  8375. this.queuedUpdates[propertyName] = value;
  8376. }
  8377. mergeQueuedUpdates(diff2) {
  8378. Object.entries(this.queuedUpdates).forEach(([updateKey, updateValue]) => {
  8379. Object.entries(diff2).forEach(([diffKey, diffValue]) => {
  8380. if (diffKey.startsWith(updateValue)) {
  8381. delete diff2[diffKey];
  8382. }
  8383. });
  8384. diff2[updateKey] = updateValue;
  8385. });
  8386. this.queuedUpdates = [];
  8387. return diff2;
  8388. }
  8389. applyUpdates(object, updates) {
  8390. for (let key in updates) {
  8391. dataSet(object, key, updates[key]);
  8392. }
  8393. return object;
  8394. }
  8395. replayUpdate(snapshot, html) {
  8396. let effects = { ...this.effects, html };
  8397. this.mergeNewSnapshot(JSON.stringify(snapshot), effects);
  8398. this.processEffects({ html });
  8399. }
  8400. processEffects(effects) {
  8401. trigger("effects", this, effects);
  8402. trigger("effect", {
  8403. component: this,
  8404. effects,
  8405. cleanup: (i) => this.addCleanup(i)
  8406. });
  8407. }
  8408. get children() {
  8409. let meta = this.snapshot.memo;
  8410. let childIds = Object.values(meta.children).map((i) => i[1]);
  8411. return childIds.map((id) => findComponent(id));
  8412. }
  8413. get parent() {
  8414. return closestComponent(this.el.parentElement);
  8415. }
  8416. inscribeSnapshotAndEffectsOnElement() {
  8417. let el = this.el;
  8418. el.setAttribute("wire:snapshot", this.snapshotEncoded);
  8419. let effects = this.originalEffects.listeners ? { listeners: this.originalEffects.listeners } : {};
  8420. if (this.originalEffects.url) {
  8421. effects.url = this.originalEffects.url;
  8422. }
  8423. if (this.originalEffects.scripts) {
  8424. effects.scripts = this.originalEffects.scripts;
  8425. }
  8426. el.setAttribute("wire:effects", JSON.stringify(effects));
  8427. }
  8428. addJsAction(name, action) {
  8429. this.jsActions[name] = action;
  8430. }
  8431. hasJsAction(name) {
  8432. return this.jsActions[name] !== void 0;
  8433. }
  8434. getJsAction(name) {
  8435. return this.jsActions[name].bind(this.$wire);
  8436. }
  8437. getJsActions() {
  8438. return this.jsActions;
  8439. }
  8440. addCleanup(cleanup) {
  8441. this.cleanups.push(cleanup);
  8442. }
  8443. cleanup() {
  8444. delete this.el.__livewire;
  8445. while (this.cleanups.length > 0) {
  8446. this.cleanups.pop()();
  8447. }
  8448. }
  8449. };
  8450. // js/store.js
  8451. var components = {};
  8452. function initComponent(el) {
  8453. let component = new Component(el);
  8454. if (components[component.id])
  8455. throw "Component already registered";
  8456. let cleanup = (i) => component.addCleanup(i);
  8457. trigger("component.init", { component, cleanup });
  8458. components[component.id] = component;
  8459. return component;
  8460. }
  8461. function destroyComponent(id) {
  8462. let component = components[id];
  8463. if (!component)
  8464. return;
  8465. component.cleanup();
  8466. delete components[id];
  8467. }
  8468. function findComponent(id) {
  8469. let component = components[id];
  8470. if (!component)
  8471. throw "Component not found: " + id;
  8472. return component;
  8473. }
  8474. function closestComponent(el, strict = true) {
  8475. let closestRoot = Alpine.findClosest(el, (i) => i.__livewire);
  8476. if (!closestRoot) {
  8477. if (strict)
  8478. throw "Could not find Livewire component in DOM tree";
  8479. return;
  8480. }
  8481. return closestRoot.__livewire;
  8482. }
  8483. function componentsByName(name) {
  8484. return Object.values(components).filter((component) => {
  8485. return name == component.name;
  8486. });
  8487. }
  8488. function getByName(name) {
  8489. return componentsByName(name).map((i) => i.$wire);
  8490. }
  8491. function find(id) {
  8492. let component = components[id];
  8493. return component && component.$wire;
  8494. }
  8495. function first() {
  8496. return Object.values(components)[0].$wire;
  8497. }
  8498. function all() {
  8499. return Object.values(components);
  8500. }
  8501. // js/events.js
  8502. function dispatch2(component, name, params) {
  8503. dispatchEvent(component.el, name, params);
  8504. }
  8505. function dispatchGlobal(name, params) {
  8506. dispatchEvent(window, name, params);
  8507. }
  8508. function dispatchSelf(component, name, params) {
  8509. dispatchEvent(component.el, name, params, false);
  8510. }
  8511. function dispatchTo(componentName, name, params) {
  8512. let targets = componentsByName(componentName);
  8513. targets.forEach((target) => {
  8514. dispatchEvent(target.el, name, params, false);
  8515. });
  8516. }
  8517. function listen2(component, name, callback) {
  8518. component.el.addEventListener(name, (e) => {
  8519. callback(e.detail);
  8520. });
  8521. }
  8522. function on2(eventName, callback) {
  8523. let handler = (e) => {
  8524. if (!e.__livewire)
  8525. return;
  8526. callback(e.detail);
  8527. };
  8528. window.addEventListener(eventName, handler);
  8529. return () => {
  8530. window.removeEventListener(eventName, handler);
  8531. };
  8532. }
  8533. function dispatchEvent(target, name, params, bubbles = true) {
  8534. let e = new CustomEvent(name, { bubbles, detail: params });
  8535. e.__livewire = { name, params, receivedBy: [] };
  8536. target.dispatchEvent(e);
  8537. }
  8538. // js/directives.js
  8539. var customDirectiveNames = /* @__PURE__ */ new Set();
  8540. function matchesForLivewireDirective(attributeName) {
  8541. return attributeName.match(new RegExp("wire:"));
  8542. }
  8543. function extractDirective(el, name) {
  8544. let [value, ...modifiers] = name.replace(new RegExp("wire:"), "").split(".");
  8545. return new Directive(value, modifiers, name, el);
  8546. }
  8547. function directive(name, callback) {
  8548. if (customDirectiveNames.has(name))
  8549. return;
  8550. customDirectiveNames.add(name);
  8551. on("directive.init", ({ el, component, directive: directive2, cleanup }) => {
  8552. if (directive2.value === name) {
  8553. callback({
  8554. el,
  8555. directive: directive2,
  8556. component,
  8557. $wire: component.$wire,
  8558. cleanup
  8559. });
  8560. }
  8561. });
  8562. }
  8563. function globalDirective(name, callback) {
  8564. if (customDirectiveNames.has(name))
  8565. return;
  8566. customDirectiveNames.add(name);
  8567. on("directive.global.init", ({ el, directive: directive2, cleanup }) => {
  8568. if (directive2.value === name) {
  8569. callback({ el, directive: directive2, cleanup });
  8570. }
  8571. });
  8572. }
  8573. function getDirectives(el) {
  8574. return new DirectiveManager(el);
  8575. }
  8576. function customDirectiveHasBeenRegistered(name) {
  8577. return customDirectiveNames.has(name);
  8578. }
  8579. var DirectiveManager = class {
  8580. constructor(el) {
  8581. this.el = el;
  8582. this.directives = this.extractTypeModifiersAndValue();
  8583. }
  8584. all() {
  8585. return this.directives;
  8586. }
  8587. has(value) {
  8588. return this.directives.map((directive2) => directive2.value).includes(value);
  8589. }
  8590. missing(value) {
  8591. return !this.has(value);
  8592. }
  8593. get(value) {
  8594. return this.directives.find((directive2) => directive2.value === value);
  8595. }
  8596. extractTypeModifiersAndValue() {
  8597. return Array.from(this.el.getAttributeNames().filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(this.el, name)));
  8598. }
  8599. };
  8600. var Directive = class {
  8601. constructor(value, modifiers, rawName, el) {
  8602. this.rawName = this.raw = rawName;
  8603. this.el = el;
  8604. this.eventContext;
  8605. this.value = value;
  8606. this.modifiers = modifiers;
  8607. this.expression = this.el.getAttribute(this.rawName);
  8608. }
  8609. get method() {
  8610. const { method } = this.parseOutMethodAndParams(this.expression);
  8611. return method;
  8612. }
  8613. get params() {
  8614. const { params } = this.parseOutMethodAndParams(this.expression);
  8615. return params;
  8616. }
  8617. parseOutMethodAndParams(rawMethod) {
  8618. let method = rawMethod;
  8619. let params = [];
  8620. const methodAndParamString = method.match(/(.*?)\((.*)\)/s);
  8621. if (methodAndParamString) {
  8622. method = methodAndParamString[1];
  8623. let func = new Function("$event", `return (function () {
  8624. for (var l=arguments.length, p=new Array(l), k=0; k<l; k++) {
  8625. p[k] = arguments[k];
  8626. }
  8627. return [].concat(p);
  8628. })(${methodAndParamString[2]})`);
  8629. params = func(this.eventContext);
  8630. }
  8631. return { method, params };
  8632. }
  8633. };
  8634. // js/lifecycle.js
  8635. var import_collapse = __toESM(require_module_cjs2());
  8636. var import_focus = __toESM(require_module_cjs3());
  8637. var import_persist2 = __toESM(require_module_cjs4());
  8638. var import_intersect = __toESM(require_module_cjs5());
  8639. var import_resize = __toESM(require_module_cjs6());
  8640. var import_anchor = __toESM(require_module_cjs7());
  8641. // js/plugins/navigate/history.js
  8642. var Snapshot = class {
  8643. constructor(url, html) {
  8644. this.url = url;
  8645. this.html = html;
  8646. }
  8647. };
  8648. var snapshotCache = {
  8649. currentKey: null,
  8650. currentUrl: null,
  8651. keys: [],
  8652. lookup: {},
  8653. limit: 10,
  8654. has(location) {
  8655. return this.lookup[location] !== void 0;
  8656. },
  8657. retrieve(location) {
  8658. let snapshot = this.lookup[location];
  8659. if (snapshot === void 0)
  8660. throw "No back button cache found for current location: " + location;
  8661. return snapshot;
  8662. },
  8663. replace(key, snapshot) {
  8664. if (this.has(key)) {
  8665. this.lookup[key] = snapshot;
  8666. } else {
  8667. this.push(key, snapshot);
  8668. }
  8669. },
  8670. push(key, snapshot) {
  8671. this.lookup[key] = snapshot;
  8672. let index = this.keys.indexOf(key);
  8673. if (index > -1)
  8674. this.keys.splice(index, 1);
  8675. this.keys.unshift(key);
  8676. this.trim();
  8677. },
  8678. trim() {
  8679. for (let key of this.keys.splice(this.limit)) {
  8680. delete this.lookup[key];
  8681. }
  8682. }
  8683. };
  8684. function updateCurrentPageHtmlInHistoryStateForLaterBackButtonClicks() {
  8685. let url = new URL(window.location.href, document.baseURI);
  8686. replaceUrl(url, document.documentElement.outerHTML);
  8687. }
  8688. function updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(key, url) {
  8689. let html = document.documentElement.outerHTML;
  8690. snapshotCache.replace(key, new Snapshot(url, html));
  8691. }
  8692. function whenTheBackOrForwardButtonIsClicked(registerFallback, handleHtml) {
  8693. let fallback2;
  8694. registerFallback((i) => fallback2 = i);
  8695. window.addEventListener("popstate", (e) => {
  8696. let state = e.state || {};
  8697. let alpine = state.alpine || {};
  8698. if (Object.keys(state).length === 0)
  8699. return;
  8700. if (!alpine.snapshotIdx)
  8701. return;
  8702. if (snapshotCache.has(alpine.snapshotIdx)) {
  8703. let snapshot = snapshotCache.retrieve(alpine.snapshotIdx);
  8704. handleHtml(snapshot.html, snapshot.url, snapshotCache.currentUrl, snapshotCache.currentKey);
  8705. } else {
  8706. fallback2(alpine.url);
  8707. }
  8708. });
  8709. }
  8710. function updateUrlAndStoreLatestHtmlForFutureBackButtons(html, destination) {
  8711. pushUrl(destination, html);
  8712. }
  8713. function pushUrl(url, html) {
  8714. updateUrl("pushState", url, html);
  8715. }
  8716. function replaceUrl(url, html) {
  8717. updateUrl("replaceState", url, html);
  8718. }
  8719. function updateUrl(method, url, html) {
  8720. let key = url.toString() + "-" + Math.random();
  8721. method === "pushState" ? snapshotCache.push(key, new Snapshot(url, html)) : snapshotCache.replace(key = snapshotCache.currentKey ?? key, new Snapshot(url, html));
  8722. let state = history.state || {};
  8723. if (!state.alpine)
  8724. state.alpine = {};
  8725. state.alpine.snapshotIdx = key;
  8726. state.alpine.url = url.toString();
  8727. try {
  8728. history[method](state, JSON.stringify(document.title), url);
  8729. snapshotCache.currentKey = key;
  8730. snapshotCache.currentUrl = url;
  8731. } catch (error2) {
  8732. if (error2 instanceof DOMException && error2.name === "SecurityError") {
  8733. console.error("Livewire: You can't use wire:navigate with a link to a different root domain: " + url);
  8734. }
  8735. console.error(error2);
  8736. }
  8737. }
  8738. // js/plugins/navigate/links.js
  8739. function whenThisLinkIsPressed(el, callback) {
  8740. let isProgrammaticClick = (e) => !e.isTrusted;
  8741. let isNotPlainLeftClick = (e) => e.which > 1 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey;
  8742. let isNotPlainEnterKey = (e) => e.which !== 13 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey;
  8743. el.addEventListener("click", (e) => {
  8744. if (isProgrammaticClick(e)) {
  8745. e.preventDefault();
  8746. callback((whenReleased) => whenReleased());
  8747. return;
  8748. }
  8749. if (isNotPlainLeftClick(e))
  8750. return;
  8751. e.preventDefault();
  8752. });
  8753. el.addEventListener("mousedown", (e) => {
  8754. if (isNotPlainLeftClick(e))
  8755. return;
  8756. e.preventDefault();
  8757. callback((whenReleased) => {
  8758. let handler = (e2) => {
  8759. e2.preventDefault();
  8760. whenReleased();
  8761. el.removeEventListener("mouseup", handler);
  8762. };
  8763. el.addEventListener("mouseup", handler);
  8764. });
  8765. });
  8766. el.addEventListener("keydown", (e) => {
  8767. if (isNotPlainEnterKey(e))
  8768. return;
  8769. e.preventDefault();
  8770. callback((whenReleased) => whenReleased());
  8771. });
  8772. }
  8773. function whenThisLinkIsHoveredFor(el, ms = 60, callback) {
  8774. el.addEventListener("mouseenter", (e) => {
  8775. let timeout = setTimeout(() => {
  8776. callback(e);
  8777. }, ms);
  8778. let handler = () => {
  8779. clearTimeout(timeout);
  8780. el.removeEventListener("mouseleave", handler);
  8781. };
  8782. el.addEventListener("mouseleave", handler);
  8783. });
  8784. }
  8785. function extractDestinationFromLink(linkEl) {
  8786. return createUrlObjectFromString(linkEl.getAttribute("href"));
  8787. }
  8788. function createUrlObjectFromString(urlString) {
  8789. return urlString !== null && new URL(urlString, document.baseURI);
  8790. }
  8791. function getUriStringFromUrlObject(urlObject) {
  8792. return urlObject.pathname + urlObject.search + urlObject.hash;
  8793. }
  8794. // js/plugins/navigate/fetch.js
  8795. function fetchHtml(destination, callback) {
  8796. let uri = getUriStringFromUrlObject(destination);
  8797. performFetch(uri, (html, finalDestination) => {
  8798. callback(html, finalDestination);
  8799. });
  8800. }
  8801. function performFetch(uri, callback) {
  8802. let options = {
  8803. headers: {
  8804. "X-Livewire-Navigate": ""
  8805. }
  8806. };
  8807. trigger("navigate.request", {
  8808. url: uri,
  8809. options
  8810. });
  8811. let finalDestination;
  8812. fetch(uri, options).then((response) => {
  8813. let destination = createUrlObjectFromString(uri);
  8814. finalDestination = createUrlObjectFromString(response.url);
  8815. if (destination.pathname + destination.search === finalDestination.pathname + finalDestination.search) {
  8816. finalDestination.hash = destination.hash;
  8817. }
  8818. return response.text();
  8819. }).then((html) => {
  8820. callback(html, finalDestination);
  8821. });
  8822. }
  8823. // js/plugins/navigate/prefetch.js
  8824. var prefetches = {};
  8825. function prefetchHtml(destination, callback) {
  8826. let uri = getUriStringFromUrlObject(destination);
  8827. if (prefetches[uri])
  8828. return;
  8829. prefetches[uri] = { finished: false, html: null, whenFinished: () => {
  8830. } };
  8831. performFetch(uri, (html, routedUri) => {
  8832. callback(html, routedUri);
  8833. });
  8834. }
  8835. function storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination) {
  8836. let state = prefetches[getUriStringFromUrlObject(destination)];
  8837. state.html = html;
  8838. state.finished = true;
  8839. state.finalDestination = finalDestination;
  8840. state.whenFinished();
  8841. }
  8842. function getPretchedHtmlOr(destination, receive, ifNoPrefetchExists) {
  8843. let uri = getUriStringFromUrlObject(destination);
  8844. if (!prefetches[uri])
  8845. return ifNoPrefetchExists();
  8846. if (prefetches[uri].finished) {
  8847. let html = prefetches[uri].html;
  8848. let finalDestination = prefetches[uri].finalDestination;
  8849. delete prefetches[uri];
  8850. return receive(html, finalDestination);
  8851. } else {
  8852. prefetches[uri].whenFinished = () => {
  8853. let html = prefetches[uri].html;
  8854. let finalDestination = prefetches[uri].finalDestination;
  8855. delete prefetches[uri];
  8856. receive(html, finalDestination);
  8857. };
  8858. }
  8859. }
  8860. // js/plugins/navigate/teleport.js
  8861. var import_alpinejs3 = __toESM(require_module_cjs());
  8862. function packUpPersistedTeleports(persistedEl) {
  8863. import_alpinejs3.default.mutateDom(() => {
  8864. persistedEl.querySelectorAll("[data-teleport-template]").forEach((i) => i._x_teleport.remove());
  8865. });
  8866. }
  8867. function removeAnyLeftOverStaleTeleportTargets(body) {
  8868. import_alpinejs3.default.mutateDom(() => {
  8869. body.querySelectorAll("[data-teleport-target]").forEach((i) => i.remove());
  8870. });
  8871. }
  8872. function unPackPersistedTeleports(persistedEl) {
  8873. import_alpinejs3.default.walk(persistedEl, (el, skip) => {
  8874. if (!el._x_teleport)
  8875. return;
  8876. el._x_teleportPutBack();
  8877. skip();
  8878. });
  8879. }
  8880. function isTeleportTarget(el) {
  8881. return el.hasAttribute("data-teleport-target");
  8882. }
  8883. // js/plugins/navigate/scroll.js
  8884. function storeScrollInformationInHtmlBeforeNavigatingAway() {
  8885. document.body.setAttribute("data-scroll-x", document.body.scrollLeft);
  8886. document.body.setAttribute("data-scroll-y", document.body.scrollTop);
  8887. document.querySelectorAll(["[x-navigate\\:scroll]", "[wire\\:scroll]"]).forEach((el) => {
  8888. el.setAttribute("data-scroll-x", el.scrollLeft);
  8889. el.setAttribute("data-scroll-y", el.scrollTop);
  8890. });
  8891. }
  8892. function restoreScrollPositionOrScrollToTop() {
  8893. let scroll = (el) => {
  8894. if (!el.hasAttribute("data-scroll-x")) {
  8895. window.scrollTo({ top: 0, left: 0, behavior: "instant" });
  8896. } else {
  8897. el.scrollTo({
  8898. top: Number(el.getAttribute("data-scroll-y")),
  8899. left: Number(el.getAttribute("data-scroll-x")),
  8900. behavior: "instant"
  8901. });
  8902. el.removeAttribute("data-scroll-x");
  8903. el.removeAttribute("data-scroll-y");
  8904. }
  8905. };
  8906. queueMicrotask(() => {
  8907. queueMicrotask(() => {
  8908. scroll(document.body);
  8909. document.querySelectorAll(["[x-navigate\\:scroll]", "[wire\\:scroll]"]).forEach(scroll);
  8910. });
  8911. });
  8912. }
  8913. // js/plugins/navigate/persist.js
  8914. var import_alpinejs4 = __toESM(require_module_cjs());
  8915. var els = {};
  8916. function storePersistantElementsForLater(callback) {
  8917. els = {};
  8918. document.querySelectorAll("[x-persist]").forEach((i) => {
  8919. els[i.getAttribute("x-persist")] = i;
  8920. callback(i);
  8921. import_alpinejs4.default.mutateDom(() => {
  8922. i.remove();
  8923. });
  8924. });
  8925. }
  8926. function putPersistantElementsBack(callback) {
  8927. let usedPersists = [];
  8928. document.querySelectorAll("[x-persist]").forEach((i) => {
  8929. let old = els[i.getAttribute("x-persist")];
  8930. if (!old)
  8931. return;
  8932. usedPersists.push(i.getAttribute("x-persist"));
  8933. old._x_wasPersisted = true;
  8934. callback(old, i);
  8935. import_alpinejs4.default.mutateDom(() => {
  8936. i.replaceWith(old);
  8937. });
  8938. });
  8939. Object.entries(els).forEach(([key, el]) => {
  8940. if (usedPersists.includes(key))
  8941. return;
  8942. import_alpinejs4.default.destroyTree(el);
  8943. });
  8944. els = {};
  8945. }
  8946. function isPersistedElement(el) {
  8947. return el.hasAttribute("x-persist");
  8948. }
  8949. // js/plugins/navigate/bar.js
  8950. var import_nprogress = __toESM(require_nprogress());
  8951. import_nprogress.default.configure({
  8952. minimum: 0.1,
  8953. trickleSpeed: 200,
  8954. showSpinner: false,
  8955. parent: "body"
  8956. });
  8957. injectStyles();
  8958. var inProgress = false;
  8959. function showAndStartProgressBar() {
  8960. inProgress = true;
  8961. setTimeout(() => {
  8962. if (!inProgress)
  8963. return;
  8964. import_nprogress.default.start();
  8965. }, 150);
  8966. }
  8967. function finishAndHideProgressBar() {
  8968. inProgress = false;
  8969. import_nprogress.default.done();
  8970. }
  8971. function removeAnyLeftOverStaleProgressBars() {
  8972. import_nprogress.default.remove();
  8973. }
  8974. function injectStyles() {
  8975. let style = document.createElement("style");
  8976. style.innerHTML = `/* Make clicks pass-through */
  8977. #nprogress {
  8978. pointer-events: none;
  8979. }
  8980. #nprogress .bar {
  8981. background: var(--livewire-progress-bar-color, #29d);
  8982. position: fixed;
  8983. z-index: 1031;
  8984. top: 0;
  8985. left: 0;
  8986. width: 100%;
  8987. height: 2px;
  8988. }
  8989. /* Fancy blur effect */
  8990. #nprogress .peg {
  8991. display: block;
  8992. position: absolute;
  8993. right: 0px;
  8994. width: 100px;
  8995. height: 100%;
  8996. box-shadow: 0 0 10px var(--livewire-progress-bar-color, #29d), 0 0 5px var(--livewire-progress-bar-color, #29d);
  8997. opacity: 1.0;
  8998. -webkit-transform: rotate(3deg) translate(0px, -4px);
  8999. -ms-transform: rotate(3deg) translate(0px, -4px);
  9000. transform: rotate(3deg) translate(0px, -4px);
  9001. }
  9002. /* Remove these to get rid of the spinner */
  9003. #nprogress .spinner {
  9004. display: block;
  9005. position: fixed;
  9006. z-index: 1031;
  9007. top: 15px;
  9008. right: 15px;
  9009. }
  9010. #nprogress .spinner-icon {
  9011. width: 18px;
  9012. height: 18px;
  9013. box-sizing: border-box;
  9014. border: solid 2px transparent;
  9015. border-top-color: var(--livewire-progress-bar-color, #29d);
  9016. border-left-color: var(--livewire-progress-bar-color, #29d);
  9017. border-radius: 50%;
  9018. -webkit-animation: nprogress-spinner 400ms linear infinite;
  9019. animation: nprogress-spinner 400ms linear infinite;
  9020. }
  9021. .nprogress-custom-parent {
  9022. overflow: hidden;
  9023. position: relative;
  9024. }
  9025. .nprogress-custom-parent #nprogress .spinner,
  9026. .nprogress-custom-parent #nprogress .bar {
  9027. position: absolute;
  9028. }
  9029. @-webkit-keyframes nprogress-spinner {
  9030. 0% { -webkit-transform: rotate(0deg); }
  9031. 100% { -webkit-transform: rotate(360deg); }
  9032. }
  9033. @keyframes nprogress-spinner {
  9034. 0% { transform: rotate(0deg); }
  9035. 100% { transform: rotate(360deg); }
  9036. }
  9037. `;
  9038. let nonce2 = getNonce();
  9039. if (nonce2)
  9040. style.nonce = nonce2;
  9041. document.head.appendChild(style);
  9042. }
  9043. // js/plugins/navigate/popover.js
  9044. function packUpPersistedPopovers(persistedEl) {
  9045. if (!isPopoverSupported())
  9046. return;
  9047. persistedEl.querySelectorAll(":popover-open").forEach((el) => {
  9048. el.setAttribute("data-navigate-popover-open", "");
  9049. let animations = el.getAnimations();
  9050. el._pausedAnimations = animations.map((animation) => ({
  9051. keyframes: animation.effect.getKeyframes(),
  9052. options: {
  9053. duration: animation.effect.getTiming().duration,
  9054. easing: animation.effect.getTiming().easing,
  9055. fill: animation.effect.getTiming().fill,
  9056. iterations: animation.effect.getTiming().iterations
  9057. },
  9058. currentTime: animation.currentTime,
  9059. playState: animation.playState
  9060. }));
  9061. animations.forEach((i) => i.pause());
  9062. });
  9063. }
  9064. function unPackPersistedPopovers(persistedEl) {
  9065. if (!isPopoverSupported())
  9066. return;
  9067. persistedEl.querySelectorAll("[data-navigate-popover-open]").forEach((el) => {
  9068. el.removeAttribute("data-navigate-popover-open");
  9069. queueMicrotask(() => {
  9070. if (!el.isConnected)
  9071. return;
  9072. el.showPopover();
  9073. el.getAnimations().forEach((i) => i.finish());
  9074. if (el._pausedAnimations) {
  9075. el._pausedAnimations.forEach(({ keyframes, options, currentTime, now, playState }) => {
  9076. let animation = el.animate(keyframes, options);
  9077. animation.currentTime = currentTime;
  9078. });
  9079. delete el._pausedAnimations;
  9080. }
  9081. });
  9082. });
  9083. }
  9084. function isPopoverSupported() {
  9085. return typeof document.createElement("div").showPopover === "function";
  9086. }
  9087. // js/plugins/navigate/page.js
  9088. var oldBodyScriptTagHashes = [];
  9089. var attributesExemptFromScriptTagHashing = [
  9090. "data-csrf",
  9091. "aria-hidden"
  9092. ];
  9093. function swapCurrentPageWithNewHtml(html, andThen) {
  9094. let newDocument = new DOMParser().parseFromString(html, "text/html");
  9095. let newHtml = newDocument.documentElement;
  9096. let newBody = document.adoptNode(newDocument.body);
  9097. let newHead = document.adoptNode(newDocument.head);
  9098. oldBodyScriptTagHashes = oldBodyScriptTagHashes.concat(Array.from(document.body.querySelectorAll("script")).map((i) => {
  9099. return simpleHash(ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing));
  9100. }));
  9101. let afterRemoteScriptsHaveLoaded = () => {
  9102. };
  9103. replaceHtmlAttributes(newHtml);
  9104. mergeNewHead(newHead).finally(() => {
  9105. afterRemoteScriptsHaveLoaded();
  9106. });
  9107. prepNewBodyScriptTagsToRun(newBody, oldBodyScriptTagHashes);
  9108. let oldBody = document.body;
  9109. document.body.replaceWith(newBody);
  9110. Alpine.destroyTree(oldBody);
  9111. andThen((i) => afterRemoteScriptsHaveLoaded = i);
  9112. }
  9113. function prepNewBodyScriptTagsToRun(newBody, oldBodyScriptTagHashes2) {
  9114. newBody.querySelectorAll("script").forEach((i) => {
  9115. if (i.hasAttribute("data-navigate-once")) {
  9116. let hash = simpleHash(ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing));
  9117. if (oldBodyScriptTagHashes2.includes(hash))
  9118. return;
  9119. }
  9120. i.replaceWith(cloneScriptTag(i));
  9121. });
  9122. }
  9123. function replaceHtmlAttributes(newHtmlElement) {
  9124. let currentHtmlElement = document.documentElement;
  9125. Array.from(newHtmlElement.attributes).forEach((attr) => {
  9126. const name = attr.name;
  9127. const value = attr.value;
  9128. if (currentHtmlElement.getAttribute(name) !== value) {
  9129. currentHtmlElement.setAttribute(name, value);
  9130. }
  9131. });
  9132. Array.from(currentHtmlElement.attributes).forEach((attr) => {
  9133. if (!newHtmlElement.hasAttribute(attr.name)) {
  9134. currentHtmlElement.removeAttribute(attr.name);
  9135. }
  9136. });
  9137. }
  9138. function mergeNewHead(newHead) {
  9139. let children = Array.from(document.head.children);
  9140. let headChildrenHtmlLookup = children.map((i) => i.outerHTML);
  9141. let garbageCollector = document.createDocumentFragment();
  9142. let touchedHeadElements = [];
  9143. let remoteScriptsPromises = [];
  9144. for (let child of Array.from(newHead.children)) {
  9145. if (isAsset(child)) {
  9146. if (!headChildrenHtmlLookup.includes(child.outerHTML)) {
  9147. if (isTracked(child)) {
  9148. if (ifTheQueryStringChangedSinceLastRequest(child, children)) {
  9149. setTimeout(() => window.location.reload());
  9150. }
  9151. }
  9152. if (isScript(child)) {
  9153. try {
  9154. remoteScriptsPromises.push(injectScriptTagAndWaitForItToFullyLoad(cloneScriptTag(child)));
  9155. } catch (error2) {
  9156. }
  9157. } else {
  9158. document.head.appendChild(child);
  9159. }
  9160. } else {
  9161. garbageCollector.appendChild(child);
  9162. }
  9163. touchedHeadElements.push(child);
  9164. }
  9165. }
  9166. for (let child of Array.from(document.head.children)) {
  9167. if (!isAsset(child))
  9168. child.remove();
  9169. }
  9170. for (let child of Array.from(newHead.children)) {
  9171. if (child.tagName.toLowerCase() === "noscript")
  9172. continue;
  9173. document.head.appendChild(child);
  9174. }
  9175. return Promise.all(remoteScriptsPromises);
  9176. }
  9177. async function injectScriptTagAndWaitForItToFullyLoad(script) {
  9178. return new Promise((resolve, reject) => {
  9179. if (script.src) {
  9180. script.onload = () => resolve();
  9181. script.onerror = () => reject();
  9182. } else {
  9183. resolve();
  9184. }
  9185. document.head.appendChild(script);
  9186. });
  9187. }
  9188. function cloneScriptTag(el) {
  9189. let script = document.createElement("script");
  9190. script.textContent = el.textContent;
  9191. script.async = el.async;
  9192. for (let attr of el.attributes) {
  9193. script.setAttribute(attr.name, attr.value);
  9194. }
  9195. return script;
  9196. }
  9197. function isTracked(el) {
  9198. return el.hasAttribute("data-navigate-track");
  9199. }
  9200. function ifTheQueryStringChangedSinceLastRequest(el, currentHeadChildren) {
  9201. let [uri, queryString] = extractUriAndQueryString(el);
  9202. return currentHeadChildren.some((child) => {
  9203. if (!isTracked(child))
  9204. return false;
  9205. let [currentUri, currentQueryString] = extractUriAndQueryString(child);
  9206. if (currentUri === uri && queryString !== currentQueryString)
  9207. return true;
  9208. });
  9209. }
  9210. function extractUriAndQueryString(el) {
  9211. let url = isScript(el) ? el.src : el.href;
  9212. return url.split("?");
  9213. }
  9214. function isAsset(el) {
  9215. return el.tagName.toLowerCase() === "link" && el.getAttribute("rel").toLowerCase() === "stylesheet" || el.tagName.toLowerCase() === "style" || el.tagName.toLowerCase() === "script";
  9216. }
  9217. function isScript(el) {
  9218. return el.tagName.toLowerCase() === "script";
  9219. }
  9220. function simpleHash(str) {
  9221. return str.split("").reduce((a, b) => {
  9222. a = (a << 5) - a + b.charCodeAt(0);
  9223. return a & a;
  9224. }, 0);
  9225. }
  9226. function ignoreAttributes(subject, attributesToRemove) {
  9227. let result = subject;
  9228. attributesToRemove.forEach((attr) => {
  9229. const regex = new RegExp(`${attr}="[^"]*"|${attr}='[^']*'`, "g");
  9230. result = result.replace(regex, "");
  9231. });
  9232. result = result.replaceAll(" ", "");
  9233. return result.trim();
  9234. }
  9235. // js/plugins/navigate/index.js
  9236. var enablePersist = true;
  9237. var showProgressBar = true;
  9238. var restoreScroll = true;
  9239. var autofocus = false;
  9240. function navigate_default(Alpine23) {
  9241. Alpine23.navigate = (url) => {
  9242. let destination = createUrlObjectFromString(url);
  9243. let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", {
  9244. url: destination,
  9245. history: false,
  9246. cached: false
  9247. });
  9248. if (prevented)
  9249. return;
  9250. navigateTo(destination);
  9251. };
  9252. Alpine23.navigate.disableProgressBar = () => {
  9253. showProgressBar = false;
  9254. };
  9255. Alpine23.addInitSelector(() => `[${Alpine23.prefixed("navigate")}]`);
  9256. Alpine23.directive("navigate", (el, { modifiers }) => {
  9257. let shouldPrefetchOnHover = modifiers.includes("hover");
  9258. shouldPrefetchOnHover && whenThisLinkIsHoveredFor(el, 60, () => {
  9259. let destination = extractDestinationFromLink(el);
  9260. if (!destination)
  9261. return;
  9262. prefetchHtml(destination, (html, finalDestination) => {
  9263. storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination);
  9264. });
  9265. });
  9266. whenThisLinkIsPressed(el, (whenItIsReleased) => {
  9267. let destination = extractDestinationFromLink(el);
  9268. if (!destination)
  9269. return;
  9270. prefetchHtml(destination, (html, finalDestination) => {
  9271. storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination);
  9272. });
  9273. whenItIsReleased(() => {
  9274. let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", {
  9275. url: destination,
  9276. history: false,
  9277. cached: false
  9278. });
  9279. if (prevented)
  9280. return;
  9281. navigateTo(destination);
  9282. });
  9283. });
  9284. });
  9285. function navigateTo(destination, shouldPushToHistoryState = true) {
  9286. showProgressBar && showAndStartProgressBar();
  9287. fetchHtmlOrUsePrefetchedHtml(destination, (html, finalDestination) => {
  9288. fireEventForOtherLibrariesToHookInto("alpine:navigating");
  9289. restoreScroll && storeScrollInformationInHtmlBeforeNavigatingAway();
  9290. showProgressBar && finishAndHideProgressBar();
  9291. cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement();
  9292. updateCurrentPageHtmlInHistoryStateForLaterBackButtonClicks();
  9293. preventAlpineFromPickingUpDomChanges(Alpine23, (andAfterAllThis) => {
  9294. enablePersist && storePersistantElementsForLater((persistedEl) => {
  9295. packUpPersistedTeleports(persistedEl);
  9296. packUpPersistedPopovers(persistedEl);
  9297. });
  9298. if (shouldPushToHistoryState) {
  9299. updateUrlAndStoreLatestHtmlForFutureBackButtons(html, finalDestination);
  9300. } else {
  9301. replaceUrl(finalDestination, html);
  9302. }
  9303. swapCurrentPageWithNewHtml(html, (afterNewScriptsAreDoneLoading) => {
  9304. removeAnyLeftOverStaleTeleportTargets(document.body);
  9305. enablePersist && putPersistantElementsBack((persistedEl, newStub) => {
  9306. unPackPersistedTeleports(persistedEl);
  9307. unPackPersistedPopovers(persistedEl);
  9308. });
  9309. restoreScrollPositionOrScrollToTop();
  9310. afterNewScriptsAreDoneLoading(() => {
  9311. andAfterAllThis(() => {
  9312. setTimeout(() => {
  9313. autofocus && autofocusElementsWithTheAutofocusAttribute();
  9314. });
  9315. nowInitializeAlpineOnTheNewPage(Alpine23);
  9316. fireEventForOtherLibrariesToHookInto("alpine:navigated");
  9317. });
  9318. });
  9319. });
  9320. });
  9321. });
  9322. }
  9323. whenTheBackOrForwardButtonIsClicked((ifThePageBeingVisitedHasntBeenCached) => {
  9324. ifThePageBeingVisitedHasntBeenCached((url) => {
  9325. let destination = createUrlObjectFromString(url);
  9326. let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", {
  9327. url: destination,
  9328. history: true,
  9329. cached: false
  9330. });
  9331. if (prevented)
  9332. return;
  9333. let shouldPushToHistoryState = false;
  9334. navigateTo(destination, shouldPushToHistoryState);
  9335. });
  9336. }, (html, url, currentPageUrl, currentPageKey) => {
  9337. let destination = createUrlObjectFromString(url);
  9338. let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", {
  9339. url: destination,
  9340. history: true,
  9341. cached: true
  9342. });
  9343. if (prevented)
  9344. return;
  9345. storeScrollInformationInHtmlBeforeNavigatingAway();
  9346. fireEventForOtherLibrariesToHookInto("alpine:navigating");
  9347. updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageUrl, currentPageKey);
  9348. preventAlpineFromPickingUpDomChanges(Alpine23, (andAfterAllThis) => {
  9349. enablePersist && storePersistantElementsForLater((persistedEl) => {
  9350. packUpPersistedTeleports(persistedEl);
  9351. packUpPersistedPopovers(persistedEl);
  9352. });
  9353. swapCurrentPageWithNewHtml(html, () => {
  9354. removeAnyLeftOverStaleProgressBars();
  9355. removeAnyLeftOverStaleTeleportTargets(document.body);
  9356. enablePersist && putPersistantElementsBack((persistedEl, newStub) => {
  9357. unPackPersistedTeleports(persistedEl);
  9358. unPackPersistedPopovers(persistedEl);
  9359. });
  9360. restoreScrollPositionOrScrollToTop();
  9361. andAfterAllThis(() => {
  9362. autofocus && autofocusElementsWithTheAutofocusAttribute();
  9363. nowInitializeAlpineOnTheNewPage(Alpine23);
  9364. fireEventForOtherLibrariesToHookInto("alpine:navigated");
  9365. });
  9366. });
  9367. });
  9368. });
  9369. setTimeout(() => {
  9370. fireEventForOtherLibrariesToHookInto("alpine:navigated");
  9371. });
  9372. }
  9373. function fetchHtmlOrUsePrefetchedHtml(fromDestination, callback) {
  9374. getPretchedHtmlOr(fromDestination, callback, () => {
  9375. fetchHtml(fromDestination, callback);
  9376. });
  9377. }
  9378. function preventAlpineFromPickingUpDomChanges(Alpine23, callback) {
  9379. Alpine23.stopObservingMutations();
  9380. callback((afterAllThis) => {
  9381. Alpine23.startObservingMutations();
  9382. queueMicrotask(() => {
  9383. afterAllThis();
  9384. });
  9385. });
  9386. }
  9387. function fireEventForOtherLibrariesToHookInto(name, detail) {
  9388. let event = new CustomEvent(name, {
  9389. cancelable: true,
  9390. bubbles: true,
  9391. detail
  9392. });
  9393. document.dispatchEvent(event);
  9394. return event.defaultPrevented;
  9395. }
  9396. function nowInitializeAlpineOnTheNewPage(Alpine23) {
  9397. Alpine23.initTree(document.body, void 0, (el, skip) => {
  9398. if (el._x_wasPersisted)
  9399. skip();
  9400. });
  9401. }
  9402. function autofocusElementsWithTheAutofocusAttribute() {
  9403. document.querySelector("[autofocus]") && document.querySelector("[autofocus]").focus();
  9404. }
  9405. function cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement() {
  9406. let walker = function(root, callback) {
  9407. Alpine.walk(root, (el, skip) => {
  9408. if (isPersistedElement(el))
  9409. skip();
  9410. if (isTeleportTarget(el))
  9411. skip();
  9412. else
  9413. callback(el, skip);
  9414. });
  9415. };
  9416. Alpine.destroyTree(document.body, walker);
  9417. }
  9418. // js/plugins/history/index.js
  9419. function history2(Alpine23) {
  9420. Alpine23.magic("queryString", (el, { interceptor }) => {
  9421. let alias;
  9422. let alwaysShow = false;
  9423. let usePush = false;
  9424. return interceptor((initialSeedValue, getter, setter, path, key) => {
  9425. let queryKey = alias || path;
  9426. let { initial, replace: replace2, push: push2, pop } = track(queryKey, initialSeedValue, alwaysShow);
  9427. setter(initial);
  9428. if (!usePush) {
  9429. Alpine23.effect(() => replace2(getter()));
  9430. } else {
  9431. Alpine23.effect(() => push2(getter()));
  9432. pop(async (newValue) => {
  9433. setter(newValue);
  9434. let tillTheEndOfTheMicrotaskQueue = () => Promise.resolve();
  9435. await tillTheEndOfTheMicrotaskQueue();
  9436. });
  9437. }
  9438. return initial;
  9439. }, (func) => {
  9440. func.alwaysShow = () => {
  9441. alwaysShow = true;
  9442. return func;
  9443. };
  9444. func.usePush = () => {
  9445. usePush = true;
  9446. return func;
  9447. };
  9448. func.as = (key) => {
  9449. alias = key;
  9450. return func;
  9451. };
  9452. });
  9453. });
  9454. Alpine23.history = { track };
  9455. }
  9456. function track(name, initialSeedValue, alwaysShow = false, except = null) {
  9457. let { has, get, set, remove } = queryStringUtils();
  9458. let url = new URL(window.location.href);
  9459. let isInitiallyPresentInUrl = has(url, name);
  9460. let initialValue = isInitiallyPresentInUrl ? get(url, name) : initialSeedValue;
  9461. let initialValueMemo = JSON.stringify(initialValue);
  9462. let exceptValueMemo = [false, null, void 0].includes(except) ? initialSeedValue : JSON.stringify(except);
  9463. let hasReturnedToInitialValue = (newValue) => JSON.stringify(newValue) === initialValueMemo;
  9464. let hasReturnedToExceptValue = (newValue) => JSON.stringify(newValue) === exceptValueMemo;
  9465. if (alwaysShow)
  9466. url = set(url, name, initialValue);
  9467. replace(url, name, { value: initialValue });
  9468. let lock = false;
  9469. let update = (strategy, newValue) => {
  9470. if (lock)
  9471. return;
  9472. let url2 = new URL(window.location.href);
  9473. if (!alwaysShow && !isInitiallyPresentInUrl && hasReturnedToInitialValue(newValue)) {
  9474. url2 = remove(url2, name);
  9475. } else if (newValue === void 0) {
  9476. url2 = remove(url2, name);
  9477. } else if (!alwaysShow && hasReturnedToExceptValue(newValue)) {
  9478. url2 = remove(url2, name);
  9479. } else {
  9480. url2 = set(url2, name, newValue);
  9481. }
  9482. strategy(url2, name, { value: newValue });
  9483. };
  9484. return {
  9485. initial: initialValue,
  9486. replace(newValue) {
  9487. update(replace, newValue);
  9488. },
  9489. push(newValue) {
  9490. update(push, newValue);
  9491. },
  9492. pop(receiver) {
  9493. let handler = (e) => {
  9494. if (!e.state || !e.state.alpine)
  9495. return;
  9496. Object.entries(e.state.alpine).forEach(([iName, { value: newValue }]) => {
  9497. if (iName !== name)
  9498. return;
  9499. lock = true;
  9500. let result = receiver(newValue);
  9501. if (result instanceof Promise) {
  9502. result.finally(() => lock = false);
  9503. } else {
  9504. lock = false;
  9505. }
  9506. });
  9507. };
  9508. window.addEventListener("popstate", handler);
  9509. return () => window.removeEventListener("popstate", handler);
  9510. }
  9511. };
  9512. }
  9513. function replace(url, key, object) {
  9514. let state = window.history.state || {};
  9515. if (!state.alpine)
  9516. state.alpine = {};
  9517. state.alpine[key] = unwrap(object);
  9518. window.history.replaceState(state, "", url.toString());
  9519. }
  9520. function push(url, key, object) {
  9521. let state = window.history.state || {};
  9522. if (!state.alpine)
  9523. state.alpine = {};
  9524. state = { alpine: { ...state.alpine, ...{ [key]: unwrap(object) } } };
  9525. window.history.pushState(state, "", url.toString());
  9526. }
  9527. function unwrap(object) {
  9528. if (object === void 0)
  9529. return void 0;
  9530. return JSON.parse(JSON.stringify(object));
  9531. }
  9532. function queryStringUtils() {
  9533. return {
  9534. has(url, key) {
  9535. let search = url.search;
  9536. if (!search)
  9537. return false;
  9538. let data = fromQueryString(search, key);
  9539. return Object.keys(data).includes(key);
  9540. },
  9541. get(url, key) {
  9542. let search = url.search;
  9543. if (!search)
  9544. return false;
  9545. let data = fromQueryString(search, key);
  9546. return data[key];
  9547. },
  9548. set(url, key, value) {
  9549. let data = fromQueryString(url.search, key);
  9550. data[key] = stripNulls(unwrap(value));
  9551. url.search = toQueryString(data);
  9552. return url;
  9553. },
  9554. remove(url, key) {
  9555. let data = fromQueryString(url.search, key);
  9556. delete data[key];
  9557. url.search = toQueryString(data);
  9558. return url;
  9559. }
  9560. };
  9561. }
  9562. function stripNulls(value) {
  9563. if (!isObjecty(value))
  9564. return value;
  9565. for (let key in value) {
  9566. if (value[key] === null)
  9567. delete value[key];
  9568. else
  9569. value[key] = stripNulls(value[key]);
  9570. }
  9571. return value;
  9572. }
  9573. function toQueryString(data) {
  9574. let isObjecty2 = (subject) => typeof subject === "object" && subject !== null;
  9575. let buildQueryStringEntries = (data2, entries2 = {}, baseKey = "") => {
  9576. Object.entries(data2).forEach(([iKey, iValue]) => {
  9577. let key = baseKey === "" ? iKey : `${baseKey}[${iKey}]`;
  9578. if (iValue === null) {
  9579. entries2[key] = "";
  9580. } else if (!isObjecty2(iValue)) {
  9581. entries2[key] = encodeURIComponent(iValue).replaceAll("%20", "+").replaceAll("%2C", ",");
  9582. } else {
  9583. entries2 = { ...entries2, ...buildQueryStringEntries(iValue, entries2, key) };
  9584. }
  9585. });
  9586. return entries2;
  9587. };
  9588. let entries = buildQueryStringEntries(data);
  9589. return Object.entries(entries).map(([key, value]) => `${key}=${value}`).join("&");
  9590. }
  9591. function fromQueryString(search, queryKey) {
  9592. search = search.replace("?", "");
  9593. if (search === "")
  9594. return {};
  9595. let insertDotNotatedValueIntoData = (key, value, data2) => {
  9596. let [first2, second, ...rest] = key.split(".");
  9597. if (!second)
  9598. return data2[key] = value;
  9599. if (data2[first2] === void 0) {
  9600. data2[first2] = isNaN(second) ? {} : [];
  9601. }
  9602. insertDotNotatedValueIntoData([second, ...rest].join("."), value, data2[first2]);
  9603. };
  9604. let entries = search.split("&").map((i) => i.split("="));
  9605. let data = /* @__PURE__ */ Object.create(null);
  9606. entries.forEach(([key, value]) => {
  9607. if (typeof value == "undefined")
  9608. return;
  9609. value = decodeURIComponent(value.replaceAll("+", "%20"));
  9610. let decodedKey = decodeURIComponent(key);
  9611. let shouldBeHandledAsArray = decodedKey.includes("[") && decodedKey.startsWith(queryKey);
  9612. if (!shouldBeHandledAsArray) {
  9613. data[key] = value;
  9614. } else {
  9615. let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", "");
  9616. insertDotNotatedValueIntoData(dotNotatedKey, value, data);
  9617. }
  9618. });
  9619. return data;
  9620. }
  9621. // js/lifecycle.js
  9622. var import_morph = __toESM(require_module_cjs8());
  9623. var import_mask = __toESM(require_module_cjs9());
  9624. var import_alpinejs5 = __toESM(require_module_cjs());
  9625. function start() {
  9626. setTimeout(() => ensureLivewireScriptIsntMisplaced());
  9627. dispatch(document, "livewire:init");
  9628. dispatch(document, "livewire:initializing");
  9629. import_alpinejs5.default.plugin(import_morph.default);
  9630. import_alpinejs5.default.plugin(history2);
  9631. import_alpinejs5.default.plugin(import_intersect.default);
  9632. import_alpinejs5.default.plugin(import_resize.default);
  9633. import_alpinejs5.default.plugin(import_collapse.default);
  9634. import_alpinejs5.default.plugin(import_anchor.default);
  9635. import_alpinejs5.default.plugin(import_focus.default);
  9636. import_alpinejs5.default.plugin(import_persist2.default);
  9637. import_alpinejs5.default.plugin(navigate_default);
  9638. import_alpinejs5.default.plugin(import_mask.default);
  9639. import_alpinejs5.default.addRootSelector(() => "[wire\\:id]");
  9640. import_alpinejs5.default.onAttributesAdded((el, attributes) => {
  9641. if (!Array.from(attributes).some((attribute) => matchesForLivewireDirective(attribute.name)))
  9642. return;
  9643. let component = closestComponent(el, false);
  9644. if (!component)
  9645. return;
  9646. attributes.forEach((attribute) => {
  9647. if (!matchesForLivewireDirective(attribute.name))
  9648. return;
  9649. let directive2 = extractDirective(el, attribute.name);
  9650. trigger("directive.init", { el, component, directive: directive2, cleanup: (callback) => {
  9651. import_alpinejs5.default.onAttributeRemoved(el, directive2.raw, callback);
  9652. } });
  9653. });
  9654. });
  9655. import_alpinejs5.default.interceptInit(import_alpinejs5.default.skipDuringClone((el) => {
  9656. if (!Array.from(el.attributes).some((attribute) => matchesForLivewireDirective(attribute.name)))
  9657. return;
  9658. if (el.hasAttribute("wire:id")) {
  9659. let component2 = initComponent(el);
  9660. import_alpinejs5.default.onAttributeRemoved(el, "wire:id", () => {
  9661. destroyComponent(component2.id);
  9662. });
  9663. }
  9664. let directives = Array.from(el.getAttributeNames()).filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(el, name));
  9665. directives.forEach((directive2) => {
  9666. trigger("directive.global.init", { el, directive: directive2, cleanup: (callback) => {
  9667. import_alpinejs5.default.onAttributeRemoved(el, directive2.raw, callback);
  9668. } });
  9669. });
  9670. let component = closestComponent(el, false);
  9671. if (component) {
  9672. trigger("element.init", { el, component });
  9673. directives.forEach((directive2) => {
  9674. trigger("directive.init", { el, component, directive: directive2, cleanup: (callback) => {
  9675. import_alpinejs5.default.onAttributeRemoved(el, directive2.raw, callback);
  9676. } });
  9677. });
  9678. }
  9679. }));
  9680. import_alpinejs5.default.start();
  9681. setTimeout(() => window.Livewire.initialRenderIsFinished = true);
  9682. dispatch(document, "livewire:initialized");
  9683. }
  9684. function ensureLivewireScriptIsntMisplaced() {
  9685. let el = document.querySelector("script[data-update-uri][data-csrf]");
  9686. if (!el)
  9687. return;
  9688. let livewireEl = el.closest("[wire\\:id]");
  9689. if (livewireEl) {
  9690. console.warn("Livewire: missing closing tags found. Ensure your template elements contain matching closing tags.", livewireEl);
  9691. }
  9692. }
  9693. // js/index.js
  9694. var import_alpinejs21 = __toESM(require_module_cjs());
  9695. // js/features/supportListeners.js
  9696. on("effect", ({ component, effects }) => {
  9697. registerListeners(component, effects.listeners || []);
  9698. });
  9699. function registerListeners(component, listeners2) {
  9700. listeners2.forEach((name) => {
  9701. let handler = (e) => {
  9702. if (e.__livewire)
  9703. e.__livewire.receivedBy.push(component);
  9704. component.$wire.call("__dispatch", name, e.detail || {});
  9705. };
  9706. window.addEventListener(name, handler);
  9707. component.addCleanup(() => window.removeEventListener(name, handler));
  9708. component.el.addEventListener(name, (e) => {
  9709. if (!e.__livewire)
  9710. return;
  9711. if (e.bubbles)
  9712. return;
  9713. if (e.__livewire)
  9714. e.__livewire.receivedBy.push(component.id);
  9715. component.$wire.call("__dispatch", name, e.detail || {});
  9716. });
  9717. });
  9718. }
  9719. // js/features/supportScriptsAndAssets.js
  9720. var import_alpinejs6 = __toESM(require_module_cjs());
  9721. var executedScripts = /* @__PURE__ */ new WeakMap();
  9722. var executedAssets = /* @__PURE__ */ new Set();
  9723. on("payload.intercept", async ({ assets }) => {
  9724. if (!assets)
  9725. return;
  9726. for (let [key, asset] of Object.entries(assets)) {
  9727. await onlyIfAssetsHaventBeenLoadedAlreadyOnThisPage(key, async () => {
  9728. await addAssetsToHeadTagOfPage(asset);
  9729. });
  9730. }
  9731. });
  9732. on("component.init", ({ component }) => {
  9733. let assets = component.snapshot.memo.assets;
  9734. if (assets) {
  9735. assets.forEach((key) => {
  9736. if (executedAssets.has(key))
  9737. return;
  9738. executedAssets.add(key);
  9739. });
  9740. }
  9741. });
  9742. on("effect", ({ component, effects }) => {
  9743. let scripts = effects.scripts;
  9744. if (scripts) {
  9745. Object.entries(scripts).forEach(([key, content]) => {
  9746. onlyIfScriptHasntBeenRunAlreadyForThisComponent(component, key, () => {
  9747. let scriptContent = extractScriptTagContent(content);
  9748. import_alpinejs6.default.dontAutoEvaluateFunctions(() => {
  9749. import_alpinejs6.default.evaluate(component.el, scriptContent, { "$wire": component.$wire, "$js": component.$wire.$js });
  9750. });
  9751. });
  9752. });
  9753. }
  9754. });
  9755. function onlyIfScriptHasntBeenRunAlreadyForThisComponent(component, key, callback) {
  9756. if (executedScripts.has(component)) {
  9757. let alreadyRunKeys2 = executedScripts.get(component);
  9758. if (alreadyRunKeys2.includes(key))
  9759. return;
  9760. }
  9761. callback();
  9762. if (!executedScripts.has(component))
  9763. executedScripts.set(component, []);
  9764. let alreadyRunKeys = executedScripts.get(component);
  9765. alreadyRunKeys.push(key);
  9766. executedScripts.set(component, alreadyRunKeys);
  9767. }
  9768. function extractScriptTagContent(rawHtml) {
  9769. let scriptRegex = /<script\b[^>]*>([\s\S]*?)<\/script>/gm;
  9770. let matches = scriptRegex.exec(rawHtml);
  9771. let innards = matches && matches[1] ? matches[1].trim() : "";
  9772. return innards;
  9773. }
  9774. async function onlyIfAssetsHaventBeenLoadedAlreadyOnThisPage(key, callback) {
  9775. if (executedAssets.has(key))
  9776. return;
  9777. await callback();
  9778. executedAssets.add(key);
  9779. }
  9780. async function addAssetsToHeadTagOfPage(rawHtml) {
  9781. let newDocument = new DOMParser().parseFromString(rawHtml, "text/html");
  9782. let newHead = document.adoptNode(newDocument.head);
  9783. for (let child of newHead.children) {
  9784. try {
  9785. await runAssetSynchronously(child);
  9786. } catch (error2) {
  9787. }
  9788. }
  9789. }
  9790. async function runAssetSynchronously(child) {
  9791. return new Promise((resolve, reject) => {
  9792. if (isScript2(child)) {
  9793. let script = cloneScriptTag2(child);
  9794. if (script.src) {
  9795. script.onload = () => resolve();
  9796. script.onerror = () => reject();
  9797. } else {
  9798. resolve();
  9799. }
  9800. document.head.appendChild(script);
  9801. } else {
  9802. document.head.appendChild(child);
  9803. resolve();
  9804. }
  9805. });
  9806. }
  9807. function isScript2(el) {
  9808. return el.tagName.toLowerCase() === "script";
  9809. }
  9810. function cloneScriptTag2(el) {
  9811. let script = document.createElement("script");
  9812. script.textContent = el.textContent;
  9813. script.async = el.async;
  9814. for (let attr of el.attributes) {
  9815. script.setAttribute(attr.name, attr.value);
  9816. }
  9817. return script;
  9818. }
  9819. // js/features/supportJsEvaluation.js
  9820. var import_alpinejs7 = __toESM(require_module_cjs());
  9821. import_alpinejs7.default.magic("js", (el) => {
  9822. let component = closestComponent(el);
  9823. return component.$wire.js;
  9824. });
  9825. on("effect", ({ component, effects }) => {
  9826. let js = effects.js;
  9827. let xjs = effects.xjs;
  9828. if (js) {
  9829. Object.entries(js).forEach(([method, body]) => {
  9830. overrideMethod(component, method, () => {
  9831. import_alpinejs7.default.evaluate(component.el, body);
  9832. });
  9833. });
  9834. }
  9835. if (xjs) {
  9836. xjs.forEach(({ expression, params }) => {
  9837. params = Object.values(params);
  9838. import_alpinejs7.default.evaluate(component.el, expression, { scope: component.jsActions, params });
  9839. });
  9840. }
  9841. });
  9842. // js/morph.js
  9843. var import_alpinejs8 = __toESM(require_module_cjs());
  9844. function morph2(component, el, html) {
  9845. let wrapperTag = el.parentElement ? el.parentElement.tagName.toLowerCase() : "div";
  9846. let wrapper = document.createElement(wrapperTag);
  9847. wrapper.innerHTML = html;
  9848. let parentComponent;
  9849. try {
  9850. parentComponent = closestComponent(el.parentElement);
  9851. } catch (e) {
  9852. }
  9853. parentComponent && (wrapper.__livewire = parentComponent);
  9854. let to = wrapper.firstElementChild;
  9855. to.__livewire = component;
  9856. trigger("morph", { el, toEl: to, component });
  9857. import_alpinejs8.default.morph(el, to, {
  9858. updating: (el2, toEl, childrenOnly, skip, skipChildren) => {
  9859. if (isntElement(el2))
  9860. return;
  9861. trigger("morph.updating", { el: el2, toEl, component, skip, childrenOnly, skipChildren });
  9862. if (el2.__livewire_replace === true)
  9863. el2.innerHTML = toEl.innerHTML;
  9864. if (el2.__livewire_replace_self === true) {
  9865. el2.outerHTML = toEl.outerHTML;
  9866. return skip();
  9867. }
  9868. if (el2.__livewire_ignore === true)
  9869. return skip();
  9870. if (el2.__livewire_ignore_self === true)
  9871. childrenOnly();
  9872. if (el2.__livewire_ignore_children === true)
  9873. return skipChildren();
  9874. if (isComponentRootEl(el2) && el2.getAttribute("wire:id") !== component.id)
  9875. return skip();
  9876. if (isComponentRootEl(el2))
  9877. toEl.__livewire = component;
  9878. },
  9879. updated: (el2) => {
  9880. if (isntElement(el2))
  9881. return;
  9882. trigger("morph.updated", { el: el2, component });
  9883. },
  9884. removing: (el2, skip) => {
  9885. if (isntElement(el2))
  9886. return;
  9887. trigger("morph.removing", { el: el2, component, skip });
  9888. },
  9889. removed: (el2) => {
  9890. if (isntElement(el2))
  9891. return;
  9892. trigger("morph.removed", { el: el2, component });
  9893. },
  9894. adding: (el2) => {
  9895. trigger("morph.adding", { el: el2, component });
  9896. },
  9897. added: (el2) => {
  9898. if (isntElement(el2))
  9899. return;
  9900. const closestComponentId = closestComponent(el2).id;
  9901. trigger("morph.added", { el: el2 });
  9902. },
  9903. key: (el2) => {
  9904. if (isntElement(el2))
  9905. return;
  9906. return el2.hasAttribute(`wire:key`) ? el2.getAttribute(`wire:key`) : el2.hasAttribute(`wire:id`) ? el2.getAttribute(`wire:id`) : el2.id;
  9907. },
  9908. lookahead: false
  9909. });
  9910. trigger("morphed", { el, component });
  9911. }
  9912. function isntElement(el) {
  9913. return typeof el.hasAttribute !== "function";
  9914. }
  9915. function isComponentRootEl(el) {
  9916. return el.hasAttribute("wire:id");
  9917. }
  9918. // js/features/supportMorphDom.js
  9919. on("effect", ({ component, effects }) => {
  9920. let html = effects.html;
  9921. if (!html)
  9922. return;
  9923. queueMicrotask(() => {
  9924. queueMicrotask(() => {
  9925. morph2(component, component.el, html);
  9926. });
  9927. });
  9928. });
  9929. // js/features/supportDispatches.js
  9930. on("effect", ({ component, effects }) => {
  9931. dispatchEvents(component, effects.dispatches || []);
  9932. });
  9933. function dispatchEvents(component, dispatches) {
  9934. dispatches.forEach(({ name, params = {}, self: self2 = false, to }) => {
  9935. if (self2)
  9936. dispatchSelf(component, name, params);
  9937. else if (to)
  9938. dispatchTo(to, name, params);
  9939. else
  9940. dispatch2(component, name, params);
  9941. });
  9942. }
  9943. // js/features/supportDisablingFormsDuringRequest.js
  9944. var import_alpinejs9 = __toESM(require_module_cjs());
  9945. var cleanups = new Bag();
  9946. on("directive.init", ({ el, directive: directive2, cleanup, component }) => setTimeout(() => {
  9947. if (directive2.value !== "submit")
  9948. return;
  9949. el.addEventListener("submit", () => {
  9950. let componentId = directive2.expression.startsWith("$parent") ? component.parent.id : component.id;
  9951. let cleanup2 = disableForm(el);
  9952. cleanups.add(componentId, cleanup2);
  9953. });
  9954. }));
  9955. on("commit", ({ component, respond }) => {
  9956. respond(() => {
  9957. cleanups.each(component.id, (i) => i());
  9958. cleanups.remove(component.id);
  9959. });
  9960. });
  9961. function disableForm(formEl) {
  9962. let undos = [];
  9963. import_alpinejs9.default.walk(formEl, (el, skip) => {
  9964. if (!formEl.contains(el))
  9965. return;
  9966. if (el.hasAttribute("wire:ignore"))
  9967. return skip();
  9968. if (shouldMarkDisabled(el)) {
  9969. undos.push(markDisabled(el));
  9970. } else if (shouldMarkReadOnly(el)) {
  9971. undos.push(markReadOnly(el));
  9972. }
  9973. });
  9974. return () => {
  9975. while (undos.length > 0)
  9976. undos.shift()();
  9977. };
  9978. }
  9979. function shouldMarkDisabled(el) {
  9980. let tag = el.tagName.toLowerCase();
  9981. if (tag === "select")
  9982. return true;
  9983. if (tag === "button" && el.type === "submit")
  9984. return true;
  9985. if (tag === "input" && (el.type === "checkbox" || el.type === "radio"))
  9986. return true;
  9987. return false;
  9988. }
  9989. function shouldMarkReadOnly(el) {
  9990. return ["input", "textarea"].includes(el.tagName.toLowerCase());
  9991. }
  9992. function markDisabled(el) {
  9993. let undo = el.disabled ? () => {
  9994. } : () => el.disabled = false;
  9995. el.disabled = true;
  9996. return undo;
  9997. }
  9998. function markReadOnly(el) {
  9999. let undo = el.readOnly ? () => {
  10000. } : () => el.readOnly = false;
  10001. el.readOnly = true;
  10002. return undo;
  10003. }
  10004. // js/features/supportPropsAndModelables.js
  10005. on("commit.pooling", ({ commits }) => {
  10006. commits.forEach((commit) => {
  10007. let component = commit.component;
  10008. getDeepChildrenWithBindings(component, (child) => {
  10009. child.$wire.$commit();
  10010. });
  10011. });
  10012. });
  10013. on("commit.pooled", ({ pools }) => {
  10014. let commits = getPooledCommits(pools);
  10015. commits.forEach((commit) => {
  10016. let component = commit.component;
  10017. getDeepChildrenWithBindings(component, (child) => {
  10018. colocateCommitsByComponent(pools, component, child);
  10019. });
  10020. });
  10021. });
  10022. function getPooledCommits(pools) {
  10023. let commits = [];
  10024. pools.forEach((pool) => {
  10025. pool.commits.forEach((commit) => {
  10026. commits.push(commit);
  10027. });
  10028. });
  10029. return commits;
  10030. }
  10031. function colocateCommitsByComponent(pools, component, foreignComponent) {
  10032. let pool = findPoolWithComponent(pools, component);
  10033. let foreignPool = findPoolWithComponent(pools, foreignComponent);
  10034. let foreignCommit = foreignPool.findCommitByComponent(foreignComponent);
  10035. foreignPool.delete(foreignCommit);
  10036. pool.add(foreignCommit);
  10037. pools.forEach((pool2) => {
  10038. if (pool2.empty())
  10039. pools.delete(pool2);
  10040. });
  10041. }
  10042. function findPoolWithComponent(pools, component) {
  10043. for (let [idx, pool] of pools.entries()) {
  10044. if (pool.hasCommitFor(component))
  10045. return pool;
  10046. }
  10047. }
  10048. function getDeepChildrenWithBindings(component, callback) {
  10049. getDeepChildren(component, (child) => {
  10050. if (hasReactiveProps(child) || hasWireModelableBindings(child)) {
  10051. callback(child);
  10052. }
  10053. });
  10054. }
  10055. function hasReactiveProps(component) {
  10056. let meta = component.snapshot.memo;
  10057. let props = meta.props;
  10058. return !!props;
  10059. }
  10060. function hasWireModelableBindings(component) {
  10061. let meta = component.snapshot.memo;
  10062. let bindings = meta.bindings;
  10063. return !!bindings;
  10064. }
  10065. function getDeepChildren(component, callback) {
  10066. component.children.forEach((child) => {
  10067. callback(child);
  10068. getDeepChildren(child, callback);
  10069. });
  10070. }
  10071. // js/features/supportFileDownloads.js
  10072. on("commit", ({ succeed }) => {
  10073. succeed(({ effects }) => {
  10074. let download = effects.download;
  10075. if (!download)
  10076. return;
  10077. let urlObject = window.webkitURL || window.URL;
  10078. let url = urlObject.createObjectURL(base64toBlob(download.content, download.contentType));
  10079. let invisibleLink = document.createElement("a");
  10080. invisibleLink.style.display = "none";
  10081. invisibleLink.href = url;
  10082. invisibleLink.download = download.name;
  10083. document.body.appendChild(invisibleLink);
  10084. invisibleLink.click();
  10085. setTimeout(function() {
  10086. urlObject.revokeObjectURL(url);
  10087. }, 0);
  10088. });
  10089. });
  10090. function base64toBlob(b64Data, contentType = "", sliceSize = 512) {
  10091. const byteCharacters = atob(b64Data);
  10092. const byteArrays = [];
  10093. if (contentType === null)
  10094. contentType = "";
  10095. for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
  10096. let slice = byteCharacters.slice(offset, offset + sliceSize);
  10097. let byteNumbers = new Array(slice.length);
  10098. for (let i = 0; i < slice.length; i++) {
  10099. byteNumbers[i] = slice.charCodeAt(i);
  10100. }
  10101. let byteArray = new Uint8Array(byteNumbers);
  10102. byteArrays.push(byteArray);
  10103. }
  10104. return new Blob(byteArrays, { type: contentType });
  10105. }
  10106. // js/features/supportLazyLoading.js
  10107. var componentsThatWantToBeBundled = /* @__PURE__ */ new WeakSet();
  10108. var componentsThatAreLazy = /* @__PURE__ */ new WeakSet();
  10109. on("component.init", ({ component }) => {
  10110. let memo = component.snapshot.memo;
  10111. if (memo.lazyLoaded === void 0)
  10112. return;
  10113. componentsThatAreLazy.add(component);
  10114. if (memo.lazyIsolated !== void 0 && memo.lazyIsolated === false) {
  10115. componentsThatWantToBeBundled.add(component);
  10116. }
  10117. });
  10118. on("commit.pooling", ({ commits }) => {
  10119. commits.forEach((commit) => {
  10120. if (!componentsThatAreLazy.has(commit.component))
  10121. return;
  10122. if (componentsThatWantToBeBundled.has(commit.component)) {
  10123. commit.isolate = false;
  10124. componentsThatWantToBeBundled.delete(commit.component);
  10125. } else {
  10126. commit.isolate = true;
  10127. }
  10128. componentsThatAreLazy.delete(commit.component);
  10129. });
  10130. });
  10131. // js/features/supportQueryString.js
  10132. var import_alpinejs10 = __toESM(require_module_cjs());
  10133. on("effect", ({ component, effects, cleanup }) => {
  10134. let queryString = effects["url"];
  10135. if (!queryString)
  10136. return;
  10137. Object.entries(queryString).forEach(([key, value]) => {
  10138. let { name, as, use, alwaysShow, except } = normalizeQueryStringEntry(key, value);
  10139. if (!as)
  10140. as = name;
  10141. let initialValue = [false, null, void 0].includes(except) ? dataGet(component.ephemeral, name) : except;
  10142. let { replace: replace2, push: push2, pop } = track(as, initialValue, alwaysShow, except);
  10143. if (use === "replace") {
  10144. let effectReference = import_alpinejs10.default.effect(() => {
  10145. replace2(dataGet(component.reactive, name));
  10146. });
  10147. cleanup(() => import_alpinejs10.default.release(effectReference));
  10148. } else if (use === "push") {
  10149. let forgetCommitHandler = on("commit", ({ component: commitComponent, succeed }) => {
  10150. if (component !== commitComponent)
  10151. return;
  10152. let beforeValue = dataGet(component.canonical, name);
  10153. succeed(() => {
  10154. let afterValue = dataGet(component.canonical, name);
  10155. if (JSON.stringify(beforeValue) === JSON.stringify(afterValue))
  10156. return;
  10157. push2(afterValue);
  10158. });
  10159. });
  10160. let forgetPopHandler = pop(async (newValue) => {
  10161. await component.$wire.set(name, newValue);
  10162. document.querySelectorAll("input").forEach((el) => {
  10163. el._x_forceModelUpdate && el._x_forceModelUpdate(el._x_model.get());
  10164. });
  10165. });
  10166. cleanup(() => {
  10167. forgetCommitHandler();
  10168. forgetPopHandler();
  10169. });
  10170. }
  10171. });
  10172. });
  10173. function normalizeQueryStringEntry(key, value) {
  10174. let defaults = { use: "replace", alwaysShow: false };
  10175. if (typeof value === "string") {
  10176. return { ...defaults, name: value, as: value };
  10177. } else {
  10178. let fullerDefaults = { ...defaults, name: key, as: key };
  10179. return { ...fullerDefaults, ...value };
  10180. }
  10181. }
  10182. // js/features/supportLaravelEcho.js
  10183. on("request", ({ options }) => {
  10184. if (window.Echo) {
  10185. options.headers["X-Socket-ID"] = window.Echo.socketId();
  10186. }
  10187. });
  10188. on("effect", ({ component, effects }) => {
  10189. let listeners2 = effects.listeners || [];
  10190. listeners2.forEach((event) => {
  10191. if (event.startsWith("echo")) {
  10192. if (typeof window.Echo === "undefined") {
  10193. console.warn("Laravel Echo cannot be found");
  10194. return;
  10195. }
  10196. let event_parts = event.split(/(echo:|echo-)|:|,/);
  10197. if (event_parts[1] == "echo:") {
  10198. event_parts.splice(2, 0, "channel", void 0);
  10199. }
  10200. if (event_parts[2] == "notification") {
  10201. event_parts.push(void 0, void 0);
  10202. }
  10203. let [
  10204. s1,
  10205. signature,
  10206. channel_type,
  10207. s2,
  10208. channel,
  10209. s3,
  10210. event_name
  10211. ] = event_parts;
  10212. if (["channel", "private", "encryptedPrivate"].includes(channel_type)) {
  10213. let handler = (e) => dispatchSelf(component, event, [e]);
  10214. window.Echo[channel_type](channel).listen(event_name, handler);
  10215. component.addCleanup(() => {
  10216. window.Echo[channel_type](channel).stopListening(event_name, handler);
  10217. });
  10218. } else if (channel_type == "presence") {
  10219. if (["here", "joining", "leaving"].includes(event_name)) {
  10220. window.Echo.join(channel)[event_name]((e) => {
  10221. dispatchSelf(component, event, [e]);
  10222. });
  10223. } else {
  10224. let handler = (e) => dispatchSelf(component, event, [e]);
  10225. window.Echo.join(channel).listen(event_name, handler);
  10226. component.addCleanup(() => {
  10227. window.Echo.leaveChannel(channel);
  10228. });
  10229. }
  10230. } else if (channel_type == "notification") {
  10231. window.Echo.private(channel).notification((notification) => {
  10232. dispatchSelf(component, event, [notification]);
  10233. });
  10234. } else {
  10235. console.warn("Echo channel type not yet supported");
  10236. }
  10237. }
  10238. });
  10239. });
  10240. // js/features/supportIsolating.js
  10241. var componentsThatAreIsolated = /* @__PURE__ */ new WeakSet();
  10242. on("component.init", ({ component }) => {
  10243. let memo = component.snapshot.memo;
  10244. if (memo.isolate !== true)
  10245. return;
  10246. componentsThatAreIsolated.add(component);
  10247. });
  10248. on("commit.pooling", ({ commits }) => {
  10249. commits.forEach((commit) => {
  10250. if (!componentsThatAreIsolated.has(commit.component))
  10251. return;
  10252. commit.isolate = true;
  10253. });
  10254. });
  10255. // js/features/supportNavigate.js
  10256. shouldHideProgressBar() && Alpine.navigate.disableProgressBar();
  10257. document.addEventListener("alpine:navigate", (e) => forwardEvent("livewire:navigate", e));
  10258. document.addEventListener("alpine:navigating", (e) => forwardEvent("livewire:navigating", e));
  10259. document.addEventListener("alpine:navigated", (e) => forwardEvent("livewire:navigated", e));
  10260. function forwardEvent(name, original) {
  10261. let event = new CustomEvent(name, { cancelable: true, bubbles: true, detail: original.detail });
  10262. document.dispatchEvent(event);
  10263. if (event.defaultPrevented) {
  10264. original.preventDefault();
  10265. }
  10266. }
  10267. function shouldRedirectUsingNavigateOr(effects, url, or) {
  10268. let forceNavigate = effects.redirectUsingNavigate;
  10269. if (forceNavigate) {
  10270. Alpine.navigate(url);
  10271. } else {
  10272. or();
  10273. }
  10274. }
  10275. function shouldHideProgressBar() {
  10276. if (!!document.querySelector("[data-no-progress-bar]"))
  10277. return true;
  10278. if (window.livewireScriptConfig && window.livewireScriptConfig.progressBar === false)
  10279. return true;
  10280. return false;
  10281. }
  10282. // js/features/supportRedirects.js
  10283. on("effect", ({ effects }) => {
  10284. if (!effects["redirect"])
  10285. return;
  10286. let url = effects["redirect"];
  10287. shouldRedirectUsingNavigateOr(effects, url, () => {
  10288. window.location.href = url;
  10289. });
  10290. });
  10291. // js/directives/wire-transition.js
  10292. var import_alpinejs11 = __toESM(require_module_cjs());
  10293. on("morph.added", ({ el }) => {
  10294. el.__addedByMorph = true;
  10295. });
  10296. directive("transition", ({ el, directive: directive2, component, cleanup }) => {
  10297. for (let i = 0; i < el.attributes.length; i++) {
  10298. if (el.attributes[i].name.startsWith("wire:show")) {
  10299. import_alpinejs11.default.bind(el, {
  10300. [directive2.rawName.replace("wire:transition", "x-transition")]: directive2.expression
  10301. });
  10302. return;
  10303. }
  10304. }
  10305. let visibility = import_alpinejs11.default.reactive({ state: el.__addedByMorph ? false : true });
  10306. import_alpinejs11.default.bind(el, {
  10307. [directive2.rawName.replace("wire:", "x-")]: "",
  10308. "x-show"() {
  10309. return visibility.state;
  10310. }
  10311. });
  10312. el.__addedByMorph && setTimeout(() => visibility.state = true);
  10313. let cleanups2 = [];
  10314. cleanups2.push(on("morph.removing", ({ el: el2, skip }) => {
  10315. skip();
  10316. el2.addEventListener("transitionend", () => {
  10317. el2.remove();
  10318. });
  10319. visibility.state = false;
  10320. cleanups2.push(on("morph", ({ component: morphComponent }) => {
  10321. if (morphComponent !== component)
  10322. return;
  10323. el2.remove();
  10324. cleanups2.forEach((i) => i());
  10325. }));
  10326. }));
  10327. cleanup(() => cleanups2.forEach((i) => i()));
  10328. });
  10329. // js/debounce.js
  10330. var callbacksByComponent = new WeakBag();
  10331. function callAndClearComponentDebounces(component, callback) {
  10332. callbacksByComponent.each(component, (callbackRegister) => {
  10333. callbackRegister.callback();
  10334. callbackRegister.callback = () => {
  10335. };
  10336. });
  10337. callback();
  10338. }
  10339. // js/directives/wire-wildcard.js
  10340. var import_alpinejs12 = __toESM(require_module_cjs());
  10341. on("directive.init", ({ el, directive: directive2, cleanup, component }) => {
  10342. if (["snapshot", "effects", "model", "init", "loading", "poll", "ignore", "id", "data", "key", "target", "dirty"].includes(directive2.value))
  10343. return;
  10344. if (customDirectiveHasBeenRegistered(directive2.value))
  10345. return;
  10346. let attribute = directive2.rawName.replace("wire:", "x-on:");
  10347. if (directive2.value === "submit" && !directive2.modifiers.includes("prevent")) {
  10348. attribute = attribute + ".prevent";
  10349. }
  10350. let cleanupBinding = import_alpinejs12.default.bind(el, {
  10351. [attribute](e) {
  10352. let execute = () => {
  10353. callAndClearComponentDebounces(component, () => {
  10354. import_alpinejs12.default.evaluate(el, "$wire." + directive2.expression, { scope: { $event: e } });
  10355. });
  10356. };
  10357. if (el.__livewire_confirm) {
  10358. el.__livewire_confirm(() => {
  10359. execute();
  10360. }, () => {
  10361. e.stopImmediatePropagation();
  10362. });
  10363. } else {
  10364. execute();
  10365. }
  10366. }
  10367. });
  10368. cleanup(cleanupBinding);
  10369. });
  10370. // js/directives/wire-navigate.js
  10371. var import_alpinejs13 = __toESM(require_module_cjs());
  10372. import_alpinejs13.default.addInitSelector(() => `[wire\\:navigate]`);
  10373. import_alpinejs13.default.addInitSelector(() => `[wire\\:navigate\\.hover]`);
  10374. import_alpinejs13.default.interceptInit(import_alpinejs13.default.skipDuringClone((el) => {
  10375. if (el.hasAttribute("wire:navigate")) {
  10376. import_alpinejs13.default.bind(el, { ["x-navigate"]: true });
  10377. } else if (el.hasAttribute("wire:navigate.hover")) {
  10378. import_alpinejs13.default.bind(el, { ["x-navigate.hover"]: true });
  10379. }
  10380. }));
  10381. document.addEventListener("alpine:navigating", () => {
  10382. Livewire.all().forEach((component) => {
  10383. component.inscribeSnapshotAndEffectsOnElement();
  10384. });
  10385. });
  10386. // js/directives/wire-confirm.js
  10387. directive("confirm", ({ el, directive: directive2 }) => {
  10388. let message = directive2.expression;
  10389. let shouldPrompt = directive2.modifiers.includes("prompt");
  10390. message = message.replaceAll("\\n", "\n");
  10391. if (message === "")
  10392. message = "Are you sure?";
  10393. el.__livewire_confirm = (action, instead) => {
  10394. if (shouldPrompt) {
  10395. let [question, expected] = message.split("|");
  10396. if (!expected) {
  10397. console.warn("Livewire: Must provide expectation with wire:confirm.prompt");
  10398. } else {
  10399. let input = prompt(question);
  10400. if (input === expected) {
  10401. action();
  10402. } else {
  10403. instead();
  10404. }
  10405. }
  10406. } else {
  10407. if (confirm(message))
  10408. action();
  10409. else
  10410. instead();
  10411. }
  10412. };
  10413. });
  10414. // js/directives/wire-current.js
  10415. var import_alpinejs14 = __toESM(require_module_cjs());
  10416. import_alpinejs14.default.addInitSelector(() => `[wire\\:current]`);
  10417. var onPageChanges = /* @__PURE__ */ new Map();
  10418. document.addEventListener("livewire:navigated", () => {
  10419. onPageChanges.forEach((i) => i(new URL(window.location.href)));
  10420. });
  10421. globalDirective("current", ({ el, directive: directive2, cleanup }) => {
  10422. let expression = directive2.expression;
  10423. let options = {
  10424. exact: directive2.modifiers.includes("exact"),
  10425. strict: directive2.modifiers.includes("strict")
  10426. };
  10427. if (expression.startsWith("#"))
  10428. return;
  10429. if (!el.hasAttribute("href"))
  10430. return;
  10431. let href = el.getAttribute("href");
  10432. let hrefUrl = new URL(href, window.location.href);
  10433. let classes = expression.split(" ").filter(String);
  10434. let refreshCurrent = (url) => {
  10435. if (pathMatches(hrefUrl, url, options)) {
  10436. el.classList.add(...classes);
  10437. el.setAttribute("data-current", "");
  10438. } else {
  10439. el.classList.remove(...classes);
  10440. el.removeAttribute("data-current");
  10441. }
  10442. };
  10443. refreshCurrent(new URL(window.location.href));
  10444. onPageChanges.set(el, refreshCurrent);
  10445. cleanup(() => onPageChanges.delete(el));
  10446. });
  10447. function pathMatches(hrefUrl, actualUrl, options) {
  10448. if (hrefUrl.hostname !== actualUrl.hostname)
  10449. return false;
  10450. let hrefPath = options.strict ? hrefUrl.pathname : hrefUrl.pathname.replace(/\/+$/, "");
  10451. let actualPath = options.strict ? actualUrl.pathname : actualUrl.pathname.replace(/\/+$/, "");
  10452. if (options.exact) {
  10453. return hrefPath === actualPath;
  10454. }
  10455. let hrefPathSegments = hrefPath.split("/");
  10456. let actualPathSegments = actualPath.split("/");
  10457. for (let i = 0; i < hrefPathSegments.length; i++) {
  10458. if (hrefPathSegments[i] !== actualPathSegments[i])
  10459. return false;
  10460. }
  10461. return true;
  10462. }
  10463. // js/directives/shared.js
  10464. function toggleBooleanStateDirective(el, directive2, isTruthy, cachedDisplay = null) {
  10465. isTruthy = directive2.modifiers.includes("remove") ? !isTruthy : isTruthy;
  10466. if (directive2.modifiers.includes("class")) {
  10467. let classes = directive2.expression.split(" ").filter(String);
  10468. if (isTruthy) {
  10469. el.classList.add(...classes);
  10470. } else {
  10471. el.classList.remove(...classes);
  10472. }
  10473. } else if (directive2.modifiers.includes("attr")) {
  10474. if (isTruthy) {
  10475. el.setAttribute(directive2.expression, true);
  10476. } else {
  10477. el.removeAttribute(directive2.expression);
  10478. }
  10479. } else {
  10480. let cache = cachedDisplay ?? window.getComputedStyle(el, null).getPropertyValue("display");
  10481. let display = ["inline", "block", "table", "flex", "grid", "inline-flex"].filter((i) => directive2.modifiers.includes(i))[0] || "inline-block";
  10482. display = directive2.modifiers.includes("remove") && !isTruthy ? cache : display;
  10483. el.style.display = isTruthy ? display : "none";
  10484. }
  10485. }
  10486. // js/directives/wire-offline.js
  10487. var offlineHandlers = /* @__PURE__ */ new Set();
  10488. var onlineHandlers = /* @__PURE__ */ new Set();
  10489. window.addEventListener("offline", () => offlineHandlers.forEach((i) => i()));
  10490. window.addEventListener("online", () => onlineHandlers.forEach((i) => i()));
  10491. directive("offline", ({ el, directive: directive2, cleanup }) => {
  10492. let setOffline = () => toggleBooleanStateDirective(el, directive2, true);
  10493. let setOnline = () => toggleBooleanStateDirective(el, directive2, false);
  10494. offlineHandlers.add(setOffline);
  10495. onlineHandlers.add(setOnline);
  10496. cleanup(() => {
  10497. offlineHandlers.delete(setOffline);
  10498. onlineHandlers.delete(setOnline);
  10499. });
  10500. });
  10501. // js/directives/wire-loading.js
  10502. directive("loading", ({ el, directive: directive2, component, cleanup }) => {
  10503. let { targets, inverted } = getTargets(el);
  10504. let [delay, abortDelay] = applyDelay(directive2);
  10505. let cleanupA = whenTargetsArePartOfRequest(component, targets, inverted, [
  10506. () => delay(() => toggleBooleanStateDirective(el, directive2, true)),
  10507. () => abortDelay(() => toggleBooleanStateDirective(el, directive2, false))
  10508. ]);
  10509. let cleanupB = whenTargetsArePartOfFileUpload(component, targets, [
  10510. () => delay(() => toggleBooleanStateDirective(el, directive2, true)),
  10511. () => abortDelay(() => toggleBooleanStateDirective(el, directive2, false))
  10512. ]);
  10513. cleanup(() => {
  10514. cleanupA();
  10515. cleanupB();
  10516. });
  10517. });
  10518. function applyDelay(directive2) {
  10519. if (!directive2.modifiers.includes("delay") || directive2.modifiers.includes("none"))
  10520. return [(i) => i(), (i) => i()];
  10521. let duration = 200;
  10522. let delayModifiers = {
  10523. "shortest": 50,
  10524. "shorter": 100,
  10525. "short": 150,
  10526. "default": 200,
  10527. "long": 300,
  10528. "longer": 500,
  10529. "longest": 1e3
  10530. };
  10531. Object.keys(delayModifiers).some((key) => {
  10532. if (directive2.modifiers.includes(key)) {
  10533. duration = delayModifiers[key];
  10534. return true;
  10535. }
  10536. });
  10537. let timeout;
  10538. let started = false;
  10539. return [
  10540. (callback) => {
  10541. timeout = setTimeout(() => {
  10542. callback();
  10543. started = true;
  10544. }, duration);
  10545. },
  10546. async (callback) => {
  10547. if (started) {
  10548. await callback();
  10549. started = false;
  10550. } else {
  10551. clearTimeout(timeout);
  10552. }
  10553. }
  10554. ];
  10555. }
  10556. function whenTargetsArePartOfRequest(component, targets, inverted, [startLoading, endLoading]) {
  10557. return on("commit", ({ component: iComponent, commit: payload, respond }) => {
  10558. if (iComponent !== component)
  10559. return;
  10560. if (targets.length > 0 && containsTargets(payload, targets) === inverted)
  10561. return;
  10562. startLoading();
  10563. respond(() => {
  10564. endLoading();
  10565. });
  10566. });
  10567. }
  10568. function whenTargetsArePartOfFileUpload(component, targets, [startLoading, endLoading]) {
  10569. let eventMismatch = (e) => {
  10570. let { id, property } = e.detail;
  10571. if (id !== component.id)
  10572. return true;
  10573. if (targets.length > 0 && !targets.map((i) => i.target).includes(property))
  10574. return true;
  10575. return false;
  10576. };
  10577. let cleanupA = listen(window, "livewire-upload-start", (e) => {
  10578. if (eventMismatch(e))
  10579. return;
  10580. startLoading();
  10581. });
  10582. let cleanupB = listen(window, "livewire-upload-finish", (e) => {
  10583. if (eventMismatch(e))
  10584. return;
  10585. endLoading();
  10586. });
  10587. let cleanupC = listen(window, "livewire-upload-error", (e) => {
  10588. if (eventMismatch(e))
  10589. return;
  10590. endLoading();
  10591. });
  10592. return () => {
  10593. cleanupA();
  10594. cleanupB();
  10595. cleanupC();
  10596. };
  10597. }
  10598. function containsTargets(payload, targets) {
  10599. let { updates, calls } = payload;
  10600. return targets.some(({ target, params }) => {
  10601. if (params) {
  10602. return calls.some(({ method, params: methodParams }) => {
  10603. return target === method && params === quickHash(JSON.stringify(methodParams));
  10604. });
  10605. }
  10606. let hasMatchingUpdate = Object.keys(updates).some((property) => {
  10607. if (property.includes(".")) {
  10608. let propertyRoot = property.split(".")[0];
  10609. if (propertyRoot === target)
  10610. return true;
  10611. }
  10612. return property === target;
  10613. });
  10614. if (hasMatchingUpdate)
  10615. return true;
  10616. if (calls.map((i) => i.method).includes(target))
  10617. return true;
  10618. });
  10619. }
  10620. function getTargets(el) {
  10621. let directives = getDirectives(el);
  10622. let targets = [];
  10623. let inverted = false;
  10624. if (directives.has("target")) {
  10625. let directive2 = directives.get("target");
  10626. let raw = directive2.expression;
  10627. if (directive2.modifiers.includes("except"))
  10628. inverted = true;
  10629. if (raw.includes("(") && raw.includes(")")) {
  10630. targets.push({ target: directive2.method, params: quickHash(JSON.stringify(directive2.params)) });
  10631. } else if (raw.includes(",")) {
  10632. raw.split(",").map((i) => i.trim()).forEach((target) => {
  10633. targets.push({ target });
  10634. });
  10635. } else {
  10636. targets.push({ target: raw });
  10637. }
  10638. } else {
  10639. let nonActionOrModelLivewireDirectives = ["init", "dirty", "offline", "target", "loading", "poll", "ignore", "key", "id"];
  10640. directives.all().filter((i) => !nonActionOrModelLivewireDirectives.includes(i.value)).map((i) => i.expression.split("(")[0]).forEach((target) => targets.push({ target }));
  10641. }
  10642. return { targets, inverted };
  10643. }
  10644. function quickHash(subject) {
  10645. return btoa(encodeURIComponent(subject));
  10646. }
  10647. // js/directives/wire-stream.js
  10648. directive("stream", ({ el, directive: directive2, cleanup }) => {
  10649. let { expression, modifiers } = directive2;
  10650. let off = on("stream", ({ name, content, replace: replace2 }) => {
  10651. if (name !== expression)
  10652. return;
  10653. if (modifiers.includes("replace") || replace2) {
  10654. el.innerHTML = content;
  10655. } else {
  10656. el.innerHTML = el.innerHTML + content;
  10657. }
  10658. });
  10659. cleanup(off);
  10660. });
  10661. on("request", ({ respond }) => {
  10662. respond((mutableObject) => {
  10663. let response = mutableObject.response;
  10664. if (!response.headers.has("X-Livewire-Stream"))
  10665. return;
  10666. mutableObject.response = {
  10667. ok: true,
  10668. redirected: false,
  10669. status: 200,
  10670. async text() {
  10671. let finalResponse = await interceptStreamAndReturnFinalResponse(response, (streamed) => {
  10672. trigger("stream", streamed);
  10673. });
  10674. if (contentIsFromDump(finalResponse)) {
  10675. this.ok = false;
  10676. }
  10677. return finalResponse;
  10678. }
  10679. };
  10680. });
  10681. });
  10682. async function interceptStreamAndReturnFinalResponse(response, callback) {
  10683. let reader = response.body.getReader();
  10684. let remainingResponse = "";
  10685. while (true) {
  10686. let { done, value: chunk } = await reader.read();
  10687. let decoder = new TextDecoder();
  10688. let output = decoder.decode(chunk);
  10689. let [streams, remaining] = extractStreamObjects(remainingResponse + output);
  10690. streams.forEach((stream) => {
  10691. callback(stream);
  10692. });
  10693. remainingResponse = remaining;
  10694. if (done)
  10695. return remainingResponse;
  10696. }
  10697. }
  10698. function extractStreamObjects(raw) {
  10699. let regex = /({"stream":true.*?"endStream":true})/g;
  10700. let matches = raw.match(regex);
  10701. let parsed = [];
  10702. if (matches) {
  10703. for (let i = 0; i < matches.length; i++) {
  10704. parsed.push(JSON.parse(matches[i]).body);
  10705. }
  10706. }
  10707. let remaining = raw.replace(regex, "");
  10708. return [parsed, remaining];
  10709. }
  10710. // js/directives/wire-replace.js
  10711. directive("replace", ({ el, directive: directive2 }) => {
  10712. if (directive2.modifiers.includes("self")) {
  10713. el.__livewire_replace_self = true;
  10714. } else {
  10715. el.__livewire_replace = true;
  10716. }
  10717. });
  10718. // js/directives/wire-ignore.js
  10719. directive("ignore", ({ el, directive: directive2 }) => {
  10720. if (directive2.modifiers.includes("self")) {
  10721. el.__livewire_ignore_self = true;
  10722. } else if (directive2.modifiers.includes("children")) {
  10723. el.__livewire_ignore_children = true;
  10724. } else {
  10725. el.__livewire_ignore = true;
  10726. }
  10727. });
  10728. // js/directives/wire-cloak.js
  10729. var import_alpinejs15 = __toESM(require_module_cjs());
  10730. import_alpinejs15.default.interceptInit((el) => {
  10731. if (el.hasAttribute("wire:cloak")) {
  10732. import_alpinejs15.default.mutateDom(() => el.removeAttribute("wire:cloak"));
  10733. }
  10734. });
  10735. // js/directives/wire-dirty.js
  10736. var refreshDirtyStatesByComponent = new WeakBag();
  10737. on("commit", ({ component, succeed }) => {
  10738. succeed(() => {
  10739. setTimeout(() => {
  10740. refreshDirtyStatesByComponent.each(component, (i) => i(false));
  10741. });
  10742. });
  10743. });
  10744. directive("dirty", ({ el, directive: directive2, component }) => {
  10745. let targets = dirtyTargets(el);
  10746. let dirty = Alpine.reactive({ state: false });
  10747. let oldIsDirty = false;
  10748. let initialDisplay = el.style.display;
  10749. let refreshDirtyState = (isDirty) => {
  10750. toggleBooleanStateDirective(el, directive2, isDirty, initialDisplay);
  10751. oldIsDirty = isDirty;
  10752. };
  10753. refreshDirtyStatesByComponent.add(component, refreshDirtyState);
  10754. Alpine.effect(() => {
  10755. let isDirty = false;
  10756. if (targets.length === 0) {
  10757. isDirty = JSON.stringify(component.canonical) !== JSON.stringify(component.reactive);
  10758. } else {
  10759. for (let i = 0; i < targets.length; i++) {
  10760. if (isDirty)
  10761. break;
  10762. let target = targets[i];
  10763. isDirty = JSON.stringify(dataGet(component.canonical, target)) !== JSON.stringify(dataGet(component.reactive, target));
  10764. }
  10765. }
  10766. if (oldIsDirty !== isDirty) {
  10767. refreshDirtyState(isDirty);
  10768. }
  10769. oldIsDirty = isDirty;
  10770. });
  10771. });
  10772. function dirtyTargets(el) {
  10773. let directives = getDirectives(el);
  10774. let targets = [];
  10775. if (directives.has("model")) {
  10776. targets.push(directives.get("model").expression);
  10777. }
  10778. if (directives.has("target")) {
  10779. targets = targets.concat(directives.get("target").expression.split(",").map((s) => s.trim()));
  10780. }
  10781. return targets;
  10782. }
  10783. // js/directives/wire-model.js
  10784. var import_alpinejs16 = __toESM(require_module_cjs());
  10785. directive("model", ({ el, directive: directive2, component, cleanup }) => {
  10786. let { expression, modifiers } = directive2;
  10787. if (!expression) {
  10788. return console.warn("Livewire: [wire:model] is missing a value.", el);
  10789. }
  10790. if (componentIsMissingProperty(component, expression)) {
  10791. return console.warn('Livewire: [wire:model="' + expression + '"] property does not exist on component: [' + component.name + "]", el);
  10792. }
  10793. if (el.type && el.type.toLowerCase() === "file") {
  10794. return handleFileUpload(el, expression, component, cleanup);
  10795. }
  10796. let isLive = modifiers.includes("live");
  10797. let isLazy = modifiers.includes("lazy") || modifiers.includes("change");
  10798. let onBlur = modifiers.includes("blur");
  10799. let isDebounced = modifiers.includes("debounce");
  10800. let update = expression.startsWith("$parent") ? () => component.$wire.$parent.$commit() : () => component.$wire.$commit();
  10801. let debouncedUpdate = isTextInput(el) && !isDebounced && isLive ? debounce(update, 150) : update;
  10802. import_alpinejs16.default.bind(el, {
  10803. ["@change"]() {
  10804. isLazy && update();
  10805. },
  10806. ["@blur"]() {
  10807. onBlur && update();
  10808. },
  10809. ["x-model" + getModifierTail(modifiers)]() {
  10810. return {
  10811. get() {
  10812. return dataGet(component.$wire, expression);
  10813. },
  10814. set(value) {
  10815. dataSet(component.$wire, expression, value);
  10816. isLive && !isLazy && !onBlur && debouncedUpdate();
  10817. }
  10818. };
  10819. }
  10820. });
  10821. });
  10822. function getModifierTail(modifiers) {
  10823. modifiers = modifiers.filter((i) => ![
  10824. "lazy",
  10825. "defer"
  10826. ].includes(i));
  10827. if (modifiers.length === 0)
  10828. return "";
  10829. return "." + modifiers.join(".");
  10830. }
  10831. function isTextInput(el) {
  10832. return ["INPUT", "TEXTAREA"].includes(el.tagName.toUpperCase()) && !["checkbox", "radio"].includes(el.type);
  10833. }
  10834. function componentIsMissingProperty(component, property) {
  10835. if (property.startsWith("$parent")) {
  10836. let parent = closestComponent(component.el.parentElement, false);
  10837. if (!parent)
  10838. return true;
  10839. return componentIsMissingProperty(parent, property.split("$parent.")[1]);
  10840. }
  10841. let baseProperty = property.split(".")[0];
  10842. return !Object.keys(component.canonical).includes(baseProperty);
  10843. }
  10844. function debounce(func, wait) {
  10845. var timeout;
  10846. return function() {
  10847. var context = this, args = arguments;
  10848. var later = function() {
  10849. timeout = null;
  10850. func.apply(context, args);
  10851. };
  10852. clearTimeout(timeout);
  10853. timeout = setTimeout(later, wait);
  10854. };
  10855. }
  10856. // js/directives/wire-init.js
  10857. var import_alpinejs17 = __toESM(require_module_cjs());
  10858. directive("init", ({ el, directive: directive2 }) => {
  10859. let fullMethod = directive2.expression ?? "$refresh";
  10860. import_alpinejs17.default.evaluate(el, `$wire.${fullMethod}`);
  10861. });
  10862. // js/directives/wire-poll.js
  10863. var import_alpinejs18 = __toESM(require_module_cjs());
  10864. directive("poll", ({ el, directive: directive2 }) => {
  10865. let interval = extractDurationFrom(directive2.modifiers, 2e3);
  10866. let { start: start2, pauseWhile, throttleWhile, stopWhen } = poll(() => {
  10867. triggerComponentRequest(el, directive2);
  10868. }, interval);
  10869. start2();
  10870. throttleWhile(() => theTabIsInTheBackground() && theDirectiveIsMissingKeepAlive(directive2));
  10871. pauseWhile(() => theDirectiveHasVisible(directive2) && theElementIsNotInTheViewport(el));
  10872. pauseWhile(() => theDirectiveIsOffTheElement(el));
  10873. pauseWhile(() => livewireIsOffline());
  10874. stopWhen(() => theElementIsDisconnected(el));
  10875. });
  10876. function triggerComponentRequest(el, directive2) {
  10877. import_alpinejs18.default.evaluate(el, directive2.expression ? "$wire." + directive2.expression : "$wire.$commit()");
  10878. }
  10879. function poll(callback, interval = 2e3) {
  10880. let pauseConditions = [];
  10881. let throttleConditions = [];
  10882. let stopConditions = [];
  10883. return {
  10884. start() {
  10885. let clear = syncronizedInterval(interval, () => {
  10886. if (stopConditions.some((i) => i()))
  10887. return clear();
  10888. if (pauseConditions.some((i) => i()))
  10889. return;
  10890. if (throttleConditions.some((i) => i()) && Math.random() < 0.95)
  10891. return;
  10892. callback();
  10893. });
  10894. },
  10895. pauseWhile(condition) {
  10896. pauseConditions.push(condition);
  10897. },
  10898. throttleWhile(condition) {
  10899. throttleConditions.push(condition);
  10900. },
  10901. stopWhen(condition) {
  10902. stopConditions.push(condition);
  10903. }
  10904. };
  10905. }
  10906. var clocks = [];
  10907. function syncronizedInterval(ms, callback) {
  10908. if (!clocks[ms]) {
  10909. let clock = {
  10910. timer: setInterval(() => clock.callbacks.forEach((i) => i()), ms),
  10911. callbacks: /* @__PURE__ */ new Set()
  10912. };
  10913. clocks[ms] = clock;
  10914. }
  10915. clocks[ms].callbacks.add(callback);
  10916. return () => {
  10917. clocks[ms].callbacks.delete(callback);
  10918. if (clocks[ms].callbacks.size === 0) {
  10919. clearInterval(clocks[ms].timer);
  10920. delete clocks[ms];
  10921. }
  10922. };
  10923. }
  10924. var isOffline = false;
  10925. window.addEventListener("offline", () => isOffline = true);
  10926. window.addEventListener("online", () => isOffline = false);
  10927. function livewireIsOffline() {
  10928. return isOffline;
  10929. }
  10930. var inBackground = false;
  10931. document.addEventListener("visibilitychange", () => {
  10932. inBackground = document.hidden;
  10933. }, false);
  10934. function theTabIsInTheBackground() {
  10935. return inBackground;
  10936. }
  10937. function theDirectiveIsOffTheElement(el) {
  10938. return !getDirectives(el).has("poll");
  10939. }
  10940. function theDirectiveIsMissingKeepAlive(directive2) {
  10941. return !directive2.modifiers.includes("keep-alive");
  10942. }
  10943. function theDirectiveHasVisible(directive2) {
  10944. return directive2.modifiers.includes("visible");
  10945. }
  10946. function theElementIsNotInTheViewport(el) {
  10947. let bounding = el.getBoundingClientRect();
  10948. return !(bounding.top < (window.innerHeight || document.documentElement.clientHeight) && bounding.left < (window.innerWidth || document.documentElement.clientWidth) && bounding.bottom > 0 && bounding.right > 0);
  10949. }
  10950. function theElementIsDisconnected(el) {
  10951. return el.isConnected === false;
  10952. }
  10953. function extractDurationFrom(modifiers, defaultDuration) {
  10954. let durationInMilliSeconds;
  10955. let durationInMilliSecondsString = modifiers.find((mod) => mod.match(/([0-9]+)ms/));
  10956. let durationInSecondsString = modifiers.find((mod) => mod.match(/([0-9]+)s/));
  10957. if (durationInMilliSecondsString) {
  10958. durationInMilliSeconds = Number(durationInMilliSecondsString.replace("ms", ""));
  10959. } else if (durationInSecondsString) {
  10960. durationInMilliSeconds = Number(durationInSecondsString.replace("s", "")) * 1e3;
  10961. }
  10962. return durationInMilliSeconds || defaultDuration;
  10963. }
  10964. // js/directives/wire-show.js
  10965. var import_alpinejs19 = __toESM(require_module_cjs());
  10966. import_alpinejs19.default.interceptInit((el) => {
  10967. for (let i = 0; i < el.attributes.length; i++) {
  10968. if (el.attributes[i].name.startsWith("wire:show")) {
  10969. let { name, value } = el.attributes[i];
  10970. let modifierString = name.split("wire:show")[1];
  10971. let expression = value.startsWith("!") ? "!$wire." + value.slice(1).trim() : "$wire." + value.trim();
  10972. import_alpinejs19.default.bind(el, {
  10973. ["x-show" + modifierString]() {
  10974. return import_alpinejs19.default.evaluate(el, expression);
  10975. }
  10976. });
  10977. }
  10978. }
  10979. });
  10980. // js/directives/wire-text.js
  10981. var import_alpinejs20 = __toESM(require_module_cjs());
  10982. import_alpinejs20.default.interceptInit((el) => {
  10983. for (let i = 0; i < el.attributes.length; i++) {
  10984. if (el.attributes[i].name.startsWith("wire:text")) {
  10985. let { name, value } = el.attributes[i];
  10986. let modifierString = name.split("wire:text")[1];
  10987. let expression = value.startsWith("!") ? "!$wire." + value.slice(1).trim() : "$wire." + value.trim();
  10988. import_alpinejs20.default.bind(el, {
  10989. ["x-text" + modifierString]() {
  10990. return import_alpinejs20.default.evaluate(el, expression);
  10991. }
  10992. });
  10993. }
  10994. }
  10995. });
  10996. // js/index.js
  10997. var Livewire2 = {
  10998. directive,
  10999. dispatchTo,
  11000. start,
  11001. first,
  11002. find,
  11003. getByName,
  11004. all,
  11005. hook: on,
  11006. trigger,
  11007. triggerAsync,
  11008. dispatch: dispatchGlobal,
  11009. on: on2,
  11010. get navigate() {
  11011. return import_alpinejs21.default.navigate;
  11012. }
  11013. };
  11014. var warnAboutMultipleInstancesOf = (entity) => console.warn(`Detected multiple instances of ${entity} running`);
  11015. if (window.Livewire)
  11016. warnAboutMultipleInstancesOf("Livewire");
  11017. if (window.Alpine)
  11018. warnAboutMultipleInstancesOf("Alpine");
  11019. window.Livewire = Livewire2;
  11020. window.Alpine = import_alpinejs21.default;
  11021. if (window.livewireScriptConfig === void 0) {
  11022. window.Alpine.__fromLivewire = true;
  11023. document.addEventListener("DOMContentLoaded", () => {
  11024. if (window.Alpine.__fromLivewire === void 0) {
  11025. warnAboutMultipleInstancesOf("Alpine");
  11026. }
  11027. Livewire2.start();
  11028. });
  11029. }
  11030. var export_Alpine = import_alpinejs21.default;
  11031. export {
  11032. export_Alpine as Alpine,
  11033. Livewire2 as Livewire
  11034. };
  11035. /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
  11036. * @license MIT */
  11037. /*! Bundled license information:
  11038. tabbable/dist/index.js:
  11039. (*!
  11040. * tabbable 5.3.3
  11041. * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
  11042. *)
  11043. focus-trap/dist/focus-trap.js:
  11044. (*!
  11045. * focus-trap 6.9.4
  11046. * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
  11047. *)
  11048. */
  11049. //# sourceMappingURL=livewire.esm.js.map