@primer/view-components
Version:
ViewComponents for the Primer Design System
1 lines • 182 kB
JavaScript
!function(){"use strict";var t,e,i,n,s,o,r,a,l=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)},c=function(t,e,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(t,i):s?s.value=i:e.set(t,i),i};const d=new WeakMap;let h=null;class IncludeFragmentElement extends HTMLElement{constructor(){super(...arguments),t.add(this),e.set(this,!1),i.set(this,new IntersectionObserver((e=>{for(const s of e)if(s.isIntersecting){const{target:e}=s;if(l(this,i,"f").unobserve(e),!(e instanceof IncludeFragmentElement))return;"lazy"===e.loading&&l(this,t,"m",n).call(this)}}),{rootMargin:"0px 0px 256px 0px",threshold:.01}))}static define(t="include-fragment",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){h=null===t?t:Promise.resolve(t)}static get observedAttributes(){return["src","loading"]}get src(){const t=this.getAttribute("src");if(t){const e=this.ownerDocument.createElement("a");return e.href=t,e.href}return""}set src(t){this.setAttribute("src",t)}get loading(){return"lazy"===this.getAttribute("loading")?"lazy":"eager"}set loading(t){this.setAttribute("loading",t)}get accept(){return this.getAttribute("accept")||""}set accept(t){this.setAttribute("accept",t)}get data(){return l(this,t,"m",o).call(this)}attributeChangedCallback(e,i){"src"===e?this.isConnected&&"eager"===this.loading&&l(this,t,"m",n).call(this):"loading"===e&&this.isConnected&&"eager"!==i&&"eager"===this.loading&&l(this,t,"m",n).call(this)}connectedCallback(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=":host {display: block;}",this.shadowRoot.append(t,document.createElement("slot"))}this.src&&"eager"===this.loading&&l(this,t,"m",n).call(this),"lazy"===this.loading&&l(this,i,"f").observe(this)}request(){const t=this.src;if(!t)throw new Error("missing src");return new Request(t,{method:"GET",credentials:"same-origin",headers:{Accept:this.accept||"text/html"}})}load(){return l(this,t,"m",o).call(this)}fetch(t){return fetch(t)}refetch(){d.delete(this),l(this,t,"m",n).call(this)}}e=new WeakMap,i=new WeakMap,t=new WeakSet,n=async function(){if(!l(this,e,"f")){c(this,e,!0,"f"),l(this,i,"f").unobserve(this);try{const i=await l(this,t,"m",s).call(this);if(i instanceof Error)throw i;const n=i,o=document.createElement("template");o.innerHTML=n;const r=document.importNode(o.content,!0);if(!this.dispatchEvent(new CustomEvent("include-fragment-replace",{cancelable:!0,detail:{fragment:r}})))return void c(this,e,!1,"f");this.replaceWith(r),this.dispatchEvent(new CustomEvent("include-fragment-replaced"))}catch(t){this.classList.add("is-error")}finally{c(this,e,!1,"f")}}},s=async function(){const e=this.src,i=d.get(this);if(i&&i.src===e)return i.data;{let i;return i=e?l(this,t,"m",a).call(this):Promise.reject(new Error("missing src")),d.set(this,{src:e,data:i}),i}},o=async function(){const e=await l(this,t,"m",s).call(this);if(e instanceof Error)throw e;return e.toString()},r=async function(t,e){await new Promise((t=>setTimeout(t,0)));for(const i of t)this.dispatchEvent(e?new CustomEvent(i,{detail:{error:e}}):new Event(i))},a=async function(){try{await l(this,t,"m",r).call(this,["loadstart"]);const i=await this.fetch(this.request()),n=i.headers.get("Content-Type");if(!(e=this.accept,e&&e.split(",").find((t=>t.match(/^\s*\*\/\*/)))||n&&n.includes(this.accept?this.accept:"text/html")))throw new Error(`Failed to load resource: expected ${this.accept||"text/html"} but was ${n}`);if(200!==i.status)throw new Error(`Failed to load resource: the server responded with a status of ${i.status}`);const s=await i.text();let o=s;if(h){o=(await h).createHTML(s,i)}return l(this,t,"m",r).call(this,["load","loadend"]),o}catch(e){throw l(this,t,"m",r).call(this,["error","loadend"],e),e}var e};const u="undefined"!=typeof globalThis?globalThis:window;try{u.IncludeFragmentElement=IncludeFragmentElement.define()}catch(t){if(!(u.DOMException&&t instanceof DOMException&&"NotSupportedError"===t.name||t instanceof ReferenceError))throw t}const m=new WeakMap;class RemoteInputElement extends HTMLElement{constructor(){super();const t=f.bind(null,this,!0),e={currentQuery:null,oninput:p((e=>t(e))),fetch:t,controller:null};m.set(this,e)}static get observedAttributes(){return["src"]}attributeChangedCallback(t,e){e&&"src"===t&&f(this,!1)}connectedCallback(){const t=this.input;if(!t)return;t.setAttribute("autocomplete","off"),t.setAttribute("spellcheck","false");const e=m.get(this);e&&(t.addEventListener("focus",e.fetch),t.addEventListener("change",e.fetch),t.addEventListener("input",e.oninput))}disconnectedCallback(){const t=this.input;if(!t)return;const e=m.get(this);e&&(t.removeEventListener("focus",e.fetch),t.removeEventListener("change",e.fetch),t.removeEventListener("input",e.oninput))}get input(){const t=this.querySelector("input, textarea");return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t:null}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}}async function f(t,e,i){const n=t.input;if(!n)return;const s=m.get(t);if(!s)return;const o=n.value;if(e&&s.currentQuery===o)return;s.currentQuery=o;const r=t.src;if(!r)return;const a=document.getElementById(t.getAttribute("aria-owns")||"");if(!a)return;const l=new URL(r,window.location.href),c=new URLSearchParams(l.search);let d;c.append(t.getAttribute("param")||"q",o),l.search=c.toString(),s.controller?s.controller.abort():(t.dispatchEvent(new CustomEvent("loadstart")),t.setAttribute("loading","")),s.controller="AbortController"in window?new AbortController:{signal:null,abort(){}};let h="";try{d=await async function(t,e,i){try{const n=await fetch(e,i);return t.dispatchEvent(new CustomEvent("load")),t.dispatchEvent(new CustomEvent("loadend")),n}catch(e){throw e instanceof Error&&"AbortError"!==(null==e?void 0:e.name)&&(t.dispatchEvent(new CustomEvent("error")),t.dispatchEvent(new CustomEvent("loadend"))),e}}(t,l.toString(),{signal:s.controller.signal,credentials:"same-origin",headers:{accept:"text/fragment+html"}}),h=await d.text(),t.removeAttribute("loading"),s.controller=null}catch(e){return void(e instanceof Error&&"AbortError"!==e.name&&(t.removeAttribute("loading"),s.controller=null))}d&&d.ok?(a.innerHTML=h,t.dispatchEvent(new CustomEvent("remote-input-success",{bubbles:!0,detail:{eventType:i?i.type:void 0}}))):t.dispatchEvent(new CustomEvent("remote-input-error",{bubbles:!0}))}function p(t){let e;return function(i){clearTimeout(e),e=setTimeout((()=>{clearTimeout(e),t(i)}),300)}}function g(t,e,i,n){var s,o=arguments.length,r=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,i,r):s(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}function b(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)}function v(t,e,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(t,i):s?s.value=i:e.set(t,i),i}window.customElements.get("remote-input")||(window.RemoteInputElement=RemoteInputElement,window.customElements.define("remote-input",RemoteInputElement)),"function"==typeof SuppressedError&&SuppressedError;const w=new WeakSet;function y(t){L(t),A(t)}const E=new WeakMap;function A(t=document){if(E.has(t))return E.get(t);let e=!1;const i=new MutationObserver((t=>{for(const e of t)if("attributes"===e.type&&e.target instanceof Element)S(e.target);else if("childList"===e.type&&e.addedNodes.length)for(const t of e.addedNodes)t instanceof Element&&L(t)}));i.observe(t,{childList:!0,subtree:!0,attributeFilter:["data-action"]});const n={get closed(){return e},unsubscribe(){e=!0,E.delete(t),i.disconnect()}};return E.set(t,n),n}function L(t){for(const e of t.querySelectorAll("[data-action]"))S(e);t instanceof Element&&t.hasAttribute("data-action")&&S(t)}function k(t){const e=t.currentTarget;for(const i of T(e))if(t.type===i.type){const n=e.closest(i.tag);w.has(n)&&"function"==typeof n[i.method]&&n[i.method](t);const s=e.getRootNode();if(s instanceof ShadowRoot&&w.has(s.host)&&s.host.matches(i.tag)){const e=s.host;"function"==typeof e[i.method]&&e[i.method](t)}}}function*T(t){for(const e of(t.getAttribute("data-action")||"").trim().split(/\s+/)){const t=e.lastIndexOf(":"),i=Math.max(0,e.lastIndexOf("#"))||e.length;yield{type:e.slice(0,t),tag:e.slice(t+1,i),method:e.slice(i+1)||"handleEvent"}||"handleEvent"}}function S(t){for(const e of T(t))t.addEventListener(e.type,k)}const C=t=>String("symbol"==typeof t?t.description:t).replace(/([A-Z]($|[a-z]))/g,"-$1").replace(/--/g,"-").replace(/^-|-$/,"").toLowerCase(),x=(t,e="property")=>{const i=C(t);if(!i.includes("-"))throw new DOMException(`${e}: ${String(t)} is not a valid ${e} name`,"SyntaxError");return i};const M="attr";function I(t,e){_(t,M).add(e)}const D=new WeakSet;function P(t,e){if(D.has(t))return;D.add(t);const i=Object.getPrototypeOf(t),n=i?.constructor?.attrPrefix??"data-";e||(e=_(i,M));for(const i of e){const e=t[i],s=x(`${n}${i}`);let o={configurable:!0,get(){return this.getAttribute(s)||""},set(t){this.setAttribute(s,t||"")}};"number"==typeof e?o={configurable:!0,get(){return Number(this.getAttribute(s)||0)},set(t){this.setAttribute(s,t)}}:"boolean"==typeof e&&(o={configurable:!0,get(){return this.hasAttribute(s)},set(t){this.toggleAttribute(s,t)}}),Object.defineProperty(t,i,o),i in t&&!t.hasAttribute(s)&&o.set.call(t,e)}}const O=new Map,H=new Promise((t=>{"loading"!==document.readyState?t():document.addEventListener("readystatechange",(()=>t()),{once:!0})})),N=new Promise((t=>{const e=new AbortController;e.signal.addEventListener("abort",(()=>t()));const i={once:!0,passive:!0,signal:e.signal},n=()=>e.abort();document.addEventListener("mousedown",n,i),document.addEventListener("touchstart",n,i),document.addEventListener("keydown",n,i),document.addEventListener("pointerdown",n,i)})),F={ready:()=>H,firstInteraction:()=>N,visible:t=>new Promise((e=>{const i=new IntersectionObserver((t=>{for(const n of t)if(n.isIntersecting)return e(),void i.disconnect()}),{rootMargin:"0px 0px 256px 0px",threshold:.01});for(const e of document.querySelectorAll(t))i.observe(e)}))},R=new Set;let q,W=null;function V(t){R.add(t),null==W&&(W=requestAnimationFrame((()=>{W=null;const t=new Set(R);if(R.clear(),O.size)t:for(const e of t)for(const t of O.keys()){const i=e instanceof Element&&e.matches(t)?e:e.querySelector(t);if(customElements.get(t)||i){const e=i?.getAttribute("data-load-on")||"ready",n=e in F?F[e]:F.ready;for(const e of O.get(t)||[])n(t).then(e);if(O.delete(t),!O.size)break t}}})))}const B=Symbol.for("catalyst");class ${constructor(t,e){const i=this,n=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){i.connectedCallback(this,n)};const s=t.prototype.disconnectedCallback;t.prototype.disconnectedCallback=function(){i.disconnectedCallback(this,s)};const o=t.prototype.attributeChangedCallback;t.prototype.attributeChangedCallback=function(t,e,n){i.attributeChangedCallback(this,t,e,n,o)};let r=t.observedAttributes||[];Object.defineProperty(t,"observedAttributes",{configurable:!0,get(){return i.observedAttributes(this,r)},set(t){r=t}}),function(t){let e=t.observedAttributes||[];const i=t.attrPrefix??"data-",n=t=>x(`${i}${t}`);Object.defineProperty(t,"observedAttributes",{configurable:!0,get:()=>[..._(t.prototype,M)].map(n).concat(e),set(t){e=t}})}(t),function(t,e){const i=e||C(t.name).replace(/-element$/,"");try{window.customElements.define(i,t),window[t.name]=customElements.get(i)}catch(t){if(!(t instanceof DOMException&&"NotSupportedError"===t.name))throw t}}(t,e)}observedAttributes(t,e){return e}connectedCallback(t,e){t.toggleAttribute("data-catalyst",!0),customElements.upgrade(t),function(t){for(const e of t.querySelectorAll("template[data-shadowroot]"))e.parentElement===t&&t.attachShadow({mode:"closed"===e.getAttribute("data-shadowroot")?"closed":"open"}).append(e.content.cloneNode(!0))}(t),P(t),function(t){w.add(t),t.shadowRoot&&y(t.shadowRoot),L(t),A(t.ownerDocument)}(t),e?.call(t),t.shadowRoot&&(y(t.shadowRoot),function(t){q||(q=new MutationObserver((t=>{if(O.size)for(const e of t)for(const t of e.addedNodes)t instanceof Element&&V(t)}))),V(t),q.observe(t,{subtree:!0,childList:!0})}(t.shadowRoot))}disconnectedCallback(t,e){e?.call(t)}attributeChangedCallback(t,e,i,n,s){P(t),"data-catalyst"!==e&&s&&s.call(t,e,i,n)}}function _(t,e){if(!Object.prototype.hasOwnProperty.call(t,B)){const e=t[B],i=t[B]=new Map;if(e)for(const[t,n]of e)i.set(t,new Set(n))}const i=t[B];return i.has(e)||i.set(e,new Set),i.get(e)}function U(t,e){_(t,"target").add(e),Object.defineProperty(t,e,{configurable:!0,get(){return function(t,e){const i=t.tagName.toLowerCase();if(t.shadowRoot)for(const n of t.shadowRoot.querySelectorAll(`[data-target~="${i}.${e}"]`))if(!n.closest(i))return n;for(const n of t.querySelectorAll(`[data-target~="${i}.${e}"]`))if(n.closest(i)===t)return n}(this,e)}})}function j(t,e){_(t,"targets").add(e),Object.defineProperty(t,e,{configurable:!0,get(){return function(t,e){const i=t.tagName.toLowerCase(),n=[];if(t.shadowRoot)for(const s of t.shadowRoot.querySelectorAll(`[data-targets~="${i}.${e}"]`))s.closest(i)||n.push(s);for(const s of t.querySelectorAll(`[data-targets~="${i}.${e}"]`))s.closest(i)===t&&n.push(s);return n}(this,e)}})}function K(t){if("string"==typeof t)return e=>{new $(e,t)};new $(t)}var z;class Y{constructor(t){this.resizeObserver=new ResizeObserver((t=>{for(const e of t){const t=e.target;t instanceof HTMLElement&&this.update(t)}})),this.resizeObserver.observe(t)}unobserve(t){this.resizeObserver.unobserve(t)}update(t){const e=t.querySelectorAll("li");for(const t of e){const e=t.querySelector(".ActionListItem-label");if(!e)continue;const i=t.querySelector(".ActionListItem-truncationTooltip");if(!i)continue;const n=e.scrollWidth>e.clientWidth;i.style.display=n?"":"none"}}}let Z=class ActionListElement extends HTMLElement{constructor(){super(...arguments),z.set(this,void 0)}connectedCallback(){v(this,z,new Y(this),"f")}disconnectedCallback(){b(this,z,"f").unobserve(this)}};z=new WeakMap,Z=g([K("action-list")],Z);const G={"outside-top":["outside-bottom","outside-right","outside-left","outside-bottom"],"outside-bottom":["outside-top","outside-right","outside-left","outside-bottom"],"outside-left":["outside-right","outside-bottom","outside-top","outside-bottom"],"outside-right":["outside-left","outside-bottom","outside-top","outside-bottom"]},J={start:["end","center"],end:["start","center"],center:["end","start"]};function X(t,e,i={}){const{positionedParent:n,clippingNode:s,positionedParentStyle:o,clippingNodeStyle:r}=function(t){if(function(t){var e;if("DIALOG"===t.tagName)return!0;try{if(t.matches(":popover-open")&&/native code/.test(null===(e=document.body.showPopover)||void 0===e?void 0:e.toString()))return!0}catch(t){return!1}return!1}(t))return{positionedParent:document.body,clippingNode:document.body,positionedParentStyle:null,clippingNodeStyle:null};let e=null,i=null,n=null,s=null,o=t.parentNode;for(;null!==o&&o!==document.body;){if(o instanceof HTMLElement){const t=getComputedStyle(o);if(e||"static"===t.position||(e=o,n=t),i||"visible"===t.overflow||(i=o,s=t),e&&i)break}o=o.parentNode}return{positionedParent:null!=e?e:document.body,clippingNode:null!=i?i:document.body,positionedParentStyle:n,clippingNodeStyle:s}}(t),a=function(t,e=null){const i=t.getBoundingClientRect(),n=e||getComputedStyle(t),s=parseInt(n.borderTopWidth,10)||0,o=parseInt(n.borderLeftWidth,10)||0,r=parseInt(n.borderRightWidth,10)||0,a=parseInt(n.borderBottomWidth,10)||0;return{top:i.top+s,left:i.left+o,width:i.width-r-o,height:Math.max(i.height-s-a,t===document.body?window.innerHeight:-1/0)}}(s,r),l=o||getComputedStyle(n),c=n.getBoundingClientRect(),[d,h]=[l.borderTopWidth,l.borderLeftWidth].map((t=>parseInt(t,10)||0));return function(t,e,i,n,{side:s,align:o,allowOutOfBounds:r,anchorOffset:a,alignmentOffset:l,displayInViewport:c},d){let h=t;c&&(h={top:0,left:0,width:d.width,height:d.height});const u={top:h.top-e.top,left:h.left-e.left,width:h.width,height:h.height};let m=tt(i,n,s,o,a,l),f=s,p=o;if(m.top-=e.top,m.left-=e.left,!r){const t=G[s];let r=0;if(t){let c=s;for(;r<t.length&&et(c,m,u,i);){const s=t[r++];c=s,m=tt(i,n,s,o,a,l),m.top-=e.top,m.left-=e.left,f=s}}const d=J[o];let g=0;if(d){let t=o;for(;g<d.length&&it(t,m,u,i);){const s=d[g++];t=s,m=tt(i,n,f,s,a,l),m.top-=e.top,m.left-=e.left,p=s}}m.top<u.top&&(m.top=u.top),m.left<u.left&&(m.left=u.left),m.left+i.width>h.width+u.left&&(m.left=h.width+u.left-i.width),(c||t&&r<t.length)&&m.top+i.height>h.height+u.top&&(m.top=Math.max(h.height+u.top-i.height,0))}return Object.assign(Object.assign({},m),{anchorSide:f,anchorAlign:p})}(a,{top:c.top+d,left:c.left+h},t.getBoundingClientRect(),e instanceof Element?e.getBoundingClientRect():e,function(t={}){var e,i,n,s,o,r;const a=null!==(e=t.side)&&void 0!==e?e:Q.side,l=null!==(i=t.align)&&void 0!==i?i:Q.align;return{side:a,align:l,anchorOffset:null!==(n=t.anchorOffset)&&void 0!==n?n:"inside-center"===a?0:Q.anchorOffset,alignmentOffset:null!==(s=t.alignmentOffset)&&void 0!==s?s:"center"!==l&&a.startsWith("inside")?Q.alignmentOffset:0,allowOutOfBounds:null!==(o=t.allowOutOfBounds)&&void 0!==o?o:Q.allowOutOfBounds,displayInViewport:null!==(r=t.displayInViewport)&&void 0!==r?r:Q.displayInViewport}}(i),{width:window.innerWidth,height:window.innerHeight})}const Q={side:"outside-bottom",align:"start",anchorOffset:4,alignmentOffset:4,allowOutOfBounds:!1,displayInViewport:!1};function tt(t,e,i,n,s,o){const r=e.left+e.width,a=e.top+e.height;let l=-1,c=-1;return"outside-top"===i?l=e.top-s-t.height:"outside-bottom"===i?l=a+s:"outside-left"===i?c=e.left-s-t.width:"outside-right"===i&&(c=r+s),"outside-top"!==i&&"outside-bottom"!==i||(c="start"===n?e.left+o:"center"===n?e.left-(t.width-e.width)/2+o:r-t.width-o),"outside-left"!==i&&"outside-right"!==i||(l="start"===n?e.top+o:"center"===n?e.top-(t.height-e.height)/2+o:a-t.height-o),"inside-top"===i?l=e.top+s:"inside-bottom"===i?l=a-s-t.height:"inside-left"===i?c=e.left+s:"inside-right"===i?c=r-s-t.width:"inside-center"===i&&(c=(r+e.left)/2-t.width/2+s),"inside-top"===i||"inside-bottom"===i?c="start"===n?e.left+o:"center"===n?e.left-(t.width-e.width)/2+o:r-t.width-o:"inside-left"!==i&&"inside-right"!==i&&"inside-center"!==i||(l="start"===n?e.top+o:"center"===n?e.top-(t.height-e.height)/2+o:a-t.height-o),{top:l,left:c}}function et(t,e,i,n){return"outside-top"===t||"outside-bottom"===t?e.top<i.top||e.top+n.height>i.height+i.top:e.left<i.left||e.left+n.width>i.width+i.left}function it(t,e,i,n){return"end"===t?e.left<i.left:"start"===t||"center"===t?e.left+n.width>i.left+i.width||e.left<i.left:void 0}function*nt(t,e={}){var i,n;const s=null!==(i=e.strict)&&void 0!==i&&i,o=null!==(n=e.onlyTabbable)&&void 0!==n&&n?at:rt,r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>t instanceof HTMLElement&&o(t,s)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});let a=null;if(!e.reverse&&o(t,s)&&(yield t),e.reverse){let t=r.lastChild();for(;t;)a=t,t=r.lastChild()}else a=r.firstChild();for(;a instanceof HTMLElement;)yield a,a=e.reverse?r.previousNode():r.nextNode();e.reverse&&o(t,s)&&(yield t)}function st(t,e=!1){return nt(t,{reverse:e,strict:!0,onlyTabbable:!0}).next().value}const ot=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","OPTGROUP","OPTION","FIELDSET"]);function rt(t,e=!1){if(t.hidden)return!1;if(t.classList.contains("sentinel"))return!1;if(t instanceof HTMLInputElement&&"hidden"===t.type)return!1;if(ot.has(t.tagName)&&t.disabled)return!1;if(e){const e=t.offsetWidth,i=t.offsetHeight,n=t.offsetParent;if(0===e||0===i)return!1;const s=getComputedStyle(t);if("none"===s.display)return!1;if("hidden"===s.visibility||"collapse"===s.visibility)return!1;const o=s.position;if(!n&&"fixed"!==o&&"sticky"!==o)return!1;if(0===t.getClientRects().length)return!1}return null!=t.getAttribute("tabindex")||("true"===t.getAttribute("contenteditable")||"plaintext-only"===t.getAttribute("contenteditable")||!(t instanceof HTMLAnchorElement&&null==t.getAttribute("href"))&&-1!==t.tabIndex)}function at(t,e=!1){return rt(t,e)&&"-1"!==t.getAttribute("tabindex")}let lt=!1;function ct(){}try{const t=Object.create({},{signal:{get(){lt=!0}}});window.addEventListener("test",ct,t),window.removeEventListener("test",ct,t)}catch(t){}function dt(){lt||(!function(){if("undefined"==typeof window)return;const t=EventTarget.prototype.addEventListener;EventTarget.prototype.addEventListener=function(e,i,n){return"object"==typeof n&&"signal"in n&&n.signal instanceof AbortSignal&&t.call(n.signal,"abort",(()=>{this.removeEventListener(e,i,n)})),t.call(this,e,i,n)}}(),lt=!0)}dt();const ht=[];let ut;const mt="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";function ft({onFocus:t}){const e=document.createElement("span");return e.setAttribute("class","sentinel"),e.setAttribute("tabindex","0"),e.setAttribute("aria-hidden","true"),e.style.cssText=mt,e.onfocus=t,e}function pt(t,e,i){const n=new AbortController,s=null!=i?i:n.signal;t.setAttribute("data-focus-trap","active");const o=ft({onFocus:()=>{const e=st(t,!0);null==e||e.focus()}}),r=ft({onFocus:()=>{const e=st(t);null==e||e.focus()}});null!==t.querySelector(":scope > span.sentinel")||(t.prepend(o),t.append(r));const a=function(t,e){const i=new MutationObserver((i=>{for(const n of i)if("childList"===n.type&&n.addedNodes.length){for(const t of n.addedNodes)if(t instanceof HTMLElement&&"SPAN"===t.tagName&&t.classList.contains("sentinel"))return;const i=t.firstElementChild,s=t.lastElementChild,[o,r]=e;(null==i?void 0:i.classList.contains("sentinel"))||t.insertAdjacentElement("afterbegin",o),(null==s?void 0:s.classList.contains("sentinel"))||t.insertAdjacentElement("beforeend",r)}}));return i.observe(t,{childList:!0}),i}(t,[o,r]);let l;function c(i){if(i instanceof HTMLElement&&document.contains(t)){if(t.contains(i))return void(l=i);if(l&&at(l)&&t.contains(l))return void l.focus();if(e&&t.contains(e))return void e.focus();{const e=st(t);return void(null==e||e.focus())}}}const d=function(t){const e=new AbortController;return t.addEventListener("abort",(()=>{e.abort()})),e}(s);if(ut){const t=ut;ut.container.setAttribute("data-focus-trap","suspended"),ut.controller.abort(),ht.push(t)}d.signal.addEventListener("abort",(()=>{ut=void 0})),s.addEventListener("abort",(()=>{t.removeAttribute("data-focus-trap");const e=t.getElementsByClassName("sentinel");for(;e.length>0;)e[0].remove();const i=ht.findIndex((e=>e.container===t));i>=0&&ht.splice(i,1),a.disconnect(),function(){const t=ht.pop();t&&pt(t.container,t.initialFocus,t.originalSignal)}()})),document.addEventListener("focus",(t=>{c(t.target)}),{signal:d.signal,capture:!0}),c(document.activeElement),ut={container:t,controller:d,initialFocus:e,originalSignal:s};const h=ht.findIndex((e=>e.container===t));if(h>=0&&ht.splice(h,1),!i)return n}let gt;function bt(){return void 0===gt&&(gt=/^mac/i.test(window.navigator.platform)),gt}let vt=1e4;const wt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);class yt{constructor(){this._items=[],this._itemSet=new Set,this._indexMap=new Map}insertAt(t,e){let i;if(e.length<=100)i=e.filter(((t,e,i)=>!this._itemSet.has(t)&&i.indexOf(t)===e));else{const t=new Set;i=[];for(let n=0;n<e.length;n++){const s=e[n];this._itemSet.has(s)||t.has(s)||(t.add(s),i.push(s))}}if(0===i.length)return;const n=Math.max(0,Math.min(t,this._items.length));if(n!==this._items.length)if(0!==n){for(let t=this._items.length-1;t>=n;t--)this._indexMap.set(this._items[t],t+i.length);i.length<=1e4?this._items.splice(n,0,...i):this._chunkedInsert(n,i);for(let t=0;t<i.length;t++){const e=i[t];this._itemSet.add(e),this._indexMap.set(e,n+t)}}else{for(let t=0;t<this._items.length;t++)this._indexMap.set(this._items[t],t+i.length);i.length<=1e4?this._items.splice(0,0,...i):this._chunkedInsert(0,i);for(let t=0;t<i.length;t++)this._itemSet.add(i[t]),this._indexMap.set(i[t],t)}else for(let t=0;t<i.length;t++){const e=i[t];this._indexMap.set(e,this._items.length),this._items.push(e),this._itemSet.add(e)}}_chunkedInsert(t,e){for(let i=0;i<e.length;i+=1e4){const n=e.slice(i,i+1e4);this._items.splice(t+i,0,...n)}}delete(t){if(!this._itemSet.has(t))return!1;const e=this._indexMap.get(t);this._items.splice(e,1),this._itemSet.delete(t),this._indexMap.delete(t);for(let t=e;t<this._items.length;t++)this._indexMap.set(this._items[t],t);return!0}has(t){return this._itemSet.has(t)}indexOf(t){var e;return null!==(e=this._indexMap.get(t))&&void 0!==e?e:-1}get(t){return this._items[t]}get size(){return this._items.length}[Symbol.iterator](){return this._items[Symbol.iterator]()}clear(){this._items=[],this._itemSet.clear(),this._indexMap.clear()}find(t){return this._items.find(t)}}var Et;dt(),function(t){t[t.ArrowHorizontal=1]="ArrowHorizontal",t[t.ArrowVertical=2]="ArrowVertical",t[t.JK=4]="JK",t[t.HL=8]="HL",t[t.HomeAndEnd=16]="HomeAndEnd",t[t.PageUpDown=256]="PageUpDown",t[t.WS=32]="WS",t[t.AD=64]="AD",t[t.Tab=128]="Tab",t[t.Backspace=512]="Backspace",t[t.ArrowAll=3]="ArrowAll",t[t.HJKL=12]="HJKL",t[t.WASD=96]="WASD",t[t.All=511]="All"}(Et||(Et={}));const At={ArrowLeft:Et.ArrowHorizontal,ArrowDown:Et.ArrowVertical,ArrowUp:Et.ArrowVertical,ArrowRight:Et.ArrowHorizontal,h:Et.HL,j:Et.JK,k:Et.JK,l:Et.HL,a:Et.AD,s:Et.WS,w:Et.WS,d:Et.AD,Tab:Et.Tab,Home:Et.HomeAndEnd,End:Et.HomeAndEnd,PageUp:Et.PageUpDown,PageDown:Et.PageUpDown,Backspace:Et.Backspace},Lt={ArrowLeft:"previous",ArrowDown:"next",ArrowUp:"previous",ArrowRight:"next",h:"previous",j:"next",k:"previous",l:"next",a:"previous",s:"next",w:"previous",d:"next",Tab:"next",Home:"start",End:"end",PageUp:"start",PageDown:"end",Backspace:"previous"};function kt(t){const e=Lt[t.key];if("Tab"===t.key&&t.shiftKey)return"previous";const i=bt();if(i&&t.metaKey||!i&&t.ctrlKey){if("ArrowLeft"===t.key||"ArrowUp"===t.key)return"start";if("ArrowRight"===t.key||"ArrowDown"===t.key)return"end"}return e}function Tt(t,e){const i=t.key,n=1===i.length||2===i.length&&i.charCodeAt(0)>=55296&&i.charCodeAt(0)<=56319,s=function(t){var e,i;if(!(t instanceof HTMLElement))return!1;const n=t.nodeName.toLowerCase(),s=null!==(i=null===(e=t.getAttribute("type"))||void 0===e?void 0:e.toLowerCase())&&void 0!==i?i:"text",o="true"===t.ariaReadOnly||"true"===t.getAttribute("aria-readonly")||null!==t.getAttribute("readonly");return("select"===n||"textarea"===n||"input"===n&&!wt.has(s)||t.isContentEditable)&&!o}(e),o=e instanceof HTMLSelectElement;if(s&&(n||"Home"===i||"End"===i))return!0;if(o){const e=bt();return!("ArrowDown"!==i||!e||t.metaKey)||!("ArrowDown"!==i||e||!t.altKey)}if(s&&!o){const t=e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement,n=t&&0===e.selectionStart&&0===e.selectionEnd,s=t&&e.selectionStart===e.value.length&&e.selectionEnd===e.value.length;if("ArrowLeft"===i&&!n)return!0;if("ArrowRight"===i&&!s)return!0;const o=e instanceof HTMLElement&&e.isContentEditable;if(e instanceof HTMLTextAreaElement||o){if("PageUp"===i||"PageDown"===i)return!0;if("ArrowUp"===i&&!n)return!0;if("ArrowDown"===i&&!s)return!0}}return!1}const St="data-is-active-descendant",Ct="activated-directly",xt="activated-indirectly",Mt="data-has-active-descendant";function It(t,e){var i,n,s,o,r,a,l;const c=new yt,d=new WeakMap,h=null!==(i=null==e?void 0:e.bindKeys)&&void 0!==i?i:((null==e?void 0:e.getNextFocusable)?Et.ArrowAll:Et.ArrowVertical)|Et.HomeAndEnd,u=null!==(n=null==e?void 0:e.focusOutBehavior)&&void 0!==n?n:"stop",m=null!==(s=null==e?void 0:e.focusInStrategy)&&void 0!==s?s:"previous",f=null==e?void 0:e.activeDescendantControl,p=null==e?void 0:e.onActiveDescendantChanged,g=null!==(o=null==e?void 0:e.ignoreHoverEvents)&&void 0!==o&&o,b=null!==(r=null==e?void 0:e.focusPrependedElements)&&void 0!==r&&r;let v,w=!1;const y=null!==(a=null==e?void 0:e.preventScroll)&&void 0!==a&&a,E="initial"===m&&(null==e?void 0:e.activeDescendantControl);function A(){return c.get(0)}function L(t,e=!1){const i=v;v=t,w=e,f?t&&document.activeElement===f?k(i,t,e):T():(i&&i!==t&&d.has(i)&&i.setAttribute("tabindex","-1"),null==t||t.setAttribute("tabindex","0"))}function k(e,i,n=!1){i.id||i.setAttribute("id","__primer_id_"+vt++),e&&e!==i&&e.removeAttribute(St),f&&(n||f.getAttribute("aria-activedescendant")!==i.id)&&(f.setAttribute("aria-activedescendant",i.id),t.setAttribute(Mt,i.id),i.setAttribute(St,n?Ct:xt),null==p||p(i,e,n))}function T(e=v){"first"===m&&(v=void 0),null==f||f.removeAttribute("aria-activedescendant"),t.removeAttribute(Mt),null==e||e.removeAttribute(St);const i=t.querySelectorAll(`[${St}]`);for(let t=0;t<i.length;t++)i[t].removeAttribute(St);null==p||p(void 0,e,!1)}function S(...t){const i=(null==e?void 0:e.focusableElementFilter)?t.filter((t=>e.focusableElementFilter(t))):t;if(0===i.length)return;const n=function(t){const e=t[0];if(0===c.size)return 0;let i=0,n=c.size-1;for(;i<=n;){const t=Math.floor((i+n)/2);x(e,c.get(t))?n=t-1:i=t+1}return i}(i);c.insertAt(n,i);for(const t of i)d.has(t)||d.set(t,t.getAttribute("tabindex")),t.setAttribute("tabindex","-1");!E&&(b&&0===n&&!w)?C():E||v||L(A())}function C(){const e=[...nt(t,I)];c.clear(),c.insertAt(0,e);for(const t of e)d.has(t)||d.set(t,t.getAttribute("tabindex")),t.setAttribute("tabindex","-1");L(A())}function x(t,e){return(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)>0}function M(...t){for(const e of t){c.delete(e);const t=d.get(e);if(void 0!==t&&(null===t?e.removeAttribute("tabindex"):e.setAttribute("tabindex",t),d.delete(e)),e===v){L(A())}}}const I={reverse:null==e?void 0:e.reverse,strict:null==e?void 0:e.strict,onlyTabbable:null==e?void 0:e.onlyTabbable};S(...nt(t,I));const D="function"==typeof m?m(document.body):A();E||L(D);const P=new MutationObserver((t=>{const e=new Set,i=new Set,n=new Set,s=new Set;for(const o of t)if("childList"===o.type){for(const t of o.removedNodes)t instanceof HTMLElement&&e.add(t);for(const t of o.addedNodes)t instanceof HTMLElement&&i.add(t)}else if("attributes"===o.type&&o.target instanceof HTMLElement){const t=o.attributeName;!!t&&o.target.hasAttribute(t)?n.add(o.target):s.add(o.target)}if(e.size>0){const t=[];for(const i of e)for(const e of nt(i))t.push(e);t.length>0&&M(...t)}if(n.size>0&&M(...n),i.size>0){const t=[];for(const e of i)for(const i of nt(e,I))t.push(i);t.length>0&&(b?C():S(...t))}s.size>0&&S(...s)}));P.observe(t,{subtree:!0,childList:!0,attributeFilter:["hidden","disabled"],attributeOldValue:!0});const O=new AbortController,H=null!==(l=null==e?void 0:e.abortSignal)&&void 0!==l?l:O.signal;let N;H.addEventListener("abort",(()=>{P.disconnect(),M(...c),c.clear()})),t.addEventListener("mousedown",(t=>{t.target instanceof HTMLElement&&t.target!==document.activeElement&&(N=c.indexOf(t.target))}),{signal:H}),f?(t.addEventListener("focusin",(t=>{t.target instanceof HTMLElement&&c.has(t.target)&&(f.focus({preventScroll:y}),L(t.target))}),{signal:H}),g||t.addEventListener("mousemove",(({target:t})=>{if(!(t instanceof Node))return;if(t instanceof HTMLElement&&c.has(t))return void L(t);const e=c.find((e=>e.contains(t)));e&&L(e)}),{signal:H,capture:!0}),f.addEventListener("focusin",(()=>{v?k(void 0,v):E||L(A())}),{signal:H}),f.addEventListener("focusout",(()=>{T()}),{signal:H})):t.addEventListener("focusin",(e=>{if(e.target instanceof HTMLElement)if(void 0!==N){if(N>=0){const t=c.get(N);t&&t!==v&&L(t)}N=void 0}else if("previous"===m)L(e.target);else if("closest"===m||"first"===m){if(e.relatedTarget instanceof Element&&!t.contains(e.relatedTarget)){const t="previous"===R?c.size-1:0,e=c.get(t);return void(null==e||e.focus({preventScroll:y}))}L(e.target)}else if("function"==typeof m)if(e.relatedTarget instanceof Element&&!t.contains(e.relatedTarget)){const t=m(e.relatedTarget);if(t&&c.has(t))return void t.focus({preventScroll:y});console.warn("Element requested is not a known focusable element.")}else L(e.target);R=void 0}),{signal:H});const F=null!=f?f:t;let R;return"closest"===m&&document.addEventListener("keydown",(t=>{"Tab"===t.key&&(R=kt(t))}),{signal:H,capture:!0}),F.addEventListener("keydown",(i=>{var n;if(i.key in Lt){const s=At[i.key];if(!i.defaultPrevented&&(s&h)>0&&!Tt(i,document.activeElement)){const s=kt(i);let o;if((null==e?void 0:e.getNextFocusable)&&(o=e.getNextFocusable(s,null!==(n=document.activeElement)&&void 0!==n?n:void 0,i)),!o){const e=function(){if(!v)return E?-1:0;const e=c.indexOf(v);return-1!==e?e:v===t?-1:0}();let n=e;"previous"===s?n-=1:"start"===s?n=0:"next"===s?n+=1:n=c.size-1,n<0&&(n="wrap"===u&&"Tab"!==i.key?c.size-1:0),n>=c.size&&(n="wrap"===u&&"Tab"!==i.key?0:c.size-1),e!==n&&(o=c.get(n))}f?L(o||v,!0):o&&(R=s,o.focus({preventScroll:y})),("Tab"!==i.key||o)&&i.preventDefault()}}}),{signal:H}),O}var Dt,Pt,Ot,Ht,Nt,Ft,Rt,qt;const Wt=new IntersectionObserver((t=>{for(const e of t){const t=e.target;e.isIntersecting&&t instanceof Bt&&t.update()}})),Vt=new ResizeObserver((t=>{for(const e of t){const t=e.target;t instanceof Bt&&t.update()}}));let Bt=class ActionBarElement extends HTMLElement{constructor(){super(...arguments),Dt.add(this),Pt.set(this,null),Ot.set(this,!1)}connectedCallback(){Vt.observe(this),Wt.observe(this),this.style.overflow="visible",this.update()}disconnectedCallback(){Vt.unobserve(this),Wt.unobserve(this)}menuItemClick(t){const e=t.currentTarget,i=e?.getAttribute("data-for");i&&document.getElementById(i)?.click()}update(){b(this,Ot,"f")||(v(this,Ot,!0,"f"),requestAnimationFrame((()=>{v(this,Ot,!1,"f"),b(this,Dt,"m",Ht).call(this)})))}};Pt=new WeakMap,Ot=new WeakMap,Dt=new WeakSet,Ht=function(){const t=b(this,Dt,"a",Nt);if(!t)return;const e=t.getBoundingClientRect().top,i=b(this,Dt,"a",qt),n=Array.from(this.items,(t=>({top:t.getBoundingClientRect().top,isDivider:t.classList.contains("ActionBar-divider")})));let s=!1;for(let t=0;t<n.length;t++){const o=n[t];o.isDivider?s=!0:(o.top>e?(b(this,Dt,"m",Rt).call(this,t,i),this.moreMenu.hidden&&(this.moreMenu.hidden=!1),s&&b(this,Dt,"m",Rt).call(this,t-1,i)):(b(this,Dt,"m",Ft).call(this,t,i),t===this.items.length-1&&(this.moreMenu.hidden=!0),s&&b(this,Dt,"m",Ft).call(this,t-1,i)),s=!1)}b(this,Pt,"f")&&b(this,Pt,"f").abort(),v(this,Pt,It(this,{bindKeys:Et.ArrowHorizontal|Et.HomeAndEnd,focusOutBehavior:"wrap",focusableElementFilter:t=>{const e=this.items.indexOf(t.parentElement),i=e>-1&&"visible"===this.items[e].style.visibility,n=t===this.moreMenu.invokerElement&&!this.moreMenu.hidden;return i||n}}),"f")},Nt=function(){return this.items.find((t=>!t.classList.contains("ActionBar-divider")))??null},Ft=function(t,e){const i=this.items[t],n=e[t];i&&n&&(i.style.setProperty("visibility","visible"),n.hidden=!0)},Rt=function(t,e){const i=this.items[t],n=e[t];i&&n&&(i.style.setProperty("visibility","hidden"),n.hidden=!1)},qt=function(){return this.moreMenu.querySelectorAll('[role="menu"] > li')},g([j],Bt.prototype,"items",void 0),g([U],Bt.prototype,"itemContainer",void 0),g([U],Bt.prototype,"moreMenu",void 0),Bt=g([K("action-bar")],Bt),window.ActionBarElement=Bt;class DetailsMenuElement extends HTMLElement{get preload(){return this.hasAttribute("preload")}set preload(t){t?this.setAttribute("preload",""):this.removeAttribute("preload")}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","menu");const t=this.parentElement;if(!t)return;const e=t.querySelector("summary");e&&(e.setAttribute("aria-haspopup","menu"),e.hasAttribute("role")||e.setAttribute("role","button"));const i=[Ut(t,"compositionstart",(t=>te(this,t))),Ut(t,"compositionend",(t=>te(this,t))),Ut(t,"click",(e=>Gt(t,e))),Ut(t,"change",(e=>Gt(t,e))),Ut(t,"keydown",(e=>function(t,e,i){if(!(i instanceof KeyboardEvent))return;if(t.querySelector("details[open]"))return;const n=$t.get(e);if(!n||n.isComposing)return;const s=i.target instanceof Element&&"SUMMARY"===i.target.tagName;switch(i.key){case"Escape":t.hasAttribute("open")&&(Qt(t),i.preventDefault(),i.stopPropagation());break;case"ArrowDown":{s&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=Yt(t,!0);e&&e.focus(),i.preventDefault()}break;case"ArrowUp":{s&&!t.hasAttribute("open")&&t.setAttribute("open","");const e=Yt(t,!1);e&&e.focus(),i.preventDefault()}break;case"n":if(Zt&&i.ctrlKey){const e=Yt(t,!0);e&&e.focus(),i.preventDefault()}break;case"p":if(Zt&&i.ctrlKey){const e=Yt(t,!1);e&&e.focus(),i.preventDefault()}break;case" ":case"Enter":{const e=document.activeElement;e instanceof HTMLElement&&Xt(e)&&e.closest("details")===t&&(i.preventDefault(),i.stopPropagation(),e.click())}}}(t,this,e))),Ut(t,"toggle",(()=>jt(t,this)),{once:!0}),Ut(t,"toggle",(()=>function(t){if(!t.hasAttribute("open"))return;for(const e of document.querySelectorAll("details[open] > details-menu")){const i=e.closest("details");i&&i!==t&&!i.contains(t)&&i.removeAttribute("open")}}(t))),this.preload?Ut(t,"mouseover",(()=>jt(t,this)),{once:!0}):_t,...Kt(t)];$t.set(this,{subscriptions:i,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=$t.get(this);if(t){$t.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const $t=new WeakMap,_t={unsubscribe(){}};function Ut(t,e,i,n=!1){return t.addEventListener(e,i,n),{unsubscribe:()=>{t.removeEventListener(e,i,n)}}}function jt(t,e){const i=e.getAttribute("src");if(!i)return;const n=$t.get(e);if(!n)return;if(n.loaded)return;n.loaded=!0;const s=e.querySelector("include-fragment");s&&!s.hasAttribute("src")&&(s.addEventListener("loadend",(()=>zt(t))),s.setAttribute("src",i))}function Kt(t){let e=!1;return[Ut(t,"mousedown",(()=>e=!0)),Ut(t,"keydown",(()=>e=!1)),Ut(t,"toggle",(()=>{t.hasAttribute("open")&&(zt(t)||e||function(t){const e=document.activeElement;if(e&&Xt(e)&&t.contains(e))return;const i=Yt(t,!0);i&&i.focus()}(t))}))]}function zt(t){if(!t.hasAttribute("open"))return!1;const e=t.querySelector("details-menu [autofocus]");return!!e&&(e.focus(),!0)}function Yt(t,e){const i=Array.from(t.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled])')),n=document.activeElement,s=n instanceof HTMLElement?i.indexOf(n):-1,o=e?i[s+1]:i[s-1],r=e?i[0]:i[i.length-1];return o||r}const Zt=navigator.userAgent.match(/Macintosh/);function Gt(t,e){const i=e.target;if(i instanceof Element&&i.closest("details")===t)if("click"===e.type){const e=i.closest('[role="menuitem"], [role="menuitemradio"]');if(!e)return;const n=e.querySelector("input");if("LABEL"===e.tagName&&i===n)return;"LABEL"===e.tagName&&n&&!n.checked||Jt(e,t)}else if("change"===e.type){const e=i.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');e&&Jt(e,t)}}function Jt(t,e){if(t.hasAttribute("disabled")||"true"===t.getAttribute("aria-disabled"))return;const i=t.closest("details-menu");if(!i)return;i.dispatchEvent(new CustomEvent("details-menu-select",{cancelable:!0,detail:{relatedTarget:t}}))&&(!function(t,e){const i=e.querySelector("[data-menu-button]");if(!i)return;const n=function(t){if(!t)return null;const e=t.hasAttribute("data-menu-button-text")?t:t.querySelector("[data-menu-button-text]");return e?e.getAttribute("data-menu-button-text")||e.textContent:null}(t);if(n)i.textContent=n;else{const e=function(t){if(!t)return null;const e=t.hasAttribute("data-menu-button-contents")?t:t.querySelector("[data-menu-button-contents]");return e?e.innerHTML:null}(t);e&&(i.innerHTML=e)}}(t,e),function(t,e){for(const i of e.querySelectorAll('[role="menuitemradio"], [role="menuitemcheckbox"]')){const e=i.querySelector('input[type="radio"], input[type="checkbox"]');let n=(i===t).toString();e instanceof HTMLInputElement&&(n=e.indeterminate?"mixed":e.checked.toString()),i.setAttribute("aria-checked",n)}}(t,e),"menuitemcheckbox"!==t.getAttribute("role")&&Qt(e),i.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:t}})))}function Xt(t){const e=t.getAttribute("role");return"menuitem"===e||"menuitemcheckbox"===e||"menuitemradio"===e}function Qt(t){if(!t.hasAttribute("open"))return;t.removeAttribute("open");const e=t.querySelector("summary");e&&e.focus()}function te(t,e){const i=$t.get(t);i&&(i.isComposing="compositionstart"===e.type)}var ee,ie;window.customElements.get("details-menu")||(window.DetailsMenuElement=DetailsMenuElement,window.customElements.define("details-menu",DetailsMenuElement));const ne=(()=>{const t=new Set;let e=null,i=null;function n(){for(const e of t)e.update()}return s=>{window.addEventListener("resize",n),window.addEventListener("scroll",n),e||(e=new IntersectionObserver((e=>{for(const i of e){const e=i.target;i.isIntersecting?(e.update(),t.add(e)):t.delete(e)}}))),i||(i=new ResizeObserver((()=>{for(const e of t)e.update()}))),i.observe(s.ownerDocument.documentElement),e.observe(s)}})();class AnchoredPositionElement extends HTMLElement{constructor(){super(...arguments),ee.set(this,null),ie.set(this,void 0)}get align(){const t=this.getAttribute("align");return"center"===t||"end"===t?t:"start"}set align(t){this.setAttribute("align",`${t}`)}get side(){const t=this.getAttribute("side");return"inside-top"===t||"inside-bottom"===t||"inside-left"===t||"inside-right"===t||"inside-center"===t||"outside-top"===t||"outside-left"===t||"outside-right"===t?t:"outside-bottom"}set side(t){this.setAttribute("side",`${t}`)}get anchorOffset(){const t=this.getAttribute("anchor-offset");return"spacious"===t||"8"===t?8:4}set anchorOffset(t){this.setAttribute("anchor-offset",`${t}`)}get anchor(){return this.getAttribute("anchor")||""}set anchor(t){this.setAttribute("anchor",`${t}`)}get anchorElement(){if(b(this,ee,"f"))return b(this,ee,"f");const t=this.anchor;return t?this.ownerDocument.getElementById(t):null}set anchorElement(t){v(this,ee,t,"f"),b(this,ee,"f")||this.removeAttribute("anchor")}get alignmentOffset(){return Number(this.getAttribute("alignment-offset"))}set alignmentOffset(t){this.setAttribute("alignment-offset",`${t}`)}get allowOutOfBounds(){return this.hasAttribute("allow-out-of-bounds")}set allowOutOfBounds(t){this.toggleAttribute("allow-out-of-bounds",t)}connectedCallback(){this.update(),this.addEventListener("beforetoggle",(()=>this.update())),ne(this)}attributeChangedCallback(){this.update()}update(){this.isConnected&&(cancelAnimationFrame(b(this,ie,"f")),v(this,ie,requestAnimationFrame((()=>{const t=this.anchorElement;if(this.classList.toggle("not-anchored",!t),t){const{left:e,top:i}=X(this,t,this);this.style.top=`${i}px`,this.style.left=`${e}px`,this.style.bottom="auto",this.style.right="auto"}else this.style.top="0",this.style.left="0",this.style.bottom="0",this.style.right="0"})),"f"))}}var se,oe,re;function ae(t){t.body.style.getPropertyValue("--dialog-scrollgutter")||t.body.style.setProperty("--dialog-scrollgutter",window.innerWidth-t.body.clientWidth+"px")}function le(t){const e=t.target,i=e?.closest("button");if(!i||i.hasAttribute("disabled")||"true"===i.getAttribute("aria-disabled"))return;let n=i?.getAttribute("data-show-dialog-id");if(n){const e=document.getElementById(n);if(e instanceof HTMLDialogElement){ae(e.ownerDocument),e.showModal(),t.preventDefault();let n=i,s=!1;for(;n;)n=n.parentElement?.closest("[popover]"),n&&"auto"===n.popover&&(n.classList.add("dialog-inside-popover-fix"),n.popover="manual",n.showPopover(),s=!0);s&&(e.addEventListener("close",(t=>t.stopImmediatePropagation()),{once:!0}),e.close(),e.showModal(),e.addEventListener("close",(()=>{for(const t of e.ownerDocument.querySelectorAll(".dialog-inside-popover-fix"))t.contains(e)&&(t.classList.remove("dialog-inside-popover-fix"),t.popover="auto",t.showPopover())}),{once:!0}))}}if(n=i.getAttribute("data-close-dialog-id")||i.getAttribute("data-submit-dialog-id"),n){const t=document.getElementById(n);t instanceof HTMLDialogElement&&t.open&&t.close()}}ee=new WeakMap,ie=new WeakMap,AnchoredPositionElement.observedAttributes=["align","side","anchor","alignment-offset","allow-out-of-bounds"],customElements.get("anchored-position")||(window.AnchoredPositionElement=AnchoredPositionElement,customElements.define("anchored-position",AnchoredPositionElement));class DialogHelperElement extends HTMLElement{constructor(){super(...arguments),se.add(this),oe.set(this,null)}get dialog(){return this.querySelector("dialog")}connectedCallback(){const{signal:t}=v(this,oe,new AbortController,"f");document.addEventListener("click",le,!0),document.addEventListener("click",this,{signal:t}),new MutationObserver((t=>{for(const e of t)e.target===this.dialog&&b(this,se,"m",re).call(this)})).observe(this,{subtree:!0,attributeFilter:["open"]}),b(this,se,"m",re).call(this)}disconnectedCallback(){b(this,oe,"f")?.abort()}handleEvent(t){const e=t.target,i=this.dialog;if(e!==i||!i?.open)return;if(i.querySelector("form"))return;const n=i.getBoundingClientRect();n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width||i.close()}}oe=new WeakMap,se=new WeakSet,re=function(){this.dialog&&this.dialog.matches("[open]:not(:modal)")&&(this.dialog.addEventListener("close",(t=>t.stopImmediatePropagation()),{once:!0}),this.dialog.close(),ae(this.dialog.ownerDocument),this.dialog.showModal())},window.customElements.get("dialog-helper")||(window.DialogHelperElement=DialogHelperElement,window.customElements.define("dialog-helper",DialogHelperElement));var ce=class extends Event{oldState;newState;constructor(t,{oldState:e="",newState:i="",...n}={}){super(t,n),this.oldState=String(e||""),this.newState=String(i||"")}},de=new WeakMap;function he(t,e,i){de.set(t,setTimeout((()=>{de.has(t)&&t.dispatchEvent(new ce("toggle",{cancelable:!1,oldState:e,newState:i}))}),0))}var ue=globalThis.ShadowRoot||function(){},me=globalThis.HTMLDialogElement||function(){},fe=new WeakMap,pe=new WeakMap,ge=new WeakMap;function be(t){return ge.get(t)||"hidden"}var ve=new WeakMap;function we(t,e){return("auto"===t.popover||"manual"===t.popover)&&(!!t.isConnected&&((!e||"showing"===be(t))&&(!(!e&&"hidden"!==be(t))&&(!(t instanceof me&&t.hasAttribute("open"))&&document.fullscreenElement!==t))))}function ye(t){return t?Array.from(pe.get(t.ownerDocument)||[]).indexOf(t)+1:0}function Ee(t){const e=ke(t),i=function(t){for(;t;){const e=t.popoverTargetElement;if(e instanceof HTMLElement)return e;if((t=t.parentElement||Le(t))instanceof ue&&(t=t.host),t instanceof Document)return}}(t);return ye(e)>ye(i)?e:i}function Ae(t){const e=pe.get(t);for(const t of e||[]){if(t.isConnected)return t;e.delete(t)}return null}function Le(t){return"function"==typeof t.getRootNode?t.getRootNode():t.parentNode?Le(t.parentNode):t}function ke(t){for(;t;){if(t instanceof HTMLElement&&"auto"===t.popover&&"showing"===ge.get(t))return t;if((t=t instanceof Element&&t.assignedSlot||t.parentElement||Le(t))instanceof ue&&(t=t.host),t instanceof Document)return}}function Te(t){return!(t.hidden||t instanceof ue)&&((!(t instanceof HTMLButtonElement||t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLOptGroupElement||t instanceof HTMLOptionElement||t instanceof HTMLFieldSetElement)||!t.disabled)&&(!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(!(t instanceof HTMLAnchorElement&&""===t.href)&&("number"==typeof t.tabIndex&&-1!==t.tabIndex))))}function Se(t){(function(t){if(t.shadowRoot&&!0!==t.shadowRoot.delegatesFocus)return null;let e=t;e.shadowRoot&&(e=e.shadowRoot);let i=e.querySelector("[autofocus]");if(i)return i;{const t=e.querySelectorAll("slot");for(const e of t){const t=e.assignedElements({flatten:!0});for(const e of t){if(e.hasAttribute("autofocus"))return e;if(i=e.querySelector("[autofocus]"),i)return i}}}const n=t.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let s=n.currentNode;for(;s;){if(Te(s))return s;s=n.nextNode()}})(t)?.focus()}var Ce=new WeakMap;function xe(t){if(!we(t,!1))return;const e=t.ownerDocument;if(!t.dispatchEvent(new ce("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"})))return;if(!we(t,!1))return;let i=!1;if("auto"===t.popover){const i=t.getAttribute("popover");if(De(function(t){const e=new Map;let i=0;for(const n of pe.get(t.ownerDocument)||[])e.set(n,i),i+=1;e.set(t,i),i+=1;let n=null;return function(t){const i=ke(t);if(null===i)return null;const s=e.get(i);(null===n||e.get(n)<s)&&(n=i)}(t.parentElement||Le(t)),n}(t)||e,!1,!0),i!==t.getAttribute("popover")||!we(t,!1))return}Ae(e)||(i=!0),Ce.delete(t);const n=e.activeElement;t.classList.add(":popover-open"),ge.set(t,"showing"),fe.has(e)||fe.set(e,new Set),fe.get(e).add(t),Se(t),"auto"===t.popover&&(pe.has(e)||pe.set(e,new Set),pe.get(e).add(t),Ne(ve.get(t),!0)),i&&n&&"auto"===t.popover&&Ce.set(t,n),he(t,"closed","open")}function Me(t,e=!1,i=!1){if(!we(t,!0))return;const n=t.ownerDocument;if("auto"===t.popover&&(De(t,e,i),!we(t,!0)))return;if(Ne(ve.get(t),!1),ve.delete(t),i&&(t.dispatchEvent(new ce("beforetoggle",{oldState:"open",newState:"closed"})),!we(t,!0)))return;fe.get(n)?.delete(t),pe.get(n)?.delete(t),t.classList.remove(":popover-open"),ge.set(t,"hidden"),i&&he(t,"open","closed");const s=Ce.get(t);s&&(Ce.delete(t),e&&s.focus())}function Ie(t,e=!1,i=!1){let n=Ae(t);for(;n;)Me(n,e,i),n=Ae(t)}function De