@rcarls/rc-common 0.0.0-next-20260921045401
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/CHANGELOG.md +101 -0
- package/README.md +329 -0
- package/dist/css-anchor-positioning-fn-hFYJeBk4.js +6371 -0
- package/dist/rc-common.js +1760 -0
- package/dist/rc-common.umd.cjs +31 -0
- package/dist/types/ActiveDescendantController.d.ts +86 -0
- package/dist/types/AnchorController.d.ts +113 -0
- package/dist/types/DragController.d.ts +46 -0
- package/dist/types/DragGestureController.d.ts +110 -0
- package/dist/types/ItemsCollectionController.d.ts +119 -0
- package/dist/types/KeyboardInteractionDirective.d.ts +32 -0
- package/dist/types/KeyboardNavigationDirective.d.ts +67 -0
- package/dist/types/MouseMoveDirective.d.ts +42 -0
- package/dist/types/MutationObserverController.d.ts +30 -0
- package/dist/types/NavigationIndicatorController.d.ts +33 -0
- package/dist/types/RafScheduler.d.ts +16 -0
- package/dist/types/ResizeController.d.ts +134 -0
- package/dist/types/RovingTabIndexMixin.d.ts +58 -0
- package/dist/types/ScrollObserverController.d.ts +61 -0
- package/dist/types/TypeaheadController.d.ts +31 -0
- package/dist/types/clickDelegate.d.ts +116 -0
- package/dist/types/findNearestScrollAncestor.d.ts +9 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/isFocusable.d.ts +10 -0
- package/dist/types/nativeChild.d.ts +54 -0
- package/dist/types/sliderUtils.d.ts +12 -0
- package/dist/types/snapUtils.d.ts +10 -0
- package/dist/types/visualViewport.d.ts +21 -0
- package/package.json +60 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
(function(b,Et){typeof exports=="object"&&typeof module<"u"?Et(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"],Et):(b=typeof globalThis<"u"?globalThis:b||self,Et(b["rc-common"]={},b.lit,b.litDirective,b.litAsyncDirective,b.litDecorators))})(this,(function(b,Et,He,jt,$o){"use strict";let zo=0;class jo{constructor(t,n){this._activeItem=null,this._activeIndex=-1,this._itemCounter=0,this._opts=n,this._instanceId=`rc-adc-${++zo}`,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 s=this._activeIndex<0?t>0?-1:n.length:this._activeIndex;const r=n.length;let l=0;do if(s+=t,i?s=(s%r+r)%r:s=Math.max(0,Math.min(r-1,s)),l++,!this._isSkipped(n[s]))break;while(l<r);this._setActive(n[s]??null,s)}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"})}}}const $n='a[href], button, input, select, textarea, summary, [role="button"], [role="link"], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function zn(e,t,n={}){const i=n.interactiveSelector??$n;for(const s of e.composedPath()){if(s===t)return!1;if(s instanceof Element&&s.matches(i))return!0}return!1}function jn(e,t,n,i={}){return!n||i.disabled||e.defaultPrevented||e.button!==0||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||zn(e,t,i)?!1:(e.preventDefault(),n.click(),!0)}class No{constructor(t,n){this._handleClick=i=>{jn(i,this._host,this._options.target(),{interactiveSelector:this._options.interactiveSelector,disabled:this._options.disabled?.()})},this._host=t,this._options=n,t.addController(this)}hostConnected(){this._host.addEventListener("click",this._handleClick)}hostDisconnected(){this._host.removeEventListener("click",this._handleClick)}}const je=class je{constructor(t,n){this._ul=null,this._options=[],this._liElements=[],this._createLi=null,this._createOption=null,this._selectedValues=new Set,this._filterText="",this._filterStrategy="contains",this._checkmark=!1,this._optionsInitialized=!1,this._pendingTouchActivation=null,this._onPointerDown=i=>{const s=i,r=this._resolveOptionLi(s.target);if(r){if(s.pointerType==="touch"){if(this._pendingTouchActivation)return;this._pendingTouchActivation={pointerId:s.pointerId,li:r,startX:s.clientX,startY:s.clientY};return}this._activateLi(r,s)}},this._onPointerMove=i=>{const s=this._pendingTouchActivation,r=i;if(!s||r.pointerId!==s.pointerId)return;Math.hypot(r.clientX-s.startX,r.clientY-s.startY)>je._TOUCH_TAP_THRESHOLD&&(this._pendingTouchActivation=null)},this._onPointerUp=i=>{const s=this._pendingTouchActivation,r=i;!s||r.pointerId!==s.pointerId||(this._pendingTouchActivation=null,this._activateLi(s.li,r))},this._onPointerCancel=i=>{const s=i;this._pendingTouchActivation?.pointerId===s.pointerId&&(this._pendingTouchActivation=null)},this._host=t,this._idPrefix=n.idPrefix,this._onInitFromDom=n.onInitFromDom,this._onActivate=n.onActivate,t.addController(this)}hostConnected(){this._host.addEventListener("pointerdown",this._onPointerDown),this._host.addEventListener("pointermove",this._onPointerMove),this._host.addEventListener("pointerup",this._onPointerUp),this._host.addEventListener("pointercancel",this._onPointerCancel),this._optionsInitialized||this._bootstrapFromDom()}hostDisconnected(){this._host.removeEventListener("pointerdown",this._onPointerDown),this._host.removeEventListener("pointermove",this._onPointerMove),this._host.removeEventListener("pointerup",this._onPointerUp),this._host.removeEventListener("pointercancel",this._onPointerCancel),this._pendingTouchActivation=null}get allOptions(){return this._options}get selectedValues(){return[...this._selectedValues]}get filterText(){return this._filterText}isSelected(t){return this._selectedValues.has(t)}optionForElement(t){if(t===this._createLi)return this._createOption;const n=this._liElements.indexOf(t);return n===-1?null:this._options[n]??null}get navigableItems(){const t=[];for(let n=0;n<this._liElements.length;n++){const i=this._liElements[n];this._options[n]?.disabled||i.hidden||t.push(i)}return this._createLi!==null&&t.push(this._createLi),t}set checkmark(t){this._checkmark!==t&&(this._checkmark=t,this._syncCheckmarks())}setOptions(t){this._optionsInitialized=!0,this._options=[...t],this._ensureContainer(),this._syncOptionsToDom()}appendOption(t){this._optionsInitialized=!0,this._options=[...this._options,t],this._ensureContainer();const n=this._createLiElement(t,this._options.length-1);this._liElements.push(n),this._createLi?this._ul.insertBefore(n,this._createLi):this._ul.appendChild(n),this._applyFilterToLi(n,t)}setSelectedValues(t){const n=new Set(this._options.filter(i=>i.kind==="action").map(i=>i.value));this._createOption&&n.add(this._createOption.value),this._selectedValues=new Set(t.filter(i=>!n.has(i))),this._syncSelectedToDom()}filterOptions(t,n="contains"){this._filterText=t,this._filterStrategy=n,this._syncFilterToDom()}clearFilter(){this._filterText="",this._syncFilterToDom()}setCreateOption(t){if(t===null){this._createLi?.remove(),this._createLi=null,this._createOption=null;return}const n=t.trim();if(this._createOption={kind:"action",action:"create",value:`create:${n}`,label:`Create "${n}"`,data:{text:n}},!this._createLi){this._ensureContainer();const i=document.createElement("li");i.setAttribute("id",`${this._idPrefix}-create`),i.setAttribute("role","option"),i.setAttribute("aria-selected","false"),i.setAttribute("part","option create-option"),this._checkmark&&this._ensureCheckmark(i),this._ul.appendChild(i),this._createLi=i}this._createLi.setAttribute("data-value",this._createOption.value),this._createLi.setAttribute("data-kind","action"),this._createLi.setAttribute("data-action",this._createOption.action),this._setLabelText(this._createLi,this._createOption.label)}_ensureContainer(){if(this._ul)return this._ul;let t=this._host.querySelector(":scope > ul");return t||(t=document.createElement("ul"),this._host.appendChild(t)),t.setAttribute("role","presentation"),t.setAttribute("aria-hidden","true"),this._ul=t,t}_bootstrapFromDom(){const t=this._host.querySelector(":scope > ul");if(!t)return;this._ul=t,t.setAttribute("role","presentation"),t.setAttribute("aria-hidden","true");const n=Array.from(t.querySelectorAll(":scope > li"));if(n.length===0)return;const i=[];for(let s=0;s<n.length;s++){const r=n[s],l=r.getAttribute("data-value")??r.getAttribute("value")??r.textContent?.trim()??"",c=r.textContent?.trim()??"",a=r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true";i.push({value:l,label:c,disabled:a}),r.setAttribute("role","option"),r.setAttribute("id",`${this._idPrefix}-${s}`),r.setAttribute("part","option"),r.setAttribute("data-value",l),r.setAttribute("aria-selected",this._selectedValues.has(l)?"true":"false"),r.setAttribute("aria-disabled",a?"true":"false"),this._checkmark&&this._ensureCheckmark(r)}this._options=i,this._liElements=n,this._onInitFromDom?.(i)}_syncOptionsToDom(){const t=this._ensureContainer();for(const n of this._liElements)n.remove();this._liElements=[];for(let n=0;n<this._options.length;n++){const i=this._createLiElement(this._options[n],n);this._liElements.push(i),t.appendChild(i)}this._createLi&&t.appendChild(this._createLi),this._syncFilterToDom()}_createLiElement(t,n){const i=document.createElement("li");return i.setAttribute("role","option"),i.setAttribute("id",`${this._idPrefix}-${n}`),i.setAttribute("part","option"),i.setAttribute("data-value",t.value),i.setAttribute("data-kind",t.kind??"option"),t.kind==="action"?i.setAttribute("data-action",t.action):i.removeAttribute("data-action"),i.setAttribute("aria-selected",this._selectedValues.has(t.value)?"true":"false"),i.setAttribute("aria-disabled",t.disabled?"true":"false"),this._checkmark&&this._ensureCheckmark(i),this._setLabelText(i,t.label),i}_setLabelText(t,n){for(const i of t.childNodes)if(i.nodeType===Node.TEXT_NODE){i.textContent=n;return}t.appendChild(document.createTextNode(n))}_ensureCheckmark(t){if(t.querySelector('[part="option-checkmark"]'))return;const n=document.createElement("span");n.setAttribute("part","option-checkmark"),n.setAttribute("aria-hidden","true"),n.textContent="✓",t.insertBefore(n,t.firstChild)}_removeCheckmark(t){t.querySelector('[part="option-checkmark"]')?.remove()}_syncCheckmarks(){const t=this._createLi?[...this._liElements,this._createLi]:[...this._liElements];for(const n of t)this._checkmark?this._ensureCheckmark(n):this._removeCheckmark(n)}_syncSelectedToDom(){for(let t=0;t<this._liElements.length;t++){const n=this._options[t];n&&this._liElements[t].setAttribute("aria-selected",this._selectedValues.has(n.value)?"true":"false")}}_syncFilterToDom(){for(let t=0;t<this._liElements.length;t++){const n=this._options[t];n&&this._applyFilterToLi(this._liElements[t],n)}}_applyFilterToLi(t,n){t.hidden=!this._isVisible(n)}_isVisible(t){if(!this._filterText)return!0;const n=t.label.toLowerCase(),i=this._filterText.toLowerCase();return typeof this._filterStrategy=="function"?this._filterStrategy(n,i):this._filterStrategy==="contains"?n.includes(i):n.startsWith(i)}_resolveOptionLi(t){if(!t)return null;const n=t.closest("li[data-value]");return!n||n.getAttribute("role")!=="option"||n.parentElement!==this._ul?null:n}_activateLi(t,n){n.preventDefault(),n.stopPropagation();const i=this.optionForElement(t);i&&this._onActivate(i)}};je._TOUCH_TAP_THRESHOLD=10;let We=je;class Ho extends jt.AsyncDirective{constructor(t){if(super(t),this._options={},this._isPointerFocus=!1,this._onPointerdown=()=>{this._isPointerFocus=!0,this._target?.removeAttribute("data-interaction-mode")},this._onFocusin=()=>{this._isPointerFocus?this._isPointerFocus=!1:this._target?.setAttribute("data-interaction-mode","keyboard")},this._onKeydown=()=>{this._target?.setAttribute("data-interaction-mode","keyboard")},t.type!==He.PartType.ELEMENT)throw new Error("The `keyInteraction` directive must be used on an element.")}get _target(){return this._options.attributeTarget??this._element?.deref()}_init(){const t=this._element?.deref();t instanceof HTMLElement&&(t.addEventListener("pointerdown",this._onPointerdown,{capture:!0}),t.addEventListener("focusin",this._onFocusin),t.addEventListener("keydown",this._onKeydown))}render(t){return Et.nothing}update(t,[n]){this.isConnected&&this._element?.deref()===void 0&&(this._element=new WeakRef(t.element),this._init()),this._options=n??{}}disconnected(){const t=this._element?.deref();t instanceof HTMLElement&&(t.removeEventListener("pointerdown",this._onPointerdown,{capture:!0}),t.removeEventListener("focusin",this._onFocusin),t.removeEventListener("keydown",this._onKeydown))}reconnected(){this._init()}}const Wo=jt.directive(Ho);class Bo extends jt.AsyncDirective{constructor(t){if(super(t),this._options={},t.type!==He.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";case"separator":return this._element?.deref()?.ariaOrientation==="vertical"?"horizontal":"vertical";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,s=this._element?.deref(),r=i==="horizontal"&&s!=null&&getComputedStyle(s).direction==="rtl",l=i==="horizontal"?r?"ArrowLeft":"ArrowRight":"ArrowDown",c=i==="horizontal"?r?"ArrowRight":"ArrowLeft":"ArrowUp",a=i==="horizontal"?"ArrowDown":"ArrowRight",o=i==="horizontal"?"ArrowUp":"ArrowLeft";let h;this._options.handleNavAxis!==!1&&(n===l?h=t.shiftKey?"next-large":"next":n===c?h=t.shiftKey?"prev-large":"prev":n==="Home"?h="start":n==="End"&&(h="end")),!h&&this._options.handleOpenAxis&&(n===a?h="open-to-first":n===o&&(h="open-to-last")),h||(n==="Enter"?h=this._options.handleActivate?"activate":"toggle":n===" "&&this._options.handleActivate?h="activate":n==="Escape"&&this._options.handleEscape&&(h="escape")),h!=null&&(this._callback(h),t.stopPropagation(),t.preventDefault())}_init(){const t=this._element?.deref();t!=null&&t instanceof HTMLElement&&(this._keyDownHandle=this._onKeydown.bind(this),t.addEventListener("keydown",this._keyDownHandle))}render(t,n){return Et.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),this._options={...i}}disconnected(){const t=this._element?.deref();t!=null&&t instanceof HTMLElement&&t.removeEventListener("keydown",this._keyDownHandle)}reconnected(){this._init()}}const Uo=jt.directive(Bo);class Vo extends jt.AsyncDirective{constructor(t){if(super(t),this._activePointerId=null,t.type!==He.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 Et.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 Xo=jt.directive(Vo);class Be{constructor(t,n){this._$target=null,this._pointerId=null,this._startX=0,this._startY=0,this._startTime=0,this._samples=[],this._activated=!1,this._rejected=!1,this._onPointerDown=i=>{if(this._pointerId!==null||!i.isPrimary&&i.pointerId!==1||i.pointerType==="mouse"&&i.button!==0||this._options.canStart?.(i)===!1)return;this._pointerId=i.pointerId,this._startX=i.clientX,this._startY=i.clientY,this._startTime=i.timeStamp,this._samples=[{x:i.clientX,y:i.clientY,time:i.timeStamp}],this._activated=!1,this._rejected=!1;const s=this._$target;s&&(s.addEventListener("pointermove",this._onPointerMove),s.addEventListener("pointerup",this._onPointerUp),s.addEventListener("pointercancel",this._onPointerCancel),s.addEventListener("lostpointercapture",this._onLostPointerCapture),this._options.activation==="immediate"&&this._activate(i))},this._onPointerMove=i=>{i.pointerId!==this._pointerId||this._rejected||(this._recordSample(i),!(!this._activated&&!this._resolveIntent(i))&&(this._options.onMove?.(this._detail(i)),this._options.preventDefault&&i.preventDefault()))},this._onPointerUp=i=>{i.pointerId===this._pointerId&&(this._recordSample(i),this._activated&&this._options.onEnd?.(this._detail(i)),this._finish())},this._onPointerCancel=i=>{this._cancel(i)},this._onLostPointerCapture=i=>{i.pointerId===this._pointerId&&this._cancel(i)},this._options={axis:"both",activation:"immediate",activationDistance:8,axisLockRatio:1.25,velocityWindow:100,minVelocityDuration:8,capture:!1,stopPropagation:!1,preventDefault:!0,focusOnStart:!1,...n},t.addController(this)}setOptions(t){Object.assign(this._options,t),this._bindTarget()}hostConnected(){this._bindTarget()}hostUpdated(){this._bindTarget()}hostDisconnected(){this._unbindTarget()}_resolveTarget(){const t=typeof this._options.target=="function"?this._options.target():this._options.target;return t instanceof HTMLElement?t:null}_bindTarget(){const t=this._resolveTarget();t!==this._$target&&(this._unbindTarget(),this._$target=t,this._$target?.addEventListener("pointerdown",this._onPointerDown,{capture:this._options.capture}))}_unbindTarget(){this._$target&&(this._$target.removeEventListener("pointerdown",this._onPointerDown,{capture:this._options.capture}),this._removeCycleListeners(this._$target),this._reset(),this._$target=null)}_resolveIntent(t){const n=t.clientX-this._startX,i=t.clientY-this._startY;if(Math.hypot(n,i)<this._options.activationDistance)return!1;const{axis:r,axisLockRatio:l}=this._options,c=Math.abs(n),a=Math.abs(i);return r==="x"&&c<a*l||r==="y"&&a<c*l?(this._rejected=!0,this._finish(),!1):(this._activate(t),!0)}_activate(t){const n=this._$target;!n||this._activated||(this._activated=!0,this._capturePointer(n,t.pointerId),this._options.focusOnStart&&n.focus(),this._options.stopPropagation&&t.stopPropagation(),this._options.preventDefault&&t.preventDefault(),this._options.onStart?.(this._detail(t)))}_cancel(t){t.pointerId===this._pointerId&&(this._activated&&this._options.onCancel?.(this._detail(t)),this._finish())}_finish(){const t=this._$target,n=this._pointerId;t&&(this._removeCycleListeners(t),n!==null&&this._releasePointer(t,n)),this._reset()}_removeCycleListeners(t){t.removeEventListener("pointermove",this._onPointerMove),t.removeEventListener("pointerup",this._onPointerUp),t.removeEventListener("pointercancel",this._onPointerCancel),t.removeEventListener("lostpointercapture",this._onLostPointerCapture)}_recordSample(t){this._samples.push({x:t.clientX,y:t.clientY,time:t.timeStamp});const n=t.timeStamp-this._options.velocityWindow;for(;this._samples.length>2&&this._samples[0].time<n;)this._samples.shift()}_detail(t){const n=this._samples[0],i=this._samples.at(-1)??n,s=i.time-n.time,r=s>=this._options.minVelocityDuration;return{event:t,pointerId:t.pointerId,pointerType:t.pointerType,startX:this._startX,startY:this._startY,x:t.clientX,y:t.clientY,deltaX:t.clientX-this._startX,deltaY:t.clientY-this._startY,duration:Math.max(0,t.timeStamp-this._startTime),velocityX:r?(i.x-n.x)/s*1e3:0,velocityY:r?(i.y-n.y)/s*1e3:0}}_capturePointer(t,n){try{t.setPointerCapture(n)}catch(i){if(!(i instanceof DOMException)||i.name!=="NotFoundError")throw i}}_releasePointer(t,n){try{t.hasPointerCapture(n)&&t.releasePointerCapture(n)}catch{}}_reset(){this._pointerId=null,this._samples=[],this._activated=!1,this._rejected=!1}}class Yo{constructor(t,n){this._dragging=!1,this._startLeft=0,this._startTop=0,this._opts={axis:"both",step:4,disabled:!1,handle:null,bounds:"viewport",...n},this._onKeyDown=this._handleKeyDown.bind(this),this._gesture=new Be(t,{target:()=>this._handle(),axis:this._opts.axis,canStart:i=>this._canStartGesture(i),onStart:i=>this._startDrag(i),onMove:i=>this._moveDrag(i),onEnd:()=>this._finishDrag(),onCancel:()=>this._finishDrag()}),t.addController(this)}setOptions(t){const n=this._handle();Object.assign(this._opts,t),this._gesture.setOptions({axis:this._opts.axis,target:()=>this._handle()});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("keydown",this._onKeyDown),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")}_detachFrom(t){t.removeEventListener("keydown",this._onKeyDown)}_canStartGesture(t){return this._opts.disabled?!1:!t.target.closest('button, [role="button"], a')}_startDrag(t){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._startLeft=i.left,this._startTop=i.top,this._dragging=!0}_moveDrag(t){if(!this._dragging)return;const n=this._target(),{axis:i}=this._opts,[s,r,l,c]=this._boundsRect(),a=i!=="y"?Math.min(Math.max(this._startLeft+t.deltaX,s),l-n.offsetWidth):parseFloat(n.style.left)||0,o=i!=="x"?Math.min(Math.max(this._startTop+t.deltaY,r),c-n.offsetHeight):parseFloat(n.style.top)||0;n.style.left=`${a}px`,n.style.top=`${o}px`}_finishDrag(){this._dragging&&(this._dragging=!1)}_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 s=0,r=0;switch(t.key){case"ArrowLeft":if(n==="y")return;s=-i;break;case"ArrowRight":if(n==="y")return;s=i;break;case"ArrowUp":if(n==="x")return;r=-i;break;case"ArrowDown":if(n==="x")return;r=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,o,h]=this._boundsRect(),u=parseFloat(l.style.left)||0,f=parseFloat(l.style.top)||0;l.style.left=`${Math.min(Math.max(u+s,c),o-l.offsetWidth)}px`,l.style.top=`${Math.min(Math.max(f+r,a),h-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 s=i.getBoundingClientRect();return[s.left,s.top,s.right,s.bottom]}const n=t.getBoundingClientRect();return[n.left,n.top,n.right,n.bottom]}}function Nn(e){const t=e.getBoundingClientRect(),n=e.offsetParent,i=n?t.left-n.getBoundingClientRect().left-n.clientLeft+n.scrollLeft:t.left,s=n?t.top-n.getBoundingClientRect().top-n.clientTop+n.scrollTop:t.top;return getComputedStyle(e).position==="static"&&(e.style.position="fixed"),e.style.translate="none",e.style.inset="auto",e.style.margin="0",e.style.boxSizing="border-box",e.style.left=`${i}px`,e.style.top=`${s}px`,e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,t}class qo{constructor(t,n){this._resizing=null,this._startW=0,this._startH=0,this._startLeft=0,this._startTop=0,this._lastDeltaX=0,this._lastDeltaY=0,this._velocityX=0,this._velocityY=0,this._pendingEdge=null,this._effectiveMinW=0,this._effectiveMinH=0,this._effectiveMaxW=1/0,this._effectiveMaxH=1/0,this._cornerBtn=null,this._opts={direction:"none",threshold:8,step:4,disabled:!1,minWidth:100,minHeight:60,handle:null,origin:"",bounds:"viewport",...n},this._onPointerMove=this._handlePointerMove.bind(this),this._onPointerLeave=this._handlePointerLeave.bind(this),this._onKeyDown=this._handleKeyDown.bind(this),this._gesture=new Be(t,{target:()=>this._handle()??this._target(),capture:!0,stopPropagation:!0,canStart:i=>this._canStartGesture(i),onStart:i=>this._startGestureResize(i),onMove:i=>this._moveGestureResize(i),onEnd:i=>this._endGestureResize(i),onCancel:()=>this._cancelResize()}),t.addController(this)}setOptions(t){const n=this._opts.handle;Object.assign(this._opts,t),this._gesture.setOptions({target:()=>this._handle()??this._target()}),n!==this._opts.handle&&(this._detachFromHandle(n),this._attachToHandle(this._opts.handle))}hostConnected(){if(this._opts.direction==="none")return;if(this._opts.handle){this._attachToHandle(this._opts.handle);return}const t=this._target();t.addEventListener("pointermove",this._onPointerMove),t.addEventListener("pointerleave",this._onPointerLeave),this._injectCornerButton()}hostDisconnected(){if(this._opts.handle){this._detachFromHandle(this._opts.handle);return}const t=this._target();t.removeEventListener("pointermove",this._onPointerMove),t.removeEventListener("pointerleave",this._onPointerLeave),this._removeCornerButton()}_target(){return this._opts.target}_handle(){return this._opts.handle}_attachToHandle(t){!t||this._opts.direction==="none"||(t.addEventListener("keydown",this._onKeyDown),t.style.cursor=this._edgeCursor(this._handleEdge()),t.style.touchAction="none",t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"))}_detachFromHandle(t){t&&t.removeEventListener("keydown",this._onKeyDown)}_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]}_handleEdge(){return this._edgeForOrigin(this._opts.origin)??this._defaultHandleEdge()}_defaultHandleEdge(){switch(this._opts.direction){case"both":return"se";case"horizontal":return"e";case"vertical":return"s";default:return"se"}}_edgeForOrigin(t){if(!t)return null;const n=t.includes("top"),i=t.includes("bottom"),s=t.includes("left"),r=t.includes("right");if(this._opts.direction==="vertical")return n?"n":i?"s":null;if(this._opts.direction==="horizontal")return s?"w":r?"e":null;if(this._opts.direction==="both"){if(n&&s)return"nw";if(n&&r)return"ne";if(i&&s)return"sw";if(i&&r)return"se";if(n)return"n";if(i)return"s";if(s)return"w";if(r)return"e"}return null}_edgeAllowsPointer(t,n){const{threshold:i}=this._opts,s=this._target().getBoundingClientRect(),r=n.clientX,l=n.clientY,c=r>=s.right-i&&r<=s.right+i,a=r>=s.left-i&&r<=s.left+i,o=l>=s.bottom-i&&l<=s.bottom+i,h=l>=s.top-i&&l<=s.top+i,u=r>=s.left&&r<=s.right,f=l>=s.top&&l<=s.bottom;switch(t){case"n":return h&&u;case"s":return o&&u;case"e":return c&&f;case"w":return a&&f;case"ne":return h&&c;case"nw":return h&&a;case"se":return o&&c;case"sw":return o&&a}}_detectEdge(t){const{direction:n,threshold:i}=this._opts;if(n==="none")return null;const s=this._edgeForOrigin(this._opts.origin);if(s)return this._edgeAllowsPointer(s,t)?s:null;const r=this._target().getBoundingClientRect(),l=t.clientX,c=t.clientY,a=l>=r.right-i&&l<=r.right+i,o=l>=r.left-i&&l<=r.left+i,h=c>=r.bottom-i&&c<=r.bottom+i,u=c>=r.top-i&&c<=r.top+i,f=l>=r.left&&l<=r.right,d=c>=r.top&&c<=r.bottom;if(n==="both"){if(a&&h)return"se";if(o&&h)return"sw";if(a&&u)return"ne";if(o&&u)return"nw";if(a&&d)return"e";if(o&&d)return"w";if(h&&f)return"s";if(u&&f)return"n"}if(n==="horizontal"){if(a&&d)return"e";if(o&&d)return"w"}if(n==="vertical"){if(h&&f)return"s";if(u&&f)return"n"}return null}_pinPosition(t){return Nn(t)}_canStartGesture(t){if(this._opts.disabled)return!1;const i=this._handle()?this._handleEdge():this._detectEdge(t);return this._pendingEdge=i,i!==null}_startGestureResize(t){this._pendingEdge&&(this._velocityX=0,this._velocityY=0,this._startResize(this._pendingEdge))}_moveGestureResize(t){this._resizing&&(this._lastDeltaX=t.deltaX,this._lastDeltaY=t.deltaY,this._velocityX=t.velocityX,this._velocityY=t.velocityY,this._applyDelta(this._resizing,t.deltaX,t.deltaY),this._opts.onResize?.(this._lifecycleDetail("pointer")))}_endGestureResize(t){this._velocityX=t.velocityX,this._velocityY=t.velocityY,this._finishResize("pointer")}_startResize(t){const n=this._target(),i=this._pinPosition(n);this._startW=i.width,this._startH=i.height,this._startLeft=Number.parseFloat(n.style.left),this._startTop=Number.parseFloat(n.style.top),this._lastDeltaX=0,this._lastDeltaY=0,this._resizing=t,this._computeEffectiveExtents(n),this._opts.onResizeStart?.(this._lifecycleDetail("pointer"))}_computeEffectiveExtents(t){const n=getComputedStyle(t);this._effectiveMinW=Math.max(this._opts.minWidth,parseFloat(n.minWidth)||0),this._effectiveMinH=Math.max(this._opts.minHeight,parseFloat(n.minHeight)||0),this._effectiveMaxW=Math.min(this._opts.maxWidth??1/0,parseFloat(n.maxWidth)||1/0),this._effectiveMaxH=Math.min(this._opts.maxHeight??1/0,parseFloat(n.maxHeight)||1/0)}_lifecycleDetail(t){const n=this._target();return{edge:this._resizing??this._handleEdge(),inputType:t,startWidth:this._startW,startHeight:this._startH,width:n.getBoundingClientRect().width,height:n.getBoundingClientRect().height,deltaX:this._lastDeltaX,deltaY:this._lastDeltaY,velocityX:t==="pointer"?this._velocityX:0,velocityY:t==="pointer"?this._velocityY:0}}_handlePointerMove(t){if(this._resizing||this._opts.handle)return;const n=this._detectEdge(t),i=this._target();i.style.cursor=n?this._edgeCursor(n):""}_finishResize(t){if(!this._resizing)return;const n=this._lifecycleDetail(t);this._resizing=null,this._pendingEdge=null,this._opts.onResizeEnd?.(n)}_cancelResize(){this._resizing=null,this._pendingEdge=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",s=t.key==="ArrowDown"||t.key==="ArrowUp";if(i&&n==="vertical"||s&&n==="horizontal"||!i&&!s)return;t.preventDefault(),t.stopPropagation();const r=this._target(),l=this._pinPosition(r),c=this._keyboardEdge(t.key);if(!c)return;this._resizing=c,this._startW=l.width,this._startH=l.height,this._startLeft=l.left,this._startTop=l.top;const a=t.shiftKey?this._opts.step*10:this._opts.step;this._computeEffectiveExtents(r);const o=t.key==="ArrowRight"?a:t.key==="ArrowLeft"?-a:0,h=t.key==="ArrowDown"?a:t.key==="ArrowUp"?-a:0;this._lastDeltaX=o,this._lastDeltaY=h,this._applyDelta(c,o,h),this._opts.onResize?.(this._lifecycleDetail("keyboard")),this._finishResize("keyboard")}_keyboardEdge(t){const n=this._edgeForOrigin(this._opts.origin);return n||(t==="ArrowRight"||t==="ArrowLeft"?this._opts.direction==="both"||this._opts.direction==="horizontal"?"e":null:(t==="ArrowDown"||t==="ArrowUp")&&(this._opts.direction==="both"||this._opts.direction==="vertical")?"s":null)}_applyDelta(t,n,i){const s=this._target(),[r,l,c,a]=this._boundsRect(),o=this._effectiveMinW,h=this._effectiveMinH,u=this._effectiveMaxW,f=this._effectiveMaxH;if(t==="e"||t==="se"||t==="ne"){const d=Math.min(u,c-this._startLeft);s.style.width=`${Math.min(Math.max(this._startW+n,o),d)}px`}if(t==="w"||t==="sw"||t==="nw"){const d=this._startLeft+this._startW,p=Math.min(Math.max(this._startLeft+n,r,d-u),d-o);s.style.left=`${p}px`,s.style.width=`${d-p}px`}if(t==="s"||t==="se"||t==="sw"){const d=Math.min(f,a-this._startTop);s.style.height=`${Math.min(Math.max(this._startH+i,h),d)}px`}if(t==="n"||t==="ne"||t==="nw"){const d=this._startTop+this._startH,p=Math.min(Math.max(this._startTop+i,l,d-f),d-h);s.style.top=`${p}px`,s.style.height=`${d-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 s=i.getBoundingClientRect();return[s.left,s.top,s.right,s.bottom]}const n=t.getBoundingClientRect();return[n.left,n.top,n.right,n.bottom]}}class Hn{constructor(t){this._callback=null,this._frame=0,t?.addController(this)}get pending(){return this._frame!==0}schedule(t){this._callback=t,!this._frame&&(this._frame=requestAnimationFrame(n=>{const i=this._callback;this._frame=0,this._callback=null,i?.(n)}))}cancel(){this._frame&&(cancelAnimationFrame(this._frame),this._frame=0,this._callback=null)}hostDisconnected(){this.cancel()}}function Ue(e){const t=e.visualViewport,n=t?.offsetLeft??0,i=t?.offsetTop??0,s=t?.width??e.innerWidth,r=t?.height??e.innerHeight;return{left:n,top:i,width:s,height:r,right:n+s,bottom:i+r}}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 Wn={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"},Go={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"},Bn=typeof CSS<"u"&&CSS.supports("position-try-fallbacks: flip-block")&&CSS.supports("min-width: anchor-size(width)");let Un=null,Ve=null;function Ko(){return Bn?Promise.resolve(null):(Ve||(Ve=Promise.resolve().then(()=>Zp).then(e=>(Un=e.default,Un)).catch(()=>null)),Ve)}let Qo=0;class Jo{constructor(t,n){this._styleEl=null,this._adoptedSheet=null,this._connected=!1,this._clampScheduler=new Hn,this._clampLoopActive=!1,this._settleFramesRemaining=0,this._stableFrames=0,this._lastNaturalRect="",this._appliedDx=0,this._appliedDy=0,this._geometryAbort=null,this._resizeObserver=null,this._intersectionObserver=null,this._mutationObserver=null,this._$observedAnchor=null,this._$observedFloating=null,this._handleGeometryChange=()=>{this._scheduleClamp()},this._opts=n,this._uid=`rc-anchor-${++Qo}`,t.addController(this)}setOptions(t){Object.assign(this._opts,t),this._applyAndPolyfill()}update(){this._applyAndPolyfill()}hostConnected(){this._connected=!0,this._applyAndPolyfill()}hostDisconnected(){this._connected=!1,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._connected||!this._apply()||(Bn?(this._startWatchingGeometry(),this._scheduleClamp()):this._applyPolyfillOrFallback().then(()=>{this._connected&&!this._opts.disabled&&(this._startWatchingGeometry(),this._scheduleClamp())}))}_scheduleClamp(){!this._connected||this._opts.disabled||(this._clampLoopActive||(this._clampLoopActive=!0),this._settleFramesRemaining=10,this._stableFrames=0,this._lastNaturalRect="",this._clampScheduler.schedule(()=>this._runClampTick()))}_runClampTick(){if(!this._connected||this._opts.disabled){this._stopClampLoop();return}const t=this._floating();if(!t){this._stopClampLoop();return}const n=t.getBoundingClientRect();if(!(n.width>0||n.height>0)){this._stopClampLoop(),this._stopWatchingGeometry();return}const s=[n.left-this._appliedDx,n.top-this._appliedDy,n.width,n.height].map(r=>Math.round(r*4)/4).join(":");if(this._stableFrames=s===this._lastNaturalRect?this._stableFrames+1:0,this._lastNaturalRect=s,this._settleFramesRemaining-=1,this._clampToViewport(n),this._stableFrames>=3||this._settleFramesRemaining<=0){this._stopClampLoop();return}this._clampScheduler.schedule(()=>this._runClampTick())}_stopClampLoop(){this._clampScheduler.cancel(),this._clampLoopActive=!1,this._settleFramesRemaining=0,this._stableFrames=0,this._lastNaturalRect=""}_startWatchingGeometry(){const t=this._anchor(),n=this._floating();if(!t||!n){this._stopWatchingGeometry();return}if(this._geometryAbort&&this._$observedAnchor===t&&this._$observedFloating===n)return;this._stopWatchingGeometry(),this._$observedAnchor=t,this._$observedFloating=n,this._geometryAbort=new AbortController;const i=n.ownerDocument.defaultView,s={passive:!0,signal:this._geometryAbort.signal};n.ownerDocument.addEventListener("scroll",this._handleGeometryChange,{...s,capture:!0}),i?.addEventListener("resize",this._handleGeometryChange,s),i?.visualViewport?.addEventListener("resize",this._handleGeometryChange,s),i?.visualViewport?.addEventListener("scroll",this._handleGeometryChange,s),typeof ResizeObserver=="function"&&(this._resizeObserver=new ResizeObserver(this._handleGeometryChange),this._resizeObserver.observe(t),this._resizeObserver.observe(n)),typeof IntersectionObserver=="function"&&(this._intersectionObserver=new IntersectionObserver(this._handleGeometryChange,{threshold:[0,1]}),this._intersectionObserver.observe(n)),typeof MutationObserver=="function"&&(this._mutationObserver=new MutationObserver(this._handleGeometryChange),this._mutationObserver.observe(t,{attributes:!0,attributeFilter:["class","style","hidden","open"]}),this._mutationObserver.observe(n,{attributes:!0,attributeFilter:["class","style","hidden","open"]}))}_stopWatchingGeometry(){this._geometryAbort?.abort(),this._geometryAbort=null,this._resizeObserver?.disconnect(),this._resizeObserver=null,this._intersectionObserver?.disconnect(),this._intersectionObserver=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._$observedAnchor=null,this._$observedFloating=null}_clampToViewport(t){const n=this._floating();if(!n)return;const i=4,s=t??n.getBoundingClientRect();if(s.width===0&&s.height===0)return;const r=n.ownerDocument.defaultView;if(!r)return;const l=Ue(r),c=s.left-this._appliedDx,a=s.right-this._appliedDx,o=s.top-this._appliedDy,h=s.bottom-this._appliedDy;let u=0,f=0;a>l.right-i&&(u=l.right-i-a),c+u<l.left+i&&(u=l.left+i-c),h>l.bottom-i&&(f=l.bottom-i-h),o+f<l.top+i&&(f=l.top+i-o),this._appliedDx=u,this._appliedDy=f;const d=u||f?`${u}px ${f}px`:"",p=`${Math.max(0,l.width-i*2)}px`,g=`${Math.max(0,l.height-i*2)}px`;n.style.translate!==d&&(n.style.translate=d),n.style.getPropertyValue("--rc-anchor-viewport-inline-size")!==p&&n.style.setProperty("--rc-anchor-viewport-inline-size",p),n.style.getPropertyValue("--rc-anchor-viewport-block-size")!==g&&n.style.setProperty("--rc-anchor-viewport-block-size",g)}async _applyPolyfillOrFallback(){const t=await Ko();if(!this._connected||this._opts.disabled)return;const n=this._shadowHost();t?await t({roots:n?[n]:void 0,useAnimationFrame:!1}):this._positionFallback()}_apply(){if(this._opts.disabled)return this._cleanup(),!1;const t=this._anchor(),n=this._floating();if(!t||!n)return this._stopClampLoop(),!1;const i=this._opts.placement??"bottom-start",s=this._opts.offset??4,r=this._opts.flip??!0,l=`--${this._uid}`,c=this._uid;t.style.setProperty("anchor-name",l),n.setAttribute("data-rc-anchor",c);const a=Wn[i],o=Go[i],h=Wn[o],u=r?`
|
|
2
|
+
@position-try --${c}-end { ${pe(o,s)} }
|
|
3
|
+
@position-try --${c}-flip { ${pe(a,s)} }
|
|
4
|
+
@position-try --${c}-both { ${pe(h,s)} }
|
|
5
|
+
`:"",f=r?`position-try-fallbacks: --${c}-end, --${c}-flip, --${c}-both;`:"",d=`
|
|
6
|
+
${u}
|
|
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,s)}
|
|
13
|
+
${f}
|
|
14
|
+
}
|
|
15
|
+
`;return this._injectStyles(d),!0}_injectStyles(t){const n=this._shadowHost();if(n?.shadowRoot)this._adoptedSheet||(this._adoptedSheet=new CSSStyleSheet,n.shadowRoot.adoptedStyleSheets=[...n.shadowRoot.adoptedStyleSheets,this._adoptedSheet]),this._adoptedSheet.replaceSync(t);else{this._styleEl?.remove();const i=this._floating()?.ownerDocument??this._anchor()?.ownerDocument;if(!i)return;this._styleEl=i.createElement("style"),this._styleEl.setAttribute("data-rc-anchor-style",this._uid),this._styleEl.textContent=t,i.head.appendChild(this._styleEl)}}_positionFallback(){const t=this._anchor(),n=this._floating();if(!t||!n)return;const i=this._opts.placement??"bottom-start",s=this._opts.offset??4,r=this._opts.flip??!0,l=4,c=t.getBoundingClientRect(),a=t.ownerDocument.defaultView;if(!a)return;const o=Ue(a),h=a.innerWidth,u=a.innerHeight;n.style.position="fixed",n.style.boxSizing="border-box",n.style.minWidth=`${c.width}px`,n.style.top="",n.style.bottom="",n.style.left="",n.style.right="";const f=n.offsetWidth||c.width,d=n.offsetHeight||0,p=i.split("-")[0],g=i.endsWith("-start")?"start":i.endsWith("-end")?"end":"center";let y=p;if(p==="top"||p==="bottom"){const _=o.bottom-c.bottom,w=c.top-o.top;r&&(p==="bottom"&&_<d+s&&w>_?y="top":p==="top"&&w<d+s&&_>w&&(y="bottom")),y==="top"?n.style.bottom=`${u-c.top+s}px`:n.style.top=`${c.bottom+s}px`;let v=g==="end"?c.right-f:g==="start"?c.left:c.left+c.width/2-f/2;v=Math.max(o.left+l,Math.min(v,o.right-f-l)),n.style.left=`${v}px`}else{const _=o.right-c.right,w=c.left-o.left;r&&(p==="right"&&_<f+s&&w>_?y="left":p==="left"&&w<f+s&&_>w&&(y="right")),y==="left"?n.style.right=`${h-c.left+s}px`:n.style.left=`${c.right+s}px`;let v=g==="end"?c.bottom-d:g==="start"?c.top:c.top+c.height/2-d/2;v=Math.max(o.top+l,Math.min(v,o.bottom-d-l)),n.style.top=`${v}px`}}_cleanup(){this._stopClampLoop(),this._stopWatchingGeometry(),this._appliedDx=0,this._appliedDy=0;const t=this._anchor(),n=this._floating();t&&t.style.removeProperty("anchor-name"),n&&(n.removeAttribute("data-rc-anchor"),n.style.translate="",n.style.removeProperty("--rc-anchor-viewport-inline-size"),n.style.removeProperty("--rc-anchor-viewport-block-size")),this._styleEl?.remove(),this._styleEl=null;const i=this._shadowHost();i?.shadowRoot&&this._adoptedSheet&&(i.shadowRoot.adoptedStyleSheets=i.shadowRoot.adoptedStyleSheets.filter(s=>s!==this._adoptedSheet),this._adoptedSheet=null)}}class Zo{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())}}class tl{constructor(t,n){this._attached=null,this._observer=null,this._options=n,t.addController(this)}setOptions(t){this._detach(),Object.assign(this._options,t),this._attach()}hostConnected(){this._attach()}hostDisconnected(){this._detach()}_resolveTarget(){const{target:t}=this._options;return typeof t=="function"?t():t??null}_attach(){if(this._options.disabled||this._attached)return;const t=this._resolveTarget();t&&(this._observer??=new MutationObserver(this._options.callback),this._observer.observe(t,this._options.observerOptions??{childList:!0}),this._attached=t)}_detach(){this._observer?.disconnect(),this._attached=null}}class el{constructor(t,n){this._frame=0,this._links=[],this._host=t,this._options=n,t.addController(this)}hostConnected(){this.sync()}hostDisconnected(){this._mutationObserver?.disconnect(),this._resizeObserver?.disconnect(),this._mutationObserver=void 0,this._resizeObserver=void 0,this._frame&&cancelAnimationFrame(this._frame),this._frame=0}sync(){this._collectLinks(),this._observeLinks(),this.update()}update(){this._frame&&cancelAnimationFrame(this._frame),this._frame=requestAnimationFrame(()=>{this._frame=0,this._positionIndicator()})}_collectLinks(){const n=this._options.slot()?.assignedElements({flatten:!0})??[],i=new Set;for(const s of n)s instanceof HTMLAnchorElement&&i.add(s),s.querySelectorAll("a").forEach(r=>i.add(r));this._links=Array.from(i)}_observeLinks(){this._mutationObserver?.disconnect(),this._resizeObserver?.disconnect(),this._mutationObserver=new MutationObserver(()=>{this._collectLinks(),this._observeLinks(),this.update()}),this._resizeObserver=new ResizeObserver(()=>this.update()),this._resizeObserver.observe(this._host);for(const t of this._links){this._mutationObserver.observe(t,{attributes:!0,attributeFilter:["aria-current","class","data-active"],childList:!0,subtree:!0}),this._resizeObserver.observe(t);const n=this._targetFor(t);n&&n!==t&&this._resizeObserver.observe(n)}}_activeLink(){const t=this._options.activeSelector().trim();if(t){const n=this._links.find(i=>i.matches(t));if(n)return n}return this._links.find(n=>{const i=n.getAttribute("aria-current");return i!==null&&i!==""&&i!=="false"})??null}_targetFor(t){const n=this._options.indicatorTargetSelector().trim();if(n){const i=t.matches(n)?t:t.querySelector(n);if(i)return i}return t.querySelector("[data-rc-navigation-indicator]")??t.querySelector("[data-rc-navigation-icon]")??t}_positionIndicator(){const t=this._options.container(),n=this._options.indicator(),i=this._activeLink();if(this._host.toggleAttribute("has-active",!!i),!t||!n||!i){n?.toggleAttribute("hidden",!0);return}const s=this._targetFor(i),r=t.getBoundingClientRect(),l=s.getBoundingClientRect();if(!l.width||!l.height){n.toggleAttribute("hidden",!0);return}n.toggleAttribute("hidden",!1),n.style.inlineSize=`${l.width}px`,n.style.blockSize=`${l.height}px`,n.style.transform=`translate(${l.left-r.left}px, ${l.top-r.top}px)`}}class nl{constructor(t){this._buffer="",this._timer=0,this._options=t}get buffer(){return this._buffer}reset(){this._buffer="",this._clearTimer()}handleKeydown(t){return t.key.length!==1||t.altKey||t.ctrlKey||t.metaKey?!1:(this.search(t.key),t.preventDefault(),!0)}search(t){this._buffer+=t.toLocaleLowerCase(),this._scheduleReset();const n=this._options.items();if(!n.length)return null;const i=this._options.startIndex?.()??0,s=n.length;for(let r=1;r<=s;r+=1){const l=(i+r)%s,c=n[l];if(this._options.text(c).trim().toLocaleLowerCase().startsWith(this._buffer))return this._options.onMatch(c,l),c}return null}_scheduleReset(){this._clearTimer(),this._timer=window.setTimeout(()=>this.reset(),this._options.timeout??500)}_clearTimer(){this._timer&&(window.clearTimeout(this._timer),this._timer=0)}}function il(e){let t=e.parentElement;for(;t&&t!==document.documentElement;){const{overflow:n,overflowY:i}=getComputedStyle(t);if(/auto|scroll/.test(i)||/auto|scroll/.test(n))return t;t=t.parentElement}return document.scrollingElement??document.documentElement}function Vn(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)}function Xn(e,t){return e.querySelector(t)}function Yn(e,t){return Array.from(e.querySelectorAll(t))}function sl(e,t){if(Yn(e,t.selector).length>=(t.minimum??1))return!1;const n=t.hostName??e.localName,i=t.childDescription??t.selector.replace(":scope > ",""),s=t.message??`[${n}] No direct child ${i} found. Place ${i} inside <${n}>.`;return console.warn(s,e),!0}class rl{constructor(t,n){this._observer=null,this._child=null,this._host=t,this._options=n,t.addController(this)}get child(){return this._child}hostConnected(){if(this.sync(),!this._options.observe)return;this._observer??=new MutationObserver(()=>this.sync());const t=this._options.observe===!0?{childList:!0}:this._options.observe;this._observer.observe(this._host,t)}hostDisconnected(){this._observer?.disconnect(),this._child=null}sync(){const t=this._child,n=Xn(this._host,this._options.selector);return this._child=n,n||this._options.onMissing?.(this._host),n!==t&&this._options.onChange?.(n,t),n}}var ol=Object.defineProperty,ll=(e,t,n,i)=>{for(var s=void 0,r=e.length-1,l;r>=0;r--)(l=e[r])&&(s=l(t,n,s)||s);return s&&ol(t,n,s),s};function al(e){class t extends e{constructor(){super(...arguments),this._items=[]}get items(){return this._items.map(i=>i.deref()).filter(i=>Vn(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 s=i.composedPath().find(r=>this.items.includes(r));s!=null&&(this._lastFocused=s,this.items.forEach(r=>r.setAttribute("tabindex","-1")),s.setAttribute("tabindex","0"))}_onSlotChange(i){const s=this._items;this._items=this._collectItems(i.currentTarget).map(r=>new WeakRef(r)),queueMicrotask(()=>{this.isConnected&&(s.forEach(r=>r.deref()?.removeAttribute("tabindex")),this._initItems())})}_initItems(){this._items.forEach(s=>s.deref()?.setAttribute("tabindex","-1"));const i=this.items[0];i&&i.setAttribute("tabindex","0")}}return ll([$o.state()],t.prototype,"_lastFocused"),t}function cl(e,t,n,i){const s=Math.min(Math.max(e,t),n);if(i<=0)return s;const r=Math.round((s-t)/i)*i+t;return Math.min(Math.max(r,t),n)}function hl(e,t,n){return n===t?0:Math.min(Math.max((e-t)/(n-t),0),1)}function ul(e,t){let n=-1,i=1/0;return e.forEach((s,r)=>{const l=Math.abs(s-t);Number.isFinite(s)&&l<i&&(n=r,i=l)}),n}function fl(e,t,n){if(n>0){const i=e.findIndex(s=>Number.isFinite(s)&&s>t);return i>=0?i:e.length-1}for(let i=e.length-1;i>=0;i-=1)if(Number.isFinite(e[i])&&e[i]<t)return i;return e.length>0?0:-1}function dl(e,t){return e.length===0?-1:t>0?e.length-1:0}var pl=Object.defineProperty,ml=Object.defineProperties,gl=Object.getOwnPropertyDescriptors,qn=Object.getOwnPropertySymbols,_l=Object.prototype.hasOwnProperty,yl=Object.prototype.propertyIsEnumerable,Gn=(e,t,n)=>t in e?pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))_l.call(t,n)&&Gn(e,n,t[n]);if(qn)for(var n of qn(t))yl.call(t,n)&&Gn(e,n,t[n]);return e},J=(e,t)=>ml(e,gl(t)),O=(e,t,n)=>new Promise((i,s)=>{var r=a=>{try{c(n.next(a))}catch(o){s(o)}},l=a=>{try{c(n.throw(a))}catch(o){s(o)}},c=a=>a.done?i(a.value):Promise.resolve(a.value).then(r,l);c((n=n.apply(e,t)).next())});const Xe=Math.min,Nt=Math.max,me=Math.round,ge=Math.floor,mt=e=>({x:e,y:e});function bl(e,t){return typeof e=="function"?e(t):e}function kl(e){return U({top:0,right:0,bottom:0,left:0},e)}function vl(e){return typeof e!="number"?kl(e):{top:e,right:e,bottom:e,left:e}}function _e(e){const{x:t,y:n,width:i,height:s}=e;return{width:i,height:s,top:n,left:t,right:t+i,bottom:n+s,x:t,y:n}}function Sl(e,t){return O(this,null,function*(){var n;t===void 0&&(t={});const{x:i,y:s,platform:r,rects:l,elements:c,strategy:a}=e,{boundary:o="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:f=!1,padding:d=0}=bl(t,e),p=vl(d),g=c[f?u==="floating"?"reference":"floating":u],y=_e(yield r.getClippingRect({element:(n=yield r.isElement==null?void 0:r.isElement(g))==null||n?g:g.contextElement||(yield r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:o,rootBoundary:h,strategy:a})),_=u==="floating"?{x:i,y:s,width:l.floating.width,height:l.floating.height}:l.reference,w=yield r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating),v=(yield r.isElement==null?void 0:r.isElement(w))?(yield r.getScale==null?void 0:r.getScale(w))||{x:1,y:1}:{x:1,y:1},T=_e(r.convertOffsetParentRelativeRectToViewportRelativeRect?yield r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:w,strategy:a}):_);return{top:(y.top-T.top+p.top)/v.y,bottom:(T.bottom-y.bottom+p.bottom)/v.y,left:(y.left-T.left+p.left)/v.x,right:(T.right-y.right+p.right)/v.x}})}function ye(){return typeof window<"u"}function Ht(e){return Kn(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=(Kn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Kn(e){return ye()?e instanceof Node||e instanceof et(e).Node:!1}function at(e){return ye()?e instanceof Element||e instanceof et(e).Element:!1}function _t(e){return ye()?e instanceof HTMLElement||e instanceof et(e).HTMLElement:!1}function Qn(e){return!ye()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof et(e).ShadowRoot}const wl=new Set(["inline","contents"]);function ie(e){const{overflow:t,overflowX:n,overflowY:i,display:s}=ct(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!wl.has(s)}const Cl=new Set(["table","td","th"]);function xl(e){return Cl.has(Ht(e))}const Ll=[":popover-open",":modal"];function be(e){return Ll.some(t=>{try{return e.matches(t)}catch{return!1}})}const Al=["transform","translate","scale","rotate","perspective"],Tl=["transform","translate","scale","rotate","perspective","filter"],El=["paint","layout","strict","content"];function Ye(e){const t=qe(),n=at(e)?ct(e):e;return Al.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)||Tl.some(i=>(n.willChange||"").includes(i))||El.some(i=>(n.contain||"").includes(i))}function Ol(e){let t=Ct(e);for(;_t(t)&&!Wt(t);){if(Ye(t))return t;if(be(t))return null;t=Ct(t)}return null}function qe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Pl=new Set(["html","body","#document"]);function Wt(e){return Pl.has(Ht(e))}function ct(e){return et(e).getComputedStyle(e)}function ke(e){return at(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ct(e){if(Ht(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qn(e)&&e.host||gt(e);return Qn(t)?t.host:t}function Jn(e){const t=Ct(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:_t(t)&&ie(t)?t:Jn(t)}function se(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Jn(e),r=s===((i=e.ownerDocument)==null?void 0:i.body),l=et(s);if(r){const c=Ge(l);return t.concat(l,l.visualViewport||[],ie(s)?s:[],c&&n?se(c):[])}return t.concat(s,se(s,[],n))}function Ge(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zn(e){const t=ct(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const s=_t(e),r=s?e.offsetWidth:n,l=s?e.offsetHeight:i,c=me(n)!==r||me(i)!==l;return c&&(n=r,i=l),{width:n,height:i,$:c}}function Ke(e){return at(e)?e:e.contextElement}function Bt(e){const t=Ke(e);if(!_t(t))return mt(1);const n=t.getBoundingClientRect(),{width:i,height:s,$:r}=Zn(t);let l=(r?me(n.width):n.width)/i,c=(r?me(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const Dl=mt(0);function ti(e){const t=et(e);return!qe()||!t.visualViewport?Dl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Il(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==et(e)?!1:t}function Ot(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=Ke(e);let l=mt(1);t&&(i?at(i)&&(l=Bt(i)):l=Bt(e));const c=Il(r,n,i)?ti(r):mt(0);let a=(s.left+c.x)/l.x,o=(s.top+c.y)/l.y,h=s.width/l.x,u=s.height/l.y;if(r){const f=et(r),d=i&&at(i)?et(i):i;let p=f,g=Ge(p);for(;g&&i&&d!==p;){const y=Bt(g),_=g.getBoundingClientRect(),w=ct(g),v=_.left+(g.clientLeft+parseFloat(w.paddingLeft))*y.x,T=_.top+(g.clientTop+parseFloat(w.paddingTop))*y.y;a*=y.x,o*=y.y,h*=y.x,u*=y.y,a+=v,o+=T,p=et(g),g=Ge(p)}}return _e({width:h,height:u,x:a,y:o})}function ve(e,t){const n=ke(e).scrollLeft;return t?t.left+n:Ot(gt(e)).left+n}function ei(e,t){const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-ve(e,n),s=n.top+t.scrollTop;return{x:i,y:s}}function Rl(e){let{elements:t,rect:n,offsetParent:i,strategy:s}=e;const r=s==="fixed",l=gt(i),c=t?be(t.floating):!1;if(i===l||c&&r)return n;let a={scrollLeft:0,scrollTop:0},o=mt(1);const h=mt(0),u=_t(i);if((u||!u&&!r)&&((Ht(i)!=="body"||ie(l))&&(a=ke(i)),_t(i))){const d=Ot(i);o=Bt(i),h.x=d.x+i.clientLeft,h.y=d.y+i.clientTop}const f=l&&!u&&!r?ei(l,a):mt(0);return{width:n.width*o.x,height:n.height*o.y,x:n.x*o.x-a.scrollLeft*o.x+h.x+f.x,y:n.y*o.y-a.scrollTop*o.y+h.y+f.y}}function Ml(e){return Array.from(e.getClientRects())}function Fl(e){const t=gt(e),n=ke(e),i=e.ownerDocument.body,s=Nt(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=Nt(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let l=-n.scrollLeft+ve(e);const c=-n.scrollTop;return ct(i).direction==="rtl"&&(l+=Nt(t.clientWidth,i.clientWidth)-s),{width:s,height:r,x:l,y:c}}const ni=25;function $l(e,t){const n=et(e),i=gt(e),s=n.visualViewport;let r=i.clientWidth,l=i.clientHeight,c=0,a=0;if(s){r=s.width,l=s.height;const h=qe();(!h||h&&t==="fixed")&&(c=s.offsetLeft,a=s.offsetTop)}const o=ve(i);if(o<=0){const h=i.ownerDocument,u=h.body,f=getComputedStyle(u),d=h.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(i.clientWidth-u.clientWidth-d);p<=ni&&(r-=p)}else o<=ni&&(r+=o);return{width:r,height:l,x:c,y:a}}const zl=new Set(["absolute","fixed"]);function jl(e,t){const n=Ot(e,!0,t==="fixed"),i=n.top+e.clientTop,s=n.left+e.clientLeft,r=_t(e)?Bt(e):mt(1),l=e.clientWidth*r.x,c=e.clientHeight*r.y,a=s*r.x,o=i*r.y;return{width:l,height:c,x:a,y:o}}function ii(e,t,n){let i;if(t==="viewport")i=$l(e,n);else if(t==="document")i=Fl(gt(e));else if(at(t))i=jl(t,n);else{const s=ti(e);i={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return _e(i)}function si(e,t){const n=Ct(e);return n===t||!at(n)||Wt(n)?!1:ct(n).position==="fixed"||si(n,t)}function Nl(e,t){const n=t.get(e);if(n)return n;let i=se(e,[],!1).filter(c=>at(c)&&Ht(c)!=="body"),s=null;const r=ct(e).position==="fixed";let l=r?Ct(e):e;for(;at(l)&&!Wt(l);){const c=ct(l),a=Ye(l);!a&&c.position==="fixed"&&(s=null),(r?!a&&!s:!a&&c.position==="static"&&s&&zl.has(s.position)||ie(l)&&!a&&si(e,l))?i=i.filter(o=>o!==l):s=c,l=Ct(l)}return t.set(e,i),i}function Hl(e){let{element:t,boundary:n,rootBoundary:i,strategy:s}=e;const r=[...n==="clippingAncestors"?be(t)?[]:Nl(t,this._c):[].concat(n),i],l=r[0],c=r.reduce((a,o)=>{const h=ii(t,o,s);return a.top=Nt(h.top,a.top),a.right=Xe(h.right,a.right),a.bottom=Xe(h.bottom,a.bottom),a.left=Nt(h.left,a.left),a},ii(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Wl(e){const{width:t,height:n}=Zn(e);return{width:t,height:n}}function Bl(e,t,n){const i=_t(t),s=gt(t),r=n==="fixed",l=Ot(e,!0,r,t);let c={scrollLeft:0,scrollTop:0};const a=mt(0);function o(){a.x=ve(s)}if(i||!i&&!r)if((Ht(t)!=="body"||ie(s))&&(c=ke(t)),i){const d=Ot(t,!0,r,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else s&&o();r&&!i&&s&&o();const h=s&&!i&&!r?ei(s,c):mt(0),u=l.left+c.scrollLeft-a.x-h.x,f=l.top+c.scrollTop-a.y-h.y;return{x:u,y:f,width:l.width,height:l.height}}function Qe(e){return ct(e).position==="static"}function ri(e,t){if(!_t(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 oi(e,t){const n=et(e);if(be(e))return n;if(!_t(e)){let s=Ct(e);for(;s&&!Wt(s);){if(at(s)&&!Qe(s))return s;s=Ct(s)}return n}let i=ri(e,t);for(;i&&xl(i)&&Qe(i);)i=ri(i,t);return i&&Wt(i)&&Qe(i)&&!Ye(i)?n:i||Ol(e)||n}const Ul=function(e){return O(this,null,function*(){const t=this.getOffsetParent||oi,n=this.getDimensions,i=yield n(e.floating);return{reference:Bl(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:Rl,getDocumentElement:gt,getClippingRect:Hl,getOffsetParent:oi,getElementRects:Ul,getClientRects:Ml,getDimensions:Wl,getScale:Bt,isElement:at,isRTL:Vl};function li(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xl(e,t){let n=null,i;const s=gt(e);function r(){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),r();const o=e.getBoundingClientRect(),{left:h,top:u,width:f,height:d}=o;if(c||t(),!f||!d)return;const p=ge(u),g=ge(s.clientWidth-(h+f)),y=ge(s.clientHeight-(u+d)),_=ge(h),w={rootMargin:-p+"px "+-g+"px "+-y+"px "+-_+"px",threshold:Nt(0,Xe(1,a))||1};let v=!0;function T(pt){const C=pt[0].intersectionRatio;if(C!==a){if(!v)return l();C?l(!1,C):i=setTimeout(()=>{l(!1,1e-7)},1e3)}C===1&&!li(o,e.getBoundingClientRect())&&l(),v=!1}try{n=new IntersectionObserver(T,J(U({},w),{root:s.ownerDocument}))}catch{n=new IntersectionObserver(T,w)}n.observe(e)}return l(!0),r}function Je(e,t,n,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=i,o=Ke(e),h=s||r?[...o?se(o):[],...se(t)]:[];h.forEach(_=>{s&&_.addEventListener("scroll",n,{passive:!0}),r&&_.addEventListener("resize",n)});const u=o&&c?Xl(o,n):null;let f=-1,d=null;l&&(d=new ResizeObserver(_=>{let[w]=_;w&&w.target===o&&d&&(d.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var v;(v=d)==null||v.observe(t)})),n()}),o&&!a&&d.observe(o),d.observe(t));let p,g=a?Ot(e):null;a&&y();function y(){const _=Ot(e);g&&!li(g,_)&&n(),g=_,p=requestAnimationFrame(y)}return n(),()=>{var _;h.forEach(w=>{s&&w.removeEventListener("scroll",n),r&&w.removeEventListener("resize",n)}),u?.(),(_=d)==null||_.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const Yl=Sl,{hasOwnProperty:Ze}=Object.prototype,re=function(){};function ai(e){return typeof e=="function"?e:re}function ci(e,t){return function(n,i,s){n.type===t&&e.call(this,n,i,s)}}function ql(e,t){const n=t.structure,i=[];for(const s in n){if(Ze.call(n,s)===!1)continue;let r=n[s];const l={name:s,type:!1,nullable:!1};Array.isArray(r)||(r=[r]);for(const c of r)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 Gl(e){const t={};for(const n in e.node)if(Ze.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]=ql(n,i)}return t}function hi(e,t){const n=e.fields.slice(),i=e.context,s=typeof i=="string";return t&&n.reverse(),function(r,l,c,a){let o;s&&(o=l[i],l[i]=r);for(const h of n){const u=r[h.name];if(!h.nullable||u){if(h.type==="list"){if(t?u.reduceRight(a,!1):u.reduce(a,!1))return!0}else if(c(u))return!0}}s&&(l[i]=o)}}function ui({StyleSheet:e,Atrule:t,Rule:n,Block:i,DeclarationList:s}){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:s}}}function Kl(e){const t=Gl(e),n={},i={},s=Symbol("break-walk"),r=Symbol("skip-node");for(const o in t)Ze.call(t,o)&&t[o]!==null&&(n[o]=hi(t[o],!1),i[o]=hi(t[o],!0));const l=ui(n),c=ui(i),a=function(o,h){function u(_,w,v){const T=f.call(y,_,w,v);return T===s?!0:T===r?!1:!!(p.hasOwnProperty(_.type)&&p[_.type](_,y,u,g)||d.call(y,_,w,v)===s)}let f=re,d=re,p=n,g=(_,w,v,T)=>_||u(w,v,T);const y={break:s,skip:r,root:o,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof h=="function")f=h;else if(h&&(f=ai(h.enter),d=ai(h.leave),h.reverse&&(p=i),h.visit)){if(l.hasOwnProperty(h.visit))p=h.reverse?c[h.visit]:l[h.visit];else if(!t.hasOwnProperty(h.visit))throw new Error("Bad value `"+h.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(", ")+")");f=ci(f,h.visit),d=ci(d,h.visit)}if(f===re&&d===re)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");u(o)};return a.break=s,a.skip=r,a.find=function(o,h){let u=null;return a(o,function(f,d,p){if(h.call(this,f,d,p))return u=f,s}),u},a.findLast=function(o,h){let u=null;return a(o,{reverse:!0,enter(f,d,p){if(h.call(this,f,d,p))return u=f,s}}),u},a.findAll=function(o,h){const u=[];return a(o,function(f,d,p){h.call(this,f,d,p)&&u.push(f)}),u},a}const xt=0,m=1,x=2,B=3,I=4,wt=5,Ql=6,Y=7,ht=8,A=9,S=10,j=11,L=12,N=13,Se=14,it=15,q=16,Z=17,ut=18,Ut=19,oe=20,P=21,k=22,ft=23,Vt=24,G=25,Jl=0;function st(e){return e>=48&&e<=57}function Xt(e){return st(e)||e>=65&&e<=70||e>=97&&e<=102}function tn(e){return e>=65&&e<=90}function Zl(e){return e>=97&&e<=122}function ta(e){return tn(e)||Zl(e)}function ea(e){return e>=128}function we(e){return ta(e)||ea(e)||e===95}function fi(e){return we(e)||st(e)||e===45}function na(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 Pt(e){return Ce(e)||e===32||e===9}function yt(e,t){return!(e!==92||Ce(t)||t===Jl)}function en(e,t,n){return e===45?we(t)||t===45||yt(t,n):we(e)?!0:e===92?yt(e,t):!1}function nn(e,t,n){return e===43||e===45?st(t)?2:t===46&&st(n)?3:0:e===46?st(t)?2:0:st(e)?1:0}function di(e){return e===65279||e===65534?1:0}const sn=new Array(128),ia=128,xe=130,pi=131,rn=132,mi=133;for(let e=0;e<sn.length;e++)sn[e]=Pt(e)&&xe||st(e)&&pi||we(e)&&rn||na(e)&&mi||e||ia;function on(e){return e<128?sn[e]:rn}function Yt(e,t){return t<e.length?e.charCodeAt(t):0}function ln(e,t,n){return n===13&&Yt(e,t+1)===10?2:1}function gi(e,t,n){let i=e.charCodeAt(t);return tn(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 s=t;s<n;s++){const r=i.charCodeAt(s-t);let l=e.charCodeAt(s);if(tn(l)&&(l=l|32),l!==r)return!1}return!0}function sa(e,t){for(;t>=0&&Pt(e.charCodeAt(t));t--);return t+1}function Ae(e,t){for(;t<e.length&&Pt(e.charCodeAt(t));t++);return t}function an(e,t){for(;t<e.length&&st(e.charCodeAt(t));t++);return t}function qt(e,t){if(t+=2,Xt(Yt(e,t-1))){for(const i=Math.min(e.length,t+5);t<i&&Xt(Yt(e,t));t++);const n=Yt(e,t);Pt(n)&&(t+=ln(e,t,n))}return t}function Te(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(!fi(n)){if(yt(n,Yt(e,t+1))){t=qt(e,t)-1;continue}break}}return t}function _i(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),st(n)&&(t=an(e,t+1),n=e.charCodeAt(t)),n===46&&st(e.charCodeAt(t+1))&&(t+=2,t=an(e,t)),gi(e,t,101)){let i=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(i=1,n=e.charCodeAt(t+2)),st(n)&&(t=an(e,t+1+i+1))}return t}function cn(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(n===41){t++;break}yt(n,Yt(e,t+1))&&(t=qt(e,t))}return t}function yi(e){if(e.length===1&&!Xt(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 bi=["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"],ra=16*1024;function Ee(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,ra)):e}const ki=10,oa=12,vi=13;function Si(e){const t=e.source,n=t.length,i=t.length>0?di(t.charCodeAt(0)):0,s=Ee(e.lines,n),r=Ee(e.columns,n);let l=e.startLine,c=e.startColumn;for(let a=i;a<n;a++){const o=t.charCodeAt(a);s[a]=l,r[a]=c++,(o===ki||o===vi||o===oa)&&(o===vi&&a+1<n&&t.charCodeAt(a+1)===ki&&(a++,s[a]=l,r[a]=c),l++,c=1)}s[n]=l,r[n]=c,e.lines=s,e.columns=r,e.computed=!0}class la{constructor(t,n,i,s){this.setSource(t,n,i,s),this.lines=null,this.columns=null}setSource(t="",n=0,i=1,s=1){this.source=t,this.startOffset=n,this.startLine=i,this.startColumn=s,this.computed=!1}getLocation(t,n){return this.computed||Si(this),{source:n,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,n,i){return this.computed||Si(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,kt=24,Dt=new Uint8Array(32);Dt[x]=k,Dt[P]=k,Dt[Ut]=oe,Dt[ft]=Vt;function wi(e){return Dt[e]!==0}class aa{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,s=Ee(this.offsetAndType,t.length+1),r=Ee(this.balance,t.length+1);let l=0,c=-1,a=0,o=t.length;this.offsetAndType=null,this.balance=null,r.fill(0),n(t,(h,u,f)=>{const d=l++;if(s[d]=h<<kt|f,c===-1&&(c=u),r[d]=o,h===a){const p=r[o];r[o]=d,o=p,a=Dt[s[p]>>kt]}else wi(h)&&(o=d,a=Dt[h])}),s[l]=xt<<kt|i,r[l]=l;for(let h=0;h<l;h++){const u=r[h];if(u<=h){const f=r[u];f!==h&&(r[h]=f)}else u>l&&(r[h]=l)}this.source=t,this.firstCharOffset=c===-1?0:c,this.tokenCount=l,this.offsetAndType=s,this.balance=r,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t]>>kt:xt}lookupTypeNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){const i=this.offsetAndType[n]>>kt;if(i!==N&&i!==G&&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]>>kt;if(i!==N&&i!==G&&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)===A&&this.source.charCodeAt(this.lookupOffset(n))===t:this.tokenType===A&&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>>kt,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>>kt,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===G;)this.next()}skipUntilBalanced(t,n){let i=t,s=0,r=0;t:for(;i<this.tokenCount;i++){if(s=this.balance[i],s<t)break t;switch(r=i>0?this.offsetAndType[i-1]&bt:this.firstCharOffset,n(this.source.charCodeAt(r))){case 1:break t;case 2:i++;break t;default:wi(this.offsetAndType[i]>>kt)&&(i=s)}}this.skip(i-this.tokenIndex)}forEachToken(t){for(let n=0,i=this.firstCharOffset;n<this.tokenCount;n++){const s=i,r=this.offsetAndType[n],l=r&bt,c=r>>kt;i=l,t(c,s,l,n)}}dump(){const t=new Array(this.tokenCount);return this.forEachToken((n,i,s,r)=>{t[r]={idx:r,type:bi[n],chunk:this.source.substring(i,s),balance:this.balance[r]}}),t}}function Ci(e,t){function n(u){return u<c?e.charCodeAt(u):0}function i(){if(o=_i(e,o),en(n(o),n(o+1),n(o+2))){h=L,o=Te(e,o);return}if(n(o)===37){h=j,o++;return}h=S}function s(){const u=o;if(o=Te(e,o),Le(e,u,o,"url")&&n(o)===40){if(o=Ae(e,o+1),n(o)===34||n(o)===39){h=x,o=u+4;return}l();return}if(n(o)===40){h=x,o++;return}h=m}function r(u){for(u||(u=n(o++)),h=wt;o<e.length;o++){const f=e.charCodeAt(o);switch(on(f)){case u:o++;return;case xe:if(Ce(f)){o+=ln(e,o,f),h=Ql;return}break;case 92:if(o===e.length-1)break;const d=n(o+1);Ce(d)?o+=ln(e,o+1,d):yt(f,d)&&(o=qt(e,o)-1);break}}}function l(){for(h=Y,o=Ae(e,o);o<e.length;o++){const u=e.charCodeAt(o);switch(on(u)){case 41:o++;return;case xe:if(o=Ae(e,o),n(o)===41||o>=e.length){o<e.length&&o++;return}o=cn(e,o),h=ht;return;case 34:case 39:case 40:case mi:o=cn(e,o),h=ht;return;case 92:if(yt(u,n(o+1))){o=qt(e,o)-1;break}o=cn(e,o),h=ht;return}}}e=String(e||"");const c=e.length;let a=di(n(0)),o=a,h;for(;o<c;){const u=e.charCodeAt(o);switch(on(u)){case xe:h=N,o=Ae(e,o+1);break;case 34:r();break;case 35:fi(n(o+1))||yt(n(o+1),n(o+2))?(h=I,o=Te(e,o+1)):(h=A,o++);break;case 39:r();break;case 40:h=P,o++;break;case 41:h=k,o++;break;case 43:nn(u,n(o+1),n(o+2))?i():(h=A,o++);break;case 44:h=ut,o++;break;case 45:nn(u,n(o+1),n(o+2))?i():n(o+1)===45&&n(o+2)===62?(h=it,o=o+3):en(u,n(o+1),n(o+2))?s():(h=A,o++);break;case 46:nn(u,n(o+1),n(o+2))?i():(h=A,o++);break;case 47:n(o+1)===42?(h=G,o=e.indexOf("*/",o+2),o=o===-1?e.length:o+2):(h=A,o++);break;case 58:h=q,o++;break;case 59:h=Z,o++;break;case 60:n(o+1)===33&&n(o+2)===45&&n(o+3)===45?(h=Se,o=o+4):(h=A,o++);break;case 64:en(n(o+1),n(o+2),n(o+3))?(h=B,o=Te(e,o+1)):(h=A,o++);break;case 91:h=Ut,o++;break;case 92:yt(u,n(o+1))?s():(h=A,o++);break;case 93:h=oe,o++;break;case 123:h=ft,o++;break;case 125:h=Vt,o++;break;case pi:i();break;case rn:s();break;default:h=A,o++}t(h,a,a=o)}}const vt=43,rt=45,Oe=110,It=!0,ca=!1;function Pe(e,t){let n=this.tokenStart+e;const i=this.charCodeAt(n);for((i===vt||i===rt)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)st(this.charCodeAt(n))||this.error("Integer is expected",n)}function Gt(e){return Pe.call(this,0,e)}function Lt(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case Oe:n="N is expected";break;case rt:n="HyphenMinus is expected";break}this.error(n,this.tokenStart+e)}}function hn(){let e=0,t=0,n=this.tokenType;for(;n===N||n===G;)n=this.lookupType(++e);if(n!==S)if(this.isDelim(vt,e)||this.isDelim(rt,e)){t=this.isDelim(vt,e)?vt:rt;do n=this.lookupType(++e);while(n===N||n===G);n!==S&&(this.skip(e),Gt.call(this,It))}else return null;return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==vt&&n!==rt&&this.error("Number sign is expected")),Gt.call(this,t!==0),t===rt?"-"+this.consume(S):this.consume(S)}const ha="AnPlusB",ua={a:[String,null],b:[String,null]};function xi(){const e=this.tokenStart;let t=null,n=null;if(this.tokenType===S)Gt.call(this,ca),n=this.consume(S);else if(this.tokenType===m&&this.cmpChar(this.tokenStart,rt))switch(t="-1",Lt.call(this,1,Oe),this.tokenEnd-this.tokenStart){case 2:this.next(),n=hn.call(this);break;case 3:Lt.call(this,2,rt),this.next(),this.skipSC(),Gt.call(this,It),n="-"+this.consume(S);break;default:Lt.call(this,2,rt),Pe.call(this,3,It),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===m||this.isDelim(vt)&&this.lookupType(1)===m){let i=0;switch(t="1",this.isDelim(vt)&&(i=1,this.next()),Lt.call(this,0,Oe),this.tokenEnd-this.tokenStart){case 1:this.next(),n=hn.call(this);break;case 2:Lt.call(this,1,rt),this.next(),this.skipSC(),Gt.call(this,It),n="-"+this.consume(S);break;default:Lt.call(this,1,rt),Pe.call(this,2,It),this.next(),n=this.substrToCursor(e+i+1)}}else if(this.tokenType===L){const i=this.charCodeAt(this.tokenStart),s=i===vt||i===rt;let r=this.tokenStart+s;for(;r<this.tokenEnd&&st(this.charCodeAt(r));r++);r===this.tokenStart+s&&this.error("Integer is expected",this.tokenStart+s),Lt.call(this,r-this.tokenStart,Oe),t=this.substring(e,r),r+1===this.tokenEnd?(this.next(),n=hn.call(this)):(Lt.call(this,r-this.tokenStart+1,rt),r+2===this.tokenEnd?(this.next(),this.skipSC(),Gt.call(this,It),n="-"+this.consume(S)):(Pe.call(this,r-this.tokenStart+2,It),this.next(),n=this.substrToCursor(r+1)))}else this.error();return t!==null&&t.charCodeAt(0)===vt&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===vt&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function Li(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 fa=Object.freeze(Object.defineProperty({__proto__:null,generate:Li,name:ha,parse:xi,structure:ua},Symbol.toStringTag,{value:"Module"}));function Ai(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function da(){for(let e=1,t;t=this.lookupType(e);e++){if(t===Vt)return!0;if(t===ft||t===B)return!1}return!1}const pa="Atrule",ma="atrule",ga={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]};function Ti(e=!1){const t=this.tokenStart;let n,i,s=null,r=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?s=this.parseWithFallback(this.AtrulePrelude.bind(this,n,e),Ai):s=Ai.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"?r=this.atrule[i].block.call(this,e):r=this.Block(da.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:s,block:r}}function Ei(e){this.token(B,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(Z,";")}const _a=Object.freeze(Object.defineProperty({__proto__:null,generate:Ei,name:pa,parse:Ti,structure:ga,walkContext:ma},Symbol.toStringTag,{value:"Module"})),ya="AtrulePrelude",ba="atrulePrelude",ka={children:[[]]};function Oi(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 Pi(e){this.children(e)}const va=Object.freeze(Object.defineProperty({__proto__:null,generate:Pi,name:ya,parse:Oi,structure:ka,walkContext:ba},Symbol.toStringTag,{value:"Module"})),Sa=36,Di=42,De=61,wa=94,un=124,Ca=126;function xa(){this.eof&&this.error("Unexpected end of input");const e=this.tokenStart;let t=!1;return this.isDelim(Di)?(t=!0,this.next()):this.isDelim(un)||this.eat(m),this.isDelim(un)?this.charCodeAt(this.tokenStart+1)!==De?(this.next(),this.eat(m)):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 La(){const e=this.tokenStart,t=this.charCodeAt(e);return t!==De&&t!==Ca&&t!==wa&&t!==Sa&&t!==Di&&t!==un&&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 Aa="AttributeSelector",Ta={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]};function Ii(){const e=this.tokenStart;let t,n=null,i=null,s=null;return this.eat(Ut),this.skipSC(),t=xa.call(this),this.skipSC(),this.tokenType!==oe&&(this.tokenType!==m&&(n=La.call(this),this.skipSC(),i=this.tokenType===wt?this.String():this.Identifier(),this.skipSC()),this.tokenType===m&&(s=this.consume(m),this.skipSC())),this.eat(oe),{type:"AttributeSelector",loc:this.getLocation(e,this.tokenStart),name:t,matcher:n,value:i,flags:s}}function Ri(e){this.token(A,"["),this.node(e.name),e.matcher!==null&&(this.tokenize(e.matcher),this.node(e.value)),e.flags!==null&&this.token(m,e.flags),this.token(A,"]")}const Ea=Object.freeze(Object.defineProperty({__proto__:null,generate:Ri,name:Aa,parse:Ii,structure:Ta},Symbol.toStringTag,{value:"Module"})),Oa=38;function Mi(){return this.Raw(null,!0)}function Fi(){return this.parseWithFallback(this.Rule,Mi)}function $i(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function Pa(){if(this.tokenType===Z)return $i.call(this,this.tokenIndex);const e=this.parseWithFallback(this.Declaration,$i);return this.tokenType===Z&&this.next(),e}const Da="Block",Ia="block",Ra={children:[["Atrule","Rule","Declaration"]]};function zi(e){const t=e?Pa:Fi,n=this.tokenStart;let i=this.createList();this.eat(ft);t:for(;!this.eof;)switch(this.tokenType){case Vt:break t;case N:case G:this.next();break;case B:i.push(this.parseWithFallback(this.Atrule.bind(this,e),Mi));break;default:e&&this.isDelim(Oa)?i.push(Fi.call(this)):i.push(t.call(this))}return this.eof||this.eat(Vt),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:i}}function ji(e){this.token(ft,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(Z,";")}),this.token(Vt,"}")}const Ma=Object.freeze(Object.defineProperty({__proto__:null,generate:ji,name:Da,parse:zi,structure:Ra,walkContext:Ia},Symbol.toStringTag,{value:"Module"})),Fa="Brackets",$a={children:[[]]};function Ni(e,t){const n=this.tokenStart;let i=null;return this.eat(Ut),i=e.call(this,t),this.eof||this.eat(oe),{type:"Brackets",loc:this.getLocation(n,this.tokenStart),children:i}}function Hi(e){this.token(A,"["),this.children(e),this.token(A,"]")}const za=Object.freeze(Object.defineProperty({__proto__:null,generate:Hi,name:Fa,parse:Ni,structure:$a},Symbol.toStringTag,{value:"Module"})),ja="CDC",Na=[];function Wi(){const e=this.tokenStart;return this.eat(it),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function Bi(){this.token(it,"-->")}const Ha=Object.freeze(Object.defineProperty({__proto__:null,generate:Bi,name:ja,parse:Wi,structure:Na},Symbol.toStringTag,{value:"Module"})),Wa="CDO",Ba=[];function Ui(){const e=this.tokenStart;return this.eat(Se),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function Vi(){this.token(Se,"<!--")}const Ua=Object.freeze(Object.defineProperty({__proto__:null,generate:Vi,name:Wa,parse:Ui,structure:Ba},Symbol.toStringTag,{value:"Module"})),Va=46,Xa="ClassSelector",Ya={name:String};function Xi(){return this.eatDelim(Va),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(m)}}function Yi(e){this.token(A,"."),this.token(m,e.name)}const qa=Object.freeze(Object.defineProperty({__proto__:null,generate:Yi,name:Xa,parse:Xi,structure:Ya},Symbol.toStringTag,{value:"Module"})),Ga=43,qi=47,Ka=62,Qa=126,Ja="Combinator",Za={name:String};function Gi(){const e=this.tokenStart;let t;switch(this.tokenType){case N:t=" ";break;case A:switch(this.charCodeAt(this.tokenStart)){case Ka:case Ga:case Qa:this.next();break;case qi:this.next(),this.eatIdent("deep"),this.eatDelim(qi);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function Ki(e){this.tokenize(e.name)}const tc=Object.freeze(Object.defineProperty({__proto__:null,generate:Ki,name:Ja,parse:Gi,structure:Za},Symbol.toStringTag,{value:"Module"})),ec=42,nc=47,ic="Comment",sc={value:String};function Qi(){const e=this.tokenStart;let t=this.tokenEnd;return this.eat(G),t-e+2>=2&&this.charCodeAt(t-2)===ec&&this.charCodeAt(t-1)===nc&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function Ji(e){this.token(G,"/*"+e.value+"*/")}const rc=Object.freeze(Object.defineProperty({__proto__:null,generate:Ji,name:ic,parse:Qi,structure:sc},Symbol.toStringTag,{value:"Module"})),oc=new Set([q,k,xt]),lc="Condition",ac={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};function Zi(e){return this.lookupTypeNonSC(1)===m&&oc.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}const cc={media:Zi,container:Zi,supports(){return this.SupportsDeclaration()}};function ts(e="media"){const t=this.createList();t:for(;!this.eof;)switch(this.tokenType){case G:case N:this.next();continue;case m:t.push(this.Identifier());break;case P:{let n=this.parseWithFallback(()=>cc[e].call(this,e),()=>null);n||(n=this.parseWithFallback(()=>{this.eat(P);const i=this.Condition(e);return this.eat(k),i},()=>this.GeneralEnclosed(e))),t.push(n);break}case x:{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 es(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(P,"("),this.node(t),this.token(k,")")):this.node(t)})}const hc=Object.freeze(Object.defineProperty({__proto__:null,generate:es,name:lc,parse:ts,structure:ac},Symbol.toStringTag,{value:"Module"})),ns=45;function uc(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===ns&&e.charCodeAt(t+1)===ns}const is=33,fc=35,dc=36,pc=38,mc=42,gc=43,ss=47;function _c(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function yc(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function bc(){const e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==Z&&this.isDelim(is)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}const kc="Declaration",vc="declaration",Sc={important:[Boolean,String],property:String,value:["Value","Raw"]};function rs(){const e=this.tokenStart,t=this.tokenIndex,n=wc.call(this),i=uc(n),s=i?this.parseCustomProperty:this.parseValue,r=i?yc:_c;let l=!1,c;this.skipSC(),this.eat(q);const a=this.tokenIndex;if(i||this.skipSC(),s?c=this.parseWithFallback(bc,r):c=r.call(this,this.tokenIndex),i&&c.type==="Value"&&c.children.isEmpty){for(let o=a-this.tokenIndex;o<=0;o++)if(this.lookupType(o)===N){c.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}return this.isDelim(is)&&(l=Cc.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 os(e){this.token(m,e.property),this.token(q,":"),this.node(e.value),e.important&&(this.token(A,"!"),this.token(m,e.important===!0?"important":e.important))}function wc(){const e=this.tokenStart;if(this.tokenType===A)switch(this.charCodeAt(this.tokenStart)){case mc:case dc:case gc:case fc:case pc:this.next();break;case ss:this.next(),this.isDelim(ss)&&this.next();break}return this.tokenType===I?this.eat(I):this.eat(m),this.substrToCursor(e)}function Cc(){this.eat(A),this.skipSC();const e=this.consume(m);return e==="important"?!0:e}const xc=Object.freeze(Object.defineProperty({__proto__:null,generate:os,name:kc,parse:rs,structure:Sc,walkContext:vc},Symbol.toStringTag,{value:"Module"})),Lc=38;function fn(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}const Ac="DeclarationList",Tc={children:[["Declaration","Atrule","Rule"]]};function ls(){const e=this.createList();for(;!this.eof;)switch(this.tokenType){case N:case G:case Z:this.next();break;case B:e.push(this.parseWithFallback(this.Atrule.bind(this,!0),fn));break;default:this.isDelim(Lc)?e.push(this.parseWithFallback(this.Rule,fn)):e.push(this.parseWithFallback(this.Declaration,fn))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function as(e){this.children(e,t=>{t.type==="Declaration"&&this.token(Z,";")})}const Ec=Object.freeze(Object.defineProperty({__proto__:null,generate:as,name:Ac,parse:ls,structure:Tc},Symbol.toStringTag,{value:"Module"})),Oc="Dimension",Pc={value:String,unit:String};function cs(){const e=this.tokenStart,t=this.consumeNumber(L);return{type:"Dimension",loc:this.getLocation(e,this.tokenStart),value:t,unit:this.substring(e+t.length,this.tokenStart)}}function hs(e){this.token(L,e.value+e.unit)}const Dc=Object.freeze(Object.defineProperty({__proto__:null,generate:hs,name:Oc,parse:cs,structure:Pc},Symbol.toStringTag,{value:"Module"})),Ic=47,Rc="Feature",Mc={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]};function us(e){const t=this.tokenStart;let n,i=null;if(this.eat(P),this.skipSC(),n=this.consume(m),this.skipSC(),this.tokenType!==k){switch(this.eat(q),this.skipSC(),this.tokenType){case S:this.lookupNonWSType(1)===A?i=this.Ratio():i=this.Number();break;case L:i=this.Dimension();break;case m:i=this.Identifier();break;case x:i=this.parseWithFallback(()=>{const s=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(Ic)&&this.error(),s},()=>this.Ratio());break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eof||this.eat(k),{type:"Feature",loc:this.getLocation(t,this.tokenStart),kind:e,name:n,value:i}}function fs(e){this.token(P,"("),this.token(m,e.name),e.value!==null&&(this.token(q,":"),this.node(e.value)),this.token(k,")")}const Fc=Object.freeze(Object.defineProperty({__proto__:null,generate:fs,name:Rc,parse:us,structure:Mc},Symbol.toStringTag,{value:"Module"})),$c="FeatureFunction",zc={kind:String,feature:String,value:["Declaration","Selector"]};function jc(e,t){const n=(this.features[e]||{})[t];return typeof n!="function"&&this.error(`Unknown feature ${t}()`),n}function ds(e="unknown"){const t=this.tokenStart,n=this.consumeFunctionName(),i=jc.call(this,e,n.toLowerCase());this.skipSC();const s=this.parseWithFallback(()=>{const r=this.tokenIndex,l=i.call(this);return this.eof===!1&&this.isBalanceEdge(r)===!1&&this.error(),l},()=>this.Raw(null,!1));return this.eof||this.eat(k),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:n,value:s}}function ps(e){this.token(x,e.feature+"("),this.node(e.value),this.token(k,")")}const Nc=Object.freeze(Object.defineProperty({__proto__:null,generate:ps,name:$c,parse:ds,structure:zc},Symbol.toStringTag,{value:"Module"})),ms=47,Hc=60,gs=61,Wc=62,Bc="FeatureRange",Uc={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 dn(){switch(this.skipSC(),this.tokenType){case S:return this.isDelim(ms,this.lookupOffsetNonSC(1))?this.Ratio():this.Number();case L:return this.Dimension();case m:return this.Identifier();case x:return this.parseWithFallback(()=>{const e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(ms)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function _s(e){if(this.skipSC(),this.isDelim(Hc)||this.isDelim(Wc)){const t=this.source[this.tokenStart];return this.next(),this.isDelim(gs)?(this.next(),t+"="):t}if(this.isDelim(gs))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function ys(e="unknown"){const t=this.tokenStart;this.skipSC(),this.eat(P);const n=dn.call(this),i=_s.call(this,n.type==="Identifier"),s=dn.call(this);let r=null,l=null;return this.lookupNonWSType(0)!==k&&(r=_s.call(this),l=dn.call(this)),this.skipSC(),this.eat(k),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:n,leftComparison:i,middle:s,rightComparison:r,right:l}}function bs(e){this.token(P,"("),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(k,")")}const Vc=Object.freeze(Object.defineProperty({__proto__:null,generate:bs,name:Bc,parse:ys,structure:Uc},Symbol.toStringTag,{value:"Module"})),Xc="Function",Yc="function",qc={name:String,children:[[]]};function ks(e,t){const n=this.tokenStart,i=this.consumeFunctionName(),s=i.toLowerCase();let r;return r=t.hasOwnProperty(s)?t[s].call(this,t):e.call(this,t),this.eof||this.eat(k),{type:"Function",loc:this.getLocation(n,this.tokenStart),name:i,children:r}}function vs(e){this.token(x,e.name+"("),this.children(e),this.token(k,")")}const Gc=Object.freeze(Object.defineProperty({__proto__:null,generate:vs,name:Xc,parse:ks,structure:qc,walkContext:Yc},Symbol.toStringTag,{value:"Module"})),Kc="GeneralEnclosed",Qc={kind:String,function:[String,null],children:[[]]};function Ss(e){const t=this.tokenStart;let n=null;this.tokenType===x?n=this.consumeFunctionName():this.eat(P);const i=this.parseWithFallback(()=>{const s=this.tokenIndex,r=this.readSequence(this.scope.Value);return this.eof===!1&&this.isBalanceEdge(s)===!1&&this.error(),r},()=>this.createSingleNodeList(this.Raw(null,!1)));return this.eof||this.eat(k),{type:"GeneralEnclosed",loc:this.getLocation(t,this.tokenStart),kind:e,function:n,children:i}}function ws(e){e.function?this.token(x,e.function+"("):this.token(P,"("),this.children(e),this.token(k,")")}const Jc=Object.freeze(Object.defineProperty({__proto__:null,generate:ws,name:Kc,parse:Ss,structure:Qc},Symbol.toStringTag,{value:"Module"})),Zc="XXX",th="Hash",eh={value:String};function Cs(){const e=this.tokenStart;return this.eat(I),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function xs(e){this.token(I,"#"+e.value)}const nh=Object.freeze(Object.defineProperty({__proto__:null,generate:xs,name:th,parse:Cs,structure:eh,xxx:Zc},Symbol.toStringTag,{value:"Module"})),ih="Identifier",sh={name:String};function Ls(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(m)}}function As(e){this.token(m,e.name)}const rh=Object.freeze(Object.defineProperty({__proto__:null,generate:As,name:ih,parse:Ls,structure:sh},Symbol.toStringTag,{value:"Module"})),oh="IdSelector",lh={name:String};function Ts(){const e=this.tokenStart;return this.eat(I),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function Es(e){this.token(A,"#"+e.name)}const ah=Object.freeze(Object.defineProperty({__proto__:null,generate:Es,name:oh,parse:Ts,structure:lh},Symbol.toStringTag,{value:"Module"})),ch=46,hh="Layer",uh={name:String};function Os(){let e=this.tokenStart,t=this.consume(m);for(;this.isDelim(ch);)this.eat(A),t+="."+this.consume(m);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function Ps(e){this.tokenize(e.name)}const fh=Object.freeze(Object.defineProperty({__proto__:null,generate:Ps,name:hh,parse:Os,structure:uh},Symbol.toStringTag,{value:"Module"})),dh="LayerList",ph={children:[["Layer"]]};function Ds(){const e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.Layer()),this.lookupTypeNonSC(0)===ut);)this.skipSC(),this.next(),this.skipSC();return{type:"LayerList",loc:this.getLocationFromList(e),children:e}}function Is(e){this.children(e,()=>this.token(ut,","))}const mh=Object.freeze(Object.defineProperty({__proto__:null,generate:Is,name:dh,parse:Ds,structure:ph},Symbol.toStringTag,{value:"Module"})),gh="MediaQuery",_h={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]};function Rs(){const e=this.tokenStart;let t=null,n=null,i=null;if(this.skipSC(),this.tokenType===m&&this.lookupTypeNonSC(1)!==P){const s=this.consume(m),r=s.toLowerCase();switch(r==="not"||r==="only"?(this.skipSC(),t=r,n=this.consume(m)):n=s,this.lookupTypeNonSC(0)){case m:{this.skipSC(),this.eatIdent("and"),i=this.Condition("media");break}case ft:case Z:case ut:case xt:break;default:this.error("Identifier or parenthesis is expected")}}else switch(this.tokenType){case m:case P:case x:{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 Ms(e){e.mediaType?(e.modifier&&this.token(m,e.modifier),this.token(m,e.mediaType),e.condition&&(this.token(m,"and"),this.node(e.condition))):e.condition&&this.node(e.condition)}const yh=Object.freeze(Object.defineProperty({__proto__:null,generate:Ms,name:gh,parse:Rs,structure:_h},Symbol.toStringTag,{value:"Module"})),bh="MediaQueryList",kh={children:[["MediaQuery"]]};function Fs(){const e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.MediaQuery()),this.tokenType===ut);)this.next();return{type:"MediaQueryList",loc:this.getLocationFromList(e),children:e}}function $s(e){this.children(e,()=>this.token(ut,","))}const vh=Object.freeze(Object.defineProperty({__proto__:null,generate:$s,name:bh,parse:Fs,structure:kh},Symbol.toStringTag,{value:"Module"})),Sh=38,wh="NestingSelector",Ch={};function zs(){const e=this.tokenStart;return this.eatDelim(Sh),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function js(){this.token(A,"&")}const xh=Object.freeze(Object.defineProperty({__proto__:null,generate:js,name:wh,parse:zs,structure:Ch},Symbol.toStringTag,{value:"Module"})),Lh="Nth",Ah={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]};function Ns(){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 Hs(e){this.node(e.nth),e.selector!==null&&(this.token(m,"of"),this.node(e.selector))}const Th=Object.freeze(Object.defineProperty({__proto__:null,generate:Hs,name:Lh,parse:Ns,structure:Ah},Symbol.toStringTag,{value:"Module"})),Eh="Number",Oh={value:String};function Ws(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(S)}}function Bs(e){this.token(S,e.value)}const Ph=Object.freeze(Object.defineProperty({__proto__:null,generate:Bs,name:Eh,parse:Ws,structure:Oh},Symbol.toStringTag,{value:"Module"})),Dh="Operator",Ih={value:String};function Us(){const e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Vs(e){this.tokenize(e.value)}const Rh=Object.freeze(Object.defineProperty({__proto__:null,generate:Vs,name:Dh,parse:Us,structure:Ih},Symbol.toStringTag,{value:"Module"})),Mh="Parentheses",Fh={children:[[]]};function Xs(e,t){const n=this.tokenStart;let i=null;return this.eat(P),i=e.call(this,t),this.eof||this.eat(k),{type:"Parentheses",loc:this.getLocation(n,this.tokenStart),children:i}}function Ys(e){this.token(P,"("),this.children(e),this.token(k,")")}const $h=Object.freeze(Object.defineProperty({__proto__:null,generate:Ys,name:Mh,parse:Xs,structure:Fh},Symbol.toStringTag,{value:"Module"})),zh="Percentage",jh={value:String};function qs(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(j)}}function Gs(e){this.token(j,e.value+"%")}const Nh=Object.freeze(Object.defineProperty({__proto__:null,generate:Gs,name:zh,parse:qs,structure:jh},Symbol.toStringTag,{value:"Module"})),Hh="PseudoClassSelector",Wh="function",Bh={name:String,children:[["Raw"],null]};function Ks(){const e=this.tokenStart;let t=null,n,i;return this.eat(q),this.tokenType===x?(n=this.consumeFunctionName(),i=n.toLowerCase(),this.lookupNonWSType(0)==k?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(k)):n=this.consume(m),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function Qs(e){this.token(q,":"),e.children===null?this.token(m,e.name):(this.token(x,e.name+"("),this.children(e),this.token(k,")"))}const Uh=Object.freeze(Object.defineProperty({__proto__:null,generate:Qs,name:Hh,parse:Ks,structure:Bh,walkContext:Wh},Symbol.toStringTag,{value:"Module"})),Vh="PseudoElementSelector",Xh="function",Yh={name:String,children:[["Raw"],null]};function Js(){const e=this.tokenStart;let t=null,n,i;return this.eat(q),this.eat(q),this.tokenType===x?(n=this.consumeFunctionName(),i=n.toLowerCase(),this.lookupNonWSType(0)==k?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(k)):n=this.consume(m),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function Zs(e){this.token(q,":"),this.token(q,":"),e.children===null?this.token(m,e.name):(this.token(x,e.name+"("),this.children(e),this.token(k,")"))}const qh=Object.freeze(Object.defineProperty({__proto__:null,generate:Zs,name:Vh,parse:Js,structure:Yh,walkContext:Xh},Symbol.toStringTag,{value:"Module"})),tr=47;function er(){switch(this.skipSC(),this.tokenType){case S:return this.Number();case x:return this.Function(this.readSequence,this.scope.Value);default:this.error("Number of function is expected")}}const Gh="Ratio",Kh={left:["Number","Function"],right:["Number","Function",null]};function nr(){const e=this.tokenStart,t=er.call(this);let n=null;return this.skipSC(),this.isDelim(tr)&&(this.eatDelim(tr),n=er.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function ir(e){this.node(e.left),this.token(A,"/"),e.right?this.node(e.right):this.node(S,1)}const Qh=Object.freeze(Object.defineProperty({__proto__:null,generate:ir,name:Gh,parse:nr,structure:Kh},Symbol.toStringTag,{value:"Module"}));function Jh(){return this.tokenIndex>0&&this.lookupType(-1)===N?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}const Zh="Raw",tu={value:String};function sr(e,t){const n=this.getTokenStart(this.tokenIndex);let i;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>n?i=Jh.call(this):i=this.tokenStart,{type:"Raw",loc:this.getLocation(n,i),value:this.substring(n,i)}}function rr(e){this.tokenize(e.value)}const eu=Object.freeze(Object.defineProperty({__proto__:null,generate:rr,name:Zh,parse:sr,structure:tu},Symbol.toStringTag,{value:"Module"}));function or(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function nu(){const e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==ft&&this.error(),e}const iu="Rule",su="rule",ru={prelude:["SelectorList","Raw"],block:["Block"]};function lr(){const e=this.tokenIndex,t=this.tokenStart;let n,i;return this.parseRulePrelude?n=this.parseWithFallback(nu,or):n=or.call(this,e),i=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:i}}function ar(e){this.node(e.prelude),this.node(e.block)}const ou=Object.freeze(Object.defineProperty({__proto__:null,generate:ar,name:iu,parse:lr,structure:ru,walkContext:su},Symbol.toStringTag,{value:"Module"})),lu="Scope",au={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]};function cr(){let e=null,t=null;this.skipSC();const n=this.tokenStart;return this.tokenType===P&&(this.next(),this.skipSC(),e=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(k)),this.lookupNonWSType(0)===m&&(this.skipSC(),this.eatIdent("to"),this.skipSC(),this.eat(P),this.skipSC(),t=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(k)),{type:"Scope",loc:this.getLocation(n,this.tokenStart),root:e,limit:t}}function hr(e){e.root&&(this.token(P,"("),this.node(e.root),this.token(k,")")),e.limit&&(this.token(m,"to"),this.token(P,"("),this.node(e.limit),this.token(k,")"))}const cu=Object.freeze(Object.defineProperty({__proto__:null,generate:hr,name:lu,parse:cr,structure:au},Symbol.toStringTag,{value:"Module"})),hu="Selector",uu={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]};function ur(){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 fr(e){this.children(e)}const fu=Object.freeze(Object.defineProperty({__proto__:null,generate:fr,name:hu,parse:ur,structure:uu},Symbol.toStringTag,{value:"Module"})),du="SelectorList",pu="selector",mu={children:[["Selector","Raw"]]};function dr(){const e=this.createList();for(;!this.eof;){if(e.push(this.Selector()),this.tokenType===ut){this.next();continue}break}return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function pr(e){this.children(e,()=>this.token(ut,","))}const gu=Object.freeze(Object.defineProperty({__proto__:null,generate:pr,name:du,parse:dr,structure:mu,walkContext:pu},Symbol.toStringTag,{value:"Module"})),pn=92,mr=34,_u=39;function gr(e){const t=e.length,n=e.charCodeAt(0),i=n===mr||n===_u?1:0,s=i===1&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1;let r="";for(let l=i;l<=s;l++){let c=e.charCodeAt(l);if(c===pn){if(l===s){l!==t-1&&(r=e.substr(l+1));break}if(c=e.charCodeAt(++l),yt(pn,c)){const a=l-1,o=qt(e,a);l=o-1,r+=yi(e.substring(a+1,o))}else c===13&&e.charCodeAt(l+1)===10&&l++}else r+=e[l]}return r}function yu(e,t){const n=mr;let i="",s=!1;for(let r=0;r<e.length;r++){const l=e.charCodeAt(r);if(l===0){i+="�";continue}if(l<=31||l===127){i+="\\"+l.toString(16),s=!0;continue}l===n||l===pn?(i+="\\"+e.charAt(r),s=!1):(s&&(Xt(l)||Pt(l))&&(i+=" "),i+=e.charAt(r),s=!1)}return'"'+i+'"'}const bu="String",ku={value:String};function _r(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:gr(this.consume(wt))}}function yr(e){this.token(wt,yu(e.value))}const vu=Object.freeze(Object.defineProperty({__proto__:null,generate:yr,name:bu,parse:_r,structure:ku},Symbol.toStringTag,{value:"Module"})),Su=33;function br(){return this.Raw(null,!1)}const wu="StyleSheet",Cu="stylesheet",xu={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]};function kr(){const e=this.tokenStart,t=this.createList();let n;for(;!this.eof;){switch(this.tokenType){case N:this.next();continue;case G:if(this.charCodeAt(this.tokenStart+2)!==Su){this.next();continue}n=this.Comment();break;case Se:n=this.CDO();break;case it:n=this.CDC();break;case B:n=this.parseWithFallback(this.Atrule,br);break;default:n=this.parseWithFallback(this.Rule,br)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function vr(e){this.children(e)}const Lu=Object.freeze(Object.defineProperty({__proto__:null,generate:vr,name:wu,parse:kr,structure:xu,walkContext:Cu},Symbol.toStringTag,{value:"Module"})),Au="SupportsDeclaration",Tu={declaration:"Declaration"};function Sr(){const e=this.tokenStart;this.eat(P),this.skipSC();const t=this.Declaration();return this.eof||this.eat(k),{type:"SupportsDeclaration",loc:this.getLocation(e,this.tokenStart),declaration:t}}function wr(e){this.token(P,"("),this.node(e.declaration),this.token(k,")")}const Eu=Object.freeze(Object.defineProperty({__proto__:null,generate:wr,name:Au,parse:Sr,structure:Tu},Symbol.toStringTag,{value:"Module"})),Ou=42,Cr=124;function mn(){this.tokenType!==m&&this.isDelim(Ou)===!1&&this.error("Identifier or asterisk is expected"),this.next()}const Pu="TypeSelector",Du={name:String};function xr(){const e=this.tokenStart;return this.isDelim(Cr)?(this.next(),mn.call(this)):(mn.call(this),this.isDelim(Cr)&&(this.next(),mn.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function Lr(e){this.tokenize(e.name)}const Iu=Object.freeze(Object.defineProperty({__proto__:null,generate:Lr,name:Pu,parse:xr,structure:Du},Symbol.toStringTag,{value:"Module"})),Ar=43,Tr=45,gn=63;function le(e,t){let n=0;for(let i=this.tokenStart+e;i<this.tokenEnd;i++){const s=this.charCodeAt(i);if(s===Tr&&t&&n!==0)return le.call(this,e+n+1,!1),-1;Xt(s)||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 Ie(e){let t=0;for(;this.isDelim(gn);)++t>e&&this.error("Too many question marks"),this.next()}function Ru(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===Ar?"Plus sign":"Hyphen minus")+" is expected")}function Mu(){let e=0;switch(this.tokenType){case S:if(e=le.call(this,1,!0),this.isDelim(gn)){Ie.call(this,6-e);break}if(this.tokenType===L||this.tokenType===S){Ru.call(this,Tr),le.call(this,1,!1);break}break;case L:e=le.call(this,1,!0),e>0&&Ie.call(this,6-e);break;default:if(this.eatDelim(Ar),this.tokenType===m){e=le.call(this,0,!0),e>0&&Ie.call(this,6-e);break}if(this.isDelim(gn)){this.next(),Ie.call(this,5);break}this.error("Hex digit or question mark is expected")}}const Fu="UnicodeRange",$u={value:String};function Er(){const e=this.tokenStart;return this.eatIdent("u"),Mu.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Or(e){this.tokenize(e.value)}const zu=Object.freeze(Object.defineProperty({__proto__:null,generate:Or,name:Fu,parse:Er,structure:$u},Symbol.toStringTag,{value:"Module"})),ju=32,_n=92,Nu=34,Hu=39,Wu=40,Pr=41;function Bu(e){const t=e.length;let n=4,i=e.charCodeAt(t-1)===Pr?t-2:t-1,s="";for(;n<i&&Pt(e.charCodeAt(n));)n++;for(;n<i&&Pt(e.charCodeAt(i));)i--;for(let r=n;r<=i;r++){let l=e.charCodeAt(r);if(l===_n){if(r===i){r!==t-1&&(s=e.substr(r+1));break}if(l=e.charCodeAt(++r),yt(_n,l)){const c=r-1,a=qt(e,c);r=a-1,s+=yi(e.substring(c+1,a))}else l===13&&e.charCodeAt(r+1)===10&&r++}else s+=e[r]}return s}function Uu(e){let t="",n=!1;for(let i=0;i<e.length;i++){const s=e.charCodeAt(i);if(s===0){t+="�";continue}if(s<=31||s===127){t+="\\"+s.toString(16),n=!0;continue}s===ju||s===_n||s===Nu||s===Hu||s===Wu||s===Pr?(t+="\\"+e.charAt(i),n=!1):(n&&Xt(s)&&(t+=" "),t+=e.charAt(i),n=!1)}return"url("+t+")"}const Vu="Url",Xu={value:String};function Dr(){const e=this.tokenStart;let t;switch(this.tokenType){case Y:t=Bu(this.consume(Y));break;case x:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(x),this.skipSC(),t=gr(this.consume(wt)),this.skipSC(),this.eof||this.eat(k);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(e,this.tokenStart),value:t}}function Ir(e){this.token(Y,Uu(e.value))}const Yu=Object.freeze(Object.defineProperty({__proto__:null,generate:Ir,name:Vu,parse:Dr,structure:Xu},Symbol.toStringTag,{value:"Module"})),qu="Value",Gu={children:[[]]};function Rr(){const e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function Mr(e){this.children(e)}const Ku=Object.freeze(Object.defineProperty({__proto__:null,generate:Mr,name:qu,parse:Rr,structure:Gu},Symbol.toStringTag,{value:"Module"})),Qu=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),Ju="WhiteSpace",Zu={value:String};function Fr(){return this.eat(N),Qu}function $r(e){this.token(N,e.value)}const tf=Object.freeze(Object.defineProperty({__proto__:null,generate:$r,name:Ju,parse:Fr,structure:Zu},Symbol.toStringTag,{value:"Module"})),ef=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:fa,Atrule:_a,AtrulePrelude:va,AttributeSelector:Ea,Block:Ma,Brackets:za,CDC:Ha,CDO:Ua,ClassSelector:qa,Combinator:tc,Comment:rc,Condition:hc,Declaration:xc,DeclarationList:Ec,Dimension:Dc,Feature:Fc,FeatureFunction:Nc,FeatureRange:Vc,Function:Gc,GeneralEnclosed:Jc,Hash:nh,IdSelector:ah,Identifier:rh,Layer:fh,LayerList:mh,MediaQuery:yh,MediaQueryList:vh,NestingSelector:xh,Nth:Th,Number:Ph,Operator:Rh,Parentheses:$h,Percentage:Nh,PseudoClassSelector:Uh,PseudoElementSelector:qh,Ratio:Qh,Raw:eu,Rule:ou,Scope:cu,Selector:fu,SelectorList:gu,String:vu,StyleSheet:Lu,SupportsDeclaration:Eu,TypeSelector:Iu,UnicodeRange:zu,Url:Yu,Value:Ku,WhiteSpace:tf},Symbol.toStringTag,{value:"Module"})),nf={node:ef},At=Kl(nf),yn=["left","right","top","bottom","inset-block-start","inset-block-end","inset-inline-start","inset-inline-end","inset-block","inset-inline","inset"];function ae(e){return yn.includes(e)}const bn=["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 sf(e){return bn.includes(e)}const kn=["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 zr(e){return kn.includes(e)}const jr=["justify-self","align-self","place-self"];function rf(e){return jr.includes(e)}const Nr=[...yn,...bn,...kn,...jr,"position-anchor","position-area"],of=[...kn,...yn,...bn];function Hr(e){return of.includes(e)}const lf=["top","left","right","bottom","start","end","self-start","self-end","center","inside","outside"];function Wr(e){return lf.includes(e)}const af=["width","height","block","inline","self-block","self-inline"];function cf(e){return af.includes(e)}const Br=new Set(["Atrule","Selector","Declaration"]);function hf(e){const t=new SourceMapGenerator,n={line:1,column:0},i={line:0,column:0},s={line:1,column:0},r={generated:s};let l=1,c=0,a=!1;const o=e.node;e.node=function(f){if(f.loc&&f.loc.start&&Br.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!==s.line||n.column!==s.column)&&t.addMapping(r)),a=!0,t.addMapping({source:f.loc.source,original:i,generated:n}))}o.call(this,f),a&&Br.has(f.type)&&(s.line=l,s.column=c)};const h=e.emit;e.emit=function(f,d,p){for(let g=0;g<f.length;g++)f.charCodeAt(g)===10?(l++,c=0):c++;h(f,d,p)};const u=e.result;return e.result=function(){return a&&t.addMapping(r),{css:u(),map:t}},e}const uf=43,ff=45,vn=(e,t)=>{if(e===A&&(e=t),typeof e=="string"){const n=e.charCodeAt(0);return n>127?32768:n<<8}return e},Ur=[[m,m],[m,x],[m,Y],[m,ht],[m,"-"],[m,S],[m,j],[m,L],[m,it],[m,P],[B,m],[B,x],[B,Y],[B,ht],[B,"-"],[B,S],[B,j],[B,L],[B,it],[I,m],[I,x],[I,Y],[I,ht],[I,"-"],[I,S],[I,j],[I,L],[I,it],[L,m],[L,x],[L,Y],[L,ht],[L,"-"],[L,S],[L,j],[L,L],[L,it],["#",m],["#",x],["#",Y],["#",ht],["#","-"],["#",S],["#",j],["#",L],["#",it],["-",m],["-",x],["-",Y],["-",ht],["-","-"],["-",S],["-",j],["-",L],["-",it],[S,m],[S,x],[S,Y],[S,ht],[S,S],[S,j],[S,L],[S,"%"],[S,it],["@",m],["@",x],["@",Y],["@",ht],["@","-"],["@",it],[".",S],[".",j],[".",L],["+",S],["+",j],["+",L],["/","*"]],df=Ur.concat([[m,I],[L,I],[I,I],[B,P],[B,wt],[B,q],[j,j],[j,L],[j,x],[j,"-"],[k,m],[k,x],[k,j],[k,L],[k,I],[k,"-"]]);function Vr(e){const t=new Set(e.map(([n,i])=>vn(n)<<16|vn(i)));return function(n,i,s){const r=vn(i,s),l=s.charCodeAt(0);return(l===ff&&i!==m&&i!==x&&i!==it||l===uf?t.has(n<<16|l<<8):t.has(n<<16|r))&&this.emit(" ",N,!0),r}}const pf=Vr(Ur),Xr=Vr(df),Yr=Object.freeze(Object.defineProperty({__proto__:null,safe:Xr,spec:pf},Symbol.toStringTag,{value:"Module"})),mf=92;function gf(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 _f(e){Ci(e,(t,n,i)=>{this.token(t,e.slice(n,i))})}function yf(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 s="",r=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:Xr,token(a,o){r=this.tokenBefore(r,a,o),this.emit(o,a,!1),a===A&&o.charCodeAt(0)===mf&&this.emit(`
|
|
16
|
+
`,N,!0)},emit(a){s+=a},result(){return s}};i&&(typeof i.decorator=="function"&&(l=i.decorator(l)),i.sourceMap&&(l=hf(l)),i.mode in Yr&&(l.tokenBefore=Yr[i.mode]));const c={node:a=>l.node(a),children:gf,token:(a,o)=>l.token(a,o),tokenize:_f};return l.node(n),l.result()}}const bf=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:Li,Atrule:Ei,AtrulePrelude:Pi,AttributeSelector:Ri,Block:ji,Brackets:Hi,CDC:Bi,CDO:Vi,ClassSelector:Yi,Combinator:Ki,Comment:Ji,Condition:es,Declaration:os,DeclarationList:as,Dimension:hs,Feature:fs,FeatureFunction:ps,FeatureRange:bs,Function:vs,GeneralEnclosed:ws,Hash:xs,IdSelector:Es,Identifier:As,Layer:Ps,LayerList:Is,MediaQuery:Ms,MediaQueryList:$s,NestingSelector:js,Nth:Hs,Number:Bs,Operator:Vs,Parentheses:Ys,Percentage:Gs,PseudoClassSelector:Qs,PseudoElementSelector:Zs,Ratio:ir,Raw:rr,Rule:ar,Scope:hr,Selector:fr,SelectorList:pr,String:yr,StyleSheet:vr,SupportsDeclaration:wr,TypeSelector:Lr,UnicodeRange:Or,Url:Ir,Value:Mr,WhiteSpace:$r},Symbol.toStringTag,{value:"Module"})),kf={node:bf},vf=yf(kf);let Kt=null;class K{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return K.createItem(t)}allocateCursor(t,n){let i;return Kt!==null?(i=Kt,Kt=Kt.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=Kt,Kt=t}updateCursors(t,n,i,s){let{cursor:r}=this;for(;r!==null;)r.prev===t&&(r.prev=n),r.next===i&&(r.next=s),r=r.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 s=K.createItem(i);n!==null?n.next=s:this.head=s,s.prev=n,n=s}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 s=i.next;i.next=s.next,t.call(n,s.data,s,this)}this.releaseCursor()}forEachRight(t,n=this){const i=this.allocateCursor(this.tail,null);for(;i.prev!==null;){const s=i.prev;i.prev=s.prev,t.call(n,s.data,s,this)}this.releaseCursor()}reduce(t,n,i=this){let s=this.allocateCursor(null,this.head),r=n,l;for(;s.next!==null;)l=s.next,s.next=l.next,r=t.call(i,r,l.data,l,this);return this.releaseCursor(),r}reduceRight(t,n,i=this){let s=this.allocateCursor(this.tail,null),r=n,l;for(;s.prev!==null;)l=s.prev,s.prev=l.prev,r=t.call(i,r,l.data,l,this);return this.releaseCursor(),r}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 K;for(let s=this.head;s!==null;s=s.next)i.appendData(t.call(n,s.data,s,this));return i}filter(t,n=this){const i=new K;for(let s=this.head;s!==null;s=s.next)t.call(n,s.data,s,this)&&i.appendData(s.data);return i}nextUntil(t,n,i=this){if(t===null)return;const s=this.allocateCursor(null,t);for(;s.next!==null;){const r=s.next;if(s.next=r.next,n.call(i,r.data,r,this))break}this.releaseCursor()}prevUntil(t,n,i=this){if(t===null)return;const s=this.allocateCursor(t,null);for(;s.prev!==null;){const r=s.prev;if(s.prev=r.prev,n.call(i,r.data,r,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){const t=new K;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(K.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(K.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(K.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(K.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(K.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 Sf(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 Sn=100,qr=60,Gr=" ";function Kr({source:e,line:t,column:n,baseLine:i,baseColumn:s},r){function l(p,g){return o.slice(p,g).map((y,_)=>String(p+_+1).padStart(f)+" |"+y).join(`
|
|
18
|
+
`)}const c=`
|
|
19
|
+
`.repeat(Math.max(i-1,0)),a=" ".repeat(Math.max(s-1,0)),o=(c+a+e).split(/\r\n?|\n|\f/),h=Math.max(1,t-r)-1,u=Math.min(t+r,o.length+1),f=Math.max(4,String(u).length)+1;let d=0;n+=(Gr.length-1)*(o[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>Sn&&(d=n-qr+3,n=qr-2);for(let p=h;p<=u;p++)p>=0&&p<o.length&&(o[p]=o[p].replace(/\t/g,Gr),o[p]=(d>0&&o[p].length>d?"…":"")+o[p].substr(d,Sn-2)+(o[p].length>d+Sn-1?"…":""));return[l(h,t),new Array(n+f+2).join("-")+"^",l(t,u)].filter(Boolean).join(`
|
|
20
|
+
`).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function Qr(e,t,n,i,s,r=1,l=1){return Object.assign(Sf("SyntaxError",e),{source:t,offset:n,line:i,column:s,sourceFragment(c){return Kr({source:t,line:i,column:s,baseLine:r,baseColumn:l},isNaN(c)?0:c)},get formattedMessage(){return`Parse error: ${e}
|
|
21
|
+
`+Kr({source:t,line:i,column:s,baseLine:r,baseColumn:l},2)}})}function wf(e){const t=this.createList();let n=!1;const i={recognizer:e};for(;!this.eof;){switch(this.tokenType){case G:this.next();continue;case N:n=!0,this.next();continue}let s=e.getNode.call(this,i);if(s===void 0)break;n&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,s,t,i),n=!1),t.push(s)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,i),t}const Jr=()=>{},Cf=33,xf=35,wn=59,Zr=123,to=0;function Lf(e){return function(){return this[e]()}}function Cn(e){const t=Object.create(null);for(const n of Object.keys(e)){const i=e[n],s=i.parse||i;s&&(t[n]=s)}return t}function Af(e){const t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:Cn(e.atrule),pseudo:Cn(e.pseudo),node:Cn(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]=Lf(i);break}return U(U({config:t},t),t.node)}function Tf(e){let t="",n="<unknown>",i=!1,s=Jr,r=!1;const l=new la,c=Object.assign(new aa,Af(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:wf,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(a){return a===Zr?1:0},consumeUntilLeftCurlyBracketOrSemicolon(a){return a===Zr||a===wn?1:0},consumeUntilExclamationMarkOrSemicolon(a){return a===Cf||a===wn?1:0},consumeUntilSemicolonIncluded(a){return a===wn?2:0},createList(){return new K},createSingleNodeList(a){return new K().appendData(a)},getFirstListNode(a){return a&&a.first},getLastListNode(a){return a&&a.last},parseWithFallback(a,o){const h=this.tokenIndex;try{return a.call(this)}catch(u){if(r)throw u;this.skip(h-this.tokenIndex);const f=o.call(this);return r=!0,s(u,f),r=!1,f}},lookupNonWSType(a){let o;do if(o=this.lookupType(a++),o!==N&&o!==G)return o;while(o!==to);return to},charCodeAt(a){return a>=0&&a<t.length?t.charCodeAt(a):0},substring(a,o){return t.substring(a,o)},substrToCursor(a){return this.source.substring(a,this.tokenStart)},cmpChar(a,o){return gi(t,a,o)},cmpStr(a,o,h){return Le(t,a,o,h)},consume(a){const o=this.tokenStart;return this.eat(a),this.substrToCursor(o)},consumeFunctionName(){const a=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(x),a},consumeNumber(a){const o=t.substring(this.tokenStart,_i(t,this.tokenStart));return this.eat(a),o},eat(a){if(this.tokenType!==a){const o=bi[a].slice(0,-6).replace(/-/g," ").replace(/^./,f=>f.toUpperCase());let h=`${/[[\](){}]/.test(o)?`"${o}"`:o} is expected`,u=this.tokenStart;switch(a){case m:this.tokenType===x||this.tokenType===Y?(u=this.tokenEnd-1,h="Identifier is expected but function found"):h="Identifier is expected";break;case I:this.isDelim(xf)&&(this.next(),u++,h="Name is expected");break;case j:this.tokenType===S&&(u=this.tokenEnd,h="Percent sign is expected");break}this.error(h,u)}this.next()},eatIdent(a){(this.tokenType!==m||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,o){return i?l.getLocationRange(a,o,n):null},getLocationFromList(a){if(i){const o=this.getFirstListNode(a),h=this.getLastListNode(a);return l.getLocationRange(o!==null?o.loc.start.offset-l.startOffset:this.tokenStart,h!==null?h.loc.end.offset-l.startOffset:this.tokenStart,n)}return null},error(a,o){const h=typeof o<"u"&&o<t.length?l.getLocation(o):this.eof?l.getLocation(sa(t,t.length-1)):l.getLocation(this.tokenStart);throw new Qr(a||"Unexpected input",t,h.offset,h.line,h.column,l.startLine,l.startColumn)}});return Object.assign(function(a,o){t=a,o=o||{},c.setSource(t,Ci),l.setSource(t,o.offset,o.line,o.column),n=o.filename||"<unknown>",i=!!o.positions,s=typeof o.onParseError=="function"?o.onParseError:Jr,r=!1,c.parseAtrulePrelude="parseAtrulePrelude"in o?!!o.parseAtrulePrelude:!0,c.parseRulePrelude="parseRulePrelude"in o?!!o.parseRulePrelude:!0,c.parseValue="parseValue"in o?!!o.parseValue:!0,c.parseCustomProperty="parseCustomProperty"in o?!!o.parseCustomProperty:!1;const{context:h="default",onComment:u}=o;if(!(h in c.context))throw new Error("Unknown context `"+h+"`");typeof u=="function"&&c.forEachToken((d,p,g)=>{if(d===G){const y=c.getLocation(p,g),_=Le(t,g-2,g,"*/")?t.slice(p+2,g-2):t.slice(p+2,g);u(_,y)}});const f=c.context[h].call(c,o);return c.eof||c.error(),f},{SyntaxError:Qr,config:c.config})}const Ef=35,Of=42,eo=43,Pf=45,Df=47,If=117;function no(e){switch(this.tokenType){case I:return this.Hash();case ut:return this.Operator();case P:return this.Parentheses(this.readSequence,e.recognizer);case Ut:return this.Brackets(this.readSequence,e.recognizer);case wt:return this.String();case L:return this.Dimension();case j:return this.Percentage();case S:return this.Number();case x:return this.cmpStr(this.tokenStart,this.tokenEnd,"url(")?this.Url():this.Function(this.readSequence,e.recognizer);case Y:return this.Url();case m:return this.cmpChar(this.tokenStart,If)&&this.cmpChar(this.tokenStart+1,eo)?this.UnicodeRange():this.Identifier();case A:{const t=this.charCodeAt(this.tokenStart);if(t===Df||t===Of||t===eo||t===Pf)return this.Operator();t===Ef&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}const Rf={getNode:no},Mf=35,Ff=38,$f=42,zf=43,jf=47,io=46,Nf=62,Hf=124,Wf=126;function Bf(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function Uf(){switch(this.tokenType){case Ut:return this.AttributeSelector();case I:return this.IdSelector();case q:return this.lookupType(1)===q?this.PseudoElementSelector():this.PseudoClassSelector();case m:return this.TypeSelector();case S:case j:return this.Percentage();case L:this.charCodeAt(this.tokenStart)===io&&this.error("Identifier is expected",this.tokenStart+1);break;case A:{switch(this.charCodeAt(this.tokenStart)){case zf:case Nf:case Wf:case jf:return this.Combinator();case io:return this.ClassSelector();case $f:case Hf:return this.TypeSelector();case Mf:return this.IdSelector();case Ff:return this.NestingSelector()}break}}}const Vf={onWhiteSpace:Bf,getNode:Uf};function Xf(){return this.createSingleNodeList(this.Raw(null,!1))}function Yf(){const e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===ut){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 so(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}const qf={getNode:no,onWhiteSpace(e,t){so(e)&&(e.value=" "+e.value),so(t.last)&&(t.last.value+=" ")},expression:Xf,var:Yf},Gf=Object.freeze(Object.defineProperty({__proto__:null,AtrulePrelude:Rf,Selector:Vf,Value:qf},Symbol.toStringTag,{value:"Module"})),Kf=new Set(["none","and","not","or"]),Qf={parse:{prelude(){const e=this.createList();if(this.tokenType===m){const t=this.substring(this.tokenStart,this.tokenEnd);Kf.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}},Jf={parse:{prelude:null,block(){return this.Block(!0)}}};function xn(e,t){return this.parseWithFallback(()=>{try{return e.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==k&&this.error()}},t||(()=>this.Raw(null,!0)))}const ro={layer(){this.skipSC();const e=this.createList(),t=xn.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();const e=this.createList(),t=xn.call(this,this.Declaration,()=>xn.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},Zf={parse:{prelude(){const e=this.createList();switch(this.tokenType){case wt:e.push(this.String());break;case Y:case x:e.push(this.Url());break;default:this.error("String or url() is expected")}return this.skipSC(),this.tokenType===m&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer")?e.push(this.Identifier()):this.tokenType===x&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer(")&&e.push(this.Function(null,ro)),this.skipSC(),this.tokenType===x&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,ro)),(this.lookupNonWSType(0)===m||this.lookupNonWSType(0)===P)&&e.push(this.MediaQueryList()),e},block:null}},td={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}},ed={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}},nd={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},id={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},sd={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}},rd={parse:{prelude:null,block(e=!1){return this.Block(e)}}},od={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}},ld={container:Qf,"font-face":Jf,import:Zf,layer:td,media:ed,nest:nd,page:id,scope:sd,"starting-style":rd,supports:od};function ad(){const e=this.createList();this.skipSC();t:for(;!this.eof;){switch(this.tokenType){case m:e.push(this.Identifier());break;case wt:e.push(this.String());break;case ut:e.push(this.Operator());break;case k:break t;default:this.error("Identifier, string or comma is expected")}this.skipSC()}return e}const Rt={parse(){return this.createSingleNodeList(this.SelectorList())}},Ln={parse(){return this.createSingleNodeList(this.Selector())}},cd={parse(){return this.createSingleNodeList(this.Identifier())}},hd={parse:ad},Re={parse(){return this.createSingleNodeList(this.Nth())}},ud={dir:cd,has:Rt,lang:hd,matches:Rt,is:Rt,"-moz-any":Rt,"-webkit-any":Rt,where:Rt,not:Rt,"nth-child":Re,"nth-last-child":Re,"nth-last-of-type":Re,"nth-of-type":Re,slotted:Ln,host:Ln,"host-context":Ln},fd=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:xi,Atrule:Ti,AtrulePrelude:Oi,AttributeSelector:Ii,Block:zi,Brackets:Ni,CDC:Wi,CDO:Ui,ClassSelector:Xi,Combinator:Gi,Comment:Qi,Condition:ts,Declaration:rs,DeclarationList:ls,Dimension:cs,Feature:us,FeatureFunction:ds,FeatureRange:ys,Function:ks,GeneralEnclosed:Ss,Hash:Cs,IdSelector:Ts,Identifier:Ls,Layer:Os,LayerList:Ds,MediaQuery:Rs,MediaQueryList:Fs,NestingSelector:zs,Nth:Ns,Number:Ws,Operator:Us,Parentheses:Xs,Percentage:qs,PseudoClassSelector:Ks,PseudoElementSelector:Js,Ratio:nr,Raw:sr,Rule:lr,Scope:cr,Selector:ur,SelectorList:dr,String:_r,StyleSheet:kr,SupportsDeclaration:Sr,TypeSelector:xr,UnicodeRange:Er,Url:Dr,Value:Rr,WhiteSpace:Fr},Symbol.toStringTag,{value:"Module"})),dd={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:Gf,atrule:ld,pseudo:ud,node:fd},pd=Tf(dd);function Me(e){const t={};for(const n of Object.keys(e)){let i=e[n];i&&(Array.isArray(i)||i instanceof K?i=i.map(Me):i.constructor===Object&&(i=Me(i))),t[n]=i}return t}let md="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",dt=(e=21)=>{let t="",n=e|0;for(;n--;)t+=md[Math.random()*64|0];return t};const oo=dt(),ce=new Set;function Fe(e){return!!(e&&e.type==="Function"&&e.name==="anchor")}function Tt(e,t=!1){return pd(e,{parseAtrulePrelude:!1,parseCustomProperty:!0,onParseError:n=>{t&&ce.add(n)}})}function tt(e){return vf(e,{mode:"spec"})}function gd(e){return e.type==="Declaration"}function _d(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 An(e){return e?e.children.map(t=>{var n;let i;((n=t.children.last)==null?void 0:n.type)==="PseudoElementSelector"&&(t=Me(t),i=tt(t.children.last),t.children.pop());const s=tt(t);return{selector:s+(i??""),elementPart:s,pseudoElementPart:i}}).toArray():[]}function yd(){ce.size>0&&(console.group(`The CSS anchor positioning polyfill was not applied due to ${ce.size===1?"a CSS parse error":"CSS parse errors"}.`),ce.forEach(e=>{console.warn(e.formattedMessage)}),console.groupEnd())}function bd(){ce.clear()}const Tn=[...Nr,"anchor-scope","anchor-name"].reduce((e,t)=>(e[t]=`--${t}-${oo}`,e),{});function kd(e,t){return gd(e)&&Tn[e.property]&&t?(t.children.appendData(J(U({},e),{property:Tn[e.property]})),{updated:!0}):{}}function vd(e){for(const t of e){let n=!1;const i=Tt(t.css,!0);At(i,{visit:"Declaration",enter(s){var r;const l=(r=this.rule)==null?void 0:r.block,{updated:c}=kd(s,l);c&&(n=!0)}}),n&&(t.css=tt(i),t.changed=!0)}return e.some(t=>t.changed===!0)}var lo=(e=>(e.All="all",e.None="none",e))(lo||{});function ot(e,t){var n;return t=(n=Tn[t])!=null?n:t,(e instanceof HTMLElement?getComputedStyle(e):e.computedStyle).getPropertyValue(t).trim()}function Qt(e,t,n){return ot(e,t)===n}function Sd(e,{selector:t,pseudoElementPart:n}){const i=getComputedStyle(e,n),s=document.createElement("div"),r=document.createElement("style");s.id=`fake-pseudo-element-${dt()}`;for(const c of Array.from(i)){const a=i.getPropertyValue(c);s.style.setProperty(c,a)}r.textContent+=`#${s.id}${n} { content: ${i.content}; }`,r.textContent+=`${t} { display: none !important; }`,document.head.append(r);const l=n==="::before"?"afterbegin":"beforeend";return e.insertAdjacentElement(l,s),{fakePseudoElement:s,sheet:r,computedStyle:i}}function wd(e){let t=e;for(;t;){if(Qt(t,"overflow","scroll"))return t;t=t.parentElement}return t}function Cd(e){let t=wd(e);return t===document.documentElement&&(t=null),t??{scrollTop:0,scrollLeft:0}}function xd(e,t){const{elementPart:n,pseudoElementPart:i}=e,s=[];if(i&&!(i==="::before"||i==="::after"))return s;const r=he(t.roots,n);if(!i)return s.push(...r),s;for(const l of r){const{fakePseudoElement:c,sheet:a,computedStyle:o}=Sd(l,e),h=c.getBoundingClientRect(),{scrollY:u,scrollX:f}=globalThis,d=Cd(l);s.push({fakePseudoElement:c,computedStyle:o,removeFakePseudoElement(){c.remove(),a.remove()},contextElement:l,getBoundingClientRect(){const{scrollY:p,scrollX:g}=globalThis,{scrollTop:y,scrollLeft:_}=d;return DOMRect.fromRect({y:h.y+(u-p)+(d.scrollTop-y),x:h.x+(f-g)+(d.scrollLeft-_),width:h.width,height:h.height})}})}return s}function Ld(e,t){const n=ot(e,"anchor-name");return t?n.split(",").map(i=>i.trim()).includes(t):!n}function Ad(e,t){const n=ot(e,"anchor-scope");return n===t||n==="all"}const En=e=>O(null,null,function*(){var t,n,i;let s=yield(t=nt.getOffsetParent)==null?void 0:t.call(nt,e);return(yield(n=nt.isElement)==null?void 0:n.call(nt,s))||(s=(yield(i=nt.getDocumentElement)==null?void 0:i.call(nt,e))||window.document.documentElement),s}),he=(e,t)=>e.flatMap(n=>[...n.querySelectorAll(t)]),ao="InvalidMimeType";function Td(e){return!!((e.type==="text/css"||e.rel==="stylesheet")&&e.href)}function Ed(e){const t=new URL(e.href,document.baseURI);if(Td(e)&&t.origin===location.origin)return t}function Od(e){return O(this,null,function*(){return(yield Promise.all(e.map(t=>O(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()),s=i.headers.get("content-type");if(!(s!=null&&s.startsWith("text/css"))){const l=new Error(`Error loading ${t.url}: expected content-type "text/css", got "${s}".`);throw l.name=ao,l}const r=yield i.text();return J(U({},t),{css:r})}catch(i){if(i instanceof Error&&i.name===ao)return console.warn(i),null;throw i}})))).filter(t=>t!==null)})}const co='[style*="anchor"]',ho='[style*="position-area"]';function Pd(e){const t=e?e.filter(i=>i instanceof HTMLElement&&(i.matches(co)||i.matches(ho))):Array.from(document.querySelectorAll([co,ho].join(","))),n=[];return t.filter(i=>i instanceof HTMLElement).forEach(i=>{const s=dt(12),r="data-has-inline-styles";i.setAttribute(r,s);const l=i.getAttribute("style"),c=`[${r}="${s}"] { ${l} }`;n.push({el:i,css:c})}),n}function Dd(e){return O(this,null,function*(){var t,n;const i=(t=e.elements)!=null?t:he(e.roots,"link, style"),s=[];i.filter(c=>c instanceof HTMLElement).forEach(c=>{if(c.tagName.toLowerCase()==="link"){const a=Ed(c);a&&s.push({el:c,url:a})}c.tagName.toLowerCase()==="style"&&s.push({el:c,css:c.innerHTML})});const r=e.excludeInlineStyles?(n=e.elements)!=null?n:[]:void 0,l=Pd(r);return yield Od([...s,...l])})}const Id="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let uo=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Id[n[e]&63];return t};const fo="--pa-cascade-property",po="data-anchor-position-wrapper",mo="data-pa-wrapper-for-",go="POLYFILL-POSITION-AREA",Rd=["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 _o(e){return Rd.includes(e)}const yo={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"]},Md=["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"],Fd=["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"],$d=["block-start","center","block-end","span-block-start","span-block-end","span-all"],zd=["inline-start","center","inline-end","span-inline-start","span-inline-end","span-all"],jd=["self-block-start","center","self-block-end","span-self-block-start","span-self-block-end","span-all"],Nd=["self-inline-start","center","self-inline-end","span-self-inline-start","span-self-inline-end","span-all"],bo=["start","center","end","span-start","span-end","span-all"],ko=["self-start","center","self-end","span-self-start","span-self-end","span-all"],Hd=["block","top","bottom","y"],Wd=["inline","left","right","x"];function On(e){const t=e.split("-");for(const n of t){if(Hd.includes(n))return"block";if(Wd.includes(n))return"inline"}return"ambiguous"}function Bd(e,t){return t[0].includes(e[0])&&t[1].includes(e[1])||t[0].includes(e[1])&&t[1].includes(e[0])}const Ud=[[Md,Fd],[$d,zd],[jd,Nd],[bo,bo],[ko,ko]];function Vd(e){for(const t of Ud)if(Bd(e,t))return!0;return!1}const vo=e=>{const t=getComputedStyle(e);return{writingMode:t.writingMode,direction:t.direction}},Xd=(e,t)=>O(null,null,function*(){const n=yield En(e);switch(t){case"Logical":case"Physical":return vo(n);case"LogicalSelf":case"PhysicalSelf":return vo(e);default:return null}}),Pn=e=>e.reverse().map(t=>3-t),So=(e,t)=>e==="Irrelevant"?t:e,Yd=(e,t)=>O(null,[e,t],function*({block:n,inline:i},s){const r=So(n[2],i[2]),l=yield Xd(s,r),c={block:[n[0],n[1]],inline:[i[0],i[1]]};if(l){if(l.direction==="rtl"&&(c.inline=Pn(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=Pn(c.block))}l.writingMode.endsWith("rl")&&(c.inline=Pn(c.inline))}return c}),qd=({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 wo([e,t]){return e===0&&t===3?"center":e===0?"end":t===3?"start":"center"}function Gd(e){return e.type==="Declaration"&&e.property==="position-area"}function Kd(e){const t=e.value.children.toArray().map(({name:n})=>n);return t.length===1&&(On(t[0])==="ambiguous"?t.push(t[0]):t.push("span-all")),t}function Qd(e){if(!Gd(e))return;const t=Kd(e);if(!Vd(t))return;const n={};switch(On(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":On(t[1])=="block"?(n.block=t[1],n.inline=t[0]):(n.inline=t[1],n.block=t[0]);break}const i={block:yo[n.block],inline:yo[n.inline]},s=`--pa-declaration-${uo(12)}`;return{values:n,grid:i,selectorUUID:s}}function Jd(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:fo,value:{type:"Raw",value:e.selectorUUID},important:!1})}function Zd(e,t){var n,i;let s;if(((n=e.parentElement)==null?void 0:n.tagName)===go)s=e.parentElement;else{s=document.createElement(go),s.style.display="grid",s.style.position="absolute";const r=getComputedStyle(e).pointerEvents;s.style.pointerEvents="none",e.style.pointerEvents=r,["top","left","right","bottom"].forEach(l=>{s.style.setProperty(l,`var(--pa-value-${l})`)}),(i=e.parentElement)==null||i.insertBefore(s,e),s.appendChild(e)}return s.setAttribute(`${mo}${t}`,""),s}function tp(e,t,n){return O(this,null,function*(){const i=`--pa-target-${uo(12)}`,s=yield Yd(t.grid,e),r=qd(s),l=So(t.grid.block[2],t.grid.inline[2]),c=["LogicalSelf","PhysicalSelf"].includes(l)?s:t.grid,a={block:wo([c.block[0],c.block[1]]),inline:wo([c.inline[0],c.inline[1]])};return{insets:r,alignments:a,targetUUID:i,targetEl:e,anchorEl:n,wrapperEl:Zd(e,i),values:t.values,grid:t.grid,selectorUUID:t.selectorUUID}})}function ep(e,t){return`
|
|
22
|
+
[${po}="${t}"][${mo}${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 np=["normal","most-width","most-height","most-block-size","most-inline-size"],ip=["flip-block","flip-inline","flip-start"];function sp(e){return e.type==="Declaration"}function rp(e){return e.type==="Declaration"&&e.property==="position-try-fallbacks"}function op(e){return e.type==="Declaration"&&e.property==="position-try-order"}function lp(e){return e.type==="Declaration"&&e.property==="position-try"}function ap(e){return e.type==="Atrule"&&e.name==="position-try"}function cp(e){return ip.includes(e)}function hp(e){return np.includes(e)}function up(e,t){const n=document.querySelector(e);if(n){let i=dp(n);return t.forEach(s=>{i=Co(i,s)}),i}}function fp(e,t){let n=e.declarations;return t.forEach(i=>{n=Co(n,i)}),n}function dp(e){const t={};return Nr.forEach(n=>{const i=ot(e,`--${n}-${oo}`);i&&(t[n]=i)}),t}const pp={"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"}},mp={"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"}},gp={"flip-block":{top:"bottom",bottom:"top",start:"end",end:"start"},"flip-inline":{left:"right",right:"left",start:"end",end:"start"},"flip-start":{}};function _p(e,t){return pp[t][e]||e}function yp(e,t){return mp[t][e]||e}function bp(e,t){if(t==="flip-start")return e;{const n=gp[t];return e.split("-").map(i=>n[i]||i).join("-")}}function kp(e,t,n){if(e==="margin"){const[i,s,r,l]=t.children.toArray();n==="flip-block"?l?t.children.fromArray([r,s,i,l]):r&&t.children.fromArray([r,s,i]):n==="flip-inline"&&l&&t.children.fromArray([i,l,r,s])}else if(e==="margin-block"){const[i,s]=t.children.toArray();n==="flip-block"&&s&&t.children.fromArray([s,i])}else if(e==="margin-inline"){const[i,s]=t.children.toArray();n==="flip-inline"&&s&&t.children.fromArray([s,i])}}const vp=(e,t)=>{var n;return((n=Tt(`#id{${e}: ${t};}`).children.first)==null?void 0:n.block.children.first).value};function Co(e,t){const n={};return Object.entries(e).forEach(([i,s])=>{const r=i,l=vp(r,s),c=_p(r,t);c!==r&&(n[r]!=null||(n[r]="revert")),At(l,{visit:"Function",enter(a){Fe(a)&&a.children.forEach(o=>{ue(o)&&Wr(o.name)&&(o.name=yp(o.name,t))})}}),r==="position-area"&&l.children.forEach(a=>{ue(a)&&_o(a.name)&&(a.name=bp(a.name,t))}),r.startsWith("margin")&&kp(r,l,t),n[c]=tt(l)}),n}function xo(e){const t=_d(e),n=[];return t.forEach(i=>{const s={atRules:[],tactics:[],positionAreas:[]};i.forEach(r=>{cp(r.name)?s.tactics.push(r.name):r.name.startsWith("--")?s.atRules.push(r.name):_o(r.name)&&s.positionAreas.push(r.name)}),s.positionAreas.length?n.push({positionArea:s.positionAreas[0],type:"position-area"}):s.atRules.length&&s.tactics.length?n.push({tactics:s.tactics,atRule:s.atRules[0],type:"at-rule-with-try-tactic"}):s.atRules.length?n.push({atRule:s.atRules[0],type:"at-rule"}):s.tactics.length&&n.push({tactics:s.tactics,type:"try-tactic"})}),n}function Sp(e){return rp(e)&&e.value.children.first?xo(e.value.children):[]}function wp(e){if(lp(e)&&e.value.children.first){const t=Me(e);let n;const i=t.value.children.first.name;i&&hp(i)&&(n=i,t.value.children.shift());const s=xo(t.value.children);return{order:n,options:s}}return{}}function Cp(e){return op(e)&&e.value.children.first?{order:e.value.children.first.name}:{}}function xp(e){const{order:t,options:n}=wp(e);if(t||n)return{order:t,options:n};const{order:i}=Cp(e),s=Sp(e);return i||s?{order:i,options:s}:{}}function Lp(e){return ae(e.property)||sf(e.property)||zr(e.property)||rf(e.property)||["position-anchor","position-area"].includes(e.property)}function Ap(e){var t,n;if(ap(e)&&(t=e.prelude)!=null&&t.value&&(n=e.block)!=null&&n.children){const i=e.prelude.value,s=e.block.children.filter(l=>sp(l)&&Lp(l)),r={uuid:`${i}-try-${dt(12)}`,declarations:Object.fromEntries(s.map(l=>[l.property,tt(l.value)]))};return{name:i,tryBlock:r}}return{}}function Tp(e){const t={},n={},i={};for(const s of e){const r=Tt(s.css);At(r,{visit:"Atrule",enter(l){const{name:c,tryBlock:a}=Ap(l);c&&a&&(t[c]=a)}})}for(const s of e){let r=!1;const l=new Set,c=Tt(s.css);At(c,{visit:"Declaration",enter(a){var o;const h=(o=this.rule)==null?void 0:o.prelude,u=An(h);if(!u.length)return;const{order:f,options:d}=xp(a),p={};f&&(p.order=f),u.forEach(({selector:g})=>{var y;d?.forEach(_=>{var w;let v;if(_.type==="at-rule")v=_.atRule;else if(_.type==="try-tactic"){v=`${g}-${_.tactics.join("-")}`;const T=up(g,_.tactics);T&&(t[v]={uuid:`${g}-${_.tactics.join("-")}-try-${dt(12)}`,declarations:T})}else if(_.type==="at-rule-with-try-tactic"){v=`${g}-${_.atRule}-${_.tactics.join("-")}`;const T=t[_.atRule],pt=fp(T,_.tactics);pt&&(t[v]={uuid:`${g}-${_.atRule}-${_.tactics.join("-")}-try-${dt(12)}`,declarations:pt})}if(v&&t[v]){const T=`[data-anchor-polyfill="${t[v].uuid}"]`;n[T]!=null||(n[T]=[]),n[T].push(g),l.has(v)||(p.fallbacks!=null||(p.fallbacks=[]),p.fallbacks.push(t[v]),l.add(v),(w=this.stylesheet)==null||w.children.prependData({type:"Rule",prelude:{type:"Raw",value:T},block:{type:"Block",children:new K().fromArray(Object.entries(t[v].declarations).map(([pt,C])=>({type:"Declaration",important:!0,property:pt,value:{type:"Raw",value:C}})))}}),r=!0)}}),Object.keys(p).length>0&&(i[g]?(p.order&&(i[g].order=p.order),p.fallbacks&&((y=i[g]).fallbacks!=null||(y.fallbacks=[]),i[g].fallbacks.push(...p.fallbacks))):i[g]=p)})}}),r&&(s.css=tt(c),s.changed=!0)}return{fallbackTargets:n,validPositions:i}}function Ep(e,t){return!e||e===t?!1:Lo(e)?e.document.contains(t):e.contains(t)}function Lo(e){return!!(e&&e===e.window)}function Op(e){return Qt(e,"position","fixed")}function Dn(e){return!!(e&&(Op(e)||Qt(e,"position","absolute")))}function Ao(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING}function Pp(e){return O(this,null,function*(){return yield nt.getOffsetParent(e)})}function In(e){return O(this,null,function*(){if(!["absolute","fixed"].includes(ot(e,"position")))return yield Pp(e);let t=e.parentElement;for(;t;){if(!Qt(t,"position","static")&&Qt(t,"display","block"))return t;t=t.parentElement}return window})}function Dp(e,t,n,i){return O(this,null,function*(){const s=yield In(e),r=yield In(n);if(!(Ep(r,e)||Lo(r))||s===r&&!(!Dn(e)||Ao(e,n)))return!1;if(s!==r){let l;const c=[];for(l=s;l&&l!==r&&l!==window;)c.push(l),l=yield In(l);const a=c[c.length-1];if(a instanceof HTMLElement&&!(!Dn(a)||Ao(a,n)))return!1}{let l=e.parentElement;for(;l;){if(Qt(l,"content-visibility","hidden"))return!1;l=l.parentElement}}return!(t&&i&&To(e,t,i)!==To(n,t,i))})}function To(e,t,n){for(;!(e.matches(n)&&Ad(e,t));){if(!e.parentElement)return null;e=e.parentElement}return e}function Ip(e,t,n,i,s){return O(this,null,function*(){if(!(e instanceof HTMLElement&&n.length&&Dn(e)))return null;const r=n.flatMap(c=>xd(c,s)).filter(c=>Ld(c,t)),l=i.map(c=>c.selector).join(",")||null;for(let c=r.length-1;c>=0;c--){const a=r[c],o="fakePseudoElement"in a;if(yield Dp(o?a.fakePseudoElement:a,t,e,l))return o&&a.removeFakePseudoElement(),a}return null})}function Rp(e){return e.type==="Declaration"&&e.property==="anchor-name"}function Mp(e){return e.type==="Declaration"&&e.property==="anchor-scope"}function Rn(e){return!!(e&&e.type==="Function"&&e.name==="anchor-size")}function $e(e){return!!(e&&e.type==="Function"&&e.name==="var")}function ue(e){return!!(e.type==="Identifier"&&e.name)}function Fp(e){return!!(e.type==="Percentage"&&e.value)}function Eo(e,t){let n,i,s,r="",l=!1,c;const a=[];e.children.toArray().forEach(f=>{if(l){r=`${r}${tt(f)}`;return}if(f.type==="Operator"&&f.value===","){l=!0;return}a.push(f)});let[o,h]=a;if(h||(h=o,o=void 0),o&&(ue(o)&&o.name.startsWith("--")?n=o.name:$e(o)&&o.children.first&&(c=o.children.first.name)),h)if(Fe(e)){if(ue(h)&&Wr(h.name))i=h.name;else if(Fp(h)){const f=Number(h.value);i=Number.isNaN(f)?void 0:f}}else Rn(e)&&ue(h)&&cf(h.name)&&(s=h.name);const u=`--anchor-${dt(12)}`;return Object.assign(e,{type:"Raw",value:`var(${u})`,children:null}),Reflect.deleteProperty(e,"name"),{anchorName:n,anchorSide:i,anchorSize:s,fallbackValue:r||"0px",customPropName:c,uuid:u}}function Oo(e){return e.value.children.map(({name:t})=>t)}let fe={},Mt={},Ft={},de={},$t={};function $p(){fe={},Mt={},Ft={},de={},$t={}}function zp(e,t){var n;if((Fe(e)||Rn(e))&&t){if(t.property.startsWith("--")){const i=tt(t.value),s=Eo(e);return de[s.uuid]=i,Ft[t.property]=[...(n=Ft[t.property])!=null?n:[],s],{changed:!0}}if(Fe(e)&&ae(t.property)||Rn(e)&&Hr(t.property)){const i=Eo(e);return{prop:t.property,data:i,changed:!0}}}return{}}function Po(e,t,n){return O(this,null,function*(){let i=t?.anchorName;const s=t?.customPropName;if(e&&!i){const a=ot(e,"position-anchor");a?i=a:s&&(i=ot(e,s))}const r=i?fe[i]||[]:[],l=i?Mt[lo.All]||[]:[],c=i?Mt[i]||[]:[];return yield Ip(e,i||null,r,[...l,...c],{roots:n.roots})})}function jp(e,t){return O(this,null,function*(){var n,i,s,r,l,c,a,o,h,u,f;const d={},p={};$p();const{fallbackTargets:g,validPositions:y}=Tp(e);for(const C of e){let M=!1;const H=Tt(C.css);At(H,function(E){var W,F,D,V;const R=(W=this.rule)==null?void 0:W.prelude,$=An(R);if(Rp(E)&&$.length)for(const z of Oo(E))fe[z]!=null||(fe[z]=[]),fe[z].push(...$);if(Mp(E)&&$.length)for(const z of Oo(E))Mt[z]!=null||(Mt[z]=[]),Mt[z].push(...$);const{prop:Q,data:St,changed:zt}=zp(E,this.declaration);if(Q&&St&&$.length)for(const{selector:z}of $)d[z]=J(U({},d[z]),{[Q]:[...(D=(F=d[z])==null?void 0:F[Q])!=null?D:[],St]});let X;if(this.block&&(X=Qd(E),X)){Jd(X,this.block);for(const{selector:z}of $)p[z]=[...(V=p[z])!=null?V:[],X]}(zt||X)&&(M=!0)}),M&&(C.css=tt(H),C.changed=!0)}const _=new Set(Object.keys(Ft)),w={},v=C=>{var M,H,E,W,F;const D=[],V=new Set((H=(M=w[C])==null?void 0:M.names)!=null?H:[]);for(;V.size>0;)for(const R of V)D.push(...(E=Ft[R])!=null?E:[]),V.delete(R),(F=(W=w[R])==null?void 0:W.names)!=null&&F.length&&w[R].names.forEach($=>V.add($));return D};for(;_.size>0;){const C=[];for(const M of e){let H=!1;const E=Tt(M.css);At(E,{visit:"Function",enter(W){var F,D;const V=(F=this.rule)==null?void 0:F.prelude,R=this.declaration,$=R?.property;if(V?.children.isEmpty===!1&&$e(W)&&R&&$&&W.children.first&&_.has(W.children.first.name)&&$.startsWith("--")){const Q=W.children.first,St=(D=Ft[Q.name])!=null?D:[],zt=v(Q.name);if(!(St.length||zt.length))return;const X=`${Q.name}-anchor-${dt(12)}`,z=tt(R.value);de[X]=z,w[$]||(w[$]={names:[],uuids:[]});const Jt=w[$];Jt.names.includes(Q.name)||Jt.names.push(Q.name),Jt.uuids.push(X),C.push($),Q.name=X,H=!0}}}),H&&(M.css=tt(E),M.changed=!0)}_.clear(),C.forEach(M=>_.add(M))}for(const C of e){let M=!1;const H=Tt(C.css);At(H,{visit:"Function",enter(E){var W,F,D,V,R,$,Q;const St=(W=this.rule)==null?void 0:W.prelude,zt=this.declaration,X=zt?.property;if(St?.children.isEmpty===!1&&$e(E)&&zt&&X&&E.children.first&&(ae(X)||zr(X))){const z=E.children.first,Jt=(F=Ft[z.name])!=null?F:[],Fn=v(z.name);if(!(Jt.length||Fn.length))return;const Ne=`${X}-${dt(12)}`;if(Fn.length){const Zt=new Set([z.name]);for(;Zt.size>0;)for(const te of Zt){const lt=w[te];if((D=lt?.names)!=null&&D.length&&(V=lt?.uuids)!=null&&V.length)for(const ee of lt.names)for(const ne of lt.uuids)$t[ne]=J(U({},$t[ne]),{[Ne]:`${ee}-${Ne}`});Zt.delete(te),(R=lt?.names)!=null&&R.length&<.names.forEach(ee=>Zt.add(ee))}}const tm=An(St);for(const Zt of[...Jt,...Fn]){const te=U({},Zt),lt=`--anchor-${dt(12)}-${X}`,ee=te.uuid;te.uuid=lt;for(const{selector:ne}of tm)d[ne]=J(U({},d[ne]),{[X]:[...(Q=($=d[ne])==null?void 0:$[X])!=null?Q:[],te]});$t[ee]=J(U({},$t[ee]),{[Ne]:lt})}z.name=`${z.name}-${Ne}`,M=!0}}}),M&&(C.css=tt(H),C.changed=!0)}if(Object.keys($t).length>0)for(const C of e){let M=!1;const H=Tt(C.css);At(H,{visit:"Function",enter(E){var W,F,D,V;if($e(E)&&(F=(W=E.children.first)==null?void 0:W.name)!=null&&F.startsWith("--")&&(V=(D=this.declaration)==null?void 0:D.property)!=null&&V.startsWith("--")&&this.block){const R=E.children.first,$=$t[R.name];if($)for(const[Q,St]of Object.entries($))this.block.children.appendData({type:"Declaration",important:!1,property:`${this.declaration.property}-${Q}`,value:{type:"Raw",value:tt(this.declaration.value).replace(`var(${R.name})`,`var(${St})`)}}),M=!0;de[R.name]&&(this.declaration.value={type:"Raw",value:de[R.name]},M=!0)}}}),M&&(C.css=tt(H),C.changed=!0)}const T=new Map;for(const[C,M]of Object.entries(d)){let H;C.startsWith("[data-anchor-polyfill=")&&(n=g[C])!=null&&n.length?H=he(t.roots,g[C].join(",")):H=he(t.roots,C);for(const[E,W]of Object.entries(M))for(const F of W)for(const D of H){const V=yield Po(D,F,{roots:t.roots}),R=`--anchor-${dt(12)}`;T.set(D,J(U({},(i=T.get(D))!=null?i:{}),{[F.uuid]:R})),D.setAttribute("style",`${F.uuid}: var(${R}); ${(s=D.getAttribute("style"))!=null?s:""}`),y[C]=J(U({},y[C]),{declarations:J(U({},(r=y[C])==null?void 0:r.declarations),{[E]:[...(a=(c=(l=y[C])==null?void 0:l.declarations)==null?void 0:c[E])!=null?a:[],J(U({},F),{anchorEl:V,targetEl:D,uuid:R})]})})}}const pt={el:document.createElement("link"),changed:!1,created:!0,css:""};e.push(pt);for(const[C,M]of Object.entries(p)){const H=he(t.roots,C);for(const E of H){const W=yield Po(E,null,{roots:t.roots});for(const F of M){const D=yield tp(E,F,W);pt.css+=ep(D.targetUUID,F.selectorUUID),pt.changed=!0,y[C]=J(U({},y[C]),{declarations:J(U({},(o=y[C])==null?void 0:o.declarations),{"position-area":[...(f=(u=(h=y[C])==null?void 0:h.declarations)==null?void 0:u["position-area"])!=null?f:[],D]})})}}}return{rules:y,inlineStyles:T,anchorScopes:Mt}})}const Np=["as","blocking","crossorigin","disabled","fetchpriority","href","hreflang","integrity","referrerpolicy","rel","type"];function Do(e,t,n=!1){const i=[];for(const{el:s,css:r,changed:l,created:c=!1}of e){const a={el:s,css:r,changed:!1};if(l){if(s.tagName.toLowerCase()==="style")s.innerHTML=r;else if(s instanceof HTMLLinkElement){const o=document.createElement("style");o.textContent=r;for(const h of s.getAttributeNames())if(!h.startsWith("on")&&!Np.includes(h)){const u=s.getAttribute(h);u!==null&&o.setAttribute(h,u)}s.hasAttribute("href")&&o.setAttribute("data-original-href",s.getAttribute("href")),c?(o.setAttribute("data-generated-by-polyfill","true"),document.head.insertAdjacentElement("beforeend",o)):(s.insertAdjacentElement("beforebegin",o),s.remove()),a.el=o}else if(s.hasAttribute("data-has-inline-styles")){const o=s.getAttribute("data-has-inline-styles");if(o){const h=`[data-has-inline-styles="${o}"]{`;let u=r.slice(h.length,-1);const f=t?.get(s);if(f)for(const[d,p]of Object.entries(f))u=`${d}: var(${p}); ${u}`;s.setAttribute("style",u)}}}n&&s.hasAttribute("data-has-inline-styles")&&s.removeAttribute("data-has-inline-styles"),i.push(a)}return i}const Hp=J(U({},nt),{_c:new Map}),Wp=(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},Bp=(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},Io=e=>{switch(e){case"top":case"bottom":return"y";case"left":case"right":return"x"}return null},Up=e=>{switch(e){case"x":return"width";case"y":return"height"}return null},Ro=e=>ot(e,"display")==="inline",Mo=(e,t)=>(t==="x"?["border-left-width","border-right-width"]:["border-top-width","border-bottom-width"]).reduce((n,i)=>n+parseInt(ot(e,i),10),0)||0,ze=(e,t)=>parseInt(ot(e,`margin-${t}`),10)||0,Vp=e=>({top:ze(e,"top"),right:ze(e,"right"),bottom:ze(e,"bottom"),left:ze(e,"left")}),Mn=e=>O(null,[e],function*({targetEl:t,targetProperty:n,anchorRect:i,anchorSide:s,anchorSize:r,fallback:l=null}){var c;if(!((r||s!==void 0)&&t&&i))return l;if(r){if(!Hr(n))return l;let a;switch(r){case"width":case"height":a=r;break;default:{let o=!1;const h=ot(t,"writing-mode");o=h.startsWith("vertical-")||h.startsWith("sideways-"),a=Bp(r,o)}}return a?`${i[a]}px`:l}if(s!==void 0){let a,o;const h=Io(n);if(!(ae(n)&&h&&(!ae(s)||h===Io(s))))return l;const u=["top","left"];switch(s){case"left":case"top":a=0;break;case"right":case"bottom":a=100;break;case"center":a=50;break;case"inside":a=u.includes(n)?0:100;break;case"outside":a=u.includes(n)?100:0;break;default:if(t){const p=(yield(c=nt.isRTL)==null?void 0:c.call(nt,t))||!1;a=Wp(s,p)}}const f=typeof a=="number"&&!Number.isNaN(a),d=Up(h);if(f&&d){(n==="bottom"||n==="right")&&(o=yield En(t));let p=i[h]+i[d]*(a/100);switch(n){case"bottom":{if(!o)break;let g=o.clientHeight;if(g===0&&Ro(o)){const y=Mo(o,h);g=o.offsetHeight-y}p=g-p;break}case"right":{if(!o)break;let g=o.clientWidth;if(g===0&&Ro(o)){const y=Mo(o,h);g=o.offsetWidth-y}p=g-p;break}}return`${p}px`}}return l}),Xp=e=>"wrapperEl"in e,Yp=e=>"uuid"in e;function qp(e,t=!1){return O(this,null,function*(){const n=document.documentElement;for(const[i,s]of Object.entries(e))for(const r of s){const l=r.anchorEl,c=r.targetEl;if(l&&c)if(Xp(r)){const a=r.wrapperEl,o=(h,u,f)=>O(null,null,function*(){return h===0?"0px":yield Mn({targetEl:a,targetProperty:u,anchorRect:f,anchorSide:h})});Je(l,a,()=>O(null,null,function*(){const h=ot(c,fo);a.setAttribute(po,h);const u=yield nt.getElementRects({reference:l,floating:a,strategy:"absolute"}),f=r.insets,d=yield o(f.block[0],"top",u.reference),p=yield o(f.block[1],"bottom",u.reference),g=yield o(f.inline[0],"left",u.reference),y=yield o(f.inline[1],"right",u.reference);n.style.setProperty(`${r.targetUUID}-top`,d||null),n.style.setProperty(`${r.targetUUID}-left`,g||null),n.style.setProperty(`${r.targetUUID}-right`,y||null),n.style.setProperty(`${r.targetUUID}-bottom`,p||null),n.style.setProperty(`${r.targetUUID}-justify-self`,r.alignments.inline),n.style.setProperty(`${r.targetUUID}-align-self`,r.alignments.block)}),{animationFrame:t})}else Je(l,c,()=>O(null,null,function*(){const a=yield nt.getElementRects({reference:l,floating:c,strategy:"absolute"}),o=yield Mn({targetEl:c,targetProperty:i,anchorRect:a.reference,anchorSide:r.anchorSide,anchorSize:r.anchorSize,fallback:r.fallbackValue});n.style.setProperty(r.uuid,o)}),{animationFrame:t});else if(Yp(r)){const a=yield Mn({targetProperty:i,anchorSide:r.anchorSide,anchorSize:r.anchorSize,fallback:r.fallbackValue});n.style.setProperty(r.uuid,a)}}})}function Fo(e,t){return O(this,null,function*(){const n=yield nt.getElementRects({reference:e,floating:e,strategy:"absolute"});return yield Yl({x:e.offsetLeft,y:e.offsetTop,platform:Hp,rects:n,elements:{floating:e,reference:t},strategy:"absolute"},{padding:Vp(e)})})}function Gp(e,t,n=!1){return O(this,null,function*(){if(!t.length)return;const i=document.querySelectorAll(e);for(const s of i){let r=!1;const l=yield En(s);Je({},s,()=>O(null,null,function*(){if(r)return;r=!0,s.removeAttribute("data-anchor-polyfill");const c=yield Fo(s,l);if(Object.values(c).every(a=>a<=0)){s.removeAttribute("data-anchor-polyfill-last-successful"),r=!1;return}for(const[a,{uuid:o}]of t.entries()){s.setAttribute("data-anchor-polyfill",o);const h=yield Fo(s,l);if(Object.values(h).every(u=>u<=0)){s.setAttribute("data-anchor-polyfill-last-successful",o),r=!1;break}if(a===t.length-1){const u=s.getAttribute("data-anchor-polyfill-last-successful");u?s.setAttribute("data-anchor-polyfill",u):s.removeAttribute("data-anchor-polyfill"),r=!1;break}}}),{animationFrame:n,layoutShift:!1})}})}function Kp(e,t=!1){return O(this,null,function*(){var n,i;for(const s of Object.values(e))yield qp((n=s.declarations)!=null?n:{},t);for(const[s,r]of Object.entries(e))yield Gp(s,(i=r.fallbacks)!=null?i:[],t)})}function Qp(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 Jp(e){return O(this,null,function*(){const t=Qp(e??window.ANCHOR_POSITIONING_POLYFILL_OPTIONS);let n=yield Dd(t),i={},s;bd();try{vd(n)&&(n=Do(n));const r=yield jp(n,{roots:t.roots});i=r.rules,s=r.inlineStyles}catch(r){throw yd(),r}return Object.values(i).length&&(Do(n,s,!0),yield Kp(i,t.useAnimationFrame)),i})}const Zp=Object.freeze(Object.defineProperty({__proto__:null,default:Jp},Symbol.toStringTag,{value:"Module"}));b.ActiveDescendantController=jo,b.AnchorController=Jo,b.ClickDelegateController=No,b.DEFAULT_INTERACTIVE_SELECTOR=$n,b.DragController=Yo,b.DragGestureController=Be,b.ItemsCollectionController=We,b.MutationObserverController=tl,b.NativeChildController=rl,b.NavigationIndicatorController=el,b.RafScheduler=Hn,b.ResizeController=qo,b.RovingTabIndexMixin=al,b.ScrollObserverController=Zo,b.TypeaheadController=nl,b.delegateClickTo=jn,b.findExtremeSnapIndex=dl,b.findNearestScrollAncestor=il,b.findNearestSnapIndex=ul,b.findNextSnapIndex=fl,b.getDirectChild=Xn,b.getDirectChildren=Yn,b.getVisualViewportBounds=Ue,b.isEventFromInteractiveDescendant=zn,b.isFocusable=Vn,b.keyInteraction=Wo,b.keyNavigation=Uo,b.mouseMove=Xo,b.pinElementBox=Nn,b.snapToStep=cl,b.valueToPercent=hl,b.warnMissingDirectChild=sl,Object.defineProperty(b,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
|
+
}
|