UNPKG

sui-explorer-local

Version:
5 lines (4 loc) 11.5 kB
import{r as c,R as E,a as A}from"./index-76fb7be0.js";var R=Object.defineProperty,C=(e,t,n)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t,n)=>(C(e,typeof t!="symbol"?t+"":t,n),n);let k=class{constructor(){b(this,"current",this.detect()),b(this,"handoffState","pending"),b(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},v=new k,L=(e,t)=>{v.isServer?c.useEffect(e,t):c.useLayoutEffect(e,t)};function O(e){let t=c.useRef(e);return L(()=>{t.current=e},[e]),t}let H=function(e){let t=O(e);return E.useCallback((...n)=>t.current(...n),[t])};function pe(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function D(){let e=typeof document>"u";return"useSyncExternalStore"in A?(t=>t.useSyncExternalStore)(A)(()=>()=>{},()=>!1,()=>!e):!1}function U(){let e=D(),[t,n]=c.useState(v.isHandoffComplete);return t&&v.isHandoffComplete===!1&&n(!1),c.useEffect(()=>{t!==!0&&n(!0)},[t]),c.useEffect(()=>v.handoff(),[]),e?!1:t}var F;let he=(F=E.useId)!=null?F:function(){let e=U(),[t,n]=E.useState(e?()=>v.nextId():null);return L(()=>{t===null&&n(v.nextId())},[t]),t!=null?""+t:void 0};function $(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,$),r}function _(e){return v.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let S=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var q=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(q||{}),K=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(K||{}),W=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(W||{});function B(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(S)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var j=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(j||{});function G(e,t=0){var n;return e===((n=_(e))==null?void 0:n.body)?!1:$(t,{0(){return e.matches(S)},1(){let r=e;for(;r!==null;){if(r.matches(S))return!0;r=r.parentElement}return!1}})}var V=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(V||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function ve(e){e==null||e.focus({preventScroll:!0})}let X=["textarea","input"].join(",");function z(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,X))!=null?n:!1}function Y(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),l=t(r);if(o===null||l===null)return 0;let i=o.compareDocumentPosition(l);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ge(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let l=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?Y(e):e:B(e);o.length>0&&i.length>1&&(i=i.filter(m=>!o.includes(m))),r=r??l.activeElement;let f=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=t&32?{preventScroll:!0}:{},a=0,s=i.length,d;do{if(a>=s||a+s<=0)return 0;let m=u+a;if(t&16)m=(m+s)%s;else{if(m<0)return 3;if(m>=s)return 1}d=i[m],d==null||d.focus(p),a+=f}while(d!==l.activeElement);return t&6&&z(d)&&d.select(),2}function J(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Q(){return/Android/gi.test(window.navigator.userAgent)}function Z(){return J()||Q()}function g(e,t,n){let r=O(t);c.useEffect(()=>{function o(l){r.current(l)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function ee(e,t,n){let r=O(t);c.useEffect(()=>{function o(l){r.current(l)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function we(e,t,n=!0){let r=c.useRef(!1);c.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(i,f){if(!r.current||i.defaultPrevented)return;let u=f(i);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let p=function a(s){return typeof s=="function"?a(s()):Array.isArray(s)||s instanceof Set?s:[s]}(e);for(let a of p){if(a===null)continue;let s=a instanceof HTMLElement?a:a.current;if(s!=null&&s.contains(u)||i.composed&&i.composedPath().includes(s))return}return!G(u,j.Loose)&&u.tabIndex!==-1&&i.preventDefault(),t(i,u)}let l=c.useRef(null);g("pointerdown",i=>{var f,u;r.current&&(l.current=((u=(f=i.composedPath)==null?void 0:f.call(i))==null?void 0:u[0])||i.target)},!0),g("mousedown",i=>{var f,u;r.current&&(l.current=((u=(f=i.composedPath)==null?void 0:f.call(i))==null?void 0:u[0])||i.target)},!0),g("click",i=>{Z()||l.current&&(o(i,()=>l.current),l.current=null)},!0),g("touchend",i=>o(i,()=>i.target instanceof HTMLElement?i.target:null),!0),ee("blur",i=>o(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}let I=Symbol();function Ee(e,t=!0){return Object.assign(e,{[I]:t})}function ye(...e){let t=c.useRef(e);c.useEffect(()=>{t.current=e},[e]);let n=H(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[I]))?void 0:n}function P(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var te=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(te||{}),ne=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ne||{});function re({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:l=!0,name:i,mergeRefs:f}){f=f??oe;let u=M(t,e);if(l)return w(u,n,r,i,f);let p=o??0;if(p&2){let{static:a=!1,...s}=u;if(a)return w(s,n,r,i,f)}if(p&1){let{unmount:a=!0,...s}=u;return $(a?0:1,{0(){return null},1(){return w({...s,hidden:!0,style:{display:"none"}},n,r,i,f)}})}return w(u,n,r,i,f)}function w(e,t={},n,r,o){let{as:l=n,children:i,refName:f="ref",...u}=N(e,["unmount","static"]),p=e.ref!==void 0?{[f]:e.ref}:{},a=typeof i=="function"?i(t):i;"className"in u&&u.className&&typeof u.className=="function"&&(u.className=u.className(t));let s={};if(t){let d=!1,m=[];for(let[y,h]of Object.entries(t))typeof h=="boolean"&&(d=!0),h===!0&&m.push(y);d&&(s["data-headlessui-state"]=m.join(" "))}if(l===c.Fragment&&Object.keys(T(u)).length>0){if(!c.isValidElement(a)||Array.isArray(a)&&a.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(u).map(h=>` - ${h}`).join(` `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(h=>` - ${h}`).join(` `)].join(` `));let d=a.props,m=typeof(d==null?void 0:d.className)=="function"?(...h)=>P(d==null?void 0:d.className(...h),u.className):P(d==null?void 0:d.className,u.className),y=m?{className:m}:{};return c.cloneElement(a,Object.assign({},M(a.props,T(N(u,["ref"]))),s,p,{ref:o(a.ref,p.ref)},y))}return c.createElement(l,Object.assign({},N(u,["ref"]),l!==c.Fragment&&p,l!==c.Fragment&&s),a)}function be(){let e=c.useRef([]),t=c.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function oe(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function M(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...l){let i=n[r];for(let f of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;f(o,...l)}}});return t}function ie(e){var t;return Object.assign(c.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function T(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function N(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let ue="div";var le=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(le||{});function ae(e,t){var n;let{features:r=1,...o}=e,l={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return re({ourProps:l,theirProps:o,slot:{},defaultTag:ue,name:"Hidden"})}let Ne=ie(ae),x=c.createContext(null);x.displayName="OpenClosedContext";var se=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(se||{});function Se(){return c.useContext(x)}function Oe({value:e,children:t}){return E.createElement(x.Provider,{value:e},t)}function $e(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&ce(n)?!1:r}function ce(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}var fe=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(fe||{});export{ge as A,ve as B,re as C,J as D,he as I,q as M,K as N,te as O,Ee as T,ie as U,H as a,ee as b,v as c,U as d,le as e,Ne as f,P as g,Oe as h,se as i,Se as j,we as k,L as l,G as m,j as n,_ as o,fe as p,Y as q,$e as r,O as s,pe as t,$ as u,ne as v,B as w,T as x,ye as y,be as z};