@rcarls/rc-common 0.1.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 +206 -0
- package/dist/css-anchor-positioning-fn-hFYJeBk4.js +6371 -0
- package/dist/rc-common.js +811 -0
- package/dist/rc-common.umd.cjs +31 -0
- package/dist/types/ActiveDescendantController.d.ts +86 -0
- package/dist/types/AnchorController.d.ts +55 -0
- package/dist/types/DragController.d.ts +53 -0
- package/dist/types/KeyboardNavigationDirective.d.ts +76 -0
- package/dist/types/KeyboardNavigationDirective.test.d.ts +1 -0
- package/dist/types/MouseMoveDirective.d.ts +42 -0
- package/dist/types/MouseMoveDirective.test.d.ts +1 -0
- package/dist/types/ResizeController.d.ts +78 -0
- package/dist/types/RovingTabIndexMixin.d.ts +58 -0
- package/dist/types/ScrollObserverController.d.ts +61 -0
- package/dist/types/ScrollObserverController.test.d.ts +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/isFocusable.d.ts +10 -0
- package/dist/types/isFocusable.test.d.ts +1 -0
- package/dist/types/sliderUtils.d.ts +12 -0
- package/package.json +62 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
(function(z,$t){typeof exports=="object"&&typeof module<"u"?$t(exports,require("lit"),require("lit/directive.js"),require("lit/async-directive.js"),require("lit/decorators.js")):typeof define=="function"&&define.amd?define(["exports","lit","lit/directive.js","lit/async-directive.js","lit/decorators.js"],$t):(z=typeof globalThis<"u"?globalThis:z||self,$t(z["rc-common"]={},z.lit,z.directive_js,z.asyncDirective_js,z.decorators_js))})(this,(function(z,$t,Dn,de,Ls){"use strict";let As=0;class Ps{constructor(t,n){this._activeItem=null,this._activeIndex=-1,this._itemCounter=0,this._opts=n,this._instanceId=`rc-adc-${++As}`,t.addController(this)}hostConnected(){}hostDisconnected(){this.clear()}get activeItem(){return this._activeItem}get activeIndex(){return this._activeIndex}navigate(t){const n=this._opts.items();if(n.length===0)return;const i=this._opts.wrap??!0;let r=this._activeIndex<0?t>0?-1:n.length:this._activeIndex;const o=n.length;let l=0;do if(r+=t,i?r=(r%o+o)%o:r=Math.max(0,Math.min(o-1,r)),l++,!this._isSkipped(n[r]))break;while(l<o);this._setActive(n[r]??null,r)}navigateToFirst(){const t=this._opts.items(),n=t.findIndex(i=>!this._isSkipped(i));n>=0&&this._setActive(t[n],n)}navigateToLast(){const t=this._opts.items();let n=-1;for(let i=t.length-1;i>=0;i--)if(!this._isSkipped(t[i])){n=i;break}n>=0&&this._setActive(t[n],n)}navigateTo(t){const i=this._opts.items()[t];i&&!this._isSkipped(i)&&this._setActive(i,t)}navigateToItem(t){const i=this._opts.items().indexOf(t);i>=0&&!this._isSkipped(t)&&this._setActive(t,i)}clear(){this._activeItem?.removeAttribute("data-active"),this._activeItem=null,this._activeIndex=-1;const t=this._opts.host();t&&t.removeAttribute("aria-activedescendant")}_isSkipped(t){return!t||t.hidden||t.getAttribute("aria-disabled")==="true"?!0:this._opts.isSkipped?.(t)??!1}_setActive(t,n){this._activeItem?.removeAttribute("data-active"),this._activeItem=t,this._activeIndex=n;const i=this._opts.host();if(i){if(!t){i.removeAttribute("aria-activedescendant");return}t.id||(t.id=`${this._instanceId}-${++this._itemCounter}`),i.setAttribute("aria-activedescendant",t.id),t.setAttribute("data-active",""),t.scrollIntoView({block:"nearest"})}}}class Ts extends de.AsyncDirective{constructor(t){if(super(t),this._options={},t.type!==Dn.PartType.ELEMENT)throw new Error("The `keyNavigation` directive must be used on an element.")}get navigationAxis(){if(this._options.navigationAxis)return this._options.navigationAxis;switch(this._element?.deref()?.role){case"slider":case"tablist":case"toolbar":case"menubar":return this._element?.deref()?.ariaOrientation==="vertical"?"vertical":"horizontal";default:return this._element?.deref()?.ariaOrientation==="horizontal"?"horizontal":"vertical"}}_normalizeKey(t){switch(t){case"Up":return"ArrowUp";case"Down":return"ArrowDown";case"Left":return"ArrowLeft";case"Right":return"ArrowRight";default:return t}}_onKeydown(t){const n=this._normalizeKey(t.key),i=this.navigationAxis,r=this._element?.deref(),o=i==="horizontal"&&r!=null&&getComputedStyle(r).direction==="rtl",l=i==="horizontal"?o?"ArrowLeft":"ArrowRight":"ArrowDown",c=i==="horizontal"?o?"ArrowRight":"ArrowLeft":"ArrowUp",a=i==="horizontal"?"ArrowDown":"ArrowRight",s=i==="horizontal"?"ArrowUp":"ArrowLeft";let u;this._options.handleNavAxis!==!1&&(n===l?u="next":n===c?u="prev":n==="Home"?u="start":n==="End"&&(u="end")),!u&&this._options.handleOpenAxis&&(n===a?u="open-to-first":n===s&&(u="open-to-last")),u||(n==="Enter"?u=this._options.handleActivate?"activate":"toggle":n===" "&&this._options.handleActivate?u="activate":n==="Escape"&&this._options.handleEscape?u="escape":n==="Tab"&&this._options.useInteractionModeAttr&&this._element?.deref()?.setAttribute("data-interaction-mode","keyboard")),u!=null&&(this._callback(u),this._options.useInteractionModeAttr&&this._element?.deref()?.setAttribute("data-interaction-mode","keyboard"),t.stopPropagation(),t.preventDefault())}_onMouseClick(t){this._options.useInteractionModeAttr&&this._element?.deref()?.removeAttribute("data-interaction-mode")}_init(){const t=this._element?.deref();t!=null&&t instanceof HTMLElement&&(this._keyDownHandle=this._onKeydown.bind(this),this._mouseClickHandle=this._onMouseClick.bind(this),t.addEventListener("keydown",this._keyDownHandle),t.addEventListener("click",this._mouseClickHandle))}render(t,n){return $t.nothing}update(t,[n,i]){this.isConnected&&this._element?.deref()===void 0&&(this._element=new WeakRef(t.element),this._init()),this._callback=n.bind(t.options?.host??t.element),typeof i=="boolean"?this._options={useInteractionModeAttr:i}:this._options={useInteractionModeAttr:!0,...i}}disconnected(){const t=this._element?.deref();t!=null&&t instanceof HTMLElement&&(t.removeEventListener("keydown",this._keyDownHandle),t.removeEventListener("click",this._mouseClickHandle))}reconnected(){this._init()}}const Es=de.directive(Ts);class Os extends de.AsyncDirective{constructor(t){if(super(t),this._activePointerId=null,t.type!==Dn.PartType.ELEMENT)throw new Error("The `mouseMove` directive must be used on an element.");this._pointerDownHandle=this._onPointerDown.bind(this),this._pointerMoveHandle=this._onPointerMove.bind(this),this._pointerEndHandle=this._onPointerEnd.bind(this)}_onPointerDown(t){if(this._activePointerId!==null)return;t.preventDefault();const n=t.currentTarget;this._activePointerId=t.pointerId,this._capturePointer(n,t.pointerId),n.addEventListener("pointermove",this._pointerMoveHandle),n.addEventListener("pointerup",this._pointerEndHandle),n.addEventListener("pointercancel",this._pointerEndHandle),n.addEventListener("lostpointercapture",this._pointerEndHandle),n.focus()}_onPointerMove(t){t.pointerId===this._activePointerId&&(t.preventDefault(),this._callback(t))}_onPointerEnd(t){if(t.pointerId!==this._activePointerId)return;t.preventDefault();const n=t.currentTarget;this._releasePointer(n,t.pointerId),this._removePointerCycleListeners(n),this._activePointerId=null}_init(){const t=this._element?.deref();t&&(t.removeEventListener("pointerdown",this._pointerDownHandle),t.addEventListener("pointerdown",this._pointerDownHandle))}_removePointerCycleListeners(t){t.removeEventListener("pointermove",this._pointerMoveHandle),t.removeEventListener("pointerup",this._pointerEndHandle),t.removeEventListener("pointercancel",this._pointerEndHandle),t.removeEventListener("lostpointercapture",this._pointerEndHandle)}_capturePointer(t,n){try{t.setPointerCapture(n)}catch{}}_releasePointer(t,n){try{t.hasPointerCapture(n)&&t.releasePointerCapture(n)}catch{}}render(t){return $t.nothing}update(t,[n]){if(this._callback=n.bind(t.options?.host??t.element),!this.isConnected||!(t.element instanceof HTMLElement))return;const i=this._element?.deref();i!==t.element&&(i?.removeEventListener("pointerdown",this._pointerDownHandle),i&&this._removePointerCycleListeners(i),this._activePointerId=null,this._element=new WeakRef(t.element),this._init())}disconnected(){const t=this._element?.deref();t&&(t.removeEventListener("pointerdown",this._pointerDownHandle),this._removePointerCycleListeners(t),this._activePointerId=null)}reconnected(){this._init()}}const Ds=de.directive(Os);class Ms{constructor(t,n){this._dragging=!1,this._startX=0,this._startY=0,this._startLeft=0,this._startTop=0,this._opts={axis:"both",step:4,disabled:!1,handle:null,bounds:"viewport",...n},this._onPointerDown=this._handlePointerDown.bind(this),this._onPointerMove=this._handlePointerMove.bind(this),this._onPointerUp=this._handlePointerUp.bind(this),this._onPointerCancel=this._cancelDrag.bind(this),this._onLostPointerCapture=this._handleLostPointerCapture.bind(this),this._onKeyDown=this._handleKeyDown.bind(this),t.addController(this)}setOptions(t){const n=this._handle();Object.assign(this._opts,t);const i=this._handle();n!==i&&(this._detachFrom(n),this._attachTo(i))}hostConnected(){this._attachTo(this._handle())}hostDisconnected(){this._detachFrom(this._handle())}_handle(){return this._opts.handle??this._opts.target}_target(){return this._opts.target}_attachTo(t){t.addEventListener("pointerdown",this._onPointerDown),t.addEventListener("keydown",this._onKeyDown),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")}_detachFrom(t){t.removeEventListener("pointerdown",this._onPointerDown),t.removeEventListener("keydown",this._onKeyDown),t.removeEventListener("pointermove",this._onPointerMove),t.removeEventListener("pointerup",this._onPointerUp),t.removeEventListener("pointercancel",this._onPointerCancel),t.removeEventListener("lostpointercapture",this._onLostPointerCapture)}_handlePointerDown(t){if(this._opts.disabled||t.target.closest('button, [role="button"], a'))return;const n=this._target(),i=n.getBoundingClientRect();getComputedStyle(n).position==="static"&&(n.style.position="fixed"),n.style.translate="none",n.style.inset="auto",n.style.margin="0",n.style.left=`${i.left}px`,n.style.top=`${i.top}px`,this._startX=t.clientX,this._startY=t.clientY,this._startLeft=i.left,this._startTop=i.top,this._dragging=!0;const r=this._handle();r.setPointerCapture(t.pointerId),r.addEventListener("pointermove",this._onPointerMove),r.addEventListener("pointerup",this._onPointerUp),r.addEventListener("pointercancel",this._onPointerCancel),r.addEventListener("lostpointercapture",this._onLostPointerCapture),t.preventDefault()}_handlePointerMove(t){if(!this._dragging)return;const n=this._target(),{axis:i}=this._opts,[r,o,l,c]=this._boundsRect(),a=i!=="y"?Math.min(Math.max(this._startLeft+t.clientX-this._startX,r),l-n.offsetWidth):parseFloat(n.style.left)||0,s=i!=="x"?Math.min(Math.max(this._startTop+t.clientY-this._startY,o),c-n.offsetHeight):parseFloat(n.style.top)||0;n.style.left=`${a}px`,n.style.top=`${s}px`}_handlePointerUp(t){this._cancelDrag()}_handleLostPointerCapture(t){this._cancelDrag()}_cancelDrag(){if(!this._dragging)return;this._dragging=!1;const t=this._handle();t.removeEventListener("pointermove",this._onPointerMove),t.removeEventListener("pointerup",this._onPointerUp),t.removeEventListener("pointercancel",this._onPointerCancel),t.removeEventListener("lostpointercapture",this._onLostPointerCapture)}_handleKeyDown(t){if(this._opts.disabled||t.currentTarget!==t.target)return;const{axis:n}=this._opts,i=t.shiftKey?this._opts.step*10:this._opts.step;let r=0,o=0;switch(t.key){case"ArrowLeft":if(n==="y")return;r=-i;break;case"ArrowRight":if(n==="y")return;r=i;break;case"ArrowUp":if(n==="x")return;o=-i;break;case"ArrowDown":if(n==="x")return;o=i;break;default:return}const l=this._target();if(getComputedStyle(l).position==="static"){const d=l.getBoundingClientRect();l.style.position="fixed",l.style.translate="none",l.style.left=`${d.left}px`,l.style.top=`${d.top}px`}const[c,a,s,u]=this._boundsRect(),h=parseFloat(l.style.left)||0,f=parseFloat(l.style.top)||0;l.style.left=`${Math.min(Math.max(h+r,c),s-l.offsetWidth)}px`,l.style.top=`${Math.min(Math.max(f+o,a),u-l.offsetHeight)}px`,t.preventDefault(),t.stopPropagation()}_boundsRect(){const{bounds:t}=this._opts;if(!t||t==="viewport")return[0,0,window.innerWidth,window.innerHeight];if(t==="parent"){const i=this._opts.target.parentElement;if(!i)return[0,0,window.innerWidth,window.innerHeight];const r=i.getBoundingClientRect();return[r.left,r.top,r.right,r.bottom]}const n=t.getBoundingClientRect();return[n.left,n.top,n.right,n.bottom]}}class Is{constructor(t,n){this._resizing=null,this._startX=0,this._startY=0,this._startW=0,this._startH=0,this._startLeft=0,this._startTop=0,this._effectiveMinW=0,this._effectiveMinH=0,this._cornerBtn=null,this._opts={direction:"none",threshold:8,step:4,disabled:!1,minWidth:100,minHeight:60,handle:null,bounds:"viewport",...n},this._onPointerMove=this._handlePointerMove.bind(this),this._onPointerDown=this._handlePointerDown.bind(this),this._onPointerUp=this._handlePointerUp.bind(this),this._onPointerLeave=this._handlePointerLeave.bind(this),this._onKeyDown=this._handleKeyDown.bind(this),t.addController(this)}setOptions(t){Object.assign(this._opts,t)}hostConnected(){if(this._opts.direction==="none")return;const t=this._target();t.addEventListener("pointermove",this._onPointerMove),t.addEventListener("pointerdown",this._onPointerDown,{capture:!0}),t.addEventListener("pointerup",this._onPointerUp),t.addEventListener("pointerleave",this._onPointerLeave),this._injectCornerButton()}hostDisconnected(){const t=this._target();t.removeEventListener("pointermove",this._onPointerMove),t.removeEventListener("pointerdown",this._onPointerDown,{capture:!0}),t.removeEventListener("pointerup",this._onPointerUp),t.removeEventListener("pointerleave",this._onPointerLeave),this._removeCornerButton()}_target(){return this._opts.target}_injectCornerButton(){if(this._opts.handle)return;const t=this._target();getComputedStyle(t).position==="static"&&(t.style.position="relative");const n=document.createElement("button");n.setAttribute("data-rc-resize-corner",""),n.setAttribute("aria-label","Resize"),n.type="button",Object.assign(n.style,{position:"absolute",bottom:"0",right:"0",width:"12px",height:"12px",padding:"0",border:"none",background:"transparent",cursor:this._cornerCursor(),zIndex:"1"}),n.addEventListener("keydown",this._onKeyDown),t.appendChild(n),this._cornerBtn=n}_removeCornerButton(){this._cornerBtn&&(this._cornerBtn.removeEventListener("keydown",this._onKeyDown),this._cornerBtn.remove(),this._cornerBtn=null)}_cornerCursor(){switch(this._opts.direction){case"both":return"se-resize";case"horizontal":return"ew-resize";case"vertical":return"ns-resize";default:return"default"}}_edgeCursor(t){return{n:"n-resize",s:"s-resize",e:"e-resize",w:"w-resize",ne:"ne-resize",nw:"nw-resize",se:"se-resize",sw:"sw-resize"}[t]}_detectEdge(t){const{direction:n,threshold:i}=this._opts;if(n==="none")return null;const r=this._target().getBoundingClientRect(),o=t.clientX,l=t.clientY,c=o>=r.right-i&&o<=r.right+i,a=o>=r.left-i&&o<=r.left+i,s=l>=r.bottom-i&&l<=r.bottom+i,u=l>=r.top-i&&l<=r.top+i,h=o>=r.left&&o<=r.right,f=l>=r.top&&l<=r.bottom;if(n==="both"){if(c&&s)return"se";if(a&&s)return"sw";if(c&&u)return"ne";if(a&&u)return"nw";if(c&&f)return"e";if(a&&f)return"w";if(s&&h)return"s";if(u&&h)return"n"}if(n==="horizontal"){if(c&&f)return"e";if(a&&f)return"w"}if(n==="vertical"){if(s&&h)return"s";if(u&&h)return"n"}return null}_pinPosition(t){const n=t.getBoundingClientRect();return getComputedStyle(t).position==="static"&&(t.style.position="fixed"),t.style.translate="none",t.style.inset="auto",t.style.margin="0",t.style.boxSizing="border-box",t.style.left=`${n.left}px`,t.style.top=`${n.top}px`,t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,n}_handlePointerDown(t){if(this._opts.disabled)return;const n=this._detectEdge(t);if(!n)return;t.stopPropagation();const i=this._target(),r=this._pinPosition(i);this._startX=t.clientX,this._startY=t.clientY,this._startW=r.width,this._startH=r.height,this._startLeft=r.left,this._startTop=r.top,this._resizing=n;const o=getComputedStyle(i);this._effectiveMinW=Math.max(this._opts.minWidth,parseFloat(o.minWidth)||0),this._effectiveMinH=Math.max(this._opts.minHeight,parseFloat(o.minHeight)||0),i.setPointerCapture(t.pointerId),t.preventDefault()}_handlePointerMove(t){if(this._resizing){const r=this._target(),[o,l,c,a]=this._boundsRect(),{maxWidth:s,maxHeight:u}=this._opts,h=this._effectiveMinW,f=this._effectiveMinH,d=t.clientX-this._startX,p=t.clientY-this._startY,m=this._resizing;if(m==="e"||m==="se"||m==="ne"){const y=Math.min(s??1/0,c-this._startLeft);r.style.width=`${Math.min(Math.max(this._startW+d,h),y)}px`}if(m==="w"||m==="sw"||m==="nw"){const y=this._startLeft+this._startW,k=Math.min(Math.max(this._startLeft+d,o,s!==void 0?y-s:-1/0),y-h);r.style.left=`${k}px`,r.style.width=`${y-k}px`}if(m==="s"||m==="se"||m==="sw"){const y=Math.min(u??1/0,a-this._startTop);r.style.height=`${Math.min(Math.max(this._startH+p,f),y)}px`}if(m==="n"||m==="ne"||m==="nw"){const y=this._startTop+this._startH,k=Math.min(Math.max(this._startTop+p,l,u!==void 0?y-u:-1/0),y-f);r.style.top=`${k}px`,r.style.height=`${y-k}px`}return}if(this._opts.handle)return;const n=this._detectEdge(t),i=this._target();i.style.cursor=n?this._edgeCursor(n):""}_handlePointerUp(t){this._resizing=null}_handlePointerLeave(t){this._resizing||(this._target().style.cursor="")}_handleKeyDown(t){if(this._opts.disabled)return;const{direction:n}=this._opts,i=t.key==="ArrowRight"||t.key==="ArrowLeft",r=t.key==="ArrowDown"||t.key==="ArrowUp";if(i&&n==="vertical"||r&&n==="horizontal"||!i&&!r)return;t.preventDefault(),t.stopPropagation();const o=this._target(),l=this._pinPosition(o),c=t.shiftKey?this._opts.step*10:this._opts.step,[,,a,s]=this._boundsRect(),{maxWidth:u,maxHeight:h}=this._opts,f=getComputedStyle(o),d=Math.max(this._opts.minWidth,parseFloat(f.minWidth)||0),p=Math.max(this._opts.minHeight,parseFloat(f.minHeight)||0);if(t.key==="ArrowRight"){const m=Math.min(u??1/0,a-l.left);o.style.width=`${Math.min(Math.max(o.offsetWidth+c,d),m)}px`}if(t.key==="ArrowLeft"&&(o.style.width=`${Math.max(o.offsetWidth-c,d)}px`),t.key==="ArrowDown"){const m=Math.min(h??1/0,s-l.top);o.style.height=`${Math.min(Math.max(o.offsetHeight+c,p),m)}px`}t.key==="ArrowUp"&&(o.style.height=`${Math.max(o.offsetHeight-c,p)}px`)}_boundsRect(){const{bounds:t}=this._opts;if(!t||t==="viewport")return[0,0,window.innerWidth,window.innerHeight];if(t==="parent"){const i=this._opts.target.parentElement;if(!i)return[0,0,window.innerWidth,window.innerHeight];const r=i.getBoundingClientRect();return[r.left,r.top,r.right,r.bottom]}const n=t.getBoundingClientRect();return[n.left,n.top,n.right,n.bottom]}}function pe(e,t){const n=`${t}px`;switch(e){case"top":return`position-area: top; margin-bottom: ${n};`;case"top-start":return`bottom: anchor(top); top: auto; left: anchor(left); right: auto; margin-bottom: ${n};`;case"top-end":return`bottom: anchor(top); top: auto; left: auto; right: anchor(right); margin-bottom: ${n};`;case"bottom":return`position-area: bottom; margin-top: ${n};`;case"bottom-start":return`top: anchor(bottom); bottom: auto; left: anchor(left); right: auto; margin-top: ${n};`;case"bottom-end":return`top: anchor(bottom); bottom: auto; left: auto; right: anchor(right); margin-top: ${n};`;case"left":return`position-area: left; margin-right: ${n};`;case"left-start":return`top: anchor(top); bottom: auto; right: anchor(left); left: auto; margin-right: ${n};`;case"left-end":return`top: auto; bottom: anchor(bottom); right: anchor(left); left: auto; margin-right: ${n};`;case"right":return`position-area: right; margin-left: ${n};`;case"right-start":return`top: anchor(top); bottom: auto; left: anchor(right); right: auto; margin-left: ${n};`;case"right-end":return`top: auto; bottom: anchor(bottom); left: anchor(right); right: auto; margin-left: ${n};`}}const Mn={top:"bottom","top-start":"bottom-start","top-end":"bottom-end",bottom:"top","bottom-start":"top-start","bottom-end":"top-end",left:"right","left-start":"right-start","left-end":"right-end",right:"left","right-start":"left-start","right-end":"left-end"},Rs={top:"top","top-start":"top-end","top-end":"top-start",bottom:"bottom","bottom-start":"bottom-end","bottom-end":"bottom-start",left:"left","left-start":"left-end","left-end":"left-start",right:"right","right-start":"right-end","right-end":"right-start"},In=CSS.supports("position-try-fallbacks: flip-block");let Rn=null,Ne=null;function js(){return In?Promise.resolve(null):(Ne||(Ne=Promise.resolve().then(()=>Ep).then(e=>(Rn=e.default,Rn)).catch(()=>null)),Ne)}let Fs=0;class $s{constructor(t,n){this._styleEl=null,this._adoptedSheet=null,this._opts=n,this._uid=`rc-anchor-${++Fs}`,t.addController(this)}setOptions(t){Object.assign(this._opts,t),this._applyAndPolyfill()}update(){this._applyAndPolyfill()}hostConnected(){this._applyAndPolyfill()}hostDisconnected(){this._cleanup()}_anchor(){const{anchor:t}=this._opts;return typeof t=="function"?t():t}_floating(){const{floating:t}=this._opts;return typeof t=="function"?t():t}_shadowHost(){const{shadowHost:t}=this._opts;return typeof t=="function"?t():t??null}_applyAndPolyfill(){this._apply(),In||this._applyPolyfillOrFallback()}async _applyPolyfillOrFallback(){const t=await js(),n=this._shadowHost();t?await t({roots:n?[n]:void 0,useAnimationFrame:!1}):this._positionFallback()}_apply(){if(this._opts.disabled){this._cleanup();return}const t=this._anchor(),n=this._floating();if(!t||!n)return;const i=this._opts.placement??"bottom-start",r=this._opts.offset??4,o=this._opts.flip??!0,l=`--${this._uid}`,c=this._uid;t.style.setProperty("anchor-name",l),n.setAttribute("data-rc-anchor",c);const a=Mn[i],s=Rs[i],u=Mn[s],h=o?`
|
|
2
|
+
@position-try --${c}-end { ${pe(s,r)} }
|
|
3
|
+
@position-try --${c}-flip { ${pe(a,r)} }
|
|
4
|
+
@position-try --${c}-both { ${pe(u,r)} }
|
|
5
|
+
`:"",f=o?`position-try-fallbacks: --${c}-end, --${c}-flip, --${c}-both;`:"",d=`
|
|
6
|
+
${h}
|
|
7
|
+
[data-rc-anchor="${c}"] {
|
|
8
|
+
position: fixed;
|
|
9
|
+
position-anchor: ${l};
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
min-width: anchor-size(width);
|
|
12
|
+
${pe(i,r)}
|
|
13
|
+
${f}
|
|
14
|
+
}
|
|
15
|
+
`;this._injectStyles(d)}_injectStyles(t){const n=this._shadowHost();n?.shadowRoot?(this._adoptedSheet||(this._adoptedSheet=new CSSStyleSheet,n.shadowRoot.adoptedStyleSheets=[...n.shadowRoot.adoptedStyleSheets,this._adoptedSheet]),this._adoptedSheet.replaceSync(t)):(this._styleEl?.remove(),this._styleEl=document.createElement("style"),this._styleEl.setAttribute("data-rc-anchor-style",this._uid),this._styleEl.textContent=t,document.head.appendChild(this._styleEl))}_positionFallback(){const t=this._anchor(),n=this._floating();if(!t||!n)return;const i=this._opts.placement??"bottom-start",r=this._opts.offset??4,o=t.getBoundingClientRect(),l=window.innerWidth,c=window.innerHeight;n.style.position="fixed",n.style.boxSizing="border-box",n.style.minWidth=`${o.width}px`;const a=i.startsWith("bottom")||i==="bottom",s=c-o.bottom;a&&s<120&&o.top>s?(n.style.top="",n.style.bottom=`${c-o.top+r}px`):(n.style.bottom="",n.style.top=`${o.bottom+r}px`);const h=i.endsWith("-end"),f=n.offsetWidth||parseFloat(getComputedStyle(n).minWidth)||0;let d=h?o.right-f:o.left;d+f>l-4&&(d=o.right-f),d=Math.max(4,Math.min(d,l-f-4)),n.style.left=`${d}px`}_cleanup(){const t=this._anchor(),n=this._floating();t&&t.style.removeProperty("anchor-name"),n&&n.removeAttribute("data-rc-anchor"),this._styleEl?.remove(),this._styleEl=null;const i=this._shadowHost();i?.shadowRoot&&this._adoptedSheet&&(i.shadowRoot.adoptedStyleSheets=i.shadowRoot.adoptedStyleSheets.filter(r=>r!==this._adoptedSheet),this._adoptedSheet=null)}}class zs{constructor(t,n){this._attached=null,this._scrolled=!1,this._onScroll=()=>this._evaluate(),this._host=t,this._opts=n,t.addController(this)}get scrolled(){return this._scrolled}setOptions(t){this._detach(),Object.assign(this._opts,t),this._attach()}hostConnected(){this._attach()}hostDisconnected(){this._detach()}_resolveTarget(){const{target:t}=this._opts;return typeof t=="function"?t():t??null}_attach(){if(this._opts.disabled||this._attached)return;const t=this._resolveTarget();t&&(this._attached=t,t.addEventListener("scroll",this._onScroll,{passive:!0}),this._evaluate())}_detach(){this._attached?.removeEventListener("scroll",this._onScroll),this._attached=null,this._lastScrollTop=void 0}_scrollTop(){const t=this._attached;return t instanceof Element?t.scrollTop:t instanceof Document?t.scrollingElement?.scrollTop??0:t?.scrollY??0}_evaluate(){if(!this._attached)return;const t=this._scrollTop(),n=t-(this._lastScrollTop??t);this._lastScrollTop=t,this._opts.onScroll?.(t,n);const i=t>(this._opts.threshold??4);i!==this._scrolled&&(this._scrolled=i,this._opts.onChange?.(i,t),this._host.requestUpdate())}}function jn(e){return e==null||e.hasAttribute("disabled")?!1:!!((e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e.hasAttribute("tabindex")||e.shadowRoot?.delegatesFocus===!0)}var Ns=Object.defineProperty,Ws=(e,t,n,i)=>{for(var r=void 0,o=e.length-1,l;o>=0;o--)(l=e[o])&&(r=l(t,n,r)||r);return r&&Ns(t,n,r),r};function Hs(e){class t extends e{constructor(){super(...arguments),this._items=[]}get items(){return this._items.map(i=>i.deref()).filter(i=>jn(i))}get firstItem(){return this.items.at(0)}get lastItem(){return this.items.at(-1)}get nextItem(){const i=this._lastFocused?this.items.indexOf(this._lastFocused):0;return this.items.at((i+1)%this.items.length)}get previousItem(){const i=this._lastFocused?this.items.indexOf(this._lastFocused):0;return this.items.at((i-1)%this.items.length)}focusItem(i){i?.focus()}focusItemAt(i){this.focusItem(this.items.at(i))}focusFirst(){this.focusItem(this.firstItem)}focusLast(){this.focusItem(this.lastItem)}_collectItems(i){return i.assignedElements()}_handleItemFocus(i){const r=i.composedPath().find(o=>this.items.includes(o));r!=null&&(this._lastFocused=r,this.items.forEach(o=>o.setAttribute("tabindex","-1")),r.setAttribute("tabindex","0"))}_onSlotChange(i){const r=this._items;this._items=this._collectItems(i.currentTarget).map(o=>new WeakRef(o)),queueMicrotask(()=>{this.isConnected&&(r.forEach(o=>o.deref()?.removeAttribute("tabindex")),this._initItems())})}_initItems(){this._items.forEach(r=>r.deref()?.setAttribute("tabindex","-1"));const i=this.items[0];i&&i.setAttribute("tabindex","0")}}return Ws([Ls.state()],t.prototype,"_lastFocused"),t}function Bs(e,t,n,i){const r=Math.min(Math.max(e,t),n);if(i<=0)return r;const o=Math.round((r-t)/i)*i+t;return Math.min(Math.max(o,t),n)}function Us(e,t,n){return n===t?0:Math.min(Math.max((e-t)/(n-t),0),1)}var Vs=Object.defineProperty,qs=Object.defineProperties,Qs=Object.getOwnPropertyDescriptors,Fn=Object.getOwnPropertySymbols,Xs=Object.prototype.hasOwnProperty,Ys=Object.prototype.propertyIsEnumerable,$n=(e,t,n)=>t in e?Vs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))Xs.call(t,n)&&$n(e,n,t[n]);if(Fn)for(var n of Fn(t))Ys.call(t,n)&&$n(e,n,t[n]);return e},J=(e,t)=>qs(e,Qs(t)),T=(e,t,n)=>new Promise((i,r)=>{var o=a=>{try{c(n.next(a))}catch(s){r(s)}},l=a=>{try{c(n.throw(a))}catch(s){r(s)}},c=a=>a.done?i(a.value):Promise.resolve(a.value).then(o,l);c((n=n.apply(e,t)).next())});const We=Math.min,zt=Math.max,me=Math.round,ge=Math.floor,mt=e=>({x:e,y:e});function Gs(e,t){return typeof e=="function"?e(t):e}function Ks(e){return U({top:0,right:0,bottom:0,left:0},e)}function Js(e){return typeof e!="number"?Ks(e):{top:e,right:e,bottom:e,left:e}}function ye(e){const{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function Zs(e,t){return T(this,null,function*(){var n;t===void 0&&(t={});const{x:i,y:r,platform:o,rects:l,elements:c,strategy:a}=e,{boundary:s="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:d=0}=Gs(t,e),p=Js(d),m=c[f?h==="floating"?"reference":"floating":h],y=ye(yield o.getClippingRect({element:(n=yield o.isElement==null?void 0:o.isElement(m))==null||n?m:m.contextElement||(yield o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:s,rootBoundary:u,strategy:a})),k=h==="floating"?{x:i,y:r,width:l.floating.width,height:l.floating.height}:l.reference,x=yield o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating),w=(yield o.isElement==null?void 0:o.isElement(x))?(yield o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},A=ye(o.convertOffsetParentRelativeRectToViewportRelativeRect?yield o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:k,offsetParent:x,strategy:a}):k);return{top:(y.top-A.top+p.top)/w.y,bottom:(A.bottom-y.bottom+p.bottom)/w.y,left:(y.left-A.left+p.left)/w.x,right:(A.right-y.right+p.right)/w.x}})}function ke(){return typeof window<"u"}function Nt(e){return zn(e)?(e.nodeName||"").toLowerCase():"#document"}function et(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gt(e){var t;return(t=(zn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zn(e){return ke()?e instanceof Node||e instanceof et(e).Node:!1}function at(e){return ke()?e instanceof Element||e instanceof et(e).Element:!1}function yt(e){return ke()?e instanceof HTMLElement||e instanceof et(e).HTMLElement:!1}function Nn(e){return!ke()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof et(e).ShadowRoot}const tl=new Set(["inline","contents"]);function ne(e){const{overflow:t,overflowX:n,overflowY:i,display:r}=ct(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!tl.has(r)}const el=new Set(["table","td","th"]);function nl(e){return el.has(Nt(e))}const il=[":popover-open",":modal"];function be(e){return il.some(t=>{try{return e.matches(t)}catch{return!1}})}const rl=["transform","translate","scale","rotate","perspective"],ol=["transform","translate","scale","rotate","perspective","filter"],sl=["paint","layout","strict","content"];function He(e){const t=Be(),n=at(e)?ct(e):e;return rl.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ol.some(i=>(n.willChange||"").includes(i))||sl.some(i=>(n.contain||"").includes(i))}function ll(e){let t=Ct(e);for(;yt(t)&&!Wt(t);){if(He(t))return t;if(be(t))return null;t=Ct(t)}return null}function Be(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const al=new Set(["html","body","#document"]);function Wt(e){return al.has(Nt(e))}function ct(e){return et(e).getComputedStyle(e)}function Se(e){return at(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ct(e){if(Nt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Nn(e)&&e.host||gt(e);return Nn(t)?t.host:t}function Wn(e){const t=Ct(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:yt(t)&&ne(t)?t:Wn(t)}function ie(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Wn(e),o=r===((i=e.ownerDocument)==null?void 0:i.body),l=et(r);if(o){const c=Ue(l);return t.concat(l,l.visualViewport||[],ne(r)?r:[],c&&n?ie(c):[])}return t.concat(r,ie(r,[],n))}function Ue(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Hn(e){const t=ct(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=yt(e),o=r?e.offsetWidth:n,l=r?e.offsetHeight:i,c=me(n)!==o||me(i)!==l;return c&&(n=o,i=l),{width:n,height:i,$:c}}function Ve(e){return at(e)?e:e.contextElement}function Ht(e){const t=Ve(e);if(!yt(t))return mt(1);const n=t.getBoundingClientRect(),{width:i,height:r,$:o}=Hn(t);let l=(o?me(n.width):n.width)/i,c=(o?me(n.height):n.height)/r;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const cl=mt(0);function Bn(e){const t=et(e);return!Be()||!t.visualViewport?cl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ul(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==et(e)?!1:t}function Tt(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=Ve(e);let l=mt(1);t&&(i?at(i)&&(l=Ht(i)):l=Ht(e));const c=ul(o,n,i)?Bn(o):mt(0);let a=(r.left+c.x)/l.x,s=(r.top+c.y)/l.y,u=r.width/l.x,h=r.height/l.y;if(o){const f=et(o),d=i&&at(i)?et(i):i;let p=f,m=Ue(p);for(;m&&i&&d!==p;){const y=Ht(m),k=m.getBoundingClientRect(),x=ct(m),w=k.left+(m.clientLeft+parseFloat(x.paddingLeft))*y.x,A=k.top+(m.clientTop+parseFloat(x.paddingTop))*y.y;a*=y.x,s*=y.y,u*=y.x,h*=y.y,a+=w,s+=A,p=et(m),m=Ue(p)}}return ye({width:u,height:h,x:a,y:s})}function _e(e,t){const n=Se(e).scrollLeft;return t?t.left+n:Tt(gt(e)).left+n}function Un(e,t){const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-_e(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function hl(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e;const o=r==="fixed",l=gt(i),c=t?be(t.floating):!1;if(i===l||c&&o)return n;let a={scrollLeft:0,scrollTop:0},s=mt(1);const u=mt(0),h=yt(i);if((h||!h&&!o)&&((Nt(i)!=="body"||ne(l))&&(a=Se(i)),yt(i))){const d=Tt(i);s=Ht(i),u.x=d.x+i.clientLeft,u.y=d.y+i.clientTop}const f=l&&!h&&!o?Un(l,a):mt(0);return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-a.scrollLeft*s.x+u.x+f.x,y:n.y*s.y-a.scrollTop*s.y+u.y+f.y}}function fl(e){return Array.from(e.getClientRects())}function dl(e){const t=gt(e),n=Se(e),i=e.ownerDocument.body,r=zt(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=zt(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let l=-n.scrollLeft+_e(e);const c=-n.scrollTop;return ct(i).direction==="rtl"&&(l+=zt(t.clientWidth,i.clientWidth)-r),{width:r,height:o,x:l,y:c}}const Vn=25;function pl(e,t){const n=et(e),i=gt(e),r=n.visualViewport;let o=i.clientWidth,l=i.clientHeight,c=0,a=0;if(r){o=r.width,l=r.height;const u=Be();(!u||u&&t==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}const s=_e(i);if(s<=0){const u=i.ownerDocument,h=u.body,f=getComputedStyle(h),d=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(i.clientWidth-h.clientWidth-d);p<=Vn&&(o-=p)}else s<=Vn&&(o+=s);return{width:o,height:l,x:c,y:a}}const ml=new Set(["absolute","fixed"]);function gl(e,t){const n=Tt(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,o=yt(e)?Ht(e):mt(1),l=e.clientWidth*o.x,c=e.clientHeight*o.y,a=r*o.x,s=i*o.y;return{width:l,height:c,x:a,y:s}}function qn(e,t,n){let i;if(t==="viewport")i=pl(e,n);else if(t==="document")i=dl(gt(e));else if(at(t))i=gl(t,n);else{const r=Bn(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return ye(i)}function Qn(e,t){const n=Ct(e);return n===t||!at(n)||Wt(n)?!1:ct(n).position==="fixed"||Qn(n,t)}function yl(e,t){const n=t.get(e);if(n)return n;let i=ie(e,[],!1).filter(c=>at(c)&&Nt(c)!=="body"),r=null;const o=ct(e).position==="fixed";let l=o?Ct(e):e;for(;at(l)&&!Wt(l);){const c=ct(l),a=He(l);!a&&c.position==="fixed"&&(r=null),(o?!a&&!r:!a&&c.position==="static"&&r&&ml.has(r.position)||ne(l)&&!a&&Qn(e,l))?i=i.filter(s=>s!==l):r=c,l=Ct(l)}return t.set(e,i),i}function kl(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e;const o=[...n==="clippingAncestors"?be(t)?[]:yl(t,this._c):[].concat(n),i],l=o[0],c=o.reduce((a,s)=>{const u=qn(t,s,r);return a.top=zt(u.top,a.top),a.right=We(u.right,a.right),a.bottom=We(u.bottom,a.bottom),a.left=zt(u.left,a.left),a},qn(t,l,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function bl(e){const{width:t,height:n}=Hn(e);return{width:t,height:n}}function Sl(e,t,n){const i=yt(t),r=gt(t),o=n==="fixed",l=Tt(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const a=mt(0);function s(){a.x=_e(r)}if(i||!i&&!o)if((Nt(t)!=="body"||ne(r))&&(c=Se(t)),i){const d=Tt(t,!0,o,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else r&&s();o&&!i&&r&&s();const u=r&&!i&&!o?Un(r,c):mt(0),h=l.left+c.scrollLeft-a.x-u.x,f=l.top+c.scrollTop-a.y-u.y;return{x:h,y:f,width:l.width,height:l.height}}function qe(e){return ct(e).position==="static"}function Xn(e,t){if(!yt(e)||ct(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return gt(e)===n&&(n=n.ownerDocument.body),n}function Yn(e,t){const n=et(e);if(be(e))return n;if(!yt(e)){let r=Ct(e);for(;r&&!Wt(r);){if(at(r)&&!qe(r))return r;r=Ct(r)}return n}let i=Xn(e,t);for(;i&&nl(i)&&qe(i);)i=Xn(i,t);return i&&Wt(i)&&qe(i)&&!He(i)?n:i||ll(e)||n}const _l=function(e){return T(this,null,function*(){const t=this.getOffsetParent||Yn,n=this.getDimensions,i=yield n(e.floating);return{reference:Sl(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};function vl(e){return ct(e).direction==="rtl"}const nt={convertOffsetParentRelativeRectToViewportRelativeRect:hl,getDocumentElement:gt,getClippingRect:kl,getOffsetParent:Yn,getElementRects:_l,getClientRects:fl,getDimensions:bl,getScale:Ht,isElement:at,isRTL:vl};function Gn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wl(e,t){let n=null,i;const r=gt(e);function o(){var c;clearTimeout(i),(c=n)==null||c.disconnect(),n=null}function l(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),o();const s=e.getBoundingClientRect(),{left:u,top:h,width:f,height:d}=s;if(c||t(),!f||!d)return;const p=ge(h),m=ge(r.clientWidth-(u+f)),y=ge(r.clientHeight-(h+d)),k=ge(u),x={rootMargin:-p+"px "+-m+"px "+-y+"px "+-k+"px",threshold:zt(0,We(1,a))||1};let w=!0;function A(pt){const _=pt[0].intersectionRatio;if(_!==a){if(!w)return l();_?l(!1,_):i=setTimeout(()=>{l(!1,1e-7)},1e3)}_===1&&!Gn(s,e.getBoundingClientRect())&&l(),w=!1}try{n=new IntersectionObserver(A,J(U({},x),{root:r.ownerDocument}))}catch{n=new IntersectionObserver(A,x)}n.observe(e)}return l(!0),o}function Qe(e,t,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=i,s=Ve(e),u=r||o?[...s?ie(s):[],...ie(t)]:[];u.forEach(k=>{r&&k.addEventListener("scroll",n,{passive:!0}),o&&k.addEventListener("resize",n)});const h=s&&c?wl(s,n):null;let f=-1,d=null;l&&(d=new ResizeObserver(k=>{let[x]=k;x&&x.target===s&&d&&(d.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=d)==null||w.observe(t)})),n()}),s&&!a&&d.observe(s),d.observe(t));let p,m=a?Tt(e):null;a&&y();function y(){const k=Tt(e);m&&!Gn(m,k)&&n(),m=k,p=requestAnimationFrame(y)}return n(),()=>{var k;u.forEach(x=>{r&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),h?.(),(k=d)==null||k.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const Cl=Zs,{hasOwnProperty:Xe}=Object.prototype,re=function(){};function Kn(e){return typeof e=="function"?e:re}function Jn(e,t){return function(n,i,r){n.type===t&&e.call(this,n,i,r)}}function xl(e,t){const n=t.structure,i=[];for(const r in n){if(Xe.call(n,r)===!1)continue;let o=n[r];const l={name:r,type:!1,nullable:!1};Array.isArray(o)||(o=[o]);for(const c of o)c===null?l.nullable=!0:typeof c=="string"?l.type="node":Array.isArray(c)&&(l.type="list");l.type&&i.push(l)}return i.length?{context:t.walkContext,fields:i}:null}function Ll(e){const t={};for(const n in e.node)if(Xe.call(e.node,n)){const i=e.node[n];if(!i.structure)throw new Error("Missed `structure` field in `"+n+"` node type definition");t[n]=xl(n,i)}return t}function Zn(e,t){const n=e.fields.slice(),i=e.context,r=typeof i=="string";return t&&n.reverse(),function(o,l,c,a){let s;r&&(s=l[i],l[i]=o);for(const u of n){const h=o[u.name];if(!u.nullable||h){if(u.type==="list"){if(t?h.reduceRight(a,!1):h.reduce(a,!1))return!0}else if(c(h))return!0}}r&&(l[i]=s)}}function ti({StyleSheet:e,Atrule:t,Rule:n,Block:i,DeclarationList:r}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:n,Block:i},Rule:{StyleSheet:e,Atrule:t,Rule:n,Block:i},Declaration:{StyleSheet:e,Atrule:t,Rule:n,Block:i,DeclarationList:r}}}function Al(e){const t=Ll(e),n={},i={},r=Symbol("break-walk"),o=Symbol("skip-node");for(const s in t)Xe.call(t,s)&&t[s]!==null&&(n[s]=Zn(t[s],!1),i[s]=Zn(t[s],!0));const l=ti(n),c=ti(i),a=function(s,u){function h(k,x,w){const A=f.call(y,k,x,w);return A===r?!0:A===o?!1:!!(p.hasOwnProperty(k.type)&&p[k.type](k,y,h,m)||d.call(y,k,x,w)===r)}let f=re,d=re,p=n,m=(k,x,w,A)=>k||h(x,w,A);const y={break:r,skip:o,root:s,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof u=="function")f=u;else if(u&&(f=Kn(u.enter),d=Kn(u.leave),u.reverse&&(p=i),u.visit)){if(l.hasOwnProperty(u.visit))p=u.reverse?c[u.visit]:l[u.visit];else if(!t.hasOwnProperty(u.visit))throw new Error("Bad value `"+u.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(", ")+")");f=Jn(f,u.visit),d=Jn(d,u.visit)}if(f===re&&d===re)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");h(s)};return a.break=r,a.skip=o,a.find=function(s,u){let h=null;return a(s,function(f,d,p){if(u.call(this,f,d,p))return h=f,r}),h},a.findLast=function(s,u){let h=null;return a(s,{reverse:!0,enter(f,d,p){if(u.call(this,f,d,p))return h=f,r}}),h},a.findAll=function(s,u){const h=[];return a(s,function(f,d,p){u.call(this,f,d,p)&&h.push(f)}),h},a}const xt=0,g=1,v=2,B=3,D=4,wt=5,Pl=6,Q=7,ut=8,L=9,S=10,$=11,C=12,N=13,ve=14,it=15,X=16,Z=17,ht=18,Bt=19,oe=20,E=21,b=22,ft=23,Ut=24,Y=25,Tl=0;function rt(e){return e>=48&&e<=57}function Vt(e){return rt(e)||e>=65&&e<=70||e>=97&&e<=102}function Ye(e){return e>=65&&e<=90}function El(e){return e>=97&&e<=122}function Ol(e){return Ye(e)||El(e)}function Dl(e){return e>=128}function we(e){return Ol(e)||Dl(e)||e===95}function ei(e){return we(e)||rt(e)||e===45}function Ml(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Ce(e){return e===10||e===13||e===12}function Et(e){return Ce(e)||e===32||e===9}function kt(e,t){return!(e!==92||Ce(t)||t===Tl)}function Ge(e,t,n){return e===45?we(t)||t===45||kt(t,n):we(e)?!0:e===92?kt(e,t):!1}function Ke(e,t,n){return e===43||e===45?rt(t)?2:t===46&&rt(n)?3:0:e===46?rt(t)?2:0:rt(e)?1:0}function ni(e){return e===65279||e===65534?1:0}const Je=new Array(128),Il=128,xe=130,ii=131,Ze=132,ri=133;for(let e=0;e<Je.length;e++)Je[e]=Et(e)&&xe||rt(e)&&ii||we(e)&&Ze||Ml(e)&&ri||e||Il;function tn(e){return e<128?Je[e]:Ze}function qt(e,t){return t<e.length?e.charCodeAt(t):0}function en(e,t,n){return n===13&&qt(e,t+1)===10?2:1}function oi(e,t,n){let i=e.charCodeAt(t);return Ye(i)&&(i=i|32),i===n}function Le(e,t,n,i){if(n-t!==i.length||t<0||n>e.length)return!1;for(let r=t;r<n;r++){const o=i.charCodeAt(r-t);let l=e.charCodeAt(r);if(Ye(l)&&(l=l|32),l!==o)return!1}return!0}function Rl(e,t){for(;t>=0&&Et(e.charCodeAt(t));t--);return t+1}function Ae(e,t){for(;t<e.length&&Et(e.charCodeAt(t));t++);return t}function nn(e,t){for(;t<e.length&&rt(e.charCodeAt(t));t++);return t}function Qt(e,t){if(t+=2,Vt(qt(e,t-1))){for(const i=Math.min(e.length,t+5);t<i&&Vt(qt(e,t));t++);const n=qt(e,t);Et(n)&&(t+=en(e,t,n))}return t}function Pe(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(!ei(n)){if(kt(n,qt(e,t+1))){t=Qt(e,t)-1;continue}break}}return t}function si(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),rt(n)&&(t=nn(e,t+1),n=e.charCodeAt(t)),n===46&&rt(e.charCodeAt(t+1))&&(t+=2,t=nn(e,t)),oi(e,t,101)){let i=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(i=1,n=e.charCodeAt(t+2)),rt(n)&&(t=nn(e,t+1+i+1))}return t}function rn(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(n===41){t++;break}kt(n,qt(e,t+1))&&(t=Qt(e,t))}return t}function li(e){if(e.length===1&&!Vt(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}const ai=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token","comment-token"],jl=16*1024;function Te(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,jl)):e}const ci=10,Fl=12,ui=13;function hi(e){const t=e.source,n=t.length,i=t.length>0?ni(t.charCodeAt(0)):0,r=Te(e.lines,n),o=Te(e.columns,n);let l=e.startLine,c=e.startColumn;for(let a=i;a<n;a++){const s=t.charCodeAt(a);r[a]=l,o[a]=c++,(s===ci||s===ui||s===Fl)&&(s===ui&&a+1<n&&t.charCodeAt(a+1)===ci&&(a++,r[a]=l,o[a]=c),l++,c=1)}r[n]=l,o[n]=c,e.lines=r,e.columns=o,e.computed=!0}class $l{constructor(t,n,i,r){this.setSource(t,n,i,r),this.lines=null,this.columns=null}setSource(t="",n=0,i=1,r=1){this.source=t,this.startOffset=n,this.startLine=i,this.startColumn=r,this.computed=!1}getLocation(t,n){return this.computed||hi(this),{source:n,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,n,i){return this.computed||hi(this),{source:i,start:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]},end:{offset:this.startOffset+n,line:this.lines[n],column:this.columns[n]}}}}const bt=16777215,St=24,Ot=new Uint8Array(32);Ot[v]=b,Ot[E]=b,Ot[Bt]=oe,Ot[ft]=Ut;function fi(e){return Ot[e]!==0}class zl{constructor(t,n){this.setSource(t,n)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(t="",n=()=>{}){t=String(t||"");const i=t.length,r=Te(this.offsetAndType,t.length+1),o=Te(this.balance,t.length+1);let l=0,c=-1,a=0,s=t.length;this.offsetAndType=null,this.balance=null,o.fill(0),n(t,(u,h,f)=>{const d=l++;if(r[d]=u<<St|f,c===-1&&(c=h),o[d]=s,u===a){const p=o[s];o[s]=d,s=p,a=Ot[r[p]>>St]}else fi(u)&&(s=d,a=Ot[u])}),r[l]=xt<<St|i,o[l]=l;for(let u=0;u<l;u++){const h=o[u];if(h<=u){const f=o[h];f!==u&&(o[u]=f)}else h>l&&(o[u]=l)}this.source=t,this.firstCharOffset=c===-1?0:c,this.tokenCount=l,this.offsetAndType=r,this.balance=o,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t]>>St:xt}lookupTypeNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){const i=this.offsetAndType[n]>>St;if(i!==N&&i!==Y&&t--===0)return i}return xt}lookupOffset(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t-1]&bt:this.source.length}lookupOffsetNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){const i=this.offsetAndType[n]>>St;if(i!==N&&i!==Y&&t--===0)return n-this.tokenIndex}return xt}lookupValue(t,n){return t+=this.tokenIndex,t<this.tokenCount?Le(this.source,this.offsetAndType[t-1]&bt,this.offsetAndType[t]&bt,n):!1}getTokenStart(t){return t===this.tokenIndex?this.tokenStart:t>0?t<this.tokenCount?this.offsetAndType[t-1]&bt:this.offsetAndType[this.tokenCount]&bt:this.firstCharOffset}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBalanceEdge(t){return this.balance[this.tokenIndex]<t}isDelim(t,n){return n?this.lookupType(n)===L&&this.source.charCodeAt(this.lookupOffset(n))===t:this.tokenType===L&&this.source.charCodeAt(this.tokenStart)===t}skip(t){let n=this.tokenIndex+t;n<this.tokenCount?(this.tokenIndex=n,this.tokenStart=this.offsetAndType[n-1]&bt,n=this.offsetAndType[n],this.tokenType=n>>St,this.tokenEnd=n&bt):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.tokenEnd,t=this.offsetAndType[t],this.tokenType=t>>St,this.tokenEnd=t&bt):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=xt,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===N||this.tokenType===Y;)this.next()}skipUntilBalanced(t,n){let i=t,r=0,o=0;t:for(;i<this.tokenCount;i++){if(r=this.balance[i],r<t)break t;switch(o=i>0?this.offsetAndType[i-1]&bt:this.firstCharOffset,n(this.source.charCodeAt(o))){case 1:break t;case 2:i++;break t;default:fi(this.offsetAndType[i]>>St)&&(i=r)}}this.skip(i-this.tokenIndex)}forEachToken(t){for(let n=0,i=this.firstCharOffset;n<this.tokenCount;n++){const r=i,o=this.offsetAndType[n],l=o&bt,c=o>>St;i=l,t(c,r,l,n)}}dump(){const t=new Array(this.tokenCount);return this.forEachToken((n,i,r,o)=>{t[o]={idx:o,type:ai[n],chunk:this.source.substring(i,r),balance:this.balance[o]}}),t}}function di(e,t){function n(h){return h<c?e.charCodeAt(h):0}function i(){if(s=si(e,s),Ge(n(s),n(s+1),n(s+2))){u=C,s=Pe(e,s);return}if(n(s)===37){u=$,s++;return}u=S}function r(){const h=s;if(s=Pe(e,s),Le(e,h,s,"url")&&n(s)===40){if(s=Ae(e,s+1),n(s)===34||n(s)===39){u=v,s=h+4;return}l();return}if(n(s)===40){u=v,s++;return}u=g}function o(h){for(h||(h=n(s++)),u=wt;s<e.length;s++){const f=e.charCodeAt(s);switch(tn(f)){case h:s++;return;case xe:if(Ce(f)){s+=en(e,s,f),u=Pl;return}break;case 92:if(s===e.length-1)break;const d=n(s+1);Ce(d)?s+=en(e,s+1,d):kt(f,d)&&(s=Qt(e,s)-1);break}}}function l(){for(u=Q,s=Ae(e,s);s<e.length;s++){const h=e.charCodeAt(s);switch(tn(h)){case 41:s++;return;case xe:if(s=Ae(e,s),n(s)===41||s>=e.length){s<e.length&&s++;return}s=rn(e,s),u=ut;return;case 34:case 39:case 40:case ri:s=rn(e,s),u=ut;return;case 92:if(kt(h,n(s+1))){s=Qt(e,s)-1;break}s=rn(e,s),u=ut;return}}}e=String(e||"");const c=e.length;let a=ni(n(0)),s=a,u;for(;s<c;){const h=e.charCodeAt(s);switch(tn(h)){case xe:u=N,s=Ae(e,s+1);break;case 34:o();break;case 35:ei(n(s+1))||kt(n(s+1),n(s+2))?(u=D,s=Pe(e,s+1)):(u=L,s++);break;case 39:o();break;case 40:u=E,s++;break;case 41:u=b,s++;break;case 43:Ke(h,n(s+1),n(s+2))?i():(u=L,s++);break;case 44:u=ht,s++;break;case 45:Ke(h,n(s+1),n(s+2))?i():n(s+1)===45&&n(s+2)===62?(u=it,s=s+3):Ge(h,n(s+1),n(s+2))?r():(u=L,s++);break;case 46:Ke(h,n(s+1),n(s+2))?i():(u=L,s++);break;case 47:n(s+1)===42?(u=Y,s=e.indexOf("*/",s+2),s=s===-1?e.length:s+2):(u=L,s++);break;case 58:u=X,s++;break;case 59:u=Z,s++;break;case 60:n(s+1)===33&&n(s+2)===45&&n(s+3)===45?(u=ve,s=s+4):(u=L,s++);break;case 64:Ge(n(s+1),n(s+2),n(s+3))?(u=B,s=Pe(e,s+1)):(u=L,s++);break;case 91:u=Bt,s++;break;case 92:kt(h,n(s+1))?r():(u=L,s++);break;case 93:u=oe,s++;break;case 123:u=ft,s++;break;case 125:u=Ut,s++;break;case ii:i();break;case Ze:r();break;default:u=L,s++}t(u,a,a=s)}}const _t=43,ot=45,Ee=110,Dt=!0,Nl=!1;function Oe(e,t){let n=this.tokenStart+e;const i=this.charCodeAt(n);for((i===_t||i===ot)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)rt(this.charCodeAt(n))||this.error("Integer is expected",n)}function Xt(e){return Oe.call(this,0,e)}function Lt(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case Ee:n="N is expected";break;case ot:n="HyphenMinus is expected";break}this.error(n,this.tokenStart+e)}}function on(){let e=0,t=0,n=this.tokenType;for(;n===N||n===Y;)n=this.lookupType(++e);if(n!==S)if(this.isDelim(_t,e)||this.isDelim(ot,e)){t=this.isDelim(_t,e)?_t:ot;do n=this.lookupType(++e);while(n===N||n===Y);n!==S&&(this.skip(e),Xt.call(this,Dt))}else return null;return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==_t&&n!==ot&&this.error("Number sign is expected")),Xt.call(this,t!==0),t===ot?"-"+this.consume(S):this.consume(S)}const Wl="AnPlusB",Hl={a:[String,null],b:[String,null]};function pi(){const e=this.tokenStart;let t=null,n=null;if(this.tokenType===S)Xt.call(this,Nl),n=this.consume(S);else if(this.tokenType===g&&this.cmpChar(this.tokenStart,ot))switch(t="-1",Lt.call(this,1,Ee),this.tokenEnd-this.tokenStart){case 2:this.next(),n=on.call(this);break;case 3:Lt.call(this,2,ot),this.next(),this.skipSC(),Xt.call(this,Dt),n="-"+this.consume(S);break;default:Lt.call(this,2,ot),Oe.call(this,3,Dt),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===g||this.isDelim(_t)&&this.lookupType(1)===g){let i=0;switch(t="1",this.isDelim(_t)&&(i=1,this.next()),Lt.call(this,0,Ee),this.tokenEnd-this.tokenStart){case 1:this.next(),n=on.call(this);break;case 2:Lt.call(this,1,ot),this.next(),this.skipSC(),Xt.call(this,Dt),n="-"+this.consume(S);break;default:Lt.call(this,1,ot),Oe.call(this,2,Dt),this.next(),n=this.substrToCursor(e+i+1)}}else if(this.tokenType===C){const i=this.charCodeAt(this.tokenStart),r=i===_t||i===ot;let o=this.tokenStart+r;for(;o<this.tokenEnd&&rt(this.charCodeAt(o));o++);o===this.tokenStart+r&&this.error("Integer is expected",this.tokenStart+r),Lt.call(this,o-this.tokenStart,Ee),t=this.substring(e,o),o+1===this.tokenEnd?(this.next(),n=on.call(this)):(Lt.call(this,o-this.tokenStart+1,ot),o+2===this.tokenEnd?(this.next(),this.skipSC(),Xt.call(this,Dt),n="-"+this.consume(S)):(Oe.call(this,o-this.tokenStart+2,Dt),this.next(),n=this.substrToCursor(o+1)))}else this.error();return t!==null&&t.charCodeAt(0)===_t&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===_t&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function mi(e){if(e.a){const t=e.a==="+1"&&"n"||e.a==="1"&&"n"||e.a==="-1"&&"-n"||e.a+"n";if(e.b){const n=e.b[0]==="-"||e.b[0]==="+"?e.b:"+"+e.b;this.tokenize(t+n)}else this.tokenize(t)}else this.tokenize(e.b)}const Bl=Object.freeze(Object.defineProperty({__proto__:null,generate:mi,name:Wl,parse:pi,structure:Hl},Symbol.toStringTag,{value:"Module"}));function gi(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function Ul(){for(let e=1,t;t=this.lookupType(e);e++){if(t===Ut)return!0;if(t===ft||t===B)return!1}return!1}const Vl="Atrule",ql="atrule",Ql={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]};function yi(e=!1){const t=this.tokenStart;let n,i,r=null,o=null;switch(this.eat(B),n=this.substrToCursor(t+1),i=n.toLowerCase(),this.skipSC(),this.eof===!1&&this.tokenType!==ft&&this.tokenType!==Z&&(this.parseAtrulePrelude?r=this.parseWithFallback(this.AtrulePrelude.bind(this,n,e),gi):r=gi.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case Z:this.next();break;case ft:hasOwnProperty.call(this.atrule,i)&&typeof this.atrule[i].block=="function"?o=this.atrule[i].block.call(this,e):o=this.Block(Ul.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:r,block:o}}function ki(e){this.token(B,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(Z,";")}const Xl=Object.freeze(Object.defineProperty({__proto__:null,generate:ki,name:Vl,parse:yi,structure:Ql,walkContext:ql},Symbol.toStringTag,{value:"Module"})),Yl="AtrulePrelude",Gl="atrulePrelude",Kl={children:[[]]};function bi(e){let t=null;return e!==null&&(e=e.toLowerCase()),this.skipSC(),hasOwnProperty.call(this.atrule,e)&&typeof this.atrule[e].prelude=="function"?t=this.atrule[e].prelude.call(this):t=this.readSequence(this.scope.AtrulePrelude),this.skipSC(),this.eof!==!0&&this.tokenType!==ft&&this.tokenType!==Z&&this.error("Semicolon or block is expected"),{type:"AtrulePrelude",loc:this.getLocationFromList(t),children:t}}function Si(e){this.children(e)}const Jl=Object.freeze(Object.defineProperty({__proto__:null,generate:Si,name:Yl,parse:bi,structure:Kl,walkContext:Gl},Symbol.toStringTag,{value:"Module"})),Zl=36,_i=42,De=61,ta=94,sn=124,ea=126;function na(){this.eof&&this.error("Unexpected end of input");const e=this.tokenStart;let t=!1;return this.isDelim(_i)?(t=!0,this.next()):this.isDelim(sn)||this.eat(g),this.isDelim(sn)?this.charCodeAt(this.tokenStart+1)!==De?(this.next(),this.eat(g)):t&&this.error("Identifier is expected",this.tokenEnd):t&&this.error("Vertical line is expected"),{type:"Identifier",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function ia(){const e=this.tokenStart,t=this.charCodeAt(e);return t!==De&&t!==ea&&t!==ta&&t!==Zl&&t!==_i&&t!==sn&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==De&&(this.isDelim(De)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}const ra="AttributeSelector",oa={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]};function vi(){const e=this.tokenStart;let t,n=null,i=null,r=null;return this.eat(Bt),this.skipSC(),t=na.call(this),this.skipSC(),this.tokenType!==oe&&(this.tokenType!==g&&(n=ia.call(this),this.skipSC(),i=this.tokenType===wt?this.String():this.Identifier(),this.skipSC()),this.tokenType===g&&(r=this.consume(g),this.skipSC())),this.eat(oe),{type:"AttributeSelector",loc:this.getLocation(e,this.tokenStart),name:t,matcher:n,value:i,flags:r}}function wi(e){this.token(L,"["),this.node(e.name),e.matcher!==null&&(this.tokenize(e.matcher),this.node(e.value)),e.flags!==null&&this.token(g,e.flags),this.token(L,"]")}const sa=Object.freeze(Object.defineProperty({__proto__:null,generate:wi,name:ra,parse:vi,structure:oa},Symbol.toStringTag,{value:"Module"})),la=38;function Ci(){return this.Raw(null,!0)}function xi(){return this.parseWithFallback(this.Rule,Ci)}function Li(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function aa(){if(this.tokenType===Z)return Li.call(this,this.tokenIndex);const e=this.parseWithFallback(this.Declaration,Li);return this.tokenType===Z&&this.next(),e}const ca="Block",ua="block",ha={children:[["Atrule","Rule","Declaration"]]};function Ai(e){const t=e?aa:xi,n=this.tokenStart;let i=this.createList();this.eat(ft);t:for(;!this.eof;)switch(this.tokenType){case Ut:break t;case N:case Y:this.next();break;case B:i.push(this.parseWithFallback(this.Atrule.bind(this,e),Ci));break;default:e&&this.isDelim(la)?i.push(xi.call(this)):i.push(t.call(this))}return this.eof||this.eat(Ut),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:i}}function Pi(e){this.token(ft,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(Z,";")}),this.token(Ut,"}")}const fa=Object.freeze(Object.defineProperty({__proto__:null,generate:Pi,name:ca,parse:Ai,structure:ha,walkContext:ua},Symbol.toStringTag,{value:"Module"})),da="Brackets",pa={children:[[]]};function Ti(e,t){const n=this.tokenStart;let i=null;return this.eat(Bt),i=e.call(this,t),this.eof||this.eat(oe),{type:"Brackets",loc:this.getLocation(n,this.tokenStart),children:i}}function Ei(e){this.token(L,"["),this.children(e),this.token(L,"]")}const ma=Object.freeze(Object.defineProperty({__proto__:null,generate:Ei,name:da,parse:Ti,structure:pa},Symbol.toStringTag,{value:"Module"})),ga="CDC",ya=[];function Oi(){const e=this.tokenStart;return this.eat(it),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function Di(){this.token(it,"-->")}const ka=Object.freeze(Object.defineProperty({__proto__:null,generate:Di,name:ga,parse:Oi,structure:ya},Symbol.toStringTag,{value:"Module"})),ba="CDO",Sa=[];function Mi(){const e=this.tokenStart;return this.eat(ve),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function Ii(){this.token(ve,"<!--")}const _a=Object.freeze(Object.defineProperty({__proto__:null,generate:Ii,name:ba,parse:Mi,structure:Sa},Symbol.toStringTag,{value:"Module"})),va=46,wa="ClassSelector",Ca={name:String};function Ri(){return this.eatDelim(va),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(g)}}function ji(e){this.token(L,"."),this.token(g,e.name)}const xa=Object.freeze(Object.defineProperty({__proto__:null,generate:ji,name:wa,parse:Ri,structure:Ca},Symbol.toStringTag,{value:"Module"})),La=43,Fi=47,Aa=62,Pa=126,Ta="Combinator",Ea={name:String};function $i(){const e=this.tokenStart;let t;switch(this.tokenType){case N:t=" ";break;case L:switch(this.charCodeAt(this.tokenStart)){case Aa:case La:case Pa:this.next();break;case Fi:this.next(),this.eatIdent("deep"),this.eatDelim(Fi);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function zi(e){this.tokenize(e.name)}const Oa=Object.freeze(Object.defineProperty({__proto__:null,generate:zi,name:Ta,parse:$i,structure:Ea},Symbol.toStringTag,{value:"Module"})),Da=42,Ma=47,Ia="Comment",Ra={value:String};function Ni(){const e=this.tokenStart;let t=this.tokenEnd;return this.eat(Y),t-e+2>=2&&this.charCodeAt(t-2)===Da&&this.charCodeAt(t-1)===Ma&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function Wi(e){this.token(Y,"/*"+e.value+"*/")}const ja=Object.freeze(Object.defineProperty({__proto__:null,generate:Wi,name:Ia,parse:Ni,structure:Ra},Symbol.toStringTag,{value:"Module"})),Fa=new Set([X,b,xt]),$a="Condition",za={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};function Hi(e){return this.lookupTypeNonSC(1)===g&&Fa.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}const Na={media:Hi,container:Hi,supports(){return this.SupportsDeclaration()}};function Bi(e="media"){const t=this.createList();t:for(;!this.eof;)switch(this.tokenType){case Y:case N:this.next();continue;case g:t.push(this.Identifier());break;case E:{let n=this.parseWithFallback(()=>Na[e].call(this,e),()=>null);n||(n=this.parseWithFallback(()=>{this.eat(E);const i=this.Condition(e);return this.eat(b),i},()=>this.GeneralEnclosed(e))),t.push(n);break}case v:{let n=this.parseWithFallback(()=>this.FeatureFunction(e),()=>null);n||(n=this.GeneralEnclosed(e)),t.push(n);break}default:break t}return t.isEmpty&&this.error("Condition is expected"),{type:"Condition",loc:this.getLocationFromList(t),kind:e,children:t}}function Ui(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(E,"("),this.node(t),this.token(b,")")):this.node(t)})}const Wa=Object.freeze(Object.defineProperty({__proto__:null,generate:Ui,name:$a,parse:Bi,structure:za},Symbol.toStringTag,{value:"Module"})),Vi=45;function Ha(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===Vi&&e.charCodeAt(t+1)===Vi}const qi=33,Ba=35,Ua=36,Va=38,qa=42,Qa=43,Qi=47;function Xa(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function Ya(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function Ga(){const e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==Z&&this.isDelim(qi)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}const Ka="Declaration",Ja="declaration",Za={important:[Boolean,String],property:String,value:["Value","Raw"]};function Xi(){const e=this.tokenStart,t=this.tokenIndex,n=tc.call(this),i=Ha(n),r=i?this.parseCustomProperty:this.parseValue,o=i?Ya:Xa;let l=!1,c;this.skipSC(),this.eat(X);const a=this.tokenIndex;if(i||this.skipSC(),r?c=this.parseWithFallback(Ga,o):c=o.call(this,this.tokenIndex),i&&c.type==="Value"&&c.children.isEmpty){for(let s=a-this.tokenIndex;s<=0;s++)if(this.lookupType(s)===N){c.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}return this.isDelim(qi)&&(l=ec.call(this),this.skipSC()),this.eof===!1&&this.tokenType!==Z&&this.isBalanceEdge(t)===!1&&this.error(),{type:"Declaration",loc:this.getLocation(e,this.tokenStart),important:l,property:n,value:c}}function Yi(e){this.token(g,e.property),this.token(X,":"),this.node(e.value),e.important&&(this.token(L,"!"),this.token(g,e.important===!0?"important":e.important))}function tc(){const e=this.tokenStart;if(this.tokenType===L)switch(this.charCodeAt(this.tokenStart)){case qa:case Ua:case Qa:case Ba:case Va:this.next();break;case Qi:this.next(),this.isDelim(Qi)&&this.next();break}return this.tokenType===D?this.eat(D):this.eat(g),this.substrToCursor(e)}function ec(){this.eat(L),this.skipSC();const e=this.consume(g);return e==="important"?!0:e}const nc=Object.freeze(Object.defineProperty({__proto__:null,generate:Yi,name:Ka,parse:Xi,structure:Za,walkContext:Ja},Symbol.toStringTag,{value:"Module"})),ic=38;function ln(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}const rc="DeclarationList",oc={children:[["Declaration","Atrule","Rule"]]};function Gi(){const e=this.createList();for(;!this.eof;)switch(this.tokenType){case N:case Y:case Z:this.next();break;case B:e.push(this.parseWithFallback(this.Atrule.bind(this,!0),ln));break;default:this.isDelim(ic)?e.push(this.parseWithFallback(this.Rule,ln)):e.push(this.parseWithFallback(this.Declaration,ln))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function Ki(e){this.children(e,t=>{t.type==="Declaration"&&this.token(Z,";")})}const sc=Object.freeze(Object.defineProperty({__proto__:null,generate:Ki,name:rc,parse:Gi,structure:oc},Symbol.toStringTag,{value:"Module"})),lc="Dimension",ac={value:String,unit:String};function Ji(){const e=this.tokenStart,t=this.consumeNumber(C);return{type:"Dimension",loc:this.getLocation(e,this.tokenStart),value:t,unit:this.substring(e+t.length,this.tokenStart)}}function Zi(e){this.token(C,e.value+e.unit)}const cc=Object.freeze(Object.defineProperty({__proto__:null,generate:Zi,name:lc,parse:Ji,structure:ac},Symbol.toStringTag,{value:"Module"})),uc=47,hc="Feature",fc={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]};function tr(e){const t=this.tokenStart;let n,i=null;if(this.eat(E),this.skipSC(),n=this.consume(g),this.skipSC(),this.tokenType!==b){switch(this.eat(X),this.skipSC(),this.tokenType){case S:this.lookupNonWSType(1)===L?i=this.Ratio():i=this.Number();break;case C:i=this.Dimension();break;case g:i=this.Identifier();break;case v:i=this.parseWithFallback(()=>{const r=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(uc)&&this.error(),r},()=>this.Ratio());break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eof||this.eat(b),{type:"Feature",loc:this.getLocation(t,this.tokenStart),kind:e,name:n,value:i}}function er(e){this.token(E,"("),this.token(g,e.name),e.value!==null&&(this.token(X,":"),this.node(e.value)),this.token(b,")")}const dc=Object.freeze(Object.defineProperty({__proto__:null,generate:er,name:hc,parse:tr,structure:fc},Symbol.toStringTag,{value:"Module"})),pc="FeatureFunction",mc={kind:String,feature:String,value:["Declaration","Selector"]};function gc(e,t){const n=(this.features[e]||{})[t];return typeof n!="function"&&this.error(`Unknown feature ${t}()`),n}function nr(e="unknown"){const t=this.tokenStart,n=this.consumeFunctionName(),i=gc.call(this,e,n.toLowerCase());this.skipSC();const r=this.parseWithFallback(()=>{const o=this.tokenIndex,l=i.call(this);return this.eof===!1&&this.isBalanceEdge(o)===!1&&this.error(),l},()=>this.Raw(null,!1));return this.eof||this.eat(b),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:n,value:r}}function ir(e){this.token(v,e.feature+"("),this.node(e.value),this.token(b,")")}const yc=Object.freeze(Object.defineProperty({__proto__:null,generate:ir,name:pc,parse:nr,structure:mc},Symbol.toStringTag,{value:"Module"})),rr=47,kc=60,or=61,bc=62,Sc="FeatureRange",_c={kind:String,left:["Identifier","Number","Dimension","Ratio","Function"],leftComparison:String,middle:["Identifier","Number","Dimension","Ratio","Function"],rightComparison:[String,null],right:["Identifier","Number","Dimension","Ratio","Function",null]};function an(){switch(this.skipSC(),this.tokenType){case S:return this.isDelim(rr,this.lookupOffsetNonSC(1))?this.Ratio():this.Number();case C:return this.Dimension();case g:return this.Identifier();case v:return this.parseWithFallback(()=>{const e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(rr)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function sr(e){if(this.skipSC(),this.isDelim(kc)||this.isDelim(bc)){const t=this.source[this.tokenStart];return this.next(),this.isDelim(or)?(this.next(),t+"="):t}if(this.isDelim(or))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function lr(e="unknown"){const t=this.tokenStart;this.skipSC(),this.eat(E);const n=an.call(this),i=sr.call(this,n.type==="Identifier"),r=an.call(this);let o=null,l=null;return this.lookupNonWSType(0)!==b&&(o=sr.call(this),l=an.call(this)),this.skipSC(),this.eat(b),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:n,leftComparison:i,middle:r,rightComparison:o,right:l}}function ar(e){this.token(E,"("),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(b,")")}const vc=Object.freeze(Object.defineProperty({__proto__:null,generate:ar,name:Sc,parse:lr,structure:_c},Symbol.toStringTag,{value:"Module"})),wc="Function",Cc="function",xc={name:String,children:[[]]};function cr(e,t){const n=this.tokenStart,i=this.consumeFunctionName(),r=i.toLowerCase();let o;return o=t.hasOwnProperty(r)?t[r].call(this,t):e.call(this,t),this.eof||this.eat(b),{type:"Function",loc:this.getLocation(n,this.tokenStart),name:i,children:o}}function ur(e){this.token(v,e.name+"("),this.children(e),this.token(b,")")}const Lc=Object.freeze(Object.defineProperty({__proto__:null,generate:ur,name:wc,parse:cr,structure:xc,walkContext:Cc},Symbol.toStringTag,{value:"Module"})),Ac="GeneralEnclosed",Pc={kind:String,function:[String,null],children:[[]]};function hr(e){const t=this.tokenStart;let n=null;this.tokenType===v?n=this.consumeFunctionName():this.eat(E);const i=this.parseWithFallback(()=>{const r=this.tokenIndex,o=this.readSequence(this.scope.Value);return this.eof===!1&&this.isBalanceEdge(r)===!1&&this.error(),o},()=>this.createSingleNodeList(this.Raw(null,!1)));return this.eof||this.eat(b),{type:"GeneralEnclosed",loc:this.getLocation(t,this.tokenStart),kind:e,function:n,children:i}}function fr(e){e.function?this.token(v,e.function+"("):this.token(E,"("),this.children(e),this.token(b,")")}const Tc=Object.freeze(Object.defineProperty({__proto__:null,generate:fr,name:Ac,parse:hr,structure:Pc},Symbol.toStringTag,{value:"Module"})),Ec="XXX",Oc="Hash",Dc={value:String};function dr(){const e=this.tokenStart;return this.eat(D),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function pr(e){this.token(D,"#"+e.value)}const Mc=Object.freeze(Object.defineProperty({__proto__:null,generate:pr,name:Oc,parse:dr,structure:Dc,xxx:Ec},Symbol.toStringTag,{value:"Module"})),Ic="Identifier",Rc={name:String};function mr(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(g)}}function gr(e){this.token(g,e.name)}const jc=Object.freeze(Object.defineProperty({__proto__:null,generate:gr,name:Ic,parse:mr,structure:Rc},Symbol.toStringTag,{value:"Module"})),Fc="IdSelector",$c={name:String};function yr(){const e=this.tokenStart;return this.eat(D),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function kr(e){this.token(L,"#"+e.name)}const zc=Object.freeze(Object.defineProperty({__proto__:null,generate:kr,name:Fc,parse:yr,structure:$c},Symbol.toStringTag,{value:"Module"})),Nc=46,Wc="Layer",Hc={name:String};function br(){let e=this.tokenStart,t=this.consume(g);for(;this.isDelim(Nc);)this.eat(L),t+="."+this.consume(g);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function Sr(e){this.tokenize(e.name)}const Bc=Object.freeze(Object.defineProperty({__proto__:null,generate:Sr,name:Wc,parse:br,structure:Hc},Symbol.toStringTag,{value:"Module"})),Uc="LayerList",Vc={children:[["Layer"]]};function _r(){const e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.Layer()),this.lookupTypeNonSC(0)===ht);)this.skipSC(),this.next(),this.skipSC();return{type:"LayerList",loc:this.getLocationFromList(e),children:e}}function vr(e){this.children(e,()=>this.token(ht,","))}const qc=Object.freeze(Object.defineProperty({__proto__:null,generate:vr,name:Uc,parse:_r,structure:Vc},Symbol.toStringTag,{value:"Module"})),Qc="MediaQuery",Xc={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]};function wr(){const e=this.tokenStart;let t=null,n=null,i=null;if(this.skipSC(),this.tokenType===g&&this.lookupTypeNonSC(1)!==E){const r=this.consume(g),o=r.toLowerCase();switch(o==="not"||o==="only"?(this.skipSC(),t=o,n=this.consume(g)):n=r,this.lookupTypeNonSC(0)){case g:{this.skipSC(),this.eatIdent("and"),i=this.Condition("media");break}case ft:case Z:case ht:case xt:break;default:this.error("Identifier or parenthesis is expected")}}else switch(this.tokenType){case g:case E:case v:{i=this.Condition("media");break}case ft:case Z:case xt:break;default:this.error("Identifier or parenthesis is expected")}return{type:"MediaQuery",loc:this.getLocation(e,this.tokenStart),modifier:t,mediaType:n,condition:i}}function Cr(e){e.mediaType?(e.modifier&&this.token(g,e.modifier),this.token(g,e.mediaType),e.condition&&(this.token(g,"and"),this.node(e.condition))):e.condition&&this.node(e.condition)}const Yc=Object.freeze(Object.defineProperty({__proto__:null,generate:Cr,name:Qc,parse:wr,structure:Xc},Symbol.toStringTag,{value:"Module"})),Gc="MediaQueryList",Kc={children:[["MediaQuery"]]};function xr(){const e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.MediaQuery()),this.tokenType===ht);)this.next();return{type:"MediaQueryList",loc:this.getLocationFromList(e),children:e}}function Lr(e){this.children(e,()=>this.token(ht,","))}const Jc=Object.freeze(Object.defineProperty({__proto__:null,generate:Lr,name:Gc,parse:xr,structure:Kc},Symbol.toStringTag,{value:"Module"})),Zc=38,tu="NestingSelector",eu={};function Ar(){const e=this.tokenStart;return this.eatDelim(Zc),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function Pr(){this.token(L,"&")}const nu=Object.freeze(Object.defineProperty({__proto__:null,generate:Pr,name:tu,parse:Ar,structure:eu},Symbol.toStringTag,{value:"Module"})),iu="Nth",ru={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]};function Tr(){this.skipSC();const e=this.tokenStart;let t=e,n=null,i;return this.lookupValue(0,"odd")||this.lookupValue(0,"even")?i=this.Identifier():i=this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),n=this.SelectorList(),t=this.tokenStart),{type:"Nth",loc:this.getLocation(e,t),nth:i,selector:n}}function Er(e){this.node(e.nth),e.selector!==null&&(this.token(g,"of"),this.node(e.selector))}const ou=Object.freeze(Object.defineProperty({__proto__:null,generate:Er,name:iu,parse:Tr,structure:ru},Symbol.toStringTag,{value:"Module"})),su="Number",lu={value:String};function Or(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(S)}}function Dr(e){this.token(S,e.value)}const au=Object.freeze(Object.defineProperty({__proto__:null,generate:Dr,name:su,parse:Or,structure:lu},Symbol.toStringTag,{value:"Module"})),cu="Operator",uu={value:String};function Mr(){const e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Ir(e){this.tokenize(e.value)}const hu=Object.freeze(Object.defineProperty({__proto__:null,generate:Ir,name:cu,parse:Mr,structure:uu},Symbol.toStringTag,{value:"Module"})),fu="Parentheses",du={children:[[]]};function Rr(e,t){const n=this.tokenStart;let i=null;return this.eat(E),i=e.call(this,t),this.eof||this.eat(b),{type:"Parentheses",loc:this.getLocation(n,this.tokenStart),children:i}}function jr(e){this.token(E,"("),this.children(e),this.token(b,")")}const pu=Object.freeze(Object.defineProperty({__proto__:null,generate:jr,name:fu,parse:Rr,structure:du},Symbol.toStringTag,{value:"Module"})),mu="Percentage",gu={value:String};function Fr(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber($)}}function $r(e){this.token($,e.value+"%")}const yu=Object.freeze(Object.defineProperty({__proto__:null,generate:$r,name:mu,parse:Fr,structure:gu},Symbol.toStringTag,{value:"Module"})),ku="PseudoClassSelector",bu="function",Su={name:String,children:[["Raw"],null]};function zr(){const e=this.tokenStart;let t=null,n,i;return this.eat(X),this.tokenType===v?(n=this.consumeFunctionName(),i=n.toLowerCase(),this.lookupNonWSType(0)==b?t=this.createList():hasOwnProperty.call(this.pseudo,i)?(this.skipSC(),t=this.pseudo[i].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(b)):n=this.consume(g),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function Nr(e){this.token(X,":"),e.children===null?this.token(g,e.name):(this.token(v,e.name+"("),this.children(e),this.token(b,")"))}const _u=Object.freeze(Object.defineProperty({__proto__:null,generate:Nr,name:ku,parse:zr,structure:Su,walkContext:bu},Symbol.toStringTag,{value:"Module"})),vu="PseudoElementSelector",wu="function",Cu={name:String,children:[["Raw"],null]};function Wr(){const e=this.tokenStart;let t=null,n,i;return this.eat(X),this.eat(X),this.tokenType===v?(n=this.consumeFunctionName(),i=n.toLowerCase(),this.lookupNonWSType(0)==b?t=this.createList():hasOwnProperty.call(this.pseudo,i)?(this.skipSC(),t=this.pseudo[i].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(b)):n=this.consume(g),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function Hr(e){this.token(X,":"),this.token(X,":"),e.children===null?this.token(g,e.name):(this.token(v,e.name+"("),this.children(e),this.token(b,")"))}const xu=Object.freeze(Object.defineProperty({__proto__:null,generate:Hr,name:vu,parse:Wr,structure:Cu,walkContext:wu},Symbol.toStringTag,{value:"Module"})),Br=47;function Ur(){switch(this.skipSC(),this.tokenType){case S:return this.Number();case v:return this.Function(this.readSequence,this.scope.Value);default:this.error("Number of function is expected")}}const Lu="Ratio",Au={left:["Number","Function"],right:["Number","Function",null]};function Vr(){const e=this.tokenStart,t=Ur.call(this);let n=null;return this.skipSC(),this.isDelim(Br)&&(this.eatDelim(Br),n=Ur.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function qr(e){this.node(e.left),this.token(L,"/"),e.right?this.node(e.right):this.node(S,1)}const Pu=Object.freeze(Object.defineProperty({__proto__:null,generate:qr,name:Lu,parse:Vr,structure:Au},Symbol.toStringTag,{value:"Module"}));function Tu(){return this.tokenIndex>0&&this.lookupType(-1)===N?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}const Eu="Raw",Ou={value:String};function Qr(e,t){const n=this.getTokenStart(this.tokenIndex);let i;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>n?i=Tu.call(this):i=this.tokenStart,{type:"Raw",loc:this.getLocation(n,i),value:this.substring(n,i)}}function Xr(e){this.tokenize(e.value)}const Du=Object.freeze(Object.defineProperty({__proto__:null,generate:Xr,name:Eu,parse:Qr,structure:Ou},Symbol.toStringTag,{value:"Module"}));function Yr(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function Mu(){const e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==ft&&this.error(),e}const Iu="Rule",Ru="rule",ju={prelude:["SelectorList","Raw"],block:["Block"]};function Gr(){const e=this.tokenIndex,t=this.tokenStart;let n,i;return this.parseRulePrelude?n=this.parseWithFallback(Mu,Yr):n=Yr.call(this,e),i=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:i}}function Kr(e){this.node(e.prelude),this.node(e.block)}const Fu=Object.freeze(Object.defineProperty({__proto__:null,generate:Kr,name:Iu,parse:Gr,structure:ju,walkContext:Ru},Symbol.toStringTag,{value:"Module"})),$u="Scope",zu={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]};function Jr(){let e=null,t=null;this.skipSC();const n=this.tokenStart;return this.tokenType===E&&(this.next(),this.skipSC(),e=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(b)),this.lookupNonWSType(0)===g&&(this.skipSC(),this.eatIdent("to"),this.skipSC(),this.eat(E),this.skipSC(),t=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(b)),{type:"Scope",loc:this.getLocation(n,this.tokenStart),root:e,limit:t}}function Zr(e){e.root&&(this.token(E,"("),this.node(e.root),this.token(b,")")),e.limit&&(this.token(g,"to"),this.token(E,"("),this.node(e.limit),this.token(b,")"))}const Nu=Object.freeze(Object.defineProperty({__proto__:null,generate:Zr,name:$u,parse:Jr,structure:zu},Symbol.toStringTag,{value:"Module"})),Wu="Selector",Hu={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]};function to(){const e=this.readSequence(this.scope.Selector);return this.getFirstListNode(e)===null&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(e),children:e}}function eo(e){this.children(e)}const Bu=Object.freeze(Object.defineProperty({__proto__:null,generate:eo,name:Wu,parse:to,structure:Hu},Symbol.toStringTag,{value:"Module"})),Uu="SelectorList",Vu="selector",qu={children:[["Selector","Raw"]]};function no(){const e=this.createList();for(;!this.eof;){if(e.push(this.Selector()),this.tokenType===ht){this.next();continue}break}return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function io(e){this.children(e,()=>this.token(ht,","))}const Qu=Object.freeze(Object.defineProperty({__proto__:null,generate:io,name:Uu,parse:no,structure:qu,walkContext:Vu},Symbol.toStringTag,{value:"Module"})),cn=92,ro=34,Xu=39;function oo(e){const t=e.length,n=e.charCodeAt(0),i=n===ro||n===Xu?1:0,r=i===1&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1;let o="";for(let l=i;l<=r;l++){let c=e.charCodeAt(l);if(c===cn){if(l===r){l!==t-1&&(o=e.substr(l+1));break}if(c=e.charCodeAt(++l),kt(cn,c)){const a=l-1,s=Qt(e,a);l=s-1,o+=li(e.substring(a+1,s))}else c===13&&e.charCodeAt(l+1)===10&&l++}else o+=e[l]}return o}function Yu(e,t){const n=ro;let i="",r=!1;for(let o=0;o<e.length;o++){const l=e.charCodeAt(o);if(l===0){i+="�";continue}if(l<=31||l===127){i+="\\"+l.toString(16),r=!0;continue}l===n||l===cn?(i+="\\"+e.charAt(o),r=!1):(r&&(Vt(l)||Et(l))&&(i+=" "),i+=e.charAt(o),r=!1)}return'"'+i+'"'}const Gu="String",Ku={value:String};function so(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:oo(this.consume(wt))}}function lo(e){this.token(wt,Yu(e.value))}const Ju=Object.freeze(Object.defineProperty({__proto__:null,generate:lo,name:Gu,parse:so,structure:Ku},Symbol.toStringTag,{value:"Module"})),Zu=33;function ao(){return this.Raw(null,!1)}const th="StyleSheet",eh="stylesheet",nh={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]};function co(){const e=this.tokenStart,t=this.createList();let n;for(;!this.eof;){switch(this.tokenType){case N:this.next();continue;case Y:if(this.charCodeAt(this.tokenStart+2)!==Zu){this.next();continue}n=this.Comment();break;case ve:n=this.CDO();break;case it:n=this.CDC();break;case B:n=this.parseWithFallback(this.Atrule,ao);break;default:n=this.parseWithFallback(this.Rule,ao)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function uo(e){this.children(e)}const ih=Object.freeze(Object.defineProperty({__proto__:null,generate:uo,name:th,parse:co,structure:nh,walkContext:eh},Symbol.toStringTag,{value:"Module"})),rh="SupportsDeclaration",oh={declaration:"Declaration"};function ho(){const e=this.tokenStart;this.eat(E),this.skipSC();const t=this.Declaration();return this.eof||this.eat(b),{type:"SupportsDeclaration",loc:this.getLocation(e,this.tokenStart),declaration:t}}function fo(e){this.token(E,"("),this.node(e.declaration),this.token(b,")")}const sh=Object.freeze(Object.defineProperty({__proto__:null,generate:fo,name:rh,parse:ho,structure:oh},Symbol.toStringTag,{value:"Module"})),lh=42,po=124;function un(){this.tokenType!==g&&this.isDelim(lh)===!1&&this.error("Identifier or asterisk is expected"),this.next()}const ah="TypeSelector",ch={name:String};function mo(){const e=this.tokenStart;return this.isDelim(po)?(this.next(),un.call(this)):(un.call(this),this.isDelim(po)&&(this.next(),un.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function go(e){this.tokenize(e.name)}const uh=Object.freeze(Object.defineProperty({__proto__:null,generate:go,name:ah,parse:mo,structure:ch},Symbol.toStringTag,{value:"Module"})),yo=43,ko=45,hn=63;function se(e,t){let n=0;for(let i=this.tokenStart+e;i<this.tokenEnd;i++){const r=this.charCodeAt(i);if(r===ko&&t&&n!==0)return se.call(this,e+n+1,!1),-1;Vt(r)||this.error(t&&n!==0?"Hyphen minus"+(n<6?" or hex digit":"")+" is expected":n<6?"Hex digit is expected":"Unexpected input",i),++n>6&&this.error("Too many hex digits",i)}return this.next(),n}function Me(e){let t=0;for(;this.isDelim(hn);)++t>e&&this.error("Too many question marks"),this.next()}function hh(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===yo?"Plus sign":"Hyphen minus")+" is expected")}function fh(){let e=0;switch(this.tokenType){case S:if(e=se.call(this,1,!0),this.isDelim(hn)){Me.call(this,6-e);break}if(this.tokenType===C||this.tokenType===S){hh.call(this,ko),se.call(this,1,!1);break}break;case C:e=se.call(this,1,!0),e>0&&Me.call(this,6-e);break;default:if(this.eatDelim(yo),this.tokenType===g){e=se.call(this,0,!0),e>0&&Me.call(this,6-e);break}if(this.isDelim(hn)){this.next(),Me.call(this,5);break}this.error("Hex digit or question mark is expected")}}const dh="UnicodeRange",ph={value:String};function bo(){const e=this.tokenStart;return this.eatIdent("u"),fh.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function So(e){this.tokenize(e.value)}const mh=Object.freeze(Object.defineProperty({__proto__:null,generate:So,name:dh,parse:bo,structure:ph},Symbol.toStringTag,{value:"Module"})),gh=32,fn=92,yh=34,kh=39,bh=40,_o=41;function Sh(e){const t=e.length;let n=4,i=e.charCodeAt(t-1)===_o?t-2:t-1,r="";for(;n<i&&Et(e.charCodeAt(n));)n++;for(;n<i&&Et(e.charCodeAt(i));)i--;for(let o=n;o<=i;o++){let l=e.charCodeAt(o);if(l===fn){if(o===i){o!==t-1&&(r=e.substr(o+1));break}if(l=e.charCodeAt(++o),kt(fn,l)){const c=o-1,a=Qt(e,c);o=a-1,r+=li(e.substring(c+1,a))}else l===13&&e.charCodeAt(o+1)===10&&o++}else r+=e[o]}return r}function _h(e){let t="",n=!1;for(let i=0;i<e.length;i++){const r=e.charCodeAt(i);if(r===0){t+="�";continue}if(r<=31||r===127){t+="\\"+r.toString(16),n=!0;continue}r===gh||r===fn||r===yh||r===kh||r===bh||r===_o?(t+="\\"+e.charAt(i),n=!1):(n&&Vt(r)&&(t+=" "),t+=e.charAt(i),n=!1)}return"url("+t+")"}const vh="Url",wh={value:String};function vo(){const e=this.tokenStart;let t;switch(this.tokenType){case Q:t=Sh(this.consume(Q));break;case v:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(v),this.skipSC(),t=oo(this.consume(wt)),this.skipSC(),this.eof||this.eat(b);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(e,this.tokenStart),value:t}}function wo(e){this.token(Q,_h(e.value))}const Ch=Object.freeze(Object.defineProperty({__proto__:null,generate:wo,name:vh,parse:vo,structure:wh},Symbol.toStringTag,{value:"Module"})),xh="Value",Lh={children:[[]]};function Co(){const e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function xo(e){this.children(e)}const Ah=Object.freeze(Object.defineProperty({__proto__:null,generate:xo,name:xh,parse:Co,structure:Lh},Symbol.toStringTag,{value:"Module"})),Ph=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),Th="WhiteSpace",Eh={value:String};function Lo(){return this.eat(N),Ph}function Ao(e){this.token(N,e.value)}const Oh=Object.freeze(Object.defineProperty({__proto__:null,generate:Ao,name:Th,parse:Lo,structure:Eh},Symbol.toStringTag,{value:"Module"})),Dh=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:Bl,Atrule:Xl,AtrulePrelude:Jl,AttributeSelector:sa,Block:fa,Brackets:ma,CDC:ka,CDO:_a,ClassSelector:xa,Combinator:Oa,Comment:ja,Condition:Wa,Declaration:nc,DeclarationList:sc,Dimension:cc,Feature:dc,FeatureFunction:yc,FeatureRange:vc,Function:Lc,GeneralEnclosed:Tc,Hash:Mc,IdSelector:zc,Identifier:jc,Layer:Bc,LayerList:qc,MediaQuery:Yc,MediaQueryList:Jc,NestingSelector:nu,Nth:ou,Number:au,Operator:hu,Parentheses:pu,Percentage:yu,PseudoClassSelector:_u,PseudoElementSelector:xu,Ratio:Pu,Raw:Du,Rule:Fu,Scope:Nu,Selector:Bu,SelectorList:Qu,String:Ju,StyleSheet:ih,SupportsDeclaration:sh,TypeSelector:uh,UnicodeRange:mh,Url:Ch,Value:Ah,WhiteSpace:Oh},Symbol.toStringTag,{value:"Module"})),Mh={node:Dh},At=Al(Mh),dn=["left","right","top","bottom","inset-block-start","inset-block-end","inset-inline-start","inset-inline-end","inset-block","inset-inline","inset"];function le(e){return dn.includes(e)}const pn=["margin-block-start","margin-block-end","margin-block","margin-inline-start","margin-inline-end","margin-inline","margin-bottom","margin-left","margin-right","margin-top","margin"];function Ih(e){return pn.includes(e)}const mn=["width","height","min-width","min-height","max-width","max-height","block-size","inline-size","min-block-size","min-inline-size","max-block-size","max-inline-size"];function Po(e){return mn.includes(e)}const To=["justify-self","align-self","place-self"];function Rh(e){return To.includes(e)}const Eo=[...dn,...pn,...mn,...To,"position-anchor","position-area"],jh=[...mn,...dn,...pn];function Oo(e){return jh.includes(e)}const Fh=["top","left","right","bottom","start","end","self-start","self-end","center","inside","outside"];function Do(e){return Fh.includes(e)}const $h=["width","height","block","inline","self-block","self-inline"];function zh(e){return $h.includes(e)}const Mo=new Set(["Atrule","Selector","Declaration"]);function Nh(e){const t=new SourceMapGenerator,n={line:1,column:0},i={line:0,column:0},r={line:1,column:0},o={generated:r};let l=1,c=0,a=!1;const s=e.node;e.node=function(f){if(f.loc&&f.loc.start&&Mo.has(f.type)){const d=f.loc.start.line,p=f.loc.start.column-1;(i.line!==d||i.column!==p)&&(i.line=d,i.column=p,n.line=l,n.column=c,a&&(a=!1,(n.line!==r.line||n.column!==r.column)&&t.addMapping(o)),a=!0,t.addMapping({source:f.loc.source,original:i,generated:n}))}s.call(this,f),a&&Mo.has(f.type)&&(r.line=l,r.column=c)};const u=e.emit;e.emit=function(f,d,p){for(let m=0;m<f.length;m++)f.charCodeAt(m)===10?(l++,c=0):c++;u(f,d,p)};const h=e.result;return e.result=function(){return a&&t.addMapping(o),{css:h(),map:t}},e}const Wh=43,Hh=45,gn=(e,t)=>{if(e===L&&(e=t),typeof e=="string"){const n=e.charCodeAt(0);return n>127?32768:n<<8}return e},Io=[[g,g],[g,v],[g,Q],[g,ut],[g,"-"],[g,S],[g,$],[g,C],[g,it],[g,E],[B,g],[B,v],[B,Q],[B,ut],[B,"-"],[B,S],[B,$],[B,C],[B,it],[D,g],[D,v],[D,Q],[D,ut],[D,"-"],[D,S],[D,$],[D,C],[D,it],[C,g],[C,v],[C,Q],[C,ut],[C,"-"],[C,S],[C,$],[C,C],[C,it],["#",g],["#",v],["#",Q],["#",ut],["#","-"],["#",S],["#",$],["#",C],["#",it],["-",g],["-",v],["-",Q],["-",ut],["-","-"],["-",S],["-",$],["-",C],["-",it],[S,g],[S,v],[S,Q],[S,ut],[S,S],[S,$],[S,C],[S,"%"],[S,it],["@",g],["@",v],["@",Q],["@",ut],["@","-"],["@",it],[".",S],[".",$],[".",C],["+",S],["+",$],["+",C],["/","*"]],Bh=Io.concat([[g,D],[C,D],[D,D],[B,E],[B,wt],[B,X],[$,$],[$,C],[$,v],[$,"-"],[b,g],[b,v],[b,$],[b,C],[b,D],[b,"-"]]);function Ro(e){const t=new Set(e.map(([n,i])=>gn(n)<<16|gn(i)));return function(n,i,r){const o=gn(i,r),l=r.charCodeAt(0);return(l===Hh&&i!==g&&i!==v&&i!==it||l===Wh?t.has(n<<16|l<<8):t.has(n<<16|o))&&this.emit(" ",N,!0),o}}const Uh=Ro(Io),jo=Ro(Bh),Fo=Object.freeze(Object.defineProperty({__proto__:null,safe:jo,spec:Uh},Symbol.toStringTag,{value:"Module"})),Vh=92;function qh(e,t){if(typeof t=="function"){let n=null;e.children.forEach(i=>{n!==null&&t.call(this,n),this.node(i),n=i});return}e.children.forEach(this.node,this)}function Qh(e){di(e,(t,n,i)=>{this.token(t,e.slice(n,i))})}function Xh(e){const t=new Map;for(let[n,i]of Object.entries(e.node))typeof(i.generate||i)=="function"&&t.set(n,i.generate||i);return function(n,i){let r="",o=0,l={node(a){if(t.has(a.type))t.get(a.type).call(c,a);else throw new Error("Unknown node type: "+a.type)},tokenBefore:jo,token(a,s){o=this.tokenBefore(o,a,s),this.emit(s,a,!1),a===L&&s.charCodeAt(0)===Vh&&this.emit(`
|
|
16
|
+
`,N,!0)},emit(a){r+=a},result(){return r}};i&&(typeof i.decorator=="function"&&(l=i.decorator(l)),i.sourceMap&&(l=Nh(l)),i.mode in Fo&&(l.tokenBefore=Fo[i.mode]));const c={node:a=>l.node(a),children:qh,token:(a,s)=>l.token(a,s),tokenize:Qh};return l.node(n),l.result()}}const Yh=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:mi,Atrule:ki,AtrulePrelude:Si,AttributeSelector:wi,Block:Pi,Brackets:Ei,CDC:Di,CDO:Ii,ClassSelector:ji,Combinator:zi,Comment:Wi,Condition:Ui,Declaration:Yi,DeclarationList:Ki,Dimension:Zi,Feature:er,FeatureFunction:ir,FeatureRange:ar,Function:ur,GeneralEnclosed:fr,Hash:pr,IdSelector:kr,Identifier:gr,Layer:Sr,LayerList:vr,MediaQuery:Cr,MediaQueryList:Lr,NestingSelector:Pr,Nth:Er,Number:Dr,Operator:Ir,Parentheses:jr,Percentage:$r,PseudoClassSelector:Nr,PseudoElementSelector:Hr,Ratio:qr,Raw:Xr,Rule:Kr,Scope:Zr,Selector:eo,SelectorList:io,String:lo,StyleSheet:uo,SupportsDeclaration:fo,TypeSelector:go,UnicodeRange:So,Url:wo,Value:xo,WhiteSpace:Ao},Symbol.toStringTag,{value:"Module"})),Gh={node:Yh},Kh=Xh(Gh);let Yt=null;class G{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return G.createItem(t)}allocateCursor(t,n){let i;return Yt!==null?(i=Yt,Yt=Yt.cursor,i.prev=t,i.next=n,i.cursor=this.cursor):i={prev:t,next:n,cursor:this.cursor},this.cursor=i,i}releaseCursor(){const{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=Yt,Yt=t}updateCursors(t,n,i,r){let{cursor:o}=this;for(;o!==null;)o.prev===t&&(o.prev=n),o.next===i&&(o.next=r),o=o.cursor}*[Symbol.iterator](){for(let t=this.head;t!==null;t=t.next)yield t.data}get size(){let t=0;for(let n=this.head;n!==null;n=n.next)t++;return t}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let n=null;this.head=null;for(let i of t){const r=G.createItem(i);n!==null?n.next=r:this.head=r,r.prev=n,n=r}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,n=this){const i=this.allocateCursor(null,this.head);for(;i.next!==null;){const r=i.next;i.next=r.next,t.call(n,r.data,r,this)}this.releaseCursor()}forEachRight(t,n=this){const i=this.allocateCursor(this.tail,null);for(;i.prev!==null;){const r=i.prev;i.prev=r.prev,t.call(n,r.data,r,this)}this.releaseCursor()}reduce(t,n,i=this){let r=this.allocateCursor(null,this.head),o=n,l;for(;r.next!==null;)l=r.next,r.next=l.next,o=t.call(i,o,l.data,l,this);return this.releaseCursor(),o}reduceRight(t,n,i=this){let r=this.allocateCursor(this.tail,null),o=n,l;for(;r.prev!==null;)l=r.prev,r.prev=l.prev,o=t.call(i,o,l.data,l,this);return this.releaseCursor(),o}some(t,n=this){for(let i=this.head;i!==null;i=i.next)if(t.call(n,i.data,i,this))return!0;return!1}map(t,n=this){const i=new G;for(let r=this.head;r!==null;r=r.next)i.appendData(t.call(n,r.data,r,this));return i}filter(t,n=this){const i=new G;for(let r=this.head;r!==null;r=r.next)t.call(n,r.data,r,this)&&i.appendData(r.data);return i}nextUntil(t,n,i=this){if(t===null)return;const r=this.allocateCursor(null,t);for(;r.next!==null;){const o=r.next;if(r.next=o.next,n.call(i,o.data,o,this))break}this.releaseCursor()}prevUntil(t,n,i=this){if(t===null)return;const r=this.allocateCursor(t,null);for(;r.prev!==null;){const o=r.prev;if(r.prev=o.prev,n.call(i,o.data,o,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){const t=new G;for(let n of this)t.appendData(n);return t}prepend(t){return this.updateCursors(null,t,this.head,t),this.head!==null?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(G.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(G.createItem(t))}insert(t,n=null){if(n!==null)if(this.updateCursors(n.prev,t,n,t),n.prev===null){if(this.head!==n)throw new Error("before doesn't belong to list");this.head=t,n.prev=t,t.next=n,this.updateCursors(null,t)}else n.prev.next=t,t.prev=n.prev,n.prev=t,t.next=n;else this.updateCursors(this.tail,t,null,t),this.tail!==null?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,n){return this.insert(G.createItem(t),n)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),t.prev!==null)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(t.next!==null)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(G.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(G.createItem(t))}shift(){return this.head!==null?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,n){return t.head===null?this:(n!=null?(this.updateCursors(n.prev,t.tail,n,t.head),n.prev!==null?(n.prev.next=t.head,t.head.prev=n.prev):this.head=t.head,n.prev=t.tail,t.tail.next=n):(this.updateCursors(this.tail,t.tail,null,t.head),this.tail!==null?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null,this)}replace(t,n){"head"in n?this.insertList(n,t):this.insert(n,t),this.remove(t)}}function Jh(e,t){const n=Object.create(SyntaxError.prototype),i=new Error;return Object.assign(n,{name:e,message:t,get stack(){return(i.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}
|
|
17
|
+
`)}})}const yn=100,$o=60,zo=" ";function No({source:e,line:t,column:n,baseLine:i,baseColumn:r},o){function l(p,m){return s.slice(p,m).map((y,k)=>String(p+k+1).padStart(f)+" |"+y).join(`
|
|
18
|
+
`)}const c=`
|
|
19
|
+
`.repeat(Math.max(i-1,0)),a=" ".repeat(Math.max(r-1,0)),s=(c+a+e).split(/\r\n?|\n|\f/),u=Math.max(1,t-o)-1,h=Math.min(t+o,s.length+1),f=Math.max(4,String(h).length)+1;let d=0;n+=(zo.length-1)*(s[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>yn&&(d=n-$o+3,n=$o-2);for(let p=u;p<=h;p++)p>=0&&p<s.length&&(s[p]=s[p].replace(/\t/g,zo),s[p]=(d>0&&s[p].length>d?"…":"")+s[p].substr(d,yn-2)+(s[p].length>d+yn-1?"…":""));return[l(u,t),new Array(n+f+2).join("-")+"^",l(t,h)].filter(Boolean).join(`
|
|
20
|
+
`).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function Wo(e,t,n,i,r,o=1,l=1){return Object.assign(Jh("SyntaxError",e),{source:t,offset:n,line:i,column:r,sourceFragment(c){return No({source:t,line:i,column:r,baseLine:o,baseColumn:l},isNaN(c)?0:c)},get formattedMessage(){return`Parse error: ${e}
|
|
21
|
+
`+No({source:t,line:i,column:r,baseLine:o,baseColumn:l},2)}})}function Zh(e){const t=this.createList();let n=!1;const i={recognizer:e};for(;!this.eof;){switch(this.tokenType){case Y:this.next();continue;case N:n=!0,this.next();continue}let r=e.getNode.call(this,i);if(r===void 0)break;n&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,r,t,i),n=!1),t.push(r)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,i),t}const Ho=()=>{},tf=33,ef=35,kn=59,Bo=123,Uo=0;function nf(e){return function(){return this[e]()}}function bn(e){const t=Object.create(null);for(const n of Object.keys(e)){const i=e[n],r=i.parse||i;r&&(t[n]=r)}return t}function rf(e){const t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:bn(e.atrule),pseudo:bn(e.pseudo),node:bn(e.node)};for(const[n,i]of Object.entries(e.parseContext))switch(typeof i){case"function":t.context[n]=i;break;case"string":t.context[n]=nf(i);break}return U(U({config:t},t),t.node)}function of(e){let t="",n="<unknown>",i=!1,r=Ho,o=!1;const l=new $l,c=Object.assign(new zl,rf(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Zh,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(a){return a===Bo?1:0},consumeUntilLeftCurlyBracketOrSemicolon(a){return a===Bo||a===kn?1:0},consumeUntilExclamationMarkOrSemicolon(a){return a===tf||a===kn?1:0},consumeUntilSemicolonIncluded(a){return a===kn?2:0},createList(){return new G},createSingleNodeList(a){return new G().appendData(a)},getFirstListNode(a){return a&&a.first},getLastListNode(a){return a&&a.last},parseWithFallback(a,s){const u=this.tokenIndex;try{return a.call(this)}catch(h){if(o)throw h;this.skip(u-this.tokenIndex);const f=s.call(this);return o=!0,r(h,f),o=!1,f}},lookupNonWSType(a){let s;do if(s=this.lookupType(a++),s!==N&&s!==Y)return s;while(s!==Uo);return Uo},charCodeAt(a){return a>=0&&a<t.length?t.charCodeAt(a):0},substring(a,s){return t.substring(a,s)},substrToCursor(a){return this.source.substring(a,this.tokenStart)},cmpChar(a,s){return oi(t,a,s)},cmpStr(a,s,u){return Le(t,a,s,u)},consume(a){const s=this.tokenStart;return this.eat(a),this.substrToCursor(s)},consumeFunctionName(){const a=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(v),a},consumeNumber(a){const s=t.substring(this.tokenStart,si(t,this.tokenStart));return this.eat(a),s},eat(a){if(this.tokenType!==a){const s=ai[a].slice(0,-6).replace(/-/g," ").replace(/^./,f=>f.toUpperCase());let u=`${/[[\](){}]/.test(s)?`"${s}"`:s} is expected`,h=this.tokenStart;switch(a){case g:this.tokenType===v||this.tokenType===Q?(h=this.tokenEnd-1,u="Identifier is expected but function found"):u="Identifier is expected";break;case D:this.isDelim(ef)&&(this.next(),h++,u="Name is expected");break;case $:this.tokenType===S&&(h=this.tokenEnd,u="Percent sign is expected");break}this.error(u,h)}this.next()},eatIdent(a){(this.tokenType!==g||this.lookupValue(0,a)===!1)&&this.error(`Identifier "${a}" is expected`),this.next()},eatDelim(a){this.isDelim(a)||this.error(`Delim "${String.fromCharCode(a)}" is expected`),this.next()},getLocation(a,s){return i?l.getLocationRange(a,s,n):null},getLocationFromList(a){if(i){const s=this.getFirstListNode(a),u=this.getLastListNode(a);return l.getLocationRange(s!==null?s.loc.start.offset-l.startOffset:this.tokenStart,u!==null?u.loc.end.offset-l.startOffset:this.tokenStart,n)}return null},error(a,s){const u=typeof s<"u"&&s<t.length?l.getLocation(s):this.eof?l.getLocation(Rl(t,t.length-1)):l.getLocation(this.tokenStart);throw new Wo(a||"Unexpected input",t,u.offset,u.line,u.column,l.startLine,l.startColumn)}});return Object.assign(function(a,s){t=a,s=s||{},c.setSource(t,di),l.setSource(t,s.offset,s.line,s.column),n=s.filename||"<unknown>",i=!!s.positions,r=typeof s.onParseError=="function"?s.onParseError:Ho,o=!1,c.parseAtrulePrelude="parseAtrulePrelude"in s?!!s.parseAtrulePrelude:!0,c.parseRulePrelude="parseRulePrelude"in s?!!s.parseRulePrelude:!0,c.parseValue="parseValue"in s?!!s.parseValue:!0,c.parseCustomProperty="parseCustomProperty"in s?!!s.parseCustomProperty:!1;const{context:u="default",onComment:h}=s;if(!(u in c.context))throw new Error("Unknown context `"+u+"`");typeof h=="function"&&c.forEachToken((d,p,m)=>{if(d===Y){const y=c.getLocation(p,m),k=Le(t,m-2,m,"*/")?t.slice(p+2,m-2):t.slice(p+2,m);h(k,y)}});const f=c.context[u].call(c,s);return c.eof||c.error(),f},{SyntaxError:Wo,config:c.config})}const sf=35,lf=42,Vo=43,af=45,cf=47,uf=117;function qo(e){switch(this.tokenType){case D:return this.Hash();case ht:return this.Operator();case E:return this.Parentheses(this.readSequence,e.recognizer);case Bt:return this.Brackets(this.readSequence,e.recognizer);case wt:return this.String();case C:return this.Dimension();case $:return this.Percentage();case S:return this.Number();case v:return this.cmpStr(this.tokenStart,this.tokenEnd,"url(")?this.Url():this.Function(this.readSequence,e.recognizer);case Q:return this.Url();case g:return this.cmpChar(this.tokenStart,uf)&&this.cmpChar(this.tokenStart+1,Vo)?this.UnicodeRange():this.Identifier();case L:{const t=this.charCodeAt(this.tokenStart);if(t===cf||t===lf||t===Vo||t===af)return this.Operator();t===sf&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}const hf={getNode:qo},ff=35,df=38,pf=42,mf=43,gf=47,Qo=46,yf=62,kf=124,bf=126;function Sf(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function _f(){switch(this.tokenType){case Bt:return this.AttributeSelector();case D:return this.IdSelector();case X:return this.lookupType(1)===X?this.PseudoElementSelector():this.PseudoClassSelector();case g:return this.TypeSelector();case S:case $:return this.Percentage();case C:this.charCodeAt(this.tokenStart)===Qo&&this.error("Identifier is expected",this.tokenStart+1);break;case L:{switch(this.charCodeAt(this.tokenStart)){case mf:case yf:case bf:case gf:return this.Combinator();case Qo:return this.ClassSelector();case pf:case kf:return this.TypeSelector();case ff:return this.IdSelector();case df:return this.NestingSelector()}break}}}const vf={onWhiteSpace:Sf,getNode:_f};function wf(){return this.createSingleNodeList(this.Raw(null,!1))}function Cf(){const e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===ht){e.push(this.Operator());const t=this.tokenIndex,n=this.parseCustomProperty?this.Value(null):this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1);if(n.type==="Value"&&n.children.isEmpty){for(let i=t-this.tokenIndex;i<=0;i++)if(this.lookupType(i)===N){n.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}e.push(n)}return e}function Xo(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}const xf={getNode:qo,onWhiteSpace(e,t){Xo(e)&&(e.value=" "+e.value),Xo(t.last)&&(t.last.value+=" ")},expression:wf,var:Cf},Lf=Object.freeze(Object.defineProperty({__proto__:null,AtrulePrelude:hf,Selector:vf,Value:xf},Symbol.toStringTag,{value:"Module"})),Af=new Set(["none","and","not","or"]),Pf={parse:{prelude(){const e=this.createList();if(this.tokenType===g){const t=this.substring(this.tokenStart,this.tokenEnd);Af.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}},Tf={parse:{prelude:null,block(){return this.Block(!0)}}};function Sn(e,t){return this.parseWithFallback(()=>{try{return e.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==b&&this.error()}},t||(()=>this.Raw(null,!0)))}const Yo={layer(){this.skipSC();const e=this.createList(),t=Sn.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();const e=this.createList(),t=Sn.call(this,this.Declaration,()=>Sn.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},Ef={parse:{prelude(){const e=this.createList();switch(this.tokenType){case wt:e.push(this.String());break;case Q:case v:e.push(this.Url());break;default:this.error("String or url() is expected")}return this.skipSC(),this.tokenType===g&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer")?e.push(this.Identifier()):this.tokenType===v&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer(")&&e.push(this.Function(null,Yo)),this.skipSC(),this.tokenType===v&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,Yo)),(this.lookupNonWSType(0)===g||this.lookupNonWSType(0)===E)&&e.push(this.MediaQueryList()),e},block:null}},Of={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}},Df={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}},Mf={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},If={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},Rf={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}},jf={parse:{prelude:null,block(e=!1){return this.Block(e)}}},Ff={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}},$f={container:Pf,"font-face":Tf,import:Ef,layer:Of,media:Df,nest:Mf,page:If,scope:Rf,"starting-style":jf,supports:Ff};function zf(){const e=this.createList();this.skipSC();t:for(;!this.eof;){switch(this.tokenType){case g:e.push(this.Identifier());break;case wt:e.push(this.String());break;case ht:e.push(this.Operator());break;case b:break t;default:this.error("Identifier, string or comma is expected")}this.skipSC()}return e}const Mt={parse(){return this.createSingleNodeList(this.SelectorList())}},_n={parse(){return this.createSingleNodeList(this.Selector())}},Nf={parse(){return this.createSingleNodeList(this.Identifier())}},Wf={parse:zf},Ie={parse(){return this.createSingleNodeList(this.Nth())}},Hf={dir:Nf,has:Mt,lang:Wf,matches:Mt,is:Mt,"-moz-any":Mt,"-webkit-any":Mt,where:Mt,not:Mt,"nth-child":Ie,"nth-last-child":Ie,"nth-last-of-type":Ie,"nth-of-type":Ie,slotted:_n,host:_n,"host-context":_n},Bf=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:pi,Atrule:yi,AtrulePrelude:bi,AttributeSelector:vi,Block:Ai,Brackets:Ti,CDC:Oi,CDO:Mi,ClassSelector:Ri,Combinator:$i,Comment:Ni,Condition:Bi,Declaration:Xi,DeclarationList:Gi,Dimension:Ji,Feature:tr,FeatureFunction:nr,FeatureRange:lr,Function:cr,GeneralEnclosed:hr,Hash:dr,IdSelector:yr,Identifier:mr,Layer:br,LayerList:_r,MediaQuery:wr,MediaQueryList:xr,NestingSelector:Ar,Nth:Tr,Number:Or,Operator:Mr,Parentheses:Rr,Percentage:Fr,PseudoClassSelector:zr,PseudoElementSelector:Wr,Ratio:Vr,Raw:Qr,Rule:Gr,Scope:Jr,Selector:to,SelectorList:no,String:so,StyleSheet:co,SupportsDeclaration:ho,TypeSelector:mo,UnicodeRange:bo,Url:vo,Value:Co,WhiteSpace:Lo},Symbol.toStringTag,{value:"Module"})),Uf={parseContext:{default:"StyleSheet",stylesheet:"StyleSheet",atrule:"Atrule",atrulePrelude(e){return this.AtrulePrelude(e.atrule?String(e.atrule):null)},mediaQueryList:"MediaQueryList",mediaQuery:"MediaQuery",condition(e){return this.Condition(e.kind)},rule:"Rule",selectorList:"SelectorList",selector:"Selector",block(){return this.Block(!0)},declarationList:"DeclarationList",declaration:"Declaration",value:"Value"},features:{supports:{selector(){return this.Selector()}},container:{style(){return this.Declaration()}}},scope:Lf,atrule:$f,pseudo:Hf,node:Bf},Vf=of(Uf);function Re(e){const t={};for(const n of Object.keys(e)){let i=e[n];i&&(Array.isArray(i)||i instanceof G?i=i.map(Re):i.constructor===Object&&(i=Re(i))),t[n]=i}return t}let qf="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",dt=(e=21)=>{let t="",n=e|0;for(;n--;)t+=qf[Math.random()*64|0];return t};const Go=dt(),ae=new Set;function je(e){return!!(e&&e.type==="Function"&&e.name==="anchor")}function Pt(e,t=!1){return Vf(e,{parseAtrulePrelude:!1,parseCustomProperty:!0,onParseError:n=>{t&&ae.add(n)}})}function tt(e){return Kh(e,{mode:"spec"})}function Qf(e){return e.type==="Declaration"}function Xf(e){return e.toArray().reduce((t,n)=>n.type==="Operator"&&n.value===","?(t.push([]),t):(n.type==="Identifier"&&t[t.length-1].push(n),t),[[]])}function vn(e){return e?e.children.map(t=>{var n;let i;((n=t.children.last)==null?void 0:n.type)==="PseudoElementSelector"&&(t=Re(t),i=tt(t.children.last),t.children.pop());const r=tt(t);return{selector:r+(i??""),elementPart:r,pseudoElementPart:i}}).toArray():[]}function Yf(){ae.size>0&&(console.group(`The CSS anchor positioning polyfill was not applied due to ${ae.size===1?"a CSS parse error":"CSS parse errors"}.`),ae.forEach(e=>{console.warn(e.formattedMessage)}),console.groupEnd())}function Gf(){ae.clear()}const wn=[...Eo,"anchor-scope","anchor-name"].reduce((e,t)=>(e[t]=`--${t}-${Go}`,e),{});function Kf(e,t){return Qf(e)&&wn[e.property]&&t?(t.children.appendData(J(U({},e),{property:wn[e.property]})),{updated:!0}):{}}function Jf(e){for(const t of e){let n=!1;const i=Pt(t.css,!0);At(i,{visit:"Declaration",enter(r){var o;const l=(o=this.rule)==null?void 0:o.block,{updated:c}=Kf(r,l);c&&(n=!0)}}),n&&(t.css=tt(i),t.changed=!0)}return e.some(t=>t.changed===!0)}var Ko=(e=>(e.All="all",e.None="none",e))(Ko||{});function st(e,t){var n;return t=(n=wn[t])!=null?n:t,(e instanceof HTMLElement?getComputedStyle(e):e.computedStyle).getPropertyValue(t).trim()}function Gt(e,t,n){return st(e,t)===n}function Zf(e,{selector:t,pseudoElementPart:n}){const i=getComputedStyle(e,n),r=document.createElement("div"),o=document.createElement("style");r.id=`fake-pseudo-element-${dt()}`;for(const c of Array.from(i)){const a=i.getPropertyValue(c);r.style.setProperty(c,a)}o.textContent+=`#${r.id}${n} { content: ${i.content}; }`,o.textContent+=`${t} { display: none !important; }`,document.head.append(o);const l=n==="::before"?"afterbegin":"beforeend";return e.insertAdjacentElement(l,r),{fakePseudoElement:r,sheet:o,computedStyle:i}}function td(e){let t=e;for(;t;){if(Gt(t,"overflow","scroll"))return t;t=t.parentElement}return t}function ed(e){let t=td(e);return t===document.documentElement&&(t=null),t??{scrollTop:0,scrollLeft:0}}function nd(e,t){const{elementPart:n,pseudoElementPart:i}=e,r=[];if(i&&!(i==="::before"||i==="::after"))return r;const o=ce(t.roots,n);if(!i)return r.push(...o),r;for(const l of o){const{fakePseudoElement:c,sheet:a,computedStyle:s}=Zf(l,e),u=c.getBoundingClientRect(),{scrollY:h,scrollX:f}=globalThis,d=ed(l);r.push({fakePseudoElement:c,computedStyle:s,removeFakePseudoElement(){c.remove(),a.remove()},contextElement:l,getBoundingClientRect(){const{scrollY:p,scrollX:m}=globalThis,{scrollTop:y,scrollLeft:k}=d;return DOMRect.fromRect({y:u.y+(h-p)+(d.scrollTop-y),x:u.x+(f-m)+(d.scrollLeft-k),width:u.width,height:u.height})}})}return r}function id(e,t){const n=st(e,"anchor-name");return t?n.split(",").map(i=>i.trim()).includes(t):!n}function rd(e,t){const n=st(e,"anchor-scope");return n===t||n==="all"}const Cn=e=>T(null,null,function*(){var t,n,i;let r=yield(t=nt.getOffsetParent)==null?void 0:t.call(nt,e);return(yield(n=nt.isElement)==null?void 0:n.call(nt,r))||(r=(yield(i=nt.getDocumentElement)==null?void 0:i.call(nt,e))||window.document.documentElement),r}),ce=(e,t)=>e.flatMap(n=>[...n.querySelectorAll(t)]),Jo="InvalidMimeType";function od(e){return!!((e.type==="text/css"||e.rel==="stylesheet")&&e.href)}function sd(e){const t=new URL(e.href,document.baseURI);if(od(e)&&t.origin===location.origin)return t}function ld(e){return T(this,null,function*(){return(yield Promise.all(e.map(t=>T(null,null,function*(){var n;if(!t.url)return t;if((n=t.el)!=null&&n.disabled)return null;try{const i=yield fetch(t.url.toString()),r=i.headers.get("content-type");if(!(r!=null&&r.startsWith("text/css"))){const l=new Error(`Error loading ${t.url}: expected content-type "text/css", got "${r}".`);throw l.name=Jo,l}const o=yield i.text();return J(U({},t),{css:o})}catch(i){if(i instanceof Error&&i.name===Jo)return console.warn(i),null;throw i}})))).filter(t=>t!==null)})}const Zo='[style*="anchor"]',ts='[style*="position-area"]';function ad(e){const t=e?e.filter(i=>i instanceof HTMLElement&&(i.matches(Zo)||i.matches(ts))):Array.from(document.querySelectorAll([Zo,ts].join(","))),n=[];return t.filter(i=>i instanceof HTMLElement).forEach(i=>{const r=dt(12),o="data-has-inline-styles";i.setAttribute(o,r);const l=i.getAttribute("style"),c=`[${o}="${r}"] { ${l} }`;n.push({el:i,css:c})}),n}function cd(e){return T(this,null,function*(){var t,n;const i=(t=e.elements)!=null?t:ce(e.roots,"link, style"),r=[];i.filter(c=>c instanceof HTMLElement).forEach(c=>{if(c.tagName.toLowerCase()==="link"){const a=sd(c);a&&r.push({el:c,url:a})}c.tagName.toLowerCase()==="style"&&r.push({el:c,css:c.innerHTML})});const o=e.excludeInlineStyles?(n=e.elements)!=null?n:[]:void 0,l=ad(o);return yield ld([...r,...l])})}const ud="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let es=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=ud[n[e]&63];return t};const ns="--pa-cascade-property",is="data-anchor-position-wrapper",rs="data-pa-wrapper-for-",os="POLYFILL-POSITION-AREA",hd=["left","center","right","span-left","span-right","x-start","x-end","span-x-start","span-x-end","x-self-start","x-self-end","span-x-self-start","span-x-self-end","span-all","top","bottom","span-top","span-bottom","y-start","y-end","span-y-start","span-y-end","y-self-start","y-self-end","span-y-self-start","span-y-self-end","block-start","block-end","span-block-start","span-block-end","inline-start","inline-end","span-inline-start","span-inline-end","self-block-start","self-block-end","span-self-block-start","span-self-block-end","self-inline-start","self-inline-end","span-self-inline-start","span-self-inline-end","start","end","span-start","span-end","self-start","self-end","span-self-start","span-self-end"];function ss(e){return hd.includes(e)}const ls={left:[0,1,"Irrelevant"],center:[1,2,"Irrelevant"],right:[2,3,"Irrelevant"],"span-left":[0,2,"Irrelevant"],"span-right":[1,3,"Irrelevant"],"x-start":[0,1,"Physical"],"x-end":[2,3,"Physical"],"span-x-start":[0,2,"Physical"],"span-x-end":[1,3,"Physical"],"x-self-start":[0,1,"PhysicalSelf"],"x-self-end":[2,3,"PhysicalSelf"],"span-x-self-start":[0,2,"PhysicalSelf"],"span-x-self-end":[1,3,"PhysicalSelf"],"span-all":[0,3,"Irrelevant"],top:[0,1,"Irrelevant"],bottom:[2,3,"Irrelevant"],"span-top":[0,2,"Irrelevant"],"span-bottom":[1,3,"Irrelevant"],"y-start":[0,1,"Physical"],"y-end":[2,3,"Physical"],"span-y-start":[0,2,"Physical"],"span-y-end":[1,3,"Physical"],"y-self-start":[0,1,"PhysicalSelf"],"y-self-end":[2,3,"PhysicalSelf"],"span-y-self-start":[0,2,"PhysicalSelf"],"span-y-self-end":[1,3,"PhysicalSelf"],"block-start":[0,1,"Logical"],"block-end":[2,3,"Logical"],"span-block-start":[0,2,"Logical"],"span-block-end":[1,3,"Logical"],"inline-start":[0,1,"Logical"],"inline-end":[2,3,"Logical"],"span-inline-start":[0,2,"Logical"],"span-inline-end":[1,3,"Logical"],"self-block-start":[0,1,"LogicalSelf"],"self-block-end":[2,3,"LogicalSelf"],"span-self-block-start":[0,2,"LogicalSelf"],"span-self-block-end":[1,3,"LogicalSelf"],"self-inline-start":[0,1,"LogicalSelf"],"self-inline-end":[2,3,"LogicalSelf"],"span-self-inline-start":[0,2,"LogicalSelf"],"span-self-inline-end":[1,3,"LogicalSelf"],start:[0,1,"Logical"],end:[2,3,"Logical"],"span-start":[0,2,"Logical"],"span-end":[1,3,"Logical"],"self-start":[0,1,"LogicalSelf"],"self-end":[2,3,"LogicalSelf"],"span-self-start":[0,2,"LogicalSelf"],"span-self-end":[1,3,"LogicalSelf"]},fd=["left","center","right","span-left","span-right","x-start","x-end","span-x-start","span-x-end","x-self-start","x-self-end","span-x-self-start","span-x-self-end","span-all"],dd=["top","center","bottom","span-top","span-bottom","y-start","y-end","span-y-start","span-y-end","y-self-start","y-self-end","span-y-self-start","span-y-self-end","span-all"],pd=["block-start","center","block-end","span-block-start","span-block-end","span-all"],md=["inline-start","center","inline-end","span-inline-start","span-inline-end","span-all"],gd=["self-block-start","center","self-block-end","span-self-block-start","span-self-block-end","span-all"],yd=["self-inline-start","center","self-inline-end","span-self-inline-start","span-self-inline-end","span-all"],as=["start","center","end","span-start","span-end","span-all"],cs=["self-start","center","self-end","span-self-start","span-self-end","span-all"],kd=["block","top","bottom","y"],bd=["inline","left","right","x"];function xn(e){const t=e.split("-");for(const n of t){if(kd.includes(n))return"block";if(bd.includes(n))return"inline"}return"ambiguous"}function Sd(e,t){return t[0].includes(e[0])&&t[1].includes(e[1])||t[0].includes(e[1])&&t[1].includes(e[0])}const _d=[[fd,dd],[pd,md],[gd,yd],[as,as],[cs,cs]];function vd(e){for(const t of _d)if(Sd(e,t))return!0;return!1}const us=e=>{const t=getComputedStyle(e);return{writingMode:t.writingMode,direction:t.direction}},wd=(e,t)=>T(null,null,function*(){const n=yield Cn(e);switch(t){case"Logical":case"Physical":return us(n);case"LogicalSelf":case"PhysicalSelf":return us(e);default:return null}}),Ln=e=>e.reverse().map(t=>3-t),hs=(e,t)=>e==="Irrelevant"?t:e,Cd=(e,t)=>T(null,[e,t],function*({block:n,inline:i},r){const o=hs(n[2],i[2]),l=yield wd(r,o),c={block:[n[0],n[1]],inline:[i[0],i[1]]};if(l){if(l.direction==="rtl"&&(c.inline=Ln(c.inline)),l.writingMode.startsWith("vertical")){const a=c.block;c.block=c.inline,c.inline=a}if(l.writingMode.startsWith("sideways")){const a=c.block;c.block=c.inline,c.inline=a,l.writingMode.endsWith("lr")&&(c.block=Ln(c.block))}l.writingMode.endsWith("rl")&&(c.inline=Ln(c.inline))}return c}),xd=({block:e,inline:t})=>{const n=[0,"top","bottom",0],i=[0,"left","right",0];return{block:[n[e[0]],n[e[1]]],inline:[i[t[0]],i[t[1]]]}};function fs([e,t]){return e===0&&t===3?"center":e===0?"end":t===3?"start":"center"}function Ld(e){return e.type==="Declaration"&&e.property==="position-area"}function Ad(e){const t=e.value.children.toArray().map(({name:n})=>n);return t.length===1&&(xn(t[0])==="ambiguous"?t.push(t[0]):t.push("span-all")),t}function Pd(e){if(!Ld(e))return;const t=Ad(e);if(!vd(t))return;const n={};switch(xn(t[0])){case"block":n.block=t[0],n.inline=t[1];break;case"inline":n.inline=t[0],n.block=t[1];break;case"ambiguous":xn(t[1])=="block"?(n.block=t[1],n.inline=t[0]):(n.inline=t[1],n.block=t[0]);break}const i={block:ls[n.block],inline:ls[n.inline]},r=`--pa-declaration-${es(12)}`;return{values:n,grid:i,selectorUUID:r}}function Td(e,t){["justify-self","align-self"].forEach(n=>{t.children.appendData({type:"Declaration",property:n,value:{type:"Raw",value:`var(--pa-value-${n})`},important:!1})}),t.children.appendData({type:"Declaration",property:ns,value:{type:"Raw",value:e.selectorUUID},important:!1})}function Ed(e,t){var n,i;let r;if(((n=e.parentElement)==null?void 0:n.tagName)===os)r=e.parentElement;else{r=document.createElement(os),r.style.display="grid",r.style.position="absolute";const o=getComputedStyle(e).pointerEvents;r.style.pointerEvents="none",e.style.pointerEvents=o,["top","left","right","bottom"].forEach(l=>{r.style.setProperty(l,`var(--pa-value-${l})`)}),(i=e.parentElement)==null||i.insertBefore(r,e),r.appendChild(e)}return r.setAttribute(`${rs}${t}`,""),r}function Od(e,t,n){return T(this,null,function*(){const i=`--pa-target-${es(12)}`,r=yield Cd(t.grid,e),o=xd(r),l=hs(t.grid.block[2],t.grid.inline[2]),c=["LogicalSelf","PhysicalSelf"].includes(l)?r:t.grid,a={block:fs([c.block[0],c.block[1]]),inline:fs([c.inline[0],c.inline[1]])};return{insets:o,alignments:a,targetUUID:i,targetEl:e,anchorEl:n,wrapperEl:Ed(e,i),values:t.values,grid:t.grid,selectorUUID:t.selectorUUID}})}function Dd(e,t){return`
|
|
22
|
+
[${is}="${t}"][${rs}${e}] {
|
|
23
|
+
--pa-value-top: var(${e}-top);
|
|
24
|
+
--pa-value-left: var(${e}-left);
|
|
25
|
+
--pa-value-right: var(${e}-right);
|
|
26
|
+
--pa-value-bottom: var(${e}-bottom);
|
|
27
|
+
--pa-value-justify-self: var(${e}-justify-self);
|
|
28
|
+
--pa-value-align-self: var(${e}-align-self);
|
|
29
|
+
}
|
|
30
|
+
`.replaceAll(`
|
|
31
|
+
`,"")}const Md=["normal","most-width","most-height","most-block-size","most-inline-size"],Id=["flip-block","flip-inline","flip-start"];function Rd(e){return e.type==="Declaration"}function jd(e){return e.type==="Declaration"&&e.property==="position-try-fallbacks"}function Fd(e){return e.type==="Declaration"&&e.property==="position-try-order"}function $d(e){return e.type==="Declaration"&&e.property==="position-try"}function zd(e){return e.type==="Atrule"&&e.name==="position-try"}function Nd(e){return Id.includes(e)}function Wd(e){return Md.includes(e)}function Hd(e,t){const n=document.querySelector(e);if(n){let i=Ud(n);return t.forEach(r=>{i=ds(i,r)}),i}}function Bd(e,t){let n=e.declarations;return t.forEach(i=>{n=ds(n,i)}),n}function Ud(e){const t={};return Eo.forEach(n=>{const i=st(e,`--${n}-${Go}`);i&&(t[n]=i)}),t}const Vd={"flip-block":{top:"bottom",bottom:"top","inset-block-start":"inset-block-end","inset-block-end":"inset-block-start","margin-top":"margin-bottom","margin-bottom":"margin-top"},"flip-inline":{left:"right",right:"left","inset-inline-start":"inset-inline-end","inset-inline-end":"inset-inline-start","margin-left":"margin-right","margin-right":"margin-left"},"flip-start":{left:"top",right:"bottom",top:"left",bottom:"right","inset-block-start":"inset-block-end","inset-block-end":"inset-block-start","inset-inline-start":"inset-inline-end","inset-inline-end":"inset-inline-start","inset-block":"inset-inline","inset-inline":"inset-block"}},qd={"flip-block":{top:"bottom",bottom:"top",start:"end",end:"start","self-end":"self-start","self-start":"self-end"},"flip-inline":{left:"right",right:"left",start:"end",end:"start","self-end":"self-start","self-start":"self-end"},"flip-start":{top:"left",left:"top",right:"bottom",bottom:"right"}},Qd={"flip-block":{top:"bottom",bottom:"top",start:"end",end:"start"},"flip-inline":{left:"right",right:"left",start:"end",end:"start"},"flip-start":{}};function Xd(e,t){return Vd[t][e]||e}function Yd(e,t){return qd[t][e]||e}function Gd(e,t){if(t==="flip-start")return e;{const n=Qd[t];return e.split("-").map(i=>n[i]||i).join("-")}}function Kd(e,t,n){if(e==="margin"){const[i,r,o,l]=t.children.toArray();n==="flip-block"?l?t.children.fromArray([o,r,i,l]):o&&t.children.fromArray([o,r,i]):n==="flip-inline"&&l&&t.children.fromArray([i,l,o,r])}else if(e==="margin-block"){const[i,r]=t.children.toArray();n==="flip-block"&&r&&t.children.fromArray([r,i])}else if(e==="margin-inline"){const[i,r]=t.children.toArray();n==="flip-inline"&&r&&t.children.fromArray([r,i])}}const Jd=(e,t)=>{var n;return((n=Pt(`#id{${e}: ${t};}`).children.first)==null?void 0:n.block.children.first).value};function ds(e,t){const n={};return Object.entries(e).forEach(([i,r])=>{const o=i,l=Jd(o,r),c=Xd(o,t);c!==o&&(n[o]!=null||(n[o]="revert")),At(l,{visit:"Function",enter(a){je(a)&&a.children.forEach(s=>{ue(s)&&Do(s.name)&&(s.name=Yd(s.name,t))})}}),o==="position-area"&&l.children.forEach(a=>{ue(a)&&ss(a.name)&&(a.name=Gd(a.name,t))}),o.startsWith("margin")&&Kd(o,l,t),n[c]=tt(l)}),n}function ps(e){const t=Xf(e),n=[];return t.forEach(i=>{const r={atRules:[],tactics:[],positionAreas:[]};i.forEach(o=>{Nd(o.name)?r.tactics.push(o.name):o.name.startsWith("--")?r.atRules.push(o.name):ss(o.name)&&r.positionAreas.push(o.name)}),r.positionAreas.length?n.push({positionArea:r.positionAreas[0],type:"position-area"}):r.atRules.length&&r.tactics.length?n.push({tactics:r.tactics,atRule:r.atRules[0],type:"at-rule-with-try-tactic"}):r.atRules.length?n.push({atRule:r.atRules[0],type:"at-rule"}):r.tactics.length&&n.push({tactics:r.tactics,type:"try-tactic"})}),n}function Zd(e){return jd(e)&&e.value.children.first?ps(e.value.children):[]}function tp(e){if($d(e)&&e.value.children.first){const t=Re(e);let n;const i=t.value.children.first.name;i&&Wd(i)&&(n=i,t.value.children.shift());const r=ps(t.value.children);return{order:n,options:r}}return{}}function ep(e){return Fd(e)&&e.value.children.first?{order:e.value.children.first.name}:{}}function np(e){const{order:t,options:n}=tp(e);if(t||n)return{order:t,options:n};const{order:i}=ep(e),r=Zd(e);return i||r?{order:i,options:r}:{}}function ip(e){return le(e.property)||Ih(e.property)||Po(e.property)||Rh(e.property)||["position-anchor","position-area"].includes(e.property)}function rp(e){var t,n;if(zd(e)&&(t=e.prelude)!=null&&t.value&&(n=e.block)!=null&&n.children){const i=e.prelude.value,r=e.block.children.filter(l=>Rd(l)&&ip(l)),o={uuid:`${i}-try-${dt(12)}`,declarations:Object.fromEntries(r.map(l=>[l.property,tt(l.value)]))};return{name:i,tryBlock:o}}return{}}function op(e){const t={},n={},i={};for(const r of e){const o=Pt(r.css);At(o,{visit:"Atrule",enter(l){const{name:c,tryBlock:a}=rp(l);c&&a&&(t[c]=a)}})}for(const r of e){let o=!1;const l=new Set,c=Pt(r.css);At(c,{visit:"Declaration",enter(a){var s;const u=(s=this.rule)==null?void 0:s.prelude,h=vn(u);if(!h.length)return;const{order:f,options:d}=np(a),p={};f&&(p.order=f),h.forEach(({selector:m})=>{var y;d?.forEach(k=>{var x;let w;if(k.type==="at-rule")w=k.atRule;else if(k.type==="try-tactic"){w=`${m}-${k.tactics.join("-")}`;const A=Hd(m,k.tactics);A&&(t[w]={uuid:`${m}-${k.tactics.join("-")}-try-${dt(12)}`,declarations:A})}else if(k.type==="at-rule-with-try-tactic"){w=`${m}-${k.atRule}-${k.tactics.join("-")}`;const A=t[k.atRule],pt=Bd(A,k.tactics);pt&&(t[w]={uuid:`${m}-${k.atRule}-${k.tactics.join("-")}-try-${dt(12)}`,declarations:pt})}if(w&&t[w]){const A=`[data-anchor-polyfill="${t[w].uuid}"]`;n[A]!=null||(n[A]=[]),n[A].push(m),l.has(w)||(p.fallbacks!=null||(p.fallbacks=[]),p.fallbacks.push(t[w]),l.add(w),(x=this.stylesheet)==null||x.children.prependData({type:"Rule",prelude:{type:"Raw",value:A},block:{type:"Block",children:new G().fromArray(Object.entries(t[w].declarations).map(([pt,_])=>({type:"Declaration",important:!0,property:pt,value:{type:"Raw",value:_}})))}}),o=!0)}}),Object.keys(p).length>0&&(i[m]?(p.order&&(i[m].order=p.order),p.fallbacks&&((y=i[m]).fallbacks!=null||(y.fallbacks=[]),i[m].fallbacks.push(...p.fallbacks))):i[m]=p)})}}),o&&(r.css=tt(c),r.changed=!0)}return{fallbackTargets:n,validPositions:i}}function sp(e,t){return!e||e===t?!1:ms(e)?e.document.contains(t):e.contains(t)}function ms(e){return!!(e&&e===e.window)}function lp(e){return Gt(e,"position","fixed")}function An(e){return!!(e&&(lp(e)||Gt(e,"position","absolute")))}function gs(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING}function ap(e){return T(this,null,function*(){return yield nt.getOffsetParent(e)})}function Pn(e){return T(this,null,function*(){if(!["absolute","fixed"].includes(st(e,"position")))return yield ap(e);let t=e.parentElement;for(;t;){if(!Gt(t,"position","static")&&Gt(t,"display","block"))return t;t=t.parentElement}return window})}function cp(e,t,n,i){return T(this,null,function*(){const r=yield Pn(e),o=yield Pn(n);if(!(sp(o,e)||ms(o))||r===o&&!(!An(e)||gs(e,n)))return!1;if(r!==o){let l;const c=[];for(l=r;l&&l!==o&&l!==window;)c.push(l),l=yield Pn(l);const a=c[c.length-1];if(a instanceof HTMLElement&&!(!An(a)||gs(a,n)))return!1}{let l=e.parentElement;for(;l;){if(Gt(l,"content-visibility","hidden"))return!1;l=l.parentElement}}return!(t&&i&&ys(e,t,i)!==ys(n,t,i))})}function ys(e,t,n){for(;!(e.matches(n)&&rd(e,t));){if(!e.parentElement)return null;e=e.parentElement}return e}function up(e,t,n,i,r){return T(this,null,function*(){if(!(e instanceof HTMLElement&&n.length&&An(e)))return null;const o=n.flatMap(c=>nd(c,r)).filter(c=>id(c,t)),l=i.map(c=>c.selector).join(",")||null;for(let c=o.length-1;c>=0;c--){const a=o[c],s="fakePseudoElement"in a;if(yield cp(s?a.fakePseudoElement:a,t,e,l))return s&&a.removeFakePseudoElement(),a}return null})}function hp(e){return e.type==="Declaration"&&e.property==="anchor-name"}function fp(e){return e.type==="Declaration"&&e.property==="anchor-scope"}function Tn(e){return!!(e&&e.type==="Function"&&e.name==="anchor-size")}function Fe(e){return!!(e&&e.type==="Function"&&e.name==="var")}function ue(e){return!!(e.type==="Identifier"&&e.name)}function dp(e){return!!(e.type==="Percentage"&&e.value)}function ks(e,t){let n,i,r,o="",l=!1,c;const a=[];e.children.toArray().forEach(f=>{if(l){o=`${o}${tt(f)}`;return}if(f.type==="Operator"&&f.value===","){l=!0;return}a.push(f)});let[s,u]=a;if(u||(u=s,s=void 0),s&&(ue(s)&&s.name.startsWith("--")?n=s.name:Fe(s)&&s.children.first&&(c=s.children.first.name)),u)if(je(e)){if(ue(u)&&Do(u.name))i=u.name;else if(dp(u)){const f=Number(u.value);i=Number.isNaN(f)?void 0:f}}else Tn(e)&&ue(u)&&zh(u.name)&&(r=u.name);const h=`--anchor-${dt(12)}`;return Object.assign(e,{type:"Raw",value:`var(${h})`,children:null}),Reflect.deleteProperty(e,"name"),{anchorName:n,anchorSide:i,anchorSize:r,fallbackValue:o||"0px",customPropName:c,uuid:h}}function bs(e){return e.value.children.map(({name:t})=>t)}let he={},It={},Rt={},fe={},jt={};function pp(){he={},It={},Rt={},fe={},jt={}}function mp(e,t){var n;if((je(e)||Tn(e))&&t){if(t.property.startsWith("--")){const i=tt(t.value),r=ks(e);return fe[r.uuid]=i,Rt[t.property]=[...(n=Rt[t.property])!=null?n:[],r],{changed:!0}}if(je(e)&&le(t.property)||Tn(e)&&Oo(t.property)){const i=ks(e);return{prop:t.property,data:i,changed:!0}}}return{}}function Ss(e,t,n){return T(this,null,function*(){let i=t?.anchorName;const r=t?.customPropName;if(e&&!i){const a=st(e,"position-anchor");a?i=a:r&&(i=st(e,r))}const o=i?he[i]||[]:[],l=i?It[Ko.All]||[]:[],c=i?It[i]||[]:[];return yield up(e,i||null,o,[...l,...c],{roots:n.roots})})}function gp(e,t){return T(this,null,function*(){var n,i,r,o,l,c,a,s,u,h,f;const d={},p={};pp();const{fallbackTargets:m,validPositions:y}=op(e);for(const _ of e){let I=!1;const W=Pt(_.css);At(W,function(P){var H,R,O,V;const M=(H=this.rule)==null?void 0:H.prelude,j=vn(M);if(hp(P)&&j.length)for(const F of bs(P))he[F]!=null||(he[F]=[]),he[F].push(...j);if(fp(P)&&j.length)for(const F of bs(P))It[F]!=null||(It[F]=[]),It[F].push(...j);const{prop:K,data:vt,changed:Ft}=mp(P,this.declaration);if(K&&vt&&j.length)for(const{selector:F}of j)d[F]=J(U({},d[F]),{[K]:[...(O=(R=d[F])==null?void 0:R[K])!=null?O:[],vt]});let q;if(this.block&&(q=Pd(P),q)){Td(q,this.block);for(const{selector:F}of j)p[F]=[...(V=p[F])!=null?V:[],q]}(Ft||q)&&(I=!0)}),I&&(_.css=tt(W),_.changed=!0)}const k=new Set(Object.keys(Rt)),x={},w=_=>{var I,W,P,H,R;const O=[],V=new Set((W=(I=x[_])==null?void 0:I.names)!=null?W:[]);for(;V.size>0;)for(const M of V)O.push(...(P=Rt[M])!=null?P:[]),V.delete(M),(R=(H=x[M])==null?void 0:H.names)!=null&&R.length&&x[M].names.forEach(j=>V.add(j));return O};for(;k.size>0;){const _=[];for(const I of e){let W=!1;const P=Pt(I.css);At(P,{visit:"Function",enter(H){var R,O;const V=(R=this.rule)==null?void 0:R.prelude,M=this.declaration,j=M?.property;if(V?.children.isEmpty===!1&&Fe(H)&&M&&j&&H.children.first&&k.has(H.children.first.name)&&j.startsWith("--")){const K=H.children.first,vt=(O=Rt[K.name])!=null?O:[],Ft=w(K.name);if(!(vt.length||Ft.length))return;const q=`${K.name}-anchor-${dt(12)}`,F=tt(M.value);fe[q]=F,x[j]||(x[j]={names:[],uuids:[]});const Kt=x[j];Kt.names.includes(K.name)||Kt.names.push(K.name),Kt.uuids.push(q),_.push(j),K.name=q,W=!0}}}),W&&(I.css=tt(P),I.changed=!0)}k.clear(),_.forEach(I=>k.add(I))}for(const _ of e){let I=!1;const W=Pt(_.css);At(W,{visit:"Function",enter(P){var H,R,O,V,M,j,K;const vt=(H=this.rule)==null?void 0:H.prelude,Ft=this.declaration,q=Ft?.property;if(vt?.children.isEmpty===!1&&Fe(P)&&Ft&&q&&P.children.first&&(le(q)||Po(q))){const F=P.children.first,Kt=(R=Rt[F.name])!=null?R:[],On=w(F.name);if(!(Kt.length||On.length))return;const ze=`${q}-${dt(12)}`;if(On.length){const Jt=new Set([F.name]);for(;Jt.size>0;)for(const Zt of Jt){const lt=x[Zt];if((O=lt?.names)!=null&&O.length&&(V=lt?.uuids)!=null&&V.length)for(const te of lt.names)for(const ee of lt.uuids)jt[ee]=J(U({},jt[ee]),{[ze]:`${te}-${ze}`});Jt.delete(Zt),(M=lt?.names)!=null&&M.length&<.names.forEach(te=>Jt.add(te))}}const Op=vn(vt);for(const Jt of[...Kt,...On]){const Zt=U({},Jt),lt=`--anchor-${dt(12)}-${q}`,te=Zt.uuid;Zt.uuid=lt;for(const{selector:ee}of Op)d[ee]=J(U({},d[ee]),{[q]:[...(K=(j=d[ee])==null?void 0:j[q])!=null?K:[],Zt]});jt[te]=J(U({},jt[te]),{[ze]:lt})}F.name=`${F.name}-${ze}`,I=!0}}}),I&&(_.css=tt(W),_.changed=!0)}if(Object.keys(jt).length>0)for(const _ of e){let I=!1;const W=Pt(_.css);At(W,{visit:"Function",enter(P){var H,R,O,V;if(Fe(P)&&(R=(H=P.children.first)==null?void 0:H.name)!=null&&R.startsWith("--")&&(V=(O=this.declaration)==null?void 0:O.property)!=null&&V.startsWith("--")&&this.block){const M=P.children.first,j=jt[M.name];if(j)for(const[K,vt]of Object.entries(j))this.block.children.appendData({type:"Declaration",important:!1,property:`${this.declaration.property}-${K}`,value:{type:"Raw",value:tt(this.declaration.value).replace(`var(${M.name})`,`var(${vt})`)}}),I=!0;fe[M.name]&&(this.declaration.value={type:"Raw",value:fe[M.name]},I=!0)}}}),I&&(_.css=tt(W),_.changed=!0)}const A=new Map;for(const[_,I]of Object.entries(d)){let W;_.startsWith("[data-anchor-polyfill=")&&(n=m[_])!=null&&n.length?W=ce(t.roots,m[_].join(",")):W=ce(t.roots,_);for(const[P,H]of Object.entries(I))for(const R of H)for(const O of W){const V=yield Ss(O,R,{roots:t.roots}),M=`--anchor-${dt(12)}`;A.set(O,J(U({},(i=A.get(O))!=null?i:{}),{[R.uuid]:M})),O.setAttribute("style",`${R.uuid}: var(${M}); ${(r=O.getAttribute("style"))!=null?r:""}`),y[_]=J(U({},y[_]),{declarations:J(U({},(o=y[_])==null?void 0:o.declarations),{[P]:[...(a=(c=(l=y[_])==null?void 0:l.declarations)==null?void 0:c[P])!=null?a:[],J(U({},R),{anchorEl:V,targetEl:O,uuid:M})]})})}}const pt={el:document.createElement("link"),changed:!1,created:!0,css:""};e.push(pt);for(const[_,I]of Object.entries(p)){const W=ce(t.roots,_);for(const P of W){const H=yield Ss(P,null,{roots:t.roots});for(const R of I){const O=yield Od(P,R,H);pt.css+=Dd(O.targetUUID,R.selectorUUID),pt.changed=!0,y[_]=J(U({},y[_]),{declarations:J(U({},(s=y[_])==null?void 0:s.declarations),{"position-area":[...(f=(h=(u=y[_])==null?void 0:u.declarations)==null?void 0:h["position-area"])!=null?f:[],O]})})}}}return{rules:y,inlineStyles:A,anchorScopes:It}})}const yp=["as","blocking","crossorigin","disabled","fetchpriority","href","hreflang","integrity","referrerpolicy","rel","type"];function _s(e,t,n=!1){const i=[];for(const{el:r,css:o,changed:l,created:c=!1}of e){const a={el:r,css:o,changed:!1};if(l){if(r.tagName.toLowerCase()==="style")r.innerHTML=o;else if(r instanceof HTMLLinkElement){const s=document.createElement("style");s.textContent=o;for(const u of r.getAttributeNames())if(!u.startsWith("on")&&!yp.includes(u)){const h=r.getAttribute(u);h!==null&&s.setAttribute(u,h)}r.hasAttribute("href")&&s.setAttribute("data-original-href",r.getAttribute("href")),c?(s.setAttribute("data-generated-by-polyfill","true"),document.head.insertAdjacentElement("beforeend",s)):(r.insertAdjacentElement("beforebegin",s),r.remove()),a.el=s}else if(r.hasAttribute("data-has-inline-styles")){const s=r.getAttribute("data-has-inline-styles");if(s){const u=`[data-has-inline-styles="${s}"]{`;let h=o.slice(u.length,-1);const f=t?.get(r);if(f)for(const[d,p]of Object.entries(f))h=`${d}: var(${p}); ${h}`;r.setAttribute("style",h)}}}n&&r.hasAttribute("data-has-inline-styles")&&r.removeAttribute("data-has-inline-styles"),i.push(a)}return i}const kp=J(U({},nt),{_c:new Map}),bp=(e,t)=>{let n;switch(e){case"start":case"self-start":n=0;break;case"end":case"self-end":n=100;break;default:typeof e=="number"&&!Number.isNaN(e)&&(n=e)}if(n!==void 0)return t?100-n:n},Sp=(e,t)=>{let n;switch(e){case"block":case"self-block":n=t?"width":"height";break;case"inline":case"self-inline":n=t?"height":"width";break}return n},vs=e=>{switch(e){case"top":case"bottom":return"y";case"left":case"right":return"x"}return null},_p=e=>{switch(e){case"x":return"width";case"y":return"height"}return null},ws=e=>st(e,"display")==="inline",Cs=(e,t)=>(t==="x"?["border-left-width","border-right-width"]:["border-top-width","border-bottom-width"]).reduce((n,i)=>n+parseInt(st(e,i),10),0)||0,$e=(e,t)=>parseInt(st(e,`margin-${t}`),10)||0,vp=e=>({top:$e(e,"top"),right:$e(e,"right"),bottom:$e(e,"bottom"),left:$e(e,"left")}),En=e=>T(null,[e],function*({targetEl:t,targetProperty:n,anchorRect:i,anchorSide:r,anchorSize:o,fallback:l=null}){var c;if(!((o||r!==void 0)&&t&&i))return l;if(o){if(!Oo(n))return l;let a;switch(o){case"width":case"height":a=o;break;default:{let s=!1;const u=st(t,"writing-mode");s=u.startsWith("vertical-")||u.startsWith("sideways-"),a=Sp(o,s)}}return a?`${i[a]}px`:l}if(r!==void 0){let a,s;const u=vs(n);if(!(le(n)&&u&&(!le(r)||u===vs(r))))return l;const h=["top","left"];switch(r){case"left":case"top":a=0;break;case"right":case"bottom":a=100;break;case"center":a=50;break;case"inside":a=h.includes(n)?0:100;break;case"outside":a=h.includes(n)?100:0;break;default:if(t){const p=(yield(c=nt.isRTL)==null?void 0:c.call(nt,t))||!1;a=bp(r,p)}}const f=typeof a=="number"&&!Number.isNaN(a),d=_p(u);if(f&&d){(n==="bottom"||n==="right")&&(s=yield Cn(t));let p=i[u]+i[d]*(a/100);switch(n){case"bottom":{if(!s)break;let m=s.clientHeight;if(m===0&&ws(s)){const y=Cs(s,u);m=s.offsetHeight-y}p=m-p;break}case"right":{if(!s)break;let m=s.clientWidth;if(m===0&&ws(s)){const y=Cs(s,u);m=s.offsetWidth-y}p=m-p;break}}return`${p}px`}}return l}),wp=e=>"wrapperEl"in e,Cp=e=>"uuid"in e;function xp(e,t=!1){return T(this,null,function*(){const n=document.documentElement;for(const[i,r]of Object.entries(e))for(const o of r){const l=o.anchorEl,c=o.targetEl;if(l&&c)if(wp(o)){const a=o.wrapperEl,s=(u,h,f)=>T(null,null,function*(){return u===0?"0px":yield En({targetEl:a,targetProperty:h,anchorRect:f,anchorSide:u})});Qe(l,a,()=>T(null,null,function*(){const u=st(c,ns);a.setAttribute(is,u);const h=yield nt.getElementRects({reference:l,floating:a,strategy:"absolute"}),f=o.insets,d=yield s(f.block[0],"top",h.reference),p=yield s(f.block[1],"bottom",h.reference),m=yield s(f.inline[0],"left",h.reference),y=yield s(f.inline[1],"right",h.reference);n.style.setProperty(`${o.targetUUID}-top`,d||null),n.style.setProperty(`${o.targetUUID}-left`,m||null),n.style.setProperty(`${o.targetUUID}-right`,y||null),n.style.setProperty(`${o.targetUUID}-bottom`,p||null),n.style.setProperty(`${o.targetUUID}-justify-self`,o.alignments.inline),n.style.setProperty(`${o.targetUUID}-align-self`,o.alignments.block)}),{animationFrame:t})}else Qe(l,c,()=>T(null,null,function*(){const a=yield nt.getElementRects({reference:l,floating:c,strategy:"absolute"}),s=yield En({targetEl:c,targetProperty:i,anchorRect:a.reference,anchorSide:o.anchorSide,anchorSize:o.anchorSize,fallback:o.fallbackValue});n.style.setProperty(o.uuid,s)}),{animationFrame:t});else if(Cp(o)){const a=yield En({targetProperty:i,anchorSide:o.anchorSide,anchorSize:o.anchorSize,fallback:o.fallbackValue});n.style.setProperty(o.uuid,a)}}})}function xs(e,t){return T(this,null,function*(){const n=yield nt.getElementRects({reference:e,floating:e,strategy:"absolute"});return yield Cl({x:e.offsetLeft,y:e.offsetTop,platform:kp,rects:n,elements:{floating:e,reference:t},strategy:"absolute"},{padding:vp(e)})})}function Lp(e,t,n=!1){return T(this,null,function*(){if(!t.length)return;const i=document.querySelectorAll(e);for(const r of i){let o=!1;const l=yield Cn(r);Qe({},r,()=>T(null,null,function*(){if(o)return;o=!0,r.removeAttribute("data-anchor-polyfill");const c=yield xs(r,l);if(Object.values(c).every(a=>a<=0)){r.removeAttribute("data-anchor-polyfill-last-successful"),o=!1;return}for(const[a,{uuid:s}]of t.entries()){r.setAttribute("data-anchor-polyfill",s);const u=yield xs(r,l);if(Object.values(u).every(h=>h<=0)){r.setAttribute("data-anchor-polyfill-last-successful",s),o=!1;break}if(a===t.length-1){const h=r.getAttribute("data-anchor-polyfill-last-successful");h?r.setAttribute("data-anchor-polyfill",h):r.removeAttribute("data-anchor-polyfill"),o=!1;break}}}),{animationFrame:n,layoutShift:!1})}})}function Ap(e,t=!1){return T(this,null,function*(){var n,i;for(const r of Object.values(e))yield xp((n=r.declarations)!=null?n:{},t);for(const[r,o]of Object.entries(e))yield Lp(r,(i=o.fallbacks)!=null?i:[],t)})}function Pp(e={}){const t=typeof e=="boolean"?{useAnimationFrame:e}:e,n=t.useAnimationFrame===void 0?!!window.UPDATE_ANCHOR_ON_ANIMATION_FRAME:t.useAnimationFrame;return Array.isArray(t.elements)||(t.elements=void 0),(!Array.isArray(t.roots)||t.roots.length===0)&&(t.roots=[document]),Object.assign(t,{useAnimationFrame:n})}function Tp(e){return T(this,null,function*(){const t=Pp(e??window.ANCHOR_POSITIONING_POLYFILL_OPTIONS);let n=yield cd(t),i={},r;Gf();try{Jf(n)&&(n=_s(n));const o=yield gp(n,{roots:t.roots});i=o.rules,r=o.inlineStyles}catch(o){throw Yf(),o}return Object.values(i).length&&(_s(n,r,!0),yield Ap(i,t.useAnimationFrame)),i})}const Ep=Object.freeze(Object.defineProperty({__proto__:null,default:Tp},Symbol.toStringTag,{value:"Module"}));z.ActiveDescendantController=Ps,z.AnchorController=$s,z.DragController=Ms,z.ResizeController=Is,z.RovingTabIndexMixin=Hs,z.ScrollObserverController=zs,z.isFocusable=jn,z.keyNavigation=Es,z.mouseMove=Ds,z.snapToStep=Bs,z.valueToPercent=Us,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export interface ActiveDescendantOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The element that receives `aria-activedescendant`. Must be focusable
|
|
5
|
+
* (e.g. has `tabindex="0"`) and remain focused while the virtual cursor
|
|
6
|
+
* navigates the item list — do NOT move DOM focus to items.
|
|
7
|
+
*/
|
|
8
|
+
host: () => Element | null;
|
|
9
|
+
/**
|
|
10
|
+
* Live getter for the ordered list of navigable items. Called on every
|
|
11
|
+
* navigation so dynamic lists (filtered, lazily rendered) are handled
|
|
12
|
+
* automatically. The returned array should already exclude items that are
|
|
13
|
+
* structurally unavailable; use `isSkipped` for items that are in the DOM
|
|
14
|
+
* but temporarily non-navigable (e.g. `aria-disabled`).
|
|
15
|
+
*/
|
|
16
|
+
items: () => Element[];
|
|
17
|
+
/**
|
|
18
|
+
* Return `true` to skip an item during navigation (e.g. `aria-disabled`,
|
|
19
|
+
* temporarily hidden). Skipped items are never set as active.
|
|
20
|
+
*/
|
|
21
|
+
isSkipped?: (item: Element) => boolean;
|
|
22
|
+
/** Wrap at list boundaries. Default `true`. */
|
|
23
|
+
wrap?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Manages the WAI-ARIA `aria-activedescendant` virtual cursor pattern.
|
|
27
|
+
*
|
|
28
|
+
* Keeps DOM focus on the host element (e.g. a combobox trigger) while
|
|
29
|
+
* signalling which popup item is logically "active" to assistive technology
|
|
30
|
+
* via `aria-activedescendant`. Contrast with `RovingTabIndexMixin`, which
|
|
31
|
+
* moves real DOM focus between items.
|
|
32
|
+
*
|
|
33
|
+
* On each navigation call the controller:
|
|
34
|
+
* 1. Assigns a stable `id` to the target item if it lacks one.
|
|
35
|
+
* 2. Sets `aria-activedescendant="[id]"` on the host element.
|
|
36
|
+
* 3. Scrolls the item into view (`block: 'nearest'`).
|
|
37
|
+
*
|
|
38
|
+
* On `clear()` it removes `aria-activedescendant` from the host.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* class MyCombobox extends LitElement {
|
|
43
|
+
* private _adc = new ActiveDescendantController(this, {
|
|
44
|
+
* host: () => this.renderRoot.querySelector('#trigger'),
|
|
45
|
+
* items: () => this._listbox?.navigableItems ?? [],
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* private _onArrowDown() { this._adc.navigate(1); }
|
|
49
|
+
* private _onEnter() { this._adc.activeItem?.click(); }
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare class ActiveDescendantController implements ReactiveController {
|
|
54
|
+
private readonly _opts;
|
|
55
|
+
private readonly _instanceId;
|
|
56
|
+
private _activeItem;
|
|
57
|
+
private _activeIndex;
|
|
58
|
+
private _itemCounter;
|
|
59
|
+
constructor(host: ReactiveControllerHost, options: ActiveDescendantOptions);
|
|
60
|
+
hostConnected(): void;
|
|
61
|
+
hostDisconnected(): void;
|
|
62
|
+
/** The currently active item, or `null` when cleared. */
|
|
63
|
+
get activeItem(): Element | null;
|
|
64
|
+
/** Index into the current `items()` array. `-1` when cleared. */
|
|
65
|
+
get activeIndex(): number;
|
|
66
|
+
/**
|
|
67
|
+
* Move the virtual cursor by `delta` steps (+1 forward, -1 backward),
|
|
68
|
+
* skipping any items for which `isSkipped` returns true.
|
|
69
|
+
*/
|
|
70
|
+
navigate(delta: 1 | -1): void;
|
|
71
|
+
/** Move the virtual cursor to the first non-skipped item. */
|
|
72
|
+
navigateToFirst(): void;
|
|
73
|
+
/** Move the virtual cursor to the last non-skipped item. */
|
|
74
|
+
navigateToLast(): void;
|
|
75
|
+
/** Move the virtual cursor to the item at `index`. */
|
|
76
|
+
navigateTo(index: number): void;
|
|
77
|
+
/** Move the virtual cursor to a specific item reference. */
|
|
78
|
+
navigateToItem(item: Element): void;
|
|
79
|
+
/**
|
|
80
|
+
* Clear the virtual cursor: removes `aria-activedescendant` from the host,
|
|
81
|
+
* removes `data-active` from the previously active item, and resets internal state.
|
|
82
|
+
*/
|
|
83
|
+
clear(): void;
|
|
84
|
+
private _isSkipped;
|
|
85
|
+
private _setActive;
|
|
86
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export type AnchorPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
3
|
+
export interface AnchorOptions {
|
|
4
|
+
/** The anchor (trigger) element. Accepts an element reference or getter. */
|
|
5
|
+
anchor: Element | (() => Element | null);
|
|
6
|
+
/** The floating element to position. Accepts an element reference or getter. */
|
|
7
|
+
floating: Element | (() => Element | null);
|
|
8
|
+
/** Preferred placement relative to the anchor. Defaults to `'bottom-start'`. */
|
|
9
|
+
placement?: AnchorPlacement;
|
|
10
|
+
/** Gap between anchor and floating in px. Defaults to `4`. */
|
|
11
|
+
offset?: number;
|
|
12
|
+
/** Flip to opposite side when clipped by viewport. Defaults to `true`. */
|
|
13
|
+
flip?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The LitElement shadow host. When provided, positioning CSS is injected into
|
|
17
|
+
* the shadow root's adoptedStyleSheets so it reaches shadow-DOM floating elements,
|
|
18
|
+
* including those promoted to the popover top layer. The polyfill is invoked
|
|
19
|
+
* with roots: [shadowHost] to scope its traversal to this shadow root.
|
|
20
|
+
*/
|
|
21
|
+
shadowHost?: HTMLElement | (() => HTMLElement | null);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Positions a floating element relative to an anchor element using CSS
|
|
25
|
+
* Anchor Positioning (native-first, polyfill on unsupported browsers via
|
|
26
|
+
* `@oddbird/css-anchor-positioning`).
|
|
27
|
+
*
|
|
28
|
+
* For shadow DOM components (pass `shadowHost`), positioning CSS is injected
|
|
29
|
+
* into the shadow root's `adoptedStyleSheets` so it reaches floating elements
|
|
30
|
+
* including those promoted to the popover top layer. The polyfill is invoked
|
|
31
|
+
* with `roots: [shadowHost]` to scope its stylesheet traversal correctly.
|
|
32
|
+
*
|
|
33
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning
|
|
34
|
+
*/
|
|
35
|
+
export declare class AnchorController implements ReactiveController {
|
|
36
|
+
private _opts;
|
|
37
|
+
private readonly _uid;
|
|
38
|
+
private _styleEl;
|
|
39
|
+
private _adoptedSheet;
|
|
40
|
+
constructor(host: ReactiveControllerHost, options: AnchorOptions);
|
|
41
|
+
setOptions(next: Partial<AnchorOptions>): void;
|
|
42
|
+
/** Re-apply positioning — call when the popup opens or the anchor moves. */
|
|
43
|
+
update(): void;
|
|
44
|
+
hostConnected(): void;
|
|
45
|
+
hostDisconnected(): void;
|
|
46
|
+
private _anchor;
|
|
47
|
+
private _floating;
|
|
48
|
+
private _shadowHost;
|
|
49
|
+
private _applyAndPolyfill;
|
|
50
|
+
private _applyPolyfillOrFallback;
|
|
51
|
+
private _apply;
|
|
52
|
+
private _injectStyles;
|
|
53
|
+
private _positionFallback;
|
|
54
|
+
private _cleanup;
|
|
55
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export interface DragOptions {
|
|
3
|
+
/** The element to move. Its `left` / `top` styles are updated during drag. */
|
|
4
|
+
target: Element;
|
|
5
|
+
/** Element that initiates the drag. Defaults to `target`. */
|
|
6
|
+
handle?: Element | null;
|
|
7
|
+
/** Bounds constraint for movement. Defaults to `'viewport'`. */
|
|
8
|
+
bounds?: 'viewport' | 'parent' | Element;
|
|
9
|
+
/** Constrain movement to one axis. Defaults to `'both'`. */
|
|
10
|
+
axis?: 'x' | 'y' | 'both';
|
|
11
|
+
/** Keyboard arrow-key step in px. Shift multiplies by 10. Defaults to `4`. */
|
|
12
|
+
step?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Makes an element draggable via pointer and keyboard.
|
|
17
|
+
*
|
|
18
|
+
* Attach to a host and pass a `target` element (the element to move) and
|
|
19
|
+
* optionally a `handle` element (the drag initiator). Arrow keys on the
|
|
20
|
+
* focused handle also move the target for keyboard accessibility.
|
|
21
|
+
*
|
|
22
|
+
* Named `DragController` internally; `movable` is the attribute name on
|
|
23
|
+
* `<rc-dialog>` to avoid colliding with the HTML `draggable` global attribute.
|
|
24
|
+
*/
|
|
25
|
+
export declare class DragController implements ReactiveController {
|
|
26
|
+
private _opts;
|
|
27
|
+
private _dragging;
|
|
28
|
+
private _startX;
|
|
29
|
+
private _startY;
|
|
30
|
+
private _startLeft;
|
|
31
|
+
private _startTop;
|
|
32
|
+
private readonly _onPointerDown;
|
|
33
|
+
private readonly _onPointerMove;
|
|
34
|
+
private readonly _onPointerUp;
|
|
35
|
+
private readonly _onPointerCancel;
|
|
36
|
+
private readonly _onLostPointerCapture;
|
|
37
|
+
private readonly _onKeyDown;
|
|
38
|
+
constructor(host: ReactiveControllerHost, options: DragOptions);
|
|
39
|
+
setOptions(next: Partial<DragOptions>): void;
|
|
40
|
+
hostConnected(): void;
|
|
41
|
+
hostDisconnected(): void;
|
|
42
|
+
private _handle;
|
|
43
|
+
private _target;
|
|
44
|
+
private _attachTo;
|
|
45
|
+
private _detachFrom;
|
|
46
|
+
private _handlePointerDown;
|
|
47
|
+
private _handlePointerMove;
|
|
48
|
+
private _handlePointerUp;
|
|
49
|
+
private _handleLostPointerCapture;
|
|
50
|
+
private _cancelDrag;
|
|
51
|
+
private _handleKeyDown;
|
|
52
|
+
private _boundsRect;
|
|
53
|
+
}
|