1import{ac as v,j as e,u as k,a as B,r as m,A,Z as V,ab as x,cy as D,al as E}from"./index-BTfcerCQ.js";import{T as g}from"./tools.service-DSpoyzxD.js";import{u as R,B as O,P as H,H as z,a as L,O as F,S as U,V as q,t as j}from"./ValidateSection-x26AHlBQ.js";import{u as G,R as K}from"./ResourceLimitDialog-0ChUUGt4.js";import{p as M}from"./limit-errors-D3pF5E9B.js";import{P as Z}from"./play-OYEGmTvl.js";import"./request-curl-RGgeATc8.js";import"./RequestPairsEditor-B8ENJcMS.js";import"./useResourceQuery-c3hGxJCK.js";import"./credentials.service-GXUgE63K.js";import"./settings-BBfsqGt7.js";import"./shield-check-BlYi1QiZ.js";import"./save-B-d3sPaV.js";import"./resource-types-BRc2eBeQ.js";const $="'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif";function ce(){const l=v();return e.jsx(J,{},l)}function J(){const l=k(),{user:p,claims:u}=B(),h=u?.orgId,n=v(),[o,f]=m.useState(()=>!h||!n?{...g.createNewTool("",{uid:""}),id:"",orgId:""}:g.createNewTool(h,{uid:p?.uid??u?.userId??"",email:p?.email||void 0})),i=s=>{f(a=>{if(!a)return a;const d=typeof s=="function"?s(a):s;return j(d)===j(a)?d:{...d,isValidated:!1,updatedAt:new Date}})},[t,w]=m.useState("basic"),[N,T]=m.useState(!1),r=G(),y=()=>{l("/app/tools")},{isSaving:c,saveError:b,validationResult:S,handleSave:I,handleValidate:P}=R(o,f,()=>l("/app/tools"),s=>{const a=M(s);a.isResourceExhausted&&r.showDialog({resource:a.resource||"customTools",currentUsage:a.current,limit:a.limit,message:a.message})}),C=[{id:"basic",label:"Info",icon:V},{id:"parameters",label:"Params",icon:x},{id:"headers",label:"Headers",icon:x},{id:"body",label:"Body",icon:x},{id:"oauth",label:"OAuth",icon:D},{id:"schema",label:"Schema",icon:E},{id:"validate",label:"Validate",icon:Z}];return e.jsxs("div",{className:"min-w-0 space-y-6",style:{fontFamily:$},children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsx("button",{onClick:y,className:"p-2 text-[#8e8e8e] hover:text-white hover:bg-white/[0.05] rounded-lg transition-colors",title:"Back to tools","aria-label":"Back to tools",disabled:c,children:e.jsx(A,{size:20})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-[-0.02em] text-white",children:"Create tool"}),e.jsx("p",{className:"text-sm text-[#949494] mt-0.5",children:"Configure your API endpoint and request structure"})]})]}),b&&e.jsx("p",{role:"alert",className:"break-words rounded-lg border border-red-500/20 bg-red-500/10 p-4 text-sm text-red-400",children:b}),!n&&e.jsx("p",{role:"alert",className:"text-sm text-red-400",children:"Select an organization to configure tools."}),e.jsx("fieldset",{disabled:c||!n,className:"min-w-0 max-w-4xl mx-auto p-1 w-full",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"border-b border-white/[0.08] -mx-1 sm:mx-0",children:e.jsx("div",{className:"overflow-x-auto scrollbar-hide",children:e.jsx("nav",{className:"flex flex-nowrap min-w-min px-1 sm:px-0",children:C.map(s=>{const a=s.icon;return e.jsxs("button",{"aria-label":s.label,onClick:()=>w(s.id),"aria-current":t===s.id?"page":void 0,className:`flex items-center gap-1.5 sm:gap-2 px-3 sm:px-6 py-3 sm:py-4 text-xs sm:text-sm font-medium transition-colors relative whitespace-nowrap flex-shrink-0 ${t===s.id?"text-white border-b-2 border-white":"text-[#8e8e8e] hover:text-[#cfcfcf]"}`,children:[e.jsx(a,{size:16,className:"flex-shrink-0"}),e.jsx("span",{className:"hidden sm:inline",children:s.label}),e.jsx("span",{className:"sm:hidden",children:s.label.split(" ")[0]})]},s.id)})})})}),e.jsxs("div",{children:[t==="basic"&&e.jsx(O,{tool:o,setTool:i,onValidationChange:T}),t==="parameters"&&e.jsx(H,{tool:o,setTool:i}),t==="headers"&&e.jsx(z,{tool:o,setTool:i}),t==="body"&&e.jsx(L,{tool:o,setTool:i}),t==="oauth"&&e.jsx(F,{tool:o,setTool:i}),t==="schema"&&e.jsx(U,{tool:o,setTool:i}),t==="validate"&&e.jsx(q,{tool:o,validationResult:S,onValidate:P,onSave:I,isBasicInfoValid:N,isSaving:c,isEditing:!1,hasChanges:!0})]})]})}),r.dialogProps&&e.jsx(K,{isOpen:r.isOpen,onClose:r.hideDialog,...r.dialogProps})]})}export{ce 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.