import{l as s,D as v,_ as b,a0 as r,V as A,d as j,a as D,b as C,c as I,f as R,u as x,m as u,o as U,j as E,w as i,k as c,q as M,r as l,t as m,v as P,N as S}from"./doc-19de6184.js";import{C as V}from"./clipboard-51434f9e.js";import{m as L,a as k,t as B,e as N}from"./ext-language_tools-c709ecd7.js";import{C as T}from"./CopyOutlined-21db004f.js";var $={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"};const q=$;function g(n){for(var e=1;eD(()=>import("./EditorShow-84687409.js"),["./EditorShow-84687409.js","./doc-19de6184.js","..\\css\\doc-5be93158.css","./ext-language_tools-c709ecd7.js"],import.meta.url))},props:{api:{type:Object,required:!0},swaggerInstance:{type:Object,required:!0}},setup(){const n=C(),e=I(()=>n.language),{messages:t}=R();return{language:e,messages:t}},data(){return{openApiRaw:"",name:"OpenAPI.json"}},created(){this.openApiRaw=x.json5stringify(this.api.openApiRaw),this.name=this.api.summary+"_OpenAPI.json",setTimeout(()=>{this.copyOpenApi()},500)},methods:{getCurrentI18nInstance(){return this.messages[this.language]},triggerDownloadOpen(){var n=this.openApiRaw,e=document.createElement("a"),t={},o=this.name,a=window.URL.createObjectURL(new Blob([n],{type:(t.type||"text/plain")+";charset="+(t.encoding||"utf-8")}));e.href=a,e.download=o||"file",e.click(),window.URL.revokeObjectURL(a)},copyOpenApi(){const n="btnCopyOpenApi"+this.api.id,e=new V("#"+n,{text:()=>this.openApiRaw});e.on("success",()=>{const o=this.getCurrentI18nInstance().message.copy.open.success;u.info(o)}),e.on("error",t=>{console.log(t);const o=this.getCurrentI18nInstance();console.log(o);const a=o.message.copy.open.fail;u.info(a)})}}},X={class:"document"},F={style:{"margin-top":"10px"},id:"knife4jDocumentOpenApiShowEditor"};function Q(n,e,t,o,a,f){const w=l("CopyOutlined"),d=S,_=l("DownloadOutlined"),h=M,O=l("editor-show");return U(),E("div",X,[s(h,{style:{"margin-top":"10px"}},{default:i(()=>[s(d,{type:"primary",id:"btnCopyOpenApi"+t.api.id},{default:i(()=>[s(w),c("span",null,m(n.$t("open.copy")),1)]),_:1},8,["id"]),s(d,{style:{"margin-left":"10px"},onClick:f.triggerDownloadOpen},{default:i(()=>[s(_),P(),c("span",null,m(n.$t("open.download")),1)]),_:1},8,["onClick"])]),_:1}),c("div",F,[s(O,{value:a.openApiRaw,"onUpdate:value":e[0]||(e[0]=y=>a.openApiRaw=y),theme:"eclipse"},null,8,["value"])])])}const ee=b(G,[["render",Q]]);export{ee as default};