暂无描述

module.cjs.js 124KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942
  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 __export = (target, all) => {
  11. for (var name in all)
  12. __defProp(target, name, { get: all[name], enumerable: true });
  13. };
  14. var __copyProps = (to, from, except, desc) => {
  15. if (from && typeof from === "object" || typeof from === "function") {
  16. for (let key of __getOwnPropNames(from))
  17. if (!__hasOwnProp.call(to, key) && key !== except)
  18. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  19. }
  20. return to;
  21. };
  22. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  23. // If the importer is in node compatibility mode or this is not an ESM
  24. // file that has been converted to a CommonJS file using a Babel-
  25. // compatible transform (i.e. "__esModule" has not been set), then set
  26. // "default" to the CommonJS "module.exports" for node compatibility.
  27. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  28. mod
  29. ));
  30. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  31. // node_modules/@vue/shared/dist/shared.cjs.js
  32. var require_shared_cjs = __commonJS({
  33. "node_modules/@vue/shared/dist/shared.cjs.js"(exports) {
  34. "use strict";
  35. Object.defineProperty(exports, "__esModule", { value: true });
  36. function makeMap(str, expectsLowerCase) {
  37. const map = /* @__PURE__ */ Object.create(null);
  38. const list = str.split(",");
  39. for (let i = 0; i < list.length; i++) {
  40. map[list[i]] = true;
  41. }
  42. return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
  43. }
  44. var PatchFlagNames = {
  45. [
  46. 1
  47. /* TEXT */
  48. ]: `TEXT`,
  49. [
  50. 2
  51. /* CLASS */
  52. ]: `CLASS`,
  53. [
  54. 4
  55. /* STYLE */
  56. ]: `STYLE`,
  57. [
  58. 8
  59. /* PROPS */
  60. ]: `PROPS`,
  61. [
  62. 16
  63. /* FULL_PROPS */
  64. ]: `FULL_PROPS`,
  65. [
  66. 32
  67. /* HYDRATE_EVENTS */
  68. ]: `HYDRATE_EVENTS`,
  69. [
  70. 64
  71. /* STABLE_FRAGMENT */
  72. ]: `STABLE_FRAGMENT`,
  73. [
  74. 128
  75. /* KEYED_FRAGMENT */
  76. ]: `KEYED_FRAGMENT`,
  77. [
  78. 256
  79. /* UNKEYED_FRAGMENT */
  80. ]: `UNKEYED_FRAGMENT`,
  81. [
  82. 512
  83. /* NEED_PATCH */
  84. ]: `NEED_PATCH`,
  85. [
  86. 1024
  87. /* DYNAMIC_SLOTS */
  88. ]: `DYNAMIC_SLOTS`,
  89. [
  90. 2048
  91. /* DEV_ROOT_FRAGMENT */
  92. ]: `DEV_ROOT_FRAGMENT`,
  93. [
  94. -1
  95. /* HOISTED */
  96. ]: `HOISTED`,
  97. [
  98. -2
  99. /* BAIL */
  100. ]: `BAIL`
  101. };
  102. var slotFlagsText = {
  103. [
  104. 1
  105. /* STABLE */
  106. ]: "STABLE",
  107. [
  108. 2
  109. /* DYNAMIC */
  110. ]: "DYNAMIC",
  111. [
  112. 3
  113. /* FORWARDED */
  114. ]: "FORWARDED"
  115. };
  116. 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";
  117. var isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
  118. var range = 2;
  119. function generateCodeFrame(source, start2 = 0, end = source.length) {
  120. let lines = source.split(/(\r?\n)/);
  121. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  122. lines = lines.filter((_, idx) => idx % 2 === 0);
  123. let count = 0;
  124. const res = [];
  125. for (let i = 0; i < lines.length; i++) {
  126. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  127. if (count >= start2) {
  128. for (let j = i - range; j <= i + range || end > count; j++) {
  129. if (j < 0 || j >= lines.length)
  130. continue;
  131. const line = j + 1;
  132. res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
  133. const lineLength = lines[j].length;
  134. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  135. if (j === i) {
  136. const pad = start2 - (count - (lineLength + newLineSeqLength));
  137. const length = Math.max(1, end > count ? lineLength - pad : end - start2);
  138. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  139. } else if (j > i) {
  140. if (end > count) {
  141. const length = Math.max(Math.min(end - count, lineLength), 1);
  142. res.push(` | ` + "^".repeat(length));
  143. }
  144. count += lineLength + newLineSeqLength;
  145. }
  146. }
  147. break;
  148. }
  149. }
  150. return res.join("\n");
  151. }
  152. var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  153. var isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  154. var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
  155. var unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
  156. var attrValidationCache = {};
  157. function isSSRSafeAttrName(name) {
  158. if (attrValidationCache.hasOwnProperty(name)) {
  159. return attrValidationCache[name];
  160. }
  161. const isUnsafe = unsafeAttrCharRE.test(name);
  162. if (isUnsafe) {
  163. console.error(`unsafe attribute name: ${name}`);
  164. }
  165. return attrValidationCache[name] = !isUnsafe;
  166. }
  167. var propsToAttrMap = {
  168. acceptCharset: "accept-charset",
  169. className: "class",
  170. htmlFor: "for",
  171. httpEquiv: "http-equiv"
  172. };
  173. 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`);
  174. 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`);
  175. function normalizeStyle(value) {
  176. if (isArray(value)) {
  177. const res = {};
  178. for (let i = 0; i < value.length; i++) {
  179. const item = value[i];
  180. const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
  181. if (normalized) {
  182. for (const key in normalized) {
  183. res[key] = normalized[key];
  184. }
  185. }
  186. }
  187. return res;
  188. } else if (isObject(value)) {
  189. return value;
  190. }
  191. }
  192. var listDelimiterRE = /;(?![^(]*\))/g;
  193. var propertyDelimiterRE = /:(.+)/;
  194. function parseStringStyle(cssText) {
  195. const ret = {};
  196. cssText.split(listDelimiterRE).forEach((item) => {
  197. if (item) {
  198. const tmp = item.split(propertyDelimiterRE);
  199. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  200. }
  201. });
  202. return ret;
  203. }
  204. function stringifyStyle(styles) {
  205. let ret = "";
  206. if (!styles) {
  207. return ret;
  208. }
  209. for (const key in styles) {
  210. const value = styles[key];
  211. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  212. if (isString(value) || typeof value === "number" && isNoUnitNumericStyleProp(normalizedKey)) {
  213. ret += `${normalizedKey}:${value};`;
  214. }
  215. }
  216. return ret;
  217. }
  218. function normalizeClass(value) {
  219. let res = "";
  220. if (isString(value)) {
  221. res = value;
  222. } else if (isArray(value)) {
  223. for (let i = 0; i < value.length; i++) {
  224. const normalized = normalizeClass(value[i]);
  225. if (normalized) {
  226. res += normalized + " ";
  227. }
  228. }
  229. } else if (isObject(value)) {
  230. for (const name in value) {
  231. if (value[name]) {
  232. res += name + " ";
  233. }
  234. }
  235. }
  236. return res.trim();
  237. }
  238. 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";
  239. 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";
  240. var VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  241. var isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  242. var isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  243. var isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  244. var escapeRE = /["'&<>]/;
  245. function escapeHtml(string) {
  246. const str = "" + string;
  247. const match = escapeRE.exec(str);
  248. if (!match) {
  249. return str;
  250. }
  251. let html = "";
  252. let escaped;
  253. let index;
  254. let lastIndex = 0;
  255. for (index = match.index; index < str.length; index++) {
  256. switch (str.charCodeAt(index)) {
  257. case 34:
  258. escaped = "&quot;";
  259. break;
  260. case 38:
  261. escaped = "&amp;";
  262. break;
  263. case 39:
  264. escaped = "&#39;";
  265. break;
  266. case 60:
  267. escaped = "&lt;";
  268. break;
  269. case 62:
  270. escaped = "&gt;";
  271. break;
  272. default:
  273. continue;
  274. }
  275. if (lastIndex !== index) {
  276. html += str.substring(lastIndex, index);
  277. }
  278. lastIndex = index + 1;
  279. html += escaped;
  280. }
  281. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  282. }
  283. var commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
  284. function escapeHtmlComment(src) {
  285. return src.replace(commentStripRE, "");
  286. }
  287. function looseCompareArrays(a, b) {
  288. if (a.length !== b.length)
  289. return false;
  290. let equal = true;
  291. for (let i = 0; equal && i < a.length; i++) {
  292. equal = looseEqual(a[i], b[i]);
  293. }
  294. return equal;
  295. }
  296. function looseEqual(a, b) {
  297. if (a === b)
  298. return true;
  299. let aValidType = isDate(a);
  300. let bValidType = isDate(b);
  301. if (aValidType || bValidType) {
  302. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  303. }
  304. aValidType = isArray(a);
  305. bValidType = isArray(b);
  306. if (aValidType || bValidType) {
  307. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  308. }
  309. aValidType = isObject(a);
  310. bValidType = isObject(b);
  311. if (aValidType || bValidType) {
  312. if (!aValidType || !bValidType) {
  313. return false;
  314. }
  315. const aKeysCount = Object.keys(a).length;
  316. const bKeysCount = Object.keys(b).length;
  317. if (aKeysCount !== bKeysCount) {
  318. return false;
  319. }
  320. for (const key in a) {
  321. const aHasKey = a.hasOwnProperty(key);
  322. const bHasKey = b.hasOwnProperty(key);
  323. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  324. return false;
  325. }
  326. }
  327. }
  328. return String(a) === String(b);
  329. }
  330. function looseIndexOf(arr, val) {
  331. return arr.findIndex((item) => looseEqual(item, val));
  332. }
  333. var toDisplayString = (val) => {
  334. return val == null ? "" : isObject(val) ? JSON.stringify(val, replacer, 2) : String(val);
  335. };
  336. var replacer = (_key, val) => {
  337. if (isMap(val)) {
  338. return {
  339. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
  340. entries[`${key} =>`] = val2;
  341. return entries;
  342. }, {})
  343. };
  344. } else if (isSet(val)) {
  345. return {
  346. [`Set(${val.size})`]: [...val.values()]
  347. };
  348. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  349. return String(val);
  350. }
  351. return val;
  352. };
  353. var babelParserDefaultPlugins = [
  354. "bigInt",
  355. "optionalChaining",
  356. "nullishCoalescingOperator"
  357. ];
  358. var EMPTY_OBJ = Object.freeze({});
  359. var EMPTY_ARR = Object.freeze([]);
  360. var NOOP = () => {
  361. };
  362. var NO = () => false;
  363. var onRE = /^on[^a-z]/;
  364. var isOn = (key) => onRE.test(key);
  365. var isModelListener = (key) => key.startsWith("onUpdate:");
  366. var extend = Object.assign;
  367. var remove = (arr, el) => {
  368. const i = arr.indexOf(el);
  369. if (i > -1) {
  370. arr.splice(i, 1);
  371. }
  372. };
  373. var hasOwnProperty = Object.prototype.hasOwnProperty;
  374. var hasOwn = (val, key) => hasOwnProperty.call(val, key);
  375. var isArray = Array.isArray;
  376. var isMap = (val) => toTypeString(val) === "[object Map]";
  377. var isSet = (val) => toTypeString(val) === "[object Set]";
  378. var isDate = (val) => val instanceof Date;
  379. var isFunction = (val) => typeof val === "function";
  380. var isString = (val) => typeof val === "string";
  381. var isSymbol = (val) => typeof val === "symbol";
  382. var isObject = (val) => val !== null && typeof val === "object";
  383. var isPromise = (val) => {
  384. return isObject(val) && isFunction(val.then) && isFunction(val.catch);
  385. };
  386. var objectToString = Object.prototype.toString;
  387. var toTypeString = (value) => objectToString.call(value);
  388. var toRawType = (value) => {
  389. return toTypeString(value).slice(8, -1);
  390. };
  391. var isPlainObject = (val) => toTypeString(val) === "[object Object]";
  392. var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  393. var isReservedProp = /* @__PURE__ */ makeMap(
  394. // the leading comma is intentional so empty string "" is also included
  395. ",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  396. );
  397. var cacheStringFunction = (fn) => {
  398. const cache = /* @__PURE__ */ Object.create(null);
  399. return (str) => {
  400. const hit = cache[str];
  401. return hit || (cache[str] = fn(str));
  402. };
  403. };
  404. var camelizeRE = /-(\w)/g;
  405. var camelize = cacheStringFunction((str) => {
  406. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  407. });
  408. var hyphenateRE = /\B([A-Z])/g;
  409. var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  410. var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  411. var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
  412. var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
  413. var invokeArrayFns = (fns, arg) => {
  414. for (let i = 0; i < fns.length; i++) {
  415. fns[i](arg);
  416. }
  417. };
  418. var def = (obj, key, value) => {
  419. Object.defineProperty(obj, key, {
  420. configurable: true,
  421. enumerable: false,
  422. value
  423. });
  424. };
  425. var toNumber = (val) => {
  426. const n = parseFloat(val);
  427. return isNaN(n) ? val : n;
  428. };
  429. var _globalThis;
  430. var getGlobalThis = () => {
  431. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  432. };
  433. exports.EMPTY_ARR = EMPTY_ARR;
  434. exports.EMPTY_OBJ = EMPTY_OBJ;
  435. exports.NO = NO;
  436. exports.NOOP = NOOP;
  437. exports.PatchFlagNames = PatchFlagNames;
  438. exports.babelParserDefaultPlugins = babelParserDefaultPlugins;
  439. exports.camelize = camelize;
  440. exports.capitalize = capitalize;
  441. exports.def = def;
  442. exports.escapeHtml = escapeHtml;
  443. exports.escapeHtmlComment = escapeHtmlComment;
  444. exports.extend = extend;
  445. exports.generateCodeFrame = generateCodeFrame;
  446. exports.getGlobalThis = getGlobalThis;
  447. exports.hasChanged = hasChanged;
  448. exports.hasOwn = hasOwn;
  449. exports.hyphenate = hyphenate;
  450. exports.invokeArrayFns = invokeArrayFns;
  451. exports.isArray = isArray;
  452. exports.isBooleanAttr = isBooleanAttr2;
  453. exports.isDate = isDate;
  454. exports.isFunction = isFunction;
  455. exports.isGloballyWhitelisted = isGloballyWhitelisted;
  456. exports.isHTMLTag = isHTMLTag;
  457. exports.isIntegerKey = isIntegerKey;
  458. exports.isKnownAttr = isKnownAttr;
  459. exports.isMap = isMap;
  460. exports.isModelListener = isModelListener;
  461. exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp;
  462. exports.isObject = isObject;
  463. exports.isOn = isOn;
  464. exports.isPlainObject = isPlainObject;
  465. exports.isPromise = isPromise;
  466. exports.isReservedProp = isReservedProp;
  467. exports.isSSRSafeAttrName = isSSRSafeAttrName;
  468. exports.isSVGTag = isSVGTag;
  469. exports.isSet = isSet;
  470. exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
  471. exports.isString = isString;
  472. exports.isSymbol = isSymbol;
  473. exports.isVoidTag = isVoidTag;
  474. exports.looseEqual = looseEqual;
  475. exports.looseIndexOf = looseIndexOf;
  476. exports.makeMap = makeMap;
  477. exports.normalizeClass = normalizeClass;
  478. exports.normalizeStyle = normalizeStyle;
  479. exports.objectToString = objectToString;
  480. exports.parseStringStyle = parseStringStyle;
  481. exports.propsToAttrMap = propsToAttrMap;
  482. exports.remove = remove;
  483. exports.slotFlagsText = slotFlagsText;
  484. exports.stringifyStyle = stringifyStyle;
  485. exports.toDisplayString = toDisplayString;
  486. exports.toHandlerKey = toHandlerKey;
  487. exports.toNumber = toNumber;
  488. exports.toRawType = toRawType;
  489. exports.toTypeString = toTypeString;
  490. }
  491. });
  492. // node_modules/@vue/shared/index.js
  493. var require_shared = __commonJS({
  494. "node_modules/@vue/shared/index.js"(exports, module2) {
  495. "use strict";
  496. if (false) {
  497. module2.exports = null;
  498. } else {
  499. module2.exports = require_shared_cjs();
  500. }
  501. }
  502. });
  503. // node_modules/@vue/reactivity/dist/reactivity.cjs.js
  504. var require_reactivity_cjs = __commonJS({
  505. "node_modules/@vue/reactivity/dist/reactivity.cjs.js"(exports) {
  506. "use strict";
  507. Object.defineProperty(exports, "__esModule", { value: true });
  508. var shared = require_shared();
  509. var targetMap = /* @__PURE__ */ new WeakMap();
  510. var effectStack = [];
  511. var activeEffect;
  512. var ITERATE_KEY = Symbol("iterate");
  513. var MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
  514. function isEffect(fn) {
  515. return fn && fn._isEffect === true;
  516. }
  517. function effect3(fn, options = shared.EMPTY_OBJ) {
  518. if (isEffect(fn)) {
  519. fn = fn.raw;
  520. }
  521. const effect4 = createReactiveEffect(fn, options);
  522. if (!options.lazy) {
  523. effect4();
  524. }
  525. return effect4;
  526. }
  527. function stop2(effect4) {
  528. if (effect4.active) {
  529. cleanup(effect4);
  530. if (effect4.options.onStop) {
  531. effect4.options.onStop();
  532. }
  533. effect4.active = false;
  534. }
  535. }
  536. var uid = 0;
  537. function createReactiveEffect(fn, options) {
  538. const effect4 = function reactiveEffect() {
  539. if (!effect4.active) {
  540. return fn();
  541. }
  542. if (!effectStack.includes(effect4)) {
  543. cleanup(effect4);
  544. try {
  545. enableTracking();
  546. effectStack.push(effect4);
  547. activeEffect = effect4;
  548. return fn();
  549. } finally {
  550. effectStack.pop();
  551. resetTracking();
  552. activeEffect = effectStack[effectStack.length - 1];
  553. }
  554. }
  555. };
  556. effect4.id = uid++;
  557. effect4.allowRecurse = !!options.allowRecurse;
  558. effect4._isEffect = true;
  559. effect4.active = true;
  560. effect4.raw = fn;
  561. effect4.deps = [];
  562. effect4.options = options;
  563. return effect4;
  564. }
  565. function cleanup(effect4) {
  566. const { deps } = effect4;
  567. if (deps.length) {
  568. for (let i = 0; i < deps.length; i++) {
  569. deps[i].delete(effect4);
  570. }
  571. deps.length = 0;
  572. }
  573. }
  574. var shouldTrack = true;
  575. var trackStack = [];
  576. function pauseTracking() {
  577. trackStack.push(shouldTrack);
  578. shouldTrack = false;
  579. }
  580. function enableTracking() {
  581. trackStack.push(shouldTrack);
  582. shouldTrack = true;
  583. }
  584. function resetTracking() {
  585. const last = trackStack.pop();
  586. shouldTrack = last === void 0 ? true : last;
  587. }
  588. function track(target, type, key) {
  589. if (!shouldTrack || activeEffect === void 0) {
  590. return;
  591. }
  592. let depsMap = targetMap.get(target);
  593. if (!depsMap) {
  594. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  595. }
  596. let dep = depsMap.get(key);
  597. if (!dep) {
  598. depsMap.set(key, dep = /* @__PURE__ */ new Set());
  599. }
  600. if (!dep.has(activeEffect)) {
  601. dep.add(activeEffect);
  602. activeEffect.deps.push(dep);
  603. if (activeEffect.options.onTrack) {
  604. activeEffect.options.onTrack({
  605. effect: activeEffect,
  606. target,
  607. type,
  608. key
  609. });
  610. }
  611. }
  612. }
  613. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  614. const depsMap = targetMap.get(target);
  615. if (!depsMap) {
  616. return;
  617. }
  618. const effects = /* @__PURE__ */ new Set();
  619. const add2 = (effectsToAdd) => {
  620. if (effectsToAdd) {
  621. effectsToAdd.forEach((effect4) => {
  622. if (effect4 !== activeEffect || effect4.allowRecurse) {
  623. effects.add(effect4);
  624. }
  625. });
  626. }
  627. };
  628. if (type === "clear") {
  629. depsMap.forEach(add2);
  630. } else if (key === "length" && shared.isArray(target)) {
  631. depsMap.forEach((dep, key2) => {
  632. if (key2 === "length" || key2 >= newValue) {
  633. add2(dep);
  634. }
  635. });
  636. } else {
  637. if (key !== void 0) {
  638. add2(depsMap.get(key));
  639. }
  640. switch (type) {
  641. case "add":
  642. if (!shared.isArray(target)) {
  643. add2(depsMap.get(ITERATE_KEY));
  644. if (shared.isMap(target)) {
  645. add2(depsMap.get(MAP_KEY_ITERATE_KEY));
  646. }
  647. } else if (shared.isIntegerKey(key)) {
  648. add2(depsMap.get("length"));
  649. }
  650. break;
  651. case "delete":
  652. if (!shared.isArray(target)) {
  653. add2(depsMap.get(ITERATE_KEY));
  654. if (shared.isMap(target)) {
  655. add2(depsMap.get(MAP_KEY_ITERATE_KEY));
  656. }
  657. }
  658. break;
  659. case "set":
  660. if (shared.isMap(target)) {
  661. add2(depsMap.get(ITERATE_KEY));
  662. }
  663. break;
  664. }
  665. }
  666. const run = (effect4) => {
  667. if (effect4.options.onTrigger) {
  668. effect4.options.onTrigger({
  669. effect: effect4,
  670. target,
  671. key,
  672. type,
  673. newValue,
  674. oldValue,
  675. oldTarget
  676. });
  677. }
  678. if (effect4.options.scheduler) {
  679. effect4.options.scheduler(effect4);
  680. } else {
  681. effect4();
  682. }
  683. };
  684. effects.forEach(run);
  685. }
  686. var isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
  687. var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(shared.isSymbol));
  688. var get2 = /* @__PURE__ */ createGetter();
  689. var shallowGet = /* @__PURE__ */ createGetter(false, true);
  690. var readonlyGet = /* @__PURE__ */ createGetter(true);
  691. var shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
  692. var arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  693. function createArrayInstrumentations() {
  694. const instrumentations = {};
  695. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  696. instrumentations[key] = function(...args) {
  697. const arr = toRaw2(this);
  698. for (let i = 0, l = this.length; i < l; i++) {
  699. track(arr, "get", i + "");
  700. }
  701. const res = arr[key](...args);
  702. if (res === -1 || res === false) {
  703. return arr[key](...args.map(toRaw2));
  704. } else {
  705. return res;
  706. }
  707. };
  708. });
  709. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  710. instrumentations[key] = function(...args) {
  711. pauseTracking();
  712. const res = toRaw2(this)[key].apply(this, args);
  713. resetTracking();
  714. return res;
  715. };
  716. });
  717. return instrumentations;
  718. }
  719. function createGetter(isReadonly2 = false, shallow = false) {
  720. return function get3(target, key, receiver) {
  721. if (key === "__v_isReactive") {
  722. return !isReadonly2;
  723. } else if (key === "__v_isReadonly") {
  724. return isReadonly2;
  725. } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
  726. return target;
  727. }
  728. const targetIsArray = shared.isArray(target);
  729. if (!isReadonly2 && targetIsArray && shared.hasOwn(arrayInstrumentations, key)) {
  730. return Reflect.get(arrayInstrumentations, key, receiver);
  731. }
  732. const res = Reflect.get(target, key, receiver);
  733. if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  734. return res;
  735. }
  736. if (!isReadonly2) {
  737. track(target, "get", key);
  738. }
  739. if (shallow) {
  740. return res;
  741. }
  742. if (isRef(res)) {
  743. const shouldUnwrap = !targetIsArray || !shared.isIntegerKey(key);
  744. return shouldUnwrap ? res.value : res;
  745. }
  746. if (shared.isObject(res)) {
  747. return isReadonly2 ? readonly(res) : reactive3(res);
  748. }
  749. return res;
  750. };
  751. }
  752. var set2 = /* @__PURE__ */ createSetter();
  753. var shallowSet = /* @__PURE__ */ createSetter(true);
  754. function createSetter(shallow = false) {
  755. return function set3(target, key, value, receiver) {
  756. let oldValue = target[key];
  757. if (!shallow) {
  758. value = toRaw2(value);
  759. oldValue = toRaw2(oldValue);
  760. if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
  761. oldValue.value = value;
  762. return true;
  763. }
  764. }
  765. const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
  766. const result = Reflect.set(target, key, value, receiver);
  767. if (target === toRaw2(receiver)) {
  768. if (!hadKey) {
  769. trigger(target, "add", key, value);
  770. } else if (shared.hasChanged(value, oldValue)) {
  771. trigger(target, "set", key, value, oldValue);
  772. }
  773. }
  774. return result;
  775. };
  776. }
  777. function deleteProperty(target, key) {
  778. const hadKey = shared.hasOwn(target, key);
  779. const oldValue = target[key];
  780. const result = Reflect.deleteProperty(target, key);
  781. if (result && hadKey) {
  782. trigger(target, "delete", key, void 0, oldValue);
  783. }
  784. return result;
  785. }
  786. function has(target, key) {
  787. const result = Reflect.has(target, key);
  788. if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
  789. track(target, "has", key);
  790. }
  791. return result;
  792. }
  793. function ownKeys(target) {
  794. track(target, "iterate", shared.isArray(target) ? "length" : ITERATE_KEY);
  795. return Reflect.ownKeys(target);
  796. }
  797. var mutableHandlers = {
  798. get: get2,
  799. set: set2,
  800. deleteProperty,
  801. has,
  802. ownKeys
  803. };
  804. var readonlyHandlers = {
  805. get: readonlyGet,
  806. set(target, key) {
  807. {
  808. console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
  809. }
  810. return true;
  811. },
  812. deleteProperty(target, key) {
  813. {
  814. console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
  815. }
  816. return true;
  817. }
  818. };
  819. var shallowReactiveHandlers = /* @__PURE__ */ shared.extend({}, mutableHandlers, {
  820. get: shallowGet,
  821. set: shallowSet
  822. });
  823. var shallowReadonlyHandlers = /* @__PURE__ */ shared.extend({}, readonlyHandlers, {
  824. get: shallowReadonlyGet
  825. });
  826. var toReactive = (value) => shared.isObject(value) ? reactive3(value) : value;
  827. var toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
  828. var toShallow = (value) => value;
  829. var getProto = (v) => Reflect.getPrototypeOf(v);
  830. function get$1(target, key, isReadonly2 = false, isShallow = false) {
  831. target = target[
  832. "__v_raw"
  833. /* RAW */
  834. ];
  835. const rawTarget = toRaw2(target);
  836. const rawKey = toRaw2(key);
  837. if (key !== rawKey) {
  838. !isReadonly2 && track(rawTarget, "get", key);
  839. }
  840. !isReadonly2 && track(rawTarget, "get", rawKey);
  841. const { has: has2 } = getProto(rawTarget);
  842. const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
  843. if (has2.call(rawTarget, key)) {
  844. return wrap(target.get(key));
  845. } else if (has2.call(rawTarget, rawKey)) {
  846. return wrap(target.get(rawKey));
  847. } else if (target !== rawTarget) {
  848. target.get(key);
  849. }
  850. }
  851. function has$1(key, isReadonly2 = false) {
  852. const target = this[
  853. "__v_raw"
  854. /* RAW */
  855. ];
  856. const rawTarget = toRaw2(target);
  857. const rawKey = toRaw2(key);
  858. if (key !== rawKey) {
  859. !isReadonly2 && track(rawTarget, "has", key);
  860. }
  861. !isReadonly2 && track(rawTarget, "has", rawKey);
  862. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  863. }
  864. function size(target, isReadonly2 = false) {
  865. target = target[
  866. "__v_raw"
  867. /* RAW */
  868. ];
  869. !isReadonly2 && track(toRaw2(target), "iterate", ITERATE_KEY);
  870. return Reflect.get(target, "size", target);
  871. }
  872. function add(value) {
  873. value = toRaw2(value);
  874. const target = toRaw2(this);
  875. const proto = getProto(target);
  876. const hadKey = proto.has.call(target, value);
  877. if (!hadKey) {
  878. target.add(value);
  879. trigger(target, "add", value, value);
  880. }
  881. return this;
  882. }
  883. function set$1(key, value) {
  884. value = toRaw2(value);
  885. const target = toRaw2(this);
  886. const { has: has2, get: get3 } = getProto(target);
  887. let hadKey = has2.call(target, key);
  888. if (!hadKey) {
  889. key = toRaw2(key);
  890. hadKey = has2.call(target, key);
  891. } else {
  892. checkIdentityKeys(target, has2, key);
  893. }
  894. const oldValue = get3.call(target, key);
  895. target.set(key, value);
  896. if (!hadKey) {
  897. trigger(target, "add", key, value);
  898. } else if (shared.hasChanged(value, oldValue)) {
  899. trigger(target, "set", key, value, oldValue);
  900. }
  901. return this;
  902. }
  903. function deleteEntry(key) {
  904. const target = toRaw2(this);
  905. const { has: has2, get: get3 } = getProto(target);
  906. let hadKey = has2.call(target, key);
  907. if (!hadKey) {
  908. key = toRaw2(key);
  909. hadKey = has2.call(target, key);
  910. } else {
  911. checkIdentityKeys(target, has2, key);
  912. }
  913. const oldValue = get3 ? get3.call(target, key) : void 0;
  914. const result = target.delete(key);
  915. if (hadKey) {
  916. trigger(target, "delete", key, void 0, oldValue);
  917. }
  918. return result;
  919. }
  920. function clear() {
  921. const target = toRaw2(this);
  922. const hadItems = target.size !== 0;
  923. const oldTarget = shared.isMap(target) ? new Map(target) : new Set(target);
  924. const result = target.clear();
  925. if (hadItems) {
  926. trigger(target, "clear", void 0, void 0, oldTarget);
  927. }
  928. return result;
  929. }
  930. function createForEach(isReadonly2, isShallow) {
  931. return function forEach(callback, thisArg) {
  932. const observed = this;
  933. const target = observed[
  934. "__v_raw"
  935. /* RAW */
  936. ];
  937. const rawTarget = toRaw2(target);
  938. const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
  939. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  940. return target.forEach((value, key) => {
  941. return callback.call(thisArg, wrap(value), wrap(key), observed);
  942. });
  943. };
  944. }
  945. function createIterableMethod(method, isReadonly2, isShallow) {
  946. return function(...args) {
  947. const target = this[
  948. "__v_raw"
  949. /* RAW */
  950. ];
  951. const rawTarget = toRaw2(target);
  952. const targetIsMap = shared.isMap(rawTarget);
  953. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  954. const isKeyOnly = method === "keys" && targetIsMap;
  955. const innerIterator = target[method](...args);
  956. const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
  957. !isReadonly2 && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
  958. return {
  959. // iterator protocol
  960. next() {
  961. const { value, done } = innerIterator.next();
  962. return done ? { value, done } : {
  963. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  964. done
  965. };
  966. },
  967. // iterable protocol
  968. [Symbol.iterator]() {
  969. return this;
  970. }
  971. };
  972. };
  973. }
  974. function createReadonlyMethod(type) {
  975. return function(...args) {
  976. {
  977. const key = args[0] ? `on key "${args[0]}" ` : ``;
  978. console.warn(`${shared.capitalize(type)} operation ${key}failed: target is readonly.`, toRaw2(this));
  979. }
  980. return type === "delete" ? false : this;
  981. };
  982. }
  983. function createInstrumentations() {
  984. const mutableInstrumentations2 = {
  985. get(key) {
  986. return get$1(this, key);
  987. },
  988. get size() {
  989. return size(this);
  990. },
  991. has: has$1,
  992. add,
  993. set: set$1,
  994. delete: deleteEntry,
  995. clear,
  996. forEach: createForEach(false, false)
  997. };
  998. const shallowInstrumentations2 = {
  999. get(key) {
  1000. return get$1(this, key, false, true);
  1001. },
  1002. get size() {
  1003. return size(this);
  1004. },
  1005. has: has$1,
  1006. add,
  1007. set: set$1,
  1008. delete: deleteEntry,
  1009. clear,
  1010. forEach: createForEach(false, true)
  1011. };
  1012. const readonlyInstrumentations2 = {
  1013. get(key) {
  1014. return get$1(this, key, true);
  1015. },
  1016. get size() {
  1017. return size(this, true);
  1018. },
  1019. has(key) {
  1020. return has$1.call(this, key, true);
  1021. },
  1022. add: createReadonlyMethod(
  1023. "add"
  1024. /* ADD */
  1025. ),
  1026. set: createReadonlyMethod(
  1027. "set"
  1028. /* SET */
  1029. ),
  1030. delete: createReadonlyMethod(
  1031. "delete"
  1032. /* DELETE */
  1033. ),
  1034. clear: createReadonlyMethod(
  1035. "clear"
  1036. /* CLEAR */
  1037. ),
  1038. forEach: createForEach(true, false)
  1039. };
  1040. const shallowReadonlyInstrumentations2 = {
  1041. get(key) {
  1042. return get$1(this, key, true, true);
  1043. },
  1044. get size() {
  1045. return size(this, true);
  1046. },
  1047. has(key) {
  1048. return has$1.call(this, key, true);
  1049. },
  1050. add: createReadonlyMethod(
  1051. "add"
  1052. /* ADD */
  1053. ),
  1054. set: createReadonlyMethod(
  1055. "set"
  1056. /* SET */
  1057. ),
  1058. delete: createReadonlyMethod(
  1059. "delete"
  1060. /* DELETE */
  1061. ),
  1062. clear: createReadonlyMethod(
  1063. "clear"
  1064. /* CLEAR */
  1065. ),
  1066. forEach: createForEach(true, true)
  1067. };
  1068. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  1069. iteratorMethods.forEach((method) => {
  1070. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  1071. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  1072. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  1073. shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true);
  1074. });
  1075. return [
  1076. mutableInstrumentations2,
  1077. readonlyInstrumentations2,
  1078. shallowInstrumentations2,
  1079. shallowReadonlyInstrumentations2
  1080. ];
  1081. }
  1082. var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */ createInstrumentations();
  1083. function createInstrumentationGetter(isReadonly2, shallow) {
  1084. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  1085. return (target, key, receiver) => {
  1086. if (key === "__v_isReactive") {
  1087. return !isReadonly2;
  1088. } else if (key === "__v_isReadonly") {
  1089. return isReadonly2;
  1090. } else if (key === "__v_raw") {
  1091. return target;
  1092. }
  1093. return Reflect.get(shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
  1094. };
  1095. }
  1096. var mutableCollectionHandlers = {
  1097. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1098. };
  1099. var shallowCollectionHandlers = {
  1100. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1101. };
  1102. var readonlyCollectionHandlers = {
  1103. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1104. };
  1105. var shallowReadonlyCollectionHandlers = {
  1106. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1107. };
  1108. function checkIdentityKeys(target, has2, key) {
  1109. const rawKey = toRaw2(key);
  1110. if (rawKey !== key && has2.call(target, rawKey)) {
  1111. const type = shared.toRawType(target);
  1112. 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.`);
  1113. }
  1114. }
  1115. var reactiveMap = /* @__PURE__ */ new WeakMap();
  1116. var shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1117. var readonlyMap = /* @__PURE__ */ new WeakMap();
  1118. var shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1119. function targetTypeMap(rawType) {
  1120. switch (rawType) {
  1121. case "Object":
  1122. case "Array":
  1123. return 1;
  1124. case "Map":
  1125. case "Set":
  1126. case "WeakMap":
  1127. case "WeakSet":
  1128. return 2;
  1129. default:
  1130. return 0;
  1131. }
  1132. }
  1133. function getTargetType(value) {
  1134. return value[
  1135. "__v_skip"
  1136. /* SKIP */
  1137. ] || !Object.isExtensible(value) ? 0 : targetTypeMap(shared.toRawType(value));
  1138. }
  1139. function reactive3(target) {
  1140. if (target && target[
  1141. "__v_isReadonly"
  1142. /* IS_READONLY */
  1143. ]) {
  1144. return target;
  1145. }
  1146. return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
  1147. }
  1148. function shallowReactive(target) {
  1149. return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
  1150. }
  1151. function readonly(target) {
  1152. return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
  1153. }
  1154. function shallowReadonly(target) {
  1155. return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
  1156. }
  1157. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1158. if (!shared.isObject(target)) {
  1159. {
  1160. console.warn(`value cannot be made reactive: ${String(target)}`);
  1161. }
  1162. return target;
  1163. }
  1164. if (target[
  1165. "__v_raw"
  1166. /* RAW */
  1167. ] && !(isReadonly2 && target[
  1168. "__v_isReactive"
  1169. /* IS_REACTIVE */
  1170. ])) {
  1171. return target;
  1172. }
  1173. const existingProxy = proxyMap.get(target);
  1174. if (existingProxy) {
  1175. return existingProxy;
  1176. }
  1177. const targetType = getTargetType(target);
  1178. if (targetType === 0) {
  1179. return target;
  1180. }
  1181. const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
  1182. proxyMap.set(target, proxy);
  1183. return proxy;
  1184. }
  1185. function isReactive2(value) {
  1186. if (isReadonly(value)) {
  1187. return isReactive2(value[
  1188. "__v_raw"
  1189. /* RAW */
  1190. ]);
  1191. }
  1192. return !!(value && value[
  1193. "__v_isReactive"
  1194. /* IS_REACTIVE */
  1195. ]);
  1196. }
  1197. function isReadonly(value) {
  1198. return !!(value && value[
  1199. "__v_isReadonly"
  1200. /* IS_READONLY */
  1201. ]);
  1202. }
  1203. function isProxy(value) {
  1204. return isReactive2(value) || isReadonly(value);
  1205. }
  1206. function toRaw2(observed) {
  1207. return observed && toRaw2(observed[
  1208. "__v_raw"
  1209. /* RAW */
  1210. ]) || observed;
  1211. }
  1212. function markRaw(value) {
  1213. shared.def(value, "__v_skip", true);
  1214. return value;
  1215. }
  1216. var convert = (val) => shared.isObject(val) ? reactive3(val) : val;
  1217. function isRef(r) {
  1218. return Boolean(r && r.__v_isRef === true);
  1219. }
  1220. function ref(value) {
  1221. return createRef(value);
  1222. }
  1223. function shallowRef(value) {
  1224. return createRef(value, true);
  1225. }
  1226. var RefImpl = class {
  1227. constructor(value, _shallow = false) {
  1228. this._shallow = _shallow;
  1229. this.__v_isRef = true;
  1230. this._rawValue = _shallow ? value : toRaw2(value);
  1231. this._value = _shallow ? value : convert(value);
  1232. }
  1233. get value() {
  1234. track(toRaw2(this), "get", "value");
  1235. return this._value;
  1236. }
  1237. set value(newVal) {
  1238. newVal = this._shallow ? newVal : toRaw2(newVal);
  1239. if (shared.hasChanged(newVal, this._rawValue)) {
  1240. this._rawValue = newVal;
  1241. this._value = this._shallow ? newVal : convert(newVal);
  1242. trigger(toRaw2(this), "set", "value", newVal);
  1243. }
  1244. }
  1245. };
  1246. function createRef(rawValue, shallow = false) {
  1247. if (isRef(rawValue)) {
  1248. return rawValue;
  1249. }
  1250. return new RefImpl(rawValue, shallow);
  1251. }
  1252. function triggerRef(ref2) {
  1253. trigger(toRaw2(ref2), "set", "value", ref2.value);
  1254. }
  1255. function unref(ref2) {
  1256. return isRef(ref2) ? ref2.value : ref2;
  1257. }
  1258. var shallowUnwrapHandlers = {
  1259. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1260. set: (target, key, value, receiver) => {
  1261. const oldValue = target[key];
  1262. if (isRef(oldValue) && !isRef(value)) {
  1263. oldValue.value = value;
  1264. return true;
  1265. } else {
  1266. return Reflect.set(target, key, value, receiver);
  1267. }
  1268. }
  1269. };
  1270. function proxyRefs(objectWithRefs) {
  1271. return isReactive2(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1272. }
  1273. var CustomRefImpl = class {
  1274. constructor(factory) {
  1275. this.__v_isRef = true;
  1276. const { get: get3, set: set3 } = factory(() => track(this, "get", "value"), () => trigger(this, "set", "value"));
  1277. this._get = get3;
  1278. this._set = set3;
  1279. }
  1280. get value() {
  1281. return this._get();
  1282. }
  1283. set value(newVal) {
  1284. this._set(newVal);
  1285. }
  1286. };
  1287. function customRef(factory) {
  1288. return new CustomRefImpl(factory);
  1289. }
  1290. function toRefs(object) {
  1291. if (!isProxy(object)) {
  1292. console.warn(`toRefs() expects a reactive object but received a plain one.`);
  1293. }
  1294. const ret = shared.isArray(object) ? new Array(object.length) : {};
  1295. for (const key in object) {
  1296. ret[key] = toRef(object, key);
  1297. }
  1298. return ret;
  1299. }
  1300. var ObjectRefImpl = class {
  1301. constructor(_object, _key) {
  1302. this._object = _object;
  1303. this._key = _key;
  1304. this.__v_isRef = true;
  1305. }
  1306. get value() {
  1307. return this._object[this._key];
  1308. }
  1309. set value(newVal) {
  1310. this._object[this._key] = newVal;
  1311. }
  1312. };
  1313. function toRef(object, key) {
  1314. return isRef(object[key]) ? object[key] : new ObjectRefImpl(object, key);
  1315. }
  1316. var ComputedRefImpl = class {
  1317. constructor(getter, _setter, isReadonly2) {
  1318. this._setter = _setter;
  1319. this._dirty = true;
  1320. this.__v_isRef = true;
  1321. this.effect = effect3(getter, {
  1322. lazy: true,
  1323. scheduler: () => {
  1324. if (!this._dirty) {
  1325. this._dirty = true;
  1326. trigger(toRaw2(this), "set", "value");
  1327. }
  1328. }
  1329. });
  1330. this[
  1331. "__v_isReadonly"
  1332. /* IS_READONLY */
  1333. ] = isReadonly2;
  1334. }
  1335. get value() {
  1336. const self2 = toRaw2(this);
  1337. if (self2._dirty) {
  1338. self2._value = this.effect();
  1339. self2._dirty = false;
  1340. }
  1341. track(self2, "get", "value");
  1342. return self2._value;
  1343. }
  1344. set value(newValue) {
  1345. this._setter(newValue);
  1346. }
  1347. };
  1348. function computed(getterOrOptions) {
  1349. let getter;
  1350. let setter;
  1351. if (shared.isFunction(getterOrOptions)) {
  1352. getter = getterOrOptions;
  1353. setter = () => {
  1354. console.warn("Write operation failed: computed value is readonly");
  1355. };
  1356. } else {
  1357. getter = getterOrOptions.get;
  1358. setter = getterOrOptions.set;
  1359. }
  1360. return new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
  1361. }
  1362. exports.ITERATE_KEY = ITERATE_KEY;
  1363. exports.computed = computed;
  1364. exports.customRef = customRef;
  1365. exports.effect = effect3;
  1366. exports.enableTracking = enableTracking;
  1367. exports.isProxy = isProxy;
  1368. exports.isReactive = isReactive2;
  1369. exports.isReadonly = isReadonly;
  1370. exports.isRef = isRef;
  1371. exports.markRaw = markRaw;
  1372. exports.pauseTracking = pauseTracking;
  1373. exports.proxyRefs = proxyRefs;
  1374. exports.reactive = reactive3;
  1375. exports.readonly = readonly;
  1376. exports.ref = ref;
  1377. exports.resetTracking = resetTracking;
  1378. exports.shallowReactive = shallowReactive;
  1379. exports.shallowReadonly = shallowReadonly;
  1380. exports.shallowRef = shallowRef;
  1381. exports.stop = stop2;
  1382. exports.toRaw = toRaw2;
  1383. exports.toRef = toRef;
  1384. exports.toRefs = toRefs;
  1385. exports.track = track;
  1386. exports.trigger = trigger;
  1387. exports.triggerRef = triggerRef;
  1388. exports.unref = unref;
  1389. }
  1390. });
  1391. // node_modules/@vue/reactivity/index.js
  1392. var require_reactivity = __commonJS({
  1393. "node_modules/@vue/reactivity/index.js"(exports, module2) {
  1394. "use strict";
  1395. if (false) {
  1396. module2.exports = null;
  1397. } else {
  1398. module2.exports = require_reactivity_cjs();
  1399. }
  1400. }
  1401. });
  1402. // packages/alpinejs/builds/module.js
  1403. var module_exports = {};
  1404. __export(module_exports, {
  1405. default: () => module_default
  1406. });
  1407. module.exports = __toCommonJS(module_exports);
  1408. // packages/alpinejs/src/scheduler.js
  1409. var flushPending = false;
  1410. var flushing = false;
  1411. var queue = [];
  1412. var lastFlushedIndex = -1;
  1413. function scheduler(callback) {
  1414. queueJob(callback);
  1415. }
  1416. function queueJob(job) {
  1417. if (!queue.includes(job))
  1418. queue.push(job);
  1419. queueFlush();
  1420. }
  1421. function dequeueJob(job) {
  1422. let index = queue.indexOf(job);
  1423. if (index !== -1 && index > lastFlushedIndex)
  1424. queue.splice(index, 1);
  1425. }
  1426. function queueFlush() {
  1427. if (!flushing && !flushPending) {
  1428. flushPending = true;
  1429. queueMicrotask(flushJobs);
  1430. }
  1431. }
  1432. function flushJobs() {
  1433. flushPending = false;
  1434. flushing = true;
  1435. for (let i = 0; i < queue.length; i++) {
  1436. queue[i]();
  1437. lastFlushedIndex = i;
  1438. }
  1439. queue.length = 0;
  1440. lastFlushedIndex = -1;
  1441. flushing = false;
  1442. }
  1443. // packages/alpinejs/src/reactivity.js
  1444. var reactive;
  1445. var effect;
  1446. var release;
  1447. var raw;
  1448. var shouldSchedule = true;
  1449. function disableEffectScheduling(callback) {
  1450. shouldSchedule = false;
  1451. callback();
  1452. shouldSchedule = true;
  1453. }
  1454. function setReactivityEngine(engine) {
  1455. reactive = engine.reactive;
  1456. release = engine.release;
  1457. effect = (callback) => engine.effect(callback, { scheduler: (task) => {
  1458. if (shouldSchedule) {
  1459. scheduler(task);
  1460. } else {
  1461. task();
  1462. }
  1463. } });
  1464. raw = engine.raw;
  1465. }
  1466. function overrideEffect(override) {
  1467. effect = override;
  1468. }
  1469. function elementBoundEffect(el) {
  1470. let cleanup = () => {
  1471. };
  1472. let wrappedEffect = (callback) => {
  1473. let effectReference = effect(callback);
  1474. if (!el._x_effects) {
  1475. el._x_effects = /* @__PURE__ */ new Set();
  1476. el._x_runEffects = () => {
  1477. el._x_effects.forEach((i) => i());
  1478. };
  1479. }
  1480. el._x_effects.add(effectReference);
  1481. cleanup = () => {
  1482. if (effectReference === void 0)
  1483. return;
  1484. el._x_effects.delete(effectReference);
  1485. release(effectReference);
  1486. };
  1487. return effectReference;
  1488. };
  1489. return [wrappedEffect, () => {
  1490. cleanup();
  1491. }];
  1492. }
  1493. // packages/alpinejs/src/utils/dispatch.js
  1494. function dispatch(el, name, detail = {}) {
  1495. el.dispatchEvent(
  1496. new CustomEvent(name, {
  1497. detail,
  1498. bubbles: true,
  1499. // Allows events to pass the shadow DOM barrier.
  1500. composed: true,
  1501. cancelable: true
  1502. })
  1503. );
  1504. }
  1505. // packages/alpinejs/src/utils/walk.js
  1506. function walk(el, callback) {
  1507. if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) {
  1508. Array.from(el.children).forEach((el2) => walk(el2, callback));
  1509. return;
  1510. }
  1511. let skip = false;
  1512. callback(el, () => skip = true);
  1513. if (skip)
  1514. return;
  1515. let node = el.firstElementChild;
  1516. while (node) {
  1517. walk(node, callback, false);
  1518. node = node.nextElementSibling;
  1519. }
  1520. }
  1521. // packages/alpinejs/src/utils/warn.js
  1522. function warn(message, ...args) {
  1523. console.warn(`Alpine Warning: ${message}`, ...args);
  1524. }
  1525. // packages/alpinejs/src/lifecycle.js
  1526. var started = false;
  1527. function start() {
  1528. if (started)
  1529. warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems.");
  1530. started = true;
  1531. if (!document.body)
  1532. warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?");
  1533. dispatch(document, "alpine:init");
  1534. dispatch(document, "alpine:initializing");
  1535. startObservingMutations();
  1536. onElAdded((el) => initTree(el, walk));
  1537. onElRemoved((el) => destroyTree(el));
  1538. onAttributesAdded((el, attrs) => {
  1539. directives(el, attrs).forEach((handle) => handle());
  1540. });
  1541. let outNestedComponents = (el) => !closestRoot(el.parentElement, true);
  1542. Array.from(document.querySelectorAll(allSelectors())).filter(outNestedComponents).forEach((el) => {
  1543. initTree(el);
  1544. });
  1545. dispatch(document, "alpine:initialized");
  1546. }
  1547. var rootSelectorCallbacks = [];
  1548. var initSelectorCallbacks = [];
  1549. function rootSelectors() {
  1550. return rootSelectorCallbacks.map((fn) => fn());
  1551. }
  1552. function allSelectors() {
  1553. return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn) => fn());
  1554. }
  1555. function addRootSelector(selectorCallback) {
  1556. rootSelectorCallbacks.push(selectorCallback);
  1557. }
  1558. function addInitSelector(selectorCallback) {
  1559. initSelectorCallbacks.push(selectorCallback);
  1560. }
  1561. function closestRoot(el, includeInitSelectors = false) {
  1562. return findClosest(el, (element) => {
  1563. const selectors = includeInitSelectors ? allSelectors() : rootSelectors();
  1564. if (selectors.some((selector) => element.matches(selector)))
  1565. return true;
  1566. });
  1567. }
  1568. function findClosest(el, callback) {
  1569. if (!el)
  1570. return;
  1571. if (callback(el))
  1572. return el;
  1573. if (el._x_teleportBack)
  1574. el = el._x_teleportBack;
  1575. if (!el.parentElement)
  1576. return;
  1577. return findClosest(el.parentElement, callback);
  1578. }
  1579. function isRoot(el) {
  1580. return rootSelectors().some((selector) => el.matches(selector));
  1581. }
  1582. var initInterceptors = [];
  1583. function interceptInit(callback) {
  1584. initInterceptors.push(callback);
  1585. }
  1586. function initTree(el, walker = walk, intercept = () => {
  1587. }) {
  1588. deferHandlingDirectives(() => {
  1589. walker(el, (el2, skip) => {
  1590. intercept(el2, skip);
  1591. initInterceptors.forEach((i) => i(el2, skip));
  1592. directives(el2, el2.attributes).forEach((handle) => handle());
  1593. el2._x_ignore && skip();
  1594. });
  1595. });
  1596. }
  1597. function destroyTree(root) {
  1598. walk(root, (el) => {
  1599. cleanupAttributes(el);
  1600. cleanupElement(el);
  1601. });
  1602. }
  1603. // packages/alpinejs/src/mutation.js
  1604. var onAttributeAddeds = [];
  1605. var onElRemoveds = [];
  1606. var onElAddeds = [];
  1607. function onElAdded(callback) {
  1608. onElAddeds.push(callback);
  1609. }
  1610. function onElRemoved(el, callback) {
  1611. if (typeof callback === "function") {
  1612. if (!el._x_cleanups)
  1613. el._x_cleanups = [];
  1614. el._x_cleanups.push(callback);
  1615. } else {
  1616. callback = el;
  1617. onElRemoveds.push(callback);
  1618. }
  1619. }
  1620. function onAttributesAdded(callback) {
  1621. onAttributeAddeds.push(callback);
  1622. }
  1623. function onAttributeRemoved(el, name, callback) {
  1624. if (!el._x_attributeCleanups)
  1625. el._x_attributeCleanups = {};
  1626. if (!el._x_attributeCleanups[name])
  1627. el._x_attributeCleanups[name] = [];
  1628. el._x_attributeCleanups[name].push(callback);
  1629. }
  1630. function cleanupAttributes(el, names) {
  1631. if (!el._x_attributeCleanups)
  1632. return;
  1633. Object.entries(el._x_attributeCleanups).forEach(([name, value]) => {
  1634. if (names === void 0 || names.includes(name)) {
  1635. value.forEach((i) => i());
  1636. delete el._x_attributeCleanups[name];
  1637. }
  1638. });
  1639. }
  1640. function cleanupElement(el) {
  1641. if (el._x_cleanups) {
  1642. while (el._x_cleanups.length)
  1643. el._x_cleanups.pop()();
  1644. }
  1645. }
  1646. var observer = new MutationObserver(onMutate);
  1647. var currentlyObserving = false;
  1648. function startObservingMutations() {
  1649. observer.observe(document, { subtree: true, childList: true, attributes: true, attributeOldValue: true });
  1650. currentlyObserving = true;
  1651. }
  1652. function stopObservingMutations() {
  1653. flushObserver();
  1654. observer.disconnect();
  1655. currentlyObserving = false;
  1656. }
  1657. var recordQueue = [];
  1658. var willProcessRecordQueue = false;
  1659. function flushObserver() {
  1660. recordQueue = recordQueue.concat(observer.takeRecords());
  1661. if (recordQueue.length && !willProcessRecordQueue) {
  1662. willProcessRecordQueue = true;
  1663. queueMicrotask(() => {
  1664. processRecordQueue();
  1665. willProcessRecordQueue = false;
  1666. });
  1667. }
  1668. }
  1669. function processRecordQueue() {
  1670. onMutate(recordQueue);
  1671. recordQueue.length = 0;
  1672. }
  1673. function mutateDom(callback) {
  1674. if (!currentlyObserving)
  1675. return callback();
  1676. stopObservingMutations();
  1677. let result = callback();
  1678. startObservingMutations();
  1679. return result;
  1680. }
  1681. var isCollecting = false;
  1682. var deferredMutations = [];
  1683. function deferMutations() {
  1684. isCollecting = true;
  1685. }
  1686. function flushAndStopDeferringMutations() {
  1687. isCollecting = false;
  1688. onMutate(deferredMutations);
  1689. deferredMutations = [];
  1690. }
  1691. function onMutate(mutations) {
  1692. if (isCollecting) {
  1693. deferredMutations = deferredMutations.concat(mutations);
  1694. return;
  1695. }
  1696. let addedNodes = [];
  1697. let removedNodes = [];
  1698. let addedAttributes = /* @__PURE__ */ new Map();
  1699. let removedAttributes = /* @__PURE__ */ new Map();
  1700. for (let i = 0; i < mutations.length; i++) {
  1701. if (mutations[i].target._x_ignoreMutationObserver)
  1702. continue;
  1703. if (mutations[i].type === "childList") {
  1704. mutations[i].addedNodes.forEach((node) => node.nodeType === 1 && addedNodes.push(node));
  1705. mutations[i].removedNodes.forEach((node) => node.nodeType === 1 && removedNodes.push(node));
  1706. }
  1707. if (mutations[i].type === "attributes") {
  1708. let el = mutations[i].target;
  1709. let name = mutations[i].attributeName;
  1710. let oldValue = mutations[i].oldValue;
  1711. let add = () => {
  1712. if (!addedAttributes.has(el))
  1713. addedAttributes.set(el, []);
  1714. addedAttributes.get(el).push({ name, value: el.getAttribute(name) });
  1715. };
  1716. let remove = () => {
  1717. if (!removedAttributes.has(el))
  1718. removedAttributes.set(el, []);
  1719. removedAttributes.get(el).push(name);
  1720. };
  1721. if (el.hasAttribute(name) && oldValue === null) {
  1722. add();
  1723. } else if (el.hasAttribute(name)) {
  1724. remove();
  1725. add();
  1726. } else {
  1727. remove();
  1728. }
  1729. }
  1730. }
  1731. removedAttributes.forEach((attrs, el) => {
  1732. cleanupAttributes(el, attrs);
  1733. });
  1734. addedAttributes.forEach((attrs, el) => {
  1735. onAttributeAddeds.forEach((i) => i(el, attrs));
  1736. });
  1737. for (let node of removedNodes) {
  1738. if (addedNodes.includes(node))
  1739. continue;
  1740. onElRemoveds.forEach((i) => i(node));
  1741. destroyTree(node);
  1742. }
  1743. addedNodes.forEach((node) => {
  1744. node._x_ignoreSelf = true;
  1745. node._x_ignore = true;
  1746. });
  1747. for (let node of addedNodes) {
  1748. if (removedNodes.includes(node))
  1749. continue;
  1750. if (!node.isConnected)
  1751. continue;
  1752. delete node._x_ignoreSelf;
  1753. delete node._x_ignore;
  1754. onElAddeds.forEach((i) => i(node));
  1755. node._x_ignore = true;
  1756. node._x_ignoreSelf = true;
  1757. }
  1758. addedNodes.forEach((node) => {
  1759. delete node._x_ignoreSelf;
  1760. delete node._x_ignore;
  1761. });
  1762. addedNodes = null;
  1763. removedNodes = null;
  1764. addedAttributes = null;
  1765. removedAttributes = null;
  1766. }
  1767. // packages/alpinejs/src/scope.js
  1768. function scope(node) {
  1769. return mergeProxies(closestDataStack(node));
  1770. }
  1771. function addScopeToNode(node, data2, referenceNode) {
  1772. node._x_dataStack = [data2, ...closestDataStack(referenceNode || node)];
  1773. return () => {
  1774. node._x_dataStack = node._x_dataStack.filter((i) => i !== data2);
  1775. };
  1776. }
  1777. function closestDataStack(node) {
  1778. if (node._x_dataStack)
  1779. return node._x_dataStack;
  1780. if (typeof ShadowRoot === "function" && node instanceof ShadowRoot) {
  1781. return closestDataStack(node.host);
  1782. }
  1783. if (!node.parentNode) {
  1784. return [];
  1785. }
  1786. return closestDataStack(node.parentNode);
  1787. }
  1788. function mergeProxies(objects) {
  1789. let thisProxy = new Proxy({}, {
  1790. ownKeys: () => {
  1791. return Array.from(new Set(objects.flatMap((i) => Object.keys(i))));
  1792. },
  1793. has: (target, name) => {
  1794. return objects.some((obj) => obj.hasOwnProperty(name));
  1795. },
  1796. get: (target, name) => {
  1797. return (objects.find((obj) => {
  1798. if (obj.hasOwnProperty(name)) {
  1799. let descriptor = Object.getOwnPropertyDescriptor(obj, name);
  1800. if (descriptor.get && descriptor.get._x_alreadyBound || descriptor.set && descriptor.set._x_alreadyBound) {
  1801. return true;
  1802. }
  1803. if ((descriptor.get || descriptor.set) && descriptor.enumerable) {
  1804. let getter = descriptor.get;
  1805. let setter = descriptor.set;
  1806. let property = descriptor;
  1807. getter = getter && getter.bind(thisProxy);
  1808. setter = setter && setter.bind(thisProxy);
  1809. if (getter)
  1810. getter._x_alreadyBound = true;
  1811. if (setter)
  1812. setter._x_alreadyBound = true;
  1813. Object.defineProperty(obj, name, {
  1814. ...property,
  1815. get: getter,
  1816. set: setter
  1817. });
  1818. }
  1819. return true;
  1820. }
  1821. return false;
  1822. }) || {})[name];
  1823. },
  1824. set: (target, name, value) => {
  1825. let closestObjectWithKey = objects.find((obj) => obj.hasOwnProperty(name));
  1826. if (closestObjectWithKey) {
  1827. closestObjectWithKey[name] = value;
  1828. } else {
  1829. objects[objects.length - 1][name] = value;
  1830. }
  1831. return true;
  1832. }
  1833. });
  1834. return thisProxy;
  1835. }
  1836. // packages/alpinejs/src/interceptor.js
  1837. function initInterceptors2(data2) {
  1838. let isObject = (val) => typeof val === "object" && !Array.isArray(val) && val !== null;
  1839. let recurse = (obj, basePath = "") => {
  1840. Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => {
  1841. if (enumerable === false || value === void 0)
  1842. return;
  1843. let path = basePath === "" ? key : `${basePath}.${key}`;
  1844. if (typeof value === "object" && value !== null && value._x_interceptor) {
  1845. obj[key] = value.initialize(data2, path, key);
  1846. } else {
  1847. if (isObject(value) && value !== obj && !(value instanceof Element)) {
  1848. recurse(value, path);
  1849. }
  1850. }
  1851. });
  1852. };
  1853. return recurse(data2);
  1854. }
  1855. function interceptor(callback, mutateObj = () => {
  1856. }) {
  1857. let obj = {
  1858. initialValue: void 0,
  1859. _x_interceptor: true,
  1860. initialize(data2, path, key) {
  1861. return callback(this.initialValue, () => get(data2, path), (value) => set(data2, path, value), path, key);
  1862. }
  1863. };
  1864. mutateObj(obj);
  1865. return (initialValue) => {
  1866. if (typeof initialValue === "object" && initialValue !== null && initialValue._x_interceptor) {
  1867. let initialize = obj.initialize.bind(obj);
  1868. obj.initialize = (data2, path, key) => {
  1869. let innerValue = initialValue.initialize(data2, path, key);
  1870. obj.initialValue = innerValue;
  1871. return initialize(data2, path, key);
  1872. };
  1873. } else {
  1874. obj.initialValue = initialValue;
  1875. }
  1876. return obj;
  1877. };
  1878. }
  1879. function get(obj, path) {
  1880. return path.split(".").reduce((carry, segment) => carry[segment], obj);
  1881. }
  1882. function set(obj, path, value) {
  1883. if (typeof path === "string")
  1884. path = path.split(".");
  1885. if (path.length === 1)
  1886. obj[path[0]] = value;
  1887. else if (path.length === 0)
  1888. throw error;
  1889. else {
  1890. if (obj[path[0]])
  1891. return set(obj[path[0]], path.slice(1), value);
  1892. else {
  1893. obj[path[0]] = {};
  1894. return set(obj[path[0]], path.slice(1), value);
  1895. }
  1896. }
  1897. }
  1898. // packages/alpinejs/src/magics.js
  1899. var magics = {};
  1900. function magic(name, callback) {
  1901. magics[name] = callback;
  1902. }
  1903. function injectMagics(obj, el) {
  1904. Object.entries(magics).forEach(([name, callback]) => {
  1905. let memoizedUtilities = null;
  1906. function getUtilities() {
  1907. if (memoizedUtilities) {
  1908. return memoizedUtilities;
  1909. } else {
  1910. let [utilities, cleanup] = getElementBoundUtilities(el);
  1911. memoizedUtilities = { interceptor, ...utilities };
  1912. onElRemoved(el, cleanup);
  1913. return memoizedUtilities;
  1914. }
  1915. }
  1916. Object.defineProperty(obj, `$${name}`, {
  1917. get() {
  1918. return callback(el, getUtilities());
  1919. },
  1920. enumerable: false
  1921. });
  1922. });
  1923. return obj;
  1924. }
  1925. // packages/alpinejs/src/utils/error.js
  1926. function tryCatch(el, expression, callback, ...args) {
  1927. try {
  1928. return callback(...args);
  1929. } catch (e) {
  1930. handleError(e, el, expression);
  1931. }
  1932. }
  1933. function handleError(error2, el, expression = void 0) {
  1934. Object.assign(error2, { el, expression });
  1935. console.warn(`Alpine Expression Error: ${error2.message}
  1936. ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
  1937. setTimeout(() => {
  1938. throw error2;
  1939. }, 0);
  1940. }
  1941. // packages/alpinejs/src/evaluator.js
  1942. var shouldAutoEvaluateFunctions = true;
  1943. function dontAutoEvaluateFunctions(callback) {
  1944. let cache = shouldAutoEvaluateFunctions;
  1945. shouldAutoEvaluateFunctions = false;
  1946. let result = callback();
  1947. shouldAutoEvaluateFunctions = cache;
  1948. return result;
  1949. }
  1950. function evaluate(el, expression, extras = {}) {
  1951. let result;
  1952. evaluateLater(el, expression)((value) => result = value, extras);
  1953. return result;
  1954. }
  1955. function evaluateLater(...args) {
  1956. return theEvaluatorFunction(...args);
  1957. }
  1958. var theEvaluatorFunction = normalEvaluator;
  1959. function setEvaluator(newEvaluator) {
  1960. theEvaluatorFunction = newEvaluator;
  1961. }
  1962. function normalEvaluator(el, expression) {
  1963. let overriddenMagics = {};
  1964. injectMagics(overriddenMagics, el);
  1965. let dataStack = [overriddenMagics, ...closestDataStack(el)];
  1966. let evaluator = typeof expression === "function" ? generateEvaluatorFromFunction(dataStack, expression) : generateEvaluatorFromString(dataStack, expression, el);
  1967. return tryCatch.bind(null, el, expression, evaluator);
  1968. }
  1969. function generateEvaluatorFromFunction(dataStack, func) {
  1970. return (receiver = () => {
  1971. }, { scope: scope2 = {}, params = [] } = {}) => {
  1972. let result = func.apply(mergeProxies([scope2, ...dataStack]), params);
  1973. runIfTypeOfFunction(receiver, result);
  1974. };
  1975. }
  1976. var evaluatorMemo = {};
  1977. function generateFunctionFromString(expression, el) {
  1978. if (evaluatorMemo[expression]) {
  1979. return evaluatorMemo[expression];
  1980. }
  1981. let AsyncFunction = Object.getPrototypeOf(async function() {
  1982. }).constructor;
  1983. let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression;
  1984. const safeAsyncFunction = () => {
  1985. try {
  1986. return new AsyncFunction(["__self", "scope"], `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;`);
  1987. } catch (error2) {
  1988. handleError(error2, el, expression);
  1989. return Promise.resolve();
  1990. }
  1991. };
  1992. let func = safeAsyncFunction();
  1993. evaluatorMemo[expression] = func;
  1994. return func;
  1995. }
  1996. function generateEvaluatorFromString(dataStack, expression, el) {
  1997. let func = generateFunctionFromString(expression, el);
  1998. return (receiver = () => {
  1999. }, { scope: scope2 = {}, params = [] } = {}) => {
  2000. func.result = void 0;
  2001. func.finished = false;
  2002. let completeScope = mergeProxies([scope2, ...dataStack]);
  2003. if (typeof func === "function") {
  2004. let promise = func(func, completeScope).catch((error2) => handleError(error2, el, expression));
  2005. if (func.finished) {
  2006. runIfTypeOfFunction(receiver, func.result, completeScope, params, el);
  2007. func.result = void 0;
  2008. } else {
  2009. promise.then((result) => {
  2010. runIfTypeOfFunction(receiver, result, completeScope, params, el);
  2011. }).catch((error2) => handleError(error2, el, expression)).finally(() => func.result = void 0);
  2012. }
  2013. }
  2014. };
  2015. }
  2016. function runIfTypeOfFunction(receiver, value, scope2, params, el) {
  2017. if (shouldAutoEvaluateFunctions && typeof value === "function") {
  2018. let result = value.apply(scope2, params);
  2019. if (result instanceof Promise) {
  2020. result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));
  2021. } else {
  2022. receiver(result);
  2023. }
  2024. } else if (typeof value === "object" && value instanceof Promise) {
  2025. value.then((i) => receiver(i));
  2026. } else {
  2027. receiver(value);
  2028. }
  2029. }
  2030. // packages/alpinejs/src/directives.js
  2031. var prefixAsString = "x-";
  2032. function prefix(subject = "") {
  2033. return prefixAsString + subject;
  2034. }
  2035. function setPrefix(newPrefix) {
  2036. prefixAsString = newPrefix;
  2037. }
  2038. var directiveHandlers = {};
  2039. function directive(name, callback) {
  2040. directiveHandlers[name] = callback;
  2041. return {
  2042. before(directive2) {
  2043. if (!directiveHandlers[directive2]) {
  2044. console.warn(
  2045. "Cannot find directive `${directive}`. `${name}` will use the default order of execution"
  2046. );
  2047. return;
  2048. }
  2049. const pos = directiveOrder.indexOf(directive2);
  2050. directiveOrder.splice(pos >= 0 ? pos : directiveOrder.indexOf("DEFAULT"), 0, name);
  2051. }
  2052. };
  2053. }
  2054. function directives(el, attributes, originalAttributeOverride) {
  2055. attributes = Array.from(attributes);
  2056. if (el._x_virtualDirectives) {
  2057. let vAttributes = Object.entries(el._x_virtualDirectives).map(([name, value]) => ({ name, value }));
  2058. let staticAttributes = attributesOnly(vAttributes);
  2059. vAttributes = vAttributes.map((attribute) => {
  2060. if (staticAttributes.find((attr) => attr.name === attribute.name)) {
  2061. return {
  2062. name: `x-bind:${attribute.name}`,
  2063. value: `"${attribute.value}"`
  2064. };
  2065. }
  2066. return attribute;
  2067. });
  2068. attributes = attributes.concat(vAttributes);
  2069. }
  2070. let transformedAttributeMap = {};
  2071. let directives2 = attributes.map(toTransformedAttributes((newName, oldName) => transformedAttributeMap[newName] = oldName)).filter(outNonAlpineAttributes).map(toParsedDirectives(transformedAttributeMap, originalAttributeOverride)).sort(byPriority);
  2072. return directives2.map((directive2) => {
  2073. return getDirectiveHandler(el, directive2);
  2074. });
  2075. }
  2076. function attributesOnly(attributes) {
  2077. return Array.from(attributes).map(toTransformedAttributes()).filter((attr) => !outNonAlpineAttributes(attr));
  2078. }
  2079. var isDeferringHandlers = false;
  2080. var directiveHandlerStacks = /* @__PURE__ */ new Map();
  2081. var currentHandlerStackKey = Symbol();
  2082. function deferHandlingDirectives(callback) {
  2083. isDeferringHandlers = true;
  2084. let key = Symbol();
  2085. currentHandlerStackKey = key;
  2086. directiveHandlerStacks.set(key, []);
  2087. let flushHandlers = () => {
  2088. while (directiveHandlerStacks.get(key).length)
  2089. directiveHandlerStacks.get(key).shift()();
  2090. directiveHandlerStacks.delete(key);
  2091. };
  2092. let stopDeferring = () => {
  2093. isDeferringHandlers = false;
  2094. flushHandlers();
  2095. };
  2096. callback(flushHandlers);
  2097. stopDeferring();
  2098. }
  2099. function getElementBoundUtilities(el) {
  2100. let cleanups = [];
  2101. let cleanup = (callback) => cleanups.push(callback);
  2102. let [effect3, cleanupEffect] = elementBoundEffect(el);
  2103. cleanups.push(cleanupEffect);
  2104. let utilities = {
  2105. Alpine: alpine_default,
  2106. effect: effect3,
  2107. cleanup,
  2108. evaluateLater: evaluateLater.bind(evaluateLater, el),
  2109. evaluate: evaluate.bind(evaluate, el)
  2110. };
  2111. let doCleanup = () => cleanups.forEach((i) => i());
  2112. return [utilities, doCleanup];
  2113. }
  2114. function getDirectiveHandler(el, directive2) {
  2115. let noop = () => {
  2116. };
  2117. let handler4 = directiveHandlers[directive2.type] || noop;
  2118. let [utilities, cleanup] = getElementBoundUtilities(el);
  2119. onAttributeRemoved(el, directive2.original, cleanup);
  2120. let fullHandler = () => {
  2121. if (el._x_ignore || el._x_ignoreSelf)
  2122. return;
  2123. handler4.inline && handler4.inline(el, directive2, utilities);
  2124. handler4 = handler4.bind(handler4, el, directive2, utilities);
  2125. isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler4) : handler4();
  2126. };
  2127. fullHandler.runCleanups = cleanup;
  2128. return fullHandler;
  2129. }
  2130. var startingWith = (subject, replacement) => ({ name, value }) => {
  2131. if (name.startsWith(subject))
  2132. name = name.replace(subject, replacement);
  2133. return { name, value };
  2134. };
  2135. var into = (i) => i;
  2136. function toTransformedAttributes(callback = () => {
  2137. }) {
  2138. return ({ name, value }) => {
  2139. let { name: newName, value: newValue } = attributeTransformers.reduce((carry, transform) => {
  2140. return transform(carry);
  2141. }, { name, value });
  2142. if (newName !== name)
  2143. callback(newName, name);
  2144. return { name: newName, value: newValue };
  2145. };
  2146. }
  2147. var attributeTransformers = [];
  2148. function mapAttributes(callback) {
  2149. attributeTransformers.push(callback);
  2150. }
  2151. function outNonAlpineAttributes({ name }) {
  2152. return alpineAttributeRegex().test(name);
  2153. }
  2154. var alpineAttributeRegex = () => new RegExp(`^${prefixAsString}([^:^.]+)\\b`);
  2155. function toParsedDirectives(transformedAttributeMap, originalAttributeOverride) {
  2156. return ({ name, value }) => {
  2157. let typeMatch = name.match(alpineAttributeRegex());
  2158. let valueMatch = name.match(/:([a-zA-Z0-9\-:]+)/);
  2159. let modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || [];
  2160. let original = originalAttributeOverride || transformedAttributeMap[name] || name;
  2161. return {
  2162. type: typeMatch ? typeMatch[1] : null,
  2163. value: valueMatch ? valueMatch[1] : null,
  2164. modifiers: modifiers.map((i) => i.replace(".", "")),
  2165. expression: value,
  2166. original
  2167. };
  2168. };
  2169. }
  2170. var DEFAULT = "DEFAULT";
  2171. var directiveOrder = [
  2172. "ignore",
  2173. "ref",
  2174. "data",
  2175. "id",
  2176. "bind",
  2177. "init",
  2178. "for",
  2179. "model",
  2180. "modelable",
  2181. "transition",
  2182. "show",
  2183. "if",
  2184. DEFAULT,
  2185. "teleport"
  2186. ];
  2187. function byPriority(a, b) {
  2188. let typeA = directiveOrder.indexOf(a.type) === -1 ? DEFAULT : a.type;
  2189. let typeB = directiveOrder.indexOf(b.type) === -1 ? DEFAULT : b.type;
  2190. return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);
  2191. }
  2192. // packages/alpinejs/src/nextTick.js
  2193. var tickStack = [];
  2194. var isHolding = false;
  2195. function nextTick(callback = () => {
  2196. }) {
  2197. queueMicrotask(() => {
  2198. isHolding || setTimeout(() => {
  2199. releaseNextTicks();
  2200. });
  2201. });
  2202. return new Promise((res) => {
  2203. tickStack.push(() => {
  2204. callback();
  2205. res();
  2206. });
  2207. });
  2208. }
  2209. function releaseNextTicks() {
  2210. isHolding = false;
  2211. while (tickStack.length)
  2212. tickStack.shift()();
  2213. }
  2214. function holdNextTicks() {
  2215. isHolding = true;
  2216. }
  2217. // packages/alpinejs/src/utils/classes.js
  2218. function setClasses(el, value) {
  2219. if (Array.isArray(value)) {
  2220. return setClassesFromString(el, value.join(" "));
  2221. } else if (typeof value === "object" && value !== null) {
  2222. return setClassesFromObject(el, value);
  2223. } else if (typeof value === "function") {
  2224. return setClasses(el, value());
  2225. }
  2226. return setClassesFromString(el, value);
  2227. }
  2228. function setClassesFromString(el, classString) {
  2229. let split = (classString2) => classString2.split(" ").filter(Boolean);
  2230. let missingClasses = (classString2) => classString2.split(" ").filter((i) => !el.classList.contains(i)).filter(Boolean);
  2231. let addClassesAndReturnUndo = (classes) => {
  2232. el.classList.add(...classes);
  2233. return () => {
  2234. el.classList.remove(...classes);
  2235. };
  2236. };
  2237. classString = classString === true ? classString = "" : classString || "";
  2238. return addClassesAndReturnUndo(missingClasses(classString));
  2239. }
  2240. function setClassesFromObject(el, classObject) {
  2241. let split = (classString) => classString.split(" ").filter(Boolean);
  2242. let forAdd = Object.entries(classObject).flatMap(([classString, bool]) => bool ? split(classString) : false).filter(Boolean);
  2243. let forRemove = Object.entries(classObject).flatMap(([classString, bool]) => !bool ? split(classString) : false).filter(Boolean);
  2244. let added = [];
  2245. let removed = [];
  2246. forRemove.forEach((i) => {
  2247. if (el.classList.contains(i)) {
  2248. el.classList.remove(i);
  2249. removed.push(i);
  2250. }
  2251. });
  2252. forAdd.forEach((i) => {
  2253. if (!el.classList.contains(i)) {
  2254. el.classList.add(i);
  2255. added.push(i);
  2256. }
  2257. });
  2258. return () => {
  2259. removed.forEach((i) => el.classList.add(i));
  2260. added.forEach((i) => el.classList.remove(i));
  2261. };
  2262. }
  2263. // packages/alpinejs/src/utils/styles.js
  2264. function setStyles(el, value) {
  2265. if (typeof value === "object" && value !== null) {
  2266. return setStylesFromObject(el, value);
  2267. }
  2268. return setStylesFromString(el, value);
  2269. }
  2270. function setStylesFromObject(el, value) {
  2271. let previousStyles = {};
  2272. Object.entries(value).forEach(([key, value2]) => {
  2273. previousStyles[key] = el.style[key];
  2274. if (!key.startsWith("--")) {
  2275. key = kebabCase(key);
  2276. }
  2277. el.style.setProperty(key, value2);
  2278. });
  2279. setTimeout(() => {
  2280. if (el.style.length === 0) {
  2281. el.removeAttribute("style");
  2282. }
  2283. });
  2284. return () => {
  2285. setStyles(el, previousStyles);
  2286. };
  2287. }
  2288. function setStylesFromString(el, value) {
  2289. let cache = el.getAttribute("style", value);
  2290. el.setAttribute("style", value);
  2291. return () => {
  2292. el.setAttribute("style", cache || "");
  2293. };
  2294. }
  2295. function kebabCase(subject) {
  2296. return subject.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
  2297. }
  2298. // packages/alpinejs/src/utils/once.js
  2299. function once(callback, fallback = () => {
  2300. }) {
  2301. let called = false;
  2302. return function() {
  2303. if (!called) {
  2304. called = true;
  2305. callback.apply(this, arguments);
  2306. } else {
  2307. fallback.apply(this, arguments);
  2308. }
  2309. };
  2310. }
  2311. // packages/alpinejs/src/directives/x-transition.js
  2312. directive("transition", (el, { value, modifiers, expression }, { evaluate: evaluate2 }) => {
  2313. if (typeof expression === "function")
  2314. expression = evaluate2(expression);
  2315. if (expression === false)
  2316. return;
  2317. if (!expression || typeof expression === "boolean") {
  2318. registerTransitionsFromHelper(el, modifiers, value);
  2319. } else {
  2320. registerTransitionsFromClassString(el, expression, value);
  2321. }
  2322. });
  2323. function registerTransitionsFromClassString(el, classString, stage) {
  2324. registerTransitionObject(el, setClasses, "");
  2325. let directiveStorageMap = {
  2326. "enter": (classes) => {
  2327. el._x_transition.enter.during = classes;
  2328. },
  2329. "enter-start": (classes) => {
  2330. el._x_transition.enter.start = classes;
  2331. },
  2332. "enter-end": (classes) => {
  2333. el._x_transition.enter.end = classes;
  2334. },
  2335. "leave": (classes) => {
  2336. el._x_transition.leave.during = classes;
  2337. },
  2338. "leave-start": (classes) => {
  2339. el._x_transition.leave.start = classes;
  2340. },
  2341. "leave-end": (classes) => {
  2342. el._x_transition.leave.end = classes;
  2343. }
  2344. };
  2345. directiveStorageMap[stage](classString);
  2346. }
  2347. function registerTransitionsFromHelper(el, modifiers, stage) {
  2348. registerTransitionObject(el, setStyles);
  2349. let doesntSpecify = !modifiers.includes("in") && !modifiers.includes("out") && !stage;
  2350. let transitioningIn = doesntSpecify || modifiers.includes("in") || ["enter"].includes(stage);
  2351. let transitioningOut = doesntSpecify || modifiers.includes("out") || ["leave"].includes(stage);
  2352. if (modifiers.includes("in") && !doesntSpecify) {
  2353. modifiers = modifiers.filter((i, index) => index < modifiers.indexOf("out"));
  2354. }
  2355. if (modifiers.includes("out") && !doesntSpecify) {
  2356. modifiers = modifiers.filter((i, index) => index > modifiers.indexOf("out"));
  2357. }
  2358. let wantsAll = !modifiers.includes("opacity") && !modifiers.includes("scale");
  2359. let wantsOpacity = wantsAll || modifiers.includes("opacity");
  2360. let wantsScale = wantsAll || modifiers.includes("scale");
  2361. let opacityValue = wantsOpacity ? 0 : 1;
  2362. let scaleValue = wantsScale ? modifierValue(modifiers, "scale", 95) / 100 : 1;
  2363. let delay = modifierValue(modifiers, "delay", 0) / 1e3;
  2364. let origin = modifierValue(modifiers, "origin", "center");
  2365. let property = "opacity, transform";
  2366. let durationIn = modifierValue(modifiers, "duration", 150) / 1e3;
  2367. let durationOut = modifierValue(modifiers, "duration", 75) / 1e3;
  2368. let easing = `cubic-bezier(0.4, 0.0, 0.2, 1)`;
  2369. if (transitioningIn) {
  2370. el._x_transition.enter.during = {
  2371. transformOrigin: origin,
  2372. transitionDelay: `${delay}s`,
  2373. transitionProperty: property,
  2374. transitionDuration: `${durationIn}s`,
  2375. transitionTimingFunction: easing
  2376. };
  2377. el._x_transition.enter.start = {
  2378. opacity: opacityValue,
  2379. transform: `scale(${scaleValue})`
  2380. };
  2381. el._x_transition.enter.end = {
  2382. opacity: 1,
  2383. transform: `scale(1)`
  2384. };
  2385. }
  2386. if (transitioningOut) {
  2387. el._x_transition.leave.during = {
  2388. transformOrigin: origin,
  2389. transitionDelay: `${delay}s`,
  2390. transitionProperty: property,
  2391. transitionDuration: `${durationOut}s`,
  2392. transitionTimingFunction: easing
  2393. };
  2394. el._x_transition.leave.start = {
  2395. opacity: 1,
  2396. transform: `scale(1)`
  2397. };
  2398. el._x_transition.leave.end = {
  2399. opacity: opacityValue,
  2400. transform: `scale(${scaleValue})`
  2401. };
  2402. }
  2403. }
  2404. function registerTransitionObject(el, setFunction, defaultValue = {}) {
  2405. if (!el._x_transition)
  2406. el._x_transition = {
  2407. enter: { during: defaultValue, start: defaultValue, end: defaultValue },
  2408. leave: { during: defaultValue, start: defaultValue, end: defaultValue },
  2409. in(before = () => {
  2410. }, after = () => {
  2411. }) {
  2412. transition(el, setFunction, {
  2413. during: this.enter.during,
  2414. start: this.enter.start,
  2415. end: this.enter.end
  2416. }, before, after);
  2417. },
  2418. out(before = () => {
  2419. }, after = () => {
  2420. }) {
  2421. transition(el, setFunction, {
  2422. during: this.leave.during,
  2423. start: this.leave.start,
  2424. end: this.leave.end
  2425. }, before, after);
  2426. }
  2427. };
  2428. }
  2429. window.Element.prototype._x_toggleAndCascadeWithTransitions = function(el, value, show, hide) {
  2430. const nextTick2 = document.visibilityState === "visible" ? requestAnimationFrame : setTimeout;
  2431. let clickAwayCompatibleShow = () => nextTick2(show);
  2432. if (value) {
  2433. if (el._x_transition && (el._x_transition.enter || el._x_transition.leave)) {
  2434. 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();
  2435. } else {
  2436. el._x_transition ? el._x_transition.in(show) : clickAwayCompatibleShow();
  2437. }
  2438. return;
  2439. }
  2440. el._x_hidePromise = el._x_transition ? new Promise((resolve, reject) => {
  2441. el._x_transition.out(() => {
  2442. }, () => resolve(hide));
  2443. el._x_transitioning.beforeCancel(() => reject({ isFromCancelledTransition: true }));
  2444. }) : Promise.resolve(hide);
  2445. queueMicrotask(() => {
  2446. let closest = closestHide(el);
  2447. if (closest) {
  2448. if (!closest._x_hideChildren)
  2449. closest._x_hideChildren = [];
  2450. closest._x_hideChildren.push(el);
  2451. } else {
  2452. nextTick2(() => {
  2453. let hideAfterChildren = (el2) => {
  2454. let carry = Promise.all([
  2455. el2._x_hidePromise,
  2456. ...(el2._x_hideChildren || []).map(hideAfterChildren)
  2457. ]).then(([i]) => i());
  2458. delete el2._x_hidePromise;
  2459. delete el2._x_hideChildren;
  2460. return carry;
  2461. };
  2462. hideAfterChildren(el).catch((e) => {
  2463. if (!e.isFromCancelledTransition)
  2464. throw e;
  2465. });
  2466. });
  2467. }
  2468. });
  2469. };
  2470. function closestHide(el) {
  2471. let parent = el.parentNode;
  2472. if (!parent)
  2473. return;
  2474. return parent._x_hidePromise ? parent : closestHide(parent);
  2475. }
  2476. function transition(el, setFunction, { during, start: start2, end } = {}, before = () => {
  2477. }, after = () => {
  2478. }) {
  2479. if (el._x_transitioning)
  2480. el._x_transitioning.cancel();
  2481. if (Object.keys(during).length === 0 && Object.keys(start2).length === 0 && Object.keys(end).length === 0) {
  2482. before();
  2483. after();
  2484. return;
  2485. }
  2486. let undoStart, undoDuring, undoEnd;
  2487. performTransition(el, {
  2488. start() {
  2489. undoStart = setFunction(el, start2);
  2490. },
  2491. during() {
  2492. undoDuring = setFunction(el, during);
  2493. },
  2494. before,
  2495. end() {
  2496. undoStart();
  2497. undoEnd = setFunction(el, end);
  2498. },
  2499. after,
  2500. cleanup() {
  2501. undoDuring();
  2502. undoEnd();
  2503. }
  2504. });
  2505. }
  2506. function performTransition(el, stages) {
  2507. let interrupted, reachedBefore, reachedEnd;
  2508. let finish = once(() => {
  2509. mutateDom(() => {
  2510. interrupted = true;
  2511. if (!reachedBefore)
  2512. stages.before();
  2513. if (!reachedEnd) {
  2514. stages.end();
  2515. releaseNextTicks();
  2516. }
  2517. stages.after();
  2518. if (el.isConnected)
  2519. stages.cleanup();
  2520. delete el._x_transitioning;
  2521. });
  2522. });
  2523. el._x_transitioning = {
  2524. beforeCancels: [],
  2525. beforeCancel(callback) {
  2526. this.beforeCancels.push(callback);
  2527. },
  2528. cancel: once(function() {
  2529. while (this.beforeCancels.length) {
  2530. this.beforeCancels.shift()();
  2531. }
  2532. ;
  2533. finish();
  2534. }),
  2535. finish
  2536. };
  2537. mutateDom(() => {
  2538. stages.start();
  2539. stages.during();
  2540. });
  2541. holdNextTicks();
  2542. requestAnimationFrame(() => {
  2543. if (interrupted)
  2544. return;
  2545. let duration = Number(getComputedStyle(el).transitionDuration.replace(/,.*/, "").replace("s", "")) * 1e3;
  2546. let delay = Number(getComputedStyle(el).transitionDelay.replace(/,.*/, "").replace("s", "")) * 1e3;
  2547. if (duration === 0)
  2548. duration = Number(getComputedStyle(el).animationDuration.replace("s", "")) * 1e3;
  2549. mutateDom(() => {
  2550. stages.before();
  2551. });
  2552. reachedBefore = true;
  2553. requestAnimationFrame(() => {
  2554. if (interrupted)
  2555. return;
  2556. mutateDom(() => {
  2557. stages.end();
  2558. });
  2559. releaseNextTicks();
  2560. setTimeout(el._x_transitioning.finish, duration + delay);
  2561. reachedEnd = true;
  2562. });
  2563. });
  2564. }
  2565. function modifierValue(modifiers, key, fallback) {
  2566. if (modifiers.indexOf(key) === -1)
  2567. return fallback;
  2568. const rawValue = modifiers[modifiers.indexOf(key) + 1];
  2569. if (!rawValue)
  2570. return fallback;
  2571. if (key === "scale") {
  2572. if (isNaN(rawValue))
  2573. return fallback;
  2574. }
  2575. if (key === "duration" || key === "delay") {
  2576. let match = rawValue.match(/([0-9]+)ms/);
  2577. if (match)
  2578. return match[1];
  2579. }
  2580. if (key === "origin") {
  2581. if (["top", "right", "left", "center", "bottom"].includes(modifiers[modifiers.indexOf(key) + 2])) {
  2582. return [rawValue, modifiers[modifiers.indexOf(key) + 2]].join(" ");
  2583. }
  2584. }
  2585. return rawValue;
  2586. }
  2587. // packages/alpinejs/src/clone.js
  2588. var isCloning = false;
  2589. function skipDuringClone(callback, fallback = () => {
  2590. }) {
  2591. return (...args) => isCloning ? fallback(...args) : callback(...args);
  2592. }
  2593. function onlyDuringClone(callback) {
  2594. return (...args) => isCloning && callback(...args);
  2595. }
  2596. function cloneNode(from, to) {
  2597. if (from._x_dataStack) {
  2598. to._x_dataStack = from._x_dataStack;
  2599. to.setAttribute("data-has-alpine-state", true);
  2600. }
  2601. isCloning = true;
  2602. dontRegisterReactiveSideEffects(() => {
  2603. initTree(to, (el, callback) => {
  2604. callback(el, () => {
  2605. });
  2606. });
  2607. });
  2608. isCloning = false;
  2609. }
  2610. var isCloningLegacy = false;
  2611. function clone(oldEl, newEl) {
  2612. if (!newEl._x_dataStack)
  2613. newEl._x_dataStack = oldEl._x_dataStack;
  2614. isCloning = true;
  2615. isCloningLegacy = true;
  2616. dontRegisterReactiveSideEffects(() => {
  2617. cloneTree(newEl);
  2618. });
  2619. isCloning = false;
  2620. isCloningLegacy = false;
  2621. }
  2622. function cloneTree(el) {
  2623. let hasRunThroughFirstEl = false;
  2624. let shallowWalker = (el2, callback) => {
  2625. walk(el2, (el3, skip) => {
  2626. if (hasRunThroughFirstEl && isRoot(el3))
  2627. return skip();
  2628. hasRunThroughFirstEl = true;
  2629. callback(el3, skip);
  2630. });
  2631. };
  2632. initTree(el, shallowWalker);
  2633. }
  2634. function dontRegisterReactiveSideEffects(callback) {
  2635. let cache = effect;
  2636. overrideEffect((callback2, el) => {
  2637. let storedEffect = cache(callback2);
  2638. release(storedEffect);
  2639. return () => {
  2640. };
  2641. });
  2642. callback();
  2643. overrideEffect(cache);
  2644. }
  2645. function shouldSkipRegisteringDataDuringClone(el) {
  2646. if (!isCloning)
  2647. return false;
  2648. if (isCloningLegacy)
  2649. return true;
  2650. return el.hasAttribute("data-has-alpine-state");
  2651. }
  2652. // packages/alpinejs/src/utils/bind.js
  2653. function bind(el, name, value, modifiers = []) {
  2654. if (!el._x_bindings)
  2655. el._x_bindings = reactive({});
  2656. el._x_bindings[name] = value;
  2657. name = modifiers.includes("camel") ? camelCase(name) : name;
  2658. switch (name) {
  2659. case "value":
  2660. bindInputValue(el, value);
  2661. break;
  2662. case "style":
  2663. bindStyles(el, value);
  2664. break;
  2665. case "class":
  2666. bindClasses(el, value);
  2667. break;
  2668. case "selected":
  2669. case "checked":
  2670. bindAttributeAndProperty(el, name, value);
  2671. break;
  2672. default:
  2673. bindAttribute(el, name, value);
  2674. break;
  2675. }
  2676. }
  2677. function bindInputValue(el, value) {
  2678. if (el.type === "radio") {
  2679. if (el.attributes.value === void 0) {
  2680. el.value = value;
  2681. }
  2682. if (window.fromModel) {
  2683. el.checked = checkedAttrLooseCompare(el.value, value);
  2684. }
  2685. } else if (el.type === "checkbox") {
  2686. if (Number.isInteger(value)) {
  2687. el.value = value;
  2688. } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) {
  2689. el.value = String(value);
  2690. } else {
  2691. if (Array.isArray(value)) {
  2692. el.checked = value.some((val) => checkedAttrLooseCompare(val, el.value));
  2693. } else {
  2694. el.checked = !!value;
  2695. }
  2696. }
  2697. } else if (el.tagName === "SELECT") {
  2698. updateSelect(el, value);
  2699. } else {
  2700. if (el.value === value)
  2701. return;
  2702. el.value = value === void 0 ? "" : value;
  2703. }
  2704. }
  2705. function bindClasses(el, value) {
  2706. if (el._x_undoAddedClasses)
  2707. el._x_undoAddedClasses();
  2708. el._x_undoAddedClasses = setClasses(el, value);
  2709. }
  2710. function bindStyles(el, value) {
  2711. if (el._x_undoAddedStyles)
  2712. el._x_undoAddedStyles();
  2713. el._x_undoAddedStyles = setStyles(el, value);
  2714. }
  2715. function bindAttributeAndProperty(el, name, value) {
  2716. bindAttribute(el, name, value);
  2717. setPropertyIfChanged(el, name, value);
  2718. }
  2719. function bindAttribute(el, name, value) {
  2720. if ([null, void 0, false].includes(value) && attributeShouldntBePreservedIfFalsy(name)) {
  2721. el.removeAttribute(name);
  2722. } else {
  2723. if (isBooleanAttr(name))
  2724. value = name;
  2725. setIfChanged(el, name, value);
  2726. }
  2727. }
  2728. function setIfChanged(el, attrName, value) {
  2729. if (el.getAttribute(attrName) != value) {
  2730. el.setAttribute(attrName, value);
  2731. }
  2732. }
  2733. function setPropertyIfChanged(el, propName, value) {
  2734. if (el[propName] !== value) {
  2735. el[propName] = value;
  2736. }
  2737. }
  2738. function updateSelect(el, value) {
  2739. const arrayWrappedValue = [].concat(value).map((value2) => {
  2740. return value2 + "";
  2741. });
  2742. Array.from(el.options).forEach((option) => {
  2743. option.selected = arrayWrappedValue.includes(option.value);
  2744. });
  2745. }
  2746. function camelCase(subject) {
  2747. return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase());
  2748. }
  2749. function checkedAttrLooseCompare(valueA, valueB) {
  2750. return valueA == valueB;
  2751. }
  2752. function isBooleanAttr(attrName) {
  2753. const booleanAttributes = [
  2754. "disabled",
  2755. "checked",
  2756. "required",
  2757. "readonly",
  2758. "hidden",
  2759. "open",
  2760. "selected",
  2761. "autofocus",
  2762. "itemscope",
  2763. "multiple",
  2764. "novalidate",
  2765. "allowfullscreen",
  2766. "allowpaymentrequest",
  2767. "formnovalidate",
  2768. "autoplay",
  2769. "controls",
  2770. "loop",
  2771. "muted",
  2772. "playsinline",
  2773. "default",
  2774. "ismap",
  2775. "reversed",
  2776. "async",
  2777. "defer",
  2778. "nomodule"
  2779. ];
  2780. return booleanAttributes.includes(attrName);
  2781. }
  2782. function attributeShouldntBePreservedIfFalsy(name) {
  2783. return !["aria-pressed", "aria-checked", "aria-expanded", "aria-selected"].includes(name);
  2784. }
  2785. function getBinding(el, name, fallback) {
  2786. if (el._x_bindings && el._x_bindings[name] !== void 0)
  2787. return el._x_bindings[name];
  2788. return getAttributeBinding(el, name, fallback);
  2789. }
  2790. function extractProp(el, name, fallback, extract = true) {
  2791. if (el._x_bindings && el._x_bindings[name] !== void 0)
  2792. return el._x_bindings[name];
  2793. if (el._x_inlineBindings && el._x_inlineBindings[name] !== void 0) {
  2794. let binding = el._x_inlineBindings[name];
  2795. binding.extract = extract;
  2796. return dontAutoEvaluateFunctions(() => {
  2797. return evaluate(el, binding.expression);
  2798. });
  2799. }
  2800. return getAttributeBinding(el, name, fallback);
  2801. }
  2802. function getAttributeBinding(el, name, fallback) {
  2803. let attr = el.getAttribute(name);
  2804. if (attr === null)
  2805. return typeof fallback === "function" ? fallback() : fallback;
  2806. if (attr === "")
  2807. return true;
  2808. if (isBooleanAttr(name)) {
  2809. return !![name, "true"].includes(attr);
  2810. }
  2811. return attr;
  2812. }
  2813. // packages/alpinejs/src/utils/debounce.js
  2814. function debounce(func, wait) {
  2815. var timeout;
  2816. return function() {
  2817. var context = this, args = arguments;
  2818. var later = function() {
  2819. timeout = null;
  2820. func.apply(context, args);
  2821. };
  2822. clearTimeout(timeout);
  2823. timeout = setTimeout(later, wait);
  2824. };
  2825. }
  2826. // packages/alpinejs/src/utils/throttle.js
  2827. function throttle(func, limit) {
  2828. let inThrottle;
  2829. return function() {
  2830. let context = this, args = arguments;
  2831. if (!inThrottle) {
  2832. func.apply(context, args);
  2833. inThrottle = true;
  2834. setTimeout(() => inThrottle = false, limit);
  2835. }
  2836. };
  2837. }
  2838. // packages/alpinejs/src/entangle.js
  2839. function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) {
  2840. let firstRun = true;
  2841. let outerHash, innerHash, outerHashLatest, innerHashLatest;
  2842. let reference = effect(() => {
  2843. let outer, inner;
  2844. if (firstRun) {
  2845. outer = outerGet();
  2846. innerSet(JSON.parse(JSON.stringify(outer)));
  2847. inner = innerGet();
  2848. firstRun = false;
  2849. } else {
  2850. outer = outerGet();
  2851. inner = innerGet();
  2852. outerHashLatest = JSON.stringify(outer);
  2853. innerHashLatest = JSON.stringify(inner);
  2854. if (outerHashLatest !== outerHash) {
  2855. inner = innerGet();
  2856. innerSet(outer);
  2857. inner = outer;
  2858. } else {
  2859. outerSet(JSON.parse(innerHashLatest != null ? innerHashLatest : null));
  2860. outer = inner;
  2861. }
  2862. }
  2863. outerHash = JSON.stringify(outer);
  2864. innerHash = JSON.stringify(inner);
  2865. });
  2866. return () => {
  2867. release(reference);
  2868. };
  2869. }
  2870. // packages/alpinejs/src/plugin.js
  2871. function plugin(callback) {
  2872. let callbacks = Array.isArray(callback) ? callback : [callback];
  2873. callbacks.forEach((i) => i(alpine_default));
  2874. }
  2875. // packages/alpinejs/src/store.js
  2876. var stores = {};
  2877. var isReactive = false;
  2878. function store(name, value) {
  2879. if (!isReactive) {
  2880. stores = reactive(stores);
  2881. isReactive = true;
  2882. }
  2883. if (value === void 0) {
  2884. return stores[name];
  2885. }
  2886. stores[name] = value;
  2887. if (typeof value === "object" && value !== null && value.hasOwnProperty("init") && typeof value.init === "function") {
  2888. stores[name].init();
  2889. }
  2890. initInterceptors2(stores[name]);
  2891. }
  2892. function getStores() {
  2893. return stores;
  2894. }
  2895. // packages/alpinejs/src/binds.js
  2896. var binds = {};
  2897. function bind2(name, bindings) {
  2898. let getBindings = typeof bindings !== "function" ? () => bindings : bindings;
  2899. if (name instanceof Element) {
  2900. return applyBindingsObject(name, getBindings());
  2901. } else {
  2902. binds[name] = getBindings;
  2903. }
  2904. return () => {
  2905. };
  2906. }
  2907. function injectBindingProviders(obj) {
  2908. Object.entries(binds).forEach(([name, callback]) => {
  2909. Object.defineProperty(obj, name, {
  2910. get() {
  2911. return (...args) => {
  2912. return callback(...args);
  2913. };
  2914. }
  2915. });
  2916. });
  2917. return obj;
  2918. }
  2919. function applyBindingsObject(el, obj, original) {
  2920. let cleanupRunners = [];
  2921. while (cleanupRunners.length)
  2922. cleanupRunners.pop()();
  2923. let attributes = Object.entries(obj).map(([name, value]) => ({ name, value }));
  2924. let staticAttributes = attributesOnly(attributes);
  2925. attributes = attributes.map((attribute) => {
  2926. if (staticAttributes.find((attr) => attr.name === attribute.name)) {
  2927. return {
  2928. name: `x-bind:${attribute.name}`,
  2929. value: `"${attribute.value}"`
  2930. };
  2931. }
  2932. return attribute;
  2933. });
  2934. directives(el, attributes, original).map((handle) => {
  2935. cleanupRunners.push(handle.runCleanups);
  2936. handle();
  2937. });
  2938. return () => {
  2939. while (cleanupRunners.length)
  2940. cleanupRunners.pop()();
  2941. };
  2942. }
  2943. // packages/alpinejs/src/datas.js
  2944. var datas = {};
  2945. function data(name, callback) {
  2946. datas[name] = callback;
  2947. }
  2948. function injectDataProviders(obj, context) {
  2949. Object.entries(datas).forEach(([name, callback]) => {
  2950. Object.defineProperty(obj, name, {
  2951. get() {
  2952. return (...args) => {
  2953. return callback.bind(context)(...args);
  2954. };
  2955. },
  2956. enumerable: false
  2957. });
  2958. });
  2959. return obj;
  2960. }
  2961. // packages/alpinejs/src/alpine.js
  2962. var Alpine = {
  2963. get reactive() {
  2964. return reactive;
  2965. },
  2966. get release() {
  2967. return release;
  2968. },
  2969. get effect() {
  2970. return effect;
  2971. },
  2972. get raw() {
  2973. return raw;
  2974. },
  2975. version: "3.13.0",
  2976. flushAndStopDeferringMutations,
  2977. dontAutoEvaluateFunctions,
  2978. disableEffectScheduling,
  2979. startObservingMutations,
  2980. stopObservingMutations,
  2981. setReactivityEngine,
  2982. onAttributeRemoved,
  2983. onAttributesAdded,
  2984. closestDataStack,
  2985. skipDuringClone,
  2986. onlyDuringClone,
  2987. addRootSelector,
  2988. addInitSelector,
  2989. addScopeToNode,
  2990. deferMutations,
  2991. mapAttributes,
  2992. evaluateLater,
  2993. interceptInit,
  2994. setEvaluator,
  2995. mergeProxies,
  2996. extractProp,
  2997. findClosest,
  2998. onElRemoved,
  2999. closestRoot,
  3000. destroyTree,
  3001. interceptor,
  3002. // INTERNAL: not public API and is subject to change without major release.
  3003. transition,
  3004. // INTERNAL
  3005. setStyles,
  3006. // INTERNAL
  3007. mutateDom,
  3008. directive,
  3009. entangle,
  3010. throttle,
  3011. debounce,
  3012. evaluate,
  3013. initTree,
  3014. nextTick,
  3015. prefixed: prefix,
  3016. prefix: setPrefix,
  3017. plugin,
  3018. magic,
  3019. store,
  3020. start,
  3021. clone,
  3022. // INTERNAL
  3023. cloneNode,
  3024. // INTERNAL
  3025. bound: getBinding,
  3026. $data: scope,
  3027. walk,
  3028. data,
  3029. bind: bind2
  3030. };
  3031. var alpine_default = Alpine;
  3032. // packages/alpinejs/src/index.js
  3033. var import_reactivity9 = __toESM(require_reactivity());
  3034. // packages/alpinejs/src/magics/$nextTick.js
  3035. magic("nextTick", () => nextTick);
  3036. // packages/alpinejs/src/magics/$dispatch.js
  3037. magic("dispatch", (el) => dispatch.bind(dispatch, el));
  3038. // packages/alpinejs/src/magics/$watch.js
  3039. magic("watch", (el, { evaluateLater: evaluateLater2, effect: effect3 }) => (key, callback) => {
  3040. let evaluate2 = evaluateLater2(key);
  3041. let firstTime = true;
  3042. let oldValue;
  3043. let effectReference = effect3(() => evaluate2((value) => {
  3044. JSON.stringify(value);
  3045. if (!firstTime) {
  3046. queueMicrotask(() => {
  3047. callback(value, oldValue);
  3048. oldValue = value;
  3049. });
  3050. } else {
  3051. oldValue = value;
  3052. }
  3053. firstTime = false;
  3054. }));
  3055. el._x_effects.delete(effectReference);
  3056. });
  3057. // packages/alpinejs/src/magics/$store.js
  3058. magic("store", getStores);
  3059. // packages/alpinejs/src/magics/$data.js
  3060. magic("data", (el) => scope(el));
  3061. // packages/alpinejs/src/magics/$root.js
  3062. magic("root", (el) => closestRoot(el));
  3063. // packages/alpinejs/src/magics/$refs.js
  3064. magic("refs", (el) => {
  3065. if (el._x_refs_proxy)
  3066. return el._x_refs_proxy;
  3067. el._x_refs_proxy = mergeProxies(getArrayOfRefObject(el));
  3068. return el._x_refs_proxy;
  3069. });
  3070. function getArrayOfRefObject(el) {
  3071. let refObjects = [];
  3072. let currentEl = el;
  3073. while (currentEl) {
  3074. if (currentEl._x_refs)
  3075. refObjects.push(currentEl._x_refs);
  3076. currentEl = currentEl.parentNode;
  3077. }
  3078. return refObjects;
  3079. }
  3080. // packages/alpinejs/src/ids.js
  3081. var globalIdMemo = {};
  3082. function findAndIncrementId(name) {
  3083. if (!globalIdMemo[name])
  3084. globalIdMemo[name] = 0;
  3085. return ++globalIdMemo[name];
  3086. }
  3087. function closestIdRoot(el, name) {
  3088. return findClosest(el, (element) => {
  3089. if (element._x_ids && element._x_ids[name])
  3090. return true;
  3091. });
  3092. }
  3093. function setIdRoot(el, name) {
  3094. if (!el._x_ids)
  3095. el._x_ids = {};
  3096. if (!el._x_ids[name])
  3097. el._x_ids[name] = findAndIncrementId(name);
  3098. }
  3099. // packages/alpinejs/src/magics/$id.js
  3100. magic("id", (el) => (name, key = null) => {
  3101. let root = closestIdRoot(el, name);
  3102. let id = root ? root._x_ids[name] : findAndIncrementId(name);
  3103. return key ? `${name}-${id}-${key}` : `${name}-${id}`;
  3104. });
  3105. // packages/alpinejs/src/magics/$el.js
  3106. magic("el", (el) => el);
  3107. // packages/alpinejs/src/magics/index.js
  3108. warnMissingPluginMagic("Focus", "focus", "focus");
  3109. warnMissingPluginMagic("Persist", "persist", "persist");
  3110. function warnMissingPluginMagic(name, magicName, slug) {
  3111. magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
  3112. }
  3113. // packages/alpinejs/src/directives/x-modelable.js
  3114. directive("modelable", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup }) => {
  3115. let func = evaluateLater2(expression);
  3116. let innerGet = () => {
  3117. let result;
  3118. func((i) => result = i);
  3119. return result;
  3120. };
  3121. let evaluateInnerSet = evaluateLater2(`${expression} = __placeholder`);
  3122. let innerSet = (val) => evaluateInnerSet(() => {
  3123. }, { scope: { "__placeholder": val } });
  3124. let initialValue = innerGet();
  3125. innerSet(initialValue);
  3126. queueMicrotask(() => {
  3127. if (!el._x_model)
  3128. return;
  3129. el._x_removeModelListeners["default"]();
  3130. let outerGet = el._x_model.get;
  3131. let outerSet = el._x_model.set;
  3132. let releaseEntanglement = entangle(
  3133. {
  3134. get() {
  3135. return outerGet();
  3136. },
  3137. set(value) {
  3138. outerSet(value);
  3139. }
  3140. },
  3141. {
  3142. get() {
  3143. return innerGet();
  3144. },
  3145. set(value) {
  3146. innerSet(value);
  3147. }
  3148. }
  3149. );
  3150. cleanup(releaseEntanglement);
  3151. });
  3152. });
  3153. // packages/alpinejs/src/directives/x-teleport.js
  3154. var teleportContainerDuringClone = document.createElement("div");
  3155. directive("teleport", (el, { modifiers, expression }, { cleanup }) => {
  3156. if (el.tagName.toLowerCase() !== "template")
  3157. warn("x-teleport can only be used on a <template> tag", el);
  3158. let target = skipDuringClone(() => {
  3159. return document.querySelector(expression);
  3160. }, () => {
  3161. return teleportContainerDuringClone;
  3162. })();
  3163. if (!target)
  3164. warn(`Cannot find x-teleport element for selector: "${expression}"`);
  3165. let clone2 = el.content.cloneNode(true).firstElementChild;
  3166. el._x_teleport = clone2;
  3167. clone2._x_teleportBack = el;
  3168. if (el._x_forwardEvents) {
  3169. el._x_forwardEvents.forEach((eventName) => {
  3170. clone2.addEventListener(eventName, (e) => {
  3171. e.stopPropagation();
  3172. el.dispatchEvent(new e.constructor(e.type, e));
  3173. });
  3174. });
  3175. }
  3176. addScopeToNode(clone2, {}, el);
  3177. mutateDom(() => {
  3178. if (modifiers.includes("prepend")) {
  3179. target.parentNode.insertBefore(clone2, target);
  3180. } else if (modifiers.includes("append")) {
  3181. target.parentNode.insertBefore(clone2, target.nextSibling);
  3182. } else {
  3183. target.appendChild(clone2);
  3184. }
  3185. initTree(clone2);
  3186. clone2._x_ignore = true;
  3187. });
  3188. cleanup(() => clone2.remove());
  3189. });
  3190. // packages/alpinejs/src/directives/x-ignore.js
  3191. var handler = () => {
  3192. };
  3193. handler.inline = (el, { modifiers }, { cleanup }) => {
  3194. modifiers.includes("self") ? el._x_ignoreSelf = true : el._x_ignore = true;
  3195. cleanup(() => {
  3196. modifiers.includes("self") ? delete el._x_ignoreSelf : delete el._x_ignore;
  3197. });
  3198. };
  3199. directive("ignore", handler);
  3200. // packages/alpinejs/src/directives/x-effect.js
  3201. directive("effect", (el, { expression }, { effect: effect3 }) => effect3(evaluateLater(el, expression)));
  3202. // packages/alpinejs/src/utils/on.js
  3203. function on(el, event, modifiers, callback) {
  3204. let listenerTarget = el;
  3205. let handler4 = (e) => callback(e);
  3206. let options = {};
  3207. let wrapHandler = (callback2, wrapper) => (e) => wrapper(callback2, e);
  3208. if (modifiers.includes("dot"))
  3209. event = dotSyntax(event);
  3210. if (modifiers.includes("camel"))
  3211. event = camelCase2(event);
  3212. if (modifiers.includes("passive"))
  3213. options.passive = true;
  3214. if (modifiers.includes("capture"))
  3215. options.capture = true;
  3216. if (modifiers.includes("window"))
  3217. listenerTarget = window;
  3218. if (modifiers.includes("document"))
  3219. listenerTarget = document;
  3220. if (modifiers.includes("debounce")) {
  3221. let nextModifier = modifiers[modifiers.indexOf("debounce") + 1] || "invalid-wait";
  3222. let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
  3223. handler4 = debounce(handler4, wait);
  3224. }
  3225. if (modifiers.includes("throttle")) {
  3226. let nextModifier = modifiers[modifiers.indexOf("throttle") + 1] || "invalid-wait";
  3227. let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
  3228. handler4 = throttle(handler4, wait);
  3229. }
  3230. if (modifiers.includes("prevent"))
  3231. handler4 = wrapHandler(handler4, (next, e) => {
  3232. e.preventDefault();
  3233. next(e);
  3234. });
  3235. if (modifiers.includes("stop"))
  3236. handler4 = wrapHandler(handler4, (next, e) => {
  3237. e.stopPropagation();
  3238. next(e);
  3239. });
  3240. if (modifiers.includes("self"))
  3241. handler4 = wrapHandler(handler4, (next, e) => {
  3242. e.target === el && next(e);
  3243. });
  3244. if (modifiers.includes("away") || modifiers.includes("outside")) {
  3245. listenerTarget = document;
  3246. handler4 = wrapHandler(handler4, (next, e) => {
  3247. if (el.contains(e.target))
  3248. return;
  3249. if (e.target.isConnected === false)
  3250. return;
  3251. if (el.offsetWidth < 1 && el.offsetHeight < 1)
  3252. return;
  3253. if (el._x_isShown === false)
  3254. return;
  3255. next(e);
  3256. });
  3257. }
  3258. if (modifiers.includes("once")) {
  3259. handler4 = wrapHandler(handler4, (next, e) => {
  3260. next(e);
  3261. listenerTarget.removeEventListener(event, handler4, options);
  3262. });
  3263. }
  3264. handler4 = wrapHandler(handler4, (next, e) => {
  3265. if (isKeyEvent(event)) {
  3266. if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
  3267. return;
  3268. }
  3269. }
  3270. next(e);
  3271. });
  3272. listenerTarget.addEventListener(event, handler4, options);
  3273. return () => {
  3274. listenerTarget.removeEventListener(event, handler4, options);
  3275. };
  3276. }
  3277. function dotSyntax(subject) {
  3278. return subject.replace(/-/g, ".");
  3279. }
  3280. function camelCase2(subject) {
  3281. return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase());
  3282. }
  3283. function isNumeric(subject) {
  3284. return !Array.isArray(subject) && !isNaN(subject);
  3285. }
  3286. function kebabCase2(subject) {
  3287. if ([" ", "_"].includes(
  3288. subject
  3289. ))
  3290. return subject;
  3291. return subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase();
  3292. }
  3293. function isKeyEvent(event) {
  3294. return ["keydown", "keyup"].includes(event);
  3295. }
  3296. function isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers) {
  3297. let keyModifiers = modifiers.filter((i) => {
  3298. return !["window", "document", "prevent", "stop", "once", "capture"].includes(i);
  3299. });
  3300. if (keyModifiers.includes("debounce")) {
  3301. let debounceIndex = keyModifiers.indexOf("debounce");
  3302. keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1);
  3303. }
  3304. if (keyModifiers.includes("throttle")) {
  3305. let debounceIndex = keyModifiers.indexOf("throttle");
  3306. keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1);
  3307. }
  3308. if (keyModifiers.length === 0)
  3309. return false;
  3310. if (keyModifiers.length === 1 && keyToModifiers(e.key).includes(keyModifiers[0]))
  3311. return false;
  3312. const systemKeyModifiers = ["ctrl", "shift", "alt", "meta", "cmd", "super"];
  3313. const selectedSystemKeyModifiers = systemKeyModifiers.filter((modifier) => keyModifiers.includes(modifier));
  3314. keyModifiers = keyModifiers.filter((i) => !selectedSystemKeyModifiers.includes(i));
  3315. if (selectedSystemKeyModifiers.length > 0) {
  3316. const activelyPressedKeyModifiers = selectedSystemKeyModifiers.filter((modifier) => {
  3317. if (modifier === "cmd" || modifier === "super")
  3318. modifier = "meta";
  3319. return e[`${modifier}Key`];
  3320. });
  3321. if (activelyPressedKeyModifiers.length === selectedSystemKeyModifiers.length) {
  3322. if (keyToModifiers(e.key).includes(keyModifiers[0]))
  3323. return false;
  3324. }
  3325. }
  3326. return true;
  3327. }
  3328. function keyToModifiers(key) {
  3329. if (!key)
  3330. return [];
  3331. key = kebabCase2(key);
  3332. let modifierToKeyMap = {
  3333. "ctrl": "control",
  3334. "slash": "/",
  3335. "space": " ",
  3336. "spacebar": " ",
  3337. "cmd": "meta",
  3338. "esc": "escape",
  3339. "up": "arrow-up",
  3340. "down": "arrow-down",
  3341. "left": "arrow-left",
  3342. "right": "arrow-right",
  3343. "period": ".",
  3344. "equal": "=",
  3345. "minus": "-",
  3346. "underscore": "_"
  3347. };
  3348. modifierToKeyMap[key] = key;
  3349. return Object.keys(modifierToKeyMap).map((modifier) => {
  3350. if (modifierToKeyMap[modifier] === key)
  3351. return modifier;
  3352. }).filter((modifier) => modifier);
  3353. }
  3354. // packages/alpinejs/src/directives/x-model.js
  3355. directive("model", (el, { modifiers, expression }, { effect: effect3, cleanup }) => {
  3356. let scopeTarget = el;
  3357. if (modifiers.includes("parent")) {
  3358. scopeTarget = el.parentNode;
  3359. }
  3360. let evaluateGet = evaluateLater(scopeTarget, expression);
  3361. let evaluateSet;
  3362. if (typeof expression === "string") {
  3363. evaluateSet = evaluateLater(scopeTarget, `${expression} = __placeholder`);
  3364. } else if (typeof expression === "function" && typeof expression() === "string") {
  3365. evaluateSet = evaluateLater(scopeTarget, `${expression()} = __placeholder`);
  3366. } else {
  3367. evaluateSet = () => {
  3368. };
  3369. }
  3370. let getValue = () => {
  3371. let result;
  3372. evaluateGet((value) => result = value);
  3373. return isGetterSetter(result) ? result.get() : result;
  3374. };
  3375. let setValue = (value) => {
  3376. let result;
  3377. evaluateGet((value2) => result = value2);
  3378. if (isGetterSetter(result)) {
  3379. result.set(value);
  3380. } else {
  3381. evaluateSet(() => {
  3382. }, {
  3383. scope: { "__placeholder": value }
  3384. });
  3385. }
  3386. };
  3387. if (typeof expression === "string" && el.type === "radio") {
  3388. mutateDom(() => {
  3389. if (!el.hasAttribute("name"))
  3390. el.setAttribute("name", expression);
  3391. });
  3392. }
  3393. var event = el.tagName.toLowerCase() === "select" || ["checkbox", "radio"].includes(el.type) || modifiers.includes("lazy") ? "change" : "input";
  3394. let removeListener = isCloning ? () => {
  3395. } : on(el, event, modifiers, (e) => {
  3396. setValue(getInputValue(el, modifiers, e, getValue()));
  3397. });
  3398. if (modifiers.includes("fill")) {
  3399. if ([null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue())) {
  3400. el.dispatchEvent(new Event(event, {}));
  3401. }
  3402. }
  3403. if (!el._x_removeModelListeners)
  3404. el._x_removeModelListeners = {};
  3405. el._x_removeModelListeners["default"] = removeListener;
  3406. cleanup(() => el._x_removeModelListeners["default"]());
  3407. if (el.form) {
  3408. let removeResetListener = on(el.form, "reset", [], (e) => {
  3409. nextTick(() => el._x_model && el._x_model.set(el.value));
  3410. });
  3411. cleanup(() => removeResetListener());
  3412. }
  3413. el._x_model = {
  3414. get() {
  3415. return getValue();
  3416. },
  3417. set(value) {
  3418. setValue(value);
  3419. }
  3420. };
  3421. el._x_forceModelUpdate = (value) => {
  3422. if (value === void 0 && typeof expression === "string" && expression.match(/\./))
  3423. value = "";
  3424. window.fromModel = true;
  3425. mutateDom(() => bind(el, "value", value));
  3426. delete window.fromModel;
  3427. };
  3428. effect3(() => {
  3429. let value = getValue();
  3430. if (modifiers.includes("unintrusive") && document.activeElement.isSameNode(el))
  3431. return;
  3432. el._x_forceModelUpdate(value);
  3433. });
  3434. });
  3435. function getInputValue(el, modifiers, event, currentValue) {
  3436. return mutateDom(() => {
  3437. var _a;
  3438. if (event instanceof CustomEvent && event.detail !== void 0)
  3439. return (_a = event.detail) != null ? _a : event.target.value;
  3440. else if (el.type === "checkbox") {
  3441. if (Array.isArray(currentValue)) {
  3442. let newValue = modifiers.includes("number") ? safeParseNumber(event.target.value) : event.target.value;
  3443. return event.target.checked ? currentValue.concat([newValue]) : currentValue.filter((el2) => !checkedAttrLooseCompare2(el2, newValue));
  3444. } else {
  3445. return event.target.checked;
  3446. }
  3447. } else if (el.tagName.toLowerCase() === "select" && el.multiple) {
  3448. return modifiers.includes("number") ? Array.from(event.target.selectedOptions).map((option) => {
  3449. let rawValue = option.value || option.text;
  3450. return safeParseNumber(rawValue);
  3451. }) : Array.from(event.target.selectedOptions).map((option) => {
  3452. return option.value || option.text;
  3453. });
  3454. } else {
  3455. let rawValue = event.target.value;
  3456. return modifiers.includes("number") ? safeParseNumber(rawValue) : modifiers.includes("trim") ? rawValue.trim() : rawValue;
  3457. }
  3458. });
  3459. }
  3460. function safeParseNumber(rawValue) {
  3461. let number = rawValue ? parseFloat(rawValue) : null;
  3462. return isNumeric2(number) ? number : rawValue;
  3463. }
  3464. function checkedAttrLooseCompare2(valueA, valueB) {
  3465. return valueA == valueB;
  3466. }
  3467. function isNumeric2(subject) {
  3468. return !Array.isArray(subject) && !isNaN(subject);
  3469. }
  3470. function isGetterSetter(value) {
  3471. return value !== null && typeof value === "object" && typeof value.get === "function" && typeof value.set === "function";
  3472. }
  3473. // packages/alpinejs/src/directives/x-cloak.js
  3474. directive("cloak", (el) => queueMicrotask(() => mutateDom(() => el.removeAttribute(prefix("cloak")))));
  3475. // packages/alpinejs/src/directives/x-init.js
  3476. addInitSelector(() => `[${prefix("init")}]`);
  3477. directive("init", skipDuringClone((el, { expression }, { evaluate: evaluate2 }) => {
  3478. if (typeof expression === "string") {
  3479. return !!expression.trim() && evaluate2(expression, {}, false);
  3480. }
  3481. return evaluate2(expression, {}, false);
  3482. }));
  3483. // packages/alpinejs/src/directives/x-text.js
  3484. directive("text", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => {
  3485. let evaluate2 = evaluateLater2(expression);
  3486. effect3(() => {
  3487. evaluate2((value) => {
  3488. mutateDom(() => {
  3489. el.textContent = value;
  3490. });
  3491. });
  3492. });
  3493. });
  3494. // packages/alpinejs/src/directives/x-html.js
  3495. directive("html", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => {
  3496. let evaluate2 = evaluateLater2(expression);
  3497. effect3(() => {
  3498. evaluate2((value) => {
  3499. mutateDom(() => {
  3500. el.innerHTML = value;
  3501. el._x_ignoreSelf = true;
  3502. initTree(el);
  3503. delete el._x_ignoreSelf;
  3504. });
  3505. });
  3506. });
  3507. });
  3508. // packages/alpinejs/src/directives/x-bind.js
  3509. mapAttributes(startingWith(":", into(prefix("bind:"))));
  3510. var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3 }) => {
  3511. if (!value) {
  3512. let bindingProviders = {};
  3513. injectBindingProviders(bindingProviders);
  3514. let getBindings = evaluateLater(el, expression);
  3515. getBindings((bindings) => {
  3516. applyBindingsObject(el, bindings, original);
  3517. }, { scope: bindingProviders });
  3518. return;
  3519. }
  3520. if (value === "key")
  3521. return storeKeyForXFor(el, expression);
  3522. if (el._x_inlineBindings && el._x_inlineBindings[value] && el._x_inlineBindings[value].extract) {
  3523. return;
  3524. }
  3525. let evaluate2 = evaluateLater(el, expression);
  3526. effect3(() => evaluate2((result) => {
  3527. if (result === void 0 && typeof expression === "string" && expression.match(/\./)) {
  3528. result = "";
  3529. }
  3530. mutateDom(() => bind(el, value, result, modifiers));
  3531. }));
  3532. };
  3533. handler2.inline = (el, { value, modifiers, expression }) => {
  3534. if (!value)
  3535. return;
  3536. if (!el._x_inlineBindings)
  3537. el._x_inlineBindings = {};
  3538. el._x_inlineBindings[value] = { expression, extract: false };
  3539. };
  3540. directive("bind", handler2);
  3541. function storeKeyForXFor(el, expression) {
  3542. el._x_keyExpression = expression;
  3543. }
  3544. // packages/alpinejs/src/directives/x-data.js
  3545. addRootSelector(() => `[${prefix("data")}]`);
  3546. directive("data", (el, { expression }, { cleanup }) => {
  3547. if (shouldSkipRegisteringDataDuringClone(el))
  3548. return;
  3549. expression = expression === "" ? "{}" : expression;
  3550. let magicContext = {};
  3551. injectMagics(magicContext, el);
  3552. let dataProviderContext = {};
  3553. injectDataProviders(dataProviderContext, magicContext);
  3554. let data2 = evaluate(el, expression, { scope: dataProviderContext });
  3555. if (data2 === void 0 || data2 === true)
  3556. data2 = {};
  3557. injectMagics(data2, el);
  3558. let reactiveData = reactive(data2);
  3559. initInterceptors2(reactiveData);
  3560. let undo = addScopeToNode(el, reactiveData);
  3561. reactiveData["init"] && evaluate(el, reactiveData["init"]);
  3562. cleanup(() => {
  3563. reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
  3564. undo();
  3565. });
  3566. });
  3567. // packages/alpinejs/src/directives/x-show.js
  3568. directive("show", (el, { modifiers, expression }, { effect: effect3 }) => {
  3569. let evaluate2 = evaluateLater(el, expression);
  3570. if (!el._x_doHide)
  3571. el._x_doHide = () => {
  3572. mutateDom(() => {
  3573. el.style.setProperty("display", "none", modifiers.includes("important") ? "important" : void 0);
  3574. });
  3575. };
  3576. if (!el._x_doShow)
  3577. el._x_doShow = () => {
  3578. mutateDom(() => {
  3579. if (el.style.length === 1 && el.style.display === "none") {
  3580. el.removeAttribute("style");
  3581. } else {
  3582. el.style.removeProperty("display");
  3583. }
  3584. });
  3585. };
  3586. let hide = () => {
  3587. el._x_doHide();
  3588. el._x_isShown = false;
  3589. };
  3590. let show = () => {
  3591. el._x_doShow();
  3592. el._x_isShown = true;
  3593. };
  3594. let clickAwayCompatibleShow = () => setTimeout(show);
  3595. let toggle = once(
  3596. (value) => value ? show() : hide(),
  3597. (value) => {
  3598. if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
  3599. el._x_toggleAndCascadeWithTransitions(el, value, show, hide);
  3600. } else {
  3601. value ? clickAwayCompatibleShow() : hide();
  3602. }
  3603. }
  3604. );
  3605. let oldValue;
  3606. let firstTime = true;
  3607. effect3(() => evaluate2((value) => {
  3608. if (!firstTime && value === oldValue)
  3609. return;
  3610. if (modifiers.includes("immediate"))
  3611. value ? clickAwayCompatibleShow() : hide();
  3612. toggle(value);
  3613. oldValue = value;
  3614. firstTime = false;
  3615. }));
  3616. });
  3617. // packages/alpinejs/src/directives/x-for.js
  3618. directive("for", (el, { expression }, { effect: effect3, cleanup }) => {
  3619. let iteratorNames = parseForExpression(expression);
  3620. let evaluateItems = evaluateLater(el, iteratorNames.items);
  3621. let evaluateKey = evaluateLater(
  3622. el,
  3623. // the x-bind:key expression is stored for our use instead of evaluated.
  3624. el._x_keyExpression || "index"
  3625. );
  3626. el._x_prevKeys = [];
  3627. el._x_lookup = {};
  3628. effect3(() => loop(el, iteratorNames, evaluateItems, evaluateKey));
  3629. cleanup(() => {
  3630. Object.values(el._x_lookup).forEach((el2) => el2.remove());
  3631. delete el._x_prevKeys;
  3632. delete el._x_lookup;
  3633. });
  3634. });
  3635. function loop(el, iteratorNames, evaluateItems, evaluateKey) {
  3636. let isObject = (i) => typeof i === "object" && !Array.isArray(i);
  3637. let templateEl = el;
  3638. evaluateItems((items) => {
  3639. if (isNumeric3(items) && items >= 0) {
  3640. items = Array.from(Array(items).keys(), (i) => i + 1);
  3641. }
  3642. if (items === void 0)
  3643. items = [];
  3644. let lookup = el._x_lookup;
  3645. let prevKeys = el._x_prevKeys;
  3646. let scopes = [];
  3647. let keys = [];
  3648. if (isObject(items)) {
  3649. items = Object.entries(items).map(([key, value]) => {
  3650. let scope2 = getIterationScopeVariables(iteratorNames, value, key, items);
  3651. evaluateKey((value2) => keys.push(value2), { scope: { index: key, ...scope2 } });
  3652. scopes.push(scope2);
  3653. });
  3654. } else {
  3655. for (let i = 0; i < items.length; i++) {
  3656. let scope2 = getIterationScopeVariables(iteratorNames, items[i], i, items);
  3657. evaluateKey((value) => keys.push(value), { scope: { index: i, ...scope2 } });
  3658. scopes.push(scope2);
  3659. }
  3660. }
  3661. let adds = [];
  3662. let moves = [];
  3663. let removes = [];
  3664. let sames = [];
  3665. for (let i = 0; i < prevKeys.length; i++) {
  3666. let key = prevKeys[i];
  3667. if (keys.indexOf(key) === -1)
  3668. removes.push(key);
  3669. }
  3670. prevKeys = prevKeys.filter((key) => !removes.includes(key));
  3671. let lastKey = "template";
  3672. for (let i = 0; i < keys.length; i++) {
  3673. let key = keys[i];
  3674. let prevIndex = prevKeys.indexOf(key);
  3675. if (prevIndex === -1) {
  3676. prevKeys.splice(i, 0, key);
  3677. adds.push([lastKey, i]);
  3678. } else if (prevIndex !== i) {
  3679. let keyInSpot = prevKeys.splice(i, 1)[0];
  3680. let keyForSpot = prevKeys.splice(prevIndex - 1, 1)[0];
  3681. prevKeys.splice(i, 0, keyForSpot);
  3682. prevKeys.splice(prevIndex, 0, keyInSpot);
  3683. moves.push([keyInSpot, keyForSpot]);
  3684. } else {
  3685. sames.push(key);
  3686. }
  3687. lastKey = key;
  3688. }
  3689. for (let i = 0; i < removes.length; i++) {
  3690. let key = removes[i];
  3691. if (!!lookup[key]._x_effects) {
  3692. lookup[key]._x_effects.forEach(dequeueJob);
  3693. }
  3694. lookup[key].remove();
  3695. lookup[key] = null;
  3696. delete lookup[key];
  3697. }
  3698. for (let i = 0; i < moves.length; i++) {
  3699. let [keyInSpot, keyForSpot] = moves[i];
  3700. let elInSpot = lookup[keyInSpot];
  3701. let elForSpot = lookup[keyForSpot];
  3702. let marker = document.createElement("div");
  3703. mutateDom(() => {
  3704. if (!elForSpot)
  3705. warn(`x-for ":key" is undefined or invalid`, templateEl);
  3706. elForSpot.after(marker);
  3707. elInSpot.after(elForSpot);
  3708. elForSpot._x_currentIfEl && elForSpot.after(elForSpot._x_currentIfEl);
  3709. marker.before(elInSpot);
  3710. elInSpot._x_currentIfEl && elInSpot.after(elInSpot._x_currentIfEl);
  3711. marker.remove();
  3712. });
  3713. elForSpot._x_refreshXForScope(scopes[keys.indexOf(keyForSpot)]);
  3714. }
  3715. for (let i = 0; i < adds.length; i++) {
  3716. let [lastKey2, index] = adds[i];
  3717. let lastEl = lastKey2 === "template" ? templateEl : lookup[lastKey2];
  3718. if (lastEl._x_currentIfEl)
  3719. lastEl = lastEl._x_currentIfEl;
  3720. let scope2 = scopes[index];
  3721. let key = keys[index];
  3722. let clone2 = document.importNode(templateEl.content, true).firstElementChild;
  3723. let reactiveScope = reactive(scope2);
  3724. addScopeToNode(clone2, reactiveScope, templateEl);
  3725. clone2._x_refreshXForScope = (newScope) => {
  3726. Object.entries(newScope).forEach(([key2, value]) => {
  3727. reactiveScope[key2] = value;
  3728. });
  3729. };
  3730. mutateDom(() => {
  3731. lastEl.after(clone2);
  3732. initTree(clone2);
  3733. });
  3734. if (typeof key === "object") {
  3735. warn("x-for key cannot be an object, it must be a string or an integer", templateEl);
  3736. }
  3737. lookup[key] = clone2;
  3738. }
  3739. for (let i = 0; i < sames.length; i++) {
  3740. lookup[sames[i]]._x_refreshXForScope(scopes[keys.indexOf(sames[i])]);
  3741. }
  3742. templateEl._x_prevKeys = keys;
  3743. });
  3744. }
  3745. function parseForExpression(expression) {
  3746. let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  3747. let stripParensRE = /^\s*\(|\)\s*$/g;
  3748. let forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  3749. let inMatch = expression.match(forAliasRE);
  3750. if (!inMatch)
  3751. return;
  3752. let res = {};
  3753. res.items = inMatch[2].trim();
  3754. let item = inMatch[1].replace(stripParensRE, "").trim();
  3755. let iteratorMatch = item.match(forIteratorRE);
  3756. if (iteratorMatch) {
  3757. res.item = item.replace(forIteratorRE, "").trim();
  3758. res.index = iteratorMatch[1].trim();
  3759. if (iteratorMatch[2]) {
  3760. res.collection = iteratorMatch[2].trim();
  3761. }
  3762. } else {
  3763. res.item = item;
  3764. }
  3765. return res;
  3766. }
  3767. function getIterationScopeVariables(iteratorNames, item, index, items) {
  3768. let scopeVariables = {};
  3769. if (/^\[.*\]$/.test(iteratorNames.item) && Array.isArray(item)) {
  3770. let names = iteratorNames.item.replace("[", "").replace("]", "").split(",").map((i) => i.trim());
  3771. names.forEach((name, i) => {
  3772. scopeVariables[name] = item[i];
  3773. });
  3774. } else if (/^\{.*\}$/.test(iteratorNames.item) && !Array.isArray(item) && typeof item === "object") {
  3775. let names = iteratorNames.item.replace("{", "").replace("}", "").split(",").map((i) => i.trim());
  3776. names.forEach((name) => {
  3777. scopeVariables[name] = item[name];
  3778. });
  3779. } else {
  3780. scopeVariables[iteratorNames.item] = item;
  3781. }
  3782. if (iteratorNames.index)
  3783. scopeVariables[iteratorNames.index] = index;
  3784. if (iteratorNames.collection)
  3785. scopeVariables[iteratorNames.collection] = items;
  3786. return scopeVariables;
  3787. }
  3788. function isNumeric3(subject) {
  3789. return !Array.isArray(subject) && !isNaN(subject);
  3790. }
  3791. // packages/alpinejs/src/directives/x-ref.js
  3792. function handler3() {
  3793. }
  3794. handler3.inline = (el, { expression }, { cleanup }) => {
  3795. let root = closestRoot(el);
  3796. if (!root._x_refs)
  3797. root._x_refs = {};
  3798. root._x_refs[expression] = el;
  3799. cleanup(() => delete root._x_refs[expression]);
  3800. };
  3801. directive("ref", handler3);
  3802. // packages/alpinejs/src/directives/x-if.js
  3803. directive("if", (el, { expression }, { effect: effect3, cleanup }) => {
  3804. let evaluate2 = evaluateLater(el, expression);
  3805. let show = () => {
  3806. if (el._x_currentIfEl)
  3807. return el._x_currentIfEl;
  3808. let clone2 = el.content.cloneNode(true).firstElementChild;
  3809. addScopeToNode(clone2, {}, el);
  3810. mutateDom(() => {
  3811. el.after(clone2);
  3812. initTree(clone2);
  3813. });
  3814. el._x_currentIfEl = clone2;
  3815. el._x_undoIf = () => {
  3816. walk(clone2, (node) => {
  3817. if (!!node._x_effects) {
  3818. node._x_effects.forEach(dequeueJob);
  3819. }
  3820. });
  3821. clone2.remove();
  3822. delete el._x_currentIfEl;
  3823. };
  3824. return clone2;
  3825. };
  3826. let hide = () => {
  3827. if (!el._x_undoIf)
  3828. return;
  3829. el._x_undoIf();
  3830. delete el._x_undoIf;
  3831. };
  3832. effect3(() => evaluate2((value) => {
  3833. value ? show() : hide();
  3834. }));
  3835. cleanup(() => el._x_undoIf && el._x_undoIf());
  3836. });
  3837. // packages/alpinejs/src/directives/x-id.js
  3838. directive("id", (el, { expression }, { evaluate: evaluate2 }) => {
  3839. let names = evaluate2(expression);
  3840. names.forEach((name) => setIdRoot(el, name));
  3841. });
  3842. // packages/alpinejs/src/directives/x-on.js
  3843. mapAttributes(startingWith("@", into(prefix("on:"))));
  3844. directive("on", skipDuringClone((el, { value, modifiers, expression }, { cleanup }) => {
  3845. let evaluate2 = expression ? evaluateLater(el, expression) : () => {
  3846. };
  3847. if (el.tagName.toLowerCase() === "template") {
  3848. if (!el._x_forwardEvents)
  3849. el._x_forwardEvents = [];
  3850. if (!el._x_forwardEvents.includes(value))
  3851. el._x_forwardEvents.push(value);
  3852. }
  3853. let removeListener = on(el, value, modifiers, (e) => {
  3854. evaluate2(() => {
  3855. }, { scope: { "$event": e }, params: [e] });
  3856. });
  3857. cleanup(() => removeListener());
  3858. }));
  3859. // packages/alpinejs/src/directives/index.js
  3860. warnMissingPluginDirective("Collapse", "collapse", "collapse");
  3861. warnMissingPluginDirective("Intersect", "intersect", "intersect");
  3862. warnMissingPluginDirective("Focus", "trap", "focus");
  3863. warnMissingPluginDirective("Mask", "mask", "mask");
  3864. function warnMissingPluginDirective(name, directiveName2, slug) {
  3865. directive(directiveName2, (el) => warn(`You can't use [x-${directiveName2}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
  3866. }
  3867. // packages/alpinejs/src/index.js
  3868. alpine_default.setEvaluator(normalEvaluator);
  3869. alpine_default.setReactivityEngine({ reactive: import_reactivity9.reactive, effect: import_reactivity9.effect, release: import_reactivity9.stop, raw: import_reactivity9.toRaw });
  3870. var src_default = alpine_default;
  3871. // packages/alpinejs/builds/module.js
  3872. var module_default = src_default;
  3873. // Annotate the CommonJS export names for ESM import in node:
  3874. 0 && (module.exports = {});