Files
nimbus/resources/dist/assets/useResponsiveResizable.js
Mazen Touati c2aa6895d6 feat: initial alpha release
This commit represents the complete foundational codebase for Nimbus Alpha, a Laravel package that provides an integrated, in-browser API client with automatic schema discovery from validation rules.

IMPORTANT: This is a squashed commit representing the culmination of extensive development, refactoring, and architectural iterations. All previous commit history has been intentionally removed to provide a clean foundation for the public alpha release.

The development of Nimbus involved:
- Multiple architectural refactorings
- Significant structural changes
- Experimental approaches that were later abandoned
- Learning iterations on the core concept
- Migration between different design patterns

This messy history would:
- Make git blame confusing and unhelpful
- Obscure the actual intent behind current implementation
- Create noise when reviewing changes
- Reference deleted or refactored code

If git blame brought you to this commit, it means you're looking at code that was part of the initial alpha release. Here's what to do:

1. Check Current Documentation
   - See `/wiki/contribution-guide/README.md` for architecture details
   - Review the specific module's README if available
   - Look for inline comments explaining the reasoning

2. Look for Related Code
   - Check other files in the same module
   - Look for tests that demonstrate intended behavior
   - Review interfaces and contracts

3. Context Matters
   - This code may have been updated since alpha
   - Check git log for subsequent changes to this file
   - Look for related issues or PRs on GitHub

---

This commit marks the beginning of Nimbus's public journey. All future
commits will build upon this foundation with clear, traceable history.

Thank you for using or contributing to Nimbus!
2025-10-23 00:16:28 +02:00

12 lines
32 KiB
JavaScript

import{aR as de,d as B,c as gt,t as Ie,f as ke,s as zt,a as je,g as $,h as N,i as Ae,b as T,o as k,w as Y,r as oe,G as Ke,e as w,P as Le,b6 as bt,j as xt,z as St,J as Ue,L as wt,u as Et,ai as _t,b7 as Ct,b8 as Pt,$ as te,H as ne,I as ae,ad as It,b9 as Rt,aE as We,a4 as $e,n as kt,l as Me,m as De,W as be,aq as At,a6 as Lt,ab as $t,Y as Mt,aj as Dt,Z as Nt,aZ as Bt}from"./app.js";import{u as Gt,_ as Ht}from"./index.js";const ve=typeof document<"u";function x(e,t="Assertion failed!"){if(!e)throw console.error(t),new Error(t)}function Xe(e,t=document){var a;if(!ve)return null;if(t instanceof HTMLElement&&((a=t==null?void 0:t.dataset)==null?void 0:a.panelGroupId)===e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function Se(e,t=document){if(!ve)return null;const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function Je(e,t,n=document){return ve?fe(e,n).findIndex(l=>l.getAttribute("data-panel-resize-handle-id")===t)??null:null}function fe(e,t=document){return ve?Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`)):[]}function Vt(e,t,n,a=document){var p,f;const s=Se(t,a),l=fe(e,a),o=s?l.indexOf(s):-1,r=((p=n[o])==null?void 0:p.id)??null,i=((f=n[o+1])==null?void 0:f.id)??null;return[r,i]}function Ye(e){return e.type==="keydown"}function Ze(e){return e.type.startsWith("mouse")}function Qe(e){return e.type.startsWith("touch")}function we(e){if(Ze(e))return{x:e.clientX,y:e.clientY};if(Qe(e)){const t=e.touches[0];if(t&&t.clientX&&t.clientY)return{x:t.clientX,y:t.clientY}}return{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY}}function et(e,t){const n=e==="horizontal",{x:a,y:s}=we(t);return n?a:s}function Ot(e,t,n,a,s){const l=n==="horizontal",o=Se(t,s);x(o);const r=o.getAttribute("data-panel-group-id");x(r);const{initialCursorPosition:i}=a,p=et(n,e),f=Xe(r,s);x(f);const u=f.getBoundingClientRect(),v=l?u.width:u.height;return(p-i)/v*100}function qt(e,t,n,a,s,l){if(Ye(e)){const o=n==="horizontal";let r=0;e.shiftKey?r=100:r=s??10;let i=0;switch(e.key){case"ArrowDown":i=o?0:r;break;case"ArrowLeft":i=o?-r:0;break;case"ArrowRight":i=o?r:0;break;case"ArrowUp":i=o?0:-r;break;case"End":i=100;break;case"Home":i=-100;break}return i}else return a==null?0:Ot(e,t,n,a,l)}function Tt({layout:e,panelsArray:t,pivotIndices:n}){let a=0,s=100,l=0,o=0;const r=n[0];x(r!=null),t.forEach((u,v)=>{const{constraints:d}=u,{maxSize:h=100,minSize:E=0}=d;v===r?(a=E,s=h):(l+=E,o+=h)});const i=Math.min(s,100-l),p=Math.max(a,100-o),f=e[r];return{valueMax:i,valueMin:p,valueNow:f}}function Ft({panelDataArray:e}){const t=Array.from({length:e.length}),n=e.map(l=>l.constraints);let a=0,s=100;for(let l=0;l<e.length;l++){const o=n[l];x(o);const{defaultSize:r}=o;r!=null&&(a++,t[l]=r,s-=r)}for(let l=0;l<e.length;l++){const o=n[l];x(o);const{defaultSize:r}=o;if(r!=null)continue;const i=e.length-a,p=s/i;a++,t[l]=p,s-=p}return t}function ie(e,t,n){t.forEach((a,s)=>{const l=e[s];x(l);const{callbacks:o,constraints:r,id:i}=l,{collapsedSize:p=0,collapsible:f}=r,u=n[i];if(u==null||a!==u){n[i]=a;const{onCollapse:v,onExpand:d,onResize:h}=o;h&&h(a,u),f&&(v||d)&&(d&&(u==null||u===p)&&a!==p&&d(),v&&(u==null||u!==p)&&a===p&&v())}})}function jt(e,t=10){let n=null;return(...s)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...s)},t)}}const Ne=10;function pe(e,t,n=Ne){e=Number.parseFloat(e.toFixed(n)),t=Number.parseFloat(t.toFixed(n));const a=e-t;return a===0?0:a>0?1:-1}function H(e,t,n){return pe(e,t,n)===0}function le({panelConstraints:e,panelIndex:t,size:n}){const a=e[t];x(a!=null);const{collapsedSize:s=0,collapsible:l,maxSize:o=100,minSize:r=0}=a;if(pe(n,r)<0)if(l){const i=(s+r)/2;pe(n,i)<0?n=s:n=r}else n=r;return n=Math.min(o,n),n=Number.parseFloat(n.toFixed(Ne)),n}function ge(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ue({delta:e,layout:t,panelConstraints:n,pivotIndices:a,trigger:s}){if(H(e,0))return t;const l=[...t],[o,r]=a;x(o!=null),x(r!=null);let i=0;if(s==="keyboard"){{const f=e<0?r:o,u=n[f];if(x(u),u.collapsible){const v=t[f];x(v!=null);const d=n[f];x(d);const{collapsedSize:h=0,minSize:E=0}=d;if(H(v,h)){const m=E-v;pe(m,Math.abs(e))>0&&(e=e<0?0-m:m)}}}{const f=e<0?o:r,u=n[f];x(u);const{collapsible:v}=u;if(v){const d=t[f];x(d!=null);const h=n[f];x(h);const{collapsedSize:E=0,minSize:m=0}=h;if(H(d,m)){const S=d-E;pe(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}}{const f=e<0?1:-1;let u=e<0?r:o,v=0;for(;;){const h=t[u];x(h!=null);const m=le({panelConstraints:n,panelIndex:u,size:100})-h;if(v+=m,u+=f,u<0||u>=n.length)break}const d=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-d:d}{let u=e<0?o:r;for(;u>=0&&u<n.length;){const v=Math.abs(e)-Math.abs(i),d=t[u];x(d!=null);const h=d-v,E=le({panelConstraints:n,panelIndex:u,size:h});if(!H(d,E)&&(i+=d-E,l[u]=E,i.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?u--:u++}}if(H(i,0))return t;{const f=e<0?r:o,u=t[f];x(u!=null);const v=u+i,d=le({panelConstraints:n,panelIndex:f,size:v});if(l[f]=d,!H(d,v)){let h=v-d,m=e<0?r:o;for(;m>=0&&m<n.length;){const S=l[m];x(S!=null);const V=S+h,A=le({panelConstraints:n,panelIndex:m,size:V});if(H(S,A)||(h-=A-S,l[m]=A),H(h,0))break;e>0?m--:m++}}}const p=l.reduce((f,u)=>u+f,0);return H(p,100)?l:t}function tt(e,t,n){const a=Je(e,t,n);return a!=null?[a,a+1]:[-1,-1]}function Kt(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ut(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Te(e),b:Te(t)};let a;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),a=e;x(a);const s={a:qe(Oe(n.a)),b:qe(Oe(n.b))};if(s.a===s.b){const l=a.childNodes,o={a:n.a.at(-1),b:n.b.at(-1)};let r=l.length;for(;r--;){const i=l[r];if(i===o.a)return 1;if(i===o.b)return-1}}return Math.sign(s.a-s.b)}const Wt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Xt(e){const t=getComputedStyle(nt(e)).display;return t==="flex"||t==="inline-flex"}function Jt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Xt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Wt.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Oe(e){let t=e.length;for(;t--;){const n=e[t];if(x(n),Jt(n))return n}return null}function qe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Te(e){const t=[];for(;e;)t.push(e),e=nt(e);return t}function nt(e){var t;return e.parentNode instanceof DocumentFragment&&((t=e.parentNode)==null?void 0:t.host)||e.parentNode}const at=1,lt=2,ot=4,st=8;function Yt(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}const Zt=Yt()==="coarse",J=[];let Ee=!1;const W=new Map,_e=new Map,me=new Set;function Qt(e,t,n,a,s,l){const{ownerDocument:o}=t,r={direction:n,element:t,hitAreaMargins:a,nonce:s,setResizeHandlerState:l},i=W.get(o)??0;return W.set(o,i+1),me.add(r),xe(),function(){_e.delete(e),me.delete(r);const f=W.get(o)??1;W.set(o,f-1),xe(),it(),f===1&&W.delete(o)}}function ze(e){const{target:t}=e,{x:n,y:a}=we(e);Ee=!0,Be({target:t,x:n,y:a}),xe(),J.length>0&&(Ge("down",e),e.preventDefault())}function K(e){const{x:t,y:n}=we(e);if(!Ee){const{target:a}=e;Be({target:a,x:t,y:n})}Ge("move",e),rt(),J.length>0&&e.preventDefault()}function U(e){const{target:t}=e,{x:n,y:a}=we(e);_e.clear(),Ee=!1,J.length>0&&e.preventDefault(),Ge("up",e),Be({target:t,x:n,y:a}),rt(),xe()}function Be({target:e,x:t,y:n}){J.splice(0);let a=null;e instanceof HTMLElement&&(a=e),me.forEach(s=>{const{element:l,hitAreaMargins:o}=s,r=l.getBoundingClientRect(),{bottom:i,left:p,right:f,top:u}=r,v=Zt?o.coarse:o.fine;if(t>=p-v&&t<=f+v&&n>=u-v&&n<=i+v){if(a!==null&&l!==a&&!l.contains(a)&&!a.contains(l)&&Ut(a,l)>0){let h=a,E=!1;for(;h&&!h.contains(l);){if(Kt(h.getBoundingClientRect(),r)){E=!0;break}h=h.parentElement}if(E)return}J.push(s)}})}function Ce(e,t){_e.set(e,t)}function rt(){let e=!1,t=!1,n;J.forEach(s=>{const{direction:l,nonce:o}=s;l.value==="horizontal"?e=!0:t=!0,n=o.value});let a=0;_e.forEach(s=>{a|=s}),e&&t?Pe("intersection",a,n):e?Pe("horizontal",a,n):t?Pe("vertical",a,n):it()}function xe(){W.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",U),n.removeEventListener("mousedown",ze),n.removeEventListener("mouseleave",K),n.removeEventListener("mousemove",K),n.removeEventListener("touchmove",K),n.removeEventListener("touchstart",ze)}),window.removeEventListener("mouseup",U),window.removeEventListener("touchcancel",U),window.removeEventListener("touchend",U),me.size>0&&(Ee?(J.length>0&&W.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",U),n.addEventListener("mouseleave",K),n.addEventListener("mousemove",K),n.addEventListener("touchmove",K,{passive:!1}))}),window.addEventListener("mouseup",U),window.addEventListener("touchcancel",U),window.addEventListener("touchend",U)):W.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("mousedown",ze),n.addEventListener("mousemove",K),n.addEventListener("touchmove",K,{passive:!1}),n.addEventListener("touchstart",ze))}))}function Ge(e,t){me.forEach(n=>{const{setResizeHandlerState:a}=n,s=J.includes(n);a(e,s,t)})}let Re=null,X=null;function en(e,t){if(t){const n=(t&at)!==0,a=(t&lt)!==0,s=(t&ot)!==0,l=(t&st)!==0;if(n)return s?"se-resize":l?"ne-resize":"e-resize";if(a)return s?"sw-resize":l?"nw-resize":"w-resize";if(s)return"s-resize";if(l)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function it(){X!==null&&(document.head.removeChild(X),Re=null,X=null)}function Pe(e,t,n){const a=en(e,t);Re!==a&&(Re=a,X===null&&(X=document.createElement("style"),n&&(X.nonce=n),document.head.appendChild(X)),X.innerHTML=`*{cursor: ${a}!important;}`)}function tn({defaultSize:e,dragState:t,layout:n,panelData:a,panelIndex:s,precision:l=3}){const o=n[s];let r;return o==null?r=e!==void 0?e.toPrecision(l):"1":a.length===1?r="1":r=o.toPrecision(l),{flexBasis:0,flexGrow:r,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function nn({layout:e,panelConstraints:t}){const n=[...e],a=n.reduce((l,o)=>l+o,0);if(n.length!==t.length)throw new Error(`Invalid ${t.length} panel layout: ${n.map(l=>`${l}%`).join(", ")}`);if(!H(a,100)){console.warn(`WARNING: Invalid layout total size: ${n.map(l=>`${l}%`).join(", ")}. Layout normalization will be applied.`);for(let l=0;l<t.length;l++){const o=n[l];x(o!=null);const r=100/a*o;n[l]=r}}let s=0;for(let l=0;l<t.length;l++){const o=n[l];x(o!=null);const r=le({panelConstraints:t,panelIndex:l,size:o});o!==r&&(s+=o-r,n[l]=r)}if(!H(s,0))for(let l=0;l<t.length;l++){const o=n[l];x(o!=null);const r=o+s,i=le({panelConstraints:t,panelIndex:l,size:r});if(o!==i&&(s-=i-o,n[l]=i,H(s,0)))break}return n}function an({eagerValuesRef:e,groupId:t,layout:n,panelDataArray:a,panelGroupElement:s,setLayout:l}){de(o=>{const r=s.value;if(!r)return;const i=fe(t,r);for(let p=0;p<a.length-1;p++){const{valueMax:f,valueMin:u,valueNow:v}=Tt({layout:n.value,panelsArray:a,pivotIndices:[p,p+1]}),d=i[p];if(d!=null){const h=a[p];x(h),d.setAttribute("aria-controls",h.id),d.setAttribute("aria-valuemax",`${Math.round(f)}`),d.setAttribute("aria-valuemin",`${Math.round(u)}`),d.setAttribute("aria-valuenow",v!=null?`${Math.round(v)}`:"")}}o(()=>{i.forEach(p=>{p.removeAttribute("aria-controls"),p.removeAttribute("aria-valuemax"),p.removeAttribute("aria-valuemin"),p.removeAttribute("aria-valuenow")})})}),de(o=>{const r=s.value;if(!r)return;const i=e.value;x(i);const{panelDataArray:p}=i,f=Xe(t,r);x(f!=null,`No group found for id "${t}"`);const u=fe(t,r);x(u);const v=u.map(d=>{const h=d.getAttribute("data-panel-resize-handle-id");x(h);const[E,m]=Vt(t,h,p,r);if(E==null||m==null)return()=>{};const S=V=>{if(!V.defaultPrevented)switch(V.key){case"Enter":{V.preventDefault();const A=p.findIndex(L=>L.id===E);if(A>=0){const L=p[A];x(L);const P=n.value[A],{collapsedSize:O=0,collapsible:F,minSize:C=0}=L.constraints;if(P!=null&&F){const G=ue({delta:H(P,O)?C-O:O-P,layout:n.value,panelConstraints:p.map(se=>se.constraints),pivotIndices:tt(t,h,r),trigger:"keyboard"});n.value!==G&&l(G)}}break}}};return d.addEventListener("keydown",S),()=>{d.removeEventListener("keydown",S)}});o(()=>{v.forEach(d=>d())})})}function Fe(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new TypeError("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function ut(e){return`reka:${e}`}function ct(e){return e.map(t=>{const{constraints:n,id:a,idIsFromProps:s,order:l}=t;return s?a:l?`${l}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function dt(e,t){try{const n=ut(e),a=t.getItem(n);if(a){const s=JSON.parse(a);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function ln(e,t,n){const a=dt(e,n)??{},s=ct(t);return a[s]??null}function on(e,t,n,a,s){const l=ut(e),o=ct(t),r=dt(e,s)??{};r[o]={expandToSizes:Object.fromEntries(n.entries()),layout:a};try{s.setItem(l,JSON.stringify(r))}catch(i){console.error(i)}}const sn=100,ce={getItem:e=>(Fe(ce),ce.getItem(e)),setItem:(e,t)=>{Fe(ce),ce.setItem(e,t)}},[ft,rn]=gt("PanelGroup");var un=B({__name:"SplitterGroup",props:{id:{type:[String,null],required:!1},autoSaveId:{type:[String,null],required:!1,default:null},direction:{type:String,required:!0},keyboardResizeBy:{type:[Number,null],required:!1,default:10},storage:{type:Object,required:!1,default:()=>ce},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["layout"],setup(e,{emit:t}){const n=e,a=t,s={},{direction:l}=Ie(n),o=ke(n.id,"reka-splitter-group"),r=zt(),{forwardRef:i,currentElement:p}=je(),f=$(null),u=$([]),v=$({}),d=$(new Map),h=$(0),E=N(()=>({autoSaveId:n.autoSaveId,direction:n.direction,dragState:f.value,id:o,keyboardResizeBy:n.keyboardResizeBy,storage:n.storage})),m=$({layout:u.value,panelDataArray:[],panelDataArrayChanged:!1}),S=c=>u.value=c;an({eagerValuesRef:m,groupId:o,layout:u,panelDataArray:m.value.panelDataArray,setLayout:S,panelGroupElement:p}),de(()=>{const{panelDataArray:c}=m.value,{autoSaveId:z}=n;if(z){if(u.value.length===0||u.value.length!==c.length)return;let y=s[z];y||(y=jt(on,sn),s[z]=y);const g=[...c],_=new Map(d.value);y(z,g,_,u.value,n.storage)}});function V(c,z){const{panelDataArray:y}=m.value,g=Z(y,c);return tn({defaultSize:z,dragState:f.value,layout:u.value,panelData:y,panelIndex:g})}function A(c){const{panelDataArray:z}=m.value;z.push(c),z.sort((y,g)=>{const _=y.order,b=g.order;return _==null&&b==null?0:_==null?-1:b==null?1:_-b}),m.value.panelDataArrayChanged=!0}Ae(()=>m.value.panelDataArrayChanged,()=>{if(m.value.panelDataArrayChanged){m.value.panelDataArrayChanged=!1;const{autoSaveId:c,storage:z}=E.value,{layout:y,panelDataArray:g}=m.value;let _=null;if(c){const R=ln(c,g,z);R&&(d.value=new Map(Object.entries(R.expandToSizes)),_=R.layout)}_===null&&(_=Ft({panelDataArray:g}));const b=nn({layout:_,panelConstraints:g.map(R=>R.constraints)});bt(y,b)||(S(b),m.value.layout=b,a("layout",b),ie(g,b,v.value))}});function L(c){return function(y){y.preventDefault();const g=p.value;if(!g)return()=>null;const{direction:_,dragState:b,id:R,keyboardResizeBy:q}=E.value,{layout:M,panelDataArray:I}=m.value,{initialLayout:ee}=b??{},j=tt(R,c,g);let D=qt(y,c,_,b,q,g);if(D===0)return;const He=_==="horizontal";r.value==="rtl"&&He&&(D=-D);const ht=I.map(yt=>yt.constraints),re=ue({delta:D,layout:ee??M,panelConstraints:ht,pivotIndices:j,trigger:Ye(y)?"keyboard":"mouse-or-touch"}),Ve=!ge(M,re);(Ze(y)||Qe(y))&&h.value!==D&&(h.value=D,Ve?Ce(c,0):He?Ce(c,D<0?at:lt):Ce(c,D<0?ot:st)),Ve&&(S(re),m.value.layout=re,a("layout",re),ie(I,re,v.value))}}function P(c,z){const{layout:y,panelDataArray:g}=m.value,_=g.map(ee=>ee.constraints),{panelSize:b,pivotIndices:R}=Q(g,c,y);x(b!=null);const M=Z(g,c)===g.length-1?b-z:z-b,I=ue({delta:M,layout:y,panelConstraints:_,pivotIndices:R,trigger:"imperative-api"});ge(y,I)||(S(I),m.value.layout=I,a("layout",I),ie(g,I,v.value))}function O(c,z){const{layout:y,panelDataArray:g}=m.value,_=Z(g,c);g[_]=c,m.value.panelDataArrayChanged=!0;const{collapsedSize:b=0,collapsible:R}=z,{collapsedSize:q=0,collapsible:M,maxSize:I=100,minSize:ee=0}=c.constraints,{panelSize:j}=Q(g,c,y);j!==null&&(R&&M&&j===b?b!==q&&P(c,q):j<ee?P(c,ee):j>I&&P(c,I))}function F(c,z){const{direction:y}=E.value,{layout:g}=m.value;if(!p.value)return;const _=Se(c,p.value);x(_);const b=et(y,z);f.value={dragHandleId:c,dragHandleRect:_.getBoundingClientRect(),initialCursorPosition:b,initialLayout:g}}function C(){f.value=null}function G(c){const{panelDataArray:z}=m.value,y=Z(z,c);y>=0&&(z.splice(y,1),delete v.value[c.id],m.value.panelDataArrayChanged=!0)}function se(c){const{layout:z,panelDataArray:y}=m.value;if(c.constraints.collapsible){const g=y.map(q=>q.constraints),{collapsedSize:_=0,panelSize:b,pivotIndices:R}=Q(y,c,z);if(x(b!=null,`Panel size not found for panel "${c.id}"`),b!==_){d.value.set(c.id,b);const M=Z(y,c)===y.length-1?b-_:_-b,I=ue({delta:M,layout:z,panelConstraints:g,pivotIndices:R,trigger:"imperative-api"});ge(z,I)||(S(I),m.value.layout=I,a("layout",I),ie(y,I,v.value))}}}function he(c){const{layout:z,panelDataArray:y}=m.value;if(c.constraints.collapsible){const g=y.map(M=>M.constraints),{collapsedSize:_=0,panelSize:b,minSize:R=0,pivotIndices:q}=Q(y,c,z);if(b===_){const M=d.value.get(c.id),I=M!=null&&M>=R?M:R,j=Z(y,c)===y.length-1?b-I:I-b,D=ue({delta:j,layout:z,panelConstraints:g,pivotIndices:q,trigger:"imperative-api"});ge(z,D)||(S(D),m.value.layout=D,a("layout",D),ie(y,D,v.value))}}}function ye(c){const{layout:z,panelDataArray:y}=m.value,{panelSize:g}=Q(y,c,z);return x(g!=null,`Panel size not found for panel "${c.id}"`),g}function mt(c){const{layout:z,panelDataArray:y}=m.value,{collapsedSize:g=0,collapsible:_,panelSize:b}=Q(y,c,z);return _?b===void 0?c.constraints.defaultSize===c.constraints.collapsedSize:b===g:!1}function vt(c){const{layout:z,panelDataArray:y}=m.value,{collapsedSize:g=0,collapsible:_,panelSize:b}=Q(y,c,z);return x(b!=null,`Panel size not found for panel "${c.id}"`),!_||b>g}rn({direction:l,dragState:f.value,groupId:o,reevaluatePanelConstraints:O,registerPanel:A,registerResizeHandle:L,resizePanel:P,startDragging:F,stopDragging:C,unregisterPanel:G,panelGroupElement:p,collapsePanel:se,expandPanel:he,isPanelCollapsed:mt,isPanelExpanded:vt,getPanelSize:ye,getPanelStyle:V});function Z(c,z){return c.findIndex(y=>y===z||y.id===z.id)}function Q(c,z,y){const g=Z(c,z),b=g===c.length-1?[g-1,g]:[g,g+1],R=y[g];return{...z.constraints,panelSize:R,pivotIndices:b}}return(c,z)=>(k(),T(w(Le),{ref:w(i),as:c.as,"as-child":c.asChild,style:Ke({display:"flex",flexDirection:w(l)==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"}),"data-panel-group":"","data-orientation":w(l),"data-panel-group-id":w(o)},{default:Y(()=>[oe(c.$slots,"default",{layout:u.value})]),_:3},8,["as","as-child","style","data-orientation","data-panel-group-id"]))}}),cn=un,dn=B({__name:"SplitterPanel",props:{collapsedSize:{type:Number,required:!1},collapsible:{type:Boolean,required:!1},defaultSize:{type:Number,required:!1},id:{type:String,required:!1},maxSize:{type:Number,required:!1},minSize:{type:Number,required:!1},order:{type:Number,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["collapse","expand","resize"],setup(e,{expose:t,emit:n}){const a=e,s=n,l=ft();if(l===null)throw new Error("SplitterPanel components must be rendered within a SplitterGroup container");const{collapsePanel:o,expandPanel:r,getPanelSize:i,getPanelStyle:p,isPanelCollapsed:f,resizePanel:u,groupId:v,reevaluatePanelConstraints:d,registerPanel:h,unregisterPanel:E}=l,m=ke(a.id,"reka-splitter-panel"),S=N(()=>({callbacks:{onCollapse:()=>s("collapse"),onExpand:()=>s("expand"),onResize:(...C)=>s("resize",...C)},constraints:{collapsedSize:a.collapsedSize&&Number.parseFloat(a.collapsedSize.toFixed(Ne)),collapsible:a.collapsible,defaultSize:a.defaultSize,maxSize:a.maxSize,minSize:a.minSize},id:m,idIsFromProps:a.id!==void 0,order:a.order}));Ae(()=>S.value.constraints,(C,G)=>{(G.collapsedSize!==C.collapsedSize||G.collapsible!==C.collapsible||G.maxSize!==C.maxSize||G.minSize!==C.minSize)&&d(S.value,G)},{deep:!0}),xt(()=>{h(S.value)}),St(()=>{E(S.value)});const V=N(()=>p(S.value,a.defaultSize)),A=N(()=>f(S.value)),L=N(()=>!A.value);function P(){o(S.value)}function O(){r(S.value)}function F(C){u(S.value,C)}return t({collapse:P,expand:O,getSize(){return i(S.value)},resize:F,isCollapsed:A,isExpanded:L}),(C,G)=>(k(),T(w(Le),{id:w(m),style:Ke(V.value),as:C.as,"as-child":C.asChild,"data-panel":"","data-panel-collapsible":C.collapsible||void 0,"data-panel-group-id":w(v),"data-panel-id":w(m),"data-panel-size":Number.parseFloat(`${V.value.flexGrow}`).toFixed(1),"data-state":C.collapsible?A.value?"collapsed":"expanded":void 0},{default:Y(()=>[oe(C.$slots,"default",{isCollapsed:A.value,isExpanded:L.value,expand:O,collapse:P,resize:F})]),_:3},8,["id","style","as","as-child","data-panel-collapsible","data-panel-group-id","data-panel-id","data-panel-size","data-state"]))}}),fn=dn;function pn({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:a}){de(s=>{const l=a.value;if(e.value||n.value===null||l===null)return;const o=Se(t,l);if(o==null)return;const r=i=>{var p;if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),(p=n.value)==null||p.call(n,i);break}case"F6":{i.preventDefault();const f=o.getAttribute("data-panel-group-id");x(f);const u=fe(f,l),v=Je(f,t,l);x(v!==null);const d=i.shiftKey?v>0?v-1:u.length-1:v+1<u.length?v+1:0;u[d].focus();break}}};o.addEventListener("keydown",r),s(()=>{o.removeEventListener("keydown",r)})})}var mn=B({__name:"SplitterResizeHandle",props:{id:{type:String,required:!1},hitAreaMargins:{type:Object,required:!1},tabindex:{type:Number,required:!1,default:0},disabled:{type:Boolean,required:!1},nonce:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["dragging"],setup(e,{emit:t}){const n=e,a=t,{forwardRef:s,currentElement:l}=je(),{disabled:o}=Ie(n),r=ft();if(r===null)throw new Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:i,groupId:p,registerResizeHandle:f,startDragging:u,stopDragging:v,panelGroupElement:d}=r,h=ke(n.id,"reka-splitter-resize-handle"),E=$("inactive"),m=$(!1),S=$(null),{nonce:V}=Ie(n),A=Gt(V);return Ae(o,()=>{ve&&(o.value?S.value=null:S.value=f(h))},{immediate:!0}),de(L=>{var F,C;if(o.value||S.value===null)return;const P=l.value;if(!P)return;x(P);const O=(G,se,he)=>{var ye;if(se)switch(G){case"down":{E.value="drag",u(h,he),a("dragging",!0);break}case"move":{E.value!=="drag"&&(E.value="hover"),(ye=S.value)==null||ye.call(S,he);break}case"up":{E.value="hover",v(),a("dragging",!1);break}}else E.value="inactive"};L(Qt(h,P,i,{coarse:((F=n.hitAreaMargins)==null?void 0:F.coarse)??15,fine:((C=n.hitAreaMargins)==null?void 0:C.fine)??5},A,O))}),pn({disabled:o,resizeHandler:S,handleId:h,panelGroupElement:d}),(L,P)=>(k(),T(w(Le),{id:w(h),ref:w(s),style:{touchAction:"none",userSelect:"none"},as:L.as,"as-child":L.asChild,role:"separator","data-resize-handle":"",tabindex:L.tabindex,"data-state":E.value,"data-disabled":w(o)?"":void 0,"data-orientation":w(i),"data-panel-group-id":w(p),"data-resize-handle-active":E.value==="drag"?"pointer":m.value?"keyboard":void 0,"data-resize-handle-state":E.value,"data-panel-resize-handle-enabled":!w(o),"data-panel-resize-handle-id":w(h),onBlur:P[0]||(P[0]=O=>m.value=!1),onFocus:P[1]||(P[1]=O=>m.value=!1)},{default:Y(()=>[oe(L.$slots,"default")]),_:3},8,["id","as","as-child","tabindex","data-state","data-disabled","data-orientation","data-panel-group-id","data-resize-handle-active","data-resize-handle-state","data-panel-resize-handle-enabled","data-panel-resize-handle-id"]))}}),vn=mn;/**
* @license lucide-vue-next v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hn=Ue("ExternalLinkIcon",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
* @license lucide-vue-next v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yn=Ue("GripVerticalIcon",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);async function gn(e){const t={};return Object.keys(e).forEach(n=>{const a=e[n],s=[];Object.keys(a).forEach(l=>{const o=a[l];s.push({resource:l,routes:o.flatMap(r=>r.methods.map(i=>({method:i,endpoint:r.uri,shortEndpoint:r.shortUri,schema:{shape:r.schema,extractionErrors:r.extractionError}}))).sort((r,i)=>r.shortEndpoint.localeCompare(i.shortEndpoint))})}),t[n]=s.sort((l,o)=>l.resource.localeCompare(o.resource))}),t}function zn(e){if(typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}function bn(e,t){if(!e||!t.trim())return[];const n=[],a=t.toLowerCase();return Object.entries(e).forEach(([s,l])=>{l.forEach(o=>{o.routes.forEach(r=>{(r.endpoint.toLowerCase().includes(a)||r.shortEndpoint.toLowerCase().includes(a)||r.method.toLowerCase().includes(a)||o.resource.toLowerCase().includes(a))&&n.push({version:s,resource:o.resource,route:r})})})}),n}function xn(e){return e?Object.values(e).reduce((t,n)=>t+n.reduce((a,s)=>a+s.routes.length,0),0):0}const Mn=wt("routes",()=>{const e=$(null),t=$(null),n=$(!1),a=$(null),s=async()=>{n.value=!0,a.value=null;try{const d=window.Nimbus.routes;if(typeof d!="string"){e.value=null;return}const h=JSON.parse(d);e.value=await gn(h)}catch(d){a.value=d instanceof Error?d.message:"Failed to load routes",e.value=null}finally{n.value=!1}},l=async()=>{t.value=zn(window.Nimbus.routeExtractorException),await s()},o=()=>{e.value=null,t.value=null,a.value=null},r=N(()=>e.value!==null&&Object.keys(e.value).length>0),i=N(()=>t.value!==null),p=N(()=>e.value?Object.keys(e.value):[]),f=N(()=>xn(e.value)),u=N(()=>d=>{var h;return((h=e.value)==null?void 0:h[d])||[]}),v=N(()=>d=>bn(e.value,d));return{routes:e,routeExtractorException:t,isLoading:n,error:a,fetchAvailableRoutes:s,initializeRoutes:l,resetRoutesState:o,hasRoutes:r,hasExtractionError:i,routeVersions:p,totalRouteCount:f,getRoutesByVersion:u,searchRoutes:v}}),Sn=["type"],wn=500,Dn=B({__name:"AppInput",props:{defaultValue:{},modelValue:{},class:{},type:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,s=Et(n,"modelValue",t,{passive:!0,defaultValue:n.defaultValue}),{openCommand:l}=_t(),o=$(),r=$(0),i=p=>{if(p.key==="Shift"){const f=Date.now();f-r.value<wn&&(p.preventDefault(),l(o.value,Rt.SHIFT_SHIFT)),r.value=f}};return(p,f)=>Ct((k(),te("input",{ref_key:"inputRef",ref:o,"onUpdate:modelValue":f[0]||(f[0]=u=>It(s)?s.value=u:null),type:e.type??"text",class:ne(w(ae)("flex h-9 w-full rounded-md border border-zinc-200 bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-zinc-500 focus-visible:ring-1 focus-visible:ring-zinc-950 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:border-zinc-800 dark:placeholder:text-zinc-400 dark:focus-visible:ring-zinc-300",n.class)),onKeydown:i},null,42,Sn)),[[Pt,w(s)]])}}),pt=(e,t)=>{const n=e.__vccOpts||e;for(const[a,s]of t)n[a]=s;return n},En={key:0,class:"z-10 flex h-4 w-3 items-center justify-center rounded-xs border bg-zinc-200 dark:bg-zinc-800"},Nn=B({__name:"AppResizableHandle",props:{id:{},hitAreaMargins:{},tabindex:{},disabled:{type:Boolean},nonce:{},asChild:{type:Boolean},as:{},class:{},withHandle:{type:Boolean}},emits:["dragging"],setup(e,{emit:t}){const n=e,a=t,s=We(n,"class","withHandle"),l=$e(s,a);return(o,r)=>(k(),T(w(vn),De({"data-slot":"resizable-handle"},w(l),{class:w(ae)("relative flex w-px items-center justify-center bg-zinc-200 after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-zinc-950 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:h-1 data-[orientation=vertical]:after:w-full data-[orientation=vertical]:after:translate-x-0 data-[orientation=vertical]:after:-translate-y-1/2 dark:bg-zinc-800 dark:focus-visible:ring-zinc-300 [&[data-orientation=vertical]>div]:rotate-90",n.class)}),{default:Y(()=>[n.withHandle?(k(),te("div",En,[Me(w(yn),{class:"size-2.5"})])):kt("",!0)]),_:1},16,["class"]))}}),Bn=B({__name:"AppResizablePanel",props:{collapsedSize:{},collapsible:{type:Boolean},defaultSize:{},id:{},maxSize:{},minSize:{},order:{},asChild:{type:Boolean},as:{}},emits:["collapse","expand","resize"],setup(e,{emit:t}){const s=$e(e,t);return(l,o)=>(k(),T(w(fn),De({"data-slot":"resizable-panel"},w(s)),{default:Y(()=>[oe(l.$slots,"default")]),_:3},16))}}),Gn=B({__name:"AppResizablePanelGroup",props:{id:{},autoSaveId:{},direction:{},keyboardResizeBy:{},storage:{},asChild:{type:Boolean},as:{},class:{}},emits:["layout"],setup(e,{emit:t}){const n=e,a=t,s=We(n,"class"),l=$e(s,a);return(o,r)=>(k(),T(w(cn),De({"data-slot":"resizable-panel-group"},w(l),{class:w(ae)("flex h-full w-full data-[orientation=vertical]:flex-col",n.class)}),{default:Y(()=>[oe(o.$slots,"default")]),_:3},16,["class"]))}}),Hn=B({__name:"AppRoundIndicator",props:{class:{}},setup(e){const t=e;return(n,a)=>(k(),te("div",{class:ne(w(ae)(t.class,"bg-background relative z-10 flex size-[12px] items-center justify-center rounded-full"))},[...a[0]||(a[0]=[be("div",{class:"size-[8px] rounded-full border-[1px] border-[currentColor] bg-[radial-gradient(circle_at_bottom,currentColor_75%,rgb(255,255,255)_100%)]"},null,-1),be("div",{class:"absolute z-[-1] size-[5px] rounded-full opacity-40 shadow-[5px_0_5px_currentColor,-5px_0_5px_currentColor]"},null,-1)])],2))}}),_n=B({__name:"AppRippleCircle",props:{size:{default:210},class:{default:""},opacity:{default:.24},animationDelay:{default:0},borderStyle:{default:""}},setup(e){At(n=>({v0f0f11b0:t.size+"px",c9f49ba8:t.animationDelay+"ms",v66d16da7:t.opacity,f9b286fe:t.borderStyle}));const t=e;return(n,a)=>(k(),te("div",{class:ne(w(ae)("absolute shadow-xl","animate-ripple-circle",t.class))},null,2))}}),Cn=pt(_n,[["__scopeId","data-v-fca93691"]]),Pn={class:"absolute inset-0"},In=B({__name:"AppRipple",props:{baseCircleSize:{default:210},baseCircleOpacity:{default:.24},spaceBetweenCircle:{default:70},circleOpacityDowngradeRatio:{default:.03},circleClass:{default:""},waveSpeed:{default:80},numberOfCircles:{default:7}},setup(e){return(t,n)=>(k(),te("div",Pn,[(k(!0),te(Lt,null,$t(e.numberOfCircles,a=>(k(),T(Cn,{key:a,opacity:e.baseCircleOpacity-a*e.circleOpacityDowngradeRatio,size:e.baseCircleSize+a*e.spaceBetweenCircle,"animation-delay":a*e.waveSpeed,"border-style":a===e.numberOfCircles-1?"dashed":"solid",class:ne(e.circleClass)},null,8,["opacity","size","animation-delay","border-style","class"]))),128))]))}}),Rn=B({__name:"AppPanelRipple",setup(e){return(t,n)=>(k(),T(In,{class:"bottom-0 translate-x-2/5 translate-y-1/2 scale-150 bg-white/5 opacity-25 dark:bg-zinc-950/5","circle-class":"border-[hsl(var(--primary))] bg-primary/25 blobed"}))}}),kn=pt(Rn,[["__scopeId","data-v-73e11484"]]),An={class:"max-w-md"},Vn=B({__name:"AppPanelStateContainer",props:{class:{}},setup(e){const t=e;return(n,a)=>(k(),te("div",{class:ne(w(ae)("relative h-full flex-1 overflow-hidden p-2",t.class))},[be("div",An,[oe(n.$slots,"default")]),Me(kn)],2))}}),On=B({__name:"DocumentationLinkButton",setup(e){return(t,n)=>(k(),T(w(Ht),{size:"xs",as:"a",href:"https://github.com/sunchayn/nimbus/tree/main/wiki/user-guide",target:"_blank"},{default:Y(()=>[Me(w(hn)),n[0]||(n[0]=Mt(" Documentation ",-1))]),_:1}))}}),qn=B({__name:"HttpVerbLabel",props:{method:{},size:{default:"sm"},variant:{default:"outline"}},setup(e){const t=e,n=N(()=>({POST:"text-emerald-600",PUT:"text-emerald-600",DELETE:"text-rose-500"})[t.method]??null),a=N(()=>({sm:"min-w-[50px] text-xxs",md:"min-w-[60px] text-xs",lg:"min-w-[70px] text-sm"})[t.size]);return(s,l)=>(k(),T(w(Dt),{variant:e.variant,class:ne(w(ae)("justify-center",a.value))},{default:Y(()=>[be("span",{class:ne(n.value)},Nt(e.method),3)]),_:1},8,["variant","class"]))}});function Tn(e,t){var s,l;const n=$(((l=(s=t.value)==null?void 0:s.$el)==null?void 0:l.contentRect.with)??window.screen.width);return Bt(t,o=>{const r=o[0];n.value=r.contentRect.width}),{thresholds:e.map(o=>N(()=>n.value<o?"vertical":"horizontal"))}}export{kn as A,Dn as _,pt as a,Hn as b,Vn as c,On as d,qn as e,Tn as f,Bn as g,Nn as h,Gn as i,Mn as u};