mancha 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/browser.js +23 -23
- package/dist/css_custom.d.ts +4 -5
- package/dist/css_custom.js +108 -56
- package/dist/css_custom.js.map +1 -1
- package/dist/css_gen_utils.js +14 -0
- package/dist/css_gen_utils.js.map +1 -1
- package/dist/mancha.js +24 -24
- package/docs/05_css.md +71 -9
- package/package.json +2 -1
package/dist/mancha.js
CHANGED
|
@@ -8,39 +8,39 @@ function i(e,t){let n=r(t);n!==void 0&&(e.href=n)}
|
|
|
8
8
|
* @license
|
|
9
9
|
* SPDX-License-Identifier: Apache-2.0
|
|
10
10
|
*/
|
|
11
|
-
function a(e,t){let n=r(t);n!==void 0&&(e.href=n)}let o={};var s=class{constructor(e,t){this.privateDoNotAccessOrElseWrappedAttributePrefix=t}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}};let c=s;function l(e){return new c(o,e)}function u(e){return e instanceof s}function d(e){if(u(e))return e.privateDoNotAccessOrElseWrappedAttributePrefix;throw Error(``)}function
|
|
11
|
+
function a(e,t){let n=r(t);n!==void 0&&(e.href=n)}let o={};var s=class{constructor(e,t){this.privateDoNotAccessOrElseWrappedAttributePrefix=t}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}};let c=s;function l(e){return new c(o,e)}function u(e){return e instanceof s}function d(e){if(u(e))return e.privateDoNotAccessOrElseWrappedAttributePrefix;throw Error(``)}function f(e,t,n,r){if(e.length===0)throw Error(``);let i=e.map(e=>d(e)),a=n.toLowerCase();if(i.every(e=>a.indexOf(e)!==0))throw Error(`Attribute "${n}" does not match any of the allowed prefixes.`);t.setAttribute(n,r)}var p=class{},m=class extends p{constructor(e,t){super(),this.privateDoNotAccessOrElseWrappedStyleSheet=e}toString(){return this.privateDoNotAccessOrElseWrappedStyleSheet}};function h(e){return new m(e,o)}function g(e){if(e instanceof m)return e.privateDoNotAccessOrElseWrappedStyleSheet;throw Error(``)}
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* SPDX-License-Identifier: Apache-2.0
|
|
15
15
|
*/
|
|
16
|
-
function g(e,t){e.textContent=h(t)}let _={sm:640,md:768,lg:1024,xl:1280},te=Object.entries(_),v=.25,y=[...Array(15)].map((e,t)=>t+1),ne=[16,20,24,28,32,36,40,48,56,64],re=[72,80,96,128,160,192,256,320,384,512],b=[...y,...ne,...re,...Object.values(_)],ie=Array.from({length:20},(e,t)=>(t+1)*5),ae=[25,50,75,100,150,200,300,500,700,1e3],x={margin:`m`},oe={padding:`p`},se={...x,...oe},ce={width:`w`,height:`h`},le={top:`top`,right:`right`,bottom:`bottom`,left:`left`},ue={"min-width":`min-w`,"min-height":`min-h`,"max-width":`max-w`,"max-height":`max-h`},S=`transition-timing-function: ease-in-out; transition-duration: var(--transition-duration, 150ms)`,de=`rgb(59 130 246 / 0.5)`,C=`var(--ring-color, ${de})`,fe={"font-mono":`font-family: monospace`,"font-sans":`font-family: sans-serif`,"font-serif":`font-family: serif`,"font-cursive":`font-family: cursive`,"text-xs":`font-size: .75rem; line-height: calc(1 / 0.75)`,"text-sm":`font-size: .875rem; line-height: calc(1.25 / 0.875)`,"text-base":`font-size: 1rem; line-height: calc(1.5 / 1)`,"text-lg":`font-size: 1.125rem; line-height: calc(1.75 / 1.125)`,"text-xl":`font-size: 1.25rem; line-height: calc(1.75 / 1.25)`,"text-2xl":`font-size: 1.5rem; line-height: calc(2 / 1.5)`,"text-3xl":`font-size: 1.875rem; line-height: calc(2.25 / 1.875)`,"text-4xl":`font-size: 2.25rem; line-height: calc(2.5 / 2.25)`,"text-5xl":`font-size: 3rem; line-height: 1`,"text-6xl":`font-size: 3.75rem; line-height: 1`,"text-7xl":`font-size: 4.5rem; line-height: 1`,"font-thin":`font-weight: 100`,"font-extralight":`font-weight: 200`,"font-light":`font-weight: 300`,"font-normal":`font-weight: 400`,"font-medium":`font-weight: 500`,"font-semibold":`font-weight: 600`,"font-bold":`font-weight: 700`,"font-extrabold":`font-weight: 800`,"font-black":`font-weight: 900`,italic:`font-style: italic`,"not-italic":`font-style: normal`,"w-max":`width: max-content`,"w-min":`width: min-content`,"w-fit":`width: fit-content`,"h-max":`height: max-content`,"h-min":`height: min-content`,"h-fit":`height: fit-content`,"size-auto":`width: auto; height: auto`,"size-px":`width: 1px; height: 1px`,"size-full":`width: 100%; height: 100%`,"size-dvw":`width: 100dvw; height: 100dvw`,"size-dvh":`width: 100dvh; height: 100dvh`,"size-lvw":`width: 100lvw; height: 100lvw`,"size-lvh":`width: 100lvh; height: 100lvh`,"size-svw":`width: 100svw; height: 100svw`,"size-svh":`width: 100svh; height: 100svh`,"size-min":`width: min-content; height: min-content`,"size-max":`width: max-content; height: max-content`,"size-fit":`width: fit-content; height: fit-content`,"tracking-tighter":`letter-spacing: -0.05em`,"tracking-tight":`letter-spacing: -0.025em`,"tracking-normal":`letter-spacing: 0`,"tracking-wide":`letter-spacing: 0.025em`,"tracking-wider":`letter-spacing: 0.05em`,"tracking-widest":`letter-spacing: 0.1em`,"leading-none":`line-height: 1`,"leading-tight":`line-height: 1.25`,"leading-snug":`line-height: 1.375`,"leading-normal":`line-height: 1.5`,"leading-relaxed":`line-height: 1.625`,"leading-loose":`line-height: 2`,"text-left":`text-align: left`,"text-right":`text-align: right`,"text-center":`text-align: center`,"text-justify":`text-align: justify`,underline:`text-decoration: underline`,"no-underline":`text-decoration: none`,"decoration-none":`text-decoration: none`,"line-through":`text-decoration: line-through`,uppercase:`text-transform: uppercase`,lowercase:`text-transform: lowercase`,capitalize:`text-transform: capitalize`,truncate:`white-space: nowrap; overflow: hidden; text-overflow: ellipsis`,"text-elipsis":`text-overflow: ellipsis`,"text-clip":`text-overflow: clip`,"text-wrap":`text-wrap: wrap`,"text-nowrap":`text-wrap: nowrap`,"text-balance":`text-wrap: balance`,"text-pretty":`text-wrap: pretty`,"whitespace-normal":`white-space: normal`,"whitespace-nowrap":`white-space: nowrap`,"whitespace-pre":`white-space: pre`,"whitespace-pre-line":`white-space: pre-line`,"whitespace-pre-wrap":`white-space: pre-wrap`,"whitespace-break-spaces":`white-space: break-spaces`,relative:`position: relative`,fixed:`position: fixed`,absolute:`position: absolute`,sticky:`position: sticky`,"object-contain":`object-fit: contain`,"object-cover":`object-fit: cover`,"object-fill":`object-fit: fill`,"object-none":`object-fit: none`,block:`display: block`,contents:`display: contents`,hidden:`display: none`,inline:`display: inline`,"inline-block":`display: inline-block`,visible:`visibility: visible`,invisible:`visibility: hidden`,collapse:`visibility: collapse`,"list-none":`list-style-type: none`,"list-disc":`list-style-type: disc`,"list-decimal":`list-style-type: decimal`,flex:`display: flex`,grid:`display: grid`,"flex-1":`flex: 1 1 0%`,"flex-inline":`display: inline-flex`,"flex-row":`flex-direction: row`,"flex-col":`flex-direction: column`,"flex-row-reverse":`flex-direction: row-reverse`,"flex-col-reverse":`flex-direction: column-reverse`,"flex-wrap":`flex-wrap: wrap`,"flex-wrap-reverse":`flex-wrap: wrap-reverse`,"flex-nowrap":`flex-wrap: nowrap`,"justify-start":`justify-content: flex-start`,"justify-end":`justify-content: flex-end`,"justify-center":`justify-content: center`,"justify-between":`justify-content: space-between`,"justify-around":`justify-content: space-around`,"justify-evenly":`justify-content: space-evenly`,"justify-stretch":`justify-content: stretch`,"items-start":`align-items: flex-start`,"items-end":`align-items: flex-end`,"items-center":`align-items: center`,"items-stretch":`align-items: stretch`,"flex-grow":`flex-grow: 1`,"flex-shrink":`flex-shrink: 1`,"align-baseline":`vertical-align: baseline`,"align-top":`vertical-align: top`,"align-middle":`vertical-align: middle`,"align-bottom":`vertical-align: bottom`,"align-text-top":`vertical-align: text-top`,"align-text-bottom":`vertical-align: text-bottom`,"overflow-auto":`overflow: auto`,"overflow-x-auto":`overflow-x: auto`,"overflow-y-auto":`overflow-y: auto`,"overflow-hidden":`overflow: hidden`,"overflow-x-hidden":`overflow-x: hidden`,"overflow-y-hidden":`overflow-y: hidden`,"overflow-visible":`overflow: visible`,"overscroll-auto":`overscroll-behavior: auto`,"overscroll-contain":`overscroll-behavior: contain`,"overscroll-none":`overscroll-behavior: none`,"overscroll-x-auto":`overscroll-behavior-x: auto`,"overscroll-x-contain":`overscroll-behavior-x: contain`,"overscroll-x-none":`overscroll-behavior-x: none`,"overscroll-y-auto":`overscroll-behavior-y: auto`,"overscroll-y-contain":`overscroll-behavior-y: contain`,"overscroll-y-none":`overscroll-behavior-y: none`,"z-auto":`z-index: auto`,"cursor-pointer":`cursor: pointer`,"cursor-wait":`cursor: wait`,"cursor-not-allowed":`cursor: not-allowed`,"select-none":`user-select: none`,"select-all":`user-select: all`,"pointer-events-auto":`pointer-events: auto`,"pointer-events-none":`pointer-events: none`,"box-border":`box-sizing: border-box`,"box-content":`box-sizing: content-box`,resize:`resize: both`,"resize-x":`resize: horizontal`,"resize-y":`resize: vertical`,"resize-none":`resize: none`,"appearance-none":`appearance: none; -webkit-appearance: none; -moz-appearance: none`,border:`border: 1px solid`,"border-none":`border: none`,"border-solid":`border-style: solid`,"border-dashed":`border-style: dashed`,"border-dotted":`border-style: dotted`,"border-collapse":`border-collapse: collapse`,"rounded-none":`border-radius: 0`,rounded:`border-radius: .25rem`,"rounded-sm":`border-radius: .125rem`,"rounded-md":`border-radius: .375rem`,"rounded-lg":`border-radius: .5rem`,"rounded-xl":`border-radius: .75rem`,"rounded-full":`border-radius: 9999px`,"shadow-2xs":`box-shadow: 0 1px rgb(0 0 0 / 0.05)`,"shadow-xs":`box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05)`,shadow:`box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`,"shadow-sm":`box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`,"shadow-md":`box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)`,"shadow-lg":`box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)`,"shadow-xl":`box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)`,"shadow-2xl":`box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25)`,"shadow-inner":`box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05)`,"shadow-none":`box-shadow: 0 0 #0000`,ring:`box-shadow: var(--ring-inset, ) 0 0 0 3px ${C}`,"ring-0":`box-shadow: var(--ring-inset, ) 0 0 0 0px ${C}`,"ring-1":`box-shadow: var(--ring-inset, ) 0 0 0 1px ${C}`,"ring-2":`box-shadow: var(--ring-inset, ) 0 0 0 2px ${C}`,"ring-4":`box-shadow: var(--ring-inset, ) 0 0 0 4px ${C}`,"ring-8":`box-shadow: var(--ring-inset, ) 0 0 0 8px ${C}`,"ring-inset":`--ring-inset: inset`,outline:`outline-style: solid`,"outline-none":`outline: 2px solid transparent; outline-offset: 2px`,"outline-dashed":`outline-style: dashed`,"outline-dotted":`outline-style: dotted`,"outline-double":`outline-style: double`,"outline-0":`outline-width: 0px`,"outline-1":`outline-width: 1px`,"outline-2":`outline-width: 2px`,"outline-4":`outline-width: 4px`,"outline-8":`outline-width: 8px`,"outline-offset-0":`outline-offset: 0px`,"outline-offset-1":`outline-offset: 1px`,"outline-offset-2":`outline-offset: 2px`,"outline-offset-4":`outline-offset: 4px`,"outline-offset-8":`outline-offset: 8px`,"aspect-auto":`aspect-ratio: auto`,"aspect-square":`aspect-ratio: 1 / 1`,"aspect-video":`aspect-ratio: 16 / 9`,"backdrop-blur-none":`backdrop-filter: blur(0)`,"backdrop-blur-sm":`backdrop-filter: blur(4px)`,"backdrop-blur":`backdrop-filter: blur(8px)`,"backdrop-blur-md":`backdrop-filter: blur(12px)`,"backdrop-blur-lg":`backdrop-filter: blur(16px)`,"backdrop-blur-xl":`backdrop-filter: blur(24px)`,"backdrop-blur-2xl":`backdrop-filter: blur(40px)`,"backdrop-blur-3xl":`backdrop-filter: blur(64px)`,"transition-none":`transition: none`,transition:`transition-property: all; ${S}`,"transition-all":`transition-property: all; ${S}`,"transition-opacity":`transition-property: opacity; ${S}`,"transition-transform":`transition-property: transform; ${S}`,"transition-shadow":`transition-property: box-shadow; ${S}`,"transition-colors":`transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; ${S}`,"animate-none":`animation: none`,"animate-spin":`animation: spin 1s linear infinite`,"animate-ping":`animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite`,"animate-pulse":`animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite`,"bg-auto":`background-size: auto`,"bg-cover":`background-size: cover`,"bg-contain":`background-size: contain`,"bg-center":`background-position: center`,"bg-top":`background-position: top`,"bg-bottom":`background-position: bottom`,"bg-left":`background-position: left`,"bg-right":`background-position: right`,"bg-left-top":`background-position: left top`,"bg-left-bottom":`background-position: left bottom`,"bg-right-top":`background-position: right top`,"bg-right-bottom":`background-position: right bottom`,"bg-no-repeat":`background-repeat: no-repeat`,"bg-fixed":`background-attachment: fixed`,"bg-local":`background-attachment: local`,"bg-scroll":`background-attachment: scroll`,"min-h-screen":`min-height: 100vh`,"max-h-screen":`max-height: 100vh`,"min-w-screen":`min-width: 100vw`,"h-dvh":`height: 100dvh`,"h-svh":`height: 100svh`,"h-lvh":`height: 100lvh`,"w-dvw":`width: 100dvw`,"w-svw":`width: 100svw`,"w-lvw":`width: 100lvw`,"min-h-dvh":`min-height: 100dvh`,"min-h-svh":`min-height: 100svh`,"min-h-lvh":`min-height: 100lvh`,"flex-none":`flex: none`,"flex-auto":`flex: 1 1 auto`,"flex-initial":`flex: 0 1 auto`,grow:`flex-grow: 1`,"grow-0":`flex-grow: 0`,shrink:`flex-shrink: 1`,"shrink-0":`flex-shrink: 0`,"self-auto":`align-self: auto`,"self-start":`align-self: flex-start`,"self-end":`align-self: flex-end`,"self-center":`align-self: center`,"self-stretch":`align-self: stretch`,"self-baseline":`align-self: baseline`,"content-normal":`align-content: normal`,"content-start":`align-content: flex-start`,"content-end":`align-content: flex-end`,"content-center":`align-content: center`,"content-between":`align-content: space-between`,"content-around":`align-content: space-around`,"content-evenly":`align-content: space-evenly`,"content-stretch":`align-content: stretch`,"items-baseline":`align-items: baseline`,"inset-0":`inset: 0`,"inset-auto":`inset: auto`,"inset-x-0":`left: 0; right: 0`,"inset-y-0":`top: 0; bottom: 0`,"inset-x-auto":`left: auto; right: auto`,"inset-y-auto":`top: auto; bottom: auto`,"sr-only":`position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0`,"not-sr-only":`position: static; width: auto; height: auto; padding: 0; margin: 0; overflow: visible; clip: auto; white-space: normal`},pe=[`*,::before,::after{--ring-color:${de}}`,`@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}`,`@keyframes ping{75%,100%{transform:scale(2);opacity:0}}`,`@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}`],me=`red pink purple deep-purple indigo blue light-blue cyan teal green light-green lime yellow amber orange deep-orange brown gray blue-gray`.split(` `),he=[50,100,200,300,400,500,600,700,800,900],ge=Object.fromEntries(me.map((e,t)=>[e,Object.fromEntries(he.map((e,n)=>{let r=(t*he.length+n)*6;return[e,`#${`ffebeeffcdd2ef9a9ae57373ef5350f44336e53935d32f2fc62828b71c1cfce4ecf8bbd0f48fb1f06292ec407ae91e63d81b60c2185bad1457880e4ff3e5f5e1bee7ce93d8ba68c8ab47bc9c27b08e24aa7b1fa26a1b9a4a148cede7f6d1c4e9b39ddb9575cd7e57c2673ab75e35b1512da84527a0311b92e8eaf6c5cae99fa8da7986cb5c6bc03f51b53949ab303f9f2835931a237ee3f2fdbbdefb90caf964b5f642a5f52196f31e88e51976d21565c00d47a1e1f5feb3e5fc81d4fa4fc3f729b6f603a9f4039be50288d10277bd01579be0f7fab2ebf280deea4dd0e126c6da00bcd400acc10097a700838f006064e0f2f1b2dfdb80cbc44db6ac26a69a00968800897b00796b00695c004d40e8f5e9c8e6c9a5d6a781c78466bb6a4caf5043a047388e3c2e7d321b5e20f1f8e9dcedc8c5e1a5aed5819ccc658bc34a7cb342689f38558b2f33691ef9fbe7f0f4c3e6ee9cdce775d4e157cddc39c0ca33afb42b9e9d24827717fffde7fff9c4fff59dfff176ffee58ffeb3bfdd835fbc02df9a825f57f17fff8e1ffecb3ffe082ffd54fffca28ffc107ffb300ffa000ff8f00ff6f00fff3e0ffe0b2ffcc80ffb74dffa726ff9800fb8c00f57c00ef6c00e65100fbe9e7ffccbcffab91ff8a65ff7043ff5722f4511ee64a19d84315bf360cefebe9d7ccc8bcaaa4a1887f8d6e637955486d4c415d40374e342e3e2723fafafaf5f5f5eeeeeee0e0e0bdbdbd9e9e9e757575616161424242212121eceff1cfd8dcb0bec590a4ae78909c607d8b546e7a455a6437474f263238`.slice(r,r+6)}`]}))]));function w(e){return e.map(([e,t])=>`.${e} { ${t} }`)}let _e=[``,`-`],T=[``],ve=[[`top`,`t`],[`bottom`,`b`],[`left`,`l`],[`right`,`r`]];function E(e,t,n){let r=(r,i)=>[`${e}${t(r)}`,n(`${e}${i}`)];return[...b.map(e=>r(`${e}`,`${e*v}rem`)),...b.map(e=>r(`${e}px`,`${e}px`)),...ie.map(e=>r(`${e}\\%`,`${e}%`))]}function D(e,t=_e){return w(Object.entries(e).flatMap(([e,n])=>[[`${n}-0`,`${e}: 0`],[`${n}-screen`,`${e}: 100v${e.includes(`height`)?`h`:`w`}`],[`${n}-full`,`${e}: 100%`],...t.flatMap(t=>E(t,e=>`${n}-${e}`,t=>`${e}: ${t}`)),...te.map(([t,r])=>[`${n}-${t}`,`${e}: ${r}px`])]))}function ye(e){return w(Object.entries(e).map(([e,t])=>[`${t}-auto`,`${e}: auto`]))}function be(e){return w(Object.entries(e).flatMap(([e,t])=>[[`${t}x-auto`,`${e}-left: auto; ${e}-right: auto;`],[`${t}y-auto`,`${e}-top: auto; ${e}-bottom: auto;`],...ve.map(([n,r])=>[`${t}${r}-auto`,`${e}-${n}: auto`])]))}function xe(e){return w(Object.entries(e).flatMap(([e,t])=>[[`${t}x-0`,`${e}-left: 0; ${e}-right: 0;`],[`${t}y-0`,`${e}-top: 0; ${e}-bottom: 0;`],...E(``,e=>`${t}x-${e}`,t=>`${e}-left: ${t}; ${e}-right: ${t};`),...E(``,e=>`${t}y-${e}`,t=>`${e}-top: ${t}; ${e}-bottom: ${t};`)]))}function Se(e,t=_e){return w(Object.entries(e).flatMap(([e,n])=>[[`${n}t-0`,`${e}-top: 0`],[`${n}b-0`,`${e}-bottom: 0`],[`${n}l-0`,`${e}-left: 0`],[`${n}r-0`,`${e}-right: 0`],...t.flatMap(t=>ve.flatMap(([r,i])=>E(t,e=>`${n}${i}-${e}`,t=>`${e}-${r}: ${t}`)))]))}function Ce(){return w([[`border`,`border-width: 1px`],[`border-x`,`border-inline-width: 1px`],[`border-y`,`border-block-width: 1px`],...[0,...y].map(e=>[`border-${e}`,`border-width: ${e}px`]),...[0,...y].map(e=>[`border-x-${e}`,`border-inline-width: ${e}px;`]),...[0,...y].map(e=>[`border-y-${e}`,`border-block-width: ${e}px;`]),...ve.flatMap(([e,t])=>[[`border-${t}`,`border-${e}-width: 1px`],...[0,...y].map(n=>[`border-${t}-${n}`,`border-${e}-width: ${n}px`])])])}function we(){return w(ie.map(e=>[`z-${e}`,`z-index: ${e}`]))}function Te(){return w(ae.map(e=>[`duration-${e}`,`--transition-duration: ${e}ms; transition-duration: ${e}ms`]))}function Ee(){return w([[`space-x-0 > *`,`margin-left: 0`],[`space-y-0 > *`,`margin-top: 0`],...b.map(e=>[`space-x-${e} > :not(:first-child)`,`margin-left: ${e*v}rem`]),...b.map(e=>[`space-y-${e} > :not(:first-child)`,`margin-top: ${e*v}rem`]),...b.map(e=>[`space-x-${e}px > :not(:first-child)`,`margin-left: ${e}px`]),...b.map(e=>[`space-y-${e}px > :not(:first-child)`,`margin-top: ${e}px`]),[`gap-0`,`gap: 0`],...b.map(e=>[`gap-${e}`,`gap: ${e*v}rem`]),...b.map(e=>[`gap-${e}px`,`gap: ${e}px`]),...b.map(e=>[`gap-x-${e}`,`column-gap: ${e*v}rem`]),...b.map(e=>[`gap-y-${e}`,`row-gap: ${e*v}rem`]),...b.map(e=>[`gap-x-${e}px`,`column-gap: ${e}px`]),...b.map(e=>[`gap-y-${e}px`,`row-gap: ${e}px`]),[`divide-x > :not(:last-child)`,`border-inline-end-width: 1px`],[`divide-y > :not(:last-child)`,`border-bottom-width: 1px`],[`divide-x-0 > :not(:last-child)`,`border-inline-end-width: 0px`],[`divide-y-0 > :not(:last-child)`,`border-bottom-width: 0px`],...[2,4,8].map(e=>[`divide-x-${e} > :not(:last-child)`,`border-inline-end-width: ${e}px`]),...[2,4,8].map(e=>[`divide-y-${e} > :not(:last-child)`,`border-bottom-width: ${e}px`]),[`divide-solid > :not(:last-child)`,`border-style: solid`],[`divide-dashed > :not(:last-child)`,`border-style: dashed`],[`divide-dotted > :not(:last-child)`,`border-style: dotted`],[`divide-none > :not(:last-child)`,`border-style: none`]])}function De(){return w([...Array.from({length:100},(e,t)=>[`text-${t}px`,`font-size: ${t}px`]),...Array.from({length:100},(e,t)=>[`text-${String(t*v).replace(`.`,`\\.`)}rem`,`font-size: ${t*v}rem`])])}function Oe(){return w([`column`,`row`].flatMap(e=>{let t=e.slice(0,3);return[...Array.from({length:12},(e,t)=>t+1).map(n=>[`grid-${t}s-${n}`,`grid-template-${e}s: repeat(${n}, minmax(0, 1fr))`]),[`grid-${t}s-none`,`grid-template-${e}s: none`],...Array.from({length:12},(e,t)=>t+1).map(n=>[`${t}-span-${n}`,`grid-${e}: span ${n} / span ${n}`]),[`${t}-span-full`,`grid-${e}: 1 / -1`],...Array.from({length:13},(e,t)=>t+1).map(n=>[`${t}-start-${n}`,`grid-${e}-start: ${n}`]),[`${t}-start-auto`,`grid-${e}-start: auto`],...Array.from({length:13},(e,t)=>t+1).map(n=>[`${t}-end-${n}`,`grid-${e}-end: ${n}`]),[`${t}-end-auto`,`grid-${e}-end: auto`]]}))}function ke(){return Object.entries(fe).map(([e,t])=>`.${e} { ${t} }`)}function Ae(e){let t=0,n=0,r=0;return e.length===4?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):e.length===7&&(t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16)),`${t} ${n} ${r}`}let je=[[`text`,`color`,``],[`fill`,`fill`,``],[`bg`,`background-color`,``],[`border`,`border-color`,``],[`divide`,`border-color`,` > :not(:last-child)`],[`ring`,`--ring-color`,``]];function Me(){let e=(e,t)=>je.map(([n,r,i])=>[`${n}-${e}${i}`,`${r}: ${t}`]);return w([...e(`white`,`#fff`),...e(`black`,`#000`),...e(`transparent`,`transparent`),...Object.entries(ge).flatMap(([t,n])=>[...e(t,n[500]),...Object.entries(n).flatMap(([n,r])=>e(`${t}-${n}`,r))])])}function Ne(){return w([[`opacity-0`,`opacity: 0`],...ie.map(e=>[`opacity-${e}`,`opacity: ${e/100}`])])}let Pe=null;function Fe(){return Pe===null&&(Pe=[...pe,...ke(),...Me(),...Ne(),...we(),...Te(),...D(le),...D(ce,T),...ye(ce),...D(x),...D(oe,T),...ye(x),...be(x),...xe(se),...Se(x),...Se(oe,T),...Ee(),...D(ue,T),...Ce(),...De(),...Oe()].join(`
|
|
17
|
-
`)),
|
|
18
|
-
`,
|
|
19
|
-
`,
|
|
20
|
-
`,
|
|
21
|
-
`,
|
|
22
|
-
`,
|
|
23
|
-
`,
|
|
24
|
-
`,
|
|
25
|
-
`,
|
|
26
|
-
`,
|
|
27
|
-
`,
|
|
28
|
-
`,
|
|
29
|
-
`,
|
|
30
|
-
`,
|
|
31
|
-
`,
|
|
32
|
-
`,
|
|
16
|
+
function _(e,t){e.textContent=g(t)}let ee={sm:640,md:768,lg:1024,xl:1280},te=Object.entries(ee),v=.25,y=[...Array(15)].map((e,t)=>t+1),ne=[16,20,24,28,32,36,40,48,56,64],re=[72,80,96,128,160,192,256,320,384,512],b=[...y,...ne,...re,...Object.values(ee)],ie=Array.from({length:20},(e,t)=>(t+1)*5),ae=[25,50,75,100,150,200,300,500,700,1e3],x={margin:`m`},oe={padding:`p`},se={...x,...oe},ce={width:`w`,height:`h`},le={top:`top`,right:`right`,bottom:`bottom`,left:`left`},ue={"min-width":`min-w`,"min-height":`min-h`,"max-width":`max-w`,"max-height":`max-h`},S=`transition-timing-function: ease-in-out; transition-duration: var(--transition-duration, 150ms)`,de=`rgb(59 130 246 / 0.5)`,C=`var(--ring-color, ${de})`,fe={"font-mono":`font-family: monospace`,"font-sans":`font-family: sans-serif`,"font-serif":`font-family: serif`,"font-cursive":`font-family: cursive`,"text-xs":`font-size: .75rem; line-height: calc(1 / 0.75)`,"text-sm":`font-size: .875rem; line-height: calc(1.25 / 0.875)`,"text-base":`font-size: 1rem; line-height: calc(1.5 / 1)`,"text-lg":`font-size: 1.125rem; line-height: calc(1.75 / 1.125)`,"text-xl":`font-size: 1.25rem; line-height: calc(1.75 / 1.25)`,"text-2xl":`font-size: 1.5rem; line-height: calc(2 / 1.5)`,"text-3xl":`font-size: 1.875rem; line-height: calc(2.25 / 1.875)`,"text-4xl":`font-size: 2.25rem; line-height: calc(2.5 / 2.25)`,"text-5xl":`font-size: 3rem; line-height: 1`,"text-6xl":`font-size: 3.75rem; line-height: 1`,"text-7xl":`font-size: 4.5rem; line-height: 1`,"font-thin":`font-weight: 100`,"font-extralight":`font-weight: 200`,"font-light":`font-weight: 300`,"font-normal":`font-weight: 400`,"font-medium":`font-weight: 500`,"font-semibold":`font-weight: 600`,"font-bold":`font-weight: 700`,"font-extrabold":`font-weight: 800`,"font-black":`font-weight: 900`,italic:`font-style: italic`,"not-italic":`font-style: normal`,"w-max":`width: max-content`,"w-min":`width: min-content`,"w-fit":`width: fit-content`,"h-max":`height: max-content`,"h-min":`height: min-content`,"h-fit":`height: fit-content`,"size-auto":`width: auto; height: auto`,"size-px":`width: 1px; height: 1px`,"size-full":`width: 100%; height: 100%`,"size-dvw":`width: 100dvw; height: 100dvw`,"size-dvh":`width: 100dvh; height: 100dvh`,"size-lvw":`width: 100lvw; height: 100lvw`,"size-lvh":`width: 100lvh; height: 100lvh`,"size-svw":`width: 100svw; height: 100svw`,"size-svh":`width: 100svh; height: 100svh`,"size-min":`width: min-content; height: min-content`,"size-max":`width: max-content; height: max-content`,"size-fit":`width: fit-content; height: fit-content`,"tracking-tighter":`letter-spacing: -0.05em`,"tracking-tight":`letter-spacing: -0.025em`,"tracking-normal":`letter-spacing: 0`,"tracking-wide":`letter-spacing: 0.025em`,"tracking-wider":`letter-spacing: 0.05em`,"tracking-widest":`letter-spacing: 0.1em`,"leading-none":`line-height: 1`,"leading-tight":`line-height: 1.25`,"leading-snug":`line-height: 1.375`,"leading-normal":`line-height: 1.5`,"leading-relaxed":`line-height: 1.625`,"leading-loose":`line-height: 2`,"text-left":`text-align: left`,"text-right":`text-align: right`,"text-center":`text-align: center`,"text-justify":`text-align: justify`,underline:`text-decoration: underline`,"no-underline":`text-decoration: none`,"decoration-none":`text-decoration: none`,"line-through":`text-decoration: line-through`,uppercase:`text-transform: uppercase`,lowercase:`text-transform: lowercase`,capitalize:`text-transform: capitalize`,truncate:`white-space: nowrap; overflow: hidden; text-overflow: ellipsis`,"text-elipsis":`text-overflow: ellipsis`,"text-clip":`text-overflow: clip`,"text-wrap":`text-wrap: wrap`,"text-nowrap":`text-wrap: nowrap`,"text-balance":`text-wrap: balance`,"text-pretty":`text-wrap: pretty`,"whitespace-normal":`white-space: normal`,"whitespace-nowrap":`white-space: nowrap`,"whitespace-pre":`white-space: pre`,"whitespace-pre-line":`white-space: pre-line`,"whitespace-pre-wrap":`white-space: pre-wrap`,"whitespace-break-spaces":`white-space: break-spaces`,relative:`position: relative`,fixed:`position: fixed`,absolute:`position: absolute`,sticky:`position: sticky`,"object-contain":`object-fit: contain`,"object-cover":`object-fit: cover`,"object-fill":`object-fit: fill`,"object-none":`object-fit: none`,block:`display: block`,contents:`display: contents`,hidden:`display: none`,inline:`display: inline`,"inline-block":`display: inline-block`,"list-item":`display: list-item`,"float-left":`float: left`,"float-right":`float: right`,"float-none":`float: none`,"clear-left":`clear: left`,"clear-right":`clear: right`,"clear-both":`clear: both`,"clear-none":`clear: none`,"break-normal":`overflow-wrap: normal; word-break: normal`,"break-words":`overflow-wrap: break-word`,"break-all":`word-break: break-all`,"break-keep":`word-break: keep-all`,visible:`visibility: visible`,invisible:`visibility: hidden`,collapse:`visibility: collapse`,"list-none":`list-style-type: none`,"list-disc":`list-style-type: disc`,"list-decimal":`list-style-type: decimal`,flex:`display: flex`,grid:`display: grid`,"flex-1":`flex: 1 1 0%`,"flex-inline":`display: inline-flex`,"flex-row":`flex-direction: row`,"flex-col":`flex-direction: column`,"flex-row-reverse":`flex-direction: row-reverse`,"flex-col-reverse":`flex-direction: column-reverse`,"flex-wrap":`flex-wrap: wrap`,"flex-wrap-reverse":`flex-wrap: wrap-reverse`,"flex-nowrap":`flex-wrap: nowrap`,"justify-start":`justify-content: flex-start`,"justify-end":`justify-content: flex-end`,"justify-center":`justify-content: center`,"justify-between":`justify-content: space-between`,"justify-around":`justify-content: space-around`,"justify-evenly":`justify-content: space-evenly`,"justify-stretch":`justify-content: stretch`,"items-start":`align-items: flex-start`,"items-end":`align-items: flex-end`,"items-center":`align-items: center`,"items-stretch":`align-items: stretch`,"flex-grow":`flex-grow: 1`,"flex-shrink":`flex-shrink: 1`,"align-baseline":`vertical-align: baseline`,"align-top":`vertical-align: top`,"align-middle":`vertical-align: middle`,"align-bottom":`vertical-align: bottom`,"align-text-top":`vertical-align: text-top`,"align-text-bottom":`vertical-align: text-bottom`,"overflow-auto":`overflow: auto`,"overflow-x-auto":`overflow-x: auto`,"overflow-y-auto":`overflow-y: auto`,"overflow-hidden":`overflow: hidden`,"overflow-x-hidden":`overflow-x: hidden`,"overflow-y-hidden":`overflow-y: hidden`,"overflow-visible":`overflow: visible`,"overscroll-auto":`overscroll-behavior: auto`,"overscroll-contain":`overscroll-behavior: contain`,"overscroll-none":`overscroll-behavior: none`,"overscroll-x-auto":`overscroll-behavior-x: auto`,"overscroll-x-contain":`overscroll-behavior-x: contain`,"overscroll-x-none":`overscroll-behavior-x: none`,"overscroll-y-auto":`overscroll-behavior-y: auto`,"overscroll-y-contain":`overscroll-behavior-y: contain`,"overscroll-y-none":`overscroll-behavior-y: none`,"z-auto":`z-index: auto`,"cursor-pointer":`cursor: pointer`,"cursor-wait":`cursor: wait`,"cursor-not-allowed":`cursor: not-allowed`,"select-none":`user-select: none`,"select-all":`user-select: all`,"pointer-events-auto":`pointer-events: auto`,"pointer-events-none":`pointer-events: none`,"box-border":`box-sizing: border-box`,"box-content":`box-sizing: content-box`,resize:`resize: both`,"resize-x":`resize: horizontal`,"resize-y":`resize: vertical`,"resize-none":`resize: none`,"appearance-none":`appearance: none; -webkit-appearance: none; -moz-appearance: none`,border:`border: 1px solid`,"border-none":`border: none`,"border-solid":`border-style: solid`,"border-dashed":`border-style: dashed`,"border-dotted":`border-style: dotted`,"border-collapse":`border-collapse: collapse`,"rounded-none":`border-radius: 0`,rounded:`border-radius: .25rem`,"rounded-sm":`border-radius: .125rem`,"rounded-md":`border-radius: .375rem`,"rounded-lg":`border-radius: .5rem`,"rounded-xl":`border-radius: .75rem`,"rounded-full":`border-radius: 9999px`,"shadow-2xs":`box-shadow: 0 1px rgb(0 0 0 / 0.05)`,"shadow-xs":`box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05)`,shadow:`box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`,"shadow-sm":`box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`,"shadow-md":`box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)`,"shadow-lg":`box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)`,"shadow-xl":`box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)`,"shadow-2xl":`box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25)`,"shadow-inner":`box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05)`,"shadow-none":`box-shadow: 0 0 #0000`,ring:`box-shadow: var(--ring-inset, ) 0 0 0 3px ${C}`,"ring-0":`box-shadow: var(--ring-inset, ) 0 0 0 0px ${C}`,"ring-1":`box-shadow: var(--ring-inset, ) 0 0 0 1px ${C}`,"ring-2":`box-shadow: var(--ring-inset, ) 0 0 0 2px ${C}`,"ring-4":`box-shadow: var(--ring-inset, ) 0 0 0 4px ${C}`,"ring-8":`box-shadow: var(--ring-inset, ) 0 0 0 8px ${C}`,"ring-inset":`--ring-inset: inset`,outline:`outline-style: solid`,"outline-none":`outline: 2px solid transparent; outline-offset: 2px`,"outline-dashed":`outline-style: dashed`,"outline-dotted":`outline-style: dotted`,"outline-double":`outline-style: double`,"outline-0":`outline-width: 0px`,"outline-1":`outline-width: 1px`,"outline-2":`outline-width: 2px`,"outline-4":`outline-width: 4px`,"outline-8":`outline-width: 8px`,"outline-offset-0":`outline-offset: 0px`,"outline-offset-1":`outline-offset: 1px`,"outline-offset-2":`outline-offset: 2px`,"outline-offset-4":`outline-offset: 4px`,"outline-offset-8":`outline-offset: 8px`,"aspect-auto":`aspect-ratio: auto`,"aspect-square":`aspect-ratio: 1 / 1`,"aspect-video":`aspect-ratio: 16 / 9`,"backdrop-blur-none":`backdrop-filter: blur(0)`,"backdrop-blur-sm":`backdrop-filter: blur(4px)`,"backdrop-blur":`backdrop-filter: blur(8px)`,"backdrop-blur-md":`backdrop-filter: blur(12px)`,"backdrop-blur-lg":`backdrop-filter: blur(16px)`,"backdrop-blur-xl":`backdrop-filter: blur(24px)`,"backdrop-blur-2xl":`backdrop-filter: blur(40px)`,"backdrop-blur-3xl":`backdrop-filter: blur(64px)`,"transition-none":`transition: none`,transition:`transition-property: all; ${S}`,"transition-all":`transition-property: all; ${S}`,"transition-opacity":`transition-property: opacity; ${S}`,"transition-transform":`transition-property: transform; ${S}`,"transition-shadow":`transition-property: box-shadow; ${S}`,"transition-colors":`transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; ${S}`,"animate-none":`animation: none`,"animate-spin":`animation: spin 1s linear infinite`,"animate-ping":`animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite`,"animate-pulse":`animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite`,"bg-auto":`background-size: auto`,"bg-cover":`background-size: cover`,"bg-contain":`background-size: contain`,"bg-center":`background-position: center`,"bg-top":`background-position: top`,"bg-bottom":`background-position: bottom`,"bg-left":`background-position: left`,"bg-right":`background-position: right`,"bg-left-top":`background-position: left top`,"bg-left-bottom":`background-position: left bottom`,"bg-right-top":`background-position: right top`,"bg-right-bottom":`background-position: right bottom`,"bg-no-repeat":`background-repeat: no-repeat`,"bg-fixed":`background-attachment: fixed`,"bg-local":`background-attachment: local`,"bg-scroll":`background-attachment: scroll`,"min-h-screen":`min-height: 100vh`,"max-h-screen":`max-height: 100vh`,"min-w-screen":`min-width: 100vw`,"h-dvh":`height: 100dvh`,"h-svh":`height: 100svh`,"h-lvh":`height: 100lvh`,"w-dvw":`width: 100dvw`,"w-svw":`width: 100svw`,"w-lvw":`width: 100lvw`,"min-h-dvh":`min-height: 100dvh`,"min-h-svh":`min-height: 100svh`,"min-h-lvh":`min-height: 100lvh`,"flex-none":`flex: none`,"flex-auto":`flex: 1 1 auto`,"flex-initial":`flex: 0 1 auto`,grow:`flex-grow: 1`,"grow-0":`flex-grow: 0`,shrink:`flex-shrink: 1`,"shrink-0":`flex-shrink: 0`,"self-auto":`align-self: auto`,"self-start":`align-self: flex-start`,"self-end":`align-self: flex-end`,"self-center":`align-self: center`,"self-stretch":`align-self: stretch`,"self-baseline":`align-self: baseline`,"content-normal":`align-content: normal`,"content-start":`align-content: flex-start`,"content-end":`align-content: flex-end`,"content-center":`align-content: center`,"content-between":`align-content: space-between`,"content-around":`align-content: space-around`,"content-evenly":`align-content: space-evenly`,"content-stretch":`align-content: stretch`,"items-baseline":`align-items: baseline`,"inset-0":`inset: 0`,"inset-auto":`inset: auto`,"inset-x-0":`left: 0; right: 0`,"inset-y-0":`top: 0; bottom: 0`,"inset-x-auto":`left: auto; right: auto`,"inset-y-auto":`top: auto; bottom: auto`,"sr-only":`position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0`,"not-sr-only":`position: static; width: auto; height: auto; padding: 0; margin: 0; overflow: visible; clip: auto; white-space: normal`},pe=[`*,::before,::after{--ring-color:${de}}`,`@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}`,`@keyframes ping{75%,100%{transform:scale(2);opacity:0}}`,`@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}`],me=`red pink purple deep-purple indigo blue light-blue cyan teal green light-green lime yellow amber orange deep-orange brown gray blue-gray`.split(` `),he=[50,100,200,300,400,500,600,700,800,900],ge=Object.fromEntries(me.map((e,t)=>[e,Object.fromEntries(he.map((e,n)=>{let r=(t*he.length+n)*6;return[e,`#${`ffebeeffcdd2ef9a9ae57373ef5350f44336e53935d32f2fc62828b71c1cfce4ecf8bbd0f48fb1f06292ec407ae91e63d81b60c2185bad1457880e4ff3e5f5e1bee7ce93d8ba68c8ab47bc9c27b08e24aa7b1fa26a1b9a4a148cede7f6d1c4e9b39ddb9575cd7e57c2673ab75e35b1512da84527a0311b92e8eaf6c5cae99fa8da7986cb5c6bc03f51b53949ab303f9f2835931a237ee3f2fdbbdefb90caf964b5f642a5f52196f31e88e51976d21565c00d47a1e1f5feb3e5fc81d4fa4fc3f729b6f603a9f4039be50288d10277bd01579be0f7fab2ebf280deea4dd0e126c6da00bcd400acc10097a700838f006064e0f2f1b2dfdb80cbc44db6ac26a69a00968800897b00796b00695c004d40e8f5e9c8e6c9a5d6a781c78466bb6a4caf5043a047388e3c2e7d321b5e20f1f8e9dcedc8c5e1a5aed5819ccc658bc34a7cb342689f38558b2f33691ef9fbe7f0f4c3e6ee9cdce775d4e157cddc39c0ca33afb42b9e9d24827717fffde7fff9c4fff59dfff176ffee58ffeb3bfdd835fbc02df9a825f57f17fff8e1ffecb3ffe082ffd54fffca28ffc107ffb300ffa000ff8f00ff6f00fff3e0ffe0b2ffcc80ffb74dffa726ff9800fb8c00f57c00ef6c00e65100fbe9e7ffccbcffab91ff8a65ff7043ff5722f4511ee64a19d84315bf360cefebe9d7ccc8bcaaa4a1887f8d6e637955486d4c415d40374e342e3e2723fafafaf5f5f5eeeeeee0e0e0bdbdbd9e9e9e757575616161424242212121eceff1cfd8dcb0bec590a4ae78909c607d8b546e7a455a6437474f263238`.slice(r,r+6)}`]}))]));function w(e){return e.map(([e,t])=>`.${e} { ${t} }`)}let _e=[``,`-`],T=[``],ve=[[`top`,`t`],[`bottom`,`b`],[`left`,`l`],[`right`,`r`]];function ye(e,t,n){let r=(r,i)=>[`${e}${t(r)}`,n(`${e}${i}`)];return[...b.map(e=>r(`${e}`,`${e*v}rem`)),...b.map(e=>r(`${e}px`,`${e}px`)),...ie.map(e=>r(`${e}\\%`,`${e}%`))]}function E(e,t=_e){return w(Object.entries(e).flatMap(([e,n])=>[[`${n}-0`,`${e}: 0`],[`${n}-screen`,`${e}: 100v${e.includes(`height`)?`h`:`w`}`],[`${n}-full`,`${e}: 100%`],...t.flatMap(t=>ye(t,e=>`${n}-${e}`,t=>`${e}: ${t}`)),...te.map(([t,r])=>[`${n}-${t}`,`${e}: ${r}px`])]))}function be(e){return w(Object.entries(e).map(([e,t])=>[`${t}-auto`,`${e}: auto`]))}function xe(e){return w(Object.entries(e).flatMap(([e,t])=>[[`${t}x-auto`,`${e}-left: auto; ${e}-right: auto;`],[`${t}y-auto`,`${e}-top: auto; ${e}-bottom: auto;`],...ve.map(([n,r])=>[`${t}${r}-auto`,`${e}-${n}: auto`])]))}function Se(e){return w(Object.entries(e).flatMap(([e,t])=>[[`${t}x-0`,`${e}-left: 0; ${e}-right: 0;`],[`${t}y-0`,`${e}-top: 0; ${e}-bottom: 0;`],...ye(``,e=>`${t}x-${e}`,t=>`${e}-left: ${t}; ${e}-right: ${t};`),...ye(``,e=>`${t}y-${e}`,t=>`${e}-top: ${t}; ${e}-bottom: ${t};`)]))}function Ce(e,t=_e){return w(Object.entries(e).flatMap(([e,n])=>[[`${n}t-0`,`${e}-top: 0`],[`${n}b-0`,`${e}-bottom: 0`],[`${n}l-0`,`${e}-left: 0`],[`${n}r-0`,`${e}-right: 0`],...t.flatMap(t=>ve.flatMap(([r,i])=>ye(t,e=>`${n}${i}-${e}`,t=>`${e}-${r}: ${t}`)))]))}function we(){return w([[`border`,`border-width: 1px`],[`border-x`,`border-inline-width: 1px`],[`border-y`,`border-block-width: 1px`],...[0,...y].map(e=>[`border-${e}`,`border-width: ${e}px`]),...[0,...y].map(e=>[`border-x-${e}`,`border-inline-width: ${e}px;`]),...[0,...y].map(e=>[`border-y-${e}`,`border-block-width: ${e}px;`]),...ve.flatMap(([e,t])=>[[`border-${t}`,`border-${e}-width: 1px`],...[0,...y].map(n=>[`border-${t}-${n}`,`border-${e}-width: ${n}px`])])])}function Te(){return w(ie.map(e=>[`z-${e}`,`z-index: ${e}`]))}function Ee(){return w(ae.map(e=>[`duration-${e}`,`--transition-duration: ${e}ms; transition-duration: ${e}ms`]))}function De(){return w([[`space-x-0 > *`,`margin-left: 0`],[`space-y-0 > *`,`margin-top: 0`],...b.map(e=>[`space-x-${e} > :not(:first-child)`,`margin-left: ${e*v}rem`]),...b.map(e=>[`space-y-${e} > :not(:first-child)`,`margin-top: ${e*v}rem`]),...b.map(e=>[`space-x-${e}px > :not(:first-child)`,`margin-left: ${e}px`]),...b.map(e=>[`space-y-${e}px > :not(:first-child)`,`margin-top: ${e}px`]),[`gap-0`,`gap: 0`],...b.map(e=>[`gap-${e}`,`gap: ${e*v}rem`]),...b.map(e=>[`gap-${e}px`,`gap: ${e}px`]),...b.map(e=>[`gap-x-${e}`,`column-gap: ${e*v}rem`]),...b.map(e=>[`gap-y-${e}`,`row-gap: ${e*v}rem`]),...b.map(e=>[`gap-x-${e}px`,`column-gap: ${e}px`]),...b.map(e=>[`gap-y-${e}px`,`row-gap: ${e}px`]),[`divide-x > :not(:last-child)`,`border-inline-end-width: 1px`],[`divide-y > :not(:last-child)`,`border-bottom-width: 1px`],[`divide-x-0 > :not(:last-child)`,`border-inline-end-width: 0px`],[`divide-y-0 > :not(:last-child)`,`border-bottom-width: 0px`],...[2,4,8].map(e=>[`divide-x-${e} > :not(:last-child)`,`border-inline-end-width: ${e}px`]),...[2,4,8].map(e=>[`divide-y-${e} > :not(:last-child)`,`border-bottom-width: ${e}px`]),[`divide-solid > :not(:last-child)`,`border-style: solid`],[`divide-dashed > :not(:last-child)`,`border-style: dashed`],[`divide-dotted > :not(:last-child)`,`border-style: dotted`],[`divide-none > :not(:last-child)`,`border-style: none`]])}function Oe(){return w([...Array.from({length:100},(e,t)=>[`text-${t}px`,`font-size: ${t}px`]),...Array.from({length:100},(e,t)=>[`text-${String(t*v).replace(`.`,`\\.`)}rem`,`font-size: ${t*v}rem`])])}function ke(){return w([`column`,`row`].flatMap(e=>{let t=e.slice(0,3);return[...Array.from({length:12},(e,t)=>t+1).map(n=>[`grid-${t}s-${n}`,`grid-template-${e}s: repeat(${n}, minmax(0, 1fr))`]),[`grid-${t}s-none`,`grid-template-${e}s: none`],...Array.from({length:12},(e,t)=>t+1).map(n=>[`${t}-span-${n}`,`grid-${e}: span ${n} / span ${n}`]),[`${t}-span-full`,`grid-${e}: 1 / -1`],...Array.from({length:13},(e,t)=>t+1).map(n=>[`${t}-start-${n}`,`grid-${e}-start: ${n}`]),[`${t}-start-auto`,`grid-${e}-start: auto`],...Array.from({length:13},(e,t)=>t+1).map(n=>[`${t}-end-${n}`,`grid-${e}-end: ${n}`]),[`${t}-end-auto`,`grid-${e}-end: auto`]]}))}function Ae(){return Object.entries(fe).map(([e,t])=>`.${e} { ${t} }`)}function je(e){let t=0,n=0,r=0;return e.length===4?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):e.length===7&&(t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16)),`${t} ${n} ${r}`}let Me=[[`text`,`color`,``],[`fill`,`fill`,``],[`bg`,`background-color`,``],[`border`,`border-color`,``],[`divide`,`border-color`,` > :not(:last-child)`],[`ring`,`--ring-color`,``]];function Ne(){let e=(e,t)=>Me.map(([n,r,i])=>[`${n}-${e}${i}`,`${r}: ${t}`]);return w([...e(`white`,`#fff`),...e(`black`,`#000`),...e(`transparent`,`transparent`),...Object.entries(ge).flatMap(([t,n])=>[...e(t,n[500]),...Object.entries(n).flatMap(([n,r])=>e(`${t}-${n}`,r))])])}function Pe(){return w([[`opacity-0`,`opacity: 0`],...ie.map(e=>[`opacity-${e}`,`opacity: ${e/100}`])])}let Fe=null;function Ie(){return Fe===null&&(Fe=[...pe,...Ae(),...Ne(),...Pe(),...Te(),...Ee(),...E(le),...E(ce,T),...be(ce),...E(x),...E(oe,T),...be(x),...xe(x),...Se(se),...Ce(x),...Ce(oe,T),...De(),...E(ue,T),...we(),...Oe(),...ke()].join(`
|
|
17
|
+
`)),Fe}let Le={text:`color`,bg:`background-color`,border:`border-color`,fill:`fill`,divide:`border-color`,ring:`--ring-color`},Re=/^(text|bg|border|fill|divide|ring)-([\w-]+)\/(\d+)$/,ze={w:`width`,h:`height`,"min-w":`min-width`,"min-h":`min-height`,"max-w":`max-width`,"max-h":`max-height`,m:`margin`,mt:`margin-top`,mr:`margin-right`,mb:`margin-bottom`,ml:`margin-left`,mx:`margin-inline`,my:`margin-block`,p:`padding`,pt:`padding-top`,pr:`padding-right`,pb:`padding-bottom`,pl:`padding-left`,px:`padding-inline`,py:`padding-block`,top:`top`,right:`right`,bottom:`bottom`,left:`left`,gap:`gap`,"gap-x":`column-gap`,"gap-y":`row-gap`,text:`font-size`,z:`z-index`,bg:`background-color`,border:`border-color`},Be=/^(-?)([\w-]+)-\[(.+)\]$/,Ve=/^[\w#.%+*/(),!-]+$/,He=/^((?:[^:[]|\[[^\]]*\])+):(.+)$/,Ue=/^aria-\[([\w-]+)=([\w-]+)\]$/,We=/^has-\[([\w:.#>+~*(),-]+)\]$/,Ge=[`busy`,`checked`,`disabled`,`expanded`,`hidden`,`pressed`,`readonly`,`required`,`selected`],Ke=[`checked`,`focus`,`disabled`,`hover`],qe={hover:`:hover`,focus:`:focus`,disabled:`:disabled`,empty:`:empty`,...Object.fromEntries(Ge.map(e=>[`aria-${e}`,`[aria-${e}="true"]`])),...Object.fromEntries(Ke.map(e=>[`has-${e}`,`:has(*:${e})`])),dark:`(prefers-color-scheme: dark)`,landscape:`(orientation: landscape)`,portrait:`(orientation: portrait)`,...Object.fromEntries(Object.entries(ee).map(([e,t])=>[e,`(min-width: ${t}px)`]))};function Je(e){if(Object.hasOwn(qe,e))return qe[e];let t=e.match(Ue);if(t)return`[aria-${t[1]}="${t[2]}"]`;let n=e.match(We)?.[1];if(!n)return;let r=0;for(let e of n)if(r+=e===`(`?1:e===`)`?-1:0,r<0)return;return r?void 0:`:has(${n})`}let Ye=new Set,D=new Set,Xe=new Set,Ze=``,O=-1,k=null;function Qe(){let e=[];for(let t of document.styleSheets)if(t!==k)try{e.push(t.cssRules.length)}catch{e.push(-1)}return e.join(`,`)}function $e(){O<0&&queueMicrotask(()=>{O=-1}),O=document.styleSheets.length}function et(){if(D.size===0||document.styleSheets.length===O)return;$e();let e=Qe();e!==Ze&&(D.clear(),Ze=e)}function tt(e){Xe.has(e)||(Xe.size>=256&&Xe.clear(),Xe.add(e),console.warn(`No CSS rule for class: ${e}`))}function nt(e,t){return D.size>=256&&D.clear(),D.size===0&&(Ze=Qe(),$e()),D.add(e),tt(t),!1}function rt(e){if(typeof document>`u`)return null;let t=`.${at(e)}`;for(let e of document.styleSheets)try{for(let n of e.cssRules)if(n instanceof CSSStyleRule&&n.selectorText===t)return n.style.cssText}catch{}return null}function it(){return typeof document<`u`&&typeof CSSStyleSheet<`u`&&typeof document.createElement==`function`}function at(e){let t=globalThis.CSS;return typeof t?.escape==`function`?t.escape(e):e.replace(/[[\]#.:>+~()'"/%,!]/g,`\\$&`)}function ot(){if(!it())return null;if(k&&!k.ownerNode?.isConnected&&(k=null,Ye.clear()),k)return k;let e=document.createElement(`style`);return e.setAttribute(`data-mancha`,`custom`),document.head.appendChild(e),e.sheet?(k=e.sheet,k):null}function st(e){let t=e.match(Be);if(!t)return null;let[,n,r,i]=t,a=ze[r];if(!a||!Ve.test(i)||i.includes(`/*`))return null;let o=0;for(let e of i)if(o+=e===`(`?1:e===`)`?-1:0,o<0)return null;if(o)return null;let s=i.replace(/_/g,` `);return{property:a,value:n?`-${s}`:s}}function ct(e){let t=e.match(Re);if(!t)return null;let[,n,r,i]=t,a=Le[n];if(!a)return null;let o=Number.parseInt(i,10);if(o<0||o>100)return null;let s=null;if(r===`white`)s=`#fff`;else if(r===`black`)s=`#000`;else{let e=r.lastIndexOf(`-`);if(e>0){let t=r.substring(0,e),n=Number.parseInt(r.substring(e+1),10);s=ge[t]?.[n]??null}s||=ge[r]?.[500]??null}return s?{property:a,value:`rgb(${je(s)} / ${o/100})`}:null}function lt(e,...t){let n=[...t,e].join(`:`),r=ot();if(!r)return!1;if(Ye.has(n))return!0;if(et(),D.has(e)||D.has(n))return tt(n),!1;let i=at(n),a=st(e)??ct(e),o=a?`${a.property}: ${a.value};`:rt(e);if(!o)return nt(e,n);let s=e.startsWith(`divide-`)?` > :not(:last-child)`:``,c=``,l=[];for(let e of t){let t=Je(e)??``;t.startsWith(`(`)?l.push(t):c+=t}let u=l.length>0,d=`.${i}${c}${s} { ${o} }`,f=u?`@media ${l.join(` and `)} { ${d} }`:d;try{let e=r.insertRule(f,r.cssRules.length),t=r.cssRules[e],i=u?t.cssRules[0]:t;return i?.style?.length?(Ye.add(n),!0):(r.deleteRule(e),i?(console.warn(`Injected CSS rule had no effect: ${f}`),!1):nt(n,n))}catch{return nt(n,n)}}function ut(e){return e.includes(`[`)||e.includes(`:`)||e.includes(`/`)}function dt(e){if(!(!e||!ut(e)))for(let t of e.trim().split(/\s+/)){let e=[],n=t;for(let r=t.match(He);r&&Je(r[1])!==void 0;r=n.match(He))e.push(r[1]),n=r[2];if(e.length){lt(n,...e);continue}ut(t)&<(t)}}function ft(e){if(!it())return;let t=e??document;if(t instanceof Element){let e=t.getAttribute(`class`);e&&dt(e)}let n=t.querySelectorAll(`[class]`);for(let e of n){let t=e.getAttribute(`class`);t&&dt(t)}}function pt(){return it()&&document.querySelector(`style[data-mancha="utils"]`)!==null}function mt(e){if(!pt())return;let t=e;typeof t.querySelectorAll==`function`&&ft(t)}function ht(e){!e||!ut(e)||pt()&&dt(e)}function gt(e){return l(e[0].toLowerCase())}function A(e){let t=e[0];return h(t)}function _t(e){return h(e.map(g).join(``))}function vt(e){let t=e.childNodes;for(let e=0;e<t.length;e++){let n=t[e];n.prev=e>0?t[e-1]:null,n.next=e<t.length-1?t[e+1]:null}}let yt=[gt`:`,gt`style`,gt`class`];function*j(e,t=new Set){let n=new Set,r=Array.from(e.childNodes).filter(e=>!t.has(e));for(yield e;r.length;){let e=r.shift();n.has(e)||(n.add(e),yield e),e.childNodes&&Array.from(e.childNodes).filter(e=>!t.has(e)).forEach(e=>{r.push(e)})}}function M(e,t){return e?.[t]!==void 0}function N(e,t){return typeof e?.[t]==`function`}function bt(e){return e.replace(/-./g,e=>e[1].toUpperCase())}function P(e,t){return e.attribs?e.attribs[t]??null:e.getAttribute?.(t)??null}function xt(e,t){return e.attribs?t in e.attribs:e.hasAttribute?.(t)??!1}function F(e,t,n=``){return P(e,n+t)||P(e,`data-${t}`)||(e.dataset?.[bt(t)]??null)}function I(e,t,n){e.attribs?e.attribs[t]=n:e.setAttribute?.(t,n)}function St(e,t,n){e.attribs?e.attribs[t]=n:f(yt,e,t,n)}function L(e,t,n){switch(t){case`disabled`:e.disabled=n;return;case`selected`:e.selected=n;return;case`checked`:e.checked=n;return;default:e[t]=n}}function R(e,t){e.attribs?delete e.attribs[t]:e.removeAttribute?.(t)}function Ct(e,t,n,r=``){xt(e,`${r}${t}`)?I(e,`${r}${t}`,n):xt(e,`data-${t}`)?I(e,`data-${t}`,n):I(e,`${r}${t}`,n)}function z(e,t,n=``){R(e,`${n}${t}`),R(e,`data-${t}`)}function wt(e,t,n){if(e.attribs&&t.attribs)t.attribs[n]=e.attribs[n];else if(n.startsWith(`data-`)){let r=bt(n.slice(5));t.dataset&&e.dataset&&(t.dataset[r]=e.dataset[r])}else{let r=e?.getAttribute?.(n);I(t,n,r||``)}}function Tt(e,t,n){let r=P(t,n),i=P(e,n),a=n===`class`||n===`style`;a&&r&&!i?.trim()||(!r||!a?wt(e,t,n):n===`class`?I(t,n,[...new Set(`${r} ${i}`.trim().split(/\s+/))].join(` `)):I(t,n,`${r.replace(/;\s*$/,``)};${i}`))}function Et(e){return M(e,`firstElementChild`)?e.firstElementChild:Array.from(e.children).find(e=>e.nodeType===1)}function B(e,...t){if(N(e,`replaceWith`)){e.replaceWith(...t);return}else{let n=e,r=n.parentNode;if(!r)return;let i=Array.from(r.childNodes).indexOf(n);n.parentNode=null,t.forEach(e=>{e.parentNode=r}),r.childNodes=[].concat(Array.from(r.childNodes).slice(0,i),t,Array.from(r.childNodes).slice(i+1)),vt(r)}}function Dt(e,...t){N(e,`replaceChildren`)?e.replaceChildren(...t):(e.childNodes=t,t.forEach(t=>{t.parentNode=e}),vt(e))}function Ot(e,t){return N(t,`appendChild`)?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,vt(e),t)}function V(e,t){return N(t,`removeChild`)?e.removeChild(t):(Dt(e,...Array.from(e.childNodes).filter(e=>e!==t)),t)}function kt(e,t,n){return n?N(e,`insertBefore`)?e.insertBefore(t,n):(t.parentNode&&V(t.parentNode,t),B(n,t,n),t):Ot(e,t)}function At(e,t=0){return e?e.length<=t?e:`${e.slice(0,t-1)}…`:``}function H(e,t=0){return globalThis.DocumentFragment&&e instanceof DocumentFragment?Array.from(e.childNodes).map(e=>H(e,t)).join(``):At(e.outerHTML||e.nodeValue||String(e),t)}function jt(e){return e.includes(`/`)?e.split(`/`).slice(0,-1).join(`/`):``}function Mt(e){return!e.includes(`://`)&&!e.startsWith(`/`)&&!e.startsWith(`#`)&&!e.startsWith(`data:`)}var Nt=class e{iterable;constructor(e){this.iterable=e}filter(t){return new e(e.filterGenerator(t,this.iterable))}map(t){return new e(e.mapGenerator(t,this.iterable))}find(e){for(let t of this.iterable)if(e(t))return t}array(){return Array.from(this.iterable)}*generator(){for(let e of this.iterable)yield e}static*filterGenerator(e,t){for(let n of t)e(n)&&(yield n)}static*mapGenerator(e,t){for(let n of t)yield e(n)}static equals(e,t){let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(i.value!==a.value)return!1;i=n.next(),a=r.next()}return i.done===a.done}};let U;(function(e){e.resolveIncludes=async function(e,t){let n=e,r=n.tagName?.toLowerCase();if(![`include`,`link`].includes(r)||r===`link`&&P(n,`rel`)!==`subresource`)return;this.log(`include directive found in:
|
|
18
|
+
`,H(e,128)),this.log(`include params:`,t);let i=n.tagName.toLocaleLowerCase()===`link`?`href`:`src`,a=P(n,i);if(!a)throw Error(`"${i}" attribute missing from ${H(e,128)}.`);let o=[];r===`include`&&o.push(`src`),r===`link`&&o.push(`rel`,`href`);let s=t=>{let r=Et(t);for(let e of Array.from(n.attributes))r&&!o.includes(e.name)&&Tt(n,r,e.name);B(e,...t.childNodes)},c=(t?.maxdepth??100)-1;if(c<=0)throw Error(`Maximum recursion depth reached.`);let l={...t,rootDocument:!1,maxdepth:c};if(a.includes(`://`)||a.startsWith(`//`))this.log(`Including remote file from absolute path:`,a),await this.preprocessRemote(a,l).then(s);else if(t?.dirpath?.includes(`://`)||t?.dirpath?.startsWith(`//`)){let e=a.startsWith(`/`)?a:`${t.dirpath}/${a}`;this.log(`Including remote file from relative path:`,e),await this.preprocessRemote(e,l).then(s)}else if(a.charAt(0)===`/`)this.log(`Including local file from absolute path:`,a),await this.preprocessLocal(a,l).then(s);else{let e=t?.dirpath&&t?.dirpath!==`.`?`${t?.dirpath}/${a}`:a;this.log(`Including local file from relative path:`,e),await this.preprocessLocal(e,l).then(s)}},e.rebaseRelativePaths=function(e,t){let n=e,r=n.tagName?.toLowerCase();if(!t?.dirpath)return;let o=P(n,`src`),s=P(n,`href`),c=F(n,`render`,`:`),l=o||s||c;if(!l||!Mt(l))return;let u=`${t.dirpath}/${l}`;this.log(`Rebasing relative path as:`,u),c?Ct(n,`render`,u,`:`):M(n,`attribs`)?St(n,o?`src`:`href`,u):r===`include`||r===`link`?I(n,o?`src`:`href`,u):r===`img`?n.src=u:r===`a`?i(n,u):r===`source`||r===`audio`||r===`video`||r===`track`||r===`input`?n.src=u:r===`area`?a(n,u):this.log(`Unable to rebase relative path for element:`,r)};function t(e){let t=e,n=t.tagName?.toLowerCase();if(!(n===`div`&&P(t,`role`)!==`template`)&&!(n!==`template`&&n!==`div`))return(P(t,`is`)||P(t,`alt`))?.toLowerCase()||void 0}e.templateName=t,e.registerCustomElements=function(e,n){let r=e,i=t(e);if(i&&!this._customElements.has(i)){this.log(`Registering custom element: ${i}\n`,H(r,128));let e=r.content||r,t=Array.from(j(e));for(let e=1;e<t.length;e++)U.rebaseRelativePaths.call(this,t[e],n);this._customElements.set(i,r),r?.parentNode&&V(r.parentNode,r)}},e.resolveCustomElements=async function(e,t){let n=e,r=n.tagName?.toLowerCase(),i=r;if(i===`div`&&(i=P(n,`role`)?.toLowerCase()||i),i&&this._customElements.has(i)){this.log(`Processing custom element: ${i}\n`,H(n,128));let a=this._customElements.get(i),o=(a.content||a).cloneNode(!0),s=Et(o);if(s)for(let e of Array.from(n.attributes))(r!==`div`||e.name!==`role`)&&Tt(n,s,e.name);let c=t?.maxdepth??10;if(c<=0)throw Error(`Maximum recursion depth reached in <${i}>.`);await this.preprocessNode(o,{...t,dirpath:void 0,maxdepth:c-1});let l=new Nt(j(o)).find(e=>e.tagName?.toLowerCase()===`slot`);l&&B(l,...n.childNodes),B(e,...o.childNodes)}},e.resolveTextNodeExpressions=function(e,t){let n=e.nodeValue||``;if(e.nodeType!==3||!n?.trim())return;this.log(`Processing node content value:
|
|
19
|
+
`,At(n,128));let r=new RegExp(/{{ ([^}]+) }}/gm),i=Array.from(n.matchAll(r)).map(e=>e[1]);return this.effect(function(){let t=n;for(let n of i){let r=this.eval(n,{$elem:e});t=t.replace(`{{ ${n} }}`,r==null?``:String(r))}e.nodeValue=t},{directive:`text`,element:e.parentElement??void 0,expression:i.join(`, `)})},e.resolveDataAttribute=async function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`data`,`:`);if(r){this.log(`:data attribute found in:
|
|
20
|
+
`,H(e,128)),z(n,`data`,`:`);let i;M(e,`renderer`)?(i=e.renderer,this.log(`Reusing existing subrenderer for node:`,H(e,64))):(i=this.subrenderer(),L(e,`renderer`,i),this.log(`Created and attached new subrenderer for node:`,H(e,64)));let a=i.eval(r,{$elem:e});if(await Promise.all(Object.entries(a).map(([e,t])=>e.startsWith(`$$`)?(i._store.get(`$rootRenderer`)||i).set(e,t):i.set(e,t,!0))),i===this)return;for(let t of j(e,this._skipNodes))this._skipNodes.add(t);await i.mount(e,t)}},e.resolveClassAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`class`,`:`);if(r){this.log(`:class attribute found in:
|
|
21
|
+
`,H(e,128)),z(n,`class`,`:`);let t=P(n,`class`)||``;return this.effect(function(){let i=this.eval(r,{$elem:e}),a=(i?`${t} ${i}`:t).trim();St(n,`class`,a),ht(a)},{directive:`class`,element:n,expression:r})}},e.resolveTextAttributes=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`text`,`:`);if(r){this.log(`:text attribute found in:
|
|
22
|
+
`,H(e,128)),z(n,`text`,`:`);let t=t=>this.textContent(e,t),i=this.effect(function(){let n=this.eval(r,{$elem:e});t(n==null?``:String(n))},{directive:`:text`,element:n,expression:r});for(let e of Array.from(n.childNodes||[]))this._skipNodes.add(e);return i}},e.resolveHtmlAttribute=async function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`html`,`:`);if(r){this.log(`:html attribute found in:
|
|
23
|
+
`,H(e,128)),z(n,`html`,`:`);let i=null,a=[];return this.effect(function(){let o=this.eval(r,{$elem:e});return new Promise(e=>{(async()=>{i&&=(i.dispose(),null);let r=this.subrenderer();i=r;let s=await r.preprocessString(o,t);await r.renderNode(s);for(let e of a)this._skipNodes.delete(e);Dt(n,s),a=Array.from(n.childNodes||[]);for(let e of a)this._skipNodes.add(e);mt(n),r._store.set(`$rootNode`,n),e()})()})},{directive:`:html`,element:n,expression:r})}},e.resolveEventAttributes=function(e,t){if(this._skipNodes.has(e))return;let n=e;for(let t of Array.from(n.attributes||[]))if(t.name.startsWith(`:on:`)||t.name.startsWith(`data-on-`)){let r=``,i=[];if(t.name.startsWith(`:on:`)?[r,...i]=t.name.substring(4).split(`.`):t.name.startsWith(`data-on-`)&&([r,...i]=t.name.substring(8).split(`.`)),!r)throw Error(`Invalid event attribute: ${t.name}`);this.log(t.name,`attribute found in:
|
|
24
|
+
`,H(e,128)),z(n,t.name);let a=r===`submit`&&n.tagName.toUpperCase()===`FORM`;e.addEventListener?.(r,n=>((i.includes(`prevent`)||a)&&n.preventDefault(),this.eval(t.value,{$elem:e,$event:n})))}},e.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`for`,`:`)?.trim();if(r){this.log(`:for attribute found in:
|
|
25
|
+
`,H(e,128)),z(n,`for`,`:`);let i=F(n,`key`,`:`);i&&z(n,`key`,`:`);for(let t of j(e,this._skipNodes))this._skipNodes.add(t);let a=e.parentNode;if(!a)return;this.cloakElement(n);let o=this.createElement(`template`,e.ownerDocument);kt(a,o,e),V(a,e),`content`in o?Ot(o.content,e):Ot(o,e),this.log(`:for template:
|
|
26
|
+
`,H(o,128));let s=r.split(` in `,2);if(s.length!==2)throw Error(`Invalid :for format: \`${r}\`. Expected "{key} in {expression}".`);let c=F(n,`data`,`:`),l=new Map,[u,d]=s;await this.effect(function(){let n=this.eval(d,{$elem:e});if(this.log(`:for list items:`,n),!Array.isArray(n)){console.error(`Expression did not yield a list: \`${d}\` => \`${n}\``);return}let r=o.parentNode;if(!r)return;let a=e=>{for(let[t,{node:n,subrenderer:r,item:i}]of l)e(t,i)&&(r.dispose(),n.parentNode&&V(n.parentNode,n),this._skipNodes.delete(n),l.delete(t))};i||a((e,t)=>t!==n[e]);let s=new Set,f=new Map,p=[],m=o.nextSibling;for(let a=0;a<n.length;a++){let o=n[a],d=i?this.eval(i,{[u]:o,$index:a}):a;s.has(d)&&console.warn(`:for duplicate key detected: ${d}. Using last item.`),s.add(d);let h,g,_=l.get(d);if(_){if(h=_.node,g=_.subrenderer,p.push(g.set(u,o,!0)),p.push(g.set(`$index`,a,!0)),c&&M(h,`renderer`)){let e=h.renderer,t=e.eval(c,{$elem:h});p.push(...Object.entries(t).map(([t,n])=>e.set(t,n,!0)))}h===m||h.nextSibling===m||kt(r,h,m)}else{g=this.subrenderer(),g.set(u,o,!0),g.set(`$index`,a,!0);let n=e.cloneNode(!0);this.cloakElement(n),kt(r,n,m),this._skipNodes.add(n),p.push(g.mount(n,t).then(()=>{this.uncloakElement(n)})),h=n,this.log(`Rendered list child:
|
|
27
|
+
`,H(n,128))}f.set(d,{node:h,subrenderer:g,item:o}),m=h.nextSibling}a(e=>!s.has(e)),l.clear();for(let[e,t]of f)l.set(e,t);return Promise.all(p).then(()=>{})},{directive:`:for`,element:n,expression:r})}},e.resolveBindAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`bind`,`:`);if(r){this.log(`:bind attribute found in:
|
|
28
|
+
`,H(e,128));let t=P(n,`:bind:on`)?.split(`,`)||n.dataset?.bindOn?.split(`,`)||[`change`,`input`];z(n,`bind`,`:`),R(n,`:bind:on`),R(n,`data-bind-on`);let i=P(n,`type`)===`checkbox`?`checked`:`value`;!r.includes(`.`)&&!this.has(r)&&this.set(r,``);let a=this;this.effect(function(){let t=this.eval(r,{$elem:e});i===`checked`?n.checked=!!t:(n.value=t,n.value!==t&&t!=null&&a._pendingValueRetries.push(()=>{n.value=t}))},{directive:`:bind`,element:n,expression:r});let o=`${r} = $elem.${i}`;for(let n of t)e.addEventListener(n,()=>this.eval(o,{$elem:e}))}},e.resolveIfAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`if`,`:`);if(r){this.log(`:if attribute found in:
|
|
29
|
+
`,H(e,128)),z(n,`if`,`:`);let t=this.createComment(` :if placeholder `,e.ownerDocument);this.effect(function(){this.eval(r,{$elem:e})?!n.parentNode&&t.parentNode&&(B(t,n),mt(n)):n.parentNode&&B(n,t)},{directive:`:if`,element:n,expression:r})}},e.resolveShowAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`show`,`:`);if(r){this.log(`:show attribute found in:
|
|
30
|
+
`,H(e,128)),z(n,`show`,`:`);let t=n.style?.display===`none`?``:n.style?.display??P(n,`style`)?.split(`;`)?.find(e=>e.split(`:`)[0]===`display`)?.split(`:`)?.at(1)?.trim();this.effect(function(){let i=this.eval(r,{$elem:e});n.style?n.style.display=i?t:`none`:St(n,`style`,`display: ${i?t:`none`};`)},{directive:`:show`,element:n,expression:r})}},e.resolveCustomAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e;for(let t of Array.from(n.attributes||[])){let r=`:attr:`,i=`data-attr-`;if(t.name.startsWith(r)||t.name.startsWith(i)){this.log(t.name,`attribute found in:
|
|
31
|
+
`,H(e,128)),R(n,t.name);let a=(t.name.split(r,2).at(-1)||``).split(i,2).at(-1)??``;this.effect(function(){let r=this.eval(t.value,{$elem:e});I(n,a,r),a===`class`&&ht(String(r??``))},{directive:`:attr:${a}`,element:n,expression:t.value})}}},e.resolveCustomProperty=function(e,t){if(this._skipNodes.has(e))return;let n=e;for(let t of Array.from(n.attributes||[])){let r=`:prop:`,i=`data-prop-`;if(t.name.startsWith(r)||t.name.startsWith(i)){this.log(t.name,`property found in:
|
|
32
|
+
`,H(e,128)),R(n,t.name);let a=bt((t.name.split(r,2).at(-1)||``).split(i,2).at(-1)??``);this.effect(function(){L(n,a,this.eval(t.value,{$elem:e}))},{directive:`:prop:${a}`,element:n,expression:t.value})}}},e.stripTypes=(e,t)=>{let n=e;P(n,`:types`)&&R(n,`:types`),P(n,`data-types`)&&R(n,`data-types`)},e.resolveRenderAttribute=async function(e,t){if(this._skipNodes.has(e))return;let n=e,r=F(n,`render`,`:`);if(!r)return;this.log(`:render attribute found: ${r}`),z(n,`render`,`:`);let i;M(e,`renderer`)?(i=e.renderer,this.log(`Reusing existing subrenderer for :render:`,H(e,64))):(i=this.subrenderer(),L(n,`renderer`,i)),await i.mount(e,t);for(let t of j(e,this._skipNodes))this._skipNodes.add(t);try{let e=await import(r);typeof e.default==`function`?await e.default(n,i):e.default!==void 0&&console.warn(`Module ${r} default export is not a function`)}catch(e){console.error(`Failed to execute render init from ${r}:`,e)}}})(U||={});function Pt(){return new URL(globalThis.window?.location?.href||`http://localhost/`)}function Ft(e){return e.substring(2)}function It(e){return`\$\$${e}`}function Lt(e){return e.keys().filter(e=>e.startsWith(`$$`))}async function Rt(e,t){for(let[n,r]of t.searchParams.entries()){let t=It(n);e.get(t)!==r&&await e.set(t,r)}}function zt(e,t,n){let r=Ft(t),i=!1;if(!n)e.searchParams.has(r)&&(e.searchParams.delete(r),i=!0);else{let t=String(n);e.searchParams.get(r)!==t&&(e.searchParams.set(r,t),i=!0)}return i}function Bt(e,t){let n=!1;for(let r of Lt(t))zt(e,r,t.get(r))&&(n=!0);n&&globalThis.window?.history?.replaceState({},``,e.toString())}function Vt(e){return async()=>{let t=Pt(),n=new Set;for(let[r,i]of t.searchParams.entries()){let t=It(r);n.add(t),e.get(t)!==i&&e.set(t,i)}let r=Lt(e);for(let t of r)n.has(t)||e.del(t)}}async function Ht(e){let t=Pt();await Rt(e,t),Bt(t,e),e.addKeyHandler(/^\$\$/,(e,t)=>{let n=Pt();zt(n,e,t)&&globalThis.window?.history?.replaceState({},``,n.toString())}),globalThis.window?.addEventListener(`popstate`,Vt(e))}
|
|
33
33
|
/*
|
|
34
34
|
* @license
|
|
35
35
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
36
36
|
*/
|
|
37
|
-
let
|
|
37
|
+
let Ut=new Set([`this`,`typeof`]),Wt=new Set([`in`]),Gt=new Set([`+`,`-`,`!`,`typeof`]),Kt=new Set([`=`,`+`,`-`,`*`,`/`,`%`,`^`,`==`,`!=`,`>`,`<`,`>=`,`<=`,`||`,`&&`,`??`,`&`,`===`,`!==`,`|`,`in`]),qt={"!":0,":":0,",":0,")":0,"]":0,"}":0,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,in:10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"?.":13,"{":13},Jt={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"??":(e,t)=>e??t,"|":(e,t)=>t(e),in:(e,t)=>e in t},Yt={"+":e=>e,"-":e=>-e,"!":e=>!e,typeof:e=>typeof e};var Xt=class{empty(){return{type:`Empty`,evaluate(e){return e},getIds(e){return e}}}literal(e){return{type:`Literal`,value:e,evaluate(e){return this.value},getIds(e){return e}}}id(e){return{type:`ID`,value:e,evaluate(e){return this.value===`this`?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(e,t){let n=Yt[e];return{type:`Unary`,operator:e,child:t,evaluate(e){return n(this.child.evaluate(e))},getIds(e){return this.child.getIds(e)}}}binary(e,t,n){let r=Jt[t];return{type:`Binary`,operator:t,left:e,right:n,evaluate(e){if(this.operator===`=`){if(this.left.type!==`ID`&&this.left.type!==`Getter`&&this.left.type!==`Index`)throw Error(`Invalid assignment target: ${this.left}`);let t=this.right.evaluate(e),n,r;return this.left.type===`Getter`?(n=this.left.receiver.evaluate(e),r=this.left.name):this.left.type===`Index`?(n=this.left.receiver.evaluate(e),r=String(this.left.argument.evaluate(e))):this.left.type===`ID`&&(n=e,r=this.left.value),n===void 0?void 0:(n[r]=t,t)}return r(this.left.evaluate(e),this.right.evaluate(e))},getIds(e){return this.left.getIds(e),this.right.getIds(e),e}}}getter(e,t,n){return{type:`Getter`,receiver:e,name:t,optional:n,evaluate(e){let t=this.receiver.evaluate(e);if(!(this.optional&&t==null))return t?.[this.name]},getIds(e){return this.receiver.getIds(e),e}}}invoke(e,t,n,r){if(t!=null&&typeof t!=`string`)throw Error(`method not a string`);return{type:`Invoke`,receiver:e,method:t,arguments:n,optional:r,evaluate(e){let t=this.receiver.evaluate(e);if(this.optional&&t==null)return;let n=this.method?t:e?.this??e,r=this.method?t?.[this.method]:t,i=this.arguments??[],a=[];for(let t of i)if(t?.type===`SpreadElement`){let n=t.evaluate(e);n&&typeof n[Symbol.iterator]==`function`&&a.push(...n)}else a.push(t?.evaluate(e));return r?.apply?.(n,a)},getIds(e){return this.receiver.getIds(e),this.arguments?.forEach(t=>{t?.getIds(e)}),e}}}paren(e){return e}index(e,t,n){return{type:`Index`,receiver:e,argument:t,optional:n,evaluate(e){let t=this.receiver.evaluate(e);if(this.optional&&t==null)return;let n=this.argument.evaluate(e);return t?.[n]},getIds(e){return this.receiver.getIds(e),e}}}ternary(e,t,n){return{type:`Ternary`,condition:e,trueExpr:t,falseExpr:n,evaluate(e){return this.condition.evaluate(e)?this.trueExpr.evaluate(e):this.falseExpr.evaluate(e)},getIds(e){return this.condition.getIds(e),this.trueExpr.getIds(e),this.falseExpr.getIds(e),e}}}map(e){return{type:`Map`,properties:e,evaluate(t){let n={};if(e&&this.properties)for(let e of this.properties)e.type===`SpreadProperty`?Object.assign(n,e.evaluate(t)):n[e.key]=e.value.evaluate(t);return n},getIds(t){if(e&&this.properties)for(let e of this.properties)e.type===`SpreadProperty`?e.expression.getIds(t):e.value.getIds(t);return t}}}property(e,t){return{type:`Property`,key:e,value:t,evaluate(e){return this.value.evaluate(e)},getIds(e){return this.value.getIds(e)}}}list(e){return{type:`List`,items:e,evaluate(e){if(!this.items)return[];let t=[];for(let n of this.items)if(n?.type===`SpreadElement`){let r=n.evaluate(e);r&&typeof r[Symbol.iterator]==`function`&&t.push(...r)}else t.push(n?.evaluate(e));return t},getIds(e){return this.items?.forEach(t=>{t?.getIds(e)}),e}}}arrowFunction(e,t){return{type:`ArrowFunction`,params:e,body:t,evaluate(e){let t=this.params,n=this.body;return function(...r){let i=Object.fromEntries(t.map((e,t)=>[e,r[t]])),a=this??e??{},o=new Proxy(a,{set(e,t,n){return Object.hasOwn(i,t)&&(i[t]=n),e[t]=n,n},get(e,t){return Object.hasOwn(i,t)?i[t]:e[t]}});return n.evaluate(o)}},getIds(e){return this.body.getIds(e).filter(e=>!this.params.includes(e))}}}spreadProperty(e){return{type:`SpreadProperty`,expression:e,evaluate(e){return this.expression.evaluate(e)},getIds(e){return this.expression.getIds(e)}}}spreadElement(e){return{type:`SpreadElement`,expression:e,evaluate(e){return this.expression.evaluate(e)},getIds(e){return this.expression.getIds(e)}}}};
|
|
38
38
|
/*
|
|
39
39
|
* @license
|
|
40
40
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
41
41
|
*/
|
|
42
|
-
let
|
|
43
|
-
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var $t=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;Gt(this._next??-1);)this._advance(!0);if(Yt(this._next??-1))return this._tokenizeString();if(Kt(this._next??-1))return this._tokenizeIdentOrKeyword();if(J(this._next??-1))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(Xt(this._next??-1))return this._tokenizeOperator();if(Zt(this._next??-1))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),e===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){let t=this._input.substring(this._tokenStart,this._index+e);return e===0&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let e=this._next;for(this._advance(!0);this._next!==e;){if(this._next===void 0||this._next===92&&(this._advance(),this._next===void 0))throw Error(`unterminated string`);this._advance()}let t=q(K.STRING,Qt(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(qt(this._next??-1));let e=this._getValue();return q(Jt(e)?K.KEYWORD:It.has(e)?K.OPERATOR:K.IDENTIFIER,e,zt[e]??0)}_tokenizeNumber(){do this._advance();while(J(this._next??-1));return this._next===46?this._tokenizeDot():q(K.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),J(this._next??-1))return this._tokenizeFraction();if(this._next===46){if(this._advance(),this._next===46)return this._advance(),this._clearValue(),q(K.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),q(K.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),q(K.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),q(K.COLON,`:`)}_tokenizeFraction(){do this._advance();while(J(this._next??-1));return q(K.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(Wt.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),q(K.ARROW,e);Ut.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?q(K.OPTIONAL_DOT,e,13):q(K.OPERATOR,e,zt[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=q(K.GROUPER,e,zt[e]);return this._advance(!0),t}};let en=(e,t)=>new tn(e,t).parse();var tn=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new $t(e),this._ast=t}parse(){this._advance();let e=this._parseExpression();if(this._token)throw Error(`Unexpected token: ${this._token.value}`);return e}_advance(e,t){if(!this._matches(e,t))throw Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);let n=this._tokenizer.nextToken();this._token=n,this._kind=n?.kind,this._value=n?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();let e=this._parseUnary();return e===void 0?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(e===void 0)throw Error(`Expected left to be defined.`);for(;this._token;)if(this._matches(K.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(K.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(K.DOT)||this._matches(K.OPTIONAL_DOT)){let t=this._kind===K.OPTIONAL_DOT;if(this._advance(),t&&this._matches(K.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(K.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t,!0)}else{let n=this._parseUnary();e=this._makeInvokeOrGetter(e,n,t)}}else if(this._matches(K.KEYWORD))break;else if(this._matches(K.OPERATOR)&&this._token.precedence>=t)e=this._value===`?`?this._parseTernary(e):this._parseBinary(e,this._token);else break;return e}_makeInvokeOrGetter(e,t,n){if(t===void 0)throw Error(`expected identifier`);if(t.type===`ID`)return this._ast.getter(e,t.value,n);if(t.type===`Invoke`&&t.receiver.type===`ID`){let r=t.receiver;return this._ast.invoke(e,r.value,t.arguments,n)}else throw Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(!Rt.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===K.OPERATOR||this._kind===K.DOT||this._kind===K.GROUPER)&&this._token&&(this._token.precedence??0)>t.precedence;)n=this._parsePrecedence(n,this._token?.precedence??0);if(n===void 0)throw Error(`Expected expression after ${t.value}`);return this._ast.binary(e,t.value,n)}_parseUnary(){if(this._matches(K.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(K.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(K.INTEGER))return this._parseInteger(e);if(this._matches(K.DECIMAL))return this._parseDecimal(e)}if(!e||!Lt.has(e))throw Error(`unexpected token: ${e}`);let t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(K.OPERATOR,`?`);let t=this._parseExpression();this._advance(K.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case K.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw Ft.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case K.IDENTIFIER:return this._parseInvokeOrIdentifier();case K.STRING:return this._parseString();case K.INTEGER:return this._parseInteger();case K.DECIMAL:return this._parseDecimal();case K.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case K.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(K.GROUPER,`]`))break;if(this._matches(K.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(K.COMMA));return this._advance(K.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(K.GROUPER,`}`))break;if(this._matches(K.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(K.STRING)||this._matches(K.IDENTIFIER))&&this._advance(),this._matches(K.COLON)){this._advance(K.COLON);let n=this._parseExpression();n&&e.push(this._ast.property(t,n))}else e.push(this._ast.property(t,this._ast.id(t)))}}while(this._matches(K.COMMA));return this._advance(K.GROUPER,`}`),this._ast.map(e)}_parseInvokeOrIdentifier(){let e=this._value;if(e===`true`)return this._advance(),this._ast.literal(!0);if(e===`false`)return this._advance(),this._ast.literal(!1);if(e===`null`)return this._advance(),this._ast.literal(null);if(e===`undefined`)return this._advance(),this._ast.literal(void 0);let t=this._parseIdentifier(),n=this._parseArguments();return n?this._ast.invoke(t,void 0,n):t}_parseIdentifier(){if(!this._matches(K.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(K.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(K.GROUPER,`)`))break;if(this._matches(K.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else{let t=this._parseExpression();e.push(t)}}while(this._matches(K.COMMA));return this._advance(K.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(K.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(K.ARROW)){this._advance();let t=this._parseExpression(),n=e?.map(e=>e.value)??[];return this._ast.arrowFunction(n,t)}else return this._ast.paren(e?.[0])}_parseString(){let e=this._ast.literal(this._value??``);return this._advance(),e}_parseInteger(e=``){let t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=``){let t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}};let Y=Symbol(`__computed__`);function nn(e){return typeof e==`object`&&!!e&&Y in e&&e[Y]===!0}let rn=new Ht,an=`__is_proxy__`,on=new WeakMap;function sn(e){return e instanceof gn||e[an]===!0}let cn=new WeakMap;function X(e){return typeof e==`object`&&!!e}function Z(e){return X(e)?cn.get(e):void 0}function ln(e){return e.subscribers.size===0&&e.holders.size===0}function un(e,t){if(!t.has(e)){t.add(e);for(let n of Array.from(e.holders))ln(n)?e.holders.delete(n):un(n,t);for(let t of Array.from(e.subscribers))t()}}function dn(e){un(e,new Set)}function fn(e,t){Z(e)?.subscribers.add(t)}function pn(e,t){Z(e)?.subscribers.delete(t)}function mn(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return mn(n.get(`$parent`),t)}function Q(e,t){let n=e?._store;return n?.has(t)?e:n?.has(`$parent`)?Q(n.get(`$parent`),t):null}function hn(e,t,n){let r=Q(e,t);r?r._store.set(t,n):e._store.set(t,n)}var gn=class e{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_store=new Map;_lock=Promise.resolve();_pending=new Map;_executing=new Set;_dirty=new Set;_children=new Set;_mutationCallbacks=new Map;_disposed=!1;_computedDepth=0;constructor(e){for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapObject(e){if(e==null||sn(e)||Object.isFrozen(e)||Object.isSealed(e))return e;let t=Object.getPrototypeOf(e);if(!(t===Object.prototype||t===null)&&!Array.isArray(e))return e;let n=cn.get(e)??{subscribers:new Set,holders:new Set};cn.set(e,n);let r=()=>dn(n),i=new Proxy(e,{deleteProperty:(e,t)=>typeof t==`string`&&t in e?(delete e[t],r(),!0):!1,set:(e,t,i,a)=>{if(Reflect.get(e,t,a)===i)return!0;X(i)&&(i=this.wrapObject(i),Z(i)?.holders.add(n));let o=Reflect.set(e,t,i,a);return r(),o},get:(e,t,r)=>{if(t===an)return!0;let i=Reflect.get(e,t,r);if(!X(i))return i;let a=this.wrapObject(i);return a!==i&&Reflect.set(e,t,a,r),Z(a)?.holders.add(n),a}});return cn.set(i,n),i}watch(e,t,n=this){let r=Q(this,e);if(!r)throw Error(`Cannot watch key "${e}" as it does not exist in the store.`);r.observers.has(e)||r.observers.set(e,new Set),Array.from(r.observers.get(e)||[]).some(e=>e.observer===t)||r.observers.get(e)?.add({observer:t,store:n})}addKeyHandler(e,t){this.keyHandlers.has(e)||this.keyHandlers.set(e,new Set),this.keyHandlers.get(e)?.add(t)}tagObserversForComputed(e,t){for(let n of this.observers.values())for(let r of n)r.observer===e&&r.store===this&&(r.computedKey=t);let n=this._store.get(`$parent`);for(;n;){for(let r of n.observers.values())for(let n of r)n.observer===e&&n.store===this&&(n.computedKey=t);n=n._store.get(`$parent`)}}markDependentComputedsDirty(e){let t=Q(this,e)?.observers.get(e);if(t){for(let e of t)if(e.computedKey){let t=e.store._store.get(e.computedKey);nn(t)&&!t.dirty&&(t.dirty=!0,e.store.markDependentComputedsDirty(e.computedKey))}}}runObservers(e){return e.filter(e=>!e.store._disposed).map(e=>e.observer.call(e.store.proxify(e.observer)))}async notify(e,t=10){let n=Q(this,e),r=Array.from(n?.observers.get(e)||[]);if(this._executing.has(e)){this._dirty.add(e);return}let i=this._pending.get(e);if(i){for(let e of r)i.entries.includes(e)||i.entries.push(e);return i.done}let a=new Promise(i=>{setTimeout(async()=>{this._pending.delete(e);try{this._executing.add(e);let t=this.runObservers(r);this._dirty.delete(e),await Promise.all(t)}finally{this._executing.delete(e),this._dirty.delete(e)&&this.notify(e,t)}let a=n?.observers.get(e);if(a)for(let e of r){let t=e.store._store.has(`$parent`),n=e.store._store.get(`$rootNode`);t&&n&&!n.isConnected&&!n.parentNode&&a.delete(e)}i()},t)});return this._pending.set(e,{done:a,entries:r}),a}get(e,t,n){t&&this.watch(e,t,n);let r=mn(this,e);if(nn(r)){if(r.dirty){this._computedDepth++;try{let t=this.proxify(r.effectFn);r.value=r.fn.call(t,t),r.dirty=!1,r.effectFn&&this.tagObserversForComputed(r.effectFn,e),this.markDependentComputedsDirty(e)}finally{this._computedDepth--}}return r.value}return r}setupComputed(e,t){let n=this,r={[Y]:!0,fn:t,dirty:!0};this._store.set(e,r);let i=function(){n._computedDepth++;try{let i=t.call(this,this);if(r.value!==i){r.value=i;let t=Q(n,e),a=Array.from(t?.observers.get(e)||[]);for(let e of a)e.observer.call(e.store.proxify(e.observer))}r.dirty=!1}finally{n._computedDepth--}};r.effectFn=i,this.effect(i,{directive:`computed`,id:e}),this.tagObserversForComputed(i,e)}mutationCallback(e){let t=this._mutationCallbacks.get(e);if(t)return t;let n=()=>{this.markDependentComputedsDirty(e),this.notify(e)};return this._mutationCallbacks.set(e,n),n}async set(e,t,n){if(nn(t)){this.setupComputed(e,t.fn);return}if(this._store.has(e)&&t===this._store.get(e))return;let r=mn(this,e);if(X(t)&&(t=this.wrapObject(t)),Z(t)||X(r)){let n=this.mutationCallback(e);pn(r,n),fn(t,n)}if(n?this._store.set(e,t):hn(this,e,t),!n){for(let[n,r]of this.keyHandlers.entries())if(n.test(e))for(let n of r)await Promise.resolve(n.call(this.$,e,t))}this.markDependentComputedsDirty(e),await this.notify(e)}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e),this._mutationCallbacks.delete(e)}disposeSubtree(e){if(!e.has(this)){e.add(this),this._disposed=!0;for(let t of this._children)t.disposeSubtree(e);this._children.clear();for(let[e,t]of this._mutationCallbacks)pn(mn(this,e),t);this._mutationCallbacks.clear();for(let e of this.observers.values())e.clear();this.observers.clear()}}dispose(){this._store.get(`$parent`)?._children.delete(this);let e=new Set;this.disposeSubtree(e);let t=this._store.get(`$parent`);for(;t;){for(let n of t.observers.values())for(let t of n)e.has(t.store)&&n.delete(t);t=t._store.get(`$parent`)}}keys(){return Array.from(this._store.keys())}has(e){return this._store.has(e)}getObserverStats(){let e={},t=0;for(let[n,r]of this.observers)e[n]=r.size,t+=r.size;return{totalKeys:this.observers.size,totalObservers:t,byKey:e}}effect(e,t){return e.call(this.proxify(e))}$computed(e){return{[Y]:!0,fn:e,dirty:!0}}proxify(t,n=this){let r=Array.from(this._store.entries()).map(([e])=>e),i=Object.fromEntries(r.map(e=>[e,null])),a=(e,t,n)=>typeof e==`function`&&t!==`constructor`?(...t)=>e.call(n,...t):e,o=new Proxy(i,{has:(e,t)=>typeof t==`string`&&(Q(this,t)||Reflect.has(this,t))?!0:Reflect.has(i,t),get:(r,i,o)=>{if(typeof i==`string`){if(Q(this,i)){let r=this.get(i,t,n),s=r instanceof e?r:on.get(r);return s?s.proxify(t,n):a(r,i,o)}if(t&&i!==an&&!Reflect.has(this,i))return this.set(i,void 0),this.get(i,t,n)}return i===`$`?this.proxify(t,n):a(Reflect.get(this,i,o),i,o)},set:(e,t,n,r)=>(typeof t!=`string`||t in this?Reflect.set(this,t,n,r):(this._computedDepth>0&&console.warn(`[mancha] Computed wrote to '${t}'. Computeds should be pure; use $effect for side effects.`),this.set(t,n)),!0)});return on.set(o,this),o}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=en(e,rn),i=new Proxy(n,{has(e,n){return Object.hasOwn(e,n)||n in t||n in globalThis},get(e,n){if(typeof n==`string`)return Object.hasOwn(e,n)?e[n]:n in t?t[n]:n in globalThis?globalThis[n]:t[n]},set(e,n,r){return typeof n==`string`?Object.hasOwn(e,n)?(e[n]=r,!0):(t[n]=r,!0):!1}});return r?.evaluate(i)}}cachedExpressionFunction(e){e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e));let t=this.expressionCache.get(e);if(!t)throw Error(`Failed to retrieve cached expression: ${e}`);return t}eval(e,t={}){let n=this.$;if(this._store.has(e)&&!Object.hasOwn(t,e))return n[e];{let r=this.cachedExpressionFunction(e);try{return r(n,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`,t),null}}}$resolve(e,t){let n={$pending:!0,$result:null,$error:null};return Promise.resolve().then(()=>e(t)).then(e=>{n.$result=e}).catch(e=>{n.$error=e instanceof Error?e:Error(String(e))}).finally(()=>{n.$pending=!1}),n}};let _n=`data-m-cloak`,vn=`mancha-runtime-cloak`,yn=M`[data-m-cloak]{display:none!important}`;var bn=class e extends gn{_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];cloakElement(e){let t=e.ownerDocument??globalThis.document;if(t?.head&&!t.getElementById(vn)){let e=t.createElement(`style`);e.id=vn,g(e,yn),t.head.appendChild(e)}R(e,_n,``)}uncloakElement(e){B(e,_n)}debug(e){return typeof e==`boolean`?this._debugLevel=e?`lifecycle`:`off`:this._debugLevel=e,this}get debugging(){return this._debugLevel!==`off`}shouldLog(t){return e.DEBUG_LEVELS.indexOf(this._debugLevel)>=e.DEBUG_LEVELS.indexOf(t)}clearPerformanceReport(){this._perfData={lifecycle:{},effects:new Map}}getNodePath(e){let t=[],n=e;for(;n?.tagName;){let e=n.tagName.toLowerCase(),r=n.parentElement;if(r){let i=Array.from(r.children).filter(t=>t.tagName.toLowerCase()===e);if(i.length>1){let r=i.indexOf(n)+1;t.unshift(`${e}:nth-child(${r})`)}else t.unshift(e)}else t.unshift(e);n=r}return t.join(`>`)}buildObserverId(e){let t=e?.directive??`unknown`,n=St(e?.expression??``,32),r=e?.element,i=e?.id??(r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`);return n?`${t}:${i}:${n}`:`${t}:${i}`}recordObserverExecution(e,t){let n=this.buildObserverId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}getPerformanceReport(){let e=Array.from(this._perfData.effects.entries()),t={};for(let[n,r]of e){let e=n.split(`:`)[0];t[e]||(t[e]={count:0,totalTime:0}),t[e].count+=r.count,t[e].totalTime+=r.totalTime}let n=e.map(([e,t])=>({id:e,executionCount:t.count,totalTime:t.totalTime,avgTime:t.count>0?t.totalTime/t.count:0})).sort((e,t)=>t.totalTime-e.totalTime).slice(0,10);return{lifecycle:this._perfData.lifecycle,effects:{total:e.length,byDirective:t,slowest:n},observers:this.getObserverStats()}}effect(e,t){let n=this;function r(){if(!n.shouldLog(`lifecycle`))return e.call(this);let r=performance.now(),i=e.call(this),a=performance.now()-r;return t&&n.recordObserverExecution(t,a),a>16&&console.warn(`[mancha] Slow observer (${a.toFixed(1)}ms):`,n.buildObserverId(t)),n.shouldLog(`effects`)&&console.debug(`[mancha] Observer (${a.toFixed(2)}ms):`,n.buildObserverId(t)),i}return super.effect(r,t)}async fetchRemote(e,t){let n=await fetch(e,{cache:t?.cache??`default`});if(!n.ok)throw Error(`Failed to fetch ${e}: ${n.status} ${n.statusText}`);return n.text()}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log(`Preprocessing string content with params:
|
|
44
|
-
`,t);let n=this.parseHTML(e,t);return await this.preprocessNode(n,t),n}async preprocessRemote(e,t){let n=await this.fetchRemote(e,t);return this.preprocessString(n,{...t,dirpath:
|
|
45
|
-
`,
|
|
46
|
-
`,
|
|
42
|
+
let Zt=new Set([`==`,`!=`,`<=`,`>=`,`||`,`&&`,`??`,`?.`]),Qt=new Set([`===`,`!==`]),W=function(e){return e[e.STRING=1]=`STRING`,e[e.IDENTIFIER=2]=`IDENTIFIER`,e[e.DOT=3]=`DOT`,e[e.COMMA=4]=`COMMA`,e[e.COLON=5]=`COLON`,e[e.INTEGER=6]=`INTEGER`,e[e.DECIMAL=7]=`DECIMAL`,e[e.OPERATOR=8]=`OPERATOR`,e[e.GROUPER=9]=`GROUPER`,e[e.KEYWORD=10]=`KEYWORD`,e[e.ARROW=11]=`ARROW`,e[e.OPTIONAL_DOT=12]=`OPTIONAL_DOT`,e[e.SPREAD=13]=`SPREAD`,e}({}),G=(e,t,n=0)=>({kind:e,value:t,precedence:n}),$t=e=>e===9||e===10||e===13||e===32,en=e=>{if(e===95||e===36)return!0;let t=e&-33;return 65<=t&&t<=90},tn=e=>en(e)||K(e),nn=e=>Ut.has(e),rn=e=>e===34||e===39,K=e=>48<=e&&e<=57,an=e=>e===43||e===45||e===42||e===47||e===33||e===38||e===37||e===60||e===61||e===62||e===63||e===94||e===124,on=e=>e===40||e===41||e===91||e===93||e===123||e===125,sn=e=>e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
|
|
43
|
+
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var cn=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;$t(this._next??-1);)this._advance(!0);if(rn(this._next??-1))return this._tokenizeString();if(en(this._next??-1))return this._tokenizeIdentOrKeyword();if(K(this._next??-1))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(an(this._next??-1))return this._tokenizeOperator();if(on(this._next??-1))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),e===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){let t=this._input.substring(this._tokenStart,this._index+e);return e===0&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let e=this._next;for(this._advance(!0);this._next!==e;){if(this._next===void 0||this._next===92&&(this._advance(),this._next===void 0))throw Error(`unterminated string`);this._advance()}let t=G(W.STRING,sn(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(tn(this._next??-1));let e=this._getValue();return G(nn(e)?W.KEYWORD:Wt.has(e)?W.OPERATOR:W.IDENTIFIER,e,qt[e]??0)}_tokenizeNumber(){do this._advance();while(K(this._next??-1));return this._next===46?this._tokenizeDot():G(W.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),K(this._next??-1))return this._tokenizeFraction();if(this._next===46){if(this._advance(),this._next===46)return this._advance(),this._clearValue(),G(W.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),G(W.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),G(W.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),G(W.COLON,`:`)}_tokenizeFraction(){do this._advance();while(K(this._next??-1));return G(W.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(Qt.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),G(W.ARROW,e);Zt.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?G(W.OPTIONAL_DOT,e,13):G(W.OPERATOR,e,qt[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=G(W.GROUPER,e,qt[e]);return this._advance(!0),t}};let ln=(e,t)=>new un(e,t).parse();var un=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new cn(e),this._ast=t}parse(){this._advance();let e=this._parseExpression();if(this._token)throw Error(`Unexpected token: ${this._token.value}`);return e}_advance(e,t){if(!this._matches(e,t))throw Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);let n=this._tokenizer.nextToken();this._token=n,this._kind=n?.kind,this._value=n?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();let e=this._parseUnary();return e===void 0?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(e===void 0)throw Error(`Expected left to be defined.`);for(;this._token;)if(this._matches(W.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(W.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(W.DOT)||this._matches(W.OPTIONAL_DOT)){let t=this._kind===W.OPTIONAL_DOT;if(this._advance(),t&&this._matches(W.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(W.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t,!0)}else{let n=this._parseUnary();e=this._makeInvokeOrGetter(e,n,t)}}else if(this._matches(W.KEYWORD))break;else if(this._matches(W.OPERATOR)&&this._token.precedence>=t)e=this._value===`?`?this._parseTernary(e):this._parseBinary(e,this._token);else break;return e}_makeInvokeOrGetter(e,t,n){if(t===void 0)throw Error(`expected identifier`);if(t.type===`ID`)return this._ast.getter(e,t.value,n);if(t.type===`Invoke`&&t.receiver.type===`ID`){let r=t.receiver;return this._ast.invoke(e,r.value,t.arguments,n)}else throw Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(!Kt.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===W.OPERATOR||this._kind===W.DOT||this._kind===W.GROUPER)&&this._token&&(this._token.precedence??0)>t.precedence;)n=this._parsePrecedence(n,this._token?.precedence??0);if(n===void 0)throw Error(`Expected expression after ${t.value}`);return this._ast.binary(e,t.value,n)}_parseUnary(){if(this._matches(W.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(W.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(W.INTEGER))return this._parseInteger(e);if(this._matches(W.DECIMAL))return this._parseDecimal(e)}if(!e||!Gt.has(e))throw Error(`unexpected token: ${e}`);let t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(W.OPERATOR,`?`);let t=this._parseExpression();this._advance(W.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case W.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw Ut.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case W.IDENTIFIER:return this._parseInvokeOrIdentifier();case W.STRING:return this._parseString();case W.INTEGER:return this._parseInteger();case W.DECIMAL:return this._parseDecimal();case W.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case W.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(W.GROUPER,`]`))break;if(this._matches(W.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(W.COMMA));return this._advance(W.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(W.GROUPER,`}`))break;if(this._matches(W.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(W.STRING)||this._matches(W.IDENTIFIER))&&this._advance(),this._matches(W.COLON)){this._advance(W.COLON);let n=this._parseExpression();n&&e.push(this._ast.property(t,n))}else e.push(this._ast.property(t,this._ast.id(t)))}}while(this._matches(W.COMMA));return this._advance(W.GROUPER,`}`),this._ast.map(e)}_parseInvokeOrIdentifier(){let e=this._value;if(e===`true`)return this._advance(),this._ast.literal(!0);if(e===`false`)return this._advance(),this._ast.literal(!1);if(e===`null`)return this._advance(),this._ast.literal(null);if(e===`undefined`)return this._advance(),this._ast.literal(void 0);let t=this._parseIdentifier(),n=this._parseArguments();return n?this._ast.invoke(t,void 0,n):t}_parseIdentifier(){if(!this._matches(W.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(W.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(W.GROUPER,`)`))break;if(this._matches(W.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else{let t=this._parseExpression();e.push(t)}}while(this._matches(W.COMMA));return this._advance(W.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(W.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(W.ARROW)){this._advance();let t=this._parseExpression(),n=e?.map(e=>e.value)??[];return this._ast.arrowFunction(n,t)}else return this._ast.paren(e?.[0])}_parseString(){let e=this._ast.literal(this._value??``);return this._advance(),e}_parseInteger(e=``){let t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=``){let t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}};let q=Symbol(`__computed__`);function dn(e){return typeof e==`object`&&!!e&&q in e&&e[q]===!0}let fn=new Xt,pn=`__is_proxy__`,mn=new WeakMap;function hn(e){return e instanceof Sn||e[pn]===!0}let J=new WeakMap;function Y(e){return typeof e==`object`&&!!e}function X(e){return Y(e)?J.get(e):void 0}function gn(e){return e.subscribers.size===0&&e.holders.size===0}function _n(e,t){if(!t.has(e)){t.add(e);for(let n of Array.from(e.holders))gn(n)?e.holders.delete(n):_n(n,t);for(let t of Array.from(e.subscribers))t()}}function vn(e){_n(e,new Set)}function yn(e,t){X(e)?.subscribers.add(t)}function bn(e,t){X(e)?.subscribers.delete(t)}function Z(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return Z(n.get(`$parent`),t)}function Q(e,t){let n=e?._store;return n?.has(t)?e:n?.has(`$parent`)?Q(n.get(`$parent`),t):null}function xn(e,t,n){let r=Q(e,t);r?r._store.set(t,n):e._store.set(t,n)}var Sn=class e{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_store=new Map;_lock=Promise.resolve();_pending=new Map;_executing=new Set;_dirty=new Set;_children=new Set;_mutationCallbacks=new Map;_disposed=!1;_computedDepth=0;constructor(e){for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapObject(e){if(e==null||hn(e)||Object.isFrozen(e)||Object.isSealed(e))return e;let t=Object.getPrototypeOf(e);if(!(t===Object.prototype||t===null)&&!Array.isArray(e))return e;let n=J.get(e)??{subscribers:new Set,holders:new Set};J.set(e,n);let r=()=>vn(n),i=new Proxy(e,{deleteProperty:(e,t)=>typeof t==`string`&&t in e?(delete e[t],r(),!0):!1,set:(e,t,i,a)=>{if(Reflect.get(e,t,a)===i)return!0;Y(i)&&(i=this.wrapObject(i),X(i)?.holders.add(n));let o=Reflect.set(e,t,i,a);return r(),o},get:(e,t,r)=>{if(t===pn)return!0;let i=Reflect.get(e,t,r);if(!Y(i))return i;let a=this.wrapObject(i);return a!==i&&Reflect.set(e,t,a,r),X(a)?.holders.add(n),a}});return J.set(i,n),i}watch(e,t,n=this){let r=Q(this,e);if(!r)throw Error(`Cannot watch key "${e}" as it does not exist in the store.`);r.observers.has(e)||r.observers.set(e,new Set),Array.from(r.observers.get(e)||[]).some(e=>e.observer===t)||r.observers.get(e)?.add({observer:t,store:n})}addKeyHandler(e,t){this.keyHandlers.has(e)||this.keyHandlers.set(e,new Set),this.keyHandlers.get(e)?.add(t)}tagObserversForComputed(e,t){for(let n of this.observers.values())for(let r of n)r.observer===e&&r.store===this&&(r.computedKey=t);let n=this._store.get(`$parent`);for(;n;){for(let r of n.observers.values())for(let n of r)n.observer===e&&n.store===this&&(n.computedKey=t);n=n._store.get(`$parent`)}}markDependentComputedsDirty(e){let t=Q(this,e)?.observers.get(e);if(t){for(let e of t)if(e.computedKey){let t=e.store._store.get(e.computedKey);dn(t)&&!t.dirty&&(t.dirty=!0,e.store.markDependentComputedsDirty(e.computedKey))}}}runObservers(e){return e.filter(e=>!e.store._disposed).map(e=>e.observer.call(e.store.proxify(e.observer)))}async notify(e,t=10){let n=Q(this,e),r=Array.from(n?.observers.get(e)||[]);if(this._executing.has(e)){this._dirty.add(e);return}let i=this._pending.get(e);if(i){for(let e of r)i.entries.includes(e)||i.entries.push(e);return i.done}let a=new Promise(i=>{setTimeout(async()=>{this._pending.delete(e);try{this._executing.add(e);let t=this.runObservers(r);this._dirty.delete(e),await Promise.all(t)}finally{this._executing.delete(e),this._dirty.delete(e)&&this.notify(e,t)}let a=n?.observers.get(e);if(a)for(let e of r){let t=e.store._store.has(`$parent`),n=e.store._store.get(`$rootNode`);t&&n&&!n.isConnected&&!n.parentNode&&a.delete(e)}i()},t)});return this._pending.set(e,{done:a,entries:r}),a}get(e,t,n){t&&this.watch(e,t,n);let r=Z(this,e);if(dn(r)){if(r.dirty){this._computedDepth++;try{let t=this.proxify(r.effectFn);r.value=r.fn.call(t,t),r.dirty=!1,r.effectFn&&this.tagObserversForComputed(r.effectFn,e),this.markDependentComputedsDirty(e)}finally{this._computedDepth--}}return r.value}return r}setupComputed(e,t){let n=this,r={[q]:!0,fn:t,dirty:!0};this._store.set(e,r);let i=function(){n._computedDepth++;try{let i=t.call(this,this);if(r.value!==i){r.value=i;let t=Q(n,e),a=Array.from(t?.observers.get(e)||[]);for(let e of a)e.observer.call(e.store.proxify(e.observer))}r.dirty=!1}finally{n._computedDepth--}};r.effectFn=i,this.effect(i,{directive:`computed`,id:e}),this.tagObserversForComputed(i,e)}mutationCallback(e){let t=this._mutationCallbacks.get(e);if(t)return t;let n=()=>{this.markDependentComputedsDirty(e),this.notify(e)};return this._mutationCallbacks.set(e,n),n}async set(e,t,n){if(dn(t)){this.setupComputed(e,t.fn);return}if(this._store.has(e)&&t===this._store.get(e))return;let r=Z(this,e);if(Y(t)&&(t=this.wrapObject(t)),X(t)||Y(r)){let n=this.mutationCallback(e);bn(r,n),yn(t,n)}if(n?this._store.set(e,t):xn(this,e,t),!n){for(let[n,r]of this.keyHandlers.entries())if(n.test(e))for(let n of r)await Promise.resolve(n.call(this.$,e,t))}this.markDependentComputedsDirty(e),await this.notify(e)}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e),this._mutationCallbacks.delete(e)}disposeSubtree(e){if(!e.has(this)){e.add(this),this._disposed=!0;for(let t of this._children)t.disposeSubtree(e);this._children.clear();for(let[e,t]of this._mutationCallbacks)bn(Z(this,e),t);this._mutationCallbacks.clear();for(let e of this.observers.values())e.clear();this.observers.clear()}}dispose(){this._store.get(`$parent`)?._children.delete(this);let e=new Set;this.disposeSubtree(e);let t=this._store.get(`$parent`);for(;t;){for(let n of t.observers.values())for(let t of n)e.has(t.store)&&n.delete(t);t=t._store.get(`$parent`)}}keys(){return Array.from(this._store.keys())}has(e){return this._store.has(e)}getObserverStats(){let e={},t=0;for(let[n,r]of this.observers)e[n]=r.size,t+=r.size;return{totalKeys:this.observers.size,totalObservers:t,byKey:e}}effect(e,t){return e.call(this.proxify(e))}$computed(e){return{[q]:!0,fn:e,dirty:!0}}proxify(t,n=this){let r=Array.from(this._store.entries()).map(([e])=>e),i=Object.fromEntries(r.map(e=>[e,null])),a=(e,t,n)=>typeof e==`function`&&t!==`constructor`?(...t)=>e.call(n,...t):e,o=new Proxy(i,{has:(e,t)=>typeof t==`string`&&(Q(this,t)||Reflect.has(this,t))?!0:Reflect.has(i,t),get:(r,i,o)=>{if(typeof i==`string`){if(Q(this,i)){let r=this.get(i,t,n),s=r instanceof e?r:mn.get(r);return s?s.proxify(t,n):a(r,i,o)}if(t&&i!==pn&&!Reflect.has(this,i))return this.set(i,void 0),this.get(i,t,n)}return i===`$`?this.proxify(t,n):a(Reflect.get(this,i,o),i,o)},set:(e,t,n,r)=>(typeof t!=`string`||t in this?Reflect.set(this,t,n,r):(this._computedDepth>0&&console.warn(`[mancha] Computed wrote to '${t}'. Computeds should be pure; use $effect for side effects.`),this.set(t,n)),!0)});return mn.set(o,this),o}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=ln(e,fn),i=new Proxy(n,{has(e,n){return Object.hasOwn(e,n)||n in t||n in globalThis},get(e,n){if(typeof n==`string`)return Object.hasOwn(e,n)?e[n]:n in t?t[n]:n in globalThis?globalThis[n]:t[n]},set(e,n,r){return typeof n==`string`?Object.hasOwn(e,n)?(e[n]=r,!0):(t[n]=r,!0):!1}});return r?.evaluate(i)}}cachedExpressionFunction(e){e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e));let t=this.expressionCache.get(e);if(!t)throw Error(`Failed to retrieve cached expression: ${e}`);return t}eval(e,t={}){let n=this.$;if(this._store.has(e)&&!Object.hasOwn(t,e))return n[e];{let r=this.cachedExpressionFunction(e);try{return r(n,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`,t),null}}}$resolve(e,t){let n={$pending:!0,$result:null,$error:null};return Promise.resolve().then(()=>e(t)).then(e=>{n.$result=e}).catch(e=>{n.$error=e instanceof Error?e:Error(String(e))}).finally(()=>{n.$pending=!1}),n}};let Cn=`data-m-cloak`,wn=`mancha-runtime-cloak`,Tn=A`[data-m-cloak]{display:none!important}`;var En=class e extends Sn{_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];cloakElement(e){let t=e.ownerDocument??globalThis.document;if(t?.head&&!t.getElementById(wn)){let e=t.createElement(`style`);e.id=wn,_(e,Tn),t.head.appendChild(e)}I(e,Cn,``)}uncloakElement(e){R(e,Cn)}debug(e){return typeof e==`boolean`?this._debugLevel=e?`lifecycle`:`off`:this._debugLevel=e,this}get debugging(){return this._debugLevel!==`off`}shouldLog(t){return e.DEBUG_LEVELS.indexOf(this._debugLevel)>=e.DEBUG_LEVELS.indexOf(t)}clearPerformanceReport(){this._perfData={lifecycle:{},effects:new Map}}getNodePath(e){let t=[],n=e;for(;n?.tagName;){let e=n.tagName.toLowerCase(),r=n.parentElement;if(r){let i=Array.from(r.children).filter(t=>t.tagName.toLowerCase()===e);if(i.length>1){let r=i.indexOf(n)+1;t.unshift(`${e}:nth-child(${r})`)}else t.unshift(e)}else t.unshift(e);n=r}return t.join(`>`)}buildObserverId(e){let t=e?.directive??`unknown`,n=At(e?.expression??``,32),r=e?.element,i=e?.id??(r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`);return n?`${t}:${i}:${n}`:`${t}:${i}`}recordObserverExecution(e,t){let n=this.buildObserverId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}getPerformanceReport(){let e=Array.from(this._perfData.effects.entries()),t={};for(let[n,r]of e){let e=n.split(`:`)[0];t[e]||(t[e]={count:0,totalTime:0}),t[e].count+=r.count,t[e].totalTime+=r.totalTime}let n=e.map(([e,t])=>({id:e,executionCount:t.count,totalTime:t.totalTime,avgTime:t.count>0?t.totalTime/t.count:0})).sort((e,t)=>t.totalTime-e.totalTime).slice(0,10);return{lifecycle:this._perfData.lifecycle,effects:{total:e.length,byDirective:t,slowest:n},observers:this.getObserverStats()}}effect(e,t){let n=this;function r(){if(!n.shouldLog(`lifecycle`))return e.call(this);let r=performance.now(),i=e.call(this),a=performance.now()-r;return t&&n.recordObserverExecution(t,a),a>16&&console.warn(`[mancha] Slow observer (${a.toFixed(1)}ms):`,n.buildObserverId(t)),n.shouldLog(`effects`)&&console.debug(`[mancha] Observer (${a.toFixed(2)}ms):`,n.buildObserverId(t)),i}return super.effect(r,t)}async fetchRemote(e,t){let n=await fetch(e,{cache:t?.cache??`default`});if(!n.ok)throw Error(`Failed to fetch ${e}: ${n.status} ${n.statusText}`);return n.text()}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log(`Preprocessing string content with params:
|
|
44
|
+
`,t);let n=this.parseHTML(e,t);return await this.preprocessNode(n,t),n}async preprocessRemote(e,t){let n=await this.fetchRemote(e,t);return this.preprocessString(n,{...t,dirpath:jt(e),rootDocument:t?.rootDocument??!e.endsWith(`.tpl.html`)})}async preprocessLocal(e,t){let n=await this.fetchLocal(e,t);return this.preprocessString(n,{...t,dirpath:jt(e),rootDocument:t?.rootDocument??!e.endsWith(`.tpl.html`)})}subrenderer(){let e=new this.constructor().debug(this.debugging);return e._store.set(`$parent`,this),this._disposed||this._children.add(e),e._store.set(`$rootRenderer`,this.get(`$rootRenderer`)??this),e._customElements=this._customElements,e}log(...e){this.shouldLog(`verbose`)&&console.debug(...e)}async preprocessNode(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;t={dirpath:this.dirpath,maxdepth:10,...t};let r=new Set(this._skipNodes),i=new Nt(j(e,r)).map(async n=>{if(n!==e&&U.templateName(n))for(let e of Array.from(n.childNodes))r.add(e);this.log(`Preprocessing node:
|
|
45
|
+
`,H(n,128)),await U.resolveIncludes.call(this,n,t),await U.rebaseRelativePaths.call(this,n,t),await U.registerCustomElements.call(this,n,t),await U.resolveCustomElements.call(this,n,t)});return await Promise.all(i.generator()),n&&(this._perfData.lifecycle.preprocessTime=(this._perfData.lifecycle.preprocessTime??0)+(performance.now()-n)),e}async renderNode(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;for(let n of j(e,this._skipNodes))this.log(`Rendering node:
|
|
46
|
+
`,H(n,128)),await U.resolveForAttribute.call(this,n,t),await U.resolveRenderAttribute.call(this,n,t),await U.resolveDataAttribute.call(this,n,t),await U.resolveTextAttributes.call(this,n,t),await U.resolveHtmlAttribute.call(this,n,t),await U.resolveIfAttribute.call(this,n,t),await U.resolveShowAttribute.call(this,n,t),await U.resolveClassAttribute.call(this,n,t),await U.resolveBindAttribute.call(this,n,t),await U.resolveEventAttributes.call(this,n,t),await U.resolveTextNodeExpressions.call(this,n,t),await U.resolveCustomAttribute.call(this,n,t),await U.resolveCustomProperty.call(this,n,t),await U.stripTypes.call(this,n,t);for(let e of this._pendingValueRetries.splice(0))e();return n&&(this._perfData.lifecycle.renderTime=(this._perfData.lifecycle.renderTime??0)+(performance.now()-n)),e}async mount(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;n&&this.clearPerformanceReport(),t={...t,rootNode:e},L(e,`renderer`,this),this._store.set(`$rootNode`,e),this.has(`$rootRenderer`)||this._store.set(`$rootRenderer`,this),this.get(`$rootRenderer`)===this&&await Ht(this),await this.preprocessNode(e,t),await this.renderNode(e,t),mt(e),n&&(this._perfData.lifecycle.mountTime=performance.now()-n)}};function Dn(){return _t([A`*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}`,A`html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}`,A`body{margin:0;line-height:inherit}`,A`hr{height:0;color:inherit;border-top-width:1px}`,A`abbr:where([title]){text-decoration:underline dotted}`,A`b,strong{font-weight:bolder}`,A`code,kbd,samp,pre{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:1em}`,A`small{font-size:80%}`,A`sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}`,A`sub{bottom:-0.25em}`,A`sup{top:-0.5em}`,A`button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}`,A`button,select{text-transform:none}`,A`button,[type='button'],[type='reset'],[type='submit']{-webkit-appearance:button;background-color:transparent;background-image:none;cursor:pointer}`,A`:-moz-focusring{outline:auto}`,A`:-moz-ui-invalid{box-shadow:none}`,A`progress{vertical-align:baseline}`,A`::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}`,A`[type='search']{-webkit-appearance:textfield;outline-offset:-2px}`,A`::-webkit-search-decoration{-webkit-appearance:none}`,A`::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}`,A`summary{display:list-item}`,A`blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}`,A`fieldset{margin:0;padding:0}`,A`legend{padding:0}`,A`ol,ul,menu{list-style:none;margin:0;padding:0}`,A`textarea{resize:vertical}`,A`::placeholder{opacity:1;color:#9ca3af}`,A`button,[role="button"]{cursor:pointer}`,A`:disabled{cursor:default;pointer-events:none;opacity:0.75}`,A`img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}`,A`img,video{max-width:100%;height:auto}`,A`[hidden]{display:none}`,A`dialog{padding:0}`,A`dialog::backdrop{background:rgba(0,0,0,0.5)}`])}function On(){return _t([A`html{`,A`max-width: 70ch;`,A`padding: 2em 1em;`,A`margin: auto;`,A`line-height: 1.75;`,A`font-size: 1.25em;`,A`font-family: sans-serif;`,A`}`,A`h1,h2,h3,h4,h5,h6{`,A`margin: 1em 0 0.5em;`,A`}`,A`p,ul,ol{`,A`margin-bottom: 1em;`,A`color: #1d1d1d;`,A`}`])}var kn=class extends En{impl=`browser`;dirpath=jt(globalThis.location?.href??`http://localhost/`);parseHTML(e,t={rootDocument:!1}){if(t.rootDocument)return new DOMParser().parseFromString(e,`text/html`);{let t=document.createRange();return t.selectNodeContents(document.body),t.createContextualFragment(e)}}serializeHTML(e){return new XMLSerializer().serializeToString(e).replace(/\s?xmlns="[^"]+"/gm,``)}preprocessLocal(e,t){return this.preprocessRemote(e,t)}createElement(e,t){return(t||document).createElement(e)}createComment(e,t){return(t||document).createComment(e)}textContent(e,t){e.textContent=t}};new kn;function An(e){for(let t of e){t=t.trim();let e=document.createElement(`style`);switch(t){case`minimal`:_(e,On());break;case`basic`:case`custom`:continue;case`utils`:{_(e,Dn()),e.setAttribute(`data-mancha`,`basic`),globalThis.document.head.appendChild(e);let t=document.createElement(`style`);t.textContent=Ie(),t.setAttribute(`data-mancha`,`utils`),globalThis.document.head.appendChild(t),ft(document);continue}default:console.error(`Unknown style name: "${t}"`);continue}globalThis.document.head.appendChild(e)}}let jn=`mancha-cloak`;function Mn(e,t){let n=`${e.join(`, `)} { opacity: 0 !important; ${t>0?`transition: opacity ${t}ms ease-in-out !important;`:``} }`,r=document.getElementById(jn);r||(r=document.createElement(`style`),r.id=jn,document.head.appendChild(r)),r.textContent=n}function Nn(e){let t=!1;return async()=>{if(t)return;t=!0;let n=document.getElementById(jn);if(n){if(e!==!1){let t=n.sheet;t&&t.cssRules.length>0&&t.cssRules[0].style.setProperty(`opacity`,`1`,`important`),await new Promise(t=>setTimeout(t,e))}typeof globalThis.requestAnimationFrame==`function`&&(await new Promise(e=>globalThis.requestAnimationFrame(e)),await new Promise(e=>globalThis.requestAnimationFrame(e))),n.remove()}}}async function Pn(e={}){let t;document.documentElement.classList.add(`mancha-loading`);let n=e.cloak?e.cloak===!0?{}:e.cloak:void 0;if(n){let r=e.target?Array.isArray(e.target)?e.target:[e.target]:[`body`],i=n.selector&&(Array.isArray(n.selector)||typeof n.selector==`string`)?Array.isArray(n.selector)?n.selector:[n.selector]:r,a=n.duration??0;Mn(i,a),t=Nn(a>0?a:!1)}else t=Nn(!1);document.readyState===`loading`&&await new Promise(e=>{window.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0})});let r=e.renderer??new kn;e.css&&e.css.length>0&&An(e.css),e.debug&&r.debug(!0),e.state&&await Promise.all(Object.entries(e.state).map(([e,t])=>r.set(e,t)));try{if(e.callback)await e.callback(r);else if(e.target){let t=Array.isArray(e.target)?e.target:[e.target];for(let n of t){let t=globalThis.document.querySelector(n);t?await r.mount(t,{cache:e.cache}):console.error(`Target element not found: "${n}"`)}}}finally{document.documentElement.classList.remove(`mancha-loading`),t&&await t()}return r}let $=globalThis.document?.currentScript,Fn=new kn;if(Fn.initMancha=Pn,globalThis.Mancha=Fn,$?.hasAttribute(`init`)){let e=$.hasAttribute(`debug`),t=$.getAttribute(`cache`)||void 0,n=$.getAttribute(`target`)?.split(`+`).map(e=>e.trim())||[`body`],r=$.getAttribute(`css`)?.split(`+`).map(e=>e.trim()).filter(e=>e!==``),i,a=$.getAttribute(`cloak`);if(a===`false`)i=void 0;else if(a&&!Number.isNaN(parseInt(a,10))){let e=parseInt(a,10);i=e>0?{duration:e}:!0}else i=!0;Pn({renderer:Fn,css:r,target:n,debug:e,cache:t,cloak:i})}else if($?.hasAttribute(`css`)){let e=$.getAttribute(`css`)?.split(`+`).map(e=>e.trim()).filter(e=>e!==``);Pn({css:e})}return Fn})();
|
package/docs/05_css.md
CHANGED
|
@@ -56,7 +56,7 @@ The utility CSS rules are inspired by Tailwind CSS. You can inject them using `i
|
|
|
56
56
|
This automatically includes:
|
|
57
57
|
- **CSS Reset**: box-sizing, typography, form and media defaults applied to all of your markup — see [CSS Reset](#css-reset), in particular the layout effects on images, lists, and form controls
|
|
58
58
|
- **Base utility classes**: spacing, sizing, colors, layout, typography, and more
|
|
59
|
-
- **On-demand scanning**: responsive variants, orientation variants,
|
|
59
|
+
- **On-demand scanning**: responsive variants, orientation variants, state variants, color opacity, custom bracket values, and dark mode are generated on-the-fly for only the classes actually used in your markup
|
|
60
60
|
|
|
61
61
|
### Media Breakpoints
|
|
62
62
|
|
|
@@ -79,12 +79,60 @@ Use the `landscape:` and `portrait:` prefixes to apply styles based on screen or
|
|
|
79
79
|
</div>
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
###
|
|
82
|
+
### State Variants
|
|
83
83
|
|
|
84
|
-
The following
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
The following state variants are supported for all utilities:
|
|
85
|
+
|
|
86
|
+
| Prefix | Selector |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| `hover:` | `.class:hover` |
|
|
89
|
+
| `focus:` | `.class:focus` |
|
|
90
|
+
| `disabled:` | `.class:disabled` |
|
|
91
|
+
| `empty:` | `.class:empty` |
|
|
92
|
+
| `aria-busy:` | `.class[aria-busy="true"]` |
|
|
93
|
+
| `aria-checked:` | `.class[aria-checked="true"]` |
|
|
94
|
+
| `aria-disabled:` | `.class[aria-disabled="true"]` |
|
|
95
|
+
| `aria-expanded:` | `.class[aria-expanded="true"]` |
|
|
96
|
+
| `aria-hidden:` | `.class[aria-hidden="true"]` |
|
|
97
|
+
| `aria-pressed:` | `.class[aria-pressed="true"]` |
|
|
98
|
+
| `aria-readonly:` | `.class[aria-readonly="true"]` |
|
|
99
|
+
| `aria-required:` | `.class[aria-required="true"]` |
|
|
100
|
+
| `aria-selected:` | `.class[aria-selected="true"]` |
|
|
101
|
+
| `has-checked:` | `.class:has(*:checked)` |
|
|
102
|
+
| `has-focus:` | `.class:has(*:focus)` |
|
|
103
|
+
| `has-disabled:` | `.class:has(*:disabled)` |
|
|
104
|
+
| `has-hover:` | `.class:has(*:hover)` |
|
|
105
|
+
| `aria-[name=value]:` | `.class[aria-name="value"]` |
|
|
106
|
+
| `has-[selector]:` | `.class:has(selector)` |
|
|
107
|
+
|
|
108
|
+
Style an element from its own ARIA attributes, or a parent from the state of its children:
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<button :attr:aria-pressed="done" class="bg-gray-200 aria-pressed:bg-green-300">Done</button>
|
|
112
|
+
<a aria-current="page" class="aria-[current=page]:font-bold">Home</a>
|
|
113
|
+
<label class="has-checked:bg-green-300"><input type="radio" /> Option</label>
|
|
114
|
+
<ul class="grid gap-3 empty:hidden"></ul>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Arbitrary values in `aria-[...]` take a single `name=value` pair of letters, digits, `_` and `-`. Selectors in `has-[...]` take letters, digits and `_-:.#>+~*(),` only, with balanced parentheses, so no spaces, quotes or attribute selectors. Anything else is rejected as an unresolvable class.
|
|
118
|
+
|
|
119
|
+
`empty:` is plain `:empty`, which is false if an element contains any text (including whitespace between tags) or element children. A `:for` list always keeps its `<template>` marker inside the container, so `empty:` cannot detect an empty `:for` list; to hide a list with no items, use `:show` on the container:
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<ul :show="errors.length">...</ul>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Stacked Variants
|
|
126
|
+
|
|
127
|
+
Variants stack: every prefix must hold for the class to apply. Media variants (`sm:`, `dark:`, `landscape:`, …) are combined into one `@media` query with `and`, and state variants are appended to the selector:
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<button class="dark:md:hover:bg-gray-700 md:aria-pressed:w-full">Toggle</button>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`dark:md:hover:bg-gray-700` becomes `@media (prefers-color-scheme: dark) and (min-width: 768px) { .dark\:md\:hover\:bg-gray-700:hover { … } }`. All conditions apply to the same element, so the order of the prefixes does not matter. Prefixes are read up to the first one that is not a variant, and the rest is the base class: `md:print:hidden` applies `md:` to a stylesheet class `.print\:hidden`.
|
|
134
|
+
|
|
135
|
+
When two variant rules set the same property, the more specific selector wins: each state variant adds specificity, a `has-[...]` variant that of its selector. Media variants add none, so between rules of equal specificity the one injected later wins, which is the one whose class Mancha encountered later.
|
|
88
136
|
|
|
89
137
|
### Dark Mode
|
|
90
138
|
|
|
@@ -102,7 +150,7 @@ The `dark:` prefix can be used with any utility class, including colors, spacing
|
|
|
102
150
|
<div class="bg-[#fff] dark:bg-[#1a1a1a] p-4 dark:border-gray-700">
|
|
103
151
|
```
|
|
104
152
|
|
|
105
|
-
> **Note:** Responsive variants (`sm:`, `md:`, etc.), orientation variants (`landscape:`, `portrait:`),
|
|
153
|
+
> **Note:** Responsive variants (`sm:`, `md:`, etc.), orientation variants (`landscape:`, `portrait:`), state variants (`hover:`, `aria-*:`, `has-*:`, …), color opacity (`/N`), dark mode (`dark:`), and custom bracket values are all generated on-demand. Only the classes actually present in your markup are injected, keeping the CSS bundle small.
|
|
106
154
|
|
|
107
155
|
### Spacing (Margin & Padding)
|
|
108
156
|
|
|
@@ -537,6 +585,7 @@ You can also control the opacity of any color utility by appending `/{opacity}`
|
|
|
537
585
|
|
|
538
586
|
| Utility | Description |
|
|
539
587
|
| --- | --- |
|
|
588
|
+
| `list-item` | `display: list-item` |
|
|
540
589
|
| `list-none` | `list-style-type: none` |
|
|
541
590
|
| `list-disc` | `list-style-type: disc` |
|
|
542
591
|
| `list-decimal` | `list-style-type: decimal` |
|
|
@@ -581,6 +630,17 @@ You can also control the opacity of any color utility by appending `/{opacity}`
|
|
|
581
630
|
| Utility | Description |
|
|
582
631
|
| --- | --- |
|
|
583
632
|
| `no-underline` | `text-decoration: none` |
|
|
633
|
+
| `float-left` | `float: left` |
|
|
634
|
+
| `float-right` | `float: right` |
|
|
635
|
+
| `float-none` | `float: none` |
|
|
636
|
+
| `clear-left` | `clear: left` |
|
|
637
|
+
| `clear-right` | `clear: right` |
|
|
638
|
+
| `clear-both` | `clear: both` |
|
|
639
|
+
| `clear-none` | `clear: none` |
|
|
640
|
+
| `break-normal` | `overflow-wrap: normal; word-break: normal` |
|
|
641
|
+
| `break-words` | `overflow-wrap: break-word` |
|
|
642
|
+
| `break-all` | `word-break: break-all` |
|
|
643
|
+
| `break-keep` | `word-break: keep-all` |
|
|
584
644
|
| `grid` | `display: grid` |
|
|
585
645
|
| `box-border` | `box-sizing: border-box` |
|
|
586
646
|
| `box-content` | `box-sizing: content-box` |
|
|
@@ -619,10 +679,10 @@ When you need a value outside the design scale, use bracket notation as an escap
|
|
|
619
679
|
|
|
620
680
|
### Variants
|
|
621
681
|
|
|
622
|
-
Custom values support pseudo-states, responsive breakpoints, and dark mode:
|
|
682
|
+
Custom values support pseudo-states, responsive breakpoints, and dark mode, stacked or not:
|
|
623
683
|
|
|
624
684
|
```html
|
|
625
|
-
<div class="hover:w-[200px] md:max-w-[900px] dark:bg-[#333]">
|
|
685
|
+
<div class="hover:w-[200px] md:max-w-[900px] dark:bg-[#333] dark:md:hover:bg-[#444]">
|
|
626
686
|
```
|
|
627
687
|
|
|
628
688
|
### Binding
|
|
@@ -637,6 +697,8 @@ Markup that Mancha did not render is the exception: it is never scanned, so call
|
|
|
637
697
|
|
|
638
698
|
**Unresolvable classes are reported**: a class that reaches on-demand injection and matches no rule logs `No CSS rule for class: ...` once for the life of the page. That covers a typo or a color outside the palette (`hover:bg-brand-500`), and also anything Mancha does not implement — a variant it does not know (`active:`, `group-hover:`), or a bracket value on a property it does not map (`rounded-[12px]`). Each of those does nothing, which is what the message is for. Sheets that arrive later are picked up, so a late-loading sheet defining the class still works.
|
|
639
699
|
|
|
700
|
+
**Restricted characters**: a bracket value may only contain letters, digits, `_`, `-`, `#`, `.`, `%`, `+`, `*`, `/`, `,`, `!` and balanced parentheses, and may not contain `/*`. Anything else (`;`, braces, quotes, backslashes, `:`, …) makes the class unresolvable, so a value cannot break out of its declaration.
|
|
701
|
+
|
|
640
702
|
### When to Use
|
|
641
703
|
|
|
642
704
|
**Prefer the design scale** for consistency. Use custom values for:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mancha",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Javscript HTML rendering engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"@types/trusted-types": "^2.0.7",
|
|
94
94
|
"@types/yargs": "^17.0.29",
|
|
95
95
|
"@web/test-runner": "^0.19.0",
|
|
96
|
+
"@web/test-runner-commands": "^0.9.0",
|
|
96
97
|
"@web/test-runner-playwright": "^0.11.1",
|
|
97
98
|
"chai": "^5.3.3",
|
|
98
99
|
"chai-as-promised": "^8.0.1",
|