module.exports=[742478,e=>{"use strict";e.s(["sanitizeSurrogates",0,function(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}])},311129,e=>{"use strict";e.s(["adjustMaxTokensForThinking",0,function(e,t,r,o){let n={minimal:1024,low:2048,medium:8192,high:16384,...o}["xhigh"===r?"high":r],i=void 0===e?t:Math.min(e+n,t);return i<=n&&(n=Math.max(0,i-1024)),{maxTokens:i,thinkingBudget:n}},"buildBaseOptions",0,function(e,t,r){return{temperature:t?.temperature,maxTokens:t?.maxTokens,signal:t?.signal,apiKey:r||t?.apiKey,transport:t?.transport,cacheRetention:t?.cacheRetention,sessionId:t?.sessionId,headers:t?.headers,onPayload:t?.onPayload,onResponse:t?.onResponse,timeoutMs:t?.timeoutMs,maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,metadata:t?.metadata}}])},259218,e=>{"use strict";function t(e,t){let r=[],o=!1;for(let n of e){if("image"===n.type){o||r.push({type:"text",text:t}),o=!0;continue}r.push(n),o=n.text===t}return r}e.s(["transformMessages",0,function(e,r,o){let n=new Map,i=(r.input.includes("image")?e:e.map(e=>"user"===e.role&&Array.isArray(e.content)?{...e,content:t(e.content,"(image omitted: model does not support images)")}:"toolResult"===e.role?{...e,content:t(e.content,"(tool image omitted: model does not support images)")}:e)).map(e=>{if("user"===e.role)return e;if("toolResult"===e.role){let t=n.get(e.toolCallId);return t&&t!==e.toolCallId?{...e,toolCallId:t}:e}if("assistant"===e.role){let t=e.provider===r.provider&&e.api===r.api&&e.model===r.id,i=e.content.flatMap(i=>{if("thinking"===i.type)return i.redacted?t?i:[]:t&&i.thinkingSignature?i:i.thinking&&""!==i.thinking.trim()?t?i:{type:"text",text:i.thinking}:[];if("text"===i.type)return t?i:{type:"text",text:i.text};if("toolCall"===i.type){let s=i;if(!t&&i.thoughtSignature&&(s={...i},delete s.thoughtSignature),!t&&o){let t=o(i.id,r,e);t!==i.id&&(n.set(i.id,t),s={...s,id:t})}return s}return i});return{...e,content:i}}return e}),s=[],a=[],l=new Set,u=()=>{if(a.length>0){for(let e of a)l.has(e.id)||s.push({role:"toolResult",toolCallId:e.id,toolName:e.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});a=[],l=new Set}};for(let e=0;e<i.length;e++){let t=i[e];if("assistant"===t.role){if(u(),"error"===t.stopReason||"aborted"===t.stopReason)continue;let e=t.content.filter(e=>"toolCall"===e.type);e.length>0&&(a=e,l=new Set),s.push(t)}else"toolResult"===t.role?l.add(t.toolCallId):"user"===t.role&&u(),s.push(t)}return u(),s}])},813341,e=>{"use strict";e.s(["headersToRecord",0,function(e){let t={};for(let[r,o]of e.entries())t[r]=o;return t}])},756508,e=>{"use strict";e.s(["clampOpenAIPromptCacheKey",0,function(e){if(void 0===e)return;let t=Array.from(e);return t.length<=64?e:t.slice(0,64).join("")}])},329383,e=>{"use strict";var t=e.i(755081);e.s(["default",()=>t.OpenAI])},37288,230268,e=>{"use strict";e.s(["isCloudflareProvider",0,function(e){return"cloudflare-workers-ai"===e||"cloudflare-ai-gateway"===e},"resolveCloudflareBaseUrl",0,function(e){let t=e.baseUrl;return t.includes("{")?t.replace(/\{([A-Z_][A-Z0-9_]*)\}/g,(t,r)=>{let o=process.env[r];if(!o)throw Error(`${r} is required for provider ${e.provider} but is not set.`);return o}):t}],37288),e.s(["buildCopilotDynamicHeaders",0,function(e){var t;let r,o={"X-Initiator":(r=(t=e.messages)[t.length-1])&&"user"!==r.role?"agent":"user","Openai-Intent":"conversation-edits"};return e.hasImages&&(o["Copilot-Vision-Request"]="true"),o},"hasCopilotVisionInput",0,function(e){return e.some(e=>!!("user"===e.role&&Array.isArray(e.content)||"toolResult"===e.role&&Array.isArray(e.content))&&e.content.some(e=>"image"===e.type))}],230268)}];

//# sourceMappingURL=0itb_0hamcdd._.js.map