Files
zyplayer-doc/zyplayer-doc-api/src/main/resources/dist/assets/unitConvert.36114cbf.js

11 lines
14 KiB
JavaScript
Raw Normal View History

2022-01-16 23:28:17 +08:00
import"./index.e0fd63e3.js";import{_ as K}from"./main.48cb78d7.js";import{aa as J,ae as X,y as I,N as z,O as Q,r as T,o as y,b as D,e as $,a as A,w,c as L,k as N,F as B,m as P,t as V,d as H}from"./vendor.59e47867.js";import{a as ee}from"./index.11b9cb38.js";function te(e,t={}){t.filter=t.filter||(()=>!0);function f(){return s()||E()||o()||p()}function l(){return m(/\s*/),s(!0)||o()||F()||d(!1)}function x(){const i=v(),n=[];let a,g=l();for(;g;){if(g.node.type==="Element"){if(a)throw new Error("Found multiple root nodes");a=g.node}g.excluded||n.push(g.node),g=l()}if(!a)throw new Error("Failed to parse XML");return{declaration:i?i.node:null,root:a,children:n}}function v(){return d(!0)}function d(i){const n=m(i?/^<\?(xml)\s*/:/^<\?([\w-:.]+)\s*/);if(!n)return;const a={name:n[1],type:"ProcessingInstruction",attributes:{}};for(;!(_()||h("?>"));){const g=c();if(!g)return a;a.attributes[g.name]=g.value}return m(/\?>/),{excluded:i?!1:t.filter(a)===!1,node:a}}function s(i){const n=m(/^<([\w-:.]+)\s*/);if(!n)return;const a={type:"Element",name:n[1],attributes:{},children:[]};for(;!(_()||h(">")||h("?>")||h("/>"));){const b=c();if(!b)return a;a.attributes[b.name]=b.value}const g=i?!1:t.filter(a)===!1;if(m(/^\s*\/>/))return a.children=null,{excluded:g,node:a};if(m(/\??>/),!g){let b=f();for(;b;)b.excluded||a.children.push(b.node),b=f()}return m(/^<\/[\w-:.]+>/),{excluded:g,node:a}}function F(){const i=m(/^<!DOCTYPE\s+[^>]*>/);if(i){const n={type:"DocumentType",content:i[0]};return{excluded:t.filter(n)===!1,node:n}}}function p(){if(e.startsWith("<![CDATA[")){const i=e.indexOf("]]>");if(i>-1){const n=i+3,a={type:"CDATA",content:e.substring(0,n)};return e=e.slice(n),{excluded:t.filter(a)===!1,node:a}}}}function o(){const i=m(/^<!--[\s\S]*?-->/);if(i){const n={type:"Comment",content:i[0]};return{excluded:t.filter(n)===!1,node:n}}}function E(){const i=m(/^([^<]+)/);if(i){const n={type:"Text",content:i[1]};return{excluded:t.filter(n)===!1,node:n}}}function c(){const i=m(/([\w-:.]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!!i)return{name:i[1],value:r(i[2])}}function r(i){return i.replace(/^['"]|['"]$/g,"")}function m(i){const n=e.match(i);if(!!n)return e=e.slice(n[0].length),n}function _(){return e.length===0}function h(i){return e.indexOf(i)===0}return e=e.trim(),x()}var ne=te;function O(e){if(!e.options.indentation&&!e.options.lineSeparator)return;e.content+=e.options.lineSeparator;let t;for(t=0;t<e.level;t++)e.content+=e.options.indentation}function S(e,t){e.content+=t}function W(e,t,f){if(typeof e.content=="string")ae(e,t,f);else if(e.type==="Element")le(e,t,f);else if(e.type==="ProcessingInstruction")G(e,t);else throw new Error("Unknown node type: "+e.type)}function ae(e,t,f){f||(e.content=e.content.trim()),e.content.length>0&&(!f&&t.content.length>0&&O(t),S(t,e.content))}function le(e,t,f){if(!f&&t.content.length>0&&O(t),S(t,"<"+e.name),Y(t,e.attributes),e.children===null){const l=t.options.whiteSpaceAtEndOfSelfclosingTag?" />":"/>";S(t,l)}else if(e.children.length===0)S(t,"></"+e.name+">");else{S(t,">"),t.level++;let l=e.attributes["xml:space"]==="preserve";if(!l&&t.options.collapseContent){let x=!1,v=!1,d=!1;e.children.forEach(function(s,F){s.type==="Text"?(s.content.includes(`
`)?(v=!0,s.content=s.content.trim()):(F===0||F===e.children.length-1)&&s.content.trim().length===0&&(s.content=""),s.content.length>0&&(x=!0)):d=!0}),x&&(!d||!v)&&(l=!0)}e.children.forEach(function(x){W(x,t,f||l,t.options)}),t.level--,!f&&!l&&O(t),S(t,"</"+e.name+">")}}function Y(e,t){Object.keys(t).forEach(function(f){const l=t[f].replace(/"/g,"&quot;");S(e," "+f+'="'+l+'"')})}function G(e,t){t.content.length>0&&O(t),S(t,"<?"+e.name),Y(t,e.attributes),S(t,"?>")}function re(e,t={}){t.indentation="indentation"in t?t.indentation:" ",t.collapseContent=t.collapseContent===!0,t.lineSeparator="lineSeparator"in t?t.lineSeparator:`\r
`,t.whiteSpaceAtEndOfSelfclosingTag=!!t.whiteSpaceAtEndOfSelfclosingTag;const l=ne(e,{filter:t.filter}),x={content:"",level:0,options:t};return l.declaration&&G(l.declaration,x),l.children.forEach(function(v){W(v,x,!1)}),x.content.replace(/\r\n/g,`
`).replace(/\n/g,t.lineSeparator)}var be=re;const ue={props:{paramList:{type:Array,required:!0},showType:{type:Boolean}},components:{CloseOutlined:J,UploadOutlined:X},emits:["update:selected"],setup(e,{attrs:t,slots:f,emit:l,expose:x}){let v=I([]),d=1e4,s=I([]);z(()=>e.paramList,()=>{F()}),Q(()=>{F()});const F=()=>{s.value=e.paramList,console.log("paramListRef.value",s.value),(s.value.length<=0||!s.value[s.value.length-1].isLastRow)&&e.paramList.push({name:"",value:void 0,type:"integer",key:++d,isLastRow:!0}),s.value.forEach(u=>{u.value=u.value||u.example||void 0,(u.enum&&u.type==="array"||u.type==="file"||u.subType==="MultipartFile")&&(u.value=[]),v.value.push(u.key)})},p=(u,C)=>{v.value=u},o=u=>{u.isLastRow&&(u.isLastRow=!1,e.paramList.push({name:"",value:void 0,type:"integer",key:++d,isLastRow:!0}),v.value.push(d))},E=u=>{if(!u.isLastRow){let C=e.paramList.findIndex(R=>R===u);e.paramList.splice(C,1)}};let c=I([]);c.value.push({title:"\u53C2\u6570\u540D",dataIndex:"name",width:250}),e.showType,c.value.push({title:"\u53C2\u6570\u503C",dataIndex:"value"}),c.value.push({title:"",dataIndex:"action",width:40});const r=(u,C)=>(C.type!=="array"||!(C.value instanceof Array)||C.value.length<=0?C.value=[u]:C.value=[...C.value,u],!1),m=(u,C)=>{C.value=C.value.filter(R=>R!==u)},_=u=>u.type==="file"||u.subType==="file"||u.subType==="MultipartFile";let h=I(!1),i=I("");const n=()=>{h.value=!0,i.value=s.value.filter(u=>u.name||u.value).map(u=>_(u)?(u.name||"")+":":(u.name||"")+":"+(u.value||"")).join(`
`)},a=()=>{g(),h.value=!1},g=()=>{if(!h.value)return;let u={};e.paramList.forEach(k=>u[k.name]=k);let C=i.value.split(`
`),R=[];C.forEach(k=>{if(!k)return;let j=k.indexOf(":");if(j>=0){let U=k.substring(0,j),q=k.substring(j+1);if(U||q){let M=u[U]||{name:U,value:q,type:"integer",key:++d};M.value=q,R.push(M)}}else{let U=u[k]||{name:k,value:void 0,type:"integer",key:++d};R.push(U)}}),R.push({name:"",value:void 0,type:"integer",key:++d,isLastRow:!0}),v.value=[],e.paramList.splice(0,e.paramList.length),R.forEach(k=>{e.paramList.push(k),v.value.push(k.key)})};return{paramListRef:s,queryParamSelectedRowKeys:v,queryParamRowSelectionChange:p,queryParamChange:o,queryParamRemove:E,beforeUpload:r,handleRemove:m,paramListColumns:c,isFileType:_,getSelectedRowKeys:()=>(g(),v.value),multilineEdit:h,multilineEditValue:i,toMultilineEdit:n,toKeyValueEdit:a,convertKeyValueEdit:g}}},ie={key:0},oe={style:{"text-align":"right"}},se=P("\u8868\u5355\u7F16\u8F91"),ce={key:1},fe=P("\u591A\u884C\u7F16\u8F91"),pe=P("Integer"),de=P("String"),me=P("File"),he=P("Integer"),ve=P("String"),ye=P("TRUE"),ge=P("FALSE"),xe=P("\u9009\u62E9\u6587\u4EF6");function _e(e,t,f,l,x,v){const d=T("a-button"),s=T("a-textarea"),F=T("a-input"),p=T("a-select-option"),o=T("a-select"),E=T("a-tag"),c=T("upload-outlined"),r=T("a-upload"),m=T("CloseOutlined"),_=T("a-table");return l.multilineEdit?(y(),D("div",ie,[$("div",oe,[A(d,{onClick:l.toKeyValueEdit,type:"link"},{default:w(()=>[se]),_:1},8,["onClick"])]),A(s,{value:l.multilineEditValue,"onUpdate:value":t[0]||(t[0]=h=>l.multilineEditValue=h),"auto-size":{minRows:14,maxRows:14}},null,8,["value"])])):(y(),D("div",ce,[A(_,{"row-selection":{selectedRowKeys:l.queryParamSelectedRowKeys,onChange:l.queryParamRowSelectionChange},dataSource:l.paramListRef,columns:l.paramListColumns,size:"small",pagination:!1,scroll:{y:"300px"}},{headerCell:w(({column:h})=>[h.dataIndex==="action"?(y(),L(d,{key:0,onClick:l.toMultilineEdit,type:"link",style:{"margin-left":"-50px"}},{default:w(()=>[fe]),_:1},8,["onClick"])):N("",!0)]),bodyCell:w(({column:h,text:i,record:n})=>[h.dataIndex==="name"?(y(),L(F,{key:0,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u540D",value:n.name,"onUpdate:value":a=>n.name=a,onChange:a=>l.queryParamChange(n)},null,8,["value","onUpdate:value","onChange"])):N("",!0),h.dataIndex==="type"?(y(),D(B,{key:1},[n.key>=1e4?(y(),L(o,{key:0,value:n.type,"onUpdate:value":a=>n.type=a},{default:w(()=>[A(p,{value:"integer"},{default:w(()=>[pe]),_:1}),A(p,{value:"string"},{default:w(()=>[de]),_:1}),A(p,{value:"file"},{default:w(()=>[me]),_:1})]),_:2},1032,["value","onUpdate:value"])):i==="integer"?(y(),L(E,{key:1,color:"pink"},{default:w(()=>[he]),_:1})):i==="string"?(y(),L(E,{key:2,color:"red"},{default:w(()=>[ve]),_:1})):(y(),L(E,{key:3,color:"green"},{default:w(()=>[P(V(i||"-"),1)]),_:2},1024))],64)):N("",!0),h.dataIndex==="value"?(y(),D(B,{key:2},[n.enum&&n.type==="array"?(y(),L(o,{key:0,value:n.value,"onUpdate:value":a=>n.value=a,mode:"multiple",placeholder:n.description||"\u8BF7\u9009\u62E9\u679A\u4E3E\u503C",style:{width:"100%"}},{default:w(()=>[(y(!0),D(B,null,H(n.enum,a=>(y(),L(p,{value:a},{default:w(()=>[P(V(a),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["value","onUpdate:value","placeholder"])):n.enum?(y(),L(o,{key:1,value:n.value,"onUpdate:value":a=>n.value=a,placeholder:n.description||"\u8BF7\u9009\u62E9\u679A\u4E3E\u503C",style:{width:"100%"}},{default:w(()=>[(y(!0),D(B,null,H(n.enum,a=>(y(),L(p,{value:a},{default:w(()=>[P(V(a),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["value","onUpdate:value","placeholder"])):n.type==="boolean"?(y(),L(o,{key:2,value:n.value,"onUpdate:value":a=>n.value=a,placeholder:n.description||"\u8BF7\u9009\u62E9\u53C2\u6570\u503C",style:{width:"100%"}},{default:w(()=>[A(p,{value:"true"},{default:w(()=>[ye]),_:1}),A(p,{value:"false"},{default:w(()=>[ge]),_:1})]),_:2},1032,["value","onUpdate:value","placeholder"])):l.isFileType(n)?(y(),L(r,{key:3,"file-list":n.value,name:"file",multiple:n.type==="array","before-upload":a=>l.beforeUpload(a,n),remove:a=>l.handleRemove(a,n)},{default:w(()=>[A(d,null,{default:w(()=>[A(c),xe]),_:1})]),_:2},1032,["file-list","multiple","before-upload","remove"])):(y(),L(F,{key:4,placeholder
`+new Array(_).join(i):"";o.removeIllegalNameCharacters&&(c=c.replace(l,"_"));var a=[n,"<",c,m||""];return r&&r.length>0||o.html?(a.push(">"),a.push(r),h&&a.push(n),a.push("</"),a.push(c),a.push(">")):a.push("/>"),a.join("")};return function c(r,m,_){var h=typeof r;switch((Array.isArray?Array.isArray(r):r instanceof Array)?h="array":r instanceof Date&&(h="date"),h){case"array":var i=[];return r.map(function(k){i.push(c(k,1,_+1))}),o.prettyPrint&&i.push(`
`),i.join("");case"date":return r.toJSON?r.toJSON():r+"";case"object":if(m==1&&r.name){var n=[],a=[];if(r.attrs)if(typeof r.attrs!="object")a.push(" "),a.push(r.attrs);else for(var g in r.attrs){var b=r.attrs[g];a.push(" "),a.push(g),a.push('="'),a.push(o.escape?s(b):b),a.push('"')}if(typeof r.value!="undefined"){var u=""+r.value;n.push(o.escape&&!r.noescape?s(u):u)}else if(typeof r.text!="undefined"){var u=""+r.text;n.push(o.escape&&!r.noescape?s(u):u)}return r.children&&n.push(c(r.children,0,_+1)),E(r.name,n.join(""),a.join(""),_,!!r.children)}else{var C=[];for(var R in r)C.push(E(R,c(r[R],0,_+1),null,_+1));return o.prettyPrint&&C.length>0&&C.push(`
`),C.join("")}case"function":return r();default:return o.escape?s(r):""+r}}(p,0,0)},d=function(p){var o=['<?xml version="1.0" encoding="utf-8"'];return p&&o.push(' standalone="yes"'),o.push("?>"),o.join("")};e.exports=function(p,o){var E=typeof Buffer!="undefined"?Buffer:function(){};if(typeof p=="string"||p instanceof E)try{p=JSON.parse(p.toString())}catch{return!1}var c="",r="";o&&(typeof o=="object"?(o.xmlHeader&&(c=d(!!o.xmlHeader.standalone)),typeof o.docType!="undefined"&&(r="<!DOCTYPE "+o.docType+">")):c=d()),o=o||{};var m=[c,o.prettyPrint&&r?`
`:"",r,v(p,o)];return m.join("")},e.exports.json_to_xml=e.exports.obj_to_xml=e.exports,e.exports.escape=s;function s(p){return(""+p).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;").replace(x,"")}e.exports.cdata=F;function F(p){return p?"<![CDATA["+p.replace(/]]>/g,"")+"]]>":"<![CDATA[]]>"}})(Z);var we=Z.exports;const Ce={props:{paramList:{type:Array,required:!0},rowLang:{type:String,required:!0}},components:{CloseOutlined:J,UploadOutlined:X,aceEditor:ee},emits:[],setup(e,{attrs:t,slots:f,emit:l,expose:x}){let v=e.paramList,d="",s=c=>{if(c.children){let m={};return c.children.forEach(_=>m[_.name]=s(_)),c.type==="array"?[m]:m}let r=c.example||"";return c.type==="array"?r?[r]:[]:r};v.length===1?d=s(v[0]):v.length>1&&v.forEach(c=>{d[c.name]=s(c)});let F=I("");d&&(e.rowLang==="json"?F.value=JSON.stringify(d,null,4):e.rowLang==="xml"&&(F.value=we(d,{html:!0,prettyPrint:!0,xmlHeader:!0})));const p=()=>F.value;let o=I();return{getParam:p,rowParamInit:c=>{o.value=c,o.value.setFontSize(16)},bodyRowParam:F,rowParamConfig:{wrap:!0,autoScrollEditorIntoView:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,minLines:18,maxLines:18}}}};function Fe(e,t,f,l,x,v){const d=T("ace-editor");return y(),L(d,{value:l.bodyRowParam,"onUpdate:value":t[0]||(t[0]=s=>l.bodyRowParam=s),onInit:l.rowParamInit,lang:f.rowLang,theme:"monokai",width:"100%",height:"100",options:l.rowParamConfig},null,8,["value","onInit","lang","options"])}var Te=K(Ce,[["render",Fe]]),Ae={formatSeconds(e){let t=parseInt(e),f=t/1e3,l=Math.floor(f%60),x=t%1e3;return l>0?`${l}.${x} s`:`${x} ms`},formatFileSize(e){if(!e)return"0 B";let t="";e<.1*1024?t=e.toFixed(2)+" B":e<.1*1024*1024?t=(e/1024).toFixed(2)+" KB":e<.1*1024*1024*1024?t=(e/(1024*1024)).toFixed(2)+" MB":t=(e/(1024*1024*1024)).toFixed(2)+" GB";let f=t+"",l=f.indexOf(".");return f.substr(l+1,2)=="00"?f.substring(0,l)+f.substr(l+3,2):t}};export{Re as P,Te as a,Ae as u,be as x};