@rcarls/rc-common 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +295 -0
- package/README.md +148 -72
- package/dist/modules/ActiveDescendantController.js +89 -0
- package/dist/modules/AnchorController.js +317 -0
- package/dist/modules/ControllerEffects.js +60 -0
- package/dist/modules/DragController.js +128 -0
- package/dist/modules/DragGestureController.js +174 -0
- package/dist/modules/FlowController.js +35 -0
- package/dist/modules/ItemsCollectionController.js +233 -0
- package/dist/modules/KeyboardInteractionDirective.js +39 -0
- package/dist/modules/KeyboardNavigationDirective.js +88 -0
- package/dist/modules/LiveAnnouncer.js +36 -0
- package/dist/modules/MutationObserverController.js +30 -0
- package/dist/modules/NavigationIndicatorController.js +81 -0
- package/dist/modules/PopoverController.js +44 -0
- package/dist/modules/RafScheduler.js +83 -0
- package/dist/modules/ReorderController.js +361 -0
- package/dist/modules/ResizeController.js +425 -0
- package/dist/modules/RovingTabIndexMixin.js +87 -0
- package/dist/modules/ScrollObserverController.js +78 -0
- package/dist/modules/TypeaheadController.js +59 -0
- package/dist/modules/anchorPlacement.js +13 -0
- package/dist/modules/clickDelegate.js +31 -0
- package/dist/modules/cssText.js +6 -0
- package/dist/modules/cssTime.js +11 -0
- package/dist/modules/cssZoom.js +16 -0
- package/dist/modules/findNearestScrollAncestor.js +22 -0
- package/dist/modules/flow.js +94 -0
- package/dist/modules/isFocusable.js +6 -0
- package/dist/modules/localeFormat.js +38 -0
- package/dist/modules/messages.js +77 -0
- package/dist/modules/nativeChild.js +37 -0
- package/dist/modules/observeLocale.js +70 -0
- package/dist/modules/sliderUtils.js +14 -0
- package/dist/modules/snapUtils.js +25 -0
- package/dist/modules/softKeyboard.js +72 -0
- package/dist/modules/visualViewport.js +14 -0
- package/dist/rc-common.js +99 -1711
- package/dist/rc-common.umd.cjs +10 -26
- package/dist/types/AnchorController.d.ts +45 -22
- package/dist/types/ControllerEffects.d.ts +15 -0
- package/dist/types/DragController.d.ts +13 -0
- package/dist/types/DragGestureController.d.ts +31 -7
- package/dist/types/FlowController.d.ts +31 -0
- package/dist/types/ItemsCollectionController.d.ts +3 -2
- package/dist/types/KeyboardInteractionDirective.d.ts +1 -2
- package/dist/types/KeyboardNavigationDirective.d.ts +16 -7
- package/dist/types/LiveAnnouncer.d.ts +22 -0
- package/dist/types/MutationObserverController.d.ts +0 -1
- package/dist/types/NavigationIndicatorController.d.ts +1 -1
- package/dist/types/PopoverController.d.ts +21 -0
- package/dist/types/RafScheduler.d.ts +36 -1
- package/dist/types/ReorderController.d.ts +131 -0
- package/dist/types/ResizeController.d.ts +46 -0
- package/dist/types/ScrollObserverController.d.ts +13 -2
- package/dist/types/TypeaheadController.d.ts +8 -2
- package/dist/types/anchorPlacement.d.ts +24 -0
- package/dist/types/clickDelegate.d.ts +9 -56
- package/dist/types/cssText.d.ts +17 -0
- package/dist/types/cssTime.d.ts +14 -0
- package/dist/types/cssZoom.d.ts +12 -0
- package/dist/types/findNearestScrollAncestor.d.ts +3 -3
- package/dist/types/flow.d.ts +121 -0
- package/dist/types/index.d.ts +13 -1
- package/dist/types/localeFormat.d.ts +4 -0
- package/dist/types/messages.d.ts +105 -0
- package/dist/types/nativeChild.d.ts +0 -3
- package/dist/types/observeLocale.d.ts +23 -0
- package/dist/types/softKeyboard.d.ts +79 -0
- package/dist/types/visualViewport.d.ts +21 -0
- package/package.json +1 -4
- package/dist/css-anchor-positioning-fn-hFYJeBk4.js +0 -6371
- package/dist/types/MouseMoveDirective.d.ts +0 -42
package/dist/rc-common.umd.cjs
CHANGED
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
(function(k,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):(k=typeof globalThis<"u"?globalThis:k||self,Et(k["rc-common"]={},k.lit,k.litDirective,k.litAsyncDirective,k.litDecorators))})(this,(function(k,Et,He,zt,Mo){"use strict";let Fo=0;class jo{constructor(t,n){this._activeItem=null,this._activeIndex=-1,this._itemCounter=0,this._opts=n,this._instanceId=`rc-adc-${++Fo}`,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 Fn='a[href], button, input, select, textarea, summary, [role="button"], [role="link"], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function jn(e,t,n={}){const i=n.interactiveSelector??Fn;for(const s of e.composedPath()){if(s===t)return!1;if(s instanceof Element&&s.matches(i))return!0}return!1}function $n(e,t,n,i={}){return!n||i.disabled||e.defaultPrevented||e.button!==0||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||jn(e,t,i)?!1:(e.preventDefault(),n.click(),!0)}class $o{constructor(t,n){this._handleClick=i=>{$n(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 ze=class ze{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)>ze._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)}};ze._TOUCH_TAP_THRESHOLD=10;let We=ze;class zo extends zt.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 No=zt.directive(zo);class Ho extends zt.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 Wo=zt.directive(Ho);class Bo extends zt.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 Uo=zt.directive(Bo);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 Vo{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 zn(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 Xo{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 zn(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]}}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 Nn={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"},Yo={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"},Hn=typeof CSS<"u"&&CSS.supports("position-try-fallbacks: flip-block")&&CSS.supports("min-width: anchor-size(width)");let Wn=null,Ue=null;function qo(){return Hn?Promise.resolve(null):(Ue||(Ue=Promise.resolve().then(()=>Jp).then(e=>(Wn=e.default,Wn)).catch(()=>null)),Ue)}let Go=0;class Ko{constructor(t,n){this._styleEl=null,this._adoptedSheet=null,this._connected=!1,this._clampLoopActive=!1,this._clampFrame=null,this._appliedDx=0,this._appliedDy=0,this._opts=n,this._uid=`rc-anchor-${++Go}`,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()||(Hn?this._scheduleClamp():this._applyPolyfillOrFallback().then(()=>{this._connected&&!this._opts.disabled&&this._scheduleClamp()}))}_scheduleClamp(){if(this._clampLoopActive||!this._connected||this._opts.disabled)return;this._clampLoopActive=!0;const t=()=>{if(this._clampFrame=null,!this._connected||this._opts.disabled){this._stopClampLoop();return}const n=this._floating();if(!n){this._stopClampLoop();return}const i=n.getBoundingClientRect();if(!(i.width>0||i.height>0)){this._stopClampLoop();return}this._clampToViewport(),this._clampFrame=requestAnimationFrame(t)};this._clampFrame=requestAnimationFrame(t)}_stopClampLoop(){this._clampFrame!==null&&(cancelAnimationFrame(this._clampFrame),this._clampFrame=null),this._clampLoopActive=!1}_clampToViewport(){const t=this._floating();if(!t)return;const n=4,i=t.getBoundingClientRect();if(i.width===0&&i.height===0)return;const s=t.ownerDocument.defaultView;if(!s)return;const r=s.innerWidth,l=s.innerHeight,c=i.left-this._appliedDx,a=i.right-this._appliedDx,o=i.top-this._appliedDy,h=i.bottom-this._appliedDy;let u=0,f=0;a>r-n&&(u=r-n-a),c+u<n&&(u=n-c),h>l-n&&(f=l-n-h),o+f<n&&(f=n-o),this._appliedDx=u,this._appliedDy=f,t.style.translate=u||f?`${u}px ${f}px`:""}async _applyPolyfillOrFallback(){const t=await qo();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=Nn[i],o=Yo[i],h=Nn[o],u=r?`
|
|
2
|
-
@position-try --${
|
|
3
|
-
@position-try --${
|
|
4
|
-
@position-try --${
|
|
5
|
-
`:"",
|
|
1
|
+
(function(c,L){typeof exports=="object"&&typeof module<"u"?L(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"],L):(c=typeof globalThis<"u"?globalThis:c||self,L(c["rc-common"]={},c.lit,c.litDirective,c.litAsyncDirective,c.litDecorators))})(this,(function(c,L,it,N,kt){"use strict";let xt=0;class At{constructor(t,e){this._activeItem=null,this._activeIndex=-1,this._itemCounter=0,this._opts=e,this._instanceId=`rc-adc-${++xt}`,t.addController(this)}hostConnected(){}hostDisconnected(){this.clear()}get activeItem(){return this._activeItem}get activeIndex(){return this._activeIndex}navigate(t){const e=this._opts.items();if(e.length===0)return;const i=this._opts.wrap??!0;let s=this._activeIndex<0?t>0?-1:e.length:this._activeIndex;const o=e.length;let r=0;do if(s+=t,i?s=(s%o+o)%o:s=Math.max(0,Math.min(o-1,s)),r++,!this._isSkipped(e[s]))break;while(r<o);this._setActive(e[s]??null,s)}navigateToFirst(){const t=this._opts.items(),e=t.findIndex(i=>!this._isSkipped(i));e>=0&&this._setActive(t[e],e)}navigateToLast(){const t=this._opts.items();let e=-1;for(let i=t.length-1;i>=0;i--)if(!this._isSkipped(t[i])){e=i;break}e>=0&&this._setActive(t[e],e)}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,e){this._activeItem?.removeAttribute("data-active"),this._activeItem=t,this._activeIndex=e;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 St='a[href], button, input, select, textarea, summary, [role="button"], [role="link"], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function Lt(n,t,e){for(const i of n.composedPath()){if(i===t)return!1;if(i instanceof Element&&i.matches(e))return!0}return!1}class Pt{constructor(t,e){this._handleClick=i=>{const s=this._options.target(),o=i;!s||this._options.disabled?.()||o.defaultPrevented||o.button!==0||o.altKey||o.ctrlKey||o.metaKey||o.shiftKey||Lt(o,this._host,this._options.interactiveSelector??St)||(o.preventDefault(),s.click())},this._host=t,this._options=e,t.addController(this)}hostConnected(){this._host.addEventListener("click",this._handleClick)}hostDisconnected(){this._host.removeEventListener("click",this._handleClick)}}const K=class K{constructor(t,e){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,o=this._resolveOptionLi(s.target);if(o){if(s.pointerType==="touch"){if(this._pendingTouchActivation)return;this._pendingTouchActivation={pointerId:s.pointerId,li:o,startX:s.clientX,startY:s.clientY};return}this._activateLi(o,s)}},this._onPointerMove=i=>{const s=this._pendingTouchActivation,o=i;if(!s||o.pointerId!==s.pointerId)return;Math.hypot(o.clientX-s.startX,o.clientY-s.startY)>K._TOUCH_TAP_THRESHOLD&&(this._pendingTouchActivation=null)},this._onPointerUp=i=>{const s=this._pendingTouchActivation,o=i;!s||o.pointerId!==s.pointerId||(this._pendingTouchActivation=null,this._activateLi(s.li,o))},this._onPointerCancel=i=>{const s=i;this._pendingTouchActivation?.pointerId===s.pointerId&&(this._pendingTouchActivation=null)},this._host=t,this._idPrefix=e.idPrefix,this._onInitFromDom=e.onInitFromDom,this._onActivate=e.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 e=this._liElements.indexOf(t);return e===-1?null:this._options[e]??null}get navigableItems(){const t=[];for(let e=0;e<this._liElements.length;e++){const i=this._liElements[e];this._options[e]?.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];const e=this._ensureContainer(),i=this._createLiElement(t,this._options.length-1);this._liElements.push(i),this._createLi?e.insertBefore(i,this._createLi):e.appendChild(i),this._applyFilterToLi(i,t)}setSelectedValues(t){const e=new Set(this._options.filter(i=>i.kind==="action").map(i=>i.value));this._createOption&&e.add(this._createOption.value),this._selectedValues=new Set(t.filter(i=>!e.has(i))),this._syncSelectedToDom()}filterOptions(t,e="contains"){this._filterText=t,this._filterStrategy=e,this._syncFilterToDom()}clearFilter(){this._filterText="",this._syncFilterToDom()}setCreateOption(t,e){if(t===null){this._createLi?.remove(),this._createLi=null,this._createOption=null;return}const i=t.trim();if(this._createOption={kind:"action",action:"create",value:`create:${i}`,label:e??i,data:{text:i}},!this._createLi){const s=this._ensureContainer(),o=document.createElement("li");o.setAttribute("id",`${this._idPrefix}-create`),o.setAttribute("role","option"),o.setAttribute("aria-selected","false"),o.setAttribute("part","option create-option"),this._checkmark&&this._ensureCheckmark(o),s.appendChild(o),this._createLi=o}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 e=Array.from(t.querySelectorAll(":scope > li"));if(e.length===0)return;const i=[];for(let s=0;s<e.length;s++){const o=e[s],r=o.getAttribute("data-value")??o.getAttribute("value")??o.textContent?.trim()??"",a=o.textContent?.trim()??"",h=o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true";i.push({value:r,label:a,disabled:h}),o.setAttribute("role","option"),o.setAttribute("id",`${this._idPrefix}-${s}`),o.setAttribute("part","option"),o.setAttribute("data-value",r),o.setAttribute("aria-selected",this._selectedValues.has(r)?"true":"false"),o.setAttribute("aria-disabled",h?"true":"false"),this._checkmark&&this._ensureCheckmark(o)}this._options=i,this._liElements=e,this._onInitFromDom?.(i)}_syncOptionsToDom(){const t=this._ensureContainer();for(const e of this._liElements)e.remove();this._liElements=[];for(let e=0;e<this._options.length;e++){const i=this._createLiElement(this._options[e],e);this._liElements.push(i),t.appendChild(i)}this._createLi&&t.appendChild(this._createLi),this._syncFilterToDom()}_createLiElement(t,e){const i=document.createElement("li");return i.setAttribute("role","option"),i.setAttribute("id",`${this._idPrefix}-${e}`),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,e){for(const i of t.childNodes)if(i.nodeType===Node.TEXT_NODE){i.textContent=e;return}t.appendChild(document.createTextNode(e))}_ensureCheckmark(t){if(t.querySelector('[part="option-checkmark"]'))return;const e=document.createElement("span");e.setAttribute("part","option-checkmark"),e.setAttribute("aria-hidden","true"),e.textContent="✓",t.insertBefore(e,t.firstChild)}_removeCheckmark(t){t.querySelector('[part="option-checkmark"]')?.remove()}_syncCheckmarks(){const t=this._createLi?[...this._liElements,this._createLi]:[...this._liElements];for(const e of t)this._checkmark?this._ensureCheckmark(e):this._removeCheckmark(e)}_syncSelectedToDom(){for(let t=0;t<this._liElements.length;t++){const e=this._options[t];e&&this._liElements[t].setAttribute("aria-selected",this._selectedValues.has(e.value)?"true":"false")}}_syncFilterToDom(){for(let t=0;t<this._liElements.length;t++){const e=this._options[t];e&&this._applyFilterToLi(this._liElements[t],e)}}_applyFilterToLi(t,e){t.hidden=!this._isVisible(e)}_isVisible(t){if(!this._filterText)return!0;const e=t.label.toLowerCase(),i=this._filterText.toLowerCase();return typeof this._filterStrategy=="function"?this._filterStrategy(e,i):this._filterStrategy==="contains"?e.includes(i):e.startsWith(i)}_resolveOptionLi(t){if(!t)return null;const e=t.closest("li[data-value]");return!e||e.getAttribute("role")!=="option"||e.parentElement!==this._ul?null:e}_activateLi(t,e){e.preventDefault(),e.stopPropagation();const i=this.optionForElement(t);i&&this._onActivate(i)}};K._TOUCH_TAP_THRESHOLD=10;let U=K;class Dt extends N.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!==it.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 L.nothing}update(t,[e]){this.isConnected&&this._element?.deref()===void 0&&(this._element=new WeakRef(t.element),this._init()),this._options=e??{}}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 Rt=N.directive(Dt),H=Object.freeze({inline:"x",block:"y",inlineReversed:!1,blockReversed:!1,rtl:!1});function y(n){const t=getComputedStyle(n),e=t.direction==="rtl";switch(t.writingMode){case"vertical-rl":case"sideways-rl":return{inline:"y",block:"x",inlineReversed:e,blockReversed:!0,rtl:e};case"vertical-lr":return{inline:"y",block:"x",inlineReversed:e,blockReversed:!1,rtl:e};case"sideways-lr":return{inline:"y",block:"x",inlineReversed:!e,blockReversed:!1,rtl:e};default:return{inline:"x",block:"y",inlineReversed:e,blockReversed:!1,rtl:e}}}function k(n,t){return n==="inline"?t.inline:t.block}function O(n,t){return n==="inline"?t.inlineReversed:t.blockReversed}function P(n,t){return t.inline===n?t.inlineReversed:t.blockReversed}function st(n,t,e){const i=k(t,e)==="x"?n.scrollLeft:n.scrollTop;return O(t,e)?Math.abs(i):i}function Ft(n,t,e,i,s="auto"){const o=O(t,i)?-e:e;k(t,i)==="x"?n.scrollTo({left:o,behavior:s}):n.scrollTo({top:o,behavior:s})}function Ot(n,t,e){return k(t,e)==="x"?n.clientWidth:n.clientHeight}function Mt(n,t,e){return k(t,e)==="x"?n.scrollWidth:n.scrollHeight}function nt(n,t,e,i){return e==="x"?i?t.right-n.right:n.left-t.left:i?t.bottom-n.bottom:n.top-t.top}function j(n,t,e){return{inlineStart:nt(n,t,e.inline,e.inlineReversed),blockStart:nt(n,t,e.block,e.blockReversed),inlineSize:e.inline==="x"?n.width:n.height,blockSize:e.block==="x"?n.width:n.height}}function q(n,t){const e=t.inlineReversed?-n.inline:n.inline,i=t.blockReversed?-n.block:n.block;return t.inline==="x"?{x:e,y:i}:{x:i,y:e}}function ot(n,t,e){const i=k(t,e)==="x"?n.dx:n.dy;return O(t,e)?-i:i}function B(n,t){const e=P("x",t),i=P("y",t),s=e?"ArrowLeft":"ArrowRight",o=e?"ArrowRight":"ArrowLeft",r=i?"ArrowUp":"ArrowDown",a=i?"ArrowDown":"ArrowUp";return n==="horizontal"?{next:s,prev:o,openFirst:r,openLast:a}:{next:r,prev:a,openFirst:s,openLast:o}}function zt(n){return B(n.inline==="x"?"horizontal":"vertical",n)}function D(n,t){return k(n==="horizontal"?"inline":"block",t)==="x"?"horizontal":"vertical"}function It(n,t){return n==="horizontal"==(t.inline==="x")?"horizontal":"vertical"}class $t extends N.AsyncDirective{constructor(t){if(super(t),this._options={},t.type!==it.PartType.ELEMENT)throw new Error("The `keyNavigation` directive must be used on an element.")}get navigationAxis(){const t=this._element?.deref();return this._resolveAxis(t,t?y(t):H)}_resolveAxis(t,e){if(this._options.navigationAxis)return D(this._options.navigationAxis,e);const i=t?.getAttribute("aria-orientation"),s=i==="horizontal"||i==="vertical"?i:null;switch(t?.role){case"slider":case"tablist":case"toolbar":case"menubar":return s??D("horizontal",e);case"separator":return s?s==="vertical"?"horizontal":"vertical":D("vertical",e);default:return s??D("vertical",e)}}_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 e=this._normalizeKey(t.key),i=this._element?.deref(),s=i?y(i):H,{next:o,prev:r,openFirst:a,openLast:h}=B(this._resolveAxis(i,s),s);let l;this._options.handleNavAxis!==!1&&(e===o?l=t.shiftKey?"next-large":"next":e===r?l=t.shiftKey?"prev-large":"prev":e==="Home"?l="start":e==="End"&&(l="end")),!l&&this._options.handleOpenAxis&&(e===a?l="open-to-first":e===h&&(l="open-to-last")),l||(e==="Enter"?l=this._options.handleActivate?"activate":"toggle":e===" "&&this._options.handleActivate?l="activate":e==="Escape"&&this._options.handleEscape&&(l="escape")),l!=null&&(this._callback(l),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,e){return L.nothing}update(t,[e,i]){this.isConnected&&this._element?.deref()===void 0&&(this._element=new WeakRef(t.element),this._init()),this._callback=e.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 Nt=N.directive($t);class M{constructor(){this._cleanups=[],this._attributes=new WeakMap,this._styles=new WeakMap,this._disposed=!1}add(t){if(this._disposed){t();return}this._cleanups.push(t)}listen(t,e,i,s){this._disposed||(t.addEventListener(e,i,s),this.add(()=>t.removeEventListener(e,i,s)))}append(t,e){this._disposed||(t.appendChild(e),this.add(()=>{e.parentNode===t&&t.removeChild(e)}))}setAttribute(t,e,i){if(this._disposed)return;let s=this._attributes.get(t);s||(s=new Map,this._attributes.set(t,s));let o=s.get(e);o||(o={written:i,previous:t.getAttribute(e)},s.set(e,o),this.add(()=>{t.getAttribute(e)===o?.written&&(o.previous===null?t.removeAttribute(e):t.setAttribute(e,o.previous))})),o.written=i,t.setAttribute(e,i)}setStyle(t,e,i,s=""){if(this._disposed)return;let o=this._styles.get(t);o||(o=new Map,this._styles.set(t,o));let r=o.get(e);r||(r={written:i,writtenPriority:s,previous:t.style.getPropertyValue(e),previousPriority:t.style.getPropertyPriority(e)},o.set(e,r),this.add(()=>{t.style.getPropertyValue(e)!==r?.written||t.style.getPropertyPriority(e)!==r.writtenPriority||(r.previous?t.style.setProperty(e,r.previous,r.previousPriority):t.style.removeProperty(e))})),r.written=i,r.writtenPriority=s,t.style.setProperty(e,i,s)}dispose(){if(!this._disposed){this._disposed=!0;for(const t of this._cleanups.reverse())t();this._cleanups.length=0}}abandon(){this._disposed=!0,this._cleanups.length=0}}function g(n){const t=n.currentCSSZoom;if(t&&Number.isFinite(t))return t;let e=1,i=n;for(;i;){const s=Number.parseFloat(getComputedStyle(i).zoom);Number.isFinite(s)&&s>0&&(e*=s);const o=i.getRootNode();i=i.parentElement??(o instanceof ShadowRoot?o.host:null)}return e}class z{constructor(t,e){this._$target=null,this._$captureTarget=null,this._pointerId=null,this._startX=0,this._startY=0,this._startTime=0,this._samples=[],this._activated=!1,this._rejected=!1,this._lastEvent=null,this._boundCapture=!1,this._disposed=!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._lastEvent=i,this._samples=[{x:i.clientX,y:i.clientY,time:i.timeStamp}],this._activated=!1,this._rejected=!1;const s=this._$target;if(!s)return;const o=i.composedPath()[0];this._$captureTarget=i.pointerType==="mouse"||!(o instanceof Element)?s:o,s.addEventListener("pointermove",this._onPointerMove),s.addEventListener("pointerup",this._onPointerUp),s.addEventListener("pointercancel",this._onPointerCancel),this._$captureTarget.addEventListener("lostpointercapture",this._onLostPointerCapture);const r=s.ownerDocument;r.addEventListener("lostpointercapture",this._onLostPointerCapture),r.addEventListener("pointerup",this._onDocumentPointerUp),r.addEventListener("pointercancel",this._onPointerCancel),this._options.activation==="immediate"?this._activate(i):this._options.activation==="press"&&this._startPress(s)},this._onTouchMove=i=>{this._activated&&i.cancelable&&i.preventDefault()},this._onContextMenu=i=>{this._activated?i.preventDefault():this._finish()},this._onPointerMove=i=>{i.pointerId!==this._pointerId||this._rejected||(this._recordSample(i),this._lastEvent=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._lastEvent=i,this._activated&&this._options.onEnd?.(this._detail(i)),this._finish())},this._onPointerCancel=i=>{this._cancel(i)},this._onDocumentPointerUp=i=>{if(i.pointerId===this._pointerId){if(this._$captureTarget&&!this._$captureTarget.isConnected){this._cancel(i);return}this._onPointerUp(i)}},this._onLostPointerCapture=i=>{i instanceof PointerEvent&&i.pointerId===this._pointerId&&(i.composedPath()[0]===this._$captureTarget||!this._$captureTarget?.isConnected)&&this._cancel(i)},this._host=t,this._options={axis:"both",activation:"immediate",activationDistance:8,pressDelay:400,axisLockRatio:1.25,velocityWindow:100,minVelocityDuration:8,capture:!1,stopPropagation:!1,preventDefault:!0,focusOnStart:!1,...e},t.addController(this)}setOptions(t){this._disposed||(this._pointerId!==null&&this._lastEvent&&this._cancel(this._lastEvent),Object.assign(this._options,t),this._bindTarget())}hostConnected(){this._disposed||this._bindTarget()}hostUpdated(){this._disposed||this._bindTarget()}hostDisconnected(){this._unbindTarget()}dispose(){this._disposed||(this._disposed=!0,this._unbindTarget(),this._host.removeController(this))}_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._boundCapture===this._options.capture||(this._unbindTarget(),this._$target=t,this._boundCapture=this._options.capture,this._$target?.addEventListener("pointerdown",this._onPointerDown,{capture:this._boundCapture}))}_unbindTarget(){this._$target&&(this._pointerId!==null&&this._lastEvent&&this._cancel(this._lastEvent),this._$target.removeEventListener("pointerdown",this._onPointerDown,{capture:this._boundCapture}),this._$target=null)}_startPress(t){t.addEventListener("touchmove",this._onTouchMove,{passive:!1}),t.addEventListener("contextmenu",this._onContextMenu),this._pressTimer=setTimeout(()=>{this._pressTimer=void 0,this._lastEvent&&!this._rejected&&this._activate(this._lastEvent)},this._options.pressDelay)}_resolveIntent(t){const e=t.clientX-this._startX,i=t.clientY-this._startY;if(Math.hypot(e,i)<this._options.activationDistance)return!1;if(this._options.activation==="press")return this._rejected=!0,this._finish(),!1;const{axis:o,axisLockRatio:r}=this._options,a=Math.abs(e),h=Math.abs(i);return o==="x"&&a<h*r||o==="y"&&h<a*r?(this._rejected=!0,this._finish(),!1):(this._activate(t),!0)}_activate(t){const e=this._$target;if(!e||this._activated)return;this._activated=!0;const i=this._$captureTarget??e;i.hasPointerCapture(t.pointerId)||this._capturePointer(i,t.pointerId),this._options.focusOnStart&&e.focus(),this._options.stopPropagation&&t.stopPropagation(),this._options.preventDefault&&t.preventDefault(),this._options.onStart?.(this._detail(t))}_cancel(t){if(t.pointerId===this._pointerId){if(this._activated){this._activated=!1;try{this._options.onCancel?.(this._detail(t))}finally{this._finish()}return}this._finish()}}_finish(){const t=this._$target,e=this._$captureTarget,i=this._pointerId;t&&this._removeCycleListeners(t),e&&i!==null&&this._releasePointer(e,i),this._reset()}_removeCycleListeners(t){clearTimeout(this._pressTimer),this._pressTimer=void 0,t.removeEventListener("touchmove",this._onTouchMove),t.removeEventListener("contextmenu",this._onContextMenu),t.removeEventListener("pointermove",this._onPointerMove),t.removeEventListener("pointerup",this._onPointerUp),t.removeEventListener("pointercancel",this._onPointerCancel),this._$captureTarget?.removeEventListener("lostpointercapture",this._onLostPointerCapture);const e=t.ownerDocument;e.removeEventListener("lostpointercapture",this._onLostPointerCapture),e.removeEventListener("pointerup",this._onDocumentPointerUp),e.removeEventListener("pointercancel",this._onPointerCancel)}_recordSample(t){this._samples.push({x:t.clientX,y:t.clientY,time:t.timeStamp});const e=t.timeStamp-this._options.velocityWindow;for(;this._samples.length>2&&this._samples[0].time<e;)this._samples.shift()}_detail(t){const e=this._samples[0],i=this._samples.at(-1)??e,s=i.time-e.time,o=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:o?(i.x-e.x)/s*1e3:0,velocityY:o?(i.y-e.y)/s*1e3:0}}_capturePointer(t,e){try{t.setPointerCapture(e)}catch(i){if(!(i instanceof DOMException)||i.name!=="NotFoundError")throw i}}_releasePointer(t,e){try{t.hasPointerCapture(e)&&t.releasePointerCapture(e)}catch{}}_reset(){this._pointerId=null,this._$captureTarget=null,this._lastEvent=null,this._samples=[],this._activated=!1,this._rejected=!1}}class Ht{constructor(t,e){this._dragging=!1,this._startLeft=0,this._startTop=0,this._zoom=1,this._handleEffects=new Map,this._connected=!1,this._disposed=!1,this._host=t,this._opts={axis:"both",step:4,disabled:!1,handle:null,bounds:"viewport",...e},this._onKeyDown=this._handleKeyDown.bind(this),this._gesture=new z(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){if(this._disposed)return;const e=this._handle();Object.assign(this._opts,t),this._gesture.setOptions({axis:this._opts.axis,target:()=>this._handle()});const i=this._handle();this._connected&&e!==i&&(this._detachFrom(e),this._attachTo(i))}hostConnected(){this._disposed||this._connected||(this._connected=!0,this._attachTo(this._handle()))}hostDisconnected(){this._connected=!1,this._detachFrom(this._handle())}dispose(){this._disposed||(this._disposed=!0,this._gesture.dispose(),this.hostDisconnected(),this._host.removeController(this))}_handle(){return this._opts.handle??this._opts.target}_target(){return this._opts.target}_attachTo(t){if(this._handleEffects.has(t))return;const e=new M;e.listen(t,"keydown",this._onKeyDown),t.hasAttribute("tabindex")||e.setAttribute(t,"tabindex","0"),this._handleEffects.set(t,e)}_detachFrom(t){this._handleEffects.get(t)?.dispose(),this._handleEffects.delete(t)}_canStartGesture(t){return this._opts.disabled?!1:!t.target.closest('button, [role="button"], a')}_startDrag(t){const e=this._target(),i=e.getBoundingClientRect();this._zoom=g(e),getComputedStyle(e).position==="static"&&(e.style.position="fixed"),e.style.translate="none",e.style.inset="auto",e.style.margin="0",this._startLeft=i.left/this._zoom,this._startTop=i.top/this._zoom,e.style.left=`${this._startLeft}px`,e.style.top=`${this._startTop}px`,this._dragging=!0}_moveDrag(t){if(!this._dragging)return;const e=this._target(),{axis:i}=this._opts,s=this._zoom,[o,r,a,h]=this._boundsRect().map(f=>f/s),{width:l,height:_}=e.getBoundingClientRect(),u=i!=="y"?Math.min(Math.max(this._startLeft+t.deltaX/s,o),a-l/s):parseFloat(e.style.left)||0,d=i!=="x"?Math.min(Math.max(this._startTop+t.deltaY/s,r),h-_/s):parseFloat(e.style.top)||0;e.style.left=`${u}px`,e.style.top=`${d}px`}_finishDrag(){this._dragging&&(this._dragging=!1)}_handleKeyDown(t){if(this._opts.disabled||t.currentTarget!==t.target)return;const{axis:e}=this._opts,i=t.shiftKey?this._opts.step*10:this._opts.step;let s=0,o=0;switch(t.key){case"ArrowLeft":if(e==="y")return;s=-i;break;case"ArrowRight":if(e==="y")return;s=i;break;case"ArrowUp":if(e==="x")return;o=-i;break;case"ArrowDown":if(e==="x")return;o=i;break;default:return}const r=this._target(),a=g(r),h=r.getBoundingClientRect();getComputedStyle(r).position==="static"&&(r.style.position="fixed",r.style.translate="none",r.style.left=`${h.left/a}px`,r.style.top=`${h.top/a}px`);const[l,_,u,d]=this._boundsRect().map(w=>w/a),f=parseFloat(r.style.left)||0,p=parseFloat(r.style.top)||0,m=u-h.width/a,v=d-h.height/a;r.style.left=`${Math.min(Math.max(f+s,l),m)}px`,r.style.top=`${Math.min(Math.max(p+o,_),v)}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 e=t.getBoundingClientRect();return[e.left,e.top,e.right,e.bottom]}}const G=new Set,Z=new Map;function rt(n,t){let e=t;for(;;){if(n.contains(e))return!0;const i=e.getRootNode();if(i.nodeType!==11)return!1;e=i.host}}function Bt(n,t){return rt(t,n)||rt(n,t)}function Wt(n,t){if(!t)return!0;const e=t().filter(i=>!!i);return n.some(({target:i})=>e.some(s=>Bt(i,s)))}function Vt(n,t,e){let i=Z.get(n);if(!i){const s=new Map,o=new MutationObserver(r=>{for(const[a,h]of Array.from(s))Wt(r,h)&&a()});o.observe(n.nodeType===9?n.documentElement:n,{attributes:!0,attributeFilter:["dir","lang"],subtree:!0}),i={observer:o,listeners:s},Z.set(n,i)}return i.listeners.set(t,e),()=>{i.listeners.delete(t),i.listeners.size===0&&(i.observer.disconnect(),Z.delete(n))}}function R(n,t,e=t?()=>[t]:void 0){const i=()=>n(),s=[],o=new Set;if(G.add(i),typeof MutationObserver=="function"){const r=t?.ownerDocument??(typeof document>"u"?null:document);if(r){o.add(r);for(const a of[t,...e?.()??[]]){if(!a)continue;o.add(a.ownerDocument),a.shadowRoot&&o.add(a.shadowRoot);let h=a.getRootNode();for(;h.nodeType===11&&"host"in h;){const l=h;o.add(l),h=l.host.getRootNode()}}for(const a of o)s.push(Vt(a,i,e))}}return()=>{G.delete(i),s.forEach(r=>r())}}function at(){for(const n of Array.from(G))n()}const J=new Map;let ht=0;function Yt(n,t){const e=n.toLowerCase(),i={...J.get(e)};for(const[s,o]of Object.entries(t))i[s]={...i[s],...o};J.set(e,i),ht+=1,at()}function b(n){return n.getAttribute("lang")??n.ownerDocument.documentElement.lang??""}function Xt(n){return`${n}`}function Kt(n){const t=n.toLowerCase().split("-").filter(Boolean);return t.map((e,i)=>t.slice(0,i+1).join("-"))}function W(n,t,e,i,s={}){const o={...e},r=new Set(Object.keys(e));for(const a of Kt(b(n))){const h=J.get(a);s.inherit&&Q(o,h?.[s.inherit],r),Q(o,h?.[t])}return Q(o,i),o}function Q(n,t,e){if(t)for(const[i,s]of Object.entries(t))s!==void 0&&(!e||e.has(i))&&(n[i]=s)}class lt{constructor(t,e={}){this._unobserveLocale=null,this._key="",this._host=t,this._onChange=e.onChange,t.addController(this)}get locale(){return this._key=this._currentKey(),b(this._host)||void 0}hostConnected(){this._unobserveLocale??=R(()=>{const t=this._currentKey();this._key!==t&&(this._key=t,this._onChange?this._onChange():this._host.requestUpdate())},this._host)}hostDisconnected(){this._unobserveLocale?.(),this._unobserveLocale=null}_currentKey(){return`${b(this._host)}|${ht}`}}class Ut extends lt{constructor(t,e,i,s={}){super(t,s),this._scope=e,this._defaults=i,this._overrides=s.overrides,this._inherit=s.inherit}get value(){return this.locale,W(this._host,this._scope,this._defaults,this._overrides?.(),{inherit:this._inherit})}}function jt(n,t,e,i){const s=n.getAttribute(t);return s!==null&&s!==i?null:(s!==e&&n.setAttribute(t,e),e)}const ct=Object.freeze({grip:"Resize"});function _t(n){const t=n.getBoundingClientRect(),e=n.offsetParent,i=g(n),s=e?(t.left-e.getBoundingClientRect().left)/i-e.clientLeft+e.scrollLeft:t.left/i,o=e?(t.top-e.getBoundingClientRect().top)/i-e.clientTop+e.scrollTop:t.top/i;return getComputedStyle(n).position==="static"&&(n.style.position="fixed"),n.style.translate="none",n.style.inset="auto",n.style.margin="0",n.style.boxSizing="border-box",n.style.left=`${s}px`,n.style.top=`${o}px`,n.style.width=`${t.width/i}px`,n.style.height=`${t.height/i}px`,t}class qt{constructor(t,e){this._resizing=null,this._startW=0,this._startH=0,this._startLeft=0,this._startTop=0,this._zoom=1,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._handleEffects=new Map,this._targetEffects=null,this._positionEffects=null,this._flowEffects=null,this._connected=!1,this._disposed=!1,this._onFlowInteraction=()=>this._syncFlowStyles(),this._host=t,this._opts={direction:"none",threshold:8,step:4,disabled:!1,minWidth:100,minHeight:60,handle:null,origin:"",bounds:"viewport",...e},this._onPointerMove=this._handlePointerMove.bind(this),this._onPointerLeave=this._handlePointerLeave.bind(this),this._onKeyDown=this._handleKeyDown.bind(this),this._gesture=new z(t,{target:()=>this._handle()??this._target(),activation:"axis",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){if(this._disposed)return;const e=this._opts.target,i=this._opts.handle,s=this._opts.direction!=="none",o=this._connected,r=t.target!==void 0&&t.target!==e||t.handle!==void 0&&t.handle!==i||t.direction!==void 0&&t.direction!=="none"!==s;o&&r&&this.hostDisconnected(),Object.assign(this._opts,t),this._gesture.setOptions({target:()=>this._handle()??this._target()}),o&&r?this.hostConnected():o&&this._syncFlowStyles()}hostConnected(){if(this._disposed||this._connected||(this._connected=!0,this._opts.direction==="none"))return;if(this._observeFlow(),this._opts.handle){this._attachToHandle(this._opts.handle);return}const t=this._target();this._targetEffects=new M,this._targetEffects.listen(t,"pointermove",this._onPointerMove),this._targetEffects.listen(t,"pointerleave",this._onPointerLeave),this._injectCornerButton()}hostDisconnected(){this._connected=!1,this._unobserveFlow(),this._opts.handle&&this._detachFromHandle(this._opts.handle),this._removeCornerButton(),this._targetEffects?.dispose(),this._targetEffects=null,this._positionEffects?.dispose(),this._positionEffects=null}dispose(){this._disposed||(this._disposed=!0,this._gesture.dispose(),this._cancelResize(),this.hostDisconnected(),this._host.removeController(this))}_target(){return this._opts.target}_handle(){return this._opts.handle}_attachToHandle(t){if(!t||this._opts.direction==="none"||this._handleEffects.has(t))return;const e=new M;e.listen(t,"keydown",this._onKeyDown),e.setStyle(t,"cursor",this._edgeCursor(this._handleEdge())),e.setStyle(t,"touch-action","none"),t.hasAttribute("tabindex")||e.setAttribute(t,"tabindex","0"),this._handleEffects.set(t,e)}_observeFlow(){if(this._flowEffects)return;const t=new M;t.add(R(this._onFlowInteraction,this._target())),t.listen(this._handle()??this._target(),"pointerenter",this._onFlowInteraction),this._flowEffects=t}_unobserveFlow(){this._flowEffects?.dispose(),this._flowEffects=null}_syncFlowStyles(){if(this._resizing)return;const t=this._handle();t&&this._handleEffects.get(t)?.setStyle(t,"cursor",this._edgeCursor(this._handleEdge())),this._cornerBtn&&(this._placeCornerButton(this._cornerBtn),this._labelCornerButton(this._cornerBtn))}_detachFromHandle(t){t&&(this._handleEffects.get(t)?.dispose(),this._handleEffects.delete(t))}_injectCornerButton(){if(this._opts.handle)return;const t=this._target();getComputedStyle(t).position==="static"&&(this._positionEffects=new M,this._positionEffects.setStyle(t,"position","relative"));const e=document.createElement("button");e.setAttribute("data-rc-resize-corner",""),e.type="button",Object.assign(e.style,{position:"absolute",width:"12px",height:"12px",padding:"0",border:"none",background:"transparent",zIndex:"1"}),this._placeCornerButton(e),this._labelCornerButton(e),e.addEventListener("keydown",this._onKeyDown),e.addEventListener("focus",this._onFlowInteraction),this._targetEffects?.append(t,e),this._cornerBtn=e}_placeCornerButton(t){const{x:e,y:i}=this._endEdges();Object.assign(t.style,{top:i==="n"?"0":"",bottom:i==="s"?"0":"",left:e==="w"?"0":"",right:e==="e"?"0":"",cursor:this._cornerCursor()})}_labelCornerButton(t){const{grip:e}=W(this._target(),"resize",ct,this._opts.messages);t.getAttribute("aria-label")!==e&&t.setAttribute("aria-label",e)}_removeCornerButton(){this._cornerBtn&&(this._cornerBtn.removeEventListener("keydown",this._onKeyDown),this._cornerBtn.removeEventListener("focus",this._onFlowInteraction),this._cornerBtn.remove(),this._cornerBtn=null)}_cornerCursor(){switch(this._opts.direction){case"both":return`${this._defaultHandleEdge()}-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()}_endEdges(){const t=y(this._target());return{x:P("x",t)?"w":"e",y:P("y",t)?"n":"s"}}_defaultHandleEdge(){const{x:t,y:e}=this._endEdges();switch(this._opts.direction){case"horizontal":return t;case"vertical":return e;default:return`${e}${t}`}}_edgeForOrigin(t){if(!t)return null;const e=t.includes("top"),i=t.includes("bottom"),s=t.includes("left"),o=t.includes("right");if(this._opts.direction==="vertical")return e?"n":i?"s":null;if(this._opts.direction==="horizontal")return s?"w":o?"e":null;if(this._opts.direction==="both"){if(e&&s)return"nw";if(e&&o)return"ne";if(i&&s)return"sw";if(i&&o)return"se";if(e)return"n";if(i)return"s";if(s)return"w";if(o)return"e"}return null}_edgeAllowsPointer(t,e){const{threshold:i}=this._opts,s=this._target().getBoundingClientRect(),o=e.clientX,r=e.clientY,a=o>=s.right-i&&o<=s.right+i,h=o>=s.left-i&&o<=s.left+i,l=r>=s.bottom-i&&r<=s.bottom+i,_=r>=s.top-i&&r<=s.top+i,u=o>=s.left&&o<=s.right,d=r>=s.top&&r<=s.bottom;switch(t){case"n":return _&&u;case"s":return l&&u;case"e":return a&&d;case"w":return h&&d;case"ne":return _&&a;case"nw":return _&&h;case"se":return l&&a;case"sw":return l&&h}}_detectEdge(t){const{direction:e,threshold:i}=this._opts;if(e==="none")return null;const s=this._edgeForOrigin(this._opts.origin);if(s)return this._edgeAllowsPointer(s,t)?s:null;const o=this._target().getBoundingClientRect(),r=t.clientX,a=t.clientY,h=r>=o.right-i&&r<=o.right+i,l=r>=o.left-i&&r<=o.left+i,_=a>=o.bottom-i&&a<=o.bottom+i,u=a>=o.top-i&&a<=o.top+i,d=r>=o.left&&r<=o.right,f=a>=o.top&&a<=o.bottom;if(e==="both"){if(h&&_)return"se";if(l&&_)return"sw";if(h&&u)return"ne";if(l&&u)return"nw";if(h&&f)return"e";if(l&&f)return"w";if(_&&d)return"s";if(u&&d)return"n"}if(e==="horizontal"){if(h&&f)return"e";if(l&&f)return"w"}if(e==="vertical"){if(_&&d)return"s";if(u&&d)return"n"}return null}_pinPosition(t){return _t(t)}_canStartGesture(t){if(this._opts.disabled||this._opts.direction==="none")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/this._zoom,t.deltaY/this._zoom),this._opts.onResize?.(this._lifecycleDetail("pointer")))}_endGestureResize(t){this._velocityX=t.velocityX,this._velocityY=t.velocityY,this._finishResize("pointer")}_startResize(t){this._positionEffects?.abandon(),this._positionEffects=null;const e=this._target();this._pinPosition(e),this._zoom=g(e),this._startW=Number.parseFloat(e.style.width),this._startH=Number.parseFloat(e.style.height),this._startLeft=Number.parseFloat(e.style.left),this._startTop=Number.parseFloat(e.style.top),this._lastDeltaX=0,this._lastDeltaY=0,this._resizing=t,this._computeEffectiveExtents(e),this._opts.onResizeStart?.(this._lifecycleDetail("pointer"))}_computeEffectiveExtents(t){const e=getComputedStyle(t);this._effectiveMinW=Math.max(this._opts.minWidth,parseFloat(e.minWidth)||0),this._effectiveMinH=Math.max(this._opts.minHeight,parseFloat(e.minHeight)||0),this._effectiveMaxW=Math.min(this._opts.maxWidth??1/0,parseFloat(e.maxWidth)||1/0),this._effectiveMaxH=Math.min(this._opts.maxHeight??1/0,parseFloat(e.maxHeight)||1/0)}_lifecycleDetail(t){const e=this._target();return{edge:this._resizing??this._handleEdge(),inputType:t,startWidth:this._startW*this._zoom,startHeight:this._startH*this._zoom,width:e.getBoundingClientRect().width,height:e.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 e=this._detectEdge(t),i=this._target();this._targetEffects?.setStyle(i,"cursor",e?this._edgeCursor(e):"")}_finishResize(t){if(!this._resizing)return;const e=this._lifecycleDetail(t);this._resizing=null,this._pendingEdge=null,this._opts.onResizeEnd?.(e)}_cancelResize(){this._resizing=null,this._pendingEdge=null}_handlePointerLeave(t){this._resizing||this._targetEffects?.setStyle(this._target(),"cursor","")}_handleKeyDown(t){if(this._opts.disabled||this._opts.direction==="none")return;const{direction:e}=this._opts,i=t.key==="ArrowRight"||t.key==="ArrowLeft",s=t.key==="ArrowDown"||t.key==="ArrowUp";if(i&&e==="vertical"||s&&e==="horizontal"||!i&&!s)return;t.preventDefault(),t.stopPropagation();const o=this._target();this._positionEffects?.abandon(),this._positionEffects=null,this._pinPosition(o);const r=this._keyboardEdge(t.key);if(!r)return;this._resizing=r,this._zoom=g(o),this._startW=Number.parseFloat(o.style.width),this._startH=Number.parseFloat(o.style.height),this._startLeft=Number.parseFloat(o.style.left),this._startTop=Number.parseFloat(o.style.top);const a=t.shiftKey?this._opts.step*10:this._opts.step;this._computeEffectiveExtents(o);const h=t.key==="ArrowRight"?a:t.key==="ArrowLeft"?-a:0,l=t.key==="ArrowDown"?a:t.key==="ArrowUp"?-a:0;this._lastDeltaX=h,this._lastDeltaY=l,this._applyDelta(r,h,l),this._opts.onResize?.(this._lifecycleDetail("keyboard")),this._finishResize("keyboard")}_keyboardEdge(t){const e=this._edgeForOrigin(this._opts.origin);if(e)return e;const{x:i,y:s}=this._endEdges();return t==="ArrowRight"||t==="ArrowLeft"?this._opts.direction==="both"||this._opts.direction==="horizontal"?i:null:(t==="ArrowDown"||t==="ArrowUp")&&(this._opts.direction==="both"||this._opts.direction==="vertical")?s:null}_applyDelta(t,e,i){const s=this._target(),[o,r,a,h]=this._boundsRect().map(f=>f/this._zoom),l=this._effectiveMinW,_=this._effectiveMinH,u=this._effectiveMaxW,d=this._effectiveMaxH;if(t==="e"||t==="se"||t==="ne"){const f=Math.min(u,a-this._startLeft);s.style.width=`${Math.min(Math.max(this._startW+e,l),f)}px`}if(t==="w"||t==="sw"||t==="nw"){const f=this._startLeft+this._startW,p=Math.min(Math.max(this._startLeft+e,o,f-u),f-l);s.style.left=`${p}px`,s.style.width=`${f-p}px`}if(t==="s"||t==="se"||t==="sw"){const f=Math.min(d,h-this._startTop);s.style.height=`${Math.min(Math.max(this._startH+i,_),f)}px`}if(t==="n"||t==="ne"||t==="nw"){const f=this._startTop+this._startH,p=Math.min(Math.max(this._startTop+i,r,f-d),f-_);s.style.top=`${p}px`,s.style.height=`${f-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 e=t.getBoundingClientRect();return[e.left,e.top,e.right,e.bottom]}}function Gt(n,t){const[,e,i,s]=/^(block|inline)-(start|end)(?:-(start|end))?$/.exec(n)??["","block","end","start"],o=e==="inline"?t.inline:t.block,r=e==="inline"?t.inlineReversed:t.blockReversed,a=i==="end"!==r,h=o==="x"?a?"right":"left":a?"bottom":"top",l=s;if(!l)return h;const u=P(h==="top"||h==="bottom"?"x":"y",t)?l==="start"?"end":"start":l;return`${h}-${u}`}const I=new Map,C=new WeakMap;let F=0;function ut(n){queueMicrotask(()=>{throw n})}function Zt(){F||(F=requestAnimationFrame(n=>{F=0;const t=[...I.values()],e=new Map;I.clear();for(const i of t)if(!(!i.active||C.get(i.scheduler)!==i))try{e.set(i,i.sample(n))}catch(s){dt(i),ut(s)}for(const i of t){if(!e.has(i)||!i.active||C.get(i.scheduler)!==i)continue;const s=e.get(i);dt(i);try{i.apply(s,n)}catch(o){ut(o)}}}))}function dt(n){C.get(n.scheduler)===n&&(n.active=!1,C.delete(n.scheduler))}class V{constructor(t){this._callback=null,this._frame=0,t?.addController(this)}get pending(){return this._frame!==0||C.has(this)}schedule(t){this._cancelPhased(),this._callback=t,!this._frame&&(this._frame=requestAnimationFrame(e=>{const i=this._callback;this._frame=0,this._callback=null,i?.(e)}))}schedulePhased(t,e){this._frame&&(cancelAnimationFrame(this._frame),this._frame=0,this._callback=null),this._cancelPhased();const i={scheduler:this,sample:t,apply:e,active:!0};C.set(this,i),I.set(this,i),Zt()}cancel(){this._frame&&(cancelAnimationFrame(this._frame),this._frame=0,this._callback=null),this._cancelPhased()}hostDisconnected(){this.cancel()}_cancelPhased(){const t=C.get(this);t&&(t.active=!1,C.delete(this),I.delete(this),F&&I.size===0&&(cancelAnimationFrame(F),F=0))}}function tt(n){const t=n.visualViewport,e=t?.offsetLeft??0,i=t?.offsetTop??0,s=t?.width??n.innerWidth,o=t?.height??n.innerHeight;return{left:e,top:i,width:s,height:o,right:e+s,bottom:i+o}}function Y(n,t){const e=`${t}px`;switch(n){case"top":return`position-area: top; margin-bottom: ${e};`;case"top-start":return`bottom: anchor(top); top: auto; left: anchor(left); right: auto; margin-bottom: ${e};`;case"top-end":return`bottom: anchor(top); top: auto; left: auto; right: anchor(right); margin-bottom: ${e};`;case"bottom":return`position-area: bottom; margin-top: ${e};`;case"bottom-start":return`top: anchor(bottom); bottom: auto; left: anchor(left); right: auto; margin-top: ${e};`;case"bottom-end":return`top: anchor(bottom); bottom: auto; left: auto; right: anchor(right); margin-top: ${e};`;case"left":return`position-area: left; margin-right: ${e};`;case"left-start":return`top: anchor(top); bottom: auto; right: anchor(left); left: auto; margin-right: ${e};`;case"left-end":return`top: auto; bottom: anchor(bottom); right: anchor(left); left: auto; margin-right: ${e};`;case"right":return`position-area: right; margin-left: ${e};`;case"right-start":return`top: anchor(top); bottom: auto; left: anchor(right); right: auto; margin-left: ${e};`;case"right-end":return`top: auto; bottom: anchor(bottom); left: anchor(right); right: auto; margin-left: ${e};`}}const ft={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"},Jt={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"},Qt=typeof CSS<"u"&&CSS.supports("position-try-fallbacks: flip-block")&&CSS.supports("min-width: anchor-size(width)");let te=0;class ee{constructor(t,e){this._styleEl=null,this._adoptedSheet=null,this._connected=!1,this._clampScheduler=new V,this._clampLoopActive=!1,this._settleFramesRemaining=0,this._stableFrames=0,this._lastNaturalRect="",this._appliedTranslateXCssPx=0,this._appliedTranslateYCssPx=0,this._geometryAbort=null,this._resizeObserver=null,this._intersectionObserver=null,this._mutationObserver=null,this._unobserveLocale=null,this._$observedAnchor=null,this._$observedFloating=null,this._handleGeometryChange=()=>{this._scheduleClamp()},this._handlePositionChange=()=>{!this._usesNativeAnchor()&&this._connected&&!this._disabled()&&this._positionFallback(),this._scheduleClamp()},this._handleDirectionChange=()=>{this._applyAndPosition()},this._host=t,this._opts=e,this._uid=`rc-anchor-${++te}`,t.addController(this)}setOptions(t){Object.assign(this._opts,t),this._applyAndPosition()}update(){this._applyAndPosition()}hostConnected(){this._connected=!0;const t=this._host,e=typeof t.getRootNode=="function"?t:this._anchor();this._unobserveLocale??=R(this._handleDirectionChange,e??void 0,()=>[e,this._anchor()]),this._applyAndPosition()}hostDisconnected(){this._connected=!1,this._unobserveLocale?.(),this._unobserveLocale=null,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}_disabled(){const{disabled:t}=this._opts;return typeof t=="function"?t():t??!1}_usesNativeAnchor(){return Qt}_applyAndPosition(){!this._connected||!this._apply()||(this._usesNativeAnchor()||this._positionFallback(),this._startWatchingGeometry(),this._scheduleClamp())}_scheduleClamp(){!this._connected||this._disabled()||(this._clampLoopActive||(this._clampLoopActive=!0),this._settleFramesRemaining=10,this._stableFrames=0,this._lastNaturalRect="",this._clampScheduler.schedule(()=>this._runClampTick()))}_runClampTick(){if(!this._connected||this._disabled()){this._stopClampLoop();return}const t=this._floating();if(!t){this._stopClampLoop();return}const e=t.getBoundingClientRect(),i=g(t);if(!(e.width>0||e.height>0)){this._stopClampLoop(),this._stopWatchingGeometry();return}const o=[e.left-this._appliedTranslateXCssPx*i,e.top-this._appliedTranslateYCssPx*i,e.width,e.height].map(r=>Math.round(r*4)/4).join(":");if(this._stableFrames=o===this._lastNaturalRect?this._stableFrames+1:0,this._lastNaturalRect=o,this._settleFramesRemaining-=1,this._clampToViewport(e),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(),e=this._floating();if(!t||!e){this._stopWatchingGeometry();return}if(this._geometryAbort&&this._$observedAnchor===t&&this._$observedFloating===e)return;this._stopWatchingGeometry(),this._$observedAnchor=t,this._$observedFloating=e,this._geometryAbort=new AbortController;const i=e.ownerDocument.defaultView,s={passive:!0,signal:this._geometryAbort.signal};e.ownerDocument.addEventListener("scroll",this._handlePositionChange,{...s,capture:!0}),i?.addEventListener("resize",this._handlePositionChange,s),i?.visualViewport?.addEventListener("resize",this._handlePositionChange,s),i?.visualViewport?.addEventListener("scroll",this._handlePositionChange,s),typeof ResizeObserver=="function"&&(this._resizeObserver=new ResizeObserver(this._handlePositionChange),this._resizeObserver.observe(t),this._resizeObserver.observe(e)),typeof IntersectionObserver=="function"&&(this._intersectionObserver=new IntersectionObserver(this._handlePositionChange,{threshold:[0,1]}),this._intersectionObserver.observe(e)),typeof MutationObserver=="function"&&(this._mutationObserver=new MutationObserver(this._handleGeometryChange),this._mutationObserver.observe(t,{attributes:!0,attributeFilter:["class","style","hidden","open"]}),this._mutationObserver.observe(e,{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 e=this._floating();if(!e)return;const i=4,s=t??e.getBoundingClientRect();if(s.width===0&&s.height===0)return;const o=e.ownerDocument.defaultView;if(!o)return;const r=tt(o),a=g(e),h=this._appliedTranslateXCssPx*a,l=this._appliedTranslateYCssPx*a,_=s.left-h,u=s.right-h,d=s.top-l,f=s.bottom-l;let p=0,m=0;u>r.right-i&&(p=r.right-i-u),_+p<r.left+i&&(p=r.left+i-_),f>r.bottom-i&&(m=r.bottom-i-f),d+m<r.top+i&&(m=r.top+i-d),this._appliedTranslateXCssPx=p/a,this._appliedTranslateYCssPx=m/a;const v=p||m?`${this._appliedTranslateXCssPx}px ${this._appliedTranslateYCssPx}px`:"",w=`${Math.max(0,r.width-i*2)/a}px`,E=`${Math.max(0,r.height-i*2)/a}px`;e.style.translate!==v&&(e.style.translate=v),e.style.getPropertyValue("--rc-anchor-viewport-inline-size")!==w&&e.style.setProperty("--rc-anchor-viewport-inline-size",w),e.style.getPropertyValue("--rc-anchor-viewport-block-size")!==E&&e.style.setProperty("--rc-anchor-viewport-block-size",E)}_physicalPlacement(t){return Gt(this._opts.placement??"block-end-start",y(t))}_apply(){if(this._disabled())return this._cleanup(),!1;const t=this._anchor(),e=this._floating();if(!t||!e)return this._stopClampLoop(),!1;const i=this._physicalPlacement(t),s=this._opts.offset??4,o=this._opts.flip??!0,r=`--${this._uid}`,a=this._uid;t.style.setProperty("anchor-name",r),e.setAttribute("data-rc-anchor",a);const h=ft[i],l=Jt[i],_=ft[l],u=o?`
|
|
2
|
+
@position-try --${a}-end { ${Y(l,s)} }
|
|
3
|
+
@position-try --${a}-flip { ${Y(h,s)} }
|
|
4
|
+
@position-try --${a}-both { ${Y(_,s)} }
|
|
5
|
+
`:"",d=o?`position-try-fallbacks: --${a}-end, --${a}-flip, --${a}-both;`:"",f=`
|
|
6
6
|
${u}
|
|
7
|
-
[data-rc-anchor="${
|
|
7
|
+
[data-rc-anchor="${a}"] {
|
|
8
8
|
position: fixed;
|
|
9
|
-
position-anchor: ${
|
|
9
|
+
position-anchor: ${r};
|
|
10
10
|
box-sizing: border-box;
|
|
11
11
|
min-width: anchor-size(width);
|
|
12
|
-
${
|
|
13
|
-
${
|
|
12
|
+
${Y(i,s)}
|
|
13
|
+
${d}
|
|
14
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=a.innerWidth,h=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 u=n.offsetWidth||c.width,f=n.offsetHeight||0,d=i.split("-")[0],p=i.endsWith("-start")?"start":i.endsWith("-end")?"end":"center";let g=d;if(d==="top"||d==="bottom"){const y=h-c.bottom,_=c.top;r&&(d==="bottom"&&y<f+s&&_>y?g="top":d==="top"&&_<f+s&&y>_&&(g="bottom")),g==="top"?n.style.bottom=`${h-c.top+s}px`:n.style.top=`${c.bottom+s}px`;let S=p==="end"?c.right-u:p==="start"?c.left:c.left+c.width/2-u/2;S=Math.max(l,Math.min(S,o-u-l)),n.style.left=`${S}px`}else{const y=o-c.right,_=c.left;r&&(d==="right"&&y<u+s&&_>y?g="left":d==="left"&&_<u+s&&y>_&&(g="right")),g==="left"?n.style.right=`${o-c.left+s}px`:n.style.left=`${c.right+s}px`;let S=p==="end"?c.bottom-f:p==="start"?c.top:c.top+c.height/2-f/2;S=Math.max(l,Math.min(S,h-f-l)),n.style.top=`${S}px`}}_cleanup(){this._stopClampLoop(),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=""),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 Qo{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 Jo{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 Zo{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 tl{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()}}class el{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 nl(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 Bn(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 Un(e,t){return e.querySelector(t)}function Vn(e,t){return Array.from(e.querySelectorAll(t))}function il(e,t){if(Vn(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 sl{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=Un(this._host,this._options.selector);return this._child=n,n||this._options.onMissing?.(this._host),n!==t&&this._options.onChange?.(n,t),n}}var rl=Object.defineProperty,ol=(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&&rl(t,n,s),s};function ll(e){class t extends e{constructor(){super(...arguments),this._items=[]}get items(){return this._items.map(i=>i.deref()).filter(i=>Bn(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 ol([Mo.state()],t.prototype,"_lastFocused"),t}function al(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 cl(e,t,n){return n===t?0:Math.min(Math.max((e-t)/(n-t),0),1)}function hl(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 ul(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 fl(e,t){return e.length===0?-1:t>0?e.length-1:0}var dl=Object.defineProperty,pl=Object.defineProperties,ml=Object.getOwnPropertyDescriptors,Xn=Object.getOwnPropertySymbols,gl=Object.prototype.hasOwnProperty,_l=Object.prototype.propertyIsEnumerable,Yn=(e,t,n)=>t in e?dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))gl.call(t,n)&&Yn(e,n,t[n]);if(Xn)for(var n of Xn(t))_l.call(t,n)&&Yn(e,n,t[n]);return e},J=(e,t)=>pl(e,ml(t)),P=(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 Ve=Math.min,Nt=Math.max,me=Math.round,ge=Math.floor,mt=e=>({x:e,y:e});function yl(e,t){return typeof e=="function"?e(t):e}function bl(e){return U({top:0,right:0,bottom:0,left:0},e)}function kl(e){return typeof e!="number"?bl(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 vl(e,t){return P(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}=yl(t,e),p=kl(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,S=yield r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating),x=(yield r.isElement==null?void 0:r.isElement(S))?(yield r.getScale==null?void 0:r.getScale(S))||{x:1,y:1}:{x:1,y:1},A=_e(r.convertOffsetParentRelativeRectToViewportRelativeRect?yield r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:S,strategy:a}):_);return{top:(y.top-A.top+p.top)/x.y,bottom:(A.bottom-y.bottom+p.bottom)/x.y,left:(y.left-A.left+p.left)/x.x,right:(A.right-y.right+p.right)/x.x}})}function ye(){return typeof window<"u"}function Ht(e){return qn(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=(qn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qn(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 Gn(e){return!ye()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof et(e).ShadowRoot}const Sl=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)&&!Sl.has(s)}const wl=new Set(["table","td","th"]);function Cl(e){return wl.has(Ht(e))}const xl=[":popover-open",":modal"];function be(e){return xl.some(t=>{try{return e.matches(t)}catch{return!1}})}const Ll=["transform","translate","scale","rotate","perspective"],Tl=["transform","translate","scale","rotate","perspective","filter"],Al=["paint","layout","strict","content"];function Xe(e){const t=Ye(),n=at(e)?ct(e):e;return Ll.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))||Al.some(i=>(n.contain||"").includes(i))}function El(e){let t=Ct(e);for(;_t(t)&&!Wt(t);){if(Xe(t))return t;if(be(t))return null;t=Ct(t)}return null}function Ye(){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||Gn(e)&&e.host||gt(e);return Gn(t)?t.host:t}function Kn(e){const t=Ct(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:_t(t)&&ie(t)?t:Kn(t)}function se(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Kn(e),r=s===((i=e.ownerDocument)==null?void 0:i.body),l=et(s);if(r){const c=qe(l);return t.concat(l,l.visualViewport||[],ie(s)?s:[],c&&n?se(c):[])}return t.concat(s,se(s,[],n))}function qe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Qn(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 Ge(e){return at(e)?e:e.contextElement}function Bt(e){const t=Ge(e);if(!_t(t))return mt(1);const n=t.getBoundingClientRect(),{width:i,height:s,$:r}=Qn(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 Ol=mt(0);function Jn(e){const t=et(e);return!Ye()||!t.visualViewport?Ol:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Dl(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==et(e)?!1:t}function Pt(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=Ge(e);let l=mt(1);t&&(i?at(i)&&(l=Bt(i)):l=Bt(e));const c=Dl(r,n,i)?Jn(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=qe(p);for(;g&&i&&d!==p;){const y=Bt(g),_=g.getBoundingClientRect(),S=ct(g),x=_.left+(g.clientLeft+parseFloat(S.paddingLeft))*y.x,A=_.top+(g.clientTop+parseFloat(S.paddingTop))*y.y;a*=y.x,o*=y.y,h*=y.x,u*=y.y,a+=x,o+=A,p=et(g),g=qe(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:Pt(gt(e)).left+n}function Zn(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 Il(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=Pt(i);o=Bt(i),h.x=d.x+i.clientLeft,h.y=d.y+i.clientTop}const f=l&&!u&&!r?Zn(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 Rl(e){return Array.from(e.getClientRects())}function Ml(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 ti=25;function Fl(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=Ye();(!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<=ti&&(r-=p)}else o<=ti&&(r+=o);return{width:r,height:l,x:c,y:a}}const jl=new Set(["absolute","fixed"]);function $l(e,t){const n=Pt(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 ei(e,t,n){let i;if(t==="viewport")i=Fl(e,n);else if(t==="document")i=Ml(gt(e));else if(at(t))i=$l(t,n);else{const s=Jn(e);i={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return _e(i)}function ni(e,t){const n=Ct(e);return n===t||!at(n)||Wt(n)?!1:ct(n).position==="fixed"||ni(n,t)}function zl(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=Xe(l);!a&&c.position==="fixed"&&(s=null),(r?!a&&!s:!a&&c.position==="static"&&s&&jl.has(s.position)||ie(l)&&!a&&ni(e,l))?i=i.filter(o=>o!==l):s=c,l=Ct(l)}return t.set(e,i),i}function Nl(e){let{element:t,boundary:n,rootBoundary:i,strategy:s}=e;const r=[...n==="clippingAncestors"?be(t)?[]:zl(t,this._c):[].concat(n),i],l=r[0],c=r.reduce((a,o)=>{const h=ei(t,o,s);return a.top=Nt(h.top,a.top),a.right=Ve(h.right,a.right),a.bottom=Ve(h.bottom,a.bottom),a.left=Nt(h.left,a.left),a},ei(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Hl(e){const{width:t,height:n}=Qn(e);return{width:t,height:n}}function Wl(e,t,n){const i=_t(t),s=gt(t),r=n==="fixed",l=Pt(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=Pt(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?Zn(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 Ke(e){return ct(e).position==="static"}function ii(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 si(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)&&!Ke(s))return s;s=Ct(s)}return n}let i=ii(e,t);for(;i&&Cl(i)&&Ke(i);)i=ii(i,t);return i&&Wt(i)&&Ke(i)&&!Xe(i)?n:i||El(e)||n}const Bl=function(e){return P(this,null,function*(){const t=this.getOffsetParent||si,n=this.getDimensions,i=yield n(e.floating);return{reference:Wl(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};function Ul(e){return ct(e).direction==="rtl"}const nt={convertOffsetParentRelativeRectToViewportRelativeRect:Il,getDocumentElement:gt,getClippingRect:Nl,getOffsetParent:si,getElementRects:Bl,getClientRects:Rl,getDimensions:Hl,getScale:Bt,isElement:at,isRTL:Ul};function ri(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vl(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),S={rootMargin:-p+"px "+-g+"px "+-y+"px "+-_+"px",threshold:Nt(0,Ve(1,a))||1};let x=!0;function A(pt){const w=pt[0].intersectionRatio;if(w!==a){if(!x)return l();w?l(!1,w):i=setTimeout(()=>{l(!1,1e-7)},1e3)}w===1&&!ri(o,e.getBoundingClientRect())&&l(),x=!1}try{n=new IntersectionObserver(A,J(U({},S),{root:s.ownerDocument}))}catch{n=new IntersectionObserver(A,S)}n.observe(e)}return l(!0),r}function Qe(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=Ge(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?Vl(o,n):null;let f=-1,d=null;l&&(d=new ResizeObserver(_=>{let[S]=_;S&&S.target===o&&d&&(d.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(t)})),n()}),o&&!a&&d.observe(o),d.observe(t));let p,g=a?Pt(e):null;a&&y();function y(){const _=Pt(e);g&&!ri(g,_)&&n(),g=_,p=requestAnimationFrame(y)}return n(),()=>{var _;h.forEach(S=>{s&&S.removeEventListener("scroll",n),r&&S.removeEventListener("resize",n)}),u?.(),(_=d)==null||_.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const Xl=vl,{hasOwnProperty:Je}=Object.prototype,re=function(){};function oi(e){return typeof e=="function"?e:re}function li(e,t){return function(n,i,s){n.type===t&&e.call(this,n,i,s)}}function Yl(e,t){const n=t.structure,i=[];for(const s in n){if(Je.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 ql(e){const t={};for(const n in e.node)if(Je.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]=Yl(n,i)}return t}function ai(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 ci({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 Gl(e){const t=ql(e),n={},i={},s=Symbol("break-walk"),r=Symbol("skip-node");for(const o in t)Je.call(t,o)&&t[o]!==null&&(n[o]=ai(t[o],!1),i[o]=ai(t[o],!0));const l=ci(n),c=ci(i),a=function(o,h){function u(_,S,x){const A=f.call(y,_,S,x);return A===s?!0:A===r?!1:!!(p.hasOwnProperty(_.type)&&p[_.type](_,y,u,g)||d.call(y,_,S,x)===s)}let f=re,d=re,p=n,g=(_,S,x,A)=>_||u(S,x,A);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=oi(h.enter),d=oi(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=li(f,h.visit),d=li(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,C=2,B=3,I=4,wt=5,Kl=6,Y=7,ht=8,T=9,v=10,z=11,L=12,N=13,Se=14,it=15,q=16,Z=17,ut=18,Ut=19,oe=20,O=21,b=22,ft=23,Vt=24,G=25,Ql=0;function st(e){return e>=48&&e<=57}function Xt(e){return st(e)||e>=65&&e<=70||e>=97&&e<=102}function Ze(e){return e>=65&&e<=90}function Jl(e){return e>=97&&e<=122}function Zl(e){return Ze(e)||Jl(e)}function ta(e){return e>=128}function we(e){return Zl(e)||ta(e)||e===95}function hi(e){return we(e)||st(e)||e===45}function ea(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 Ot(e){return Ce(e)||e===32||e===9}function yt(e,t){return!(e!==92||Ce(t)||t===Ql)}function tn(e,t,n){return e===45?we(t)||t===45||yt(t,n):we(e)?!0:e===92?yt(e,t):!1}function en(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 ui(e){return e===65279||e===65534?1:0}const nn=new Array(128),na=128,xe=130,fi=131,sn=132,di=133;for(let e=0;e<nn.length;e++)nn[e]=Ot(e)&&xe||st(e)&&fi||we(e)&&sn||ea(e)&&di||e||na;function rn(e){return e<128?nn[e]:sn}function Yt(e,t){return t<e.length?e.charCodeAt(t):0}function on(e,t,n){return n===13&&Yt(e,t+1)===10?2:1}function pi(e,t,n){let i=e.charCodeAt(t);return Ze(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(Ze(l)&&(l=l|32),l!==r)return!1}return!0}function ia(e,t){for(;t>=0&&Ot(e.charCodeAt(t));t--);return t+1}function Te(e,t){for(;t<e.length&&Ot(e.charCodeAt(t));t++);return t}function ln(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);Ot(n)&&(t+=on(e,t,n))}return t}function Ae(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(!hi(n)){if(yt(n,Yt(e,t+1))){t=qt(e,t)-1;continue}break}}return t}function mi(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),st(n)&&(t=ln(e,t+1),n=e.charCodeAt(t)),n===46&&st(e.charCodeAt(t+1))&&(t+=2,t=ln(e,t)),pi(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=ln(e,t+1+i+1))}return t}function an(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 gi(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 _i=["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"],sa=16*1024;function Ee(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,sa)):e}const yi=10,ra=12,bi=13;function ki(e){const t=e.source,n=t.length,i=t.length>0?ui(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===yi||o===bi||o===ra)&&(o===bi&&a+1<n&&t.charCodeAt(a+1)===yi&&(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 oa{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||ki(this),{source:n,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,n,i){return this.computed||ki(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[C]=b,Dt[O]=b,Dt[Ut]=oe,Dt[ft]=Vt;function vi(e){return Dt[e]!==0}class la{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 vi(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)===T&&this.source.charCodeAt(this.lookupOffset(n))===t:this.tokenType===T&&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:vi(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:_i[n],chunk:this.source.substring(i,s),balance:this.balance[r]}}),t}}function Si(e,t){function n(u){return u<c?e.charCodeAt(u):0}function i(){if(o=mi(e,o),tn(n(o),n(o+1),n(o+2))){h=L,o=Ae(e,o);return}if(n(o)===37){h=z,o++;return}h=v}function s(){const u=o;if(o=Ae(e,o),Le(e,u,o,"url")&&n(o)===40){if(o=Te(e,o+1),n(o)===34||n(o)===39){h=C,o=u+4;return}l();return}if(n(o)===40){h=C,o++;return}h=m}function r(u){for(u||(u=n(o++)),h=wt;o<e.length;o++){const f=e.charCodeAt(o);switch(rn(f)){case u:o++;return;case xe:if(Ce(f)){o+=on(e,o,f),h=Kl;return}break;case 92:if(o===e.length-1)break;const d=n(o+1);Ce(d)?o+=on(e,o+1,d):yt(f,d)&&(o=qt(e,o)-1);break}}}function l(){for(h=Y,o=Te(e,o);o<e.length;o++){const u=e.charCodeAt(o);switch(rn(u)){case 41:o++;return;case xe:if(o=Te(e,o),n(o)===41||o>=e.length){o<e.length&&o++;return}o=an(e,o),h=ht;return;case 34:case 39:case 40:case di:o=an(e,o),h=ht;return;case 92:if(yt(u,n(o+1))){o=qt(e,o)-1;break}o=an(e,o),h=ht;return}}}e=String(e||"");const c=e.length;let a=ui(n(0)),o=a,h;for(;o<c;){const u=e.charCodeAt(o);switch(rn(u)){case xe:h=N,o=Te(e,o+1);break;case 34:r();break;case 35:hi(n(o+1))||yt(n(o+1),n(o+2))?(h=I,o=Ae(e,o+1)):(h=T,o++);break;case 39:r();break;case 40:h=O,o++;break;case 41:h=b,o++;break;case 43:en(u,n(o+1),n(o+2))?i():(h=T,o++);break;case 44:h=ut,o++;break;case 45:en(u,n(o+1),n(o+2))?i():n(o+1)===45&&n(o+2)===62?(h=it,o=o+3):tn(u,n(o+1),n(o+2))?s():(h=T,o++);break;case 46:en(u,n(o+1),n(o+2))?i():(h=T,o++);break;case 47:n(o+1)===42?(h=G,o=e.indexOf("*/",o+2),o=o===-1?e.length:o+2):(h=T,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=T,o++);break;case 64:tn(n(o+1),n(o+2),n(o+3))?(h=B,o=Ae(e,o+1)):(h=T,o++);break;case 91:h=Ut,o++;break;case 92:yt(u,n(o+1))?s():(h=T,o++);break;case 93:h=oe,o++;break;case 123:h=ft,o++;break;case 125:h=Vt,o++;break;case fi:i();break;case sn:s();break;default:h=T,o++}t(h,a,a=o)}}const vt=43,rt=45,Pe=110,It=!0,aa=!1;function Oe(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 Oe.call(this,0,e)}function Lt(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case Pe:n="N is expected";break;case rt:n="HyphenMinus is expected";break}this.error(n,this.tokenStart+e)}}function cn(){let e=0,t=0,n=this.tokenType;for(;n===N||n===G;)n=this.lookupType(++e);if(n!==v)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!==v&&(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(v):this.consume(v)}const ca="AnPlusB",ha={a:[String,null],b:[String,null]};function wi(){const e=this.tokenStart;let t=null,n=null;if(this.tokenType===v)Gt.call(this,aa),n=this.consume(v);else if(this.tokenType===m&&this.cmpChar(this.tokenStart,rt))switch(t="-1",Lt.call(this,1,Pe),this.tokenEnd-this.tokenStart){case 2:this.next(),n=cn.call(this);break;case 3:Lt.call(this,2,rt),this.next(),this.skipSC(),Gt.call(this,It),n="-"+this.consume(v);break;default:Lt.call(this,2,rt),Oe.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,Pe),this.tokenEnd-this.tokenStart){case 1:this.next(),n=cn.call(this);break;case 2:Lt.call(this,1,rt),this.next(),this.skipSC(),Gt.call(this,It),n="-"+this.consume(v);break;default:Lt.call(this,1,rt),Oe.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,Pe),t=this.substring(e,r),r+1===this.tokenEnd?(this.next(),n=cn.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(v)):(Oe.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 Ci(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 ua=Object.freeze(Object.defineProperty({__proto__:null,generate:Ci,name:ca,parse:wi,structure:ha},Symbol.toStringTag,{value:"Module"}));function xi(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function fa(){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 da="Atrule",pa="atrule",ma={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]};function Li(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),xi):s=xi.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(fa.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:s,block:r}}function Ti(e){this.token(B,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(Z,";")}const ga=Object.freeze(Object.defineProperty({__proto__:null,generate:Ti,name:da,parse:Li,structure:ma,walkContext:pa},Symbol.toStringTag,{value:"Module"})),_a="AtrulePrelude",ya="atrulePrelude",ba={children:[[]]};function Ai(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 Ei(e){this.children(e)}const ka=Object.freeze(Object.defineProperty({__proto__:null,generate:Ei,name:_a,parse:Ai,structure:ba,walkContext:ya},Symbol.toStringTag,{value:"Module"})),va=36,Pi=42,De=61,Sa=94,hn=124,wa=126;function Ca(){this.eof&&this.error("Unexpected end of input");const e=this.tokenStart;let t=!1;return this.isDelim(Pi)?(t=!0,this.next()):this.isDelim(hn)||this.eat(m),this.isDelim(hn)?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 xa(){const e=this.tokenStart,t=this.charCodeAt(e);return t!==De&&t!==wa&&t!==Sa&&t!==va&&t!==Pi&&t!==hn&&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 La="AttributeSelector",Ta={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]};function Oi(){const e=this.tokenStart;let t,n=null,i=null,s=null;return this.eat(Ut),this.skipSC(),t=Ca.call(this),this.skipSC(),this.tokenType!==oe&&(this.tokenType!==m&&(n=xa.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 Di(e){this.token(T,"["),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(T,"]")}const Aa=Object.freeze(Object.defineProperty({__proto__:null,generate:Di,name:La,parse:Oi,structure:Ta},Symbol.toStringTag,{value:"Module"})),Ea=38;function Ii(){return this.Raw(null,!0)}function Ri(){return this.parseWithFallback(this.Rule,Ii)}function Mi(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function Pa(){if(this.tokenType===Z)return Mi.call(this,this.tokenIndex);const e=this.parseWithFallback(this.Declaration,Mi);return this.tokenType===Z&&this.next(),e}const Oa="Block",Da="block",Ia={children:[["Atrule","Rule","Declaration"]]};function Fi(e){const t=e?Pa:Ri,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),Ii));break;default:e&&this.isDelim(Ea)?i.push(Ri.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 Ra=Object.freeze(Object.defineProperty({__proto__:null,generate:ji,name:Oa,parse:Fi,structure:Ia,walkContext:Da},Symbol.toStringTag,{value:"Module"})),Ma="Brackets",Fa={children:[[]]};function $i(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 zi(e){this.token(T,"["),this.children(e),this.token(T,"]")}const ja=Object.freeze(Object.defineProperty({__proto__:null,generate:zi,name:Ma,parse:$i,structure:Fa},Symbol.toStringTag,{value:"Module"})),$a="CDC",za=[];function Ni(){const e=this.tokenStart;return this.eat(it),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function Hi(){this.token(it,"-->")}const Na=Object.freeze(Object.defineProperty({__proto__:null,generate:Hi,name:$a,parse:Ni,structure:za},Symbol.toStringTag,{value:"Module"})),Ha="CDO",Wa=[];function Wi(){const e=this.tokenStart;return this.eat(Se),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function Bi(){this.token(Se,"<!--")}const Ba=Object.freeze(Object.defineProperty({__proto__:null,generate:Bi,name:Ha,parse:Wi,structure:Wa},Symbol.toStringTag,{value:"Module"})),Ua=46,Va="ClassSelector",Xa={name:String};function Ui(){return this.eatDelim(Ua),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(m)}}function Vi(e){this.token(T,"."),this.token(m,e.name)}const Ya=Object.freeze(Object.defineProperty({__proto__:null,generate:Vi,name:Va,parse:Ui,structure:Xa},Symbol.toStringTag,{value:"Module"})),qa=43,Xi=47,Ga=62,Ka=126,Qa="Combinator",Ja={name:String};function Yi(){const e=this.tokenStart;let t;switch(this.tokenType){case N:t=" ";break;case T:switch(this.charCodeAt(this.tokenStart)){case Ga:case qa:case Ka:this.next();break;case Xi:this.next(),this.eatIdent("deep"),this.eatDelim(Xi);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function qi(e){this.tokenize(e.name)}const Za=Object.freeze(Object.defineProperty({__proto__:null,generate:qi,name:Qa,parse:Yi,structure:Ja},Symbol.toStringTag,{value:"Module"})),tc=42,ec=47,nc="Comment",ic={value:String};function Gi(){const e=this.tokenStart;let t=this.tokenEnd;return this.eat(G),t-e+2>=2&&this.charCodeAt(t-2)===tc&&this.charCodeAt(t-1)===ec&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function Ki(e){this.token(G,"/*"+e.value+"*/")}const sc=Object.freeze(Object.defineProperty({__proto__:null,generate:Ki,name:nc,parse:Gi,structure:ic},Symbol.toStringTag,{value:"Module"})),rc=new Set([q,b,xt]),oc="Condition",lc={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};function Qi(e){return this.lookupTypeNonSC(1)===m&&rc.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}const ac={media:Qi,container:Qi,supports(){return this.SupportsDeclaration()}};function Ji(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 O:{let n=this.parseWithFallback(()=>ac[e].call(this,e),()=>null);n||(n=this.parseWithFallback(()=>{this.eat(O);const i=this.Condition(e);return this.eat(b),i},()=>this.GeneralEnclosed(e))),t.push(n);break}case C:{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 Zi(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(O,"("),this.node(t),this.token(b,")")):this.node(t)})}const cc=Object.freeze(Object.defineProperty({__proto__:null,generate:Zi,name:oc,parse:Ji,structure:lc},Symbol.toStringTag,{value:"Module"})),ts=45;function hc(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===ts&&e.charCodeAt(t+1)===ts}const es=33,uc=35,fc=36,dc=38,pc=42,mc=43,ns=47;function gc(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function _c(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function yc(){const e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==Z&&this.isDelim(es)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}const bc="Declaration",kc="declaration",vc={important:[Boolean,String],property:String,value:["Value","Raw"]};function is(){const e=this.tokenStart,t=this.tokenIndex,n=Sc.call(this),i=hc(n),s=i?this.parseCustomProperty:this.parseValue,r=i?_c:gc;let l=!1,c;this.skipSC(),this.eat(q);const a=this.tokenIndex;if(i||this.skipSC(),s?c=this.parseWithFallback(yc,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(es)&&(l=wc.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 ss(e){this.token(m,e.property),this.token(q,":"),this.node(e.value),e.important&&(this.token(T,"!"),this.token(m,e.important===!0?"important":e.important))}function Sc(){const e=this.tokenStart;if(this.tokenType===T)switch(this.charCodeAt(this.tokenStart)){case pc:case fc:case mc:case uc:case dc:this.next();break;case ns:this.next(),this.isDelim(ns)&&this.next();break}return this.tokenType===I?this.eat(I):this.eat(m),this.substrToCursor(e)}function wc(){this.eat(T),this.skipSC();const e=this.consume(m);return e==="important"?!0:e}const Cc=Object.freeze(Object.defineProperty({__proto__:null,generate:ss,name:bc,parse:is,structure:vc,walkContext:kc},Symbol.toStringTag,{value:"Module"})),xc=38;function un(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}const Lc="DeclarationList",Tc={children:[["Declaration","Atrule","Rule"]]};function rs(){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),un));break;default:this.isDelim(xc)?e.push(this.parseWithFallback(this.Rule,un)):e.push(this.parseWithFallback(this.Declaration,un))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function os(e){this.children(e,t=>{t.type==="Declaration"&&this.token(Z,";")})}const Ac=Object.freeze(Object.defineProperty({__proto__:null,generate:os,name:Lc,parse:rs,structure:Tc},Symbol.toStringTag,{value:"Module"})),Ec="Dimension",Pc={value:String,unit:String};function ls(){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 as(e){this.token(L,e.value+e.unit)}const Oc=Object.freeze(Object.defineProperty({__proto__:null,generate:as,name:Ec,parse:ls,structure:Pc},Symbol.toStringTag,{value:"Module"})),Dc=47,Ic="Feature",Rc={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]};function cs(e){const t=this.tokenStart;let n,i=null;if(this.eat(O),this.skipSC(),n=this.consume(m),this.skipSC(),this.tokenType!==b){switch(this.eat(q),this.skipSC(),this.tokenType){case v:this.lookupNonWSType(1)===T?i=this.Ratio():i=this.Number();break;case L:i=this.Dimension();break;case m:i=this.Identifier();break;case C:i=this.parseWithFallback(()=>{const s=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(Dc)&&this.error(),s},()=>this.Ratio());break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eof||this.eat(b),{type:"Feature",loc:this.getLocation(t,this.tokenStart),kind:e,name:n,value:i}}function hs(e){this.token(O,"("),this.token(m,e.name),e.value!==null&&(this.token(q,":"),this.node(e.value)),this.token(b,")")}const Mc=Object.freeze(Object.defineProperty({__proto__:null,generate:hs,name:Ic,parse:cs,structure:Rc},Symbol.toStringTag,{value:"Module"})),Fc="FeatureFunction",jc={kind:String,feature:String,value:["Declaration","Selector"]};function $c(e,t){const n=(this.features[e]||{})[t];return typeof n!="function"&&this.error(`Unknown feature ${t}()`),n}function us(e="unknown"){const t=this.tokenStart,n=this.consumeFunctionName(),i=$c.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(b),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:n,value:s}}function fs(e){this.token(C,e.feature+"("),this.node(e.value),this.token(b,")")}const zc=Object.freeze(Object.defineProperty({__proto__:null,generate:fs,name:Fc,parse:us,structure:jc},Symbol.toStringTag,{value:"Module"})),ds=47,Nc=60,ps=61,Hc=62,Wc="FeatureRange",Bc={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 fn(){switch(this.skipSC(),this.tokenType){case v:return this.isDelim(ds,this.lookupOffsetNonSC(1))?this.Ratio():this.Number();case L:return this.Dimension();case m:return this.Identifier();case C:return this.parseWithFallback(()=>{const e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(ds)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function ms(e){if(this.skipSC(),this.isDelim(Nc)||this.isDelim(Hc)){const t=this.source[this.tokenStart];return this.next(),this.isDelim(ps)?(this.next(),t+"="):t}if(this.isDelim(ps))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function gs(e="unknown"){const t=this.tokenStart;this.skipSC(),this.eat(O);const n=fn.call(this),i=ms.call(this,n.type==="Identifier"),s=fn.call(this);let r=null,l=null;return this.lookupNonWSType(0)!==b&&(r=ms.call(this),l=fn.call(this)),this.skipSC(),this.eat(b),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:n,leftComparison:i,middle:s,rightComparison:r,right:l}}function _s(e){this.token(O,"("),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(b,")")}const Uc=Object.freeze(Object.defineProperty({__proto__:null,generate:_s,name:Wc,parse:gs,structure:Bc},Symbol.toStringTag,{value:"Module"})),Vc="Function",Xc="function",Yc={name:String,children:[[]]};function ys(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(b),{type:"Function",loc:this.getLocation(n,this.tokenStart),name:i,children:r}}function bs(e){this.token(C,e.name+"("),this.children(e),this.token(b,")")}const qc=Object.freeze(Object.defineProperty({__proto__:null,generate:bs,name:Vc,parse:ys,structure:Yc,walkContext:Xc},Symbol.toStringTag,{value:"Module"})),Gc="GeneralEnclosed",Kc={kind:String,function:[String,null],children:[[]]};function ks(e){const t=this.tokenStart;let n=null;this.tokenType===C?n=this.consumeFunctionName():this.eat(O);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(b),{type:"GeneralEnclosed",loc:this.getLocation(t,this.tokenStart),kind:e,function:n,children:i}}function vs(e){e.function?this.token(C,e.function+"("):this.token(O,"("),this.children(e),this.token(b,")")}const Qc=Object.freeze(Object.defineProperty({__proto__:null,generate:vs,name:Gc,parse:ks,structure:Kc},Symbol.toStringTag,{value:"Module"})),Jc="XXX",Zc="Hash",th={value:String};function Ss(){const e=this.tokenStart;return this.eat(I),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function ws(e){this.token(I,"#"+e.value)}const eh=Object.freeze(Object.defineProperty({__proto__:null,generate:ws,name:Zc,parse:Ss,structure:th,xxx:Jc},Symbol.toStringTag,{value:"Module"})),nh="Identifier",ih={name:String};function Cs(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(m)}}function xs(e){this.token(m,e.name)}const sh=Object.freeze(Object.defineProperty({__proto__:null,generate:xs,name:nh,parse:Cs,structure:ih},Symbol.toStringTag,{value:"Module"})),rh="IdSelector",oh={name:String};function Ls(){const e=this.tokenStart;return this.eat(I),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function Ts(e){this.token(T,"#"+e.name)}const lh=Object.freeze(Object.defineProperty({__proto__:null,generate:Ts,name:rh,parse:Ls,structure:oh},Symbol.toStringTag,{value:"Module"})),ah=46,ch="Layer",hh={name:String};function As(){let e=this.tokenStart,t=this.consume(m);for(;this.isDelim(ah);)this.eat(T),t+="."+this.consume(m);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function Es(e){this.tokenize(e.name)}const uh=Object.freeze(Object.defineProperty({__proto__:null,generate:Es,name:ch,parse:As,structure:hh},Symbol.toStringTag,{value:"Module"})),fh="LayerList",dh={children:[["Layer"]]};function Ps(){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 Os(e){this.children(e,()=>this.token(ut,","))}const ph=Object.freeze(Object.defineProperty({__proto__:null,generate:Os,name:fh,parse:Ps,structure:dh},Symbol.toStringTag,{value:"Module"})),mh="MediaQuery",gh={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]};function Ds(){const e=this.tokenStart;let t=null,n=null,i=null;if(this.skipSC(),this.tokenType===m&&this.lookupTypeNonSC(1)!==O){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 O:case C:{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 Is(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 _h=Object.freeze(Object.defineProperty({__proto__:null,generate:Is,name:mh,parse:Ds,structure:gh},Symbol.toStringTag,{value:"Module"})),yh="MediaQueryList",bh={children:[["MediaQuery"]]};function Rs(){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 Ms(e){this.children(e,()=>this.token(ut,","))}const kh=Object.freeze(Object.defineProperty({__proto__:null,generate:Ms,name:yh,parse:Rs,structure:bh},Symbol.toStringTag,{value:"Module"})),vh=38,Sh="NestingSelector",wh={};function Fs(){const e=this.tokenStart;return this.eatDelim(vh),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function js(){this.token(T,"&")}const Ch=Object.freeze(Object.defineProperty({__proto__:null,generate:js,name:Sh,parse:Fs,structure:wh},Symbol.toStringTag,{value:"Module"})),xh="Nth",Lh={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]};function $s(){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 zs(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:zs,name:xh,parse:$s,structure:Lh},Symbol.toStringTag,{value:"Module"})),Ah="Number",Eh={value:String};function Ns(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(v)}}function Hs(e){this.token(v,e.value)}const Ph=Object.freeze(Object.defineProperty({__proto__:null,generate:Hs,name:Ah,parse:Ns,structure:Eh},Symbol.toStringTag,{value:"Module"})),Oh="Operator",Dh={value:String};function Ws(){const e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Bs(e){this.tokenize(e.value)}const Ih=Object.freeze(Object.defineProperty({__proto__:null,generate:Bs,name:Oh,parse:Ws,structure:Dh},Symbol.toStringTag,{value:"Module"})),Rh="Parentheses",Mh={children:[[]]};function Us(e,t){const n=this.tokenStart;let i=null;return this.eat(O),i=e.call(this,t),this.eof||this.eat(b),{type:"Parentheses",loc:this.getLocation(n,this.tokenStart),children:i}}function Vs(e){this.token(O,"("),this.children(e),this.token(b,")")}const Fh=Object.freeze(Object.defineProperty({__proto__:null,generate:Vs,name:Rh,parse:Us,structure:Mh},Symbol.toStringTag,{value:"Module"})),jh="Percentage",$h={value:String};function Xs(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(z)}}function Ys(e){this.token(z,e.value+"%")}const zh=Object.freeze(Object.defineProperty({__proto__:null,generate:Ys,name:jh,parse:Xs,structure:$h},Symbol.toStringTag,{value:"Module"})),Nh="PseudoClassSelector",Hh="function",Wh={name:String,children:[["Raw"],null]};function qs(){const e=this.tokenStart;let t=null,n,i;return this.eat(q),this.tokenType===C?(n=this.consumeFunctionName(),i=n.toLowerCase(),this.lookupNonWSType(0)==b?t=this.createList():hasOwnProperty.call(this.pseudo,i)?(this.skipSC(),t=this.pseudo[i].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(b)):n=this.consume(m),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function Gs(e){this.token(q,":"),e.children===null?this.token(m,e.name):(this.token(C,e.name+"("),this.children(e),this.token(b,")"))}const Bh=Object.freeze(Object.defineProperty({__proto__:null,generate:Gs,name:Nh,parse:qs,structure:Wh,walkContext:Hh},Symbol.toStringTag,{value:"Module"})),Uh="PseudoElementSelector",Vh="function",Xh={name:String,children:[["Raw"],null]};function Ks(){const e=this.tokenStart;let t=null,n,i;return this.eat(q),this.eat(q),this.tokenType===C?(n=this.consumeFunctionName(),i=n.toLowerCase(),this.lookupNonWSType(0)==b?t=this.createList():hasOwnProperty.call(this.pseudo,i)?(this.skipSC(),t=this.pseudo[i].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(b)):n=this.consume(m),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function Qs(e){this.token(q,":"),this.token(q,":"),e.children===null?this.token(m,e.name):(this.token(C,e.name+"("),this.children(e),this.token(b,")"))}const Yh=Object.freeze(Object.defineProperty({__proto__:null,generate:Qs,name:Uh,parse:Ks,structure:Xh,walkContext:Vh},Symbol.toStringTag,{value:"Module"})),Js=47;function Zs(){switch(this.skipSC(),this.tokenType){case v:return this.Number();case C:return this.Function(this.readSequence,this.scope.Value);default:this.error("Number of function is expected")}}const qh="Ratio",Gh={left:["Number","Function"],right:["Number","Function",null]};function tr(){const e=this.tokenStart,t=Zs.call(this);let n=null;return this.skipSC(),this.isDelim(Js)&&(this.eatDelim(Js),n=Zs.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function er(e){this.node(e.left),this.token(T,"/"),e.right?this.node(e.right):this.node(v,1)}const Kh=Object.freeze(Object.defineProperty({__proto__:null,generate:er,name:qh,parse:tr,structure:Gh},Symbol.toStringTag,{value:"Module"}));function Qh(){return this.tokenIndex>0&&this.lookupType(-1)===N?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}const Jh="Raw",Zh={value:String};function nr(e,t){const n=this.getTokenStart(this.tokenIndex);let i;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>n?i=Qh.call(this):i=this.tokenStart,{type:"Raw",loc:this.getLocation(n,i),value:this.substring(n,i)}}function ir(e){this.tokenize(e.value)}const tu=Object.freeze(Object.defineProperty({__proto__:null,generate:ir,name:Jh,parse:nr,structure:Zh},Symbol.toStringTag,{value:"Module"}));function sr(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function eu(){const e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==ft&&this.error(),e}const nu="Rule",iu="rule",su={prelude:["SelectorList","Raw"],block:["Block"]};function rr(){const e=this.tokenIndex,t=this.tokenStart;let n,i;return this.parseRulePrelude?n=this.parseWithFallback(eu,sr):n=sr.call(this,e),i=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:i}}function or(e){this.node(e.prelude),this.node(e.block)}const ru=Object.freeze(Object.defineProperty({__proto__:null,generate:or,name:nu,parse:rr,structure:su,walkContext:iu},Symbol.toStringTag,{value:"Module"})),ou="Scope",lu={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]};function lr(){let e=null,t=null;this.skipSC();const n=this.tokenStart;return this.tokenType===O&&(this.next(),this.skipSC(),e=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(b)),this.lookupNonWSType(0)===m&&(this.skipSC(),this.eatIdent("to"),this.skipSC(),this.eat(O),this.skipSC(),t=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(b)),{type:"Scope",loc:this.getLocation(n,this.tokenStart),root:e,limit:t}}function ar(e){e.root&&(this.token(O,"("),this.node(e.root),this.token(b,")")),e.limit&&(this.token(m,"to"),this.token(O,"("),this.node(e.limit),this.token(b,")"))}const au=Object.freeze(Object.defineProperty({__proto__:null,generate:ar,name:ou,parse:lr,structure:lu},Symbol.toStringTag,{value:"Module"})),cu="Selector",hu={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]};function cr(){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 hr(e){this.children(e)}const uu=Object.freeze(Object.defineProperty({__proto__:null,generate:hr,name:cu,parse:cr,structure:hu},Symbol.toStringTag,{value:"Module"})),fu="SelectorList",du="selector",pu={children:[["Selector","Raw"]]};function ur(){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 fr(e){this.children(e,()=>this.token(ut,","))}const mu=Object.freeze(Object.defineProperty({__proto__:null,generate:fr,name:fu,parse:ur,structure:pu,walkContext:du},Symbol.toStringTag,{value:"Module"})),dn=92,dr=34,gu=39;function pr(e){const t=e.length,n=e.charCodeAt(0),i=n===dr||n===gu?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===dn){if(l===s){l!==t-1&&(r=e.substr(l+1));break}if(c=e.charCodeAt(++l),yt(dn,c)){const a=l-1,o=qt(e,a);l=o-1,r+=gi(e.substring(a+1,o))}else c===13&&e.charCodeAt(l+1)===10&&l++}else r+=e[l]}return r}function _u(e,t){const n=dr;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===dn?(i+="\\"+e.charAt(r),s=!1):(s&&(Xt(l)||Ot(l))&&(i+=" "),i+=e.charAt(r),s=!1)}return'"'+i+'"'}const yu="String",bu={value:String};function mr(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:pr(this.consume(wt))}}function gr(e){this.token(wt,_u(e.value))}const ku=Object.freeze(Object.defineProperty({__proto__:null,generate:gr,name:yu,parse:mr,structure:bu},Symbol.toStringTag,{value:"Module"})),vu=33;function _r(){return this.Raw(null,!1)}const Su="StyleSheet",wu="stylesheet",Cu={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]};function yr(){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)!==vu){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,_r);break;default:n=this.parseWithFallback(this.Rule,_r)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function br(e){this.children(e)}const xu=Object.freeze(Object.defineProperty({__proto__:null,generate:br,name:Su,parse:yr,structure:Cu,walkContext:wu},Symbol.toStringTag,{value:"Module"})),Lu="SupportsDeclaration",Tu={declaration:"Declaration"};function kr(){const e=this.tokenStart;this.eat(O),this.skipSC();const t=this.Declaration();return this.eof||this.eat(b),{type:"SupportsDeclaration",loc:this.getLocation(e,this.tokenStart),declaration:t}}function vr(e){this.token(O,"("),this.node(e.declaration),this.token(b,")")}const Au=Object.freeze(Object.defineProperty({__proto__:null,generate:vr,name:Lu,parse:kr,structure:Tu},Symbol.toStringTag,{value:"Module"})),Eu=42,Sr=124;function pn(){this.tokenType!==m&&this.isDelim(Eu)===!1&&this.error("Identifier or asterisk is expected"),this.next()}const Pu="TypeSelector",Ou={name:String};function wr(){const e=this.tokenStart;return this.isDelim(Sr)?(this.next(),pn.call(this)):(pn.call(this),this.isDelim(Sr)&&(this.next(),pn.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function Cr(e){this.tokenize(e.name)}const Du=Object.freeze(Object.defineProperty({__proto__:null,generate:Cr,name:Pu,parse:wr,structure:Ou},Symbol.toStringTag,{value:"Module"})),xr=43,Lr=45,mn=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===Lr&&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(mn);)++t>e&&this.error("Too many question marks"),this.next()}function Iu(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===xr?"Plus sign":"Hyphen minus")+" is expected")}function Ru(){let e=0;switch(this.tokenType){case v:if(e=le.call(this,1,!0),this.isDelim(mn)){Ie.call(this,6-e);break}if(this.tokenType===L||this.tokenType===v){Iu.call(this,Lr),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(xr),this.tokenType===m){e=le.call(this,0,!0),e>0&&Ie.call(this,6-e);break}if(this.isDelim(mn)){this.next(),Ie.call(this,5);break}this.error("Hex digit or question mark is expected")}}const Mu="UnicodeRange",Fu={value:String};function Tr(){const e=this.tokenStart;return this.eatIdent("u"),Ru.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Ar(e){this.tokenize(e.value)}const ju=Object.freeze(Object.defineProperty({__proto__:null,generate:Ar,name:Mu,parse:Tr,structure:Fu},Symbol.toStringTag,{value:"Module"})),$u=32,gn=92,zu=34,Nu=39,Hu=40,Er=41;function Wu(e){const t=e.length;let n=4,i=e.charCodeAt(t-1)===Er?t-2:t-1,s="";for(;n<i&&Ot(e.charCodeAt(n));)n++;for(;n<i&&Ot(e.charCodeAt(i));)i--;for(let r=n;r<=i;r++){let l=e.charCodeAt(r);if(l===gn){if(r===i){r!==t-1&&(s=e.substr(r+1));break}if(l=e.charCodeAt(++r),yt(gn,l)){const c=r-1,a=qt(e,c);r=a-1,s+=gi(e.substring(c+1,a))}else l===13&&e.charCodeAt(r+1)===10&&r++}else s+=e[r]}return s}function Bu(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===$u||s===gn||s===zu||s===Nu||s===Hu||s===Er?(t+="\\"+e.charAt(i),n=!1):(n&&Xt(s)&&(t+=" "),t+=e.charAt(i),n=!1)}return"url("+t+")"}const Uu="Url",Vu={value:String};function Pr(){const e=this.tokenStart;let t;switch(this.tokenType){case Y:t=Wu(this.consume(Y));break;case C:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(C),this.skipSC(),t=pr(this.consume(wt)),this.skipSC(),this.eof||this.eat(b);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(e,this.tokenStart),value:t}}function Or(e){this.token(Y,Bu(e.value))}const Xu=Object.freeze(Object.defineProperty({__proto__:null,generate:Or,name:Uu,parse:Pr,structure:Vu},Symbol.toStringTag,{value:"Module"})),Yu="Value",qu={children:[[]]};function Dr(){const e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function Ir(e){this.children(e)}const Gu=Object.freeze(Object.defineProperty({__proto__:null,generate:Ir,name:Yu,parse:Dr,structure:qu},Symbol.toStringTag,{value:"Module"})),Ku=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),Qu="WhiteSpace",Ju={value:String};function Rr(){return this.eat(N),Ku}function Mr(e){this.token(N,e.value)}const Zu=Object.freeze(Object.defineProperty({__proto__:null,generate:Mr,name:Qu,parse:Rr,structure:Ju},Symbol.toStringTag,{value:"Module"})),tf=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:ua,Atrule:ga,AtrulePrelude:ka,AttributeSelector:Aa,Block:Ra,Brackets:ja,CDC:Na,CDO:Ba,ClassSelector:Ya,Combinator:Za,Comment:sc,Condition:cc,Declaration:Cc,DeclarationList:Ac,Dimension:Oc,Feature:Mc,FeatureFunction:zc,FeatureRange:Uc,Function:qc,GeneralEnclosed:Qc,Hash:eh,IdSelector:lh,Identifier:sh,Layer:uh,LayerList:ph,MediaQuery:_h,MediaQueryList:kh,NestingSelector:Ch,Nth:Th,Number:Ph,Operator:Ih,Parentheses:Fh,Percentage:zh,PseudoClassSelector:Bh,PseudoElementSelector:Yh,Ratio:Kh,Raw:tu,Rule:ru,Scope:au,Selector:uu,SelectorList:mu,String:ku,StyleSheet:xu,SupportsDeclaration:Au,TypeSelector:Du,UnicodeRange:ju,Url:Xu,Value:Gu,WhiteSpace:Zu},Symbol.toStringTag,{value:"Module"})),ef={node:tf},Tt=Gl(ef),_n=["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 _n.includes(e)}const yn=["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 nf(e){return yn.includes(e)}const bn=["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 Fr(e){return bn.includes(e)}const jr=["justify-self","align-self","place-self"];function sf(e){return jr.includes(e)}const $r=[..._n,...yn,...bn,...jr,"position-anchor","position-area"],rf=[...bn,..._n,...yn];function zr(e){return rf.includes(e)}const of=["top","left","right","bottom","start","end","self-start","self-end","center","inside","outside"];function Nr(e){return of.includes(e)}const lf=["width","height","block","inline","self-block","self-inline"];function af(e){return lf.includes(e)}const Hr=new Set(["Atrule","Selector","Declaration"]);function cf(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&&Hr.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&&Hr.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 hf=43,uf=45,kn=(e,t)=>{if(e===T&&(e=t),typeof e=="string"){const n=e.charCodeAt(0);return n>127?32768:n<<8}return e},Wr=[[m,m],[m,C],[m,Y],[m,ht],[m,"-"],[m,v],[m,z],[m,L],[m,it],[m,O],[B,m],[B,C],[B,Y],[B,ht],[B,"-"],[B,v],[B,z],[B,L],[B,it],[I,m],[I,C],[I,Y],[I,ht],[I,"-"],[I,v],[I,z],[I,L],[I,it],[L,m],[L,C],[L,Y],[L,ht],[L,"-"],[L,v],[L,z],[L,L],[L,it],["#",m],["#",C],["#",Y],["#",ht],["#","-"],["#",v],["#",z],["#",L],["#",it],["-",m],["-",C],["-",Y],["-",ht],["-","-"],["-",v],["-",z],["-",L],["-",it],[v,m],[v,C],[v,Y],[v,ht],[v,v],[v,z],[v,L],[v,"%"],[v,it],["@",m],["@",C],["@",Y],["@",ht],["@","-"],["@",it],[".",v],[".",z],[".",L],["+",v],["+",z],["+",L],["/","*"]],ff=Wr.concat([[m,I],[L,I],[I,I],[B,O],[B,wt],[B,q],[z,z],[z,L],[z,C],[z,"-"],[b,m],[b,C],[b,z],[b,L],[b,I],[b,"-"]]);function Br(e){const t=new Set(e.map(([n,i])=>kn(n)<<16|kn(i)));return function(n,i,s){const r=kn(i,s),l=s.charCodeAt(0);return(l===uf&&i!==m&&i!==C&&i!==it||l===hf?t.has(n<<16|l<<8):t.has(n<<16|r))&&this.emit(" ",N,!0),r}}const df=Br(Wr),Ur=Br(ff),Vr=Object.freeze(Object.defineProperty({__proto__:null,safe:Ur,spec:df},Symbol.toStringTag,{value:"Module"})),pf=92;function mf(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 gf(e){Si(e,(t,n,i)=>{this.token(t,e.slice(n,i))})}function _f(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:Ur,token(a,o){r=this.tokenBefore(r,a,o),this.emit(o,a,!1),a===T&&o.charCodeAt(0)===pf&&this.emit(`
|
|
16
|
-
`,N,!0)},emit(a){s+=a},result(){return s}};i&&(typeof i.decorator=="function"&&(l=i.decorator(l)),i.sourceMap&&(l=cf(l)),i.mode in Vr&&(l.tokenBefore=Vr[i.mode]));const c={node:a=>l.node(a),children:mf,token:(a,o)=>l.token(a,o),tokenize:gf};return l.node(n),l.result()}}const yf=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:Ci,Atrule:Ti,AtrulePrelude:Ei,AttributeSelector:Di,Block:ji,Brackets:zi,CDC:Hi,CDO:Bi,ClassSelector:Vi,Combinator:qi,Comment:Ki,Condition:Zi,Declaration:ss,DeclarationList:os,Dimension:as,Feature:hs,FeatureFunction:fs,FeatureRange:_s,Function:bs,GeneralEnclosed:vs,Hash:ws,IdSelector:Ts,Identifier:xs,Layer:Es,LayerList:Os,MediaQuery:Is,MediaQueryList:Ms,NestingSelector:js,Nth:zs,Number:Hs,Operator:Bs,Parentheses:Vs,Percentage:Ys,PseudoClassSelector:Gs,PseudoElementSelector:Qs,Ratio:er,Raw:ir,Rule:or,Scope:ar,Selector:hr,SelectorList:fr,String:gr,StyleSheet:br,SupportsDeclaration:vr,TypeSelector:Cr,UnicodeRange:Ar,Url:Or,Value:Ir,WhiteSpace:Mr},Symbol.toStringTag,{value:"Module"})),bf={node:yf},kf=_f(bf);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 vf(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 vn=100,Xr=60,Yr=" ";function qr({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+=(Yr.length-1)*(o[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>vn&&(d=n-Xr+3,n=Xr-2);for(let p=h;p<=u;p++)p>=0&&p<o.length&&(o[p]=o[p].replace(/\t/g,Yr),o[p]=(d>0&&o[p].length>d?"…":"")+o[p].substr(d,vn-2)+(o[p].length>d+vn-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 Gr(e,t,n,i,s,r=1,l=1){return Object.assign(vf("SyntaxError",e),{source:t,offset:n,line:i,column:s,sourceFragment(c){return qr({source:t,line:i,column:s,baseLine:r,baseColumn:l},isNaN(c)?0:c)},get formattedMessage(){return`Parse error: ${e}
|
|
21
|
-
`+qr({source:t,line:i,column:s,baseLine:r,baseColumn:l},2)}})}function Sf(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 Kr=()=>{},wf=33,Cf=35,Sn=59,Qr=123,Jr=0;function xf(e){return function(){return this[e]()}}function wn(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 Lf(e){const t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:wn(e.atrule),pseudo:wn(e.pseudo),node:wn(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]=xf(i);break}return U(U({config:t},t),t.node)}function Tf(e){let t="",n="<unknown>",i=!1,s=Kr,r=!1;const l=new oa,c=Object.assign(new la,Lf(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Sf,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(a){return a===Qr?1:0},consumeUntilLeftCurlyBracketOrSemicolon(a){return a===Qr||a===Sn?1:0},consumeUntilExclamationMarkOrSemicolon(a){return a===wf||a===Sn?1:0},consumeUntilSemicolonIncluded(a){return a===Sn?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!==Jr);return Jr},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 pi(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(C),a},consumeNumber(a){const o=t.substring(this.tokenStart,mi(t,this.tokenStart));return this.eat(a),o},eat(a){if(this.tokenType!==a){const o=_i[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===C||this.tokenType===Y?(u=this.tokenEnd-1,h="Identifier is expected but function found"):h="Identifier is expected";break;case I:this.isDelim(Cf)&&(this.next(),u++,h="Name is expected");break;case z:this.tokenType===v&&(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(ia(t,t.length-1)):l.getLocation(this.tokenStart);throw new Gr(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,Si),l.setSource(t,o.offset,o.line,o.column),n=o.filename||"<unknown>",i=!!o.positions,s=typeof o.onParseError=="function"?o.onParseError:Kr,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:Gr,config:c.config})}const Af=35,Ef=42,Zr=43,Pf=45,Of=47,Df=117;function to(e){switch(this.tokenType){case I:return this.Hash();case ut:return this.Operator();case O: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 z:return this.Percentage();case v:return this.Number();case C: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,Df)&&this.cmpChar(this.tokenStart+1,Zr)?this.UnicodeRange():this.Identifier();case T:{const t=this.charCodeAt(this.tokenStart);if(t===Of||t===Ef||t===Zr||t===Pf)return this.Operator();t===Af&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}const If={getNode:to},Rf=35,Mf=38,Ff=42,jf=43,$f=47,eo=46,zf=62,Nf=124,Hf=126;function Wf(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function Bf(){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 v:case z:return this.Percentage();case L:this.charCodeAt(this.tokenStart)===eo&&this.error("Identifier is expected",this.tokenStart+1);break;case T:{switch(this.charCodeAt(this.tokenStart)){case jf:case zf:case Hf:case $f:return this.Combinator();case eo:return this.ClassSelector();case Ff:case Nf:return this.TypeSelector();case Rf:return this.IdSelector();case Mf:return this.NestingSelector()}break}}}const Uf={onWhiteSpace:Wf,getNode:Bf};function Vf(){return this.createSingleNodeList(this.Raw(null,!1))}function Xf(){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 no(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}const Yf={getNode:to,onWhiteSpace(e,t){no(e)&&(e.value=" "+e.value),no(t.last)&&(t.last.value+=" ")},expression:Vf,var:Xf},qf=Object.freeze(Object.defineProperty({__proto__:null,AtrulePrelude:If,Selector:Uf,Value:Yf},Symbol.toStringTag,{value:"Module"})),Gf=new Set(["none","and","not","or"]),Kf={parse:{prelude(){const e=this.createList();if(this.tokenType===m){const t=this.substring(this.tokenStart,this.tokenEnd);Gf.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}},Qf={parse:{prelude:null,block(){return this.Block(!0)}}};function Cn(e,t){return this.parseWithFallback(()=>{try{return e.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==b&&this.error()}},t||(()=>this.Raw(null,!0)))}const io={layer(){this.skipSC();const e=this.createList(),t=Cn.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();const e=this.createList(),t=Cn.call(this,this.Declaration,()=>Cn.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},Jf={parse:{prelude(){const e=this.createList();switch(this.tokenType){case wt:e.push(this.String());break;case Y:case C: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===C&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer(")&&e.push(this.Function(null,io)),this.skipSC(),this.tokenType===C&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,io)),(this.lookupNonWSType(0)===m||this.lookupNonWSType(0)===O)&&e.push(this.MediaQueryList()),e},block:null}},Zf={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}},td={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}},ed={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},nd={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},id={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}},sd={parse:{prelude:null,block(e=!1){return this.Block(e)}}},rd={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}},od={container:Kf,"font-face":Qf,import:Jf,layer:Zf,media:td,nest:ed,page:nd,scope:id,"starting-style":sd,supports:rd};function ld(){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 b:break t;default:this.error("Identifier, string or comma is expected")}this.skipSC()}return e}const Rt={parse(){return this.createSingleNodeList(this.SelectorList())}},xn={parse(){return this.createSingleNodeList(this.Selector())}},ad={parse(){return this.createSingleNodeList(this.Identifier())}},cd={parse:ld},Re={parse(){return this.createSingleNodeList(this.Nth())}},hd={dir:ad,has:Rt,lang:cd,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:xn,host:xn,"host-context":xn},ud=Object.freeze(Object.defineProperty({__proto__:null,AnPlusB:wi,Atrule:Li,AtrulePrelude:Ai,AttributeSelector:Oi,Block:Fi,Brackets:$i,CDC:Ni,CDO:Wi,ClassSelector:Ui,Combinator:Yi,Comment:Gi,Condition:Ji,Declaration:is,DeclarationList:rs,Dimension:ls,Feature:cs,FeatureFunction:us,FeatureRange:gs,Function:ys,GeneralEnclosed:ks,Hash:Ss,IdSelector:Ls,Identifier:Cs,Layer:As,LayerList:Ps,MediaQuery:Ds,MediaQueryList:Rs,NestingSelector:Fs,Nth:$s,Number:Ns,Operator:Ws,Parentheses:Us,Percentage:Xs,PseudoClassSelector:qs,PseudoElementSelector:Ks,Ratio:tr,Raw:nr,Rule:rr,Scope:lr,Selector:cr,SelectorList:ur,String:mr,StyleSheet:yr,SupportsDeclaration:kr,TypeSelector:wr,UnicodeRange:Tr,Url:Pr,Value:Dr,WhiteSpace:Rr},Symbol.toStringTag,{value:"Module"})),fd={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:qf,atrule:od,pseudo:hd,node:ud},dd=Tf(fd);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 pd="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",dt=(e=21)=>{let t="",n=e|0;for(;n--;)t+=pd[Math.random()*64|0];return t};const so=dt(),ce=new Set;function Fe(e){return!!(e&&e.type==="Function"&&e.name==="anchor")}function At(e,t=!1){return dd(e,{parseAtrulePrelude:!1,parseCustomProperty:!0,onParseError:n=>{t&&ce.add(n)}})}function tt(e){return kf(e,{mode:"spec"})}function md(e){return e.type==="Declaration"}function gd(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 Ln(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 _d(){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 yd(){ce.clear()}const Tn=[...$r,"anchor-scope","anchor-name"].reduce((e,t)=>(e[t]=`--${t}-${so}`,e),{});function bd(e,t){return md(e)&&Tn[e.property]&&t?(t.children.appendData(J(U({},e),{property:Tn[e.property]})),{updated:!0}):{}}function kd(e){for(const t of e){let n=!1;const i=At(t.css,!0);Tt(i,{visit:"Declaration",enter(s){var r;const l=(r=this.rule)==null?void 0:r.block,{updated:c}=bd(s,l);c&&(n=!0)}}),n&&(t.css=tt(i),t.changed=!0)}return e.some(t=>t.changed===!0)}var ro=(e=>(e.All="all",e.None="none",e))(ro||{});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 vd(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 Sd(e){let t=e;for(;t;){if(Qt(t,"overflow","scroll"))return t;t=t.parentElement}return t}function wd(e){let t=Sd(e);return t===document.documentElement&&(t=null),t??{scrollTop:0,scrollLeft:0}}function Cd(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}=vd(l,e),h=c.getBoundingClientRect(),{scrollY:u,scrollX:f}=globalThis,d=wd(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 xd(e,t){const n=ot(e,"anchor-name");return t?n.split(",").map(i=>i.trim()).includes(t):!n}function Ld(e,t){const n=ot(e,"anchor-scope");return n===t||n==="all"}const An=e=>P(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)]),oo="InvalidMimeType";function Td(e){return!!((e.type==="text/css"||e.rel==="stylesheet")&&e.href)}function Ad(e){const t=new URL(e.href,document.baseURI);if(Td(e)&&t.origin===location.origin)return t}function Ed(e){return P(this,null,function*(){return(yield Promise.all(e.map(t=>P(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=oo,l}const r=yield i.text();return J(U({},t),{css:r})}catch(i){if(i instanceof Error&&i.name===oo)return console.warn(i),null;throw i}})))).filter(t=>t!==null)})}const lo='[style*="anchor"]',ao='[style*="position-area"]';function Pd(e){const t=e?e.filter(i=>i instanceof HTMLElement&&(i.matches(lo)||i.matches(ao))):Array.from(document.querySelectorAll([lo,ao].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 Od(e){return P(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=Ad(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 Ed([...s,...l])})}const Dd="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let co=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Dd[n[e]&63];return t};const ho="--pa-cascade-property",uo="data-anchor-position-wrapper",fo="data-pa-wrapper-for-",po="POLYFILL-POSITION-AREA",Id=["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 mo(e){return Id.includes(e)}const go={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"]},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"],Md=["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"],Fd=["block-start","center","block-end","span-block-start","span-block-end","span-all"],jd=["inline-start","center","inline-end","span-inline-start","span-inline-end","span-all"],$d=["self-block-start","center","self-block-end","span-self-block-start","span-self-block-end","span-all"],zd=["self-inline-start","center","self-inline-end","span-self-inline-start","span-self-inline-end","span-all"],_o=["start","center","end","span-start","span-end","span-all"],yo=["self-start","center","self-end","span-self-start","span-self-end","span-all"],Nd=["block","top","bottom","y"],Hd=["inline","left","right","x"];function En(e){const t=e.split("-");for(const n of t){if(Nd.includes(n))return"block";if(Hd.includes(n))return"inline"}return"ambiguous"}function Wd(e,t){return t[0].includes(e[0])&&t[1].includes(e[1])||t[0].includes(e[1])&&t[1].includes(e[0])}const Bd=[[Rd,Md],[Fd,jd],[$d,zd],[_o,_o],[yo,yo]];function Ud(e){for(const t of Bd)if(Wd(e,t))return!0;return!1}const bo=e=>{const t=getComputedStyle(e);return{writingMode:t.writingMode,direction:t.direction}},Vd=(e,t)=>P(null,null,function*(){const n=yield An(e);switch(t){case"Logical":case"Physical":return bo(n);case"LogicalSelf":case"PhysicalSelf":return bo(e);default:return null}}),Pn=e=>e.reverse().map(t=>3-t),ko=(e,t)=>e==="Irrelevant"?t:e,Xd=(e,t)=>P(null,[e,t],function*({block:n,inline:i},s){const r=ko(n[2],i[2]),l=yield Vd(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}),Yd=({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 vo([e,t]){return e===0&&t===3?"center":e===0?"end":t===3?"start":"center"}function qd(e){return e.type==="Declaration"&&e.property==="position-area"}function Gd(e){const t=e.value.children.toArray().map(({name:n})=>n);return t.length===1&&(En(t[0])==="ambiguous"?t.push(t[0]):t.push("span-all")),t}function Kd(e){if(!qd(e))return;const t=Gd(e);if(!Ud(t))return;const n={};switch(En(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":En(t[1])=="block"?(n.block=t[1],n.inline=t[0]):(n.inline=t[1],n.block=t[0]);break}const i={block:go[n.block],inline:go[n.inline]},s=`--pa-declaration-${co(12)}`;return{values:n,grid:i,selectorUUID:s}}function Qd(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:ho,value:{type:"Raw",value:e.selectorUUID},important:!1})}function Jd(e,t){var n,i;let s;if(((n=e.parentElement)==null?void 0:n.tagName)===po)s=e.parentElement;else{s=document.createElement(po),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(`${fo}${t}`,""),s}function Zd(e,t,n){return P(this,null,function*(){const i=`--pa-target-${co(12)}`,s=yield Xd(t.grid,e),r=Yd(s),l=ko(t.grid.block[2],t.grid.inline[2]),c=["LogicalSelf","PhysicalSelf"].includes(l)?s:t.grid,a={block:vo([c.block[0],c.block[1]]),inline:vo([c.inline[0],c.inline[1]])};return{insets:r,alignments:a,targetUUID:i,targetEl:e,anchorEl:n,wrapperEl:Jd(e,i),values:t.values,grid:t.grid,selectorUUID:t.selectorUUID}})}function tp(e,t){return`
|
|
22
|
-
[${uo}="${t}"][${fo}${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 ep=["normal","most-width","most-height","most-block-size","most-inline-size"],np=["flip-block","flip-inline","flip-start"];function ip(e){return e.type==="Declaration"}function sp(e){return e.type==="Declaration"&&e.property==="position-try-fallbacks"}function rp(e){return e.type==="Declaration"&&e.property==="position-try-order"}function op(e){return e.type==="Declaration"&&e.property==="position-try"}function lp(e){return e.type==="Atrule"&&e.name==="position-try"}function ap(e){return np.includes(e)}function cp(e){return ep.includes(e)}function hp(e,t){const n=document.querySelector(e);if(n){let i=fp(n);return t.forEach(s=>{i=So(i,s)}),i}}function up(e,t){let n=e.declarations;return t.forEach(i=>{n=So(n,i)}),n}function fp(e){const t={};return $r.forEach(n=>{const i=ot(e,`--${n}-${so}`);i&&(t[n]=i)}),t}const dp={"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"}},pp={"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"}},mp={"flip-block":{top:"bottom",bottom:"top",start:"end",end:"start"},"flip-inline":{left:"right",right:"left",start:"end",end:"start"},"flip-start":{}};function gp(e,t){return dp[t][e]||e}function _p(e,t){return pp[t][e]||e}function yp(e,t){if(t==="flip-start")return e;{const n=mp[t];return e.split("-").map(i=>n[i]||i).join("-")}}function bp(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 kp=(e,t)=>{var n;return((n=At(`#id{${e}: ${t};}`).children.first)==null?void 0:n.block.children.first).value};function So(e,t){const n={};return Object.entries(e).forEach(([i,s])=>{const r=i,l=kp(r,s),c=gp(r,t);c!==r&&(n[r]!=null||(n[r]="revert")),Tt(l,{visit:"Function",enter(a){Fe(a)&&a.children.forEach(o=>{ue(o)&&Nr(o.name)&&(o.name=_p(o.name,t))})}}),r==="position-area"&&l.children.forEach(a=>{ue(a)&&mo(a.name)&&(a.name=yp(a.name,t))}),r.startsWith("margin")&&bp(r,l,t),n[c]=tt(l)}),n}function wo(e){const t=gd(e),n=[];return t.forEach(i=>{const s={atRules:[],tactics:[],positionAreas:[]};i.forEach(r=>{ap(r.name)?s.tactics.push(r.name):r.name.startsWith("--")?s.atRules.push(r.name):mo(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 vp(e){return sp(e)&&e.value.children.first?wo(e.value.children):[]}function Sp(e){if(op(e)&&e.value.children.first){const t=Me(e);let n;const i=t.value.children.first.name;i&&cp(i)&&(n=i,t.value.children.shift());const s=wo(t.value.children);return{order:n,options:s}}return{}}function wp(e){return rp(e)&&e.value.children.first?{order:e.value.children.first.name}:{}}function Cp(e){const{order:t,options:n}=Sp(e);if(t||n)return{order:t,options:n};const{order:i}=wp(e),s=vp(e);return i||s?{order:i,options:s}:{}}function xp(e){return ae(e.property)||nf(e.property)||Fr(e.property)||sf(e.property)||["position-anchor","position-area"].includes(e.property)}function Lp(e){var t,n;if(lp(e)&&(t=e.prelude)!=null&&t.value&&(n=e.block)!=null&&n.children){const i=e.prelude.value,s=e.block.children.filter(l=>ip(l)&&xp(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=At(s.css);Tt(r,{visit:"Atrule",enter(l){const{name:c,tryBlock:a}=Lp(l);c&&a&&(t[c]=a)}})}for(const s of e){let r=!1;const l=new Set,c=At(s.css);Tt(c,{visit:"Declaration",enter(a){var o;const h=(o=this.rule)==null?void 0:o.prelude,u=Ln(h);if(!u.length)return;const{order:f,options:d}=Cp(a),p={};f&&(p.order=f),u.forEach(({selector:g})=>{var y;d?.forEach(_=>{var S;let x;if(_.type==="at-rule")x=_.atRule;else if(_.type==="try-tactic"){x=`${g}-${_.tactics.join("-")}`;const A=hp(g,_.tactics);A&&(t[x]={uuid:`${g}-${_.tactics.join("-")}-try-${dt(12)}`,declarations:A})}else if(_.type==="at-rule-with-try-tactic"){x=`${g}-${_.atRule}-${_.tactics.join("-")}`;const A=t[_.atRule],pt=up(A,_.tactics);pt&&(t[x]={uuid:`${g}-${_.atRule}-${_.tactics.join("-")}-try-${dt(12)}`,declarations:pt})}if(x&&t[x]){const A=`[data-anchor-polyfill="${t[x].uuid}"]`;n[A]!=null||(n[A]=[]),n[A].push(g),l.has(x)||(p.fallbacks!=null||(p.fallbacks=[]),p.fallbacks.push(t[x]),l.add(x),(S=this.stylesheet)==null||S.children.prependData({type:"Rule",prelude:{type:"Raw",value:A},block:{type:"Block",children:new K().fromArray(Object.entries(t[x].declarations).map(([pt,w])=>({type:"Declaration",important:!0,property:pt,value:{type:"Raw",value:w}})))}}),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 Ap(e,t){return!e||e===t?!1:Co(e)?e.document.contains(t):e.contains(t)}function Co(e){return!!(e&&e===e.window)}function Ep(e){return Qt(e,"position","fixed")}function On(e){return!!(e&&(Ep(e)||Qt(e,"position","absolute")))}function xo(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING}function Pp(e){return P(this,null,function*(){return yield nt.getOffsetParent(e)})}function Dn(e){return P(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 Op(e,t,n,i){return P(this,null,function*(){const s=yield Dn(e),r=yield Dn(n);if(!(Ap(r,e)||Co(r))||s===r&&!(!On(e)||xo(e,n)))return!1;if(s!==r){let l;const c=[];for(l=s;l&&l!==r&&l!==window;)c.push(l),l=yield Dn(l);const a=c[c.length-1];if(a instanceof HTMLElement&&!(!On(a)||xo(a,n)))return!1}{let l=e.parentElement;for(;l;){if(Qt(l,"content-visibility","hidden"))return!1;l=l.parentElement}}return!(t&&i&&Lo(e,t,i)!==Lo(n,t,i))})}function Lo(e,t,n){for(;!(e.matches(n)&&Ld(e,t));){if(!e.parentElement)return null;e=e.parentElement}return e}function Dp(e,t,n,i,s){return P(this,null,function*(){if(!(e instanceof HTMLElement&&n.length&&On(e)))return null;const r=n.flatMap(c=>Cd(c,s)).filter(c=>xd(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 Op(o?a.fakePseudoElement:a,t,e,l))return o&&a.removeFakePseudoElement(),a}return null})}function Ip(e){return e.type==="Declaration"&&e.property==="anchor-name"}function Rp(e){return e.type==="Declaration"&&e.property==="anchor-scope"}function In(e){return!!(e&&e.type==="Function"&&e.name==="anchor-size")}function je(e){return!!(e&&e.type==="Function"&&e.name==="var")}function ue(e){return!!(e.type==="Identifier"&&e.name)}function Mp(e){return!!(e.type==="Percentage"&&e.value)}function To(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:je(o)&&o.children.first&&(c=o.children.first.name)),h)if(Fe(e)){if(ue(h)&&Nr(h.name))i=h.name;else if(Mp(h)){const f=Number(h.value);i=Number.isNaN(f)?void 0:f}}else In(e)&&ue(h)&&af(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 Ao(e){return e.value.children.map(({name:t})=>t)}let fe={},Mt={},Ft={},de={},jt={};function Fp(){fe={},Mt={},Ft={},de={},jt={}}function jp(e,t){var n;if((Fe(e)||In(e))&&t){if(t.property.startsWith("--")){const i=tt(t.value),s=To(e);return de[s.uuid]=i,Ft[t.property]=[...(n=Ft[t.property])!=null?n:[],s],{changed:!0}}if(Fe(e)&&ae(t.property)||In(e)&&zr(t.property)){const i=To(e);return{prop:t.property,data:i,changed:!0}}}return{}}function Eo(e,t,n){return P(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[ro.All]||[]:[],c=i?Mt[i]||[]:[];return yield Dp(e,i||null,r,[...l,...c],{roots:n.roots})})}function $p(e,t){return P(this,null,function*(){var n,i,s,r,l,c,a,o,h,u,f;const d={},p={};Fp();const{fallbackTargets:g,validPositions:y}=Tp(e);for(const w of e){let M=!1;const H=At(w.css);Tt(H,function(E){var W,F,D,V;const R=(W=this.rule)==null?void 0:W.prelude,j=Ln(R);if(Ip(E)&&j.length)for(const $ of Ao(E))fe[$]!=null||(fe[$]=[]),fe[$].push(...j);if(Rp(E)&&j.length)for(const $ of Ao(E))Mt[$]!=null||(Mt[$]=[]),Mt[$].push(...j);const{prop:Q,data:St,changed:$t}=jp(E,this.declaration);if(Q&&St&&j.length)for(const{selector:$}of j)d[$]=J(U({},d[$]),{[Q]:[...(D=(F=d[$])==null?void 0:F[Q])!=null?D:[],St]});let X;if(this.block&&(X=Kd(E),X)){Qd(X,this.block);for(const{selector:$}of j)p[$]=[...(V=p[$])!=null?V:[],X]}($t||X)&&(M=!0)}),M&&(w.css=tt(H),w.changed=!0)}const _=new Set(Object.keys(Ft)),S={},x=w=>{var M,H,E,W,F;const D=[],V=new Set((H=(M=S[w])==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=S[R])==null?void 0:W.names)!=null&&F.length&&S[R].names.forEach(j=>V.add(j));return D};for(;_.size>0;){const w=[];for(const M of e){let H=!1;const E=At(M.css);Tt(E,{visit:"Function",enter(W){var F,D;const V=(F=this.rule)==null?void 0:F.prelude,R=this.declaration,j=R?.property;if(V?.children.isEmpty===!1&&je(W)&&R&&j&&W.children.first&&_.has(W.children.first.name)&&j.startsWith("--")){const Q=W.children.first,St=(D=Ft[Q.name])!=null?D:[],$t=x(Q.name);if(!(St.length||$t.length))return;const X=`${Q.name}-anchor-${dt(12)}`,$=tt(R.value);de[X]=$,S[j]||(S[j]={names:[],uuids:[]});const Jt=S[j];Jt.names.includes(Q.name)||Jt.names.push(Q.name),Jt.uuids.push(X),w.push(j),Q.name=X,H=!0}}}),H&&(M.css=tt(E),M.changed=!0)}_.clear(),w.forEach(M=>_.add(M))}for(const w of e){let M=!1;const H=At(w.css);Tt(H,{visit:"Function",enter(E){var W,F,D,V,R,j,Q;const St=(W=this.rule)==null?void 0:W.prelude,$t=this.declaration,X=$t?.property;if(St?.children.isEmpty===!1&&je(E)&&$t&&X&&E.children.first&&(ae(X)||Fr(X))){const $=E.children.first,Jt=(F=Ft[$.name])!=null?F:[],Mn=x($.name);if(!(Jt.length||Mn.length))return;const Ne=`${X}-${dt(12)}`;if(Mn.length){const Zt=new Set([$.name]);for(;Zt.size>0;)for(const te of Zt){const lt=S[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)jt[ne]=J(U({},jt[ne]),{[Ne]:`${ee}-${Ne}`});Zt.delete(te),(R=lt?.names)!=null&&R.length&<.names.forEach(ee=>Zt.add(ee))}}const Zp=Ln(St);for(const Zt of[...Jt,...Mn]){const te=U({},Zt),lt=`--anchor-${dt(12)}-${X}`,ee=te.uuid;te.uuid=lt;for(const{selector:ne}of Zp)d[ne]=J(U({},d[ne]),{[X]:[...(Q=(j=d[ne])==null?void 0:j[X])!=null?Q:[],te]});jt[ee]=J(U({},jt[ee]),{[Ne]:lt})}$.name=`${$.name}-${Ne}`,M=!0}}}),M&&(w.css=tt(H),w.changed=!0)}if(Object.keys(jt).length>0)for(const w of e){let M=!1;const H=At(w.css);Tt(H,{visit:"Function",enter(E){var W,F,D,V;if(je(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,j=jt[R.name];if(j)for(const[Q,St]of Object.entries(j))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&&(w.css=tt(H),w.changed=!0)}const A=new Map;for(const[w,M]of Object.entries(d)){let H;w.startsWith("[data-anchor-polyfill=")&&(n=g[w])!=null&&n.length?H=he(t.roots,g[w].join(",")):H=he(t.roots,w);for(const[E,W]of Object.entries(M))for(const F of W)for(const D of H){const V=yield Eo(D,F,{roots:t.roots}),R=`--anchor-${dt(12)}`;A.set(D,J(U({},(i=A.get(D))!=null?i:{}),{[F.uuid]:R})),D.setAttribute("style",`${F.uuid}: var(${R}); ${(s=D.getAttribute("style"))!=null?s:""}`),y[w]=J(U({},y[w]),{declarations:J(U({},(r=y[w])==null?void 0:r.declarations),{[E]:[...(a=(c=(l=y[w])==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[w,M]of Object.entries(p)){const H=he(t.roots,w);for(const E of H){const W=yield Eo(E,null,{roots:t.roots});for(const F of M){const D=yield Zd(E,F,W);pt.css+=tp(D.targetUUID,F.selectorUUID),pt.changed=!0,y[w]=J(U({},y[w]),{declarations:J(U({},(o=y[w])==null?void 0:o.declarations),{"position-area":[...(f=(u=(h=y[w])==null?void 0:h.declarations)==null?void 0:u["position-area"])!=null?f:[],D]})})}}}return{rules:y,inlineStyles:A,anchorScopes:Mt}})}const zp=["as","blocking","crossorigin","disabled","fetchpriority","href","hreflang","integrity","referrerpolicy","rel","type"];function Po(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")&&!zp.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 Np=J(U({},nt),{_c:new Map}),Hp=(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},Wp=(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},Oo=e=>{switch(e){case"top":case"bottom":return"y";case"left":case"right":return"x"}return null},Bp=e=>{switch(e){case"x":return"width";case"y":return"height"}return null},Do=e=>ot(e,"display")==="inline",Io=(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,$e=(e,t)=>parseInt(ot(e,`margin-${t}`),10)||0,Up=e=>({top:$e(e,"top"),right:$e(e,"right"),bottom:$e(e,"bottom"),left:$e(e,"left")}),Rn=e=>P(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(!zr(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=Wp(r,o)}}return a?`${i[a]}px`:l}if(s!==void 0){let a,o;const h=Oo(n);if(!(ae(n)&&h&&(!ae(s)||h===Oo(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=Hp(s,p)}}const f=typeof a=="number"&&!Number.isNaN(a),d=Bp(h);if(f&&d){(n==="bottom"||n==="right")&&(o=yield An(t));let p=i[h]+i[d]*(a/100);switch(n){case"bottom":{if(!o)break;let g=o.clientHeight;if(g===0&&Do(o)){const y=Io(o,h);g=o.offsetHeight-y}p=g-p;break}case"right":{if(!o)break;let g=o.clientWidth;if(g===0&&Do(o)){const y=Io(o,h);g=o.offsetWidth-y}p=g-p;break}}return`${p}px`}}return l}),Vp=e=>"wrapperEl"in e,Xp=e=>"uuid"in e;function Yp(e,t=!1){return P(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(Vp(r)){const a=r.wrapperEl,o=(h,u,f)=>P(null,null,function*(){return h===0?"0px":yield Rn({targetEl:a,targetProperty:u,anchorRect:f,anchorSide:h})});Qe(l,a,()=>P(null,null,function*(){const h=ot(c,ho);a.setAttribute(uo,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 Qe(l,c,()=>P(null,null,function*(){const a=yield nt.getElementRects({reference:l,floating:c,strategy:"absolute"}),o=yield Rn({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(Xp(r)){const a=yield Rn({targetProperty:i,anchorSide:r.anchorSide,anchorSize:r.anchorSize,fallback:r.fallbackValue});n.style.setProperty(r.uuid,a)}}})}function Ro(e,t){return P(this,null,function*(){const n=yield nt.getElementRects({reference:e,floating:e,strategy:"absolute"});return yield Xl({x:e.offsetLeft,y:e.offsetTop,platform:Np,rects:n,elements:{floating:e,reference:t},strategy:"absolute"},{padding:Up(e)})})}function qp(e,t,n=!1){return P(this,null,function*(){if(!t.length)return;const i=document.querySelectorAll(e);for(const s of i){let r=!1;const l=yield An(s);Qe({},s,()=>P(null,null,function*(){if(r)return;r=!0,s.removeAttribute("data-anchor-polyfill");const c=yield Ro(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 Ro(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 Gp(e,t=!1){return P(this,null,function*(){var n,i;for(const s of Object.values(e))yield Yp((n=s.declarations)!=null?n:{},t);for(const[s,r]of Object.entries(e))yield qp(s,(i=r.fallbacks)!=null?i:[],t)})}function Kp(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 Qp(e){return P(this,null,function*(){const t=Kp(e??window.ANCHOR_POSITIONING_POLYFILL_OPTIONS);let n=yield Od(t),i={},s;yd();try{kd(n)&&(n=Po(n));const r=yield $p(n,{roots:t.roots});i=r.rules,s=r.inlineStyles}catch(r){throw _d(),r}return Object.values(i).length&&(Po(n,s,!0),yield Gp(i,t.useAnimationFrame)),i})}const Jp=Object.freeze(Object.defineProperty({__proto__:null,default:Qp},Symbol.toStringTag,{value:"Module"}));k.ActiveDescendantController=jo,k.AnchorController=Ko,k.ClickDelegateController=$o,k.DEFAULT_INTERACTIVE_SELECTOR=Fn,k.DragController=Vo,k.DragGestureController=Be,k.ItemsCollectionController=We,k.MutationObserverController=Jo,k.NativeChildController=sl,k.NavigationIndicatorController=Zo,k.RafScheduler=tl,k.ResizeController=Xo,k.RovingTabIndexMixin=ll,k.ScrollObserverController=Qo,k.TypeaheadController=el,k.delegateClickTo=$n,k.findExtremeSnapIndex=fl,k.findNearestScrollAncestor=nl,k.findNearestSnapIndex=hl,k.findNextSnapIndex=ul,k.getDirectChild=Un,k.getDirectChildren=Vn,k.isEventFromInteractiveDescendant=jn,k.isFocusable=Bn,k.keyInteraction=No,k.keyNavigation=Wo,k.mouseMove=Uo,k.pinElementBox=zn,k.snapToStep=al,k.valueToPercent=cl,k.warnMissingDirectChild=il,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
|
|
15
|
+
`;return this._injectStyles(f),!0}_injectStyles(t){const e=this._shadowHost();if(e?.shadowRoot)this._adoptedSheet||(this._adoptedSheet=new CSSStyleSheet,e.shadowRoot.adoptedStyleSheets=[...e.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(),e=this._floating();if(!t||!e)return;const i=this._physicalPlacement(t),s=this._opts.offset??4,o=this._opts.flip??!0,r=4,a=t.getBoundingClientRect(),h=t.ownerDocument.defaultView;if(!h)return;const l=tt(h),_=h.innerWidth,u=h.innerHeight,d=g(e),f=s*d;e.style.position="fixed",e.style.boxSizing="border-box",e.style.minWidth=`${a.width/d}px`,e.style.top="",e.style.bottom="",e.style.left="",e.style.right="";const p=(e.offsetWidth||a.width/d)*d,m=e.offsetHeight*d,v=i.split("-")[0],w=i.endsWith("-start")?"start":i.endsWith("-end")?"end":"center";let E=v;if(v==="top"||v==="bottom"){const x=l.bottom-a.bottom,A=a.top-l.top;o&&(v==="bottom"&&x<m+f&&A>x?E="top":v==="top"&&A<m+f&&x>A&&(E="bottom")),E==="top"?e.style.bottom=`${(u-a.top+f)/d}px`:e.style.top=`${(a.bottom+f)/d}px`;let S=w==="end"?a.right-p:w==="start"?a.left:a.left+a.width/2-p/2;S=Math.max(l.left+r,Math.min(S,l.right-p-r)),e.style.left=`${S/d}px`}else{const x=l.right-a.right,A=a.left-l.left;o&&(v==="right"&&x<p+f&&A>x?E="left":v==="left"&&A<p+f&&x>A&&(E="right")),E==="left"?e.style.right=`${(_-a.left+f)/d}px`:e.style.left=`${(a.right+f)/d}px`;let S=w==="end"?a.bottom-m:w==="start"?a.top:a.top+a.height/2-m/2;S=Math.max(l.top+r,Math.min(S,l.bottom-m-r)),e.style.top=`${S/d}px`}}_cleanup(){this._stopClampLoop(),this._stopWatchingGeometry(),this._appliedTranslateXCssPx=0,this._appliedTranslateYCssPx=0;const t=this._anchor(),e=this._floating();t&&t.style.removeProperty("anchor-name"),e&&(e.removeAttribute("data-rc-anchor"),e.style.translate="",e.style.removeProperty("--rc-anchor-viewport-inline-size"),e.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)}}const et="data-rc-popover-fallback-open";class ie{constructor(t,e){this._current=null,this._connected=!1,this._element=e.element,t.addController(this)}hostConnected(){this._connected=!0}hostDisconnected(){this._connected=!1,this._close(this._current),this._current=null}sync(t){const e=typeof this._element=="function"?this._element():this._element;if(e!==this._current&&(this._close(this._current),this._current=e),!(!this._connected||!e?.isConnected)){if(!t){this._close(e);return}if(!e.hasAttribute(et)){try{if(typeof e.showPopover=="function"){e.matches(":popover-open")||e.showPopover();return}}catch{}e.setAttribute(et,"")}}}_close(t){if(t){t.removeAttribute(et);try{typeof t.hidePopover=="function"&&t.matches(":popover-open")&&t.hidePopover()}catch{}}}}class se{constructor(t,e){this._attached=null,this._scrolled=!1,this._initialFrame=new V,this._onScroll=()=>this._evaluate(),this._disposed=!1,this._host=t,this._opts=e,t.addController(this)}get scrolled(){return this._scrolled}setOptions(t){this._disposed||(this._detach(),Object.assign(this._opts,t),this._attach())}hostConnected(){this._disposed||this._attach()}hostDisconnected(){this._detach()}dispose(){this._disposed||(this._disposed=!0,this._detach(),this._host.removeController(this))}_resolveTarget(){const{target:t}=this._opts;return typeof t=="function"?t():t??null}_attach(){if(!(this._opts.disabled||this._attached)){if(this._opts.initialEvaluation==="frame"){this._queueAttach();return}this._attachNow()}}_attachNow(){if(this._opts.disabled||this._attached)return;const t=this._resolveTarget();t&&(this._attached=t,t.addEventListener("scroll",this._onScroll,{passive:!0}),this._evaluate())}_queueAttach(){this._initialFrame.schedulePhased(()=>{const t=this._resolveTarget();return t?{target:t,scrollTop:this._scrollTop(t)}:null},t=>{if(!(!t||this._opts.disabled||this._attached)){if(this._resolveTarget()!==t.target){this._attach();return}this._attached=t.target,t.target.addEventListener("scroll",this._onScroll,{passive:!0}),this._applyScrollTop(t.scrollTop)}})}_detach(){this._initialFrame.cancel(),this._attached?.removeEventListener("scroll",this._onScroll),this._attached=null,this._lastScrollTop=void 0}_scrollTop(t=this._attached){return t instanceof Element?t.scrollTop:t instanceof Document?t.scrollingElement?.scrollTop??0:t?.scrollY??0}_evaluate(){this._attached&&this._applyScrollTop(this._scrollTop())}_applyScrollTop(t){const e=t-(this._lastScrollTop??t);this._lastScrollTop=t,this._opts.onScroll?.(t,e);const i=t>(this._opts.threshold??4);i!==this._scrolled&&(this._scrolled=i,this._opts.onChange?.(i,t),this._host.requestUpdate())}}class ne{constructor(t,e){this._attached=null,this._observer=null,this._options=e,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 oe{constructor(t,e){this._frame=0,this._links=[],this._host=t,this._options=e,t.addController(this)}hostConnected(){this._unobserveLocale??=R(()=>this.update(),this._host),this.sync()}hostDisconnected(){this._mutationObserver?.disconnect(),this._resizeObserver?.disconnect(),this._unobserveLocale?.(),this._mutationObserver=void 0,this._resizeObserver=void 0,this._unobserveLocale=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 e=this._options.slot()?.assignedElements({flatten:!0})??[],i=new Set;for(const s of e)s instanceof HTMLAnchorElement&&i.add(s),s.querySelectorAll("a").forEach(o=>i.add(o));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 e=this._targetFor(t);e&&e!==t&&this._resizeObserver.observe(e)}}_activeLink(){const t=this._options.activeSelector().trim();if(t){const e=this._links.find(i=>i.matches(t));if(e)return e}return this._links.find(e=>{const i=e.getAttribute("aria-current");return i!==null&&i!==""&&i!=="false"})??null}_targetFor(t){const e=this._options.indicatorTargetSelector().trim();if(e){const i=t.matches(e)?t:t.querySelector(e);if(i)return i}return t.querySelector("[data-rc-navigation-indicator]")??t.querySelector("[data-rc-navigation-icon]")??t}_positionIndicator(){const t=this._options.container(),e=this._options.indicator(),i=this._activeLink();if(this._host.toggleAttribute("has-active",!!i),!t||!e||!i){e?.toggleAttribute("hidden",!0);return}const s=this._targetFor(i),o=t.getBoundingClientRect(),r=s.getBoundingClientRect();if(!r.width||!r.height){e.toggleAttribute("hidden",!0);return}const a=y(t),h=j(r,o,a),{x:l,y:_}=q({inline:h.inlineStart,block:h.blockStart},a),u=g(e);e.toggleAttribute("hidden",!1),e.style.inlineSize=`${h.inlineSize/u}px`,e.style.blockSize=`${h.blockSize/u}px`,e.style.transform=`translate(${l/u}px, ${_/u}px)`}}const re=new Map,ae=new Map;function pt(n,t,e,i){const s=`${e??""}|${JSON.stringify(i)}`;let o=n.get(s);return o||(o=t(e,i),n.set(s,o)),o}function mt(n,t={}){return pt(re,(e,i)=>{try{return new Intl.NumberFormat(e,i)}catch{return new Intl.NumberFormat(void 0,i)}},n,t)}function gt(n,t={}){return pt(ae,(e,i)=>{try{return new Intl.Collator(e,i)}catch{return new Intl.Collator(void 0,i)}},n,t)}const bt=new Map;function*he(n,t){if(typeof Intl.Segmenter=="function"){const i=t??"";let s=bt.get(i);if(!s){try{s=new Intl.Segmenter(t,{granularity:"grapheme"})}catch{s=new Intl.Segmenter(void 0,{granularity:"grapheme"})}bt.set(i,s)}for(const o of s.segment(n))yield n.slice(0,o.index+o.segment.length);return}let e=0;for(const i of n)e+=i.length,yield n.slice(0,e)}class le{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,this._scheduleReset();const e=this._options.items();if(!e.length)return null;const i=this._options.startIndex?.()??0,s=e.length,o=this._options.locale?.(),r=gt(o,{sensitivity:"base",usage:"search"});for(let a=1;a<=s;a+=1){const h=(i+a)%s,l=e[h],_=this._options.text(l).trim();for(const u of he(_,o))if(r.compare(u,this._buffer)===0)return this._options.onMatch(l,h),l}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)}}const ce=["","date","datetime-local","email","month","number","password","search","tel","text","time","url","week"],_e=1e3;function $(n){let t=n.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function ue(n){return n instanceof HTMLTextAreaElement?!n.readOnly&&!n.disabled:n instanceof HTMLInputElement?!n.readOnly&&!n.disabled&&ce.includes(n.type):n instanceof HTMLElement&&n.isContentEditable}function de(n){return ue($(n))}class fe{constructor(t={}){this._full=null,this._applied=null,this._keyboardOpen=!1,this._closeTimer=null,this._heightWhileOpen=t.heightWhileOpen??"keyboard",this._closeTimeout=t.closeTimeout??_e,this._onCloseTimeout=t.onCloseTimeout}get keyboardOpen(){return this._keyboardOpen}next(t,e){const i=this._full;return!i||!this._applied||t.width!==this._applied.width?this._settle(t):t.height>=i.height?this._settle(t):e?(this._clearCloseTimer(),this._keyboardOpen=!0,this._apply(this._heightWhileOpen==="full"?{...t,height:i.height}:t)):this._keyboardOpen?(this._startCloseTimer(),this._heightWhileOpen==="full"||t.height<this._applied.height?this._apply({...t,height:this._applied.height}):this._apply(t)):this._settle(t)}reset(){this._clearCloseTimer(),this._full=null,this._applied=null,this._keyboardOpen=!1}_settle(t){return this._clearCloseTimer(),this._keyboardOpen=!1,this._full=t,this._apply(t)}_apply(t){return this._applied=t,t}_startCloseTimer(){this._closeTimer===null&&(this._closeTimer=setTimeout(()=>{this._closeTimer=null,this._keyboardOpen=!1,this._full=null,this._onCloseTimeout?.()},this._closeTimeout))}_clearCloseTimer(){this._closeTimer!==null&&(clearTimeout(this._closeTimer),this._closeTimer=null)}}function pe(n,...t){return n.reduce((e,i,s)=>e+String(t[s-1])+i)}function vt(n){const t=n.ownerDocument;let e=yt(n);for(;e&&e!==t.documentElement;){const{overflow:i,overflowY:s}=getComputedStyle(e);if(/auto|scroll/.test(s)||/auto|scroll/.test(i))return e;e=yt(e)}return t.scrollingElement??t.documentElement}function yt(n){if(n.assignedSlot)return n.assignedSlot;if(n.parentElement)return n.parentElement;const t=n.getRootNode();return t instanceof ShadowRoot?t.host:null}function me(n,t){return n.inline===t.inline&&n.inlineReversed===t.inlineReversed&&n.blockReversed===t.blockReversed&&n.rtl===t.rtl}class ge{constructor(t){this._flow=H,this._observer=null,this._unobserveLocale=null,this._frame=new V,this._host=t,t.addController(this)}get flow(){return this._flow}hostConnected(){this._scheduleRefresh(),this._unobserveLocale??=R(()=>this._scheduleRefresh(),this._host),typeof ResizeObserver=="function"&&(this._observer??=new ResizeObserver(()=>this._scheduleRefresh()),this._observer.observe(this._host))}hostDisconnected(){this._frame.cancel(),this._observer?.disconnect(),this._unobserveLocale?.(),this._unobserveLocale=null}refresh(){this._frame.cancel(),this._apply(y(this._host))}_scheduleRefresh(){this._frame.schedulePhased(()=>y(this._host),t=>this._apply(t))}_apply(t){me(t,this._flow)||(this._flow=t,this._host.requestUpdate())}}function wt(n){return n==null||n.hasAttribute("disabled")?!1:!!((n instanceof HTMLAnchorElement||n instanceof HTMLAreaElement)&&n.hasAttribute("href")||n instanceof HTMLButtonElement||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement||n.hasAttribute("tabindex")||n.shadowRoot?.delegatesFocus===!0)}function Et(n,t){return Array.from(n.querySelectorAll(t))}function be(n,t){if(Et(n,t.selector).length>=(t.minimum??1))return!1;const e=t.hostName??n.localName,i=t.childDescription??t.selector.replace(":scope > ",""),s=t.message??`[${e}] No direct child ${i} found. Place ${i} inside <${e}>.`;return console.warn(s,n),!0}class ve{constructor(t,e){this._observer=null,this._child=null,this._host=t,this._options=e,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,e=this._host.querySelector(this._options.selector);return this._child=e,e||this._options.onMissing?.(this._host),e!==t&&this._options.onChange?.(e,t),e}}var ye=Object.defineProperty,we=(n,t,e,i)=>{for(var s=void 0,o=n.length-1,r;o>=0;o--)(r=n[o])&&(s=r(t,e,s)||s);return s&&ye(t,e,s),s};function Ee(n){class t extends n{constructor(){super(...arguments),this._items=[]}get items(){return this._items.map(i=>i.deref()).filter(i=>wt(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(o=>this.items.includes(o));s!=null&&(this._lastFocused=s,this.items.forEach(o=>o.setAttribute("tabindex","-1")),s.setAttribute("tabindex","0"))}_onSlotChange(i){const s=this._items;this._items=this._collectItems(i.currentTarget).map(o=>new WeakRef(o)),queueMicrotask(()=>{this.isConnected&&(s.forEach(o=>o.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 we([kt.state()],t.prototype,"_lastFocused"),t}function Ce(n,t,e,i){const s=Math.min(Math.max(n,t),e);if(i<=0)return s;const o=Math.round((s-t)/i)*i+t;return Math.min(Math.max(o,t),e)}function Te(n,t,e){return e===t?0:Math.min(Math.max((n-t)/(e-t),0),1)}function ke(n,t){let e=-1,i=1/0;return n.forEach((s,o)=>{const r=Math.abs(s-t);Number.isFinite(s)&&r<i&&(e=o,i=r)}),e}function xe(n,t,e){if(e>0){const i=n.findIndex(s=>Number.isFinite(s)&&s>t);return i>=0?i:n.length-1}for(let i=n.length-1;i>=0;i-=1)if(Number.isFinite(n[i])&&n[i]<t)return i;return n.length>0?0:-1}function Ae(n,t){return n.length===0?-1:t>0?n.length-1:0}const Se=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(ms|s)?$/i;function Le(n){const t=Se.exec(n.trim());if(!t)return;const[,e,i]=t,s=Number(e)*(i?.toLowerCase()==="s"?1e3:1);return Number.isFinite(s)&&s>=0?s:void 0}class Ct{constructor(t){const e=t.ownerDocument??t;this._$region=e.createElement("div"),this._$region.setAttribute("role","status"),this._$region.setAttribute("aria-live","polite"),this._$region.setAttribute("aria-atomic","true"),this._$region.setAttribute("data-rc-live-announcer",""),Object.assign(this._$region.style,{position:"absolute",inlineSize:"1px",blockSize:"1px",margin:"-1px",padding:"0",overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap",border:"0"}),t.appendChild(this._$region)}get element(){return this._$region}announce(t){clearTimeout(this._clearTimer),this._$region.textContent="",this._clearTimer=setTimeout(()=>{this._$region.textContent=t},50)}dispose(){clearTimeout(this._clearTimer),this._$region.remove()}}function T(n,t){return mt(t,{useGrouping:!1}).format(n)}const Tt=Object.freeze({instructions:"Press Space to reorder.",grabbed:(n,t,e)=>`Picked up, position ${T(n,e)} of ${T(t,e)}. Use the arrow keys to move, Space to drop, Escape to cancel.`,moved:(n,t,e)=>`Moved to position ${T(n,e)} of ${T(t,e)}.`,dropped:(n,t,e)=>`Dropped at position ${T(n,e)} of ${T(t,e)}.`,canceled:(n,t,e)=>`Reorder canceled. Back at position ${T(n,e)} of ${T(t,e)}.`}),Pe=16;class De{constructor(t,e){this._activeGesture=null,this._pending=null,this._session=null,this._translated=new Map,this._announcer=null,this._autoScrollFrame=0,this._restoringFocus=!1,this._onKeyDown=i=>{const s=this._session;if(s?.mode==="pointer"){i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),this.cancel());return}if(s?.mode==="keyboard"){const h=this._resolve(i),l=this._items()[s.current];if(!h||h.item!==l){this._drop();return}this._keyboardStep(i,s);return}if(i.key!==" "&&i.key!=="Enter"||this._isDisabled())return;const o=this._resolve(i);if(!o)return;i.preventDefault();const r=this._items(),a=r.indexOf(o.item);this._session={mode:"keyboard",item:o.item,from:a,current:a,flow:y(this._host)},this._host.ownerDocument.addEventListener("pointerdown",this._onDocumentPointerDown,!0),this._options.onActiveChange?.(o.item,"keyboard"),this._announce(this.message("grabbed")(a+1,r.length,b(this._host)))},this._onFocusOut=i=>{const s=this._session;if(s?.mode!=="keyboard"||this._restoringFocus)return;const o=i.relatedTarget;if(o instanceof Node){const r=this._items()[s.current];this._handleOf(r)?.contains(o)||this._drop();return}requestAnimationFrame(()=>{if(this._session!==s)return;const r=$(this._host.ownerDocument),a=this._items(),h=a.includes(s.item)?s.item:a[s.current],l=this._handleOf(h);r&&r!==this._host.ownerDocument.body&&!l?.contains(r)?this._drop():l&&r!==l&&l.focus()})},this._onDocumentPointerDown=i=>{const s=this._session;if(s?.mode!=="keyboard")return;const o=this._handleOf(this._items()[s.current]);(!o||!i.composedPath().includes(o))&&this._drop()},this._host=t,this._options=e,this._gesture=new z(t,{target:t,activation:"axis",axis:"both",canStart:i=>this._canStart(i),onStart:i=>this._pointerStart(i,this._gesture),onMove:i=>this._pointerMove(i),onEnd:()=>this._pointerEnd(),onCancel:()=>this._cancel()}),this._pressGesture=new z(t,{target:t,activation:"press",canStart:i=>this._canStartPress(i),onStart:i=>this._pointerStart(i,this._pressGesture),onMove:i=>this._pointerMove(i),onEnd:i=>{const s=this._session?.mode==="pointer"?this._session.item:null;this._pointerEnd(),s&&this._swallowNextClick(s,i)},onCancel:i=>{const s=this._session?.mode==="pointer"?this._session.item:null;this._cancel(),s&&this._swallowNextClick(s,i)}}),t.addController(this)}get active(){return this._session!==null}hostConnected(){this._host.addEventListener("keydown",this._onKeyDown),this._host.addEventListener("focusout",this._onFocusOut)}hostDisconnected(){this._host.removeEventListener("keydown",this._onKeyDown),this._host.removeEventListener("focusout",this._onFocusOut),this._end(),this._announcer?.dispose(),this._announcer=null}cancel(){if(this._session?.mode==="pointer"){this._activeGesture?.setOptions({});return}this._cancel()}message(t){return W(this._host,"reorder",Tt,this._options.messages?.())[t]}_items(){return this._options.items()}_isDisabled(){return this._options.disabled?.()??!1}_resolve(t){const e=this._items();for(const i of t.composedPath()){if(!(i instanceof HTMLElement))continue;if(i===this._host)return null;if(!i.matches(this._options.handleSelector))continue;const s=e.find(o=>o.contains(i));return s?{item:s,handle:i}:null}return null}_handleOf(t){return t?.querySelector(this._options.handleSelector)??null}_announce(t){const e=this._options.announcerRoot?.()??Fe(this._host);this._announcer?.element.parentNode!==e&&(this._announcer?.dispose(),this._announcer=new Ct(e)),this._announcer.announce(t)}_canStart(t){if(this._session||this._isDisabled())return!1;const e=this._resolve(t);return this._pending=e?{item:e.item}:null,e!==null}_canStartPress(t){if(t.pointerType==="mouse"||this._session||this._isDisabled()||this._resolve(t))return!1;const e=t.composedPath(),i=this._items().find(s=>e.includes(s));return this._pending=i?{item:i}:null,i!==void 0}_swallowNextClick(t,e){const i=this._host.ownerDocument,s=a=>{a.detail===0||!a.composedPath().includes(t)||a instanceof PointerEvent&&a.pointerId>0&&a.pointerId!==e.pointerId||(a.preventDefault(),a.stopPropagation(),o())},o=()=>{clearTimeout(r),i.removeEventListener("click",s,!0)},r=setTimeout(o,400);i.addEventListener("click",s,!0)}_pointerStart(t,e){const i=this._pending?.item;this._pending=null,this._activeGesture=e;const s=this._items(),o=i?s.indexOf(i):-1;if(!i||o===-1)return;const r=y(this._host),a=this._host.getBoundingClientRect(),h=s.map(_=>{const u=j(_.getBoundingClientRect(),a,r);return{start:u.blockStart,size:u.blockSize}}),l=vt(this._host);this._session={mode:"pointer",item:i,from:o,to:o,flow:r,slots:h,step:Re(h,o),scroller:l,scrollStartCssPx:X(l,r),pointerDeltaViewportPx:0,x:t.x,y:t.y},this._options.onActiveChange?.(i,"pointer"),this._announce(this.message("grabbed")(o+1,s.length,b(this._host))),this._pointerMove(t)}_pointerMove(t){const e=this._session;e?.mode==="pointer"&&(e.x=t.x,e.y=t.y,e.pointerDeltaViewportPx=ot({dx:t.deltaX,dy:t.deltaY},"block",e.flow),this._layoutPointer(e),this._queueAutoScroll())}_layoutPointer(t){const e=X(t.scroller,t.flow)-t.scrollStartCssPx,i=t.scroller===this._host.ownerDocument.scrollingElement?1:g(t.scroller),s=t.pointerDeltaViewportPx+e*i,{slots:o,from:r}=t,a=o[r].start+s+o[r].size/2;let h=r;for(let _=r+1;_<o.length;_+=1)a>o[_].start+o[_].size/2&&(h=_);for(let _=r-1;_>=0;_-=1)a<o[_].start+o[_].size/2&&(h=_);h!==t.to&&(t.to=h,this._announce(this.message("moved")(h+1,o.length,b(this._host)))),this._items().forEach((_,u)=>{let d=0;_===t.item?d=s:u>r&&u<=h?d=-t.step:u<r&&u>=h&&(d=t.step),this._translate(_,d,t.flow)})}_translate(t,e,i){if(e===0){this._restoreTranslation(t);return}const s=e/g(t),{x:o,y:r}=q({inline:0,block:s},i);this._translated.has(t)||this._translated.set(t,{value:t.style.getPropertyValue("translate"),priority:t.style.getPropertyPriority("translate")}),t.style.setProperty("translate",`${o}px ${r}px`)}_clearTranslations(){for(const t of this._translated.keys())this._restoreTranslation(t)}_restoreTranslation(t){const e=this._translated.get(t);e&&(this._translated.delete(t),e.value?t.style.setProperty("translate",e.value,e.priority):t.style.removeProperty("translate"))}_queueAutoScroll(){this._autoScrollFrame||(this._autoScrollFrame=requestAnimationFrame(()=>{this._autoScrollFrame=0;const t=this._session;if(t?.mode!=="pointer")return;const e=this._autoScrollSpeed(t);if(e===0)return;const i=X(t.scroller,t.flow);t.scroller.scrollBy(t.flow.block==="x"?{left:e}:{top:e}),X(t.scroller,t.flow)!==i&&(this._layoutPointer(t),this._queueAutoScroll())}))}_autoScrollSpeed(t){const e=this._options.autoScrollEdge??48,{scroller:i,flow:s}=t,o=this._host.ownerDocument,r=i===o.scrollingElement||i===o.documentElement?new DOMRect(0,0,window.innerWidth,window.innerHeight):i.getBoundingClientRect(),a=s.block==="x",h=a?t.x:t.y,l=a?r.left:r.top,_=a?r.right:r.bottom,u=d=>Math.ceil((e-Math.max(0,d))/e*Pe);return h-l<e?-u(h-l):_-h<e?u(_-h):0}_pointerEnd(){const t=this._session;if(t?.mode!=="pointer")return;const{item:e,from:i,to:s}=t,o=t.slots.length;this._end(),s!==i&&this._commit(e,i,s,"pointer"),this._announce(this.message("dropped")(s+1,o,b(this._host)))}_keyboardStep(t,e){const i=this._items().length,s=B(D("vertical",e.flow),e.flow);let o;switch(t.key){case s.next:o=Math.min(i-1,e.current+1);break;case s.prev:o=Math.max(0,e.current-1);break;case"Home":o=0;break;case"End":o=i-1;break;case" ":case"Enter":t.preventDefault(),this._drop();return;case"Escape":{t.preventDefault(),t.stopPropagation();const{item:r,current:a,from:h}=e;this._end(),a!==h&&this._commit(r,a,h,"keyboard"),this._announce(this.message("canceled")(h+1,i,b(this._host)));return}default:return}t.preventDefault(),o!==e.current&&(this._commit(e.item,e.current,o,"keyboard"),e.current=o,this._announce(this.message("moved")(o+1,i,b(this._host))))}_drop(){if(this._session?.mode!=="keyboard")return;const t=this._items().length,e=this._session.current+1;this._end(),this._announce(this.message("dropped")(e,t,b(this._host)))}_commit(t,e,i,s){const o=this._handleOf(t),r=o!==null&&o===$(this._host.ownerDocument);this._restoringFocus=r;try{this._options.onMove(t,e,i,s)}finally{r||(this._restoringFocus=!1)}r&&requestAnimationFrame(()=>{const a=this._items(),h=a.includes(t)?t:a[i],l=this._handleOf(h);this._session?.mode==="keyboard"&&h&&h!==this._session.item&&(this._session.item=h),this._session?.mode==="keyboard"&&h&&(this._session.current=a.indexOf(h)),l&&$(this._host.ownerDocument)!==l&&l.focus(),this._restoringFocus=!1})}_cancel(){const t=this._session;if(!t)return;const e=this._items().length;this._end(),t.mode==="keyboard"&&t.current!==t.from&&this._commit(t.item,t.current,t.from,"keyboard"),this._announce(this.message("canceled")(t.from+1,e,b(this._host)))}_end(){this._autoScrollFrame&&(cancelAnimationFrame(this._autoScrollFrame),this._autoScrollFrame=0);const t=this._session!==null;this._host.ownerDocument.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),this._session=null,this._pending=null,this._activeGesture=null,t&&this._options.onActiveChange?.(null,null),this._clearTranslations()}}function X(n,t){const e=y(n),i=e.block===t.block?"block":"inline",s=st(n,i,e);return O(i,e)===t.blockReversed?s:-s}function Re(n,t){const e=n[t],i=n[t+1],s=n[t-1];return i?i.start-e.start:s?e.start+e.size-(s.start+s.size):e.size}function Fe(n){let t=n;for(;t;){if(t.localName==="dialog"&&t.hasAttribute("open")||t.hasAttribute("popover")&&t.matches(":popover-open"))return t;const e=t.getRootNode();t=t.parentElement??(e instanceof ShadowRoot?e.host:null)}return n.ownerDocument.body}c.ActiveDescendantController=At,c.AnchorController=ee,c.ClickDelegateController=Pt,c.DEFAULT_REORDER_MESSAGES=Tt,c.DEFAULT_RESIZE_MESSAGES=ct,c.DragController=Ht,c.DragGestureController=z,c.FlowController=ge,c.HORIZONTAL_LTR_FLOW=H,c.ItemsCollectionController=U,c.LiveAnnouncer=Ct,c.LocaleController=lt,c.MessagesController=Ut,c.MutationObserverController=ne,c.NativeChildController=ve,c.NavigationIndicatorController=oe,c.PopoverController=ie,c.RafScheduler=V,c.ReorderController=De,c.ResizeController=qt,c.RovingTabIndexMixin=Ee,c.ScrollObserverController=se,c.SoftKeyboardViewport=fe,c.TypeaheadController=le,c.arrowKeys=B,c.bidiIsolate=Xt,c.clientSize=Ot,c.collator=gt,c.cssText=pe,c.cssZoom=g,c.deepActiveElement=$,c.findExtremeSnapIndex=Ae,c.findNearestScrollAncestor=vt,c.findNearestSnapIndex=ke,c.findNextSnapIndex=xe,c.getDirectChildren=Et,c.getScrollOffset=st,c.getVisualViewportBounds=tt,c.inlineArrowKeys=zt,c.isFocusable=wt,c.isPhysicalReversed=P,c.isReversed=O,c.isTextEntryFocused=de,c.keyInteraction=Rt,c.keyNavigation=Nt,c.layoutOrientation=It,c.logicalDelta=ot,c.logicalRect=j,c.messagesLocale=b,c.notifyLocaleChange=at,c.numberFormat=mt,c.observeLocale=R,c.parseCssTime=Le,c.physicalAxis=k,c.physicalOffset=q,c.pinElementBox=_t,c.registerMessages=Yt,c.renderedOrientation=D,c.resolveFlow=y,c.resolveMessages=W,c.scrollSize=Mt,c.setScrollOffset=Ft,c.snapToStep=Ce,c.syncDefaultAttribute=jt,c.valueToPercent=Te,c.warnMissingDirectChild=be,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|