|
|
-import{d as g,F as w,V as y,bt as i,M as h,U as r,ao as v,j as c,aJ as b,aq as _}from"./index-2ae071fb.js";import{s as T}from"./instrument-722ec6dc.js";import"./vue3-lottie.es-ff8de5cc.js";import"./index-66fcf207.js";import"./index-9bbdfecc.js";import"./index-f6831e69.js";const L="_skeleton_vtlsh_1",x="_detail_vtlsh_12",R="_container_vtlsh_20",l={skeleton:L,detail:x,container:R},k=g({name:"music-list",setup(){const u=w(),t=y({isLoading:!0,isProductLoading:!1,product:[{state:!1,name:"五线谱",type:i.staff,base64:""},{state:!1,name:"首调",type:i.firstTone,base64:""},{state:!1,name:"固定调",type:i.fixedTone,base64:""}]});h(()=>{window.appName="colexiu",r.xmlUrl=u.xmlUrl,r.musicRenderType=i.staff,t.isLoading=!1,v({message:"生成中",duration:0})});const m=async()=>{var o;const s=t.product.find(n=>n.type===r.musicRenderType);s&&(s.state=!0,s.base64=await p());const e=t.product.find(n=>!n.state);if(!s&&e&&(e.state=!0),e){r.musicRenderType=e.type,t.isLoading=!0,setTimeout(()=>t.isLoading=!1,500);return}_(),console.log(t.product),(o=window.parent)==null||o.postMessage({api:"webApi_renderSvg",product:JSON.stringify(t.product)},"*")},p=()=>new Promise(s=>{setTimeout(async()=>{var d;const e=(d=document.getElementById("osmdSvgPage1"))==null?void 0:d.cloneNode(!0);if(!e){s("");return}const o=e.width.animVal.value,n=e.height.animVal.value,a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("width",`${o*2}`),a.setAttribute("height",`${n*2}`),a.setAttribute("fill","#fff"),e.prepend(a);const f=T(e.outerHTML).toDataURL("image/png",1);s(f)},500)});return()=>c("div",{class:l.detail},[c("div",{id:"scrollContainer",class:[l.container,"hideCursor"]},[!t.isLoading&&c(b,{showSelection:!1,onRendered:m},null)])])}});export{k as default};
|