import{w as h}from"./factory-BR3bc_RM.js";var y=e=>e?.constructor.name==="Array",q=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!m(e[r],t[r]))return!1;return!0},m=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof e?.isEqual=="function"&&typeof t?.isEqual=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(y(e)&&y(t))return q(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const r=Object.keys(t??Object.create(null)),n=r.length;for(let i=0;i<n;i++)if(!Reflect.has(e,r[i]))return!1;for(let i=0;i<n;i++){const s=r[i];if(!m(e[s],t[s]))return!1}return!0};function w(e,t){return Array.from(e?.querySelectorAll(t)??[])}function B(e,t){return e?.querySelector(t)??null}var a=e=>e.id;function A(e,t,r=a){return e.find(n=>r(n)===t)}function S(e,t,r=a){const n=A(e,t,r);return n?e.indexOf(n):-1}var k=e=>e.split("").map(t=>{const r=t.charCodeAt(0);return r>0&&r<128?t:r>=128&&r<=255?`/x${r.toString(16)}`.replace("/","\\"):""}).join("").trim(),x=e=>k(e.dataset?.valuetext??e.textContent??""),T=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase());function j(e,t,r,n=a){const i=r?S(e,r,n):-1;let s=r?h(e,i):e;return t.length===1&&(s=s.filter(o=>n(o)!==r)),s.find(o=>T(x(o),t))}function v(e,t){const{state:r,activeId:n,key:i,timeout:s=350,itemToId:l}=t,o=r.keysSoFar+i,p=o.length>1&&Array.from(o).every(u=>u===o[0])?o[0]:o;let d=e.slice();const g=j(d,p,n,l);function f(){clearTimeout(r.timer),r.timer=-1}function c(u){r.keysSoFar=u,f(),u!==""&&(r.timer=+setTimeout(()=>{c(""),f()},s))}return c(o),g}var C=Object.assign(v,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:E});function E(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}export{B as a,C as g,m as i,w as q};
