1import{j as e,u as t,a,bl as n,e as r,x as s,ae as o,D as i,ai as l,bm as c,bn as d,ag as u,aV as p,aM as f,X as h,J as m,a7 as g,aX as y,aY as x}from"./ui-vendor-Cr0jQPbr.js";import{a as v}from"./antd-vendor-1SrxY5Xd.js";import{B as b}from"./button-DLd3nQk4.js";import{k as w,u as j,z as S,D as z,e as N,f as C,B as k,H as P}from"./index-D_TDUqgc.js";import"./supabase-mmufn7lB.js";import"./utils-vendor-DRCDPyZC.js";import"./react-vendor-QV_AskjY.js";const R=v.forwardRef(({className:n,type:r,label:s,helperText:o,error:i,success:l,leftIcon:c,rightIcon:d,size:u="default",...p},f)=>{const h=p.id||p.name||v.useId(),m=i?"border-red-500 focus-visible:ring-red-500/20":l?"border-emerald-500 focus-visible:ring-emerald-500/20":"border-[var(--border-input)] focus-visible:ring-[var(--accent-secondary)]/20";return e.jsxs("div",{className:"w-full",children:[s&&e.jsx("label",{htmlFor:h,className:"block text-sm font-medium text-[var(--text-secondary)] mb-1.5",children:s}),e.jsxs("div",{className:"relative",children:[c&&e.jsx("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-muted)]",children:e.jsx(c,{size:18})}),e.jsx("input",{id:h,type:r,className:w("flex w-full rounded-lg border bg-[var(--bg-input)] text-[var(--text-primary)] transition-all duration-150","placeholder:text-[var(--text-placeholder)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:border-[var(--border-input-focus)]","disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-[var(--bg-tertiary)]","file:border-0 file:bg-transparent file:text-sm file:font-medium",{sm:"h-9 text-sm px-3",default:"h-11 text-sm px-4",lg:"h-12 text-base px-4"}[u],m,c&&"pl-10",(d||i||l)&&"pr-10",n),ref:f,"aria-invalid":i?"true":void 0,"aria-describedby":o||i?`${h}-helper`:void 0,...p}),e.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:[i&&e.jsx(t,{size:18,className:"text-red-500"}),l&&!i&&e.jsx(a,{size:18,className:"text-emerald-500"}),d&&!i&&!l&&e.jsx(d,{size:18,className:"text-[var(--text-muted)]"})]})]}),(o||i)&&e.jsx("p",{id:`${h}-helper`,className:w("mt-1.5 text-xs",i?"text-red-500":"text-[var(--text-muted)]"),children:i||o})]})});function L({groupSize:e,panelElement:t,styleProp:a}){let n;const[r,s]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(a);switch(s){case"%":n=r/100*e;break;case"px":n=r;break;case"rem":n=function(e,t){const a=getComputedStyle(e.ownerDocument.body);return t*parseFloat(a.fontSize)}(t,r);break;case"em":n=function(e,t){const a=getComputedStyle(e);return t*parseFloat(a.fontSize)}(t,r);break;case"vh":n=function(e){return e/100*window.innerHeight}(r);break;case"vw":n=function(e){return e/100*window.innerWidth}(r)}return n}function E(e){return parseFloat(e.toFixed(3))}function T({group:e}){const{orientation:t,panels:a}=e;return a.reduce((e,a)=>e+="horizontal"===t?a.element.offsetWidth:a.element.offsetHeight,0)}function D(e){const{panels:t}=e,a=T({group:e});return 0===a?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{const{element:t,panelConstraints:n}=e;let r,s=0;if(void 0!==n.collapsedSize){s=E(L({groupSize:a,panelElement:t,styleProp:n.collapsedSize})/a*100)}if(void 0!==n.defaultSize){r=E(L({groupSize:a,panelElement:t,styleProp:n.defaultSize})/a*100)}let o=0;if(void 0!==n.minSize){o=E(L({groupSize:a,panelElement:t,styleProp:n.minSize})/a*100)}let i=100;if(void 0!==n.maxSize){i=E(L({groupSize:a,panelElement:t,styleProp:n.maxSize})/a*100)}return{groupResizeBehavior:n.groupResizeBehavior,collapsedSize:s,collapsible:!0===n.collapsible,defaultSize:r,disabled:n.disabled,minSize:o,maxSize:i,panelId:e.id}})}function M(e,t="Assertion error"){if(!e)throw Error(t)}function O(e,t){return Array.from(t).sort("horizontal"===e?I:$)}function I(e,t){const a=e.element.offsetLeft-t.element.offsetLeft;return 0!==a?a:e.element.offsetWidth-t.element.offsetWidth}function $(e,t){const a=e.element.offsetTop-t.element.offsetTop;return 0!==a?a:e.element.offsetHeight-t.element.offsetHeight}function A(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function U(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function q({orientation:e,rects:t,targetRect:a}){const n={x:a.x+a.width/2,y:a.y+a.height/2};let r,s=Number.MAX_VALUE;for(const o of t){const{x:t,y:a}=U(n,o),i="horizontal"===e?t:a;i<s&&(s=i,r=o)}return M(r,"No rect found"),r}let F;function H(){return void 0===F&&(F="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),F}function W(e){const{element:t,orientation:a,panels:n,separators:r}=e,s=O(a,Array.from(t.children).filter(A).map(e=>({element:e}))).map(({element:e})=>e),o=[];
1let i,l=!1,c=!1,d=-1,u=-1,p=0,f=[];{let e=-1;for(const t of s)t.hasAttribute("data-panel")&&(e++,null===t.ariaDisabled&&(p++,-1===d&&(d=e),u=e))}if(p>1){let t=-1;for(const p of s)if(p.hasAttribute("data-panel")){t++;const r=n.find(e=>e.element===p);if(r){if(i){const n=i.element.getBoundingClientRect(),s=p.getBoundingClientRect();let h;if(c){const e="horizontal"===a?new DOMRect(n.right,n.top,0,n.height):new DOMRect(n.left,n.bottom,n.width,0),t="horizontal"===a?new DOMRect(s.left,s.top,0,s.height):new DOMRect(s.left,s.top,s.width,0);switch(f.length){case 0:h=[e,t];break;case 1:{const r=f[0],o=q({orientation:a,rects:[n,s],targetRect:r.element.getBoundingClientRect()});h=[r,o===n?t:e];break}default:h=f}}else h=f.length?f:["horizontal"===a?new DOMRect(n.right,s.top,s.left-n.right,s.height):new DOMRect(s.left,n.bottom,s.width,s.top-n.bottom)];for(const a of h){let n="width"in a?a:a.element.getBoundingClientRect();const s=H()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(n.width<s){const e=s-n.width;n=new DOMRect(n.x-e/2,n.y,n.width+e,n.height)}if(n.height<s){const e=s-n.height;n=new DOMRect(n.x,n.y-e/2,n.width,n.height+e)}!l&&!(t<=d||t>u)&&o.push({group:e,groupSize:T({group:e}),panels:[i,r],separator:"width"in a?void 0:a,rect:n}),l=!1}}c=!1,i=r,f=[]}}else if(p.hasAttribute("data-separator")){null!==p.ariaDisabled&&(l=!0);const e=r.find(e=>e.element===p);
1e?f.push(e):(i=void 0,f=[])}else c=!0}return o}R.displayName="Input";class G{#e={};addListener(e,t){const a=this.#e[e];return void 0===a?this.#e[e]=[t]:a.includes(t)||a.push(t),()=>{this.removeListener(e,t)}}emit(e,t){const a=this.#e[e];if(void 0!==a)if(1===a.length)a[0].call(null,t);else{let e=!1,r=null;const s=Array.from(a);for(let a=0;a<s.length;a++){const o=s[a];try{o.call(null,t)}catch(n){null===r&&(e=!0,r=n)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){const a=this.#e[e];if(void 0!==a){const e=a.indexOf(t);e>=0&&a.splice(e,1)}}}let B=new Map;const J=new G;function V(e,t){for(const[a]of B)if(a.id===e)return a}function X(e,t){for(const[a,n]of B)if(a.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function _(){return B}function Y(e,t){return J.addListener("groupChange",a=>{a.group.id===e&&t(a)})}function K(e,t){const a=B.get(e);B=new Map(B),B.set(e,t),J.emit("groupChange",{group:e,prev:a,next:t})}const Z=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Q(e){const t=getComputedStyle(e);return!!("fixed"===t.position||"auto"!==t.zIndex&&("static"!==t.position||function(e){const t=getComputedStyle(ne(e)??e).display;return"flex"===t||"inline-flex"===t}(e))||+t.opacity<1||"transform"in t&&"none"!==t.transform||"webkitTransform"in t&&"none"!==t.webkitTransform||"mixBlendMode"in t&&"normal"!==t.mixBlendMode||"filter"in t&&"none"!==t.filter||"webkitFilter"in t&&"none"!==t.webkitFilter||"isolation"in t&&"isolate"===t.isolation||Z.test(t.willChange)||"touch"===t.webkitOverflowScrolling)}function ee(e){let t=e.length;for(;t--;){const a=e[t];if(M(a,"Missing node"),Q(a))return a}return null}function te(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ae(e){const t=[];for(;e;)t.push(e),e=ne(e);return t}function ne(e){const{parentNode:t}=e;return function(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(t)?t.host:t}function re(e,t){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 se({groupElement:e,hitRegion:t,pointerEventTarget:a}){if(!A(a)||a.contains(e)||e.contains(a))return!0;if(function(e,t){if(e===t)throw new Error("Cannot compare node with itself");const a={a:ae(e),b:ae(t)};let n;for(;a.a.at(-1)===a.b.at(-1);)n=a.a.pop(),a.b.pop();M(n,"Stacking order can only be calculated for elements with a common ancestor");const r=te(ee(a.a)),s=te(ee(a.b));if(r===s){const e=n.childNodes,t={a:a.a.at(-1),b:a.b.at(-1)};let r=e.length;for(;r--;){const a=e[r];if(a===t.a)return 1;if(a===t.b)return-1}}return Math.sign(r-s)}(a,e)>0){let n=a;for(;n;){if(n.contains(e))return!0;if(re(n.getBoundingClientRect(),t))return!1;n=n.parentElement}}return!0}function oe(e,t){const a=[];return t.forEach((t,n)=>{if(n.disabled)return;const r=W(n),s=function(e,t,a){let n,r={x:1/0,y:1/0};for(const s of t){const t=U(a,s.rect);switch(e){case"horizontal":t.x<=r.x&&(n=s,r=t);break;case"vertical":t.y<=r.y&&(n=s,r=t)}}return n?{distance:r,hitRegion:n}:void 0}(n.orientation,r,{x:e.clientX,y:e.clientY});s&&s.distance.x<=0&&s.distance.y<=0&&se({groupElement:n.element,hitRegion:s.hitRegion.rect,pointerEventTarget:e.target})&&a.push(s.hitRegion)}),a}function ie(e,t,a=0){return Math.abs(E(e)-E(t))<=a}function le(e,t){return ie(e,t)?0:e>t?1:-1}function ce({overrideDisabledPanels:e,panelConstraints:t,prevSize:a,size:n}){const{collapsedSize:r=0,collapsible:s,disabled:o,maxSize:i=100,minSize:l=0}=t;if(o&&!e)return a;
1if(le(n,l)<0)if(s){n=le(n,(r+l)/2)<0?r:l}else n=l;return n=E(n=Math.min(i,n))}function de({delta:e,initialLayout:t,panelConstraints:a,pivotIndices:n,prevLayout:r,trigger:s}){if(ie(e,0))return t;const o="imperative-api"===s,i=Object.values(t),l=Object.values(r),c=[...i],[d,u]=n;M(null!=d,"Invalid first pivot index"),M(null!=u,"Invalid second pivot index");let p=0;switch(s){case"keyboard":{const t=e<0?u:d,n=a[t];M(n,`Panel constraints not found for index ${t}`);const{collapsedSize:r=0,collapsible:s,minSize:o=0}=n;if(s){const a=i[t];if(M(null!=a,`Previous layout not found for panel index ${t}`),ie(a,r)){const t=o-a;le(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const t=e<0?d:u,n=a[t];M(n,`No panel constraints found for index ${t}`);const{collapsedSize:r=0,collapsible:s,minSize:o=0}=n;if(s){const a=i[t];if(M(null!=a,`Previous layout not found for panel index ${t}`),ie(a,o)){const t=a-r;le(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{const t=e<0?u:d,n=a[t];M(n,`Panel constraints not found for index ${t}`);const r=i[t],{collapsible:s,collapsedSize:o,minSize:l}=n;if(s&&le(r,l)<0)if(e>0){const t=l-o,a=t/2;le(r+e,l)<0&&(e=le(e,a)<=0?0:t)}else{const t=l-o,a=100-t/2;le(r-e,l)<0&&(e=le(100+e,a)>0?0:-t)}break}}{const t=e<0?1:-1;let n=e<0?u:d,r=0;for(;;){const e=i[n];M(null!=e,`Previous layout not found for panel index ${n}`);if(r+=ce({overrideDisabledPanels:o,panelConstraints:a[n],prevSize:e,size:100})-e,n+=t,n<0||n>=a.length)break}const s=Math.min(Math.abs(e),Math.abs(r));e=e<0?0-s:s}{let t=e<0?d:u;for(;t>=0&&t<a.length;){const n=Math.abs(e)-Math.abs(p),r=i[t];M(null!=r,`Previous layout not found for panel index ${t}`);const s=r-n,l=ce({overrideDisabledPanels:o,panelConstraints:a[t],prevSize:r,size:s});if(!ie(r,l)&&(p+=r-l,c[t]=l,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!=t[a])return!1;return!0}(l,c))return r;{const t=e<0?u:d,n=i[t];M(null!=n,`Previous layout not found for panel index ${t}`);const r=n+p,s=ce({overrideDisabledPanels:o,panelConstraints:a[t],prevSize:n,size:r});if(c[t]=s,!ie(s,r)){let t=r-s,n=e<0?u:d;for(;n>=0&&n<a.length;){const r=c[n];M(null!=r,`Previous layout not found for panel index ${n}`);const s=r+t,i=ce({overrideDisabledPanels:o,panelConstraints:a[n],prevSize:r,size:s});if(ie(r,i)||(t-=i-r,c[n]=i),ie(t,0))break;e>0?n--:n++}}}if(!ie(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return r;const f=Object.keys(r);return c.reduce((e,t,a)=>(e[f[a]]=t,e),{})}function ue(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(void 0===t[a]||0!==le(e[a],t[a]))return!1;return!0}function pe({layout:e,panelConstraints:t}){const a=Object.values(e),n=[...a],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(", ")}`);if(!ie(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];M(null!=e,`No layout data found for index ${i}`);const t=100/r*e;n[i]=t}let s=0;for(let i=0;i<t.length;i++){const e=a[i];M(null!=e,`No layout data found for index ${i}`);const r=n[i];M(null!=r,`No layout data found for index ${i}`);const o=ce({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:e,size:r});r!=o&&(s+=r-o,n[i]=o)}if(!ie(s,0))for(let i=0;i<t.length;i++){const e=n[i];M(null!=e,`No layout data found for index ${i}`);const a=e+s,r=ce({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:e,size:a});if(e!==r&&(s-=r-e,n[i]=r,ie(s,0)))break}const o=Object.keys(e);return n.reduce((e,t,a)=>(e[o[a]]=t,e),{})}function fe({groupId:e,panelId:t}){const a=()=>{const t=_();for(const[a,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:s,groupSize:o,separatorToPanels:i}]of t)if(a.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:a,groupSize:o,layout:s,separatorToPanels:i};throw Error(`Group ${e} not found`)},n=()=>{const e=a().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const e=a().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const e=a().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{const n=s();if(e===n)return;const{defaultLayoutDeferred:r,derivedPanelConstraints:o,group:i,groupSize:l,layout:c,separatorToPanels:d}=a(),u=i.panels.findIndex(e=>e.id===t),p=u===i.panels.length-1,f=pe({layout:de({delta:p?n-e:e-n,initialLayout:c,panelConstraints:o,pivotIndices:p?[u-1,u]:[u,u+1],prevLayout:c,trigger:"imperative-api"}),panelConstraints:o});ue(c,f)||K(i,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:l,layout:f,separatorToPanels:d})};return{collapse:()=>{const{collapsible:e,collapsedSize:t}=n(),{mutableValues:a}=r(),i=s();e&&i!==t&&(a.expandToSize=i,o(t))},expand:()=>{const{collapsible:e,collapsedSize:t,minSize:a}=n(),{mutableValues:i}=r(),l=s();
1if(e&&l===t){let e=i.expandToSize??a;0===e&&(e=1),o(e)}},getSize:()=>{const{group:e}=a(),t=s(),{element:n}=r();return{asPercentage:t,inPixels:"horizontal"===e.orientation?n.offsetWidth:n.offsetHeight}},isCollapsed:()=>{const{collapsible:e,collapsedSize:t}=n(),a=s();return e&&ie(t,a)},resize:e=>{const{group:t}=a(),{element:n}=r(),s=T({group:t}),i=E(L({groupSize:s,panelElement:n,styleProp:e})/s*100);o(i)}}}function he(e){if(e.defaultPrevented)return;const t=_();oe(e,t).forEach(t=>{if(t.separator){const a=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(a){const n=a.panelConstraints.defaultSize,r=fe({groupId:t.group.id,panelId:a.id});r&&void 0!==n&&(r.resize(n),e.preventDefault())}}})}function me(e){const t=_();for(const[a]of t)if(a.separators.some(t=>t.element===e))return a;throw Error("Could not find parent Group for separator element")}function ge({groupId:e}){const t=()=>{const t=_();for(const[a,n]of t)if(a.id===e)return{group:a,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:e,layout:a}=t();return e?{}:a},setLayout(e){const{defaultLayoutDeferred:a,derivedPanelConstraints:n,group:r,groupSize:s,layout:o,separatorToPanels:i}=t(),l=pe({layout:e,panelConstraints:n});
1return a?o:(ue(o,l)||K(r,{defaultLayoutDeferred:a,derivedPanelConstraints:n,groupSize:s,layout:l,separatorToPanels:i}),l)}}}function ye(e,t){const a=me(e),n=X(a.id,!0),r=a.separators.find(t=>t.element===e);M(r,"Matching separator not found");const s=n.separatorToPanels.get(r);M(s,"Matching panels not found");const o=s.map(e=>a.panels.indexOf(e)),i=ge({groupId:a.id}).getLayout(),l=pe({layout:de({delta:t,initialLayout:i,panelConstraints:n.derivedPanelConstraints,pivotIndices:o,prevLayout:i,trigger:"keyboard"}),panelConstraints:n.derivedPanelConstraints});ue(i,l)||K(a,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:l,separatorToPanels:n.separatorToPanels})}function xe(e){if(e.defaultPrevented)return;const t=e.currentTarget,a=me(t);if(!a.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===a.orientation&&ye(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===a.orientation&&ye(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===a.orientation&&ye(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===a.orientation&&ye(t,-5);break;case"End":e.preventDefault(),ye(t,100);break;case"Enter":{e.preventDefault();const a=me(t),n=X(a.id,!0),{derivedPanelConstraints:r,layout:s,separatorToPanels:o}=n,i=a.separators.find(e=>e.element===t);M(i,"Matching separator not found");const l=o.get(i);M(l,"Matching panels not found");const c=l[0],d=r.find(e=>e.panelId===c.id);if(M(d,"Panel metadata not found"),d.collapsible){const e=s[c.id],n=d.collapsedSize===e?a.mutableState.expandedPanelSizes[c.id]??d.minSize:d.collapsedSize;ye(t,n-e)}break}case"F6":{e.preventDefault();const a=me(t).separators.map(e=>e.element),n=Array.from(a).findIndex(t=>t===e.currentTarget);M(null!==n,"Index not found");a[e.shiftKey?n>0?n-1:a.length-1:n+1<a.length?n+1:0].focus({preventScroll:!0});break}case"Home":e.preventDefault(),ye(t,-100)}}let ve={cursorFlags:0,state:"inactive"};const be=new G;function we(){return ve}function je(e){const t=ve;ve=e,be.emit("change",{prev:t,next:e})}function Se(e){if(e.defaultPrevented)return;if("mouse"===e.pointerType&&e.button>0)return;const t=_(),a=oe(e,t),n=new Map;let r=!1;a.forEach(e=>{e.separator&&(r||(r=!0,e.separator.element.focus({preventScroll:!0})));const a=t.get(e.group);a&&n.set(e.group,a.layout)}),je({cursorFlags:0,hitRegions:a,initialLayoutMap:n,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),a.length&&e.preventDefault()}const ze=e=>e,Ne=()=>{};let Ce;function ke(){return void 0===Ce&&(Ce=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Ce=!0)),Ce}const Pe=new WeakMap;function Re(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:a}=Pe.get(e)??{};void 0===a&&(a=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(a));const n=we();switch(n.state){case"active":case"hover":{const e=function({cursorFlags:e,groups:t,state:a}){let n=0,r=0;switch(a){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":n++;break;case"vertical":r++}})}if(0!==n||0!==r){if("active"===a&&e&&ke()){const t=!!(4&e),a=!!(8&e);if(1&e)return t?"se-resize":a?"ne-resize":"e-resize";if(2&e)return t?"sw-resize":a?"nw-resize":"w-resize";if(t)return"s-resize";if(a)return"n-resize"}return ke()?n>0&&r>0?"move":n>0?"ew-resize":"ns-resize":n>0&&r>0?"grab":n>0?"col-resize":"row-resize"}}({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(e=>e.group),state:n.state}),r=`*, *:hover {cursor: ${e} !important; }`;if(t===r)return;t=r,e?0===a.cssRules.length?a.insertRule(r):a.replaceSync(r):1===a.cssRules.length&&a.deleteRule(0);break}case"inactive":t=void 0,1===a.cssRules.length&&a.deleteRule(0)}Pe.set(e,{prevStyle:t,styleSheet:a})}function Le({document:e,event:t,hitRegions:a,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:s,prevCursorFlags:o}){let i=0;a.forEach(e=>{const{group:a,groupSize:o}=e,{orientation:l,panels:c}=a,{disableCursor:d}=a.mutableState;let u=0;u=s?"horizontal"===l?(t.clientX-s.x)/o*100:(t.clientY-s.y)/o*100:"horizontal"===l?t.clientX<0?-100:100:t.clientY
1<0?-100:100;const p=n.get(a),f=r.get(a);if(!p||!f)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:m,groupSize:g,layout:y,separatorToPanels:x}=f;if(m&&y&&x){const t=de({delta:u,initialLayout:p,panelConstraints:m,pivotIndices:e.panels.map(e=>c.indexOf(e)),prevLayout:y,trigger:"mouse-or-touch"});if(ue(t,y)){if(0!==u&&!d)switch(l){case"horizontal":i|=u<0?1:2;break;case"vertical":i|=u<0?4:8}}else K(e.group,{defaultLayoutDeferred:h,derivedPanelConstraints:m,groupSize:g,layout:t,separatorToPanels:x})}});let l=0;0===t.movementX?l|=3&o:l|=3&i,0===t.movementY?l|=12&o:l|=12&i,function(e){const t=ve,a={...ve};a.cursorFlags=e,ve=a,be.emit("change",{prev:t,next:a})}(l),Re(e)}function Ee(e){const t=_(),a=we();if("active"===a.state)Le({document:e.currentTarget,event:e,hitRegions:a.hitRegions,initialLayoutMap:a.initialLayoutMap,mountedGroups:t,prevCursorFlags:a.cursorFlags})}function Te(e){if(e.defaultPrevented)return;const t=we(),a=_();switch(t.state){case"active":if(0===e.buttons)return je({cursorFlags:0,state:"inactive"}),void t.hitRegions.forEach(e=>{const t=X(e.group.id,!0);K(e.group,t)});Le({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:a,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{const n=oe(e,a);0===n.length?"inactive"!==t.state&&je({cursorFlags:0,state:"inactive"}):je({cursorFlags:0,hitRegions:n,state:"hover"}),Re(e.currentTarget);break}}}function De(e){if(e.relatedTarget instanceof HTMLIFrameElement&&"hover"===we().state)je({cursorFlags:0,state:"inactive"})}function Me(e){if(e.defaultPrevented)return;if("mouse"===e.pointerType&&e.button>0)return;const t=we();if("active"===t.state)je({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Re(e.currentTarget),t.hitRegions.forEach(e=>{const t=X(e.group.id,!0);K(e.group,t)}),e.preventDefault())}function Oe(e){let t=0,a=0;const n={};for(const s of e)if(void 0!==s.defaultSize){t++;const e=E(s.defaultSize);a+=e,n[s.panelId]=e}else n[s.panelId]=void 0;const r=e.length-t;if(0!==r){const t=E((100-a)/r);for(const a of e)void 0===a.defaultSize&&(n[a.panelId]=t)}return n}function Ie(e,t,a){if(!a[0])return;const n=e.panels.find(e=>e.element===t);if(!n||!n.onResize)return;const r=T({group:e}),s="horizontal"===e.orientation?n.element.offsetWidth:n.element.offsetHeight,o=n.mutableValues.prevSize,i={asPercentage:E(s/r*100),inPixels:s};n.mutableValues.prevSize=i,n.onResize(i,n.id,o)}function $e(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(e[a]!==t[a])return!1;return!0}function Ae({group:e,nextGroupSize:t,prevGroupSize:a,prevLayout:n}){if(a<=0||t<=0||a===t)return n;let r=0,s=0,o=!1;const i=new Map,l=[];for(const u of e.panels){const e=n[u.id]??0;switch(u.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{o=!0;const n=E(e/100*a/t*100);i.set(u.id,n),r+=n;break}default:l.push(u.id),s+=e}}if(!o||0===l.length)return n;const c=100-r,d={...n};if(i.forEach((e,t)=>{d[t]=e}),s>0)for(const u of l){const e=n[u]??0;d[u]=E(e/s*c)}else{const e=E(c/l.length);for(const t of l)d[t]=e}return d}const Ue=new Map;function qe(e){let t=!0;M(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const a=e.element.ownerDocument.defaultView.ResizeObserver,n=new Set,r=new Set,s=new a(a=>{for(const n of a){const{borderBoxSize:a,target:r}=n;if(r===e.element){if(t){const t=T({group:e});if(0===t)return;const a=X(e.id);if(!a)return;const n=D(e),r=a.defaultLayoutDeferred?Oe(n):a.layout,s=pe({layout:Ae({group:e,nextGroupSize:t,prevGroupSize:a.groupSize,prevLayout:r}),panelConstraints:n});if(!a.defaultLayoutDeferred&&ue(a.layout,s)&&$e(a.derivedPanelConstraints,n)&&a.groupSize===t)return;K(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,groupSize:t,layout:s,separatorToPanels:a.separatorToPanels})}}else Ie(e,r,a)}});s.observe(e.element),e.panels.forEach(e=>{M(!n.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),n.add(e.id),e.onResize&&s.observe(e.element)});const o=T({group:e}),i=D(e),l=e.panels.map(({id:e})=>e).join(",");let c=e.mutableState.defaultLayout;
1c&&(function(e,t){const a=e.map(e=>e.id),n=Object.keys(t);if(a.length!==n.length)return!1;for(const r of a)if(!n.includes(r))return!1;return!0}(e.panels,c)||(c=void 0));const d=pe({layout:e.mutableState.layouts[l]??c??Oe(i),panelConstraints:i}),u=e.element.ownerDocument;Ue.set(u,(Ue.get(u)??0)+1);const p=new Map;return W(e).forEach(e=>{e.separator&&p.set(e.separator,e.panels)}),K(e,{defaultLayoutDeferred:0===o,derivedPanelConstraints:i,groupSize:o,layout:d,separatorToPanels:p}),e.separators.forEach(e=>{M(!r.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.element.addEventListener("keydown",xe)}),1===Ue.get(u)&&(u.addEventListener("dblclick",he,!0),u.addEventListener("pointerdown",Se,!0),u.addEventListener("pointerleave",Ee),u.addEventListener("pointermove",Te),u.addEventListener("pointerout",De),u.addEventListener("pointerup",Me,!0)),function(){t=!1,Ue.set(u,Math.max(0,(Ue.get(u)??0)-1)),function(e){B=new Map(B),B.delete(e)}(e),e.separators.forEach(e=>{e.element.removeEventListener("keydown",xe)}),Ue.get(u)||(u.removeEventListener("dblclick",he,!0),u.removeEventListener("pointerdown",Se,!0),u.removeEventListener("pointerleave",Ee),u.removeEventListener("pointermove",Te),u.removeEventListener("pointerout",De),u.removeEventListener("pointerup",Me,!0)),s.disconnect()}}function Fe(e){const t=v.useId();return`${e??t}`}const He=typeof window<"u"?v.useLayoutEffect:v.useEffect;function We(e){const t=v.useRef(e);return He(()=>{t.current=e},[e]),v.useCallback((...e)=>t.current?.(...e),[t])}function Ge(...e){return We(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function Be(e){const t=v.useRef({...e});return He(()=>{for(const a in e)t.current[a]=e[a]},[e]),t.current}const Je=v.createContext(null);function Ve({children:t,className:a,defaultLayout:n,disableCursor:r,disabled:s,elementRef:o,groupRef:i,id:l,onLayoutChange:c,onLayoutChanged:d,orientation:u="horizontal",resizeTargetMinimumSize:p={coarse:20,fine:10},style:f,...h}){const m=v.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=We(e=>{ue(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),y=We(e=>{ue(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,d?.(e))}),x=Fe(l),b=v.useRef(null),[w,j]=function(){const[e,t]=v.useState({});return[e,v.useCallback(()=>t({}),[])]}(),S=v.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:p,separators:[]}),z=Ge(b,o);!function(e,t){const a=v.useRef({getLayout:()=>({}),setLayout:ze});v.useImperativeHandle(t,()=>a.current,[]),He(()=>{Object.assign(a.current,ge({groupId:e}))})}(x,i);const N=We((e,t)=>{const a=we(),r=V(e),s=X(e);if(s){let e=!1;if("active"===a.state)e=a.hitRegions.some(e=>e.group===r);return{flexGrow:s.layout[t]??1,pointerEvents:e?"none":void 0}}return{flexGrow:n?.[t]??1}}),C=Be({defaultLayout:n,disableCursor:r}),k=v.useMemo(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:N,id:x,orientation:u,registerPanel:e=>{const t=S.current;return t.panels=O(u,[...t.panels,e]),j(),()=>{t.panels=t.panels.filter(t=>t!==e),j()}},registerSeparator:e=>{const t=S.current;return t.separators=O(u,[...t.separators,e]),j(),()=>{t.separators=t.separators.filter(t=>t!==e),j()}},togglePanelDisabled:(e,t)=>{const a=S.current.panels.find(t=>t.id===e);a&&(a.panelConstraints.disabled=t);const n=V(x),r=X(x);n&&r&&K(n,{...r,derivedPanelConstraints:D(n)})},toggleSeparatorDisabled:(e,t)=>{const a=S.current.separators.find(t=>t.id===e);a&&(a.disabled=t)}}),[N,x,j,u,C]),P=v.useRef(null);return He(()=>{const e=b.current;if(null===e)return;const t=S.current;let a;if(void 0!==C.defaultLayout&&Object.keys(C.defaultLayout).length===t.panels.length){a={};for(const e of t.panels){const t=C.defaultLayout[e.id];void 0!==t&&(a[e.id]=t)}}const n={disabled:!!s,element:e,id:x,mutableState:{defaultLayout:a,disableCursor:!!C.disableCursor,expandedPanelSizes:S.current.lastExpandedPanelSizes,layouts:S.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};P.current=n;const r=qe(n),{defaultLayoutDeferred:o,derivedPanelConstraints:i,layout:l}=X(n.id,!0);!o&&i.length>0&&(g(l),y(l));const c=Y(x,e=>{const{defaultLayoutDeferred:t,derivedPanelConstraints:a,layout:r}=e.next;if(t||0===a.length)return;const s=n.panels.map(({id:e})=>e).join(",");n.mutableState.layouts[s]=r,a.forEach(t=>{if(t.collapsible){const{layout:a}=e.prev??{};if(a){const e=ie(t.collapsedSize,r[t.panelId]),s=ie(t.collapsedSize,a[t.panelId]);e&&!s&&(n.mutableState.expandedPanelSizes[t.panelId]=a[t.panelId])}}});const o="active"!==we().state;g(r),o&&y(r)});return()=>{P.current=null,r(),c()}},[s,x,y,g,u,w,C]),v.useEffect(()=>{const e=P.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),e.jsx(Je.Provider,{value:k,children:e.jsx("div",{...h,className:a,"data-group":!0,"data-testid":x,id:x,ref:z,style:{height:"100%",width:"100%",overflow:"hidden",...f,dis
1play:"flex",flexDirection:"horizontal"===u?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===u?"pan-y":"pan-x"},children:t})})}function Xe(){const e=v.useContext(Je);return M(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function _e({children:t,className:a,collapsedSize:n="0%",collapsible:r=!1,defaultSize:s,disabled:o,elementRef:i,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:d="100%",minSize:u="0%",onResize:p,panelRef:f,style:h,...m}){const g=!!c,y=Fe(c),x=Be({disabled:o}),b=v.useRef(null),w=Ge(b,i),{getPanelStyles:j,id:S,orientation:z,registerPanel:N,togglePanelDisabled:C}=Xe(),k=null!==p,P=We((e,t,a)=>{p?.(e,c,a)});He(()=>{const e=b.current;if(null!==e){const t={element:e,id:y,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:k?P:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:r,defaultSize:s,disabled:x.disabled,maxSize:d,minSize:u}};return N(t)}},[l,n,r,s,k,y,g,d,u,P,N,x]),v.useEffect(()=>{C(y,!!o)},[o,y,C]),function(e,t){const{id:a}=Xe(),n=v.useRef({collapse:Ne,expand:Ne,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ne});v.useImperativeHandle(t,()=>n.current,[]),He(()=>{Object.assign(n.current,fe({groupId:a,panelId:e}))})}(y,f);const R=v.useSyncExternalStore(e=>Y(S,e),()=>JSON.stringify(j(S,y)),()=>JSON.stringify(j(S,y)));return e.jsx("div",{...m,"aria-disabled":o||void 0,"data-panel":!0,"data-testid":y,id:y,ref:w,style:{...Ye,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(R)},children:e.jsx("div",{className:a,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:"horizontal"===z?"pan-y":"pan-x"},children:t})})}Ve.displayName="Group",_e.displayName="Panel";const Ye={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Ke({children:t,className:a,disabled:n,elementRef:r,id:s,style:o,...i}){const l=Fe(s),c=Be({disabled:n}),[d,u]=v.useState({}),[p,f]=v.useState("inactive"),h=v.useRef(null),m=Ge(h,r),{disableCursor:g,id:y,orientation:x,registerSeparator:b,toggleSeparatorDisabled:w}=Xe(),j="horizontal"===x?"vertical":"horizontal";let S;return He(()=>{const e=h.current;if(null!==e){const t={disabled:c.disabled,element:e,id:l},a=b(t),n=function(e){return be.addListener("change",e)}(e=>{f("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:"inactive")}),r=Y(y,e=>{const{derivedPanelConstraints:a,layout:n,separatorToPanels:r}=e.next,s=r.get(t);if(s){const e=s[0],t=s.indexOf(e);u(function({layout:e,panelConstraints:t,panelId:a,panelIndex:n}){let r,s;const o=e[a],i=t.find(e=>e.panelId===a);if(i){const l=i.maxSize,c=[n,n+1];s=pe({layout:de({delta:(i.collapsible?i.collapsedSize:i.minSize)-o,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[a],r=pe({layout:de({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[a]}return{valueControls:a,valueMax:r,valueMin:s,valueNow:o}}({layout:n,panelConstraints:a,panelId:e.id,panelIndex:t}))}});return()=>{n(),r(),a()}}},[y,l,b,c]),v.useEffect(()=>{w(l,!!n)},[n,l,w]),n&&!g&&(S="not-allowed"),e.jsx("div",{...i,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":j,"aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:t,className:a,"data-separator":n?"disabled":p,"data-testid":l,id:l,ref:m,role:"separator",style:{flexBasis:"auto",cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Ke.displayName="Separator";const Ze=({className:t,...a})=>e.jsx(Ve,{className:w("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...a}),Qe=_e,et=({withHandle:t,className:a,...r})=>e.jsx(Ke,{className:w("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...r,children:t&&e.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:e.jsx(n,{className:"h-2.5 w-2.5"})})}),tt=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],at="text-green-400",nt="text-red-400",rt="text-yellow-400",st="text-blue-400",ot=e=>e?e>=200&&e<300?at:e>=300&&e<400?rt:e>
1=400?nt:st:st,it=e=>e?e>=200&&e<300?y:e>=400?x:t:t,lt=(e,t)=>e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`:t("apiPlayground.notAvailable"),ct=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch(t){return!1}},dt=({status:t,duration:a})=>{const{t:n}=j(),r=it(t),s=ot(t),o=t??n("apiPlayground.notAvailable");return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:w("flex items-center gap-2 px-3 py-1.5 rounded-md bg-neutral-800/50 border border-gray-700/40",s),children:[e.jsx(r,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm font-semibold",children:o})]}),a&&e.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm",children:[e.jsx(g,{className:"h-4 w-4"}),e.jsx("span",{children:lt(a,n)})]})]})},ut=({active:t,onClick:a,children:n,disabled:r=!1})=>e.jsx("button",{onClick:a,disabled:r,className:w("px-4 py-3 text-sm font-medium border-b-2 -mb-[2px] transition-colors rounded-t-md",t?"border-blue-500 bg-neutral-800/60 text-blue-400":"border-transparent text-gray-400 hover:text-gray-200",r&&"opacity-50 cursor-not-allowed"),children:n}),pt=({param:t,type:a,onUpdate:n,onRemove:r,disabled:s=!1})=>{const{t:o}=j();return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(R,{placeholder:o("apiPlayground.placeholders.key"),className:"flex-1 h-10 bg-neutral-800 text-gray-100 placeholder-gray-500 border border-gray-700 rounded-md px-3 focus:outline-none focus:ring-2 focus:ring-blue-500/50",value:t.key,disabled:s,onChange:e=>n(t.id,"key",e.target.value)}),e.jsx(R,{placeholder:o("apiPlayground.placeholders.value"),className:"flex-1 h-10 bg-neutral-800 text-gray-100 placeholder-gray-500 border border-gray-700 rounded-md px-3 focus:outline-none focus:ring-2 focus:ring-blue-500/50",value:t.value,onChange:e=>n(t.id,"value",e.target.value)}),e.jsx(b,{size:"icon",variant:"ghost",className:"h-10 w-10 rounded-md border border-red-900/30 text-red-400 hover:bg-red-900/25 transition-colors flex-shrink-0",onClick:()=>r(t.id),"aria-label":o("common.delete"),children:e.jsx(m,{className:"h-4 w-4"})})]})},ft=({config:t,language:n="curl"})=>{const{t:r}=j(),[s,o]=v.useState(!1),i=v.useMemo(()=>{if("curl"===n){let e=`curl -X ${t.method} "${t.url}"`;if(t.headers?.forEach(t=>{t.key&&t.value&&(e+=` \\\n -H "${t.key}: ${t.value}"`)}),t.body?.length>0&&["POST","PUT","PATCH"].includes(t.method)){const a={};t.body.forEach(e=>{e.key&&(a[e.key]=e.value)}),e+=` \\\n -d '${JSON.stringify(a)}'`}return e}if("javascript"===n){const e={};t.headers?.forEach(t=>{t.key&&t.value&&(e[t.key]=t.value)});let a=`fetch("${t.url}", {\n method: "${t.method}"`;if(Object.keys(e).length>0&&(a+=`,\n headers: ${JSON.stringify(e,null,2).replace(/\n/g,"\n ")}`),t.body?.length>0&&["POST","PUT","PATCH"].includes(t.method)){const e={};t.body.forEach(t=>{t.key&&(e[t.key]=t.value)}),a+=`,\n body: JSON.stringify(${JSON.stringify(e,null,2).replace(/\n/g,"\n ")})`}return a+="\n})\n .then(res => res.json())\n .then(data => console.log(data))\n .catch(err => console.error(err))",a}if("python"===n){let e="import requests\n\n";const a={};if(t.headers?.forEach(e=>{e.key&&e.value&&(a[e.key]=e.value)}),Object.keys(a).length>0&&(e+=`headers = ${JSON.stringify(a,null,2).replace(/"/g,"'")}\n\n`),t.body?.length>0&&["POST","PUT","PATCH"].includes(t.method)){const a={};t.body.forEach(e=>{e.key&&(a[e.key]=e.value)}),e+=`data = ${JSON.stringify(a,null,2).replace(/"/g,"'")}\n\n`}return e+=`response = requests.${t.method.toLowerCase()}(\n "${t.url}"`,Object.keys(a).length>0&&(e+=",\n headers=headers"),t.body?.length>0&&["POST","PUT","PATCH"].includes(t.method)&&(e+=",\n json=data"),e+="\n)\n\nprint(response.json())",e}return""},[t,n]);return e.jsxs("div",{className:"relative",children:[e.jsx(b,{size:"sm",variant:"ghost",className:"absolute top-2 right-2 z-10 h-8 px-2 bg-neutral-800/80 hover:bg-neutral-700/80",onClick:async()=>{await ct(i)&&(o(!0),setTimeout(()=>o(!1),2e3))},children:s?e.jsxs(e.Fragment,{children:[e.jsx(a,{className:"h-3 w-3 mr-1.5"}),r("common.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(p,{className:"h-3 w-3 mr-1.5"}),r("common.copy")]})}),e.jsx("pre",{className:"text-xs overflow-auto bg-neutral-950/50 rounded-lg p-4 pt-12 text-gray-100 font-mono max-h-[400px]",children:i})]})},ht=({item:t,onSelect:a,onDelete:n})=>{const{t:r}=j(),s=it(t.response?.status),o=ot(t.response?.status),i=t.response?.status??r("apiPlayground.notAvailable");return e.jsxs("div",{className:"group flex items-center gap-3 p-3 bg-neutral-800/30 hover:bg-neutral-800/60 rounded-lg border border-gray-700/40 transition-colors cursor-pointer",children:[e.jsxs("div",{className:"flex-1",onClick:a,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-xs font-semibold text-blue-400",children:t.method}),e.jsx("span",{className:"text-xs text-gray-400 truncate flex-1",children:t.url})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{className:w("h-3 w-3",o)}),e.jsx("span",{className:w("text-xs font-medium",o),children:i}),e.jsx("span",{className:"text-xs text-gray-500",children:"â¢"}),e.jsx("span",{className:"text-xs text-gray-500",children:lt(t.duration,r)}),e.jsx("span",{className:"text-xs text-gray-500",children:"â¢"}),e.jsx("span",{className:"text-xs text-gray-500",children:new Date(t.timestamp).toLocaleTimeString()})]})]}),e.jsx(b,{size:"icon",variant:"ghost",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity text-red-400 hover:bg-red-900/25",onClick:e=>{e.stopPropagation(),n(t.id)},children:e.jsx(m,{className:"h-3 w-3"})})]})},mt=({item:t,onLoad:a,onDelete:n})=>e.jsxs("div",{className:"group flex items-center gap-3 p-3 bg-neutral-800/30 hover:bg-neutral-800/60 rounded-lg border border-gray-700/40 transition-colors cursor-pointer",children:[e.jsxs("div",{className:"flex-1",onClick:a,children:[e.jsx("div",{className:"text-sm font-medium text-gray-200 mb-1",children:t.name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-semibold text-blue-400",children:t.config.method}),e.jsx("span",{className:"text-xs text-gray-500 truncate",children:t.config.url})]})]}),e.jsx(b,{size:"icon",variant:"ghost",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity text-red-400 hover:bg-red-900/25",onClick:e=>{e.stopPropagation(),n(t.id)},children:e.jsx(m,{className:"h-3 w-3"})})]});function gt({config:n,onConfigChange:m,onTest:g}){const{t:y}=j(),[x,w]=v.useState(!1),[P,L]=v.useState("headers"),[E,T]=v.useState("response"),[D,M]=v.useState(""),[O,I]=v.useState(!1),[$,A]=v.useState(""),[U,q]=v.useState("curl"),[F,H]=v.useState(n||{url:"",method:"GET",headers:[],query:[],path:[],body:[],rawResponse:{}}),[W,G]=v.useState(()=>{try{const e=localStorage.getItem("api-playground-history");return e?JSON.parse(e):[]}catch{return[]}}),[B,J]=v.useState(()=>{try{const e=localStorage.getItem("api-playground-saved");return e?JSON.parse(e):[]}catch{return[]}});v.useEffect(()=>{m&&m(F)},[F,m]),v.useEffect(()=>{try{localStorage.setItem("api-playground-history",JSON.stringify(W))}catch(e){}},[W]),v.useEffect(()=>{try{localStorage.setItem("api-playground-saved",JSON.stringify(B))}catch(e){}},[B]);const V=v.useCallback(e=>{if(!e||e.startsWith("curl"))return{queryParams:[],pathParams:[]};try{const t=new URL(e.startsWith("http")?e:`https://example.com${e.startsWith("/")?e:`/${e}`}`),a=[];
1t.searchParams.forEach((e,t)=>{a.push({id:crypto.randomUUID(),key:t,value:e})});const n=t.pathname.split("/").filter(e=>e.startsWith(":")).map(e=>({id:crypto.randomUUID(),key:e.substring(1),value:""}));return{queryParams:a,pathParams:n}}catch{const t=[],a=[],n=e.indexOf("?");if(-1!==n){const a=e.substring(n+1);new URLSearchParams(a).forEach((e,a)=>{t.push({id:crypto.randomUUID(),key:a,value:e})})}const r=e.match(/:[a-zA-Z_][a-zA-Z0-9_]*/g);return r&&r.forEach(e=>{const t=e.substring(1);a.find(e=>e.key===t)||a.push({id:crypto.randomUUID(),key:t,value:""})}),{queryParams:t,pathParams:a}}},[]),X=v.useCallback((e,t)=>{H(a=>{const n={...a,[e]:t};if("url"===e&&t!==a.url&&"string"==typeof t&&!t.startsWith("curl")){const{queryParams:e,pathParams:r}=V(t),s=new Set(a.query?.map(e=>e.key)||[]),o=new Set(e.map(e=>e.key)),i=s.size!==o.size||[...s].some(e=>!o.has(e)),l=new Set(a.path?.map(e=>e.key)||[]),c=new Set(r.map(e=>e.key)),d=l.size!==c.size||[...l].some(e=>!c.has(e));if(i||d)return{...n,query:e,path:r}}return n})},[V]),_=v.useMemo(()=>"headers"===P?F.headers:"query"===P?F.query:"path"===P?F.path:"body"===P?F.body:[],[P,F]),Y=v.useCallback((e,t)=>{let a=e;const n=a.indexOf("?");if(-1!==n&&(a=a.substring(0,n)),t.length>0){const e=t.filter(e=>e.key&&e.value).map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`).join("&");e&&(a+=`?${e}`)}return a},[]),K=v.useCallback(e=>X("body",e),[X]),Z=v.useCallback(e=>{H(t=>{const a={...t,query:e},n=a.url||"";if(!n.startsWith("curl")){const t=Y(n,e);return{...a,url:t}}return a})},[Y]),Q=v.useCallback(e=>X("path",e),[X]),ee=v.useCallback(e=>X("headers",e),[X]),te=v.useMemo(()=>({headers:ee,query:Z,body:K,path:Q}),[ee,Z,K,Q]),ae=v.useCallback((e,t,a,n)=>{const r=F[e]?.find(e=>e.id===t),s=F[e]?.map(e=>e.id===t?{...e,[a]:n}:e);if("query"===e)Z(s);else if("path"===e&&"key"===a&&r){te[e](s);let t=F.url||"";if(r.key){const e=r.key.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp(`:${e}(?=/|$)`,"g"),`:${n}`)}X("url",t)}else te[e](s)},[F,te,Z,X]),ne=v.useCallback(e=>{let t="";const a=F[e]?.map(e=>e.key)||[];if("path"===e){let e=1;for(t=`param${e}`;a.includes(t);)e++,t=`param${e}`}const n={id:crypto.randomUUID(),value:"",key:"path"===e?t:""},r=[...F[e]||[],n];"query"===e?Z(r):"path"===e&&t?(te[e](r),X("url",`${F.url}/:${t}`)):te[e](r)},[F,te,Z,X]),re=v.useCallback((e,t)=>{const a=F[e]?.find(e=>e.id===t),n=F[e]?.filter(e=>e.id!==t)||[];if("query"===e)Z(n);else if("path"===e&&a?.key){te[e](n);const t=F.url||"",r=a.key.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(`/?:${r}(?=/|$)/?`,"g"),o=t.replace(s,e=>e.startsWith("/")&&e.endsWith("/")?"/":"").replace(/([^:]\/)\/+/g,"$1").replace(/\/$/,"");X("url",o)}else te[e](n)},[F,te,Z,X]),se=v.useCallback(e=>{try{const t=S(e),a={url:t.url||"",method:t.method||"GET",headers:t.headers||[],query:t.query||[],path:t.path||[],body:t.body||[],rawResponse:F.rawResponse};H(a)}catch(t){}},[F.rawResponse]),oe=v.useCallback(e=>{H(("posts"===e?yt:"todos"===e?xt:vt).config)},[]);v.useEffect(()=>{const e=F.url;e?.trim().toLowerCase().startsWith("curl ")&&se(e)},[F.url,se]);const ie=v.useCallback(()=>{const e={url:F.url,method:F.method};return F.headers?.length>0&&(e.headers=F.headers.map(e=>({key:e.key,value:e.value}))),F.query?.length>0&&(e.query=F.query.map(e=>({key:e.key,value:e.value}))),F.path?.length>0&&(e.path=F.path.map(e=>({key:e.key,value:e.value}))),F.body?.length>0&&(e.body=F.body.map(e=>({key:e.key,value:e.value}))),e},[F]),le=v.useCallback(()=>{const e={config:ie(),timestamp:Date.now(),version:"1.0"},t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=`api-config-${Date.now()}.json`,n.click(),URL.revokeObjectURL(a)},[ie]),ce=v.useCallback(e=>{const t=e.target.files?.[0];if(!t)return;const a=new FileReader;a.onload=e=>{try{const t=JSON.parse(e.target?.result);t.config&&H(e=>({...t.config,rawResponse:e.rawResponse}))}catch(t){}},a.readAsText(t)},[]),de=v.useCallback(()=>{if(!$.trim())return;const e={id:crypto.randomUUID(),name:$.trim(),config:ie(),timestamp:Date.now()};J(t=>[e,...t]),A(""),I(!1)},[$,ie]),ue=v.useCallback(e=>{H(t=>({...e.config,rawResponse:t.rawResponse}))},[]),pe=v.useCallback(e=>{J(t=>t.filter(t=>t.id!==e))},[]),fe=v.useCallback(e=>{G(t=>t.filter(t=>t.id!==e))},[]),he=v.useCallback(e=>{H(t=>({...e.config,rawResponse:t.rawResponse}))},[]),me=v.useCallback(()=>{G([])},[]),ge=v.useMemo(()=>
1{if(!D||!F.rawResponse?.data)return F.rawResponse?.data;try{return JSON.stringify(F.rawResponse.data,null,2).toLowerCase().includes(D.toLowerCase())?F.rawResponse.data:null}catch{return F.rawResponse.data}},[F.rawResponse,D]),ye=v.useMemo(()=>({headers:y("apiPlayground.tabs.headers"),path:y("apiPlayground.tabs.path"),query:y("apiPlayground.tabs.query"),body:y("apiPlayground.tabs.body"),response:y("apiPlayground.tabs.response"),code:y("apiPlayground.tabs.code"),history:y("apiPlayground.tabs.history"),saved:y("apiPlayground.tabs.saved")}),[y]);return e.jsxs(Ze,{direction:"horizontal",className:"h-full gap-4 bg-neutral-950",children:[e.jsx(Qe,{defaultSize:66,minSize:50,children:e.jsxs("div",{className:"flex flex-col gap-4 h-full p-6 bg-neutral-900 rounded-lg shadow-sm border border-gray-700/40",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs(z,{children:[e.jsx(N,{asChild:!0,children:e.jsxs(b,{variant:"outline",size:"sm",className:"w-full sm:w-[90px] justify-between",children:[F.method,e.jsx(r,{className:"h-4 w-4 ml-2"})]})}),e.jsx(C,{children:tt.map(t=>e.jsx(k,{onClick:()=>X("method",t),children:e.jsxs("div",{className:"flex items-center",children:[t,F.method===t&&e.jsx(a,{className:"ml-2 h-4 w-4"})]})},t))})]}),e.jsx(R,{placeholder:y("apiPlayground.placeholders.url"),value:F.url,onChange:e=>X("url",e.target.value),className:"flex-1 h-10 bg-neutral-800 text-gray-100 placeholder-gray-500 border border-gray-700 rounded-md px-3 focus:outline-none focus:ring-2 focus:ring-blue-500/50"})]}),e.jsx("div",{className:"flex gap-1 border-b border-gray-700",children:[{value:"headers",label:ye.headers,supportedTab:tt},{value:"path",label:ye.path,supportedTab:tt},{value:"query",label:ye.query,supportedTab:tt},{value:"body",label:ye.body,supportedTab:["POST","PUT","PATCH"]}].filter(e=>e.supportedTab.includes(F.method)).map(t=>e.jsx(ut,{active:P===t.value,onClick:()=>L(t.value),children:t.label},t.value))}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-4",children:[["headers","query","path"].includes(P)&&e.jsxs("div",{className:"space-y-3",children:[_?.map(t=>e.jsx(pt,{param:t,type:P,disabled:"path"===P,onUpdate:ae.bind(null,P),onRemove:re.bind(null,P)},t.id)),e.jsxs(b,{variant:"outline",size:"sm",className:"mt-4 h-10",onClick:()=>ne(P),children:[e.jsx(s,{className:"h-4 w-4 mr-2"}),y("apiPlayground.actions.addItem",{item:ye[P]||P})]})]}),"body"===P&&["POST","PUT","PATCH"].includes(F.method)&&e.jsxs("div",{className:"space-y-3",children:[F.body?.map(t=>e.jsx(pt,{param:t,type:"body",onUpdate:ae.bind(null,"body"),onRemove:re.bind(null,"body")},t.id)),e.jsxs(b,{variant:"outline",size:"sm",className:"mt-4 h-10",onClick:()=>ne("body"),children:[e.jsx(s,{className:"h-4 w-4 mr-2"}),y("apiPlayground.actions.addField")]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-6 border-t border-gray-700 flex-wrap",children:[e.jsxs(z,{children:[e.jsx(N,{asChild:!0,children:e.jsx(b,{disabled:x,variant:"outline",size:"sm",className:"h-10",children:y("apiPlayground.actions.examples")})}),e.jsxs(C,{children:[e.jsx(k,{onClick:()=>oe("posts"),children:y("apiPlayground.actions.examplePosts")}),e.jsx(k,{onClick:()=>oe("todos"),children:y("apiPlayground.actions.exampleTodos")}),e.jsx(k,{onClick:()=>oe("create"),children:y("apiPlayground.actions.exampleCreate")})]})]}),e.jsxs(b,{variant:"outline",size:"sm",className:"h-10",onClick:()=>I(!O),children:[e.jsx(o,{className:"h-4 w-4 mr-2"}),y("common.save")]}),e.jsxs(b,{variant:"outline",size:"sm",className:"h-10",onClick:le,children:[e.jsx(i,{className:"h-4 w-4 mr-2"}),y("apiPlayground.actions.export")]}),e.jsxs("label",{className:"relative",children:[e.jsx("input",{type:"file",accept:".json",onChange:ce,className:"absolute inset-0 opacity-0 cursor-pointer"}),e.jsxs(b,{variant:"outline",size:"sm",className:"h-10",as:"div",children:[e.jsx(l,{className:"h-4 w-4 mr-2"}),y("apiPlayground.actions.import")]})]}),e.jsx(b,{onClick:async()=>{if(!g)return;w(!0);const e=Date.now();try{const t=await g(F),a=Date.now()-e,n=(t&&(t.status_code??t.status??t.statusCode))??void 0,r=(t&&(t.response??t.responseBody??t.data??t.body))??t,s=t?.headers||{};X("rawResponse",{status:n,data:r,headers:s,duration:a});const o={id:crypto.randomUUID(),timestamp:Date.now(),method:F.method,url:F.url,config:{...F},response:{status:n,data:r,headers:s},duration:a};G(e=>[o,...e].slice(0,50))}catch(t){const a=Date.now()-e,n=t instanceof Error?t.message:String(t);X("rawResponse",{error:n,duration:a});const r={id:crypto.randomUUID(),timestamp:Date.now(),method:F.method,url:F.url,config:{...F},response:{error:n},duration:a};G(e=>[r,...e].slice(0,50))}finally{w(!1)}},disabled:!F.url?.trim()||x,variant:"default",size:"sm",className:"h-10 px-6 ml-auto",children:y(x?"apiPlayground.actions.testing":"apiPlayground.actions.test")})]}),O&&e.jsx("div",{className:"p-4 bg-neutral-800/50 rounded-lg border border-gray-700/40",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(R,{placeholder:y("apiPlayground.placeholders.configName"),value:$,onChange:e=>A(e.target.value),onKeyPress:e=>"Enter"===e.key&&de(),className:"flex-1 h-9 bg-neutral-800 text-gray-100 placeholder-gray-500 border border-gray-700"}),e.jsx(b,{size:"sm",onClick:de,disabled:!$.trim(),className:"h-9",children:y("common.save")}),e.jsx(b,{size:"sm",variant:"ghost",onClick:()=>{I(!1),A("")},className:"h-9",children:y("common.cancel")})]})})]})}),e.jsx(et,{withHandle:!0}),e.jsx(Qe,{defaultSize:34,minSize:25,children:e.jsxs("div",{className:"h-full flex flex-col bg-neutral-900 rounded-lg shadow-sm border border-gray-700/40",children:[e.jsxs("div",{className:"flex gap-1 border-b border-gray-700 p-2",children:[e.jsx(ut,{active:"response"===E,onClick:()=>T("response"),children:ye.response}),e.jsxs(ut,{active:"code"===E,onClick:()=>T("code"),children:[e.jsx(c,{className:"h-3 w-3 mr-1.5"}),ye.code]}),e.jsxs(ut,{active:"history"===E,onClick:()=>T("history"),children:[e.jsx(d,{className:"h-3 w-3 mr-1.5"}),ye.history]}),e.jsxs(ut,{active:"saved"===E,onClick:()=>T("saved"),children:[e.jsx(u,{className:"h-3 w-3 mr-1.5"}),ye.saved]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:["response"===E&&e.jsxs("div",{className:"h-full flex flex-col p-4",children:[F.rawResponse?.status&&e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx(dt,{status:F.rawResponse.status,duration:F.rawResponse.duration}),e.jsxs(b,{size:"sm",variant:"ghost",className:"h-8",onClick:()=>ct(JSON.stringify(F.rawResponse.data,null,2)),children:[e.jsx(p,{className:"h-3 w-3 mr-1.5"}),y("common.copy")]})]}),F.rawResponse&&Object.keys(F.rawResponse).length>0&&e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(f,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-500"}),e.jsx(R,{placeholder:y("apiPlayground.placeholders.responseSearch"),value:D,onChange:e=>M(e.target.value),className:"pl-9 pr-9 h-9 bg-neutral-800 text-gray-100 placeholder-gray-500 border border-gray-700"}),D&&e.jsx("button",{onClick:()=>M(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-300",children:e.jsx(h,{className:"h-4 w-4"})})]})}),e.jsx("div",{className:"flex-1 overflow-auto bg-neutral-950/50 rounded-lg p-4",children:F.rawResponse?.error?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(t,{className:"h-4 w-4 text-red-400 mt-0.5"}),e.jsx("span",{className:"text-red-400 font-medium text-sm",children:F.rawResponse.error})]}):F.rawResponse?.data?e.jsx("pre",{className:"text-xs text-gray-100 font-mono whitespace-pre-wrap",children:JSON.stringify(ge,null,2)}):e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 text-sm",children:y("apiPlayground.messages.noResponse",{action:y("apiPlayground.actions.test")})})})]}),"code"===E&&e.jsxs("div",{className:"h-full flex flex-col p-4",children:[e.jsx("div",{className:"mb-3 flex gap-2",children:["curl","javascript","python"].map(t=>e.jsx(b,{size:"sm",variant:U===t?"default":"outline",onClick:()=>q(t),className:"h-8 text-xs",children:y("curl"===t?"apiPlayground.codeLanguages.curl":"javascript"===t?"apiPlayground.codeLanguages.javascript":"apiPlayground.codeLanguages.python")},t))}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx(ft,{config:F,language:U})})]}),"history"===E&&e.jsxs("div",{className:"h-full flex flex-col p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-200",children:y("apiPlayground.sections.requestHistory")}),W.length>0&&e.jsx(b,{size:"sm",variant:"ghost",onClick:me,className:"h-7 text-xs text-red-400 hover:text-red-300",children:y("apiPlayground.actions.clearAll")})]}),e.jsx("div",{className:"flex-1 overflow-auto space-y-2",children:0===W.length?e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 text-sm",children:y("apiPlayground.messages.noHistory")}):W.map(t=>e.jsx(ht,{item:t,onSelect:()=>he(t),onDelete:fe},t.id))})]}),"saved"===E&&e.jsxs("div",{className:"h-full flex flex-col p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-200 mb-3",children:y("apiPlayground.sections.savedConfigs")}),e.jsx("div",{className:"flex-1 overflow-auto space-y-2",children:0===B.length?e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 text-sm",children:y("apiPlayground.messages.noSaved")}):B.map(t=>e.jsx(mt,{item:t,onLoad:()=>ue(t),onDelete:pe},t.id))})]})]})]})})]})}const yt={config:{url:"https://jsonplaceholder.typicode.com/posts",method:"GET",headers:[{id:"header-1",key:"Accept",value:"application/json"}],query:[{id:"query-1",key:"userId",value:"1"}],path:[],body:[]}},xt={config:{url:"https://jsonplaceholder.typicode.com/todos",method:"GET",headers:[{id:"header-1",key:"Accept",value:"application/json"}],query:[{id:"query-1",key:"completed",value:"false"}],path:[],body:[]}},vt={config:{url:"https://jsonplaceholder.typicode.com/posts",method:"POST",headers:[{id:"header-1",key:"Content-Type",value:"application/json"}],query:[],path:[],body:[{id:"body-1",key:"title",value:"My New Post"},{id:"body-2",key:"body",value:"This is the post content"},{id:"body-3",key:"userId",value:"1"}]}};function bt(){const{t:t}=j(),a=t("apiPlayground"),[n,r]=v.useState({url:"",method:"GET",headers:[],query:[],path:[],body:[]});v.useEffect(()=>(document.documentElement.classList.add("dark"),()=>{}),[]);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{children:[e.jsx("title",{children:a.metaTitle}),e.jsx("meta",{name:"description",content:a.metaDescription})]}),e.jsx("div",{className:"min-h-screen w-full bg-neutral-950",children:e.jsx("div",{className:"container mx-auto py-12 px-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsx("h1",{className:"text-4xl font-bold text-white tracking-tight",children:a.title})}),e.jsx("p",{className:"text-gray-400 text-lg",children:a.subtitle})]}),e.jsx("div",{className:"bg-neutral-900/50 rounded-xl border border-gray-800 p-6 h-[700px]",children:e.jsx(gt,{config:n,onTest:async e=>{let t=e.url;const a=new URLSearchParams;
1e.query?.forEach(e=>{e.key&&e.value&&a.append(e.key,e.value)}),a.toString()&&(t+=`?${a.toString()}`);const n={};let r;if(e.headers?.forEach(e=>{e.key&&e.value&&(n[e.key]=e.value)}),["POST","PUT","PATCH"].includes(e.method)){const t={};e.body?.forEach(e=>{e.key&&(t[e.key]=e.value)}),r=JSON.stringify(t),n["Content-Type"]=n["Content-Type"]||"application/json"}try{const a=await fetch(t,{method:e.method,headers:n,body:r});if(!a.ok){let e=a.statusText;try{const t=await a.json();e=t?.error||JSON.stringify(t)}catch{}throw new Error(e||`Request failed with status ${a.status}`)}if((a.headers.get("content-type")||"").includes("application/json")){const e=await a.json();return{status:a.status,data:e}}{const e=await a.text();return{status:a.status,data:e}}}catch(s){throw s}},onConfigChange:r})}),e.jsx("div",{className:"mt-10 grid grid-cols-1 md:grid-cols-3 gap-5",children:a.features.map((t,a)=>e.jsx(wt,{title:t.title,description:t.description},`${t.title}-${a}`))})]})})})]})}function wt({title:t,description:a}){return e.jsxs("div",{className:"bg-neutral-900/50 p-6 rounded-lg border border-gray-800 hover:border-gray-700 transition-colors",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t}),e.jsx("p",{className:"text-sm text-gray-400",children:a})]})}export{bt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.