index-e83ba030.js 1.8 KB

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