mirror of
https://github.com/meshcore-dev/map.meshcore.dev.git
synced 2026-04-20 22:13:50 +00:00
1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
|
|
const V=[];function S(){return window.matchMedia("(pointer: coarse)").matches}function lt(){return window.matchMedia("(prefers-color-scheme: dark)").matches}async function W(t){await new Promise(n=>setTimeout(n,t))}function ft(){return"fxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}function h(t,n){try{return typeof t=="string"?(n??document).querySelector(t):t}catch{return null}}function s(t,n){try{return typeof t=="string"?(n??document).querySelectorAll(t):t??V}catch{return V}}function u(t,n){return(t==null?void 0:t.classList.contains(n))??!1}function y(t,n){var e;return((e=t==null?void 0:t.tagName)==null?void 0:e.toLowerCase())===n}function T(t,n){var e;return((e=t==null?void 0:t.type)==null?void 0:e.toLowerCase())===n}function g(t,n){if(t instanceof NodeList)for(let e=0;e<t.length;e++)t[e].classList.add(n);else t==null||t.classList.add(n)}function p(t,n){if(t instanceof NodeList)for(let e=0;e<t.length;e++)t[e].classList.remove(n);else t==null||t.classList.remove(n)}function o(t,n,e,i=!0){t!=null&&t.addEventListener&&t.addEventListener(n,e,i)}function F(t,n,e,i=!0){t!=null&&t.removeEventListener&&t.removeEventListener(n,e,i)}function dt(t,n){var e;(e=n==null?void 0:n.parentNode)==null||e.insertBefore(t,n)}function O(t){return t==null?void 0:t.previousElementSibling}function $(t){return t==null?void 0:t.nextElementSibling}function v(t){return t==null?void 0:t.parentElement}function pt(t){const n=document.createElement("div");for(let e=0,i=Object.keys(t),a=i.length;e<a;e++){const c=i[e],r=t[c];n.setAttribute(c,r)}return n}function _(){var t;(t=document.activeElement)==null||t.blur()}function yt(t){return s('[data-ui="#'+t+'"]')}function gt(t){return h('[data-ui="#'+t+'"]')}function ht(t){t.id&&u(t,"page")&&(t=gt(t.id)??t);const n=v(t);if(!u(n,"tabs")&&!u(n,"tabbed")&&!y(n,"nav"))return;const e=s("a",n);for(let i=0;i<e.length;i++)p(e[i],"active");g(t,"active")}function X(t){t.placeholder||(t.placeholder=" ")}function vt(t){const n=t.currentTarget,e=v(n),i=h("input:not([type=file], [type=checkbox], [type=radio]), select, textarea",e);i&&i.focus()}function z(t){const n=t.currentTarget;L(n)}function N(t){const n=t.currentTarget;L(n)}function bt(t){const n=t.currentTarget;R(n)}function xt(t){const n=t.currentTarget;q(n)}function kt(t){const n=t.currentTarget;R(n,t)}function mt(t){const n=t.currentTarget;q(n,t)}function wt(t){const n=t.currentTarget;Y(n)}function Ct(t){var i;const n=t.currentTarget,e=h("input",v(n));e&&((i=n.textContent)!=null&&i.includes("visibility"))&&(e.type=e.type==="password"?"text":"password")}function Tt(){const t=s(".field > label");for(let n=0;n<t.length;n++)o(t[n],"click",vt)}function Lt(){const t=s(".field > input:not([type=file], [type=color], [type=range])");for(let n=0;n<t.length;n++)o(t[n],"focus",z),o(t[n],"blur",N),L(t[n])}function At(){const t=s(".field > select");for(let n=0;n<t.length;n++)o(t[n],"focus",z),o(t[n],"blur",N)}function Et(){const t=s(".field > input[type=file]");for(let n=0;n<t.length;n++)o(t[n],"change",bt),R(t[n])}function St(){const t=s(".field > input[type=color]");for(let n=0;n<t.length;n++)o(t[n],"change",xt),q(t[n])}function Dt(){const t=s(".field.textarea > textarea");for(let n=0;n<t.length;n++)o(t[n],"focus",z),o(t[n],"blur",N),o(t[n],"input",wt),Y(t[n])}function It(){const t=s("input[type=password] ~ :is(i, a)");for(let n=0;n<t.length;n++)o(t[n],"click",Ct)}function L(t){T(t,"number")&&!t.value&&(t.value=""),X(t)}function R(t,n){if((n==null?void 0:n.key)==="Enter"){const i=O(t);if(!T(i,"file"))return;i.click();return}const e=$(t);T(e,"text")&&(e.value=t.files?Array.from(t.files).map(i=>i.name).join(", "):"",e.readOnly=!0,o(e,"keydown",kt,!1),L(e))}function q(t,n){if((n==null?void 0:n.key)==="Enter"){const i=O(t);if(!T(i,"color"))return;i.click();return}const e=$(t);T(e,"text")&&(e.readOnly=!0,e.value=t.value,o(e,"keydown",mt,!1),L(e))}function Y(t){X(t);const n=v(t);n.removeAttribute("style"),u(n,"min")&&n.style.setProperty("---size",`${Math.min(192,Math.max(t.scrollHeight,n.offsetHeight))}p
|