Files
numerical-notation-editor/docs/editor/static/js/main.e0740145.chunk.js
T
2021-10-07 00:15:25 +08:00

2 lines
50 KiB
JavaScript

(this["webpackJsonpnumerical-notation-editor"]=this["webpackJsonpnumerical-notation-editor"]||[]).push([[0],{114:function(e,t,n){e.exports={headerWrapper:"Editor_headerWrapper__2rEBR",header:"Editor_header__2Qcr4",container:"Editor_container__3rhfS"}},143:function(e,t,n){e.exports={svg:"Canvas_svg__2w1z4"}},146:function(e,t,n){e.exports={selectedNotation:"Notation_selectedNotation__3wsjJ"}},228:function(e,t,n){},229:function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(21),a=n.n(i),c=(n(157),n(235)),s=n(44),l=n(247),u=n(248),d=n(249),f=n(250),h=n(251),p=n(32),b=n(13),j=Object(b.f)({selectedNotationKey:null,lastSelectedNotationKey:null,shouldNotationBlurAfterClick:!0,tieSourceKey:null,helpDialogVisible:!1,configDialogVisible:!1,clipboardContent:null}),v=[],g=-1;function x(e,t){var n=new Set;function r(e){return"object"===typeof e&&null!==e&&![Promise,Map,Set,WeakMap,WeakSet].some((function(t){return e instanceof t}))}return function e(t,o){if(!r(t)||!r(o))return t===o;if(t===o)return!0;if(n.has(t)||n.has(o))return!1;n.add(t),n.add(o);var i=Object.keys(t),a=Object.keys(o);return i.length===a.length&&i.every((function(n){return e(t[n],o[n])}))}(e,t)}function m(e){var t=Math.min(Math.max(0,g+e),v.length-1);t!==g&&(g=t,Object.assign(U,v[t]))}function O(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.apply(this,n);var o=Object(b.i)(U);x(v[g],o)||(v[++g]=o,v.length=g+1,v.length>256&&v.splice(0,256-v.length))}function y(){var e,t;"function"===typeof(arguments.length<=0?void 0:arguments[0])?t=arguments.length<=0?void 0:arguments[0]:(e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1]);var n=[e,O.bind(this,t)];return void 0===e&&n.shift(),b.b.apply(this,n)}function k(e){var t=this;Object(b.h)((function(){O.call(t,e)}))}var w=b.b,C=(b.h,"0"),S="\u2500",N="\u2502",P=[C,"1","2","3","4","5","6","7"];function T(e){return P.includes((null===e||void 0===e?void 0:e.note)||e)}function E(e){var t={type:"notation",key:"n_".concat(String(Math.random())),note:"0",octave:0,dotted:!1,underline:0,breakUnderline:!1,prefixSups:[],topDecorators:[],tieTo:null};return e&&Object.assign(t,e),t}function I(e){var t=JSON.parse(JSON.stringify(Object(b.i)(e)));return delete t.key,E(t)}function A(e){var t={type:"paragraph",key:"p_".concat(String(Math.random())),notations:[],alignJustify:null};return e&&Object.assign(t,e),t}function _(){return A({notations:[E({note:"0"}),E({note:"0"}),E({note:"0"}),E({note:"0"}),E({note:N})]})}var H={version:1,canvasWidth:896,canvasHeight:1024,defaultFontSize:16,defaultSubFontSize:12,title:"\u65e0\u6807\u9898",tone:"C",marginHorizontal:64,marginTop:32,gapAfterTitle:16,gapAfterHeader:32,gapBetweenParagraph:32,gapBetweenNotation:16,beat:[4,4],speed:75,authors:["\u4f5a\u540d \u4f5c\u8bcd","\u7b80\u8c31\u7f16\u8f91\u5668 \u5236\u8c31"],notations:[]};function D(){return JSON.parse(JSON.stringify(H))}function B(){var e=D();return e.paragraphs=[_()],e}function M(e){var t={};return(U.paragraphs||[]).some((function(n,r){var o=(n.notations||[]).findIndex((function(t){return t.key===e}));return-1!==o&&(t.notation=n.notations[o],t.notationIndex=o,t.paragraph=n,t.paragraphIndex=r,!0)})),t}var W,F,K,L,V,z=w((function(e){e||(e=B()),j.lastSelectedNotationKey=j.selectedNotationKey=j.tieSourceKey=null,v.length=0,g=-1,Object(b.j)((function(){for(var t=0,n=Object.keys(U);t<n.length;t++){var r=n[t];Object(b.g)(U,r)}Object.assign(U,e)}))})),R=Object(b.f)(B()),Y=o.a.createContext(R),U=R,X=n(11);function J(e,t){return function(e){W||(W=document.createElement("canvas"),F=W.getContext("2d"),K=window.getComputedStyle(document.body).fontFamily),F.font="".concat(e||U.defaultFontSize,"px ").concat(K)}(e),F.measureText(t).width}function G(e,t){return L||(L=document.createElementNS("http://www.w3.org/2000/svg","svg"),(V=document.createElementNS("http://www.w3.org/2000/svg","text")).style.visibility="hidden",L.appendChild(V),document.body.appendChild(L)),V.style.fontSize=e+"px",V.textContent=t,V.getBBox()}function $(e){var t=(null===e||void 0===e?void 0:e.notations)||[];return t.some((function(e,n){return e.tieTo&&t.findIndex((function(t){return t.key===e.tieTo}))>n}))}var q=Object(b.f)({get maxContentWidth(){return Math.max(U.canvasWidth-2*U.marginHorizontal,0)},get minTieHeight(){return 8},get maxTieHeight(){return 20},get maxTieBezierOffset(){return 25},get underlineStepOffsetY(){return 3},get underlineInitialOffsetY(){return this.xHeight/2-3},get octaveStepOffsetY(){return 5},get octaveInitialOffsetAbove(){return q.xHeight/2+2},get octaveInitialOffsetBelow(){return q.xHeight/2-2},get titleOffsetY(){return U.marginTop+32+U.gapAfterTitle},get headerOffsetY(){var e=2*this.xHeight,t=this.titleOffsetY,n=t+e,r=t+this.xHeight*U.authors.length;return Math.max(t,n,r)+U.gapAfterHeader},get baseFontData(){var e=G(U.defaultFontSize,"x");return{xWidth:e.width,xHeight:e.height}},get baseSubFontData(){var e=G(U.defaultSubFontSize,"x");return{xWidth:e.width,xHeight:e.height}},get xHeight(){return this.baseFontData.xHeight},get xWidth(){return this.baseFontData.xWidth},get subXHeight(){return this.baseSubFontData.xHeight},get subXWidth(){return this.baseSubFontData.xWidth}}),Z=J.bind(null,U.defaultFontSize),Q=J.bind(null,U.defaultSubFontSize);function ee(e){var t=e.notations||[];if(0===t.length)return q.xHeight;$(e);var n=t.map((function(e){return function(e){var t,n,r,o,i=[0],a=q.xHeight/2,c=-q.xHeight/2;i.push(a,c);var s=0|e.octave,l=e.underline>0?q.underlineInitialOffsetY+q.underlineStepOffsetY*(0|e.underline):0;i.push(l);var u=e.octave>0?-q.octaveInitialOffsetAbove:q.octaveInitialOffsetBelow+l;r=s>0?u-5*Math.abs(s):s<0?u+5*Math.abs(s):0;i.push(r),o=(null===(t=e.prefixSups)||void 0===t?void 0:t.length)?q.subXHeight-4:0,i.push(o);var d=0;e.octave>0&&(d=q.octaveInitialOffsetAbove-q.octaveStepOffsetY*e.octave);var f=d-q.subXHeight*(0|(null===(n=e.topDecorators)||void 0===n?void 0:n.length))-2;i.push(f);var h=Math.max.apply(Math,i),p=Math.min.apply(Math,i);return h-p}(e)})),r=t.map((function(e){return re(e)})),o=n.map((function(e,t){return e-r[t]}));return 0+(Math.max.apply(Math,Object(X.a)(o))+Math.max.apply(Math,Object(X.a)(r)))}function te(e){var t=e.notations||[];if(0===t.length)return q.xHeight/2;return $(e),t.map((function(e){return re(e)})).reduce((function(e,t){return Math.max(e,t)}),q.xHeight/2)+0}function ne(e){var t=e.prefixSups||[];return Q(t.join(""))+2*t.length}function re(e){var t,n=[0],r=q.xHeight/2;n.push(r);var o=0;e.octave>0&&(o=q.octaveInitialOffsetAbove+q.octaveStepOffsetY*Math.abs(e.octave)),n.push(o);var i=o+q.subXHeight*(0|(null===(t=e.topDecorators)||void 0===t?void 0:t.length))-2;return n.push(i),Math.max.apply(Math,n)}function oe(e){var t=Z(e.note)+U.gapBetweenNotation;return ne(e)+t+(e.dotted?8:0)}var ie=q,ae=n(236),ce=n(237),se=n(238),le=n(239),ue=n(240),de=n(241),fe=n(242),he=n(233),pe={1:0,2:2,3:4,4:5,5:7,6:9,7:11},be={0:1,1:1,2:2,3:2,4:3,5:4,6:4,7:5,8:5,9:6,10:7,11:7},je={"\u266d":-1,"\u266f":1},ve={1:"\u266f",3:"\u266f",6:"\u266f",8:"\u266f",10:"\u266d"},ge={C:0,D:2,E:4,F:5,G:7,A:9,B:11},xe=y((function(e){e|=0,U.paragraphs.forEach((function(t){t.notations.forEach((function(t){if(T(t)&&C!==((null===(r=t)||void 0===r?void 0:r.note)||r)){t.octave+=Math.trunc(e/12);var n=pe[t.note]+e%12+(t.prefixSups||[]).reduce((function(e,t){return e+(0|je[t])}),0);n>=12?(t.octave+=1,n-=12):n<0&&(t.octave-=1,n+=12),t.note=String(be[n]),t.prefixSups=(t.prefixSups||[]).filter((function(e){return"\u266f"!==e&&"\u266d"!==e})),ve[n]&&t.prefixSups.unshift(ve[n])}var r}))}))})),me=y((function(e){var t=-(ge[e.split("").at(-1)]-ge[U.tone.split("").at(-1)]);(e.startsWith("\u266d")||U.tone.startsWith("\u266f"))&&(t-=1),(e.startsWith("\u266f")||U.tone.startsWith("\u266d"))&&(t+=1),xe(t),U.tone=e})),Oe=n(24),ye=n.n(Oe),ke=n(41),we=n(149),Ce=function(){return{escape:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},parseExtension:e,mimeType:function(t){var n=e(t).toLowerCase();return function(){var e="application/font-woff",t="image/jpeg";return{woff:e,woff2:e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:t,jpeg:t,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}()[n]||""},dataAsUrl:function(e,t){return"data:"+t+";base64,"+e},isDataUrl:function(e){return-1!==e.search(/^(data:)/)},canvasToBlob:function(e){return e.toBlob?new Promise((function(t){e.toBlob(t)})):function(e){return new Promise((function(t){for(var n=window.atob(e.toDataURL().split(",")[1]),r=n.length,o=new Uint8Array(r),i=0;i<r;i++)o[i]=n.charCodeAt(i);t(new Blob([o],{type:"image/png"}))}))}(e)},resolveUrl:function(e,t){var n=document.implementation.createHTMLDocument(),r=n.createElement("base");n.head.appendChild(r);var o=n.createElement("a");return n.body.appendChild(o),r.href=t,o.href=e,o.href},getAndEncode:function(e){var t=3e4;Ie.impl.options.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());return new Promise((function(n){var r,o=new XMLHttpRequest;if(o.onreadystatechange=a,o.ontimeout=c,o.responseType="blob",o.timeout=t,o.open("GET",e,!0),o.send(),Ie.impl.options.imagePlaceholder){var i=Ie.impl.options.imagePlaceholder.split(/,/);i&&i[1]&&(r=i[1])}function a(){if(4===o.readyState)if(200===o.status){var t=new FileReader;t.onloadend=function(){var e=t.result.split(/,/)[1];n(e)},t.readAsDataURL(o.response)}else r?n(r):s("cannot fetch resource: "+e+", status: "+o.status)}function c(){r?n(r):s("timeout of "+t+"ms occured while fetching resource: "+e)}function s(e){console.error(e),n("")}}))},uid:function(){var e=0;return function(){return"u"+t()+e++;function t(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)}}}(),delay:function(e){return function(t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))}},asArray:function(e){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t},escapeXhtml:function(e){return e.replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=n,r.src=e}))},width:function(e){var n=t(e,"border-left-width"),r=t(e,"border-right-width");return e.scrollWidth+n+r},height:function(e){var n=t(e,"border-top-width"),r=t(e,"border-bottom-width");return e.scrollHeight+n+r}};function e(e){var t=/\.([^\.\/]*?)$/g.exec(e);return t?t[1]:""}function t(e,t){var n=window.getComputedStyle(e).getPropertyValue(t);return parseFloat(n.replace("px",""))}}(),Se=function(){var e=/url\(['"]?([^'"]+?)['"]?\)/g;return{inlineAll:function(e,o,i){return a()?Promise.resolve(e):Promise.resolve(e).then(n).then((function(t){var n=Promise.resolve(e);return t.forEach((function(e){n=n.then((function(t){return r(t,e,o,i)}))})),n}));function a(){return!t(e)}},shouldProcess:t,impl:{readUrls:n,inline:r}};function t(t){return-1!==t.search(e)}function n(t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n[1]);return r.filter((function(e){return!Ce.isDataUrl(e)}))}function r(e,t,n,r){return Promise.resolve(t).then((function(e){return n?Ce.resolveUrl(e,n):e})).then(r||Ce.getAndEncode).then((function(e){return Ce.dataAsUrl(e,Ce.mimeType(t))})).then((function(n){return e.replace(function(e){return new RegExp("(url\\(['\"]?)("+Ce.escape(e)+")(['\"]?\\))","g")}(t),"$1"+n+"$3")}))}}(),Ne=function(){return{resolveAll:function(){return e(document).then((function(e){return Promise.all(e.map((function(e){return e.resolve()})))})).then((function(e){return e.join("\n")}))},impl:{readAll:e}};function e(){return Promise.resolve(Ce.asArray(document.styleSheets)).then((function(e){var t=[];return e.forEach((function(e){try{Ce.asArray(e.cssRules||[]).forEach(t.push.bind(t))}catch(n){console.log("Error while reading CSS rules from "+e.href,n.toString())}})),t})).then((function(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return Se.shouldProcess(e.style.getPropertyValue("src"))}))})).then((function(t){return t.map(e)}));function e(e){return{resolve:function(){var t=(e.parentStyleSheet||{}).href;return Se.inlineAll(e.cssText,t)},src:function(){return e.style.getPropertyValue("src")}}}}}(),Pe=function(){return{inlineAll:function t(n){return n instanceof Element?r(n).then((function(){return n instanceof HTMLImageElement?e(n).inline():Promise.all(Ce.asArray(n.childNodes).map((function(e){return t(e)})))})):Promise.resolve(n);function r(e){var t=e.style.getPropertyValue("background");return t?Se.inlineAll(t).then((function(t){e.style.setProperty("background",t,e.style.getPropertyPriority("background"))})).then((function(){return e})):Promise.resolve(e)}},impl:{newImage:e}};function e(e){return{inline:function(t){return Ce.isDataUrl(e.src)?Promise.resolve():Promise.resolve(e.src).then(t||Ce.getAndEncode).then((function(t){return Ce.dataAsUrl(t,Ce.mimeType(e.src))})).then((function(t){return new Promise((function(n,r){e.onload=n,e.onerror=r,e.src=t}))}))}}}}(),Te=window.devicePixelRatio||1,Ee={imagePlaceholder:void 0,cacheBust:!1},Ie={toSvg:Ae,toPng:function(e,t){return _e(e,t||{}).then((function(e){return e.toDataURL()}))},toJpeg:function(e,t){return _e(e,t=t||{}).then((function(e){return e.toDataURL("image/jpeg",t.quality||1)}))},toBlob:function(e,t){return _e(e,t||{}).then(Ce.canvasToBlob)},toPixelData:function(e,t){return _e(e,t||{}).then((function(t){return t.getContext("2d").getImageData(0,0,Ce.width(e)*Te,Ce.height(e)*Te).data}))},impl:{fontFaces:Ne,images:Pe,util:Ce,inliner:Se,options:{}}};function Ae(e,t){return function(e){"undefined"===typeof e.imagePlaceholder?Ie.impl.options.imagePlaceholder=Ee.imagePlaceholder:Ie.impl.options.imagePlaceholder=e.imagePlaceholder;"undefined"===typeof e.cacheBust?Ie.impl.options.cacheBust=Ee.cacheBust:Ie.impl.options.cacheBust=e.cacheBust}(t=t||{}),Promise.resolve(e).then((function(e){return He(e,t.filter,!0)})).then(De).then(Be).then((function(e){t.bgcolor&&(e.style.backgroundColor=t.bgcolor);t.width&&(e.style.width=t.width+"px");t.height&&(e.style.height=t.height+"px");t.style&&Object.keys(t.style).forEach((function(n){e.style[n]=t.style[n]}));return e})).then((function(n){return function(e,t,n){return Promise.resolve(e).then((function(e){return e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(e)})).then(Ce.escapeXhtml).then((function(e){return'<foreignObject x="0" y="0" width="100%" height="100%">'+e+"</foreignObject>"})).then((function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'">'+e+"</svg>"})).then((function(e){return"data:image/svg+xml;charset=utf-8,"+e}))}(n,(t.width||Ce.width(e))*Te,t.height||Ce.height(e)*Te)}))}function _e(e,t){return Ae(e,t).then(Ce.makeImage).then(Ce.delay(100)).then((function(n){var r=function(e){var n=document.createElement("canvas"),r=t.width||Ce.width(e),o=t.height||Ce.height(e);if(n.width=r*Te,n.height=o*Te,n.style.width=r+"px",n.style.height=o+"px",n.getContext("2d").scale(Te,Te),t.bgcolor){var i=n.getContext("2d");i.fillStyle=t.bgcolor,i.fillRect(0,0,n.width,n.height)}return n}(e);return r.getContext("2d").drawImage(n,0,0),r}))}function He(e,t,n){return n||!t||t(e)?Promise.resolve(e).then((function(e){return e instanceof HTMLCanvasElement?Ce.makeImage(e.toDataURL()):e.cloneNode(!1)})).then((function(n){return function(e,t,n){var r=e.childNodes;return 0===r.length?Promise.resolve(t):o(t,Ce.asArray(r),n).then((function(){return t}));function o(e,t,n){var r=Promise.resolve();return t.forEach((function(t){r=r.then((function(){return He(t,n)})).then((function(t){t&&e.appendChild(t)}))})),r}}(e,n,t)})).then((function(t){return function(e,t){return t instanceof Element?Promise.resolve().then(n).then(r).then(o).then(i).then((function(){return t})):t;function n(){function n(e,t){function n(e,t){Ce.asArray(e).forEach((function(n){t.setProperty(n,e.getPropertyValue(n),e.getPropertyPriority(n))}))}e.cssText?t.cssText=e.cssText:n(e,t)}n(window.getComputedStyle(e),t.style)}function r(){function n(n){var r=window.getComputedStyle(e,n),o=r.getPropertyValue("content");if(""!==o&&"none"!==o){var i=Ce.uid();t.className=t.className+" "+i;var a=document.createElement("style");a.appendChild(c(i,n,r)),t.appendChild(a)}function c(e,t,n){var r="."+e+":"+t,o=n.cssText?i(n):a(n);return document.createTextNode(r+"{"+o+"}");function i(e){var t=e.getPropertyValue("content");return e.cssText+" content: "+t+";"}function a(e){return Ce.asArray(e).map(t).join("; ")+";";function t(t){return t+": "+e.getPropertyValue(t)+(e.getPropertyPriority(t)?" !important":"")}}}}[":before",":after"].forEach((function(e){n(e)}))}function o(){e instanceof HTMLTextAreaElement&&(t.innerHTML=e.value),e instanceof HTMLInputElement&&t.setAttribute("value",e.value)}function i(){t instanceof SVGElement&&(t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t instanceof SVGRectElement&&["width","height"].forEach((function(e){var n=t.getAttribute(e);n&&t.style.setProperty(e,n)})))}}(e,t)})):Promise.resolve()}function De(e){return Ne.resolveAll().then((function(t){var n=document.createElement("style");return e.appendChild(n),n.appendChild(document.createTextNode(t)),e}))}function Be(e){return Pe.inlineAll(e).then((function(){return e}))}var Me=Ie;function We(e){return new Promise((function(t,n){var r=new FileReader;r.readAsText(e,"utf8"),r.onloadend=function(){t(JSON.parse(r.result))}}))}function Fe(){return(Fe=Object(ke.a)(ye.a.mark((function e(t){var n;return ye.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,We(t);case 2:if((n=e.sent).version<=1){e.next=6;break}return we.b.error("\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\uff0c\u8bf7\u4f7f\u7528\u6700\u65b0\u7248\u672c"),e.abrupt("return");case 6:z(n);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ke(){var e=new Blob([JSON.stringify(Object(b.i)(U))],{type:"application/json"}),t=document.createElement("a");t.download=(U.title||"\u672a\u6807\u9898")+".json",t.href=URL.createObjectURL(e),t.click(),URL.revokeObjectURL(t.href)}var Le=n(2),Ve=he.a.SubMenu,ze=w((function(e){!function(e){Fe.apply(this,arguments)}(e.target.files[0])})),Re=w((function(){j.selectedNotationKey=null,Me.toPng(document.querySelector("#temp_svg"),{bgcolor:"white"}).then((function(e){var t=document.createElement("a");t.download=(U.title||"\u672a\u6807\u9898")+".png",t.href=e,t.click()}))})),Ye=y((function(e){switch(e.key){case"undo":m(-1);break;case"redo":m(1);break;case"reset-title":k((function(){U.title="\u3010\u6b4c\u66f2\u540d\u79f0\u3011"}));break;case"reset-authors":U.authors=["\u3010\u4f5c\u66f2\u8005\u3011 \u4f5c\u66f2","\u3010\u586b\u8bcd\u8005\u3011 \u586b\u8bcd","\u3010\u8bb0\u8c31\u8005\u3011 \u8bb0\u8c31"];break;case"add-paragraph":U.paragraphs.push(_())}})),Ue=y((function(e){j.shouldNotationBlurAfterClick&&j.selectedNotationKey&&(j.lastSelectedNotationKey=j.selectedNotationKey,j.selectedNotationKey=null),j.shouldNotationBlurAfterClick=!0})),Xe=y((function(e){var t=e.key.toLowerCase(),n=e.shiftKey,r=e.ctrlKey;if(j.selectedNotationKey){if(j.helpDialogVisible||j.configDialogVisible)return;var o=M(j.selectedNotationKey),i=o.paragraph,a=o.notation,c=o.paragraphIndex,s=o.notationIndex;if(!a)return;switch(!0){case T(t)&&!r&&!n:a.note=t;break;case"-"===t&&!r&&!n:a.note=S;break;case"|"===t&&!r:a.note=N;break;case"u"===t&&!r&&!n:a.underline+=1;break;case"u"===t&&!r&&n:a.underline-=1,a.underline=Math.max(0,a.underline);break;case"."===t&&!r&&!n:a.dotted=!a.dotted;break;case"8"===t&&!r&&!n:a.octave+=1;break;case"*"===t&&!r:a.octave-=1;break;case"#"===t&&!r:0!==a.prefixSups.indexOf("\u266f")?("\u266d"===a.prefixSups[0]&&a.prefixSups.shift(),a.prefixSups.unshift("\u266f")):a.prefixSups.shift();break;case"b"===t&&!r&&!n:0!==a.prefixSups.indexOf("\u266d")?("\u266f"===a.prefixSups[0]&&a.prefixSups.shift(),a.prefixSups.unshift("\u266d")):a.prefixSups.shift();break;case"~"===t&&!r:a.topDecorators.includes("~")?a.topDecorators.splice(a.topDecorators.indexOf("~"),1):a.topDecorators.push("~");break;case"enter"===t&&!r&&!n:if(i.notations[s+1])j.selectedNotationKey=i.notations[s+1].key;else{var l=E();i.notations.push(l),j.selectedNotationKey=l.key}break;case"l"===t&&!r&&!n:var u,d=i.notations[s+1]||(null===(u=U.paragraphs[c+1].notations)||void 0===u?void 0:u.at(0));d&&(j.selectedNotationKey=d.key);break;case"enter"===t&&!r&&n:i.notations[s-1]&&(j.selectedNotationKey=i.notations[s-1].key);break;case"h"===t&&!r&&!n:var f,h=i.notations[s-1]||(null===(f=U.paragraphs[c-1].notations)||void 0===f?void 0:f.at(-1));h&&(j.selectedNotationKey=h.key);break;case"enter"===t&&r&&!n:var p=E();s===i.notations.length-1&&c===U.paragraphs.length-1?(U.paragraphs.push(A({notations:[p]})),j.selectedNotationKey=U.paragraphs.at(-1).notations.at(0).key):(i.notations.splice(s+1,0,p),j.selectedNotationKey=p.key);break;case"j"===t&&!r&&!n:var v,g=U.paragraphs[c+1];if(null===g||void 0===g||null===(v=g.notations)||void 0===v?void 0:v.length){var x=g.notations[s]||g.notations.at(-1);j.selectedNotationKey=x.key}break;case"k"===t&&!r&&!n:var O,y=U.paragraphs[c-1];if(null===y||void 0===y||null===(O=y.notations)||void 0===O?void 0:O.length){var k=y.notations[s]||y.notations.at(-1);j.selectedNotationKey=k.key}break;case"backspace"===t&&!r&&!n:case"delete"===t&&!r&&!n:i.notations.splice(s,1);var w=i.notations[s]||i.notations[s-1];j.selectedNotationKey=null===w||void 0===w?void 0:w.key;break;case"backspace"===t&&!r&&n:case"delete"===t&&!r&&n:var C,P;U.paragraphs.splice(c,1);var _=U.paragraphs[c]||U.paragraphs.at(-1),H=(null===_||void 0===_||null===(C=_.notations)||void 0===C?void 0:C.at(s))||(null===_||void 0===_||null===(P=_.notations)||void 0===P?void 0:P.at(-1));j.selectedNotationKey=null===H||void 0===H?void 0:H.key;break;case"="===t&&!r&&!n:"boolean"!==typeof i.alignJustify&&(i.alignJustify=!(c===U.paragraphs.length-1)),i.alignJustify=!i.alignJustify;break;case"c"===t&&r&&!n:e.preventDefault(),j.clipboardContent=a;break;case"c"===t&&r&&n:e.preventDefault(),j.clipboardContent=i;break;case"v"===t&&r&&!n:if(e.preventDefault(),j.clipboardContent)switch(j.clipboardContent.type){case"notation":i.notations.splice(s+1,0,I(j.clipboardContent));break;case"paragraph":U.paragraphs.splice(c+1,0,function(e){var t=JSON.parse(JSON.stringify(Object(b.i)(e)));return delete t.key,t.notations=e.notations.map((function(e){return I(e)})),A(t)}(j.clipboardContent));break;default:j.clipboardContent=null}}}else if(!0===["h","j","k","l"].includes(t)){var D,B,W,F,K=M(j.lastSelectedNotationKey).notation;j.selectedNotationKey=null===(D=K||(null===(B=U.paragraphs)||void 0===B||null===(W=B.at(0))||void 0===W||null===(F=W.notations)||void 0===F?void 0:F.at(0)))||void 0===D?void 0:D.key}switch(!0){case"z"===t&&r&&!n:m(-1);break;case"y"===t&&r&&!n:case"z"===t&&r&&n:m(1);break;case"s"===t&&r&&!n:e.preventDefault(),Ke();break;case"o"===t&&r&&!n:e.preventDefault();var L=document.createElement("input");L.type="file",L.accept=".json",L.onchange=ze,L.click();break;case"?"===t&&!r:j.helpDialogVisible?j.helpDialogVisible=!1:(j.configDialogVisible=!1,j.helpDialogVisible=!0)}})),Je=Object(Le.jsxs)(he.a,{children:[Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(ae.a,{}),onClick:function(){z()},children:"\u65b0\u5efa"},"create"),Object(Le.jsxs)(he.a.Item,{icon:Object(Le.jsx)(ce.a,{}),children:["\u6253\u5f00",Object(Le.jsx)("input",{onChange:ze,accept:".json",type:"file",title:"",style:{opacity:0,cursor:"pointer",width:"100%",left:0,top:0,height:"100%",position:"absolute"}})]},"open"),Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(se.a,{}),onClick:function(){Ke()},children:"\u4fdd\u5b58"},"save"),Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(se.a,{}),onClick:Re,children:"\u5bfc\u51fa\u4e3a\u56fe\u7247"},"export")]}),Ge=Object(Le.jsxs)(he.a,{onClick:Ye,children:[Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(le.a,{}),children:"\u64a4\u9500"},"undo"),Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(ue.a,{}),children:"\u91cd\u505a"},"redo"),Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(de.a,{}),children:"\u6dfb\u52a0\u6bb5\u843d"},"add-paragraph"),Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(fe.a,{}),children:"\u91cd\u7f6e\u6b4c\u66f2\u540d\u79f0"},"reset-title"),Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(fe.a,{}),children:"\u91cd\u7f6e\u4f5c\u8005\u4fe1\u606f"},"reset-authors")]}),$e=Object(Le.jsxs)(he.a,{onClick:function(e){var t=e.key;switch(!0){case t.startsWith("convertTo"):var n=t.split("-",2)[1];me(n);break;case"convert-up"===t:xe(2);break;case"convert-down"===t:xe(-2);break;case"convert-up8"===t:xe(12);break;case"convert-down8"===t:xe(-12)}},children:[Object(Le.jsxs)(Ve,{title:"\u8f6c\u5230...",children:[Object(Le.jsx)(he.a.Item,{children:"1 = C"},"convertTo-C"),Object(Le.jsx)(he.a.Item,{children:"1 = D"},"convertTo-D"),Object(Le.jsx)(he.a.Item,{children:"1 = E"},"convertTo-E"),Object(Le.jsx)(he.a.Item,{children:"1 = F"},"convertTo-F"),Object(Le.jsx)(he.a.Item,{children:"1 = G"},"convertTo-G"),Object(Le.jsx)(he.a.Item,{children:"1 = A"},"convertTo-A"),Object(Le.jsx)(he.a.Item,{children:"1 = B"},"convertTo-B"),Object(Le.jsxs)(he.a.Item,{children:["1 = ",Object(Le.jsx)("sup",{children:"\u266d"}),"D"]},"convertTo-\u266dD"),Object(Le.jsxs)(he.a.Item,{children:["1 = ",Object(Le.jsx)("sup",{children:"\u266d"}),"E"]},"convertTo-\u266dE"),Object(Le.jsxs)(he.a.Item,{children:["1 = ",Object(Le.jsx)("sup",{children:"\u266d"}),"G"]},"convertTo-\u266dG"),Object(Le.jsxs)(he.a.Item,{children:["1 = ",Object(Le.jsx)("sup",{children:"\u266d"}),"A"]},"convertTo-\u266dA"),Object(Le.jsxs)(he.a.Item,{children:["1 = ",Object(Le.jsx)("sup",{children:"\u266d"}),"B"]},"convertTo-\u266dB")]},"convertTo"),Object(Le.jsx)(he.a.Item,{children:"\u5347\u9ad8\u4e00\u4e2a\u97f3"},"convert-up"),Object(Le.jsx)(he.a.Item,{children:"\u964d\u4f4e\u4e00\u4e2a\u97f3"},"convert-down"),Object(Le.jsx)(he.a.Item,{children:"\u5347\u9ad8\u4e00\u4e2a\u516b\u5ea6"},"convert-up8"),Object(Le.jsx)(he.a.Item,{children:"\u964d\u4f4e\u4e00\u4e2a\u516b\u5ea6"},"convert-down8")]},"tone"),qe=n(1),Ze=n(10),Qe=n(143),et=n.n(Qe),tt=["children"];var nt=Object(p.a)((function(e){var t=e.children,n=Object(Ze.a)(e,tt);return Object(Le.jsx)("svg",Object(qe.a)(Object(qe.a)({id:"temp_svg",xmlns:" http://www.w3.org/2000/svg",className:et.a.svg,width:U.canvasWidth,height:U.canvasHeight,onContextMenu:function(e){return e.preventDefault()}},n),{},{children:t}))})),rt=n(232),ot=n(231),it=n(234),at=["propertyName"],ct=["propertyName","label"],st=Object(p.a)((function(e){var t=e.propertyName,n=Object(Ze.a)(e,at),r=w((function(e){var n=0|Number(e.target.value);U[t]=n}));return Object(Le.jsx)(rt.a,Object(qe.a)({value:U[t],onChange:r},n))}));function lt(e){var t=e.propertyName,n=e.label,r=Object(Ze.a)(e,ct);return Object(Le.jsx)(ot.a.Item,Object(qe.a)(Object(qe.a)({label:n},r),{},{children:Object(Le.jsx)(st,{propertyName:t})}))}var ut,dt=function(e){var t=e.visible,n=e.onVisibleChange,o=Object(r.useCallback)((function(){null===n||void 0===n||n.call(null,!1)}),[n]),i=w((function(){var e=D(),t=e.canvasWidth,n=e.canvasHeight,r=e.marginTop,o=e.marginHorizontal,i=e.gapBetweenParagraph,a=e.gapBetweenNotation;Object.assign(U,{canvasWidth:t,canvasHeight:n,marginTop:r,marginHorizontal:o,gapBetweenParagraph:i,gapBetweenNotation:a})}));return Object(Le.jsx)(it.a,{style:{top:20},visible:t,title:"\u914d\u7f6e",onCancel:o,footer:[Object(Le.jsx)(s.a,{onClick:i,children:"\u91cd\u7f6e\u4e3a\u9ed8\u8ba4"},"reset"),Object(Le.jsx)(s.a,{type:"primary",onClick:o,children:"\u5173\u95ed"},"close")],children:Object(Le.jsxs)(ot.a,{labelAlign:"right",labelCol:{span:4},children:[Object(Le.jsx)(ot.a.Item,{label:"\u753b\u5e03\u5927\u5c0f",children:Object(Le.jsxs)(rt.a.Group,{children:[Object(Le.jsx)(st,{propertyName:"canvasWidth",style:{width:"45%",textAlign:"center"}}),Object(Le.jsx)(rt.a,{className:"site-input-split",style:{width:"10%",borderLeft:0,borderRight:0,textAlign:"center",pointerEvents:"none"},placeholder:"x",disabled:!0}),Object(Le.jsx)(st,{propertyName:"canvasHeight",style:{width:"45%",textAlign:"center"}})]})}),Object(Le.jsx)(lt,{label:"\u9876\u90e8\u8fb9\u8ddd",propertyName:"marginTop"}),Object(Le.jsx)(lt,{label:"\u5de6\u53f3\u8fb9\u8ddd",propertyName:"marginHorizontal"}),Object(Le.jsx)(lt,{label:"\u6bb5\u95f4\u8ddd",propertyName:"gapBetweenParagraph"}),Object(Le.jsx)(lt,{label:"\u97f3\u7b26\u95f4\u8ddd",propertyName:"gapBetweenNotation"})]})})},ft=n(6),ht=n(78),pt=n.n(ht),bt=!1,jt={x:0,y:0};function vt(){return ut||((ut=document.createElement("div")).id="svg-popover-container",ut.style="\n position: absolute;\n left: 0;\n top: 0;\n ",document.body.appendChild(ut),document.addEventListener("scroll",(function(){bt=!0}))),ut}function gt(){if(bt){var e=vt().getBoundingClientRect();jt={x:-e.x,y:-e.y},bt=!1}return jt}function xt(e){var t=e.children,n=e.renderContent,o=e.renderPopover,a=e.darkMode,c=e.globalClassName,s=e.offset,l=e.placement,u=e.style,d=e.title,f=e.trigger,h=e.visible,p=e.autoHide,b=e.showArrow,j=e.onVisibilityChange,v=Object(r.useRef)({x:0,y:0,width:0,height:0,top:0,bottom:0,left:0,right:0}),g=Object(r.useRef)(!1),x=Object(r.useRef)(),m=Object(r.useRef)(),O=Object(r.useState)(!1),y=Object(ft.a)(O,2),k=y[0],w=y[1],C=Object(r.useState)({x:0,y:0}),S=Object(ft.a)(C,2),N=S[0],P=S[1],T=Object(r.useState)(),E=Object(ft.a)(T,2)[1],I=[pt.a.popover,c].filter(Boolean),A=[pt.a.arrow],_=[pt.a.header],H=s&&s.x||0,D=s&&s.y||0,B={transform:""},M={};l=l.toLowerCase();var W=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;H+=e,D+=t},F=Object(r.useCallback)((function(e){var t;e=null!==(t=e)&&void 0!==t?t:!k;var n=void 0===h?e:h;if(n){if(!x.current)return void setTimeout(F,0);v.current=x.current.getBoundingClientRect()}w(n),j&&j(e)}),[h,k,j]),K=Object(r.useCallback)((function(e){P({x:e.pageX,y:e.pageY}),e.preventDefault(),F(!0)}),[F]);if(Object(r.useEffect)((function(){g.current=!0}),[]),Object(r.useEffect)((function(){if(!1!==p){var e=function(e){if("keydown"===e.type&&"Escape"===e.key)F(!1);else if("mouseup"===e.type){for(var t=e.target;t;t=t.parentElement){if(t===m.current)return;if(t===x.current){if("context"===f&&2!==e.button)continue;if("click"===f&&0!==e.button)continue;return}}F(!1)}};return k&&(document.addEventListener("mouseup",e),document.addEventListener("keydown",e)),function(){document.removeEventListener("mouseup",e),document.removeEventListener("keydown",e)}}}),[k,p,F,f]),void 0!==h&&h!==k&&(g.current?F():setTimeout((function(){E([])}),0)),"context"!==f){var L=v.current;switch(!0){case/^(left|right)(top|center|bottom)?$/i.test(l):B.minHeight="32px",l.startsWith("right")?B.left=L.right+"px":(B.left=L.left+"px",B.transform+=" translate(-100%, 0)"),l.endsWith("top")?(B.top=L.top+"px",B.transform+=" translate(0, 0)",M.top="16px"):l.endsWith("bottom")?(B.top=L.bottom+"px",B.transform+=" translate(0, -100%)",M.bottom="0"):(B.top=L.y+L.height/2+"px",B.transform+=" translate(0, -50%)",M.top="50%");break;case/^(top|bottom)(left|center|right)?$/i.test(l):default:l.startsWith("bottom")?B.top=L.bottom+"px":(B.top=L.y+"px",B.transform+=" translate(0, -100%)"),l.endsWith("left")?(B.left=L.left+"px",M.left="16px"):l.endsWith("right")?(B.left=L.right+"px",B.transform+=" translate(-100%, 0)",M.right="0"):(B.left=L.right-L.width/2+"px",B.transform+=" translateX(-50%)",M.left="50%")}switch(!0){case!b:break;case l.startsWith("left"):W(-8),A.push("left");break;case l.startsWith("right"):W(8),A.push("right");break;case l.startsWith("bottom"):W(0,8),A.push("bottom");break;case l.startsWith("top"):default:W(0,-8),A.push("top")}W(gt().x,gt().y),B.transform+=" translate(".concat(H,"px, ").concat(D,"px)")}else B.left=N.x,B.top=N.y,B.transform="translate(".concat(H,"px, ").concat(D,"px)");return a&&(I.push("dark"),A.push("dark"),_.push("dark")),B=Object.assign(B,u),Object(Le.jsxs)(Le.Fragment,{children:["[]",Object(Le.jsx)("g",{type:"noop",ref:x,onClick:"click"===f?function(){return F()}:void 0,onMouseEnter:"hover"===f?function(){return F(!0)}:void 0,onMouseLeave:"hover"===f?function(){return F(!1)}:void 0,onContextMenu:"context"===f?K:void 0,children:t}),k&&Object(i.createPortal)(Object(Le.jsx)("div",{ref:m,className:I.join(" "),style:B,children:o?"function"===typeof o?o():o:Object(Le.jsxs)(Le.Fragment,{children:[b&&Object(Le.jsx)("div",{className:A.join(" "),style:M}),d&&Object(Le.jsx)("header",{className:_.join(" "),children:d}),Object(Le.jsx)("div",{className:d?pt.a.content:null,children:"function"===typeof n?n():null!==n&&void 0!==n?n:null})]})}),vt())]})}xt.defaultProps={trigger:"click",placement:"top",showArrow:!0};var mt=o.a.memo(xt),Ot=n(79),yt=n.n(Ot),kt=function(e,t){var n=e.children,o=e.title,i=e.initialValue,a=e.inputType,c=e.options,l=e.overlay,u=e.onChange,d=e.popoverProps,f=Object(r.useState)(i),h=Object(ft.a)(f,2),p=h[0],b=h[1],j=Object(r.useState)(!1),v=Object(ft.a)(j,2),g=v[0],x=v[1];Object(r.useImperativeHandle)(t,(function(){return{showPopover:x.bind(null,!0),hidePopover:x.bind(null,!1)}}),[]);var m,O=Object(r.useCallback)((function(e){x(e),e||b(i)}),[i]),y=Object(r.useCallback)((function(e){b(e.target.value)}),[]),k=Object(r.useCallback)(function(){var e=Object(ke.a)(ye.a.mark((function e(t){var n;return ye.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=void 0===t?p:t,e.next=3,u&&u(n);case 3:!1!==e.sent&&x(!1);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[p,u]),w=Object(r.useCallback)((function(){x(!1)}),[]),C=Object(r.useCallback)((function(){b(i),x(!1)}),[i]),S=Object(r.useCallback)((function(){return Object(Le.jsxs)(Le.Fragment,{children:[Object(Le.jsx)(rt.a,{autoFocus:!0,value:p,onChange:y,onPressEnter:function(){return k()}}),Object(Le.jsxs)("div",{className:yt.a.buttonGroup,children:[Object(Le.jsx)(s.a,{type:"primary",className:yt.a.button,onClick:function(){return k()},children:"\u786e\u5b9a"}),Object(Le.jsx)(s.a,{onClick:C,children:"\u53d6\u6d88"})]})]})}),[p,y,k,C]),N=Object(r.useCallback)((function(){return l?Object(Le.jsx)("div",{onClick:w,children:l}):Object(Le.jsx)(he.a,{className:yt.a.menu,children:(c||[]).filter((function(e){return!1!==e.visible})).map((function(e){return Object(Le.jsx)(he.a.Item,{icon:e.icon,className:yt.a.menuItem+(e.key===i?" selected":""),onClick:function(){return k(e.key)},children:e.text},e.key)}))})}),[i,c,k,w,l]);if("select"===a)m=N;else m=S;return Object(Le.jsx)(mt,Object(qe.a)(Object(qe.a)({trigger:"select"===a?"context":"click",title:o,renderContent:m,renderPopover:undefined,visible:g,placement:"bottom",onVisibilityChange:O},d),{},{children:n}))},wt=o.a.forwardRef(kt),Ct=["children","type","editable","offset","offsetX","offsetY"];function St(e){var t,n,r=e.children,o=e.type,i=e.editable,a=e.offset,c=e.offsetX,s=e.offsetY,l=Object(Ze.a)(e,Ct);return c=0|(null!==(t=null===a||void 0===a?void 0:a.x)&&void 0!==t?t:c),s=0|(null!==(n=null===a||void 0===a?void 0:a.y)&&void 0!==n?n:s),Object(Le.jsx)("g",Object(qe.a)(Object(qe.a)({type:o,transform:"translate(".concat(c,",").concat(s,")"),style:i?{cursor:"pointer"}:null},l),{},{children:r}))}function Nt(e){var t=document.createElement("span");return t.appendChild(document.createTextNode(e)),t.innerHTML.replace(/\s/g,"&nbsp;")}var Pt=["children","editable"];function Tt(e){var t=e.children,n=e.editable,r=Object(Ze.a)(e,Pt);return"string"===typeof t?Object(Le.jsx)("text",Object(qe.a)({x:"0",y:"0",style:n?{cursor:"pointer"}:null,dominantBaseline:"hanging",stroke:"none",fontWeight:"bold",fill:"currentColor",dangerouslySetInnerHTML:{__html:Nt(t)}},r)):Object(Le.jsx)("text",Object(qe.a)(Object(qe.a)({x:"0",y:"0",style:n?{cursor:"pointer"}:null,dominantBaseline:"hanging",stroke:"none",fontWeight:"bold",fill:"currentColor"},r),{},{children:t}))}var Et=["C","D","E","F","G","A","B","\u266dC","\u266dD","\u266dE","\u266dF","\u266dG","\u266dA","\u266dB"].map((function(e){return{key:e,text:e}})),It=y((function(e){U.tone=e})),At=y((function(e){U.speed=e})),_t=y((function(e){var t=String(e).split("/");if(2!==t.length)return we.b.error("\u8bf7\u4ee5\u3010*/*\u3011\u7684\u683c\u5f0f\u8f93\u5165\u8282\u62cd\uff01"),!1;var n=[parseInt(t[0],10),parseInt(t[1],10)],r=n[0],o=n[1];if(!(r>0&&o>0))return we.b.error("\u8bf7\u8f93\u5165\u5927\u4e8e0\u7684\u62cd\u6570\u548c\u65f6\u503c\uff01"),!1;U.beat=[r,o]}));var Ht=Object(p.a)((function(){return Object(Le.jsxs)(Le.Fragment,{children:[Object(Le.jsx)(wt,{inputType:"select",initialValue:U.tone,options:Et,onChange:It,popoverProps:{trigger:"click"},children:Object(Le.jsxs)(St,{type:"tone",editable:!0,offsetX:U.marginHorizontal,offsetY:ie.titleOffsetY,children:[Object(Le.jsx)(Tt,{children:"1\xa0\xa0= "}),U.tone.startsWith("\u266d")&&Object(Le.jsx)(Tt,{x:"27",y:"-2",fontSize:U.defaultSubFontSize,children:"\u266d"}),Object(Le.jsx)(Tt,{editable:!0,x:U.tone.startsWith("\u266d")?36:29,children:U.tone.at(-1)})]})}),Object(Le.jsx)(wt,{title:"\u8282\u62cd\uff1a",inputType:"number",initialValue:U.beat.join("/"),onChange:_t,children:Object(Le.jsxs)(St,{type:"beat",editable:!0,offsetX:U.marginHorizontal+64,offsetY:ie.titleOffsetY,children:[Object(Le.jsx)(Tt,{x:"0",y:"-8",textAnchor:"middle",children:U.beat[0]}),Object(Le.jsx)(Tt,{x:"0",y:"12",textAnchor:"middle",children:U.beat[1]}),Object(Le.jsx)("line",{x1:"-8",y1:"8",x2:"8",y2:"8",stroke:"currentColor"})]})}),Object(Le.jsx)(wt,{title:"\u901f\u5ea6\uff08bps\uff09\uff1a",inputType:"number",initialValue:U.speed,onChange:At,children:Object(Le.jsxs)(St,{editable:!0,type:"speed",offsetX:U.marginHorizontal,offsetY:ie.titleOffsetY+22,children:[Object(Le.jsx)(Tt,{x:"-4",children:"\u2669"}),Object(Le.jsxs)(Tt,{x:"16",children:["=\xa0",U.speed]})]})})]})})),Dt=n(243),Bt=[{key:"create",text:"\u6dfb\u52a0",icon:Object(Le.jsx)(ae.a,{}),onClick:function(){U.authors.push("\u4f5c\u8005\u4fe1\u606f")}},{key:"delete",text:"\u5220\u9664",icon:Object(Le.jsx)(Dt.a,{}),onClick:function(e){U.authors.splice(e,1)}}],Mt=[{key:"create",text:"\u6dfb\u52a0\u4f5c\u8005\u4fe1\u606f",icon:Object(Le.jsx)(ae.a,{}),onClick:function(){U.authors.push("\u3010\u8bb0\u8c31\u8005\u3011 \u8bb0\u8c31")}}],Wt=y((function(e,t){var n=Bt.find((function(e){return e.key===t}));null===n||void 0===n||n.onClick(e)})),Ft=y((function(e){var t=Mt.find((function(t){return t.key===e}));null===t||void 0===t||t.onClick()})),Kt=y((function(e,t){if(!t)return new Promise((function(t){it.a.confirm({title:"\u5220\u9664\u8fd9\u6761\u4f5c\u8005\u4fe1\u606f\uff1f",okText:"\u786e\u5b9a",cancelText:"\u53d6\u6d88",onOk:function(){t(!0),U.authors.splice(e,1)},onCancel:function(){t(!0)}})}));U.authors[e]=t}));var Lt=Object(p.a)((function(){return Object(Le.jsxs)(St,{type:"authors",offsetX:U.canvasWidth-U.marginHorizontal,offsetY:ie.titleOffsetY,children:[Object(Le.jsx)(wt,{inputType:"select",options:Mt,popoverProps:{trigger:"context"},onChange:Ft,children:Object(Le.jsx)("rect",{x:U.marginHorizontal-150,y:"-64",width:150,height:150,fill:U.authors.length?"none":"transparent"})}),U.authors.map((function(e,t){return Object(Le.jsx)(wt,{inputType:"select",options:Bt,popoverProps:{trigger:"context"},onChange:Wt.bind(null,t),children:Object(Le.jsx)(wt,{title:"\u4f5c\u8005\u4fe1\u606f\uff1a",initialValue:e,onChange:Kt.bind(null,t),children:Object(Le.jsx)(Tt,{editable:!0,y:22*t,textAnchor:"end",children:e})})},t+e)}))]})})),Vt=y((function(e){U.title=e}));var zt=Object(p.a)((function(){var e=Object(r.useRef)();return Object(Le.jsx)(St,{type:"title",offsetY:U.marginTop,children:Object(Le.jsx)(wt,{ref:e,title:"\u6b4c\u66f2\u540d\u79f0\uff1a",initialValue:U.title,onChange:Vt,children:Object(Le.jsx)(Tt,{editable:!0,x:"50%",fontSize:"32",fill:"currentColor",stroke:"none",textAnchor:"middle",children:U.title})})})}));function Rt(){return Object(Le.jsxs)(Le.Fragment,{children:[Object(Le.jsx)(zt,{}),Object(Le.jsx)(Ht,{}),Object(Le.jsx)(Lt,{})]})}var Yt=o.a.memo(Rt),Ut=n(58),Xt=n.n(Ut);function Jt(e){var t=e.kbd,n=e.desc;return Object(Le.jsxs)("li",{className:Xt.a.listItem,children:[Object(Le.jsx)("kbd",{className:Xt.a.kbd,children:t}),Object(Le.jsx)("span",{children:n})]})}var Gt=function(e){var t=e.visible,n=e.onVisibleChange,o=Object(r.useCallback)((function(){null===n||void 0===n||n.call(null,!1)}),[n]);return Object(Le.jsxs)(it.a,{width:"100%",height:"90%",style:{top:"4%"},visible:t,title:"\u5e2e\u52a9",onCancel:o,footer:Object(Le.jsx)(s.a,{type:"primary",onClick:o,children:"\u786e\u5b9a"},"close"),children:[Object(Le.jsx)("h2",{children:"\u5feb\u6377\u952e"}),Object(Le.jsx)("h3",{children:"\u5168\u5c40"}),Object(Le.jsxs)("ul",{className:Xt.a.list,children:[Object(Le.jsx)(Jt,{kbd:"\uff1f",desc:"\u663e\u793a\u6b64\u5e2e\u52a9"}),Object(Le.jsx)(Jt,{kbd:"Ctrl+Z",desc:"\u64a4\u9500"}),Object(Le.jsx)(Jt,{kbd:"Ctrl+Shift+Z",desc:"\u91cd\u505a"}),Object(Le.jsx)(Jt,{kbd:"Ctrl+O",desc:"\u6253\u5f00\u6587\u4ef6"}),Object(Le.jsx)(Jt,{kbd:"h j k l",desc:"\u79fb\u52a8\u7126\u70b9"})]}),Object(Le.jsx)("h3",{children:"\u4ec5\u9009\u4e2d\u7b26\u53f7\u65f6"}),Object(Le.jsx)("h4",{children:"\u8f93\u5165"}),Object(Le.jsxs)("ul",{className:Xt.a.list,children:[Object(Le.jsx)(Jt,{kbd:"0~7, -",desc:"\u8f93\u5165\u97f3\u7b26"}),Object(Le.jsx)(Jt,{kbd:"|",desc:"\u8f93\u5165\u5c0f\u8282\u7ebf"}),Object(Le.jsx)(Jt,{kbd:".",desc:"\u8f93\u5165\u9644\u70b9"}),Object(Le.jsx)(Jt,{kbd:"~",desc:"\u98a4\u97f3\u7b26\u53f7"}),Object(Le.jsx)(Jt,{kbd:"u / U",desc:"\u589e\u51cf\u65f6\u7ebf"}),Object(Le.jsx)(Jt,{kbd:"8 / *",desc:"\u516b\u5ea6\u5706\u70b9"}),Object(Le.jsx)(Jt,{kbd:"# / b",desc:"\u97f3\u7b26\u5347/\u964d"})]}),Object(Le.jsx)("h4",{children:"\u64cd\u4f5c"}),Object(Le.jsxs)("ul",{className:Xt.a.list,children:[Object(Le.jsx)(Jt,{kbd:"Enter",desc:"\u79fb\u52a8\u5230\u4e0b\u4e00\u4e2a\u97f3\u7b26"}),Object(Le.jsx)(Jt,{kbd:"Shift+Enter",desc:"\u79fb\u52a8\u5230\u4e0a\u4e00\u4e2a\u97f3\u7b26"}),Object(Le.jsx)(Jt,{kbd:"Ctrl+Enter",desc:"\u5728\u5f53\u524d\u4f4d\u7f6e\u540e\u63d2\u5165\u97f3\u7b26"}),Object(Le.jsx)(Jt,{kbd:"Delete",desc:"\u5220\u9664\u5f53\u524d\u97f3\u7b26"}),Object(Le.jsx)(Jt,{kbd:"Shift+Delete",desc:"\u5220\u9664\u5f53\u524d\u6bb5\u843d"}),Object(Le.jsx)(Jt,{kbd:"=",desc:"\u6bb5\u843d\u662f\u5426\u4e24\u7aef\u5bf9\u9f50"}),Object(Le.jsx)(Jt,{kbd:"h j k l",desc:"Vi\u98ce\u683c\u79fb\u52a8\u7126\u70b9"}),Object(Le.jsx)(Jt,{kbd:"Ctrl+C",desc:"\u590d\u5236\u5f53\u524d\u97f3\u7b26"}),Object(Le.jsx)(Jt,{kbd:"Ctrl+Shift+C",desc:"\u590d\u5236\u5f53\u524d\u6bb5\u843d"}),Object(Le.jsx)(Jt,{kbd:"Ctrl+V",desc:"\u7c98\u8d34"})]}),Object(Le.jsx)("h2",{children:"\u63d0\u793a"}),Object(Le.jsxs)("ul",{className:Xt.a.list,children:[Object(Le.jsx)("li",{children:"\u6bb5\u843d\u4e0a\u53ef\u4ee5\u53f3\u952e\u5355\u51fb\u5f39\u51fa\u64cd\u4f5c\u83dc\u5355"}),Object(Le.jsx)("li",{children:"\u589e\u51cf\u65f6\u7ebf\u9ed8\u8ba4\u8fde\u7eed\uff0c\u53ef\u5728\u97f3\u7b26\u53f3\u952e\u83dc\u5355\u4e2d\u9009\u62e9\u6253\u65ad"})]})]})},$t=n(244);function qt(e){var t=y((function(t){switch(t.key){case"add":var n=U.paragraphs.findIndex((function(t){return t.key===e.key})),r=A({notations:[E({note:"0"}),E({note:"0"}),E({note:"0"}),E({note:"0"}),E({note:N})]});-1!==n?U.paragraphs.splice(n+1,0,r):U.paragraphs.push(r);break;case"delete":var o=U.paragraphs.findIndex((function(t){return t.key===e.key}));-1!==o&&U.paragraphs.splice(o,1)}}));return Object(Le.jsxs)(he.a,{onClick:t,children:[Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)($t.a,{}),children:"\u6dfb\u52a0\u6bb5\u843d"},"add"),Object(Le.jsx)(he.a.Item,{danger:!0,icon:Object(Le.jsx)(Dt.a,{}),children:"\u5220\u9664\u6bb5\u843d"},"delete")]})}var Zt=n(245),Qt=n(246),en=function(e,t){var n=e.tieTo,r=y((function(t){var r=t.key;switch(!0){case"tie"===r:if(!n)return void(j.tieSourceKey=e.key);var o=M(e.tieTo).notation;o&&(o.tieTo=null),e.tieTo=null;break;case"break-underline"===r:e.breakUnderline=!e.breakUnderline;break;case r.startsWith("separator-"):var i=r.split("-",2)[1];e.note=i}}));return Object(Le.jsxs)(he.a,{onClick:r,style:{minWidth:"80px"},children:[T(e)&&Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(Zt.a,{}),children:e.breakUnderline?"\u5728\u6b64\u5904\u5ef6\u7eed\u589e\u51cf\u65f6\u7ebf":"\u5728\u6b64\u5904\u6253\u65ad\u589e\u51cf\u65f6\u7ebf"},"break-underline"),T(e)&&Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(Qt.a,{}),notation:e,children:e.tieTo?"\u5220\u9664\u8fde\u97f3\u7ebf":"\u4ece\u6b64\u5904\u6dfb\u52a0\u8fde\u97f3\u7ebf\u5230..."},"tie"),Object(Le.jsx)(he.a.Item,{icon:Object(Le.jsx)(Dt.a,{}),children:"\u5220\u9664\u7b26\u53f7"},"delete")]})};var tn=n(146),nn=n.n(tn);function rn(e){var t=e.offsetX,n=e.notation,r=(e.paragraph,y((function(){if(j.selectedNotationKey=n.key,j.shouldNotationBlurAfterClick=!1,j.tieSourceKey){if(j.tieSourceKey===n.key)return void(j.tieSourceKey=null);var e=M(j.tieSourceKey),t=e.notation,r=e.paragraph;if(!t)return void(j.tieSourceKey=null);r.notations.includes(n)?T(n)?(t.tieTo=n.key,n.tieTo=t.key):we.b.warn("\u53ea\u5141\u8bb8\u5728\u97f3\u7b26\u4e0a\u6dfb\u52a0\u8fde\u97f3\u7ebf\uff01"):we.b.warn("\u53ea\u5141\u8bb8\u76f8\u540c\u6bb5\u843d\u7684\u97f3\u7b26\u76f8\u8fde\uff01"),j.tieSourceKey=null}}))),o=ie.underlineStepOffsetY*(0|n.underline),i=n.octave>0?-ie.octaveInitialOffsetAbove:ie.octaveInitialOffsetBelow+o,a=(n.octave>0?-1:1)*ie.octaveStepOffsetY,c=0;n.octave>0&&(c=a*Math.abs(n.octave));return Object(Le.jsx)(wt,{inputType:"select",popoverProps:{trigger:"context"},overlay:en(n),children:Object(Le.jsxs)(St,{editable:!0,type:"notation",offsetX:t,onClick:r,className:j.selectedNotationKey===n.key?nn.a.selectedNotation:"",children:[function(){var e=n.prefixSups||[];return e.map((function(t,n){return Object(Le.jsx)(Tt,{dominantBaseline:"middle",textAnchor:"middle",fontSize:U.defaultSubFontSize,x:-ie.xWidth-(Q(e.slice(0,n).join(""))+2*n),y:-ie.subXHeight/2+2,children:t},n+t)}))}(),(n.topDecorators||[]).map((function(e,t){return Object(Le.jsx)(Tt,{dominantBaseline:"middle",textAnchor:"middle",fontSize:U.defaultSubFontSize,y:c-(t+1)*ie.subXHeight+2,children:e},t+e)})),function(){var e;return n.note===S&&(e="scale(0.8, 1)"),Object(Le.jsx)(Tt,{dominantBaseline:"middle",textAnchor:"middle",transform:e,children:n.note})}(),n.dotted&&Object(Le.jsx)("circle",{type:"dot",cx:ie.xWidth+4,cy:"-2",r:"2",fill:"currentColor"}),function(e){var t=Math.abs(Number(e));return Number.isInteger(t)?Array(t).fill(0,0,t):[]}(n.octave).map((function(e,t){return Object(Le.jsx)("circle",{type:"octave",cx:"0",cy:i+a*t,fill:"currentColor",r:"2"},t)}))]})})}rn.defaultProps={offsetX:0,offsetY:0};var on=Object(p.a)(rn);var an=Object(p.a)((function(e){var t,n=e.paragraph,r=e.offsetY,o=e.alignJustify,i=n.notations||[],a=[],c=0;if(o&&(null===(t=n.notations)||void 0===t?void 0:t.length)>1){var s=function(e){var t=e.notations||[];return 0===t.length?0:t.map((function(e){return oe(e)})).reduce((function(e,t){return e+t}),0)-U.gapBetweenNotation}(n);c=(ie.maxContentWidth-s)/(n.notations.length-1)}var l=i.map((function(e,t){return ie.xWidth/2+function(e){for(var t=0,n=0;n<e;n++){var r=i[n];a[n]=a[n]||oe(r),t+=a[n]}return t+ne(i[e])}(t)+c*t})),u=function(e,t,n){return Object(Le.jsx)("line",{x1:l[t]-ie.xWidth,x2:l[n]+ie.xWidth,y1:e,y2:e,stroke:"currentColor"},"".concat(t,"_").concat(n,"_").concat(e))};return Object(Le.jsxs)(St,{type:"paragraph",offsetY:r,children:[function(){var e=ee(n);return Object(Le.jsx)(wt,{inputType:"select",overlay:qt(n),children:Object(Le.jsx)("rect",{x:-ie.xWidth/2,y:-te(n),width:ie.maxContentWidth,height:e,fill:"transparent"})})}(),function(){for(var e=[],t=new Map,n=function(n){var r=i[n];if(r.tieTo){var o=i.findIndex((function(e){return e.key===r.tieTo}));if(o<=n)return"continue";for(var a=0,c=n;c<=o;++c){var s=void 0;t.has(i[c].key)?s=t.get(i[c].key):(s=-re(i[c]),t.set(i[c].key,s)),a=Math.min(a,s)}e.push(function(e,t,n){var r=l[t],o=r+4,i=l[n],a=i-4,c=i-r,s=21917145491103032e-21*c*c*c-.0062948773732605465*c*c+.6378785891964498*c-.6843414475200537,u=e-(s=Math.max(Math.min(s,ie.maxTieBezierOffset),ie.minTieHeight));return Object(Le.jsx)("path",{d:"M".concat(r," ").concat(e," C").concat(o," ").concat(u," ").concat(a," ").concat(u," ").concat(i," ").concat(e),stroke:"currentColor",fill:"none"},"".concat(t,"_").concat(n,"_").concat(e))}(a,n,o))}},r=0;r<i.length;++r)n(r);return e}(),n.notations.map((function(e,t){return Object(Le.jsx)(on,{notation:e,paragraph:n,offsetX:l[t]},e.key)})),function(){for(var e=[],t=i.map((function(e){return e.underline>0?e.underline:0})),n=ie.underlineInitialOffsetY;t.some((function(e){return e>0}));){for(var r=-1,o=r,a=0;a<i.length;++a){var c=i[a];t[a]>0?(r>=0?c.breakUnderline?(e.push(u(n,r,o)),r=o=a):o=a:r=o=a,a===i.length-1&&(e.push(u(n,r,o)),r=o=-1),--t[a]):r>=0&&(e.push(u(n,r,o)),r=o=-1)}n+=ie.underlineStepOffsetY}return e}()]})})),cn=n(114),sn=n.n(cn);var ln=Object(p.a)((function(){var e=[];function t(t){for(var n=U.paragraphs||[],r=0,o=0;o<t;o++){var i=n[o];e[o]=e[o]||ee(i)+U.gapBetweenParagraph,r+=e[o]}return r+=te(n[t])}var n=w((function(e){j.configDialogVisible=e})),o=w((function(e){j.helpDialogVisible=e}));return Object(r.useEffect)((function(){return document.addEventListener("keydown",Xe),function(){document.removeEventListener("keydown",Xe)}}),[]),Object(Le.jsxs)("div",{className:sn.a.container,style:{width:U.canvasWidth+"px"},children:[Object(Le.jsx)("div",{className:sn.a.headerWrapper,children:Object(Le.jsxs)("div",{className:sn.a.header,style:{width:U.canvasWidth+"px"},children:[Object(Le.jsx)(c.a,{overlay:Je,placement:"bottomLeft",children:Object(Le.jsx)(s.a,{icon:Object(Le.jsx)(l.a,{}),type:"text",children:"\u6587\u4ef6"})}),Object(Le.jsx)(c.a,{overlay:Ge,placement:"bottomLeft",children:Object(Le.jsx)(s.a,{icon:Object(Le.jsx)(u.a,{}),type:"text",children:"\u7f16\u8f91"})}),Object(Le.jsx)(c.a,{overlay:$e,placement:"bottomLeft",children:Object(Le.jsx)(s.a,{icon:Object(Le.jsx)(d.a,{}),type:"text",children:"\u8f6c\u8c03"})}),Object(Le.jsx)(s.a,{icon:Object(Le.jsx)(f.a,{}),type:"text",onClick:function(){n(!0)},children:"\u914d\u7f6e"}),Object(Le.jsx)(s.a,{icon:Object(Le.jsx)(h.a,{}),type:"text",onClick:function(){o(!0)},children:"\u5e2e\u52a9"})]})}),Object(Le.jsxs)(nt,{onClick:Ue,children:[Object(Le.jsx)(Yt,{}),Object(Le.jsx)(St,{offsetX:U.marginHorizontal,offsetY:ie.headerOffsetY,children:U.paragraphs.map((function(e,n){var r=e.alignJustify;return"boolean"!==typeof r&&(r=!(n===U.paragraphs.length-1)),Object(Le.jsx)(an,{paragraph:e,offsetY:t(n),alignJustify:r},e.key)}))})]}),Object(Le.jsx)(dt,{visible:j.configDialogVisible,onVisibleChange:n}),Object(Le.jsx)(Gt,{visible:j.helpDialogVisible,onVisibleChange:o})]})}));function un(){return(un=Object(ke.a)(ye.a.mark((function e(){var t;return ye.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!/(\?|&)loadExample(&|$)/.test(window.location.search)){e.next=6;break}return e.next=4,n.e(4).then(n.t.bind(null,252,3));case 4:t=e.sent,z(t.default);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var dn=function(){return Object(r.useEffect)((function(){!function(){un.apply(this,arguments)}()}),[]),Object(Le.jsx)(Y.Provider,{value:U,children:Object(Le.jsx)(ln,{})})},fn=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,253)).then((function(t){var n=t.getCLS,r=t.getFID,o=t.getFCP,i=t.getLCP,a=t.getTTFB;n(e),r(e),o(e),i(e),a(e)}))};n(228);a.a.render(Object(Le.jsx)(o.a.StrictMode,{children:Object(Le.jsx)(dn,{})}),document.getElementById("root")),fn()},58:function(e,t,n){e.exports={list:"HelpModal_list__syZn2",listItem:"HelpModal_listItem__34m_q",kbd:"HelpModal_kbd__RCRud"}},78:function(e,t,n){e.exports={popover:"PopoverOnSvg_popover__3bN4H",arrow:"PopoverOnSvg_arrow__22-aj",content:"PopoverOnSvg_content__1rAgR",header:"PopoverOnSvg_header__URzxW"}},79:function(e,t,n){e.exports={buttonGroup:"EditableContent_buttonGroup__2qXGn",button:"EditableContent_button__6qyvP",menu:"EditableContent_menu__2ah_9",menuItem:"EditableContent_menuItem__3P1Eu"}}},[[229,1,2]]]);
//# sourceMappingURL=main.e0740145.chunk.js.map