티스토리 수익 글 보기

티스토리 수익 글 보기

“use strict”;(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([[37294],{8891:(e,t,a)=>{a.d(t,{L:()=>BlackbirdPermissionCaches});var s=a(50467),r=a(21067),i=a(96379),o=a(51987);let BlackbirdPermissionCaches=class BlackbirdPermissionCaches{async setupWarmCachesLoop(){(0,r.M3)()&&(BlackbirdPermissionCaches.warmCachesLoopSetup?await BlackbirdPermissionCaches.warm:(BlackbirdPermissionCaches.warmCachesLoopSetup=!0,await this.warmCaches()))}async warmCaches(){let e=54e4;try{let t=await (0,i.lS)(“/search/warm_blackbird_caches”,{headers:{Accept:”application/json”,…(0,o.kt)()}}),a=await t.json();e=new Date(a.userCacheExpiresAt).getTime()-Date.now()-3e4,(isNaN(e)||e<=5)&&(e=3e4)}catch{}BlackbirdPermissionCaches.warmResolve(),setTimeout(()=>{this.warmCaches()},e)}};(0,s._)(BlackbirdPermissionCaches,”warmCachesLoopSetup”,!1),(0,s._)(BlackbirdPermissionCaches,”warmResolve”,void 0),(0,s._)(BlackbirdPermissionCaches,”warm”,new Promise(e=>{BlackbirdPermissionCaches.warmResolve=e}))},14095:(e,t,a)=>{a.d(t,{U1:()=>m,Z2:()=>d});var s=a(50467),r=a(53419),i=a(97665),o=a(97286),n=a(96379),l=a(96540),c=a(25641),u=a(51213),h=a(35247);function d(e,t,a){let s=(0,i.jE)(),d=(0,l.useCallback)(()=>s.invalidateQueries({queryKey:[“copilot-chat”,”entitlement”]}),[s]),{data:m}=(0,o.I)({queryKey:[“copilot-chat”,”entitlement”],queryFn:async()=>{let e=await (0,n.lS)(“/github-copilot/chat/entitlement”);if(!e.ok)throw Error(`Failed to retrieve Copilot chat entitlement (${e.status} on ${e.url})`);return await e.json()},enabled:e===u.mF.LicensedLimited||e===u.mF.LicensedFull&&h.W.premiumRequestQuotasEnabled,placeholderData:{licenseType:e,plan:t,quotas:a},staleTime:3e5}),p=m?.licenseType??e,f=m?.plan??t,y=m?.quotas??a,k=(0,l.useCallback)(t=>{(e===u.mF.LicensedLimited||e===u.mF.LicensedFull&&h.W.premiumRequestQuotasEnabled)&&(h.W.reduceChatQuotaChecks&&p===u.mF.LicensedLimited&&y?.remaining.chatPercentage!==void 0&&y.remaining.chatPercentage>c.fG||p===u.mF.LicensedFull&&y?.remaining.premiumInteractionsPercentage!==void 0&&y.remaining.premiumInteractionsPercentage>c.mF||(d(),(0,r.BI)(“dotcom_chat.activate”,{target:”ENTITLEMENTS_RELOAD”,origin:t})))},[e,d,p,y?.remaining.chatPercentage,y?.remaining.premiumInteractionsPercentage]);return[new CopilotChatEntitlement(p,f,m?.quotas,m?.trial),k]}let CopilotChatEntitlement=class CopilotChatEntitlement{isLicensed(){return this.licenseType&&this.licenseType!==u.mF.Unlicensed}canPurchaseAdditionalQuota(){return this.licenseType!==u.mF.LicensedLimited&&h.W.premiumRequestQuotasEnabled&&(this.plan===u.UH.IndividualPro||this.plan===u.UH.IndividualProPlus)}canUpgradePlan(){return this.licenseType===u.mF.LicensedLimited||h.W.premiumRequestQuotasEnabled&&this.plan===u.UH.IndividualPro}chatQuotaRemaining(){return h.W.premiumRequestQuotasEnabled&&this.quotas?.remaining.chatPercentage!==void 0?this.quotas?.remaining.chatPercentage??0:this.quotas?.remaining.chat??0}premiumInteractionsQuotaRemaining(){return this.quotas?.remaining.premiumInteractionsPercentage??0}eligibleForTrial(){return this.trial?.eligible??!1}constructor(e,t,a,r){(0,s._)(this,”licenseType”,void 0),(0,s._)(this,”plan”,void 0),(0,s._)(this,”quotas”,void 0),(0,s._)(this,”trial”,void 0),this.licenseType=e,this.plan=t,this.quotas=a,this.trial=r}};function m(e){return!!(e&&e!==u.UH.IndividualFree)}},14457:(e,t,a)=>{a.d(t,{d:()=>ApiCache});var s=a(50467);let ApiCache=class ApiCache{async get(…e){let t=e.join(this.separator),a=this.cache.get(t);if(a)return a;{let a=this.fetchFn(…e);return this.cache.set(t,a),(await a).ok||this.cache.delete(t),a}}constructor(e){(0,s._)(this,”separator”,”-!-“),(0,s._)(this,”cache”,new Map),(0,s._)(this,”fetchFn”,void 0),this.fetchFn=e}}},20139:(e,t,a)=>{a.d(t,{k:()=>CopilotChatService});var s=a(50467),r=a(8891),i=a(65411),o=a(25407),n=a(96379),l=a(14457),c=a(25641),u=a(35247),h=a(79064),d=a(57872),m=a(44902),p=a(46062);let f=new Set([“snippet”,”file”,”symbol”,”repository”]);let CopilotChatService=class CopilotChatService{async fetchMCPServers(){let e=await this.makeCAPIRequest(“/mcps”,”GET”);if(!e.ok)throw Error(`Failed to fetch MCP servers: ${e.status}`);return(await e.json()).servers}async fetchThreads(e={}){let t=new URLSearchParams;”string”==typeof e.name&&t.set(“name”,e.name);let a=`/threads?${t.toString()}`,s=await this.makeCAPIRequest(a,”GET”);if(!s.ok)return s;let r=(await s.json()).threads||[];return{status:s.status,ok:!0,payload:r}}async fetchSharedThreads(){let e=await this.makeCAPIRequest(“/threads?shared”,”GET”);if(!e.ok)return e;let t=(await e.json()).threads||[];return{status:e.status,ok:!0,payload:t}}async fetchLatestThread(e){let t=new URLSearchParams;”string”==typeof e&&t.set(“thread_id”,e);let a=await this.makeCAPIRequest(`/threads/latest?${t.toString()}`,”GET”);if(!a.ok)return a;let s=(await a.json()).thread;return{status:a.status,ok:!0,payload:s}}async createThread(e,t){let a={custom_copilot_id:e?.id,custom_copilot_owner:e?.owner,scope_id:t},s=await this.makeCAPIRequest(“/threads”,”POST”,a);if(!s.ok)return s;let r=(await s.json()).thread;return{status:s.status,ok:!0,payload:r}}async deleteThread(e){let t=await this.makeCAPIRequest(`/threads/${e}`,”DELETE”);return t.ok?{status:t.status,ok:!0,payload:null}:t}async deleteAllThreads(e){let t=await this.makeCAPIRequest(“/threads”,”DELETE”,e);return t.ok?{status:t.status,ok:!0,payload:null}:t}async renameThread(e,t){let a=await this.makeCAPIRequest(`/threads/${e}/name`,”PATCH”,{generate:!1,name:t});if(!a.ok)return a;let s=(await a.json()).name||””;return{status:a.status,ok:!0,payload:s}}async clearThread(e){let t=await this.makeCAPIRequest(`/threads/${e}/clear`,”PATCH”);return t.ok?{status:t.status,ok:!0,payload:null}:t}async shareThread(e,t){let a=await this.makeCAPIRequest(`/threads/${e}/share`,”PATCH”,{shared_message_id:t});if(!a.ok)return a;let s=(await a.json()).thread;return{status:a.status,ok:!0,payload:s}}async unshareThread(e){let t=await this.makeCAPIRequest(`/threads/${e}/unshare`,”PATCH”);if(!t.ok)return t;let a=(await t.json()).thread;return{status:t.status,ok:!0,payload:a}}async unshareAllThreads(){let e=await this.makeCAPIRequest(“/threads/unshare”,”POST”);return e.ok?{status:e.status,ok:!0,payload:null}:e}async continueSharedThread(e){let t=await this.makeCAPIRequest(`/shared/${e}/duplicate`,”POST”);return t.ok?{status:200,ok:!0,payload:await t.json()}:t}async generateThreadName(e){let t=await this.makeCAPIRequest(`/threads/${e}/name`,”PATCH”,{generate:!0,name:””});if(!t.ok)return t;let a=(await t.json()).name||””;return{status:t.status,ok:!0,payload:a}}async getSystemPrompt(e){let t=await this.makeCAPIRequest(`/system_prompt/${e}`,”GET”);if(!t.ok)return t;let a=await t.json();return{status:t.status,ok:!0,payload:a}}async listMessages(e){if(this.listMessagesCache?.thread.id===e)return{status:200,ok:!0,payload:this.listMessagesCache};let t=await this.makeCAPIRequest(`/threads/${e}/messages`,”GET”);return this.handleListMessages(t,!0)}async listSharedThreadMessages(e){let t=await this.makeCAPIRequest(`/shared/${e}/messages`,”GET”);return this.handleListMessages(t,!1)}async handleListMessages(e,t){if(!e.ok)if(!(404===e.status&&e.response?.headers.has(“Content-Type”))||”application/json”!==e.response.headers.get(“Content-Type”))return e;else{let t=await e.response.json();return{…e,payload:t}}let a=await e.json();return t&&(Array.isArray(a.messages)&&(a.messages=a.messages.map(e=>(e.references=(0,d.q)(e.references),e))),this.listMessagesCache=a),{status:e.status,ok:!0,payload:a}}async createMessage(e,t,a,s,r,i,o){this.listMessagesCache=void 0;let n=await this.makeCAPIRequest(`/threads/${e}/messages`,”POST”,{content:t,mediaContent:a,intent:s,references:r,currentURL:window.location.href,customInstructions:i,model:o,settings:h.Jt.settings??void 0});if(!n.ok)return n;let l=(await n.json()).message;return{status:n.status,ok:!0,payload:l}}async createMessageStreaming({threadID:e,messageID:t,content:a,mediaContent:s,intent:r,mode:i,references:o,context:n,confirmations:l,customInstructions:c,model:d,customCopilotID:m,parentMessageID:p,tools:f,clientToolResults:k,signal:g,skillOptions:w}){this.listMessagesCache=void 0,m&&(i=”custom-copilots”);let T=u.W.domPageContext&&”immersive”!==i&&”custom-copilots”!==i?function(){let e=(document.querySelector(“main”)||document.body).cloneNode(!0);for(let t of[“script”,”style”,”svg”,”iframe”,”textarea”,”.js-header-wrapper”,”.footer”,”.sr-only”,”.react-code-file-contents”])for(let a of e.querySelectorAll(t))a.remove();for(let t of e.querySelectorAll(“*”)){if(!t.textContent?.trim()){t.remove();continue}let e=window.getComputedStyle(t);(“none”===e.display||”hidden”===e.visibility)&&t.remove()}let t=e.querySelectorAll(“p, h1, h2, h3, h4, li, td, th, blockquote, pre, code:not(pre code)”),a=[];for(let e of t){let t=y(e);t&&a.push(t)}let s=a.join(` `);return(s.length<=16e3?s:`${s.substring(0,16e3)} Content was truncated. Use the API to get full content.`).replace(/\s{2,}/g," ").trim()}():void 0,C={responseMessageID:t,content:a,intent:r,references:o,context:n,currentURL:window.location.href,streaming:!0,confirmations:l,customInstructions:c,model:d,mode:i,settings:h.Jt.settings??void 0,customCopilotID:m?.id,customCopilotOwner:m?.owner,parentMessageID:p,tools:f,clientToolResults:k,mediaContent:s,skillOptions:w,pageContext:T,requestTrace:h.Jt.getTracingRequestedFlag()},P=this.processQueryParams(new URLSearchParams(window.location.search)),v=await this.makeCAPIRequest(`/threads/${e}/messages?${P.toString()}`,"POST",C,!0,void 0,g);return v.ok?{status:v.status,ok:!0,response:v}:v}processQueryParams(e){let t=["instruction_prompt"],a=new URLSearchParams;for(let[s,r]of e)t.includes(s)&&a.append(s,r);return a}async listModels(){let e=await this.makeCAPIRequest("/models","GET",void 0,!1,"");if(!e.ok)return e;let t=await e.json();return{status:e.status,ok:!0,payload:t.data}}async setModelPolicyState(e,t){let a=await this.makeCAPIRequest(`/models/${e}/policy`,"POST",{state:t},!1,"");if(!a.ok)return Promise.reject(Error(`Failed to update model policy state: ${a.status}`))}async getSimpleCompletion(e,t){let a=(0,p.wv)(),s=t??a.id,r=await this.makeCAPIRequest("/chat/completions","POST",{messages:[{role:"user",content:e}],selectedModel:s,stream:!1},!1,"");if(!r.ok)return r;let i=(await r.json()).choices[0]?.message?.content||"";return{status:r.status,ok:!0,payload:i}}async sendFeedback({feedback:e,feedbackChoice:t,messageId:a,threadId:s,textResponse:r}){let i=await this.makeDotcomRequest(`${this.urlPathPrefix}/feedback`,"POST",{feedback:e,feedback_choice:t,message_id:a,thread_id:s,text_response:r});return i.ok?{status:i.status,ok:!0,payload:null}:i}async listRepoFiles(e,t=!1){let a=(0,o.ClY)({repo:e,commitOid:e.commitOID,includeDirectories:t});return this.repoFilesCache.get(a)}async querySymbols(e,t){return await this.blackbirdCaches.setupWarmCachesLoop(),this.querySymbolsCache.get(e.ownerLogin,e.name,t)}async fetchImplicitContext(e,t,a){let s=await this.makeDotcomRequest(`${this.urlPathPrefix}/implicit-context/${t}/${a}/${encodeURIComponent(e)}`,"GET");return s.ok?{status:s.status,ok:s.ok,payload:await s.json()}:s}getCachedRepo(e){return this.repoDetailsCache.get(e)}async fetchRepo(e){let t;if(this.repoDetailsCache.has(e))t=this.repoDetailsCache.get(e);else{let a=await this.makeDotcomRequest(`${this.urlPathPrefix}/repositories/${e}`,"GET");if(!a.ok)return a;t=await a.json(),this.repoDetailsCache.set(e,t)}return{status:200,ok:!0,payload:t}}async fetchFileContents(e,t,a){let s=await this.makeDotcomRequest(`${this.urlPathPrefix}/file_contents/${e}/${t}/${a}`,"GET");return s.ok?{status:200,ok:!0,payload:await s.json()}:s}async fetchFileContentsNwo(e,t,a,s){let r;return(r=s?await this.makeDotcomRequest(`${this.urlPathPrefix}/file_contents_nwo/${e}/${t}/${s}/${a}`,"GET"):await this.makeDotcomRequest(`${this.urlPathPrefix}/file_contents_nwo/${e}/${t}/${a}`,"GET")).ok?{status:200,ok:!0,payload:await r.json()}:r}async listAgents(e){let t=await (0,n.lS)(e);if(!t.ok)return{status:t.status,ok:!1,error:c.nN[t.status]||c.DW};let a=await t.json();return{status:t.status,ok:t.ok,payload:a}}async listCustomCopilots(){let e=await (0,n.lS)(`${this.urlPathPrefix}/custom_copilots`);if(!e.ok)return{status:e.status,ok:!1,error:c.nN[e.status]||c.DW};let t=await e.json();return{status:e.status,ok:!0,payload:t}}async fetchCopilotSpace(e){let t,{owner:a,id:s}=e;t=a?`${this.urlPathPrefix}/custom_copilots/${a}/${s}`:`${this.urlPathPrefix}/custom_copilots/${s}`;let r=await (0,n.lS)(t);if(!r.ok)return{status:r.status,ok:!1,error:c.nN[r.status]||c.DW};let i=await r.json();return{status:r.status,ok:!0,payload:i}}async fetchCustomAgents(e,t){let a=await this.makeCAPIRequest(`/agents/swe/custom-agents/${e}/${t}`,"GET",void 0,void 0,"");if(!a.ok)return 404===a.status?{status:a.status,ok:!0,payload:[]}:{status:a.status,ok:!1,error:c.nN[a.status]||c.DW};let s=(await a.json()).agents;return{status:a.status,ok:!0,payload:s}}async hydrateReference(e){if(!f.has(e.type))return{status:204,ok:!0,payload:e};let t=await this.makeDotcomRequest(`${this.urlPathPrefix}/reference_details`,"POST",{reference:e});return t.ok?{status:t.status,ok:t.ok,payload:await t.json()}:t}async fetchLanguageForFileReference(e){let{repoOwner:t,repoName:a}=e,s=window.btoa(e.path),r=(0,o.RT3)({ownerLogin:t,name:a},s,!0),i=await this.makeDotcomRequest(r,"GET");return i.ok?{status:i.status,ok:i.ok,payload:await i.json()}:i}async fetchAutocompleteIssues(e,t){let a=await this.makeDotcomRequest(`/copilot/chat/autocomplete/issues?repo=${e}&q=${t}`,"GET");return a.ok?await a.json():[]}async fetchAutocompletePullRequests(e,t){let a=await this.makeDotcomRequest(`/copilot/chat/autocomplete/pulls?repo=${e}&q=${t}`,"GET");return a.ok?await a.json():[]}async fetchAutocompleteDiscussions(e,t){let a=await this.makeDotcomRequest(`/copilot/chat/autocomplete/discussions?repo=${e}&q=${t}`,"GET");return a.ok?await a.json():[]}async makeDotcomRequest(e,t,a){let s={};for(let e of(0,m.f)()){let t=e.split("="),a=t[0]?.replaceAll("_","-"),r="1";t.length>1&&(r=t[1]),s[`X-Experiment-${a}`]=r}let r=await this.copilotAuthTokenProvider.getAuthToken();s[“X-Copilot-Api-Token”]=r.value;try{let r=await (0,n.lS)(e,{method:t,body:a,headers:s});if(r.ok)return r;return{status:r.status,ok:!1,error:c.nN[r.status]||c.DW}}catch{return{status:500,ok:!1,error:c.DW}}}get directConnectConfiguration(){return{integrationID:”copilot-chat”}}async makeCAPIRequest(e,t,a,s=!1,r=”/github/chat”,i){let o=this.apiURL,n=await this.copilotAuthTokenProvider.getAuthToken();return await (0,c.p)({basePath:o+r,path:e,method:t,body:a,streamingResponse:s,authToken:n,integrationId:this.directConnectConfiguration.integrationID,realIp:this.realIp,signal:i,apiVersion:this.apiVersion})}async fetchTracesByThreadID(e,t){let a=`/thread/${e}`;t&&(a+=`?sharedID=${encodeURIComponent(t)}`);let s=await this.makeCAPIRequest(a,”GET”,void 0,!1,”/traces”);if(!s.ok)return s;let r=await this.processTracesResponse(s);return{status:s.status,ok:!0,payload:r}}async fetchCoffeTrace(e){let t=await this.makeCAPIRequest(`/evaluation/thread/${e}`,”GET”,void 0,!1,”/traces”);if(!t.ok)return t;let a=await this.processTracesResponse(t);return{status:t.status,ok:!0,payload:a}}async processTracesResponse(e){let t=await e.json(),a=[];for(let e of t)e.spans&&Array.isArray(e.spans)&&e.id&&a.push({id:e.id,spans:e.spans});return a}async deleteTrace(e,t){let a=await this.makeCAPIRequest(`/thread/${e}/trace/${t}`,”DELETE”,void 0,!1,”/traces”);return a.ok?{status:a.status,ok:!0,payload:null}:a}async deleteTracesForThread(e){let t=await this.makeCAPIRequest(`/thread/${e}`,”DELETE”,void 0,!1,”/traces”);return t.ok?{status:t.status,ok:!0,payload:null}:t}constructor(e,t,a,o){(0,s._)(this,”apiURL”,void 0),(0,s._)(this,”urlPathPrefix”,”/github-copilot/chat”),(0,s._)(this,”repoDetailsCache”,new Map),(0,s._)(this,”listMessagesCache”,void 0),(0,s._)(this,”copilotAuthTokenProvider”,void 0),(0,s._)(this,”blackbirdCaches”,new r.L),(0,s._)(this,”realIp”,void 0),(0,s._)(this,”apiVersion”,void 0),(0,s._)(this,”listRepoFilesImpl”,async e=>{let t=await this.makeDotcomRequest(e,”GET”);return t.ok?{status:200,ok:!0,payload:await t.json()}:t}),(0,s._)(this,”repoFilesCache”,new l.d(this.listRepoFilesImpl)),(0,s._)(this,”querySymbolsImpl”,async(e,t,a)=>{let s=await this.makeDotcomRequest(`/search/suggestions?query=repo:${e}/${t} ${a}`,”GET”);return s.ok?{status:200,ok:!0,payload:(await s.json()).suggestions.filter(e=>”SUGGESTION_KIND_SYMBOL”===e.kind)}:s}),(0,s._)(this,”querySymbolsCache”,new l.d(this.querySymbolsImpl)),this.apiURL=e,this.copilotAuthTokenProvider=new i.JR(t.map(e=>e.id)),this.realIp=a||””,this.apiVersion=o}};let y=e=>{let t=e.tagName.toLowerCase(),a=e.textContent;if(!a||!a.trim())return null;let s=a.trim();switch(t){case”h1″:return`# ${s}`;case”h2″:return`## ${s}`;case”h3″:return`### ${s}`;case”h4″:return`#### ${s}`;case”p”:default:return s;case”li”:return`\u{2022} ${s}`;case”code”:return`\`${s}\“;case”pre”:return`\`\`\` ${s} \`\`\“;case”blockquote”:return`> ${s}`}}},37294:(e,t,a)=>{a.d(t,{hh:()=>f,jR:()=>k,Kf:()=>y});var s=a(74848),r=a(16522),i=a(33535),o=a(88431),n=a(96540),l=a(60803),c=a(60460);let u=new Map,h=new Set;function d(e,t){switch(t.type){case”SET_TRACE_INFO”:{let{visible:a,spanNode:s,messageId:r,threadId:i,actualTraceId:o,traces:n}=t.traceInfo,l=e.traceInfo?.traces||u,c=e.traceInfo?.loadedThreadIds||h;if(n&&n.size>0){let e=new Map(l);for(let[t,a]of n)e.set(t,a);l=e}else if(s&&r&&i){let e=new Map(l),t=new Date(s.startTime).toISOString();e.set(r,{spanNode:s,threadId:i,actualTraceId:o||””,timestamp:t}),l=e}if(i&&!c.has(i)){let e=new Set(c);e.add(i),c=e}let d=void 0!==a?a:e.traceInfo?.visible||!1;return{…e,traceInfo:{visible:d,traces:l,loadedThreadIds:c}}}case”REMOVE_TRACE”:{let a=new Map(e.traceInfo?.traces||[]);for(let[e,s]of a)if(s.actualTraceId===t.traceID){a.delete(e);break}return{…e,traceInfo:{visible:e.traceInfo?.visible||!1,traces:a,loadedThreadIds:e.traceInfo?.loadedThreadIds||new Set}}}case”REMOVE_TRACES_FOR_THREAD”:{let a=new Map(e.traceInfo?.traces||[]);for(let[e,s]of a)s.threadId===t.threadID&&a.delete(e);return{…e,traceInfo:{visible:e.traceInfo?.visible||!1,traces:a,loadedThreadIds:e.traceInfo?.loadedThreadIds||new Set}}}}}let m=(0,n.createContext)(null),p=(0,n.createContext)(null);function f(e){let t,a,u,h,f,y,k=(0,r.c)(20),{apiURL:g,children:w,ssoOrgs:T,testReducerState:C}=e;k[0]!==C?(t=C||{},k[0]=C,k[1]=t):t=k[1];let P=t,[v,I]=(0,n.useReducer)(d,P),[_,R]=(0,i.XG)(v);return k[2]!==R||k[3]!==v||k[4]!==_.current.value?(a=()=>{v!==_.current.value&&R(v)},k[2]=R,k[3]=v,k[4]=_.current.value,k[5]=a):a=k[5],k[6]!==R||k[7]!==v||k[8]!==_?(u=[v,_,R],k[6]=R,k[7]=v,k[8]=_,k[9]=u):u=k[9],(0,o.N)(a,u),k[10]!==g||k[11]!==w||k[12]!==T?(h=(0,s.jsx)(c.Q,{apiURL:g,dispatch:I,ssoOrgs:T,children:w}),k[10]=g,k[11]=w,k[12]=T,k[13]=h):h=k[13],k[14]!==_||k[15]!==h?(f=(0,s.jsx)(p.Provider,{value:I,children:(0,s.jsx)(l.n,{value:_,children:h})}),k[14]=_,k[15]=h,k[16]=f):f=k[16],k[17]!==v||k[18]!==f?(y=(0,s.jsx)(m.Provider,{value:v,children:f}),k[17]=v,k[18]=f,k[19]=y):y=k[19],y}function y(){let e=(0,n.useContext)(m);if(!e)throw Error(“useTraceState must be used within a TraceContext”);return e}function k(){return(0,n.useContext)(p)}try{m.displayName||(m.displayName=”TraceStateContext”)}catch{}try{p.displayName||(p.displayName=”TraceDispatchContext”)}catch{}try{f.displayName||(f.displayName=”TraceProvider”)}catch{}},46062:(e,t,a)=>{a.d(t,{GF:()=>u,QA:()=>l,ZL:()=>p,eW:()=>d,fZ:()=>h,wv:()=>c});var s=a(79184),r=a(51213),i=a(35247);let o=”/images/modules/marketplace/models/families/openai.svg”,n=new Map([[“Azure OpenAI”,o],[“OpenAI”,o],[“Anthropic”,”/images/modules/marketplace/models/families/anthropic.svg”],[“Google”,”/images/modules/marketplace/models/families/gemini.svg”],[“xAI”,”/images/modules/marketplace/models/families/xai.svg”]]),l=”copilot-base”;function c(){return{capabilities:{family:”gpt-4.1″,limits:{max_prompt_tokens:128e3,vision:{supported_media_types:[“image/jpeg”,”image/png”,”image/webp”,”image/gif”]}},supports:{parallel_tool_calls:!0,tool_calls:!0},tokenizer:”o200k_base”,type:”chat”},id:”gpt-4.1″,name:”GPT-4.1″,displayName:”GPT-4.1″,model_picker_enabled:!0,preview:!1,vendor:”OpenAI”,logoURL:o,isThirdParty:!1,hasLimitedCapabilities:!1,version:”gpt-4.1-2025-04-14″}}function u(e){let{plan:t,premiumInteractionsQuotaExceeded:a,overagesEnabled:r}=(0,s.xR)();return h(e,t,a,r)}function h(e,t,a,s){var n,l;let u;return i.W.forceLegacyChatDefaultModel?{capabilities:{family:”gpt-4o”,limits:{max_prompt_tokens:2e4,vision:{supported_media_types:[“image/jpeg”,”image/png”,”image/webp”,”image/gif”]}},supports:{parallel_tool_calls:!0,tool_calls:!0},tokenizer:”o200k_base”,type:”chat”},id:”gpt-4o”,name:”GPT 4o”,version:”gpt-4o-2024-05-13″,displayName:”GPT 4o”,vendor:”Azure OpenAI”,logoURL:o,hasLimitedCapabilities:!1,preview:!1,isThirdParty:!1,model_picker_enabled:!0}:(n=!!a,l=!!s,(u=i.W.premiumRequestQuotasEnabled&&t!==r.UH.IndividualFree&&n&&!l?e?.find(e=>!0===e.is_chat_fallback):e?.find(e=>!0===e.is_chat_default))||c())}function d(e){return(e??[c()]).map(m).filter(e=>!!e).filter(e=>e.model_picker_enabled)}function m(e){var t,a,s;if(“chat”!==e.capabilities.type||!((t=e).model_picker_enabled&&(!t.policy||”enabled”===t.policy.state||t.policy.terms)))return null;let r=n.get(e.vendor);return”xAI”===e.vendor&&null!==document.querySelector(‘[data-color-mode=”dark”]’)&&(r=”/images/modules/marketplace/models/families/xai-dark.svg”),{…e,displayName:function(e){for(let t of f)if(e.name.endsWith(t))return e.name.replace(t,””).trim();return e.name}(e),hasLimitedCapabilities:(a=e,s=i.W.copilotChatO1Tools,”o1-ga”===a.capabilities.family?!s:”o3″===a.capabilities.family||!a.capabilities.supports.tool_calls),isThirdParty:”Azure OpenAI”!==e.vendor,logoURL:r}}function p(e){return null!=e.custom_model}let f=[“(Beta)”,”(Preview)”]},57872:(e,t,a)=>{a.d(t,{q:()=>s});function s(e){return Array.isArray(e)?e.filter(e=>!(“refOrigin”in e&&”custom_copilot”===e.refOrigin)&&!(“type”in e&&”custom-instructions”===e.type)):e}},60460:(e,t,a)=>{a.d(t,{Q:()=>m,y:()=>p});var s=a(74848),r=a(16522),i=a(96540),o=a(60803),n=a(50467),l=a(82518),c=a(20139),u=a(35247),h=a(63828);let TraceManager=class TraceManager{async fetchAndLoadTraces(e,t){if(!u.W.requestTracing||!(0,l.Xl)())return;let a=this.getTraceState();if(!a.traceInfo?.loadedThreadIds?.has(e))try{let s=await this.service.fetchTracesByThreadID(e,t);s.ok&&s.payload.length>0?this.addTracesToState(a,s,e):this.dispatch({type:”SET_TRACE_INFO”,traceInfo:{threadId:e}})}catch{}}addTracesToState(e,t,a){let s=new Map(e.traceInfo?.traces||[]);for(let e of t.payload)for(let[,t]of(0,h.r)(e.spans).entries()){let r=new Date(t.startTime).toISOString(),i=`${a}:${r}`;s.set(i,{spanNode:t,threadId:a,actualTraceId:e.id,timestamp:r})}this.dispatch({type:”SET_TRACE_INFO”,traceInfo:{traces:s,threadId:a}})}async fetchCoffeTrace(e){if(!u.W.requestTracing||!(0,l.Xl)())return{ok:!1,status:403,error:”Tracing not available”};let t=this.getTraceState(),a=await this.service.fetchCoffeTrace(e);if(a.ok&&a.payload.length>0)return this.addTracesToState(t,a,e),a;throw Error(`Failed to load COFFE trace: ${a.status}`)}async deleteTraceSpansForGivenThread(e){let t=await this.service.deleteTracesForThread(e);return t.ok&&this.dispatch({type:”REMOVE_TRACES_FOR_THREAD”,threadID:e}),t}async deleteTrace(e,t){let a=await this.service.deleteTrace(e,t);return a.ok&&this.dispatch({type:”REMOVE_TRACE”,traceID:t}),a}constructor(e,t,a,s){(0,n._)(this,”dispatch”,void 0),(0,n._)(this,”service”,void 0),(0,n._)(this,”getTraceState”,void 0),(0,n._)(this,”showTraceDisplay”,async(e,t)=>{e&&t&&await this.fetchAndLoadTraces(t),this.dispatch({type:”SET_TRACE_INFO”,traceInfo:{visible:e,threadId:t??void 0}})}),this.dispatch=e,this.service=new c.k(a,s),this.getTraceState=t}};let d=(0,i.createContext)(null);function m(e){let t,a,i=(0,r.c)(8),{apiURL:n,children:l,dispatch:c,ssoOrgs:u}=e,h=(0,o.c)();i[0]!==n||i[1]!==c||i[2]!==h||i[3]!==u?(t=new TraceManager(c,h,n,u),i[0]=n,i[1]=c,i[2]=h,i[3]=u,i[4]=t):t=i[4];let m=t;return i[5]!==l||i[6]!==m?(a=(0,s.jsx)(d.Provider,{value:m,children:l}),i[5]=l,i[6]=m,i[7]=a):a=i[7],a}function p(){let e=(0,i.useContext)(d);if(null===e)throw Error(“useTraceManager must be used within a TraceManagerProvider”);return e}try{d.displayName||(d.displayName=”TraceManagerContext”)}catch{}try{m.displayName||(m.displayName=”TraceManagerProvider”)}catch{}},60803:(e,t,a)=>{a.d(t,{c:()=>o,n:()=>i});var s=a(96540);let r=(0,s.createContext)(null),i=r.Provider;function o(){let e=(0,s.useContext)(r);if(!e||!e.current)throw Error(“useGetTraceState can only be used inside a TraceProvider”);return(0,s.useCallback)(()=>e.current.value,[e])}try{r.displayName||(r.displayName=”ObservableTraceStateContext”)}catch{}},63828:(e,t,a)=>{a.d(t,{r:()=>s});function s(e){let t=new Map,a=[];return e.map(e=>{let s={name:e.name,spanId:e.spanId,attributes:e.attributes,startTime:e.startTime,endTime:e.endTime,children:[],sessionId:e.sessionId,userId:e.userId,input:e.input,output:e.output,metadata:e.metadata};t.set(s.spanId,s);let r=e.parentId&&t.get(e.parentId);return r?r.children.push(s):a.push(s),s}),a}},79184:(e,t,a)=>{a.d(t,{$d:()=>h,xR:()=>d});var s=a(74848),r=a(16522),i=a(69599),o=a(96540),n=a(14095),l=a(51213),c=a(35247);let u=(0,o.createContext)(void 0);function h(e){let t,a,o,h,d,m,p,f,y,k=(0,r.c)(30),{children:g,initialLicenseType:w,initialPlan:T,initialQuotas:C}=e,[P,v]=(0,n.Z2)(w,T,C),I=P.licenseType,_=P.plan??null;k[0]!==P?(t=P.chatQuotaRemaining()??1/0,k[0]=P,k[1]=t):t=k[1];let R=t;k[2]!==P?(a=P.premiumInteractionsQuotaRemaining()??1/0,k[2]=P,k[3]=a):a=k[3];let b=a;k[4]!==P.quotas?(o=P.quotas?.resetDate?new Date(P.quotas.resetDate).toLocaleDateString(“en-US”,{year:”numeric”,month:”long”,day:”numeric”}):””,k[4]=P.quotas,k[5]=o):o=k[5];let q=o;k[6]===Symbol.for(“react.memo_cache_sentinel”)?(h=(0,i.G7)(“copilot_simulate_quota_exceeded”),k[6]=h):h=k[6];let A=h,E=A||I===l.mF.LicensedLimited;k[7]!==P?(d=P.canPurchaseAdditionalQuota(),k[7]=P,k[8]=d):d=k[8];let S=d;k[9]!==P?(m=P.canUpgradePlan(),k[9]=P,k[10]=m):m=k[10];let $=m,L=A||E&&R<=0,D=c.W.premiumRequestQuotasEnabled&&b<=0,x=P.quotas?.overagesEnabled??!1;k[11]!==P?(p=P.eligibleForTrial(),k[11]=P,k[12]=p):p=k[12];let j=p;k[13]!==S||k[14]!==$||k[15]!==L||k[16]!==R||k[17]!==j||k[18]!==E||k[19]!==I||k[20]!==x||k[21]!==_||k[22]!==b||k[23]!==D||k[24]!==v||k[25]!==q?(f={licenseType:I,chatQuotaRemaining:R,premiumChatQuotaRemaining:b,resetDate:q,isLicensedLimited:E,chatQuotaExceeded:L,premiumInteractionsQuotaExceeded:D,reloadQuota:v,plan:_,canPurchaseAdditionalQuota:S,canUpgradePlan:$,overagesEnabled:x,eligibleForTrial:j},k[13]=S,k[14]=$,k[15]=L,k[16]=R,k[17]=j,k[18]=E,k[19]=I,k[20]=x,k[21]=_,k[22]=b,k[23]=D,k[24]=v,k[25]=q,k[26]=f):f=k[26];let F=f;return k[27]!==g||k[28]!==F?(y=(0,s.jsx)(u.Provider,{value:F,children:g}),k[27]=g,k[28]=F,k[29]=y):y=k[29],y}let d=()=>{let e=(0,o.useContext)(u);if(!e)throw Error(“useEntitlement must be used within EntitlementProvider”);return e};try{u.displayName||(u.displayName=”EntitlementContext”)}catch{}try{h.displayName||(h.displayName=”EntitlementProvider”)}catch{}}}]); //# sourceMappingURL=37294-88b2f3e69eb3.js.map