music-sheet.bb8efd17.js 3.1 KB

1
  1. import{u as b,r as i,d as C,ai as N,a as P,M as O,a3 as _,H as w,_ as y,aj as k,s as I,f as Y,D as j,c as F}from"./App.3b52122c.js";/* empty css */function A(){import("data:text/javascript,")}(function(l,t){var o=t.documentElement,p=l.devicePixelRatio||1;function s(){t.body?t.body.style.fontSize=12+"px":t.addEventListener("DOMContentLoaded",s)}s();function r(){var d=o.clientWidth/10;o.style.fontSize=d+"px"}if(r(),l.addEventListener("resize",r),l.addEventListener("pageshow",function(d){d.persisted&&r()}),p>=2){var n=t.createElement("body"),e=t.createElement("div");e.style.border=".5px solid transparent",n.appendChild(e),o.appendChild(n),e.offsetHeight===1&&o.classList.add("hairlines"),o.removeChild(n)}})(window,document);const f=b(),K=i();var X=C({name:"Colexiu",setup(){let u=0;const l=i(!0),t=i(!1),o=i(""),p=new _(650,884),s=i({}),r=i(!1),n=i("staff"),e=i({staff:null,first:null,fixed:null});f.pageType==="more"&&(s.value={PageFormat:p,DYMusicScoreType:"staff",RenderKeySignatures:!0}),async function(){try{console.log("\u9700\u8981\u6E32\u67D3\u7684xml search.xml:",f.xml);const c=await N(f.xml,{musicSheetName:f.title||""});if(!c.value){l.value=!1,t.value=!0,console.log("\u6CA1\u6709xml\u9519\u8BEF\u4E86"),window.parent.postMessage({api:"osdmRenderedError"},"*");return}o.value=c.value}catch(c){console.log("\u83B7\u53D6xml\u9519\u8BEF\u4E86",c),window.parent.postMessage({api:"osdmRenderedError"},"*")}}();const d=async c=>{w({api:"cloudLoading",content:{show:!1,type:"fullscreen"}});const S=async a=>{if(a){const v=[];if(a.Drawer.Backends.length>0){for(let g=0,R=a.Drawer.Backends.length;g<R;g++){const m=a.Drawer.Backends[g],{state:M,width:E,height:L}=m.ctx,{x:T,y:z}=M.scale,D=new XMLSerializer().serializeToString(m.ctx.svg);v.push(await k(D,E/T,L/z))}return v}}};if(window.parent)try{const a=await S(c);n.value==="staff"?(u=1,n.value="first",e.value.staff=a,s.value.DYMusicScoreType="jianpu",s.value.RenderKeySignatures=!0,await y(),r.value=!0,setTimeout(()=>{r.value=!1},100)):n.value==="first"?(u=2,n.value="fixed",e.value.first=a,s.value.DYMusicScoreType="jianpu",s.value.RenderKeySignatures=!1,await y(),r.value=!0,setTimeout(()=>{r.value=!1},100)):n.value==="fixed"&&(u=3,e.value.fixed=a,console.log(e.value,"staffImgs fixed = last")),u===3&&(console.log(e.value,"staffImgs ------------- postMessage"),window.parent.postMessage({api:"osdmRendered",content:{img:JSON.parse(JSON.stringify(e.value))}},"*"))}catch(a){console.log("\u6E32\u67D3\u9519\u8BEF\u4E86"),console.log(a,"error"),window.parent.postMessage({api:"osdmRenderedError"},"*")}},x=async()=>{},h=()=>{console.log("onRenderError\u9519\u8BEF\u4E86"),w({api:"cloudLoading",content:{show:!1,type:"fullscreen"}}),t.value=!0,l.value=!1,window.parent&&window.parent.postMessage({api:"osdmRenderedError"},"*")};return()=>!r.value&&P(O,{ref:K,score:o.value,isSoundEffect:!0,opotions:{drawTitle:!1,drawComposer:!0,drawLyricist:!1,drawMetronomeMarks:!0,drawMeasureNumbers:!0,autoResize:!1},EngravingRules:s,onStartRender:x,onRenderError:h,onRerender:d},null)}});I.clintNmae="colexiu";window.DYEnvironment="COLEXIU";document.body.style.setProperty("--osdm-zoom",""+Y());j();F(X).mount("#app");export{A as __vite_legacy_guard};