{"version":3,"file":"RequestConsole.BzXPbeey.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/skutfc2nPV4BgRwaUclh/rUl5IoDkuciCNgKGLO7K/RequestConsole.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const snippets={Python:`from openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://api.your-domain.com/v1\",\n    api_key=os.environ[\"API_KEY\"]\n)\n\nresponse = client.chat.completions.create(\n    model=\"balanced\",\n    messages=[{\n        \"role\": \"user\",\n        \"content\": \"What should we build next?\"\n    }]\n)`,TypeScript:`import OpenAI from \"openai\"\n\nconst client = new OpenAI({\n  baseURL: \"https://api.your-domain.com/v1\",\n  apiKey: process.env.API_KEY,\n})\n\nconst response = await client.chat.completions.create({\n  model: \"balanced\",\n  messages: [{\n    role: \"user\",\n    content: \"What should we build next?\",\n  }],\n})`};/** @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 430 */export default function RequestConsole({style,pythonExample=\"import os\\n\"+snippets.Python,typeScriptExample=snippets.TypeScript,footerLabel=\"OPENAI-COMPATIBLE REQUEST FORMAT / SERVER-SIDE EXAMPLE\"}){const[language,setLanguage]=React.useState(\"Python\");const[copied,setCopied]=React.useState(\"\");const timer=React.useRef();const codeBlock=React.useRef(null);const mounted=React.useRef(true),copyId=React.useRef(0);React.useEffect(()=>{mounted.current=true;return()=>{mounted.current=false;copyId.current++;clearTimeout(timer.current);};},[]);const code=language===\"Python\"?pythonExample:typeScriptExample;async function copy(){const id=++copyId.current;setCopied(\"\");clearTimeout(timer.current);let message=\"Copied\";try{await navigator.clipboard.writeText(code);}catch{message=\"Code selected\";}if(!mounted.current||id!==copyId.current)return;if(message!==\"Copied\"&&codeBlock.current){const block=codeBlock.current,doc=block.ownerDocument,selection=doc.getSelection();block.focus({preventScroll:true});const range=doc.createRange();range.selectNodeContents(block);selection?.removeAllRanges();selection?.addRange(range);}setCopied(message);clearTimeout(timer.current);if(message===\"Copied\")timer.current=setTimeout(()=>setCopied(\"\"),2200);}return /*#__PURE__*/_jsxs(\"section\",{className:\"strateline-console\",\"aria-label\":\"API request example\",style:style,children:[/*#__PURE__*/_jsx(\"style\",{children:`.strateline-console{box-sizing:border-box;width:100%;background:#101426;color:#FFFFFF;border-radius:4px;overflow:hidden;font:12px/1.7 'IBM Plex Mono',monospace}.strateline-console *{box-sizing:border-box}.strateline-console header{display:flex;justify-content:space-between;gap:8px;align-items:center;border-bottom:1px solid #363D59;padding:12px 20px}.strateline-console button{font:inherit;color:#D0D8EC;border:0;background:none;padding:8px;cursor:pointer}.strateline-console button[aria-pressed=true]{color:#8EA6FF;border-bottom:1px solid #8EA6FF}.strateline-console button:focus-visible{outline:2px solid #8EA6FF;outline-offset:2px}.strateline-console pre{overflow:auto;white-space:pre;margin:0;padding:24px;font:inherit;tab-size:2}.strateline-console footer{padding:12px 24px;color:#D0D8EC;border-top:1px solid #363D59;font-size:10px}@media(max-width:500px){.strateline-console header{padding:10px 12px}.strateline-console pre{padding:20px 16px;font-size:10px}}`}),/*#__PURE__*/_jsxs(\"header\",{children:[/*#__PURE__*/_jsx(\"div\",{\"aria-label\":\"Language\",children:Object.keys(snippets).map(k=>/*#__PURE__*/_jsx(\"button\",{\"aria-pressed\":language===k,onClick:()=>{copyId.current++;clearTimeout(timer.current);setLanguage(k);setCopied(\"\");},children:k},k))}),/*#__PURE__*/_jsx(\"button\",{onClick:copy,\"aria-live\":\"polite\",children:copied||\"Copy ↗\"})]}),/*#__PURE__*/_jsx(\"pre\",{ref:codeBlock,tabIndex:0,\"aria-label\":\"Request code\",children:/*#__PURE__*/_jsx(\"code\",{children:code})}),/*#__PURE__*/_jsx(\"footer\",{\"aria-live\":\"polite\",children:copied===\"Code selected\"?\"Press Ctrl/Cmd+C to copy the selected code.\":footerLabel})]});}addPropertyControls(RequestConsole,{pythonExample:{type:ControlType.String,title:\"Python example\",displayTextArea:true,defaultValue:\"import os\\n\"+snippets.Python},typeScriptExample:{type:ControlType.String,title:\"TypeScript example\",displayTextArea:true,defaultValue:snippets.TypeScript},footerLabel:{type:ControlType.String,title:\"Example note\",defaultValue:\"OPENAI-COMPATIBLE REQUEST FORMAT / SERVER-SIDE EXAMPLE\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RequestConsole\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RequestConsole.map"],"mappings":"mMA6BgC,SAAwB,EAAe,CAAC,QAAM,gBAAc;EAAc,EAAS,OAAO,oBAAkB,EAAS,WAAW,cAAY,0DAA0D,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAe,QAAQ,EAAO,CAAC,EAAO,GAAWA,EAAe,EAAE,EAAQ,EAAMC,EAAa,EAAQ,EAAUA,EAAa,IAAI,EAAQ,EAAQA,EAAa,EAAI,EAAE,EAAOA,EAAa,CAAC,EAAE,OAAqB,EAAQ,QAAQ,OAAe,CAAC,EAAQ,QAAQ,GAAM,EAAO,UAAU,aAAa,EAAM,OAAO,CAAE,GAAI,CAAC,CAAC,EAAE,IAAM,EAAK,IAAW,SAAS,EAAc,EAAkB,eAAe,GAAM,CAAC,IAAM,EAAG,EAAE,EAAO,QAAQ,EAAU,EAAE,EAAE,aAAa,EAAM,OAAO,EAAE,IAAI,EAAQ,SAAS,GAAG,CAAC,MAAM,EAAU,UAAU,UAAU,CAAI,CAAE,MAAM,CAAC,EAAQ,eAAgB,CAAI,MAAC,EAAQ,SAAS,IAAK,EAAO,SAAe,IAAG,IAAU,UAAU,EAAU,QAAQ,CAAC,IAAM,EAAM,EAAU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