diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz
index 91650ac..0363520 100644
Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ
diff --git a/packages/chord-chart-studio/SLOC b/packages/chord-chart-studio/SLOC
index 7b237b6..942db71 100644
--- a/packages/chord-chart-studio/SLOC
+++ b/packages/chord-chart-studio/SLOC
@@ -2,17 +2,17 @@ Source code:
---------- Result ------------
- Physical : 6960
- Source : 5791
- Comment : 169
+ Physical : 7129
+ Source : 5924
+ Comment : 173
Single-line comment : 80
- Block comment : 89
+ Block comment : 93
Mixed : 14
Empty block comment : 0
- Empty : 1014
+ Empty : 1046
To Do : 0
-Number of files read : 162
+Number of files read : 164
----------------------------
@@ -38,17 +38,17 @@ Total:
---------- Result ------------
- Physical : 14298
- Source : 11816
- Comment : 238
+ Physical : 14467
+ Source : 11949
+ Comment : 242
Single-line comment : 142
- Block comment : 96
+ Block comment : 100
Mixed : 25
Empty block comment : 0
- Empty : 2269
+ Empty : 2301
To Do : 0
-Number of files read : 229
+Number of files read : 231
----------------------------
diff --git a/packages/chord-chart-studio/build/assets/index-BHxJF9L-.js b/packages/chord-chart-studio/build/assets/index-BHxJF9L-.js
new file mode 100644
index 0000000..d829c5c
--- /dev/null
+++ b/packages/chord-chart-studio/build/assets/index-BHxJF9L-.js
@@ -0,0 +1,60 @@
+import{c as Nt,_ as Tt,a as St,d as wt,b as _t,e as qe,f as k,g as B,p as Q,h as Et,i as Pt,j as qt,k as It,t as Mt,v as Ie,R as C,l as r,P as i,m as Me,n as Ot,U as Lt,o as kt,q as Oe,I as Bt,r as At,$ as Dt,u as Le,s as R,w as Fe,x as Wt,y as T,z as Ne,A as Gt,B as Ht,C as $t,D as zt,E as Vt,F as Ut,G as Kt,H as Te,J as Yt,K as Jt,L as Qt,S as Xt,M as Zt,N as en,O as tn,Q as nn,T as Se,V as rn}from"./vendor-3z0Gt4wU.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();const sn=()=>{try{const e=localStorage.getItem("state");return e?JSON.parse(e):void 0}catch{return}},on=e=>{try{const t=JSON.stringify(e);localStorage.setItem("state",t)}catch{}};function ke(){return Date.now()}const A="db/files/Create",D="db/files/Delete",M="db/files/Import",X="db/files/Update",Z="db/options/setOptionValue",W="ui/layout/app/setEditorMode",Be="ui/layout/app/toggleLeftBar",Ae="ui/layout/app/toggleRightBar",an=e=>e.ui.layout.app.isLeftBarCollapsed,ln=e=>e.ui.layout.app.isRightBarCollapsed,P=e=>e.ui.layout.app.editorMode,S=e=>e.fileManager.selected,cn=e=>e.fileManager.renamed,dn=e=>e.fileManager.defaultTitle,un=Nt(wt,_t),ee=un(e=>Tt(e.db.files.allFiles,({title:t,id:n})=>({title:t,id:n})),e=>St(e,t=>t.title.toLowerCase())),te=(e,t)=>e.db.files.allFiles[t],ne=(e,t,n)=>{const s=e.db.files.allFiles[t];if(s&&(s.options||{})[n])return Object.keys(s.options[n]).length===0?void 0:qe(s.options[n])},De=(e,t)=>{const n=e.db.files.allFiles[t];if(!n)return;const s=n.options||{},o=[];if(s.edit&&o.push({...s.edit}),s.play&&o.push({...s.play}),s.print&&o.push({...s.print}),s.export&&o.push({...s.export}),!!o.length)return o.sort((a,l)=>a.updatedAt-l.updatedAt),o.reduce((a,l)=>Object.assign(a,l),{})},re={edit:["theme","transposeValue","preferredAccidentals","symbolType"],play:["theme","transposeValue","preferredAccidentals","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy","columnsCount","fontSize"],print:["transposeValue","preferredAccidentals","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy","columnsCount","columnBreakOnSection","documentMargins","fontSize"],export:["chartFormat","transposeValue","preferredAccidentals","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy"]},pn={allFiles:{}};function mn(e,t){const{id:n,title:s,content:o}=t.payload,a={...e.allFiles};return a[n]={id:n,title:s,content:o},{...e,allFiles:a}}function hn(e,t){const{id:n,title:s,content:o}=t.payload;if(!s&&typeof o>"u"||!e.allFiles[n])return e;const a={...e.allFiles};return a[n]={...a[n]},s&&(a[n].title=s),typeof o<"u"&&(a[n].content=o),{...e,allFiles:a}}function gn(e,t){const{id:n}=t.payload;if(!n||!e.allFiles[n])return e;const s={...e.allFiles};return delete s[n],{...e,allFiles:s}}function fn(e,t,n){const{context:s,key:o,value:a}=t.payload,l=S(n),c={...e.allFiles};if(["songFormatting","songPreferences"].includes(s)&&c[l]){const d=P(n),u=s==="songPreferences"?"preferences":d;return c[l]=yn(c[l],u,o,a),{...e,allFiles:c}}return e}function yn(e,t,n,s){return{...e,options:{...e.options,[t]:{...(e.options||{})[t],updatedAt:ke(),[n]:s}}}}function bn(e,t,n){const s=S(n),o=t.payload.mode;if(!!!ne(n,s,o)){const l=k(De(n,s)||{},re[o]);if(Object.keys(l).length){l.updatedAt=ke();const c={...e.allFiles};return c[s]={...c[s],options:{...c[s].options,[o]:l}},{...e,allFiles:c}}}return e}const xn=(e=pn,t={},n={})=>{switch(t.type){case A:case M:return mn(e,t);case X:return hn(e,t);case D:return gn(e,t);case Z:return fn(e,t,n);case W:return bn(e,t,n)}return e},se="fileManager/select",We="fileManager/enableRename",p=(e,t,n)=>{if(!(!e.db.options[t]||!e.db.options[t].values||typeof e.db.options[t].values[n]>"u"))return e.db.options[t].values[n]},I=(e,t)=>{if(!(!e.db.options[t]||!e.db.options[t].defaults))return qe(e.db.options[t].defaults)},Cn={};function jn(e,t){const{context:n,key:s,value:o}=t.payload;if(!e[n]||!e[n].values||typeof e[n].values[s]>"u")return e;const a={...e,[n]:{...e[n],values:{...e[n].values}}};return a[n].values[s]=o,a}function Rn(e,t,n){const s=S(n),o=t.payload.mode,a=Ge(n,s,o);return{...e,songFormatting:{...e.songFormatting,values:{...a}}}}function Ge(e,t,n){const s=I(e,"songFormatting");let o=ne(e,t,n);return o||(o=De(e,t)||{}),delete o.updatedAt,o=k(o,re[n]),Object.assign(s,o)}function vn(e,t,n){const{id:s}=t.payload,o=P(n),a=Ge(n,s,o),l=ne(n,s,"preferences")||{};delete l.updatedAt;const c=I(n,"songPreferences"),d=Object.assign(c,l);return{...e,songPreferences:{...e.songPreferences,values:{...d}},songFormatting:{...e.songFormatting,values:{...a}}}}const Fn=(e=Cn,t={},n={})=>{switch(t.type){case Z:return jn(e,t);case W:return Rn(e,t,n);case se:return vn(e,t,n)}return e},Nn=B({files:xn,options:Fn}),Tn={selected:"",renamed:"",defaultTitle:"[untitled]"};function Sn(e=Tn,t={}){switch(t.type){case A:{const{id:n}=t.payload;return{...e,selected:n,renamed:n}}case M:{const{id:n}=t.payload;return{...e,selected:n,renamed:""}}case X:return{...e,renamed:""};case D:return{...e,selected:"",renamed:""};case se:{const{id:n}=t.payload;return{...e,selected:n,renamed:n===e.renamed?n:""}}case We:{const{id:n}=t.payload;return{...e,renamed:n}}}return e}const He="songImporter/import/cancel",ie="songImporter/import/start",$e="songImporter/setContent",ze="songImporter/setInputFormat";function q(e){return Q.sanitize(e,{ALLOWED_TAGS:["#text"],KEEP_CONTENT:!0})}const wn={content:"",isFromWeb:!1,isImporting:!1,inputFormat:"auto",title:""};function _n(e=wn,t={}){switch(t.type){case $e:{const{content:n,title:s=""}=t.payload;return{...e,content:q(n),title:s?q(s):e.title}}case ze:{const{inputFormat:n}=t.payload;return{...e,inputFormat:n}}case M:case He:return{...e,content:"",title:"",isImporting:!1};case ie:{const{content:n,inputFormat:s,title:o,isFromWeb:a}=t.payload;return{...e,isImporting:!0,content:n?q(n):"",title:o?q(o):"",inputFormat:s||e.inputFormat,isFromWeb:a}}}return e}const En={isLeftBarCollapsed:!1,isRightBarCollapsed:!1,editorMode:"edit",activeModal:"none"};function Pn(e=En,t={}){switch(t.type){case Be:return{...e,isLeftBarCollapsed:!e.isLeftBarCollapsed};case Ae:return{...e,isRightBarCollapsed:!e.isRightBarCollapsed};case W:{const{mode:n}=t.payload;return{...e,editorMode:n}}case D:case A:case M:return{...e,editorMode:"edit"}}return e}const qn=B({app:Pn}),In=B({layout:qn}),Mn=B({db:Nn,fileManager:Sn,songImporter:_n,ui:In}),On={editorPreferences:{values:{theme:"dark1",chartFormat:"chordmark"},defaults:{theme:"dark1",chartFormat:"chordmark"}},songPreferences:{values:{transposeValue:0,preferredAccidentals:"auto",symbolType:"chord"},defaults:{transposeValue:0,preferredAccidentals:"auto",symbolType:"chord"}},songFormatting:{values:{chartType:"all",alignChordsWithLyrics:!0,alignBars:!0,autoRepeatChords:!0,expandSectionCopy:!0,fontSize:0,columnsCount:1,columnBreakOnSection:!0,documentMargins:3},defaults:{chartType:"all",alignChordsWithLyrics:!0,alignBars:!0,autoRepeatChords:!0,expandSectionCopy:!0,fontSize:0,columnsCount:1,columnBreakOnSection:!0,documentMargins:3}}},Ln={options:On},kn={db:Ln};let L;function Bn(){const e=Et(Pt(Mt)),t=sn();t&&t.db&&t.db.options&&delete t.db.options.rendering;const n=qt(t,kn);L=It(Mn,n,e),L.subscribe(()=>{on(L.getState())})}function G(){return L}function v(e,t){if(!e)throw new TypeError("Cannot create an action without an action type");return{type:e,payload:t}}const An=(e,t)=>v($e,{content:e,title:t}),Dn=e=>v(ze,{inputFormat:e}),Wn=()=>v(ie,{isFromWeb:!1}),Gn=(e,t,n)=>v(ie,{content:t,inputFormat:e,title:n,isFromWeb:!0}),Hn=()=>v(He),$n={"@CCS/IMPORT_TAB":e=>{const t=G(),n=zn(e.title,e.artist);t.dispatch(Gn(e.inputFormat,e.chordChart,n))}},zn=(e,t)=>"_"+(t?t+" - ":"")+e;function Vn(){return $n}function Un(){window.addEventListener("message",Kn)}const Kn=e=>{const t={...Vn()};if(e.source!==window||e.origin!==window.location.origin)return!1;const n=e.data;return typeof t[n.type]=="function"&&t[n.type](n.payload),!0},Yn=(e,t="")=>{if(!e)throw new TypeError("Cannot create a file without title");const n={id:Ie(),title:e,content:t};return v(A,n)},K=(e,t="")=>{if(!e)throw new TypeError("Cannot import a file without title");const n={id:Ie(),title:e,content:t};return v(M,n)},Ve=(e,{title:t,content:n}={})=>{if(!e)throw new TypeError("Cannot update a file without an id");return v(X,{id:e,title:t,content:n})},Jn=e=>v(D,{id:e}),Qn=`Welcome to Chord Chart Studio!
+
+Chord Chart Studio is the official editor of the ChordMark format.
+You can use it to quickly write accurate transcription of songs made up of chords and lyrics.
+
+A % D7.. E7..
+_Just write _some chords, some _lyrics
+%
+_And see how it _looks: _terrific!
+
+Where to start? You can either:
+- check the sample song on the left
+- read the user guide, by clicking the big yellow button in the top right corner
+
+Have fun!
+`,Xn=`#i
+C.. Am.. %
+%
+
+#v
+C.. Am..
+I _heard there was a _secret chord
+%
+That _David played and it _pleased the lord
+F... G. C.. G..
+But _you don't really care for _music, _do you?
+C.. F. G.
+Well it _goes like this the _fourth, the _fifth
+Am.. F..
+The _minor fall and the _major lift
+G.. E7.. Am
+The _baffled king com_posing halle_lujah
+
+#c
+F
+Halle_lujah
+Am
+Halle_lujah
+F
+Halle_lujah
+C.. G.. C.. Am..
+Halle_lu_u_jah
+
+#v
+Well, your _faith was strong but you _needed proof
+You _saw her bathing _on the roof
+Her _beauty and the moonlight _over_threw you
+She _tied you to her _kitchen _chair
+She _broke your throne and she _cut your hair
+And _from your lips she _drew the halle_lujah
+
+#c
+`;function Zn(){const e=G(),t=e.getState();ee(t).length===0&&(e.dispatch(K("Hallelujah - Leonard Cohen",Xn)),e.dispatch(K("Getting started",Qn)))}class Ue extends C.Component{constructor(t){super(t),this.state={error:null,errorInfo:null}}componentDidCatch(t,n){this.setState({error:t,errorInfo:n})}render(){return this.state.errorInfo?r.jsxs("div",{className:"ErrorBoundary",children:[r.jsx("h2",{children:"Something went wrong"}),r.jsxs("details",{style:{whiteSpace:"pre-wrap"},open:!0,children:[this.state.error&&this.state.error.toString(),r.jsx("br",{}),this.state.errorInfo.componentStack]})]}):this.props.children}}Ue.propTypes={children:i.any};let V;function er(e,t){const n=document.getElementById("app");V||(V=Me(n)),V.render(r.jsx(Ot,{store:G(),children:r.jsx(C.StrictMode,{children:r.jsx(Ue,{children:r.jsx(e,{...t})})})}))}var tr={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const nr={base:tr.VITE_BASE||""};let Y,Ke;const rr={init(e){const t=e.map(n=>({...n,path:nr.base+n.path,action:s=>({Controller:n.action,params:s.params})}));Y=new Lt(t,{errorHandler(n,s){console.error(`Error: Cannot find route for path: ${s.pathname}`)}}),Ke=kt(Y,{stringifyQueryParams:Oe.stringify})}};function H(e,t=!0){const n=new URL(e,window.location.origin);return Y.resolve(n.pathname).then(({Controller:s,params:o}={})=>{if(s){t&&sr(e);const a=Oe.parse(n.search,{ignoreQueryPrefix:!0});er(s,{...o,...a})}})}function Ye(e,t){try{return Ke(e,t)}catch(n){console.error(n.toString())}}function sr(e){window.history.pushState({url:e},null,e)}window.addEventListener("popstate",()=>{const e=window.location.pathname+window.location.search;H(e,!1)});const ir="_button_18d4b_1",or="_icon_18d4b_8",ar="_label_18d4b_8",lr="_primary_18d4b_41",cr="_secondary_18d4b_58",dr="_tertiary_18d4b_76",E={button:ir,icon:or,label:ar,primary:lr,secondary:cr,tertiary:dr};function ur({id:e,size:t}){let n;switch(e){case"plus":n=At;break;case"import":n=Bt;break}return r.jsx(n,{size:t})}const we="primary";function pr({children:e,type:t=we,icon:n="",onPress:s}){const o=[E.button,E[t]?E[t]:E[we]],a=n?r.jsx("span",{className:E.icon,children:r.jsx(ur,{id:n,size:20})}):"";return r.jsxs(Dt,{onPress:s,className:o.join(" "),children:[a,r.jsx("span",{className:E.label,children:e})]})}function mr(){const t=Le(ee).map(n=>r.jsx(hr,{song:n},n.id));return r.jsxs("div",{children:["Full Library",r.jsx("ul",{children:t}),r.jsx(pr,{children:"My Nice Button"})]})}const hr=({song:e})=>{const t=n=>{n.preventDefault(),H(Ye("songView",{songId:e.id}))};return r.jsx("li",{children:r.jsx("a",{href:`/song/${e.id}`,onClick:t,children:e.title})})},gr=[{name:"library",path:"/library",action:mr}];function fr({songId:e}){const t=Le(s=>te(s,e)),n=s=>{s.preventDefault(),H(Ye("library"))};return r.jsxs("div",{children:[r.jsx("a",{href:"",onClick:n,children:"Go back to list"}),r.jsx("br",{}),r.jsx("b",{children:t.title}),r.jsx("p",{children:t.content})]})}const yr=[{name:"songView",path:"/songView/:songId",action:fr}],Je=e=>v(W,{mode:e}),br=()=>v(Be),xr=()=>v(Ae),Cr="/assets/logo-D2B3txiq.svg";function jr(){return r.jsx("div",{className:"logo",children:r.jsx("div",{className:"logo-isExpanded",children:r.jsx("div",{className:"logo-img",children:r.jsxs("svg",{className:"stacked",children:[r.jsx("title",{children:"Chord Chart Studio"}),r.jsx("use",{href:Cr+"#stacked"})]})})})})}const Rr=C.memo(jr);function Qe(e){const{iconName:t}=e,n=["icon","material-icons"];return r.jsx("i",{className:n.join(" "),children:t})}Qe.propTypes={iconName:i.string.isRequired};const x=C.memo(Qe);function Xe(e){const{label:t,icon:n,editorMode:s,setEditorMode:o,isActive:a,isDisabled:l}=e,c=["mainNavEntry"];a&&c.push("mainNavEntry-isActive"),l&&c.push("mainNavEntry-isDisabled");function d(){l||o(s)}return r.jsxs("li",{className:c.join(" "),onClick:d,children:[r.jsx("span",{className:"mainNavEntry-icon",children:r.jsx(x,{iconName:n})}),t]})}Xe.propTypes={label:i.string.isRequired,icon:i.string.isRequired,editorMode:i.string.isRequired,setEditorMode:i.func.isRequired,isActive:i.bool.isRequired,isDisabled:i.bool.isRequired};const vr=C.memo(Xe);function Ze(e){const{currentMode:t,allEntries:n,setEditorMode:s,selectedId:o}=e;return r.jsx("nav",{className:"mainNav",children:r.jsx("ul",{className:"mainNav-entries",children:n.map((a,l)=>r.jsx(vr,{isActive:!!o&&a.editorMode===t,isDisabled:!o,setEditorMode:s,...a},l))})})}Ze.propTypes={currentMode:i.string.isRequired,setEditorMode:i.func.isRequired,selectedId:i.string,allEntries:i.arrayOf(i.shape({id:i.string.isRequired,label:i.string.isRequired,icon:i.string.isRequired,editorMode:i.string.isRequired}))};const Fr=C.memo(Ze),_=({children:e,isDisabled:t,buttonName:n,onClick:s,type:o})=>{const a=["Button"];return o==="primary"&&a.push("Button-primary"),o==="secondary"&&a.push("Button-secondary"),t&&a.push("Button-isDisabled"),r.jsx("button",{className:a.join(" "),disabled:t,type:"button",name:n,onClick:s,children:e})};_.propTypes={children:i.string.isRequired,isDisabled:i.bool,buttonName:i.string.isRequired,type:i.string.isRequired,onClick:i.func.isRequired};_.defaultProps={isDisabled:!1};const Nr="https://chord-chart-studio.netlify.app",oe=()=>{const e=()=>{window.open(Nr,"_blank").focus()};return r.jsxs("div",{className:"userGuide",children:[r.jsx("div",{className:"userGuide-isCollapsed",children:r.jsx(x,{iconName:"help_outline"})}),r.jsx("div",{className:"userGuide-isExpanded",children:r.jsx(_,{buttonName:"userGuide",type:"primary",onClick:e,children:"User Guide"})})]})};oe.propTypes={};oe.defaultProps={};const Tr=C.memo(oe),Sr=()=>({"chord-chart-studio":"v0.14.0","chord-symbol":"v4.0.0","chord-mark":"v0.16.2"});function wr(){const e=Sr();return r.jsx("div",{className:"versions",children:r.jsxs("div",{className:"versions-isExpanded",children:["Chord Chart Studio ",e["chord-chart-studio"],r.jsx("br",{}),"ChordSymbol ",e["chord-symbol"]," ",r.jsx("br",{}),"ChordMark ",e["chord-mark"]," ",r.jsx("br",{}),"Logo by"," ",r.jsx("a",{href:"https://spelling-bee-assistant.app/",target:"_blank",rel:"noreferrer",children:"Dieter Raber"})]})})}const _r=C.memo(wr),Er=e=>e.songImporter.content,Pr=e=>e.songImporter.inputFormat,qr=e=>e.songImporter.title,Ir=e=>e.songImporter.isImporting,Mr=e=>e.songImporter.isFromWeb;function ae(e){const{children:t,closeModal:n}=e;return R.useEffect(()=>{const s=o=>{o.key==="Escape"&&n()};return window.addEventListener("keyup",s),()=>{window.removeEventListener("keyup",s)}}),r.jsxs("section",{className:"mod-ModalContainer",children:[r.jsx("div",{className:"mod-Overlay",onClick:n,"data-testid":"modal-overlay"}),r.jsx("div",{className:"mod-ContentContainer",children:t})]})}ae.propTypes={children:i.element.isRequired,closeModal:i.func.isRequired};const et=({cancelImport:e,chordMarkContent:t,importFile:n,title:s,content:o,error:a})=>{const l=s?'Import "'+s+'"':"Import song",c=()=>{n(s||"[untitled]",t)};return r.jsxs("div",{className:"sim-Header_Container",children:[r.jsx("div",{className:"sim-Header_Title",children:l}),r.jsxs("div",{className:"sim-Header_Actions",children:[r.jsx(_,{onClick:e,buttonName:"cancel",type:"secondary",children:"CANCEL"}),r.jsx(_,{onClick:c,buttonName:"import",type:"primary",isDisabled:o===""||a!=="",children:"IMPORT"})]})]})};et.propTypes={cancelImport:i.func.isRequired,chordMarkContent:i.string,content:i.string,error:i.string,importFile:i.func.isRequired,title:i.string};const tt=50*1024,Or=e=>new Promise((t,n)=>{if(e.length){const s=e[0];kr(s)?n(Ar(s.size)):Br(s)?s.text().then(o=>{t({content:o,title:Lr(s)})}).catch(o=>{n(o)}):n(Dr(s))}else n(Wr())}),Lr=e=>e.name.substr(0,e.name.lastIndexOf(".")),kr=e=>e.size>tt,Br=e=>e.type.indexOf("text")===0||e.type.length===0,Ar=e=>"The selected file is too big: "+Fe(e,{round:0})+" (maximum allowed file size is "+Fe(tt,{round:0})+").",Dr=e=>"Cannot import file of type "+e.type+".",Wr=()=>"No file selected.",Gr="text/*,.cho,.crd,.chopro,.chord,.pro,.txt,.md",nt=({setContent:e})=>{const t=n=>{Or(n.target.files).then(s=>{e(s.content,s.title)}).catch(s=>{e(s)})};return r.jsxs("div",{children:[r.jsx("label",{htmlFor:"importSong-Input",className:"Button Button-primary",children:"Select File"}),r.jsx("input",{id:"importSong-Input",name:"importSong-Input",type:"file",className:"sim-InputFile_Input",onChange:t,accept:Gr})]})};nt.propTypes={setContent:i.func.isRequired};function le(e){const{content:t,setContent:n,isDisabled:s}=e,o=l=>{n(l.target.value)},a=["sim-Input_Textarea"];return s&&a.push("sim-Input_Textarea-Disabled"),r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"sim-Input_Header",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"Copy/paste below",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsx("textarea",{className:a.join(" "),onChange:o,value:t,disabled:s,"data-testid":"sim-input"})]})}le.propTypes={content:i.string.isRequired,isDisabled:i.bool.isRequired,setContent:i.func.isRequired};le.defaultProps={};function ce(e){const{inputFormat:t,error:n}=e;return r.jsxs("div",{className:"sim-Preview_Error",children:[r.jsxs("p",{children:["There was an error when trying to parse the song in the specified input format (",t,").",r.jsx("br",{}),"Please correct the input or try another format.",r.jsx("br",{}),"The error was:"]}),r.jsxs("p",{children:['"',n,'"']}),r.jsx("p",{children:'Hint: most of the time, this is related to an unclosed "[" or "{" or an unsupported ChordPro directive'})]})}ce.propTypes={error:i.string,inputFormat:i.string.isRequired};ce.defaultProps={};function de(e){const{setInputFormat:t,inputFormat:n,id:s,label:o,isDisabled:a}=e,l=u=>{a||t(u.target.value)},c=["sim-InputFormat_Entry"],d=["sim-InputFormat_Label"];return a&&(c.push("sim-InputFormat_Entry-Disabled"),d.push("sim-InputFormat_Label-Disabled")),r.jsxs(r.Fragment,{children:[r.jsx("input",{className:c.join(" "),type:"radio",name:"inputFormat",id:s,value:s,onChange:l,checked:n===s}),r.jsx("label",{className:d.join(" "),htmlFor:s,children:o})]})}de.propTypes={setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired,id:i.string.isRequired,label:i.string.isRequired,isDisabled:i.bool.isRequired};de.defaultProps={};const Hr=[{id:"auto",label:"Detect"},{id:"chordPro",label:"Bracketed chords (ChordPro)"},{id:"chordsOverLyrics",label:"Chords over lyrics (Ultimate Guitar...)"}];function ue(e){const{setInputFormat:t,inputFormat:n,disableAll:s}=e,o=Hr.map(a=>r.jsx(de,{setInputFormat:t,id:a.id,label:a.label,inputFormat:n,isDisabled:s},a.id));return r.jsxs("div",{className:"sim-InputFormat",children:["Input format:",o]})}ue.propTypes={disableAll:i.bool.isRequired,setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired};ue.defaultProps={};function pe(e){const{cancelImport:t,content:n,importFile:s,isFromWeb:o,isImporting:a,setContent:l,setInputFormat:c,inputFormat:d,title:u}=e;if(!a)return null;let h="",m="";try{h=Wt(n,{inputFormat:d})}catch(f){m=f.message}return r.jsx(ae,{closeModal:t,children:r.jsxs("div",{className:"sim-SongImporterModal_Container","data-testid":"song-importer",children:[r.jsx(et,{cancelImport:t,chordMarkContent:h,content:n,error:m,importFile:s,title:u}),r.jsxs("div",{className:"sim-TwoColumns_Container",children:[r.jsx("div",{className:"sim-Column_Container",children:r.jsx(nt,{setContent:l})}),r.jsx("div",{className:"sim-Column_Container",children:r.jsx(ue,{inputFormat:d,setInputFormat:c,disableAll:o===!0})})]}),r.jsxs("div",{className:"sim-TwoColumns_Container sim-TwoColumns_Container-autoHeight",children:[r.jsx("div",{className:"sim-Column_Container",children:r.jsx(le,{content:n,setContent:l,isDisabled:o})}),r.jsxs("div",{className:"sim-Column_Container",children:[r.jsxs("div",{className:"sim-Input_Header",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"ChordMark preview",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsx("div",{className:"sim-Preview_Container","data-testid":"sim-preview",children:m?r.jsx(ce,{inputFormat:d,error:m}):h})]})]})]})})}pe.propTypes={cancelImport:i.func.isRequired,content:i.string.isRequired,importFile:i.func.isRequired,isFromWeb:i.bool.isRequired,isImporting:i.bool.isRequired,setContent:i.func.isRequired,setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired,title:i.string};pe.defaultProps={};const $r=T(e=>({content:Er(e),isFromWeb:Mr(e),isImporting:Ir(e),inputFormat:Pr(e),title:qr(e)}),{setContent:An,setInputFormat:Dn,cancelImport:Hn,importFile:K})(pe),zr=[{id:"edit",label:"Edit",icon:"create",editorMode:"edit"},{id:"play",label:"Screen view",icon:"music_note",editorMode:"play"},{id:"print",label:"Print/PDF Preview",icon:"print",editorMode:"print"},{id:"export",label:"Export Preview",icon:"save_alt",editorMode:"export"}];function me(e){const{editorMode:t,isLeftBarCollapsed:n,isRightBarCollapsed:s,toggleLeftBar:o,toggleRightBar:a,setEditorMode:l,selectedId:c,leftBar:d,rightBar:u}=e,h=["leftBar"];n&&h.push("leftBar-isCollapsed");const m=["rightBar"];return s&&m.push("rightBar-isCollapsed"),r.jsxs("div",{className:"appLayout-wrapper",children:[r.jsx($r,{}),r.jsxs("section",{className:h.join(" "),children:[r.jsxs("div",{className:"leftBar-content",onClick:n?o:null,children:[r.jsx(Rr,{}),d]}),r.jsx("div",{className:"leftBar-collapser",onClick:o,"data-testid":"leftBar-collapser",children:r.jsx("span",{className:"leftBar-collapserIcon",children:r.jsx(x,{iconName:"keyboard_arrow_left"})})})]}),r.jsxs("section",{className:"appLayout-main",children:[r.jsx("section",{className:"appLayout-header",children:r.jsx(Fr,{allEntries:zr,currentMode:t,setEditorMode:l,selectedId:c})}),r.jsx("section",{className:"appLayout-content",children:e.children})]}),r.jsxs("section",{className:m.join(" "),children:[r.jsx("div",{className:"rightBar-collapser",onClick:a,"data-testid":"rightBar-collapser",children:r.jsx("span",{className:"rightBar-collapserIcon",children:r.jsx(x,{iconName:"keyboard_arrow_right"})})}),r.jsxs("div",{className:"rightBar-content",onClick:s?a:null,children:[r.jsx(Tr,{}),u,r.jsx(_r,{})]})]})]})}me.propTypes={children:i.element,isLeftBarCollapsed:i.bool,isRightBarCollapsed:i.bool,selectedId:i.string,toggleLeftBar:i.func.isRequired,toggleRightBar:i.func.isRequired,editorMode:i.string.isRequired,setEditorMode:i.func.isRequired,leftBar:i.element.isRequired,rightBar:i.element.isRequired};me.defaultProps={isLeftBarCollapsed:!1,isRightBarCollapsed:!1};const Vr=T(e=>({editorMode:P(e),isLeftBarCollapsed:an(e),isRightBarCollapsed:ln(e),selectedId:S(e)}),{toggleLeftBar:br,toggleRightBar:xr,setEditorMode:Je})(me),Ur=e=>v(se,{id:e}),Kr=e=>v(We,{id:e});function Yr(e,t={},n=!1){return st(e,t,n,"text")}function rt(e,t={},n=!1){return st(e,t,n,"html")}function st(e,t,n,s){if(n)switch(t.chartFormat){case"chordmark":{const a=O(e,t);return s==="html"?a:_e(a)}case"chordmarkSrc":return s==="html"?U(e):e;case"chordpro":{t.customRenderer=$t();const a=O(e,t);return s==="html"?U(a):a}case"ultimateGuitar":{t.customRenderer=Ne();const a=O(e,{...t,customRenderer:Ne(),printBarSeparators:"grids",printChordsDuration:"never",printSubBeatDelimiters:!1,printInlineTimeSignatures:!1,chordSymbolRenderer:Gt({customFilters:[Ht()],useShortNamings:!0,accidentalsType:t.accidentalsType==="auto"?"original":t.accidentalsType,...t})})+`
+
+Created with Chord Chart Studio (https://chord-chart-studio.netlify.app)`;return s==="html"?U(a):a}}const o=O(e,{...t,wrapChordLyricLines:!0});return s==="html"?o:_e(o)}function O(e,t){try{const n=zt(e);return Vt(n,{...t})}catch(n){return n.message}}function U(e){return e.split(`
+`).map(t=>t===""?" ":t).map(t=>`${t}`).join("")}function _e(e){return e.match(/(
.*?<\/p>)/gm).map(n=>q(n)).map(n=>n===" "?"":n).join(`
+`)}function Jr(){const t=G().getState(),n=S(t),s=te(t,n),o={chartFormat:p(t,"editorPreferences","chartFormat"),transposeValue:p(t,"songPreferences","transposeValue"),accidentalsType:p(t,"songPreferences","accidentalsType"),symbolType:p(t,"songPreferences","symbolType"),chartType:p(t,"songFormatting","chartType"),alignChordsWithLyrics:p(t,"songFormatting","alignChordsWithLyrics"),alignBars:p(t,"songFormatting","alignBars"),autoRepeatChords:p(t,"songFormatting","autoRepeatChords"),expandSectionCopy:p(t,"songFormatting","expandSectionCopy")},a=Yr(s.content,o,!0),l=o.chartFormat==="chordpro"?"cho":"txt",c=`${s.title}.${l}`,d=new Blob([a],{type:"text/plain;charset=utf-8",endings:"native"});Ut.saveAs(d,c)}function it(e){const{confirmAction:t,confirmTitle:n="OK",cancelAction:s,cancelTitle:o="CANCEL",children:a}=e;return r.jsx(ae,{closeModal:s,children:r.jsxs("section",{className:"mod-ModalConfirmContainer",children:[r.jsx("div",{className:"mod-ModalConfirmMessage",children:a}),r.jsxs("div",{className:"mod-ModalConfirmButtons",children:[r.jsx(_,{onClick:s,type:"secondary",buttonName:"cancel",children:o}),r.jsx(_,{onClick:t,type:"primary",buttonName:"confirm",children:n})]})]})})}it.propTypes={confirmAction:i.func.isRequired,confirmTitle:i.string,cancelAction:i.func.isRequired,cancelTitle:i.string,children:i.node.isRequired};function ot(e){const{selected:t,deleteFile:n,isDeleting:s,setIsDeleting:o}=e;if(!s)return null;const a=()=>o(!1),l=()=>{o(!1),n(t)};return r.jsxs(it,{confirmAction:l,confirmTitle:"DELETE",cancelAction:a,children:["Are you sure you want to delete this file?",r.jsx("br",{}),"This action cannot be undone."]})}ot.propTypes={deleteFile:i.func.isRequired,isDeleting:i.bool.isRequired,selected:i.string.isRequired,setIsDeleting:i.func.isRequired};function at(e){const{icon:t,text:n,action:s,isDisabled:o}=e,a=["fileManagerAction"];o&&a.push("fileManagerAction-isDisabled");const l=()=>{o||s()};return r.jsx("span",{className:a.join(" "),onClick:l,children:r.jsxs("span",{className:"fileManagerAction-icon",children:[r.jsx(x,{iconName:t})," ",n]})})}at.propTypes={icon:i.string.isRequired,text:i.string.isRequired,action:i.func.isRequired,isDisabled:i.bool.isRequired};const Qr=C.memo(at);function lt(e){const{selected:t,createFile:n,deleteFile:s,enableRename:o,startImport:a,exportAsText:l,printFile:c}=e,d=[{icon:"upload",text:"Import",action:a,isDisabled:!1},{icon:"add_circle",text:"New",action:n,isDisabled:!1},{icon:"create",text:"Rename",action:o,isDisabled:!t},{icon:"delete",text:"Delete",action:s,isDisabled:!t},{icon:"print",text:"Print",action:c,isDisabled:!t},{icon:"download",text:"Export",action:l,isDisabled:!t}];return r.jsx("div",{className:"fileManager-actionsList",children:d.map((u,h)=>R.createElement(Qr,{...u,key:h}))})}lt.propTypes={selected:i.string,createFile:i.func.isRequired,deleteFile:i.func.isRequired,enableRename:i.func.isRequired,exportAsText:i.func.isRequired,printFile:i.func.isRequired,startImport:i.func.isRequired};const Xr=C.memo(lt);function ct(e){const[t,n]=R.useState(e.title),{fileId:s,isSelected:o,isRenamed:a,defaultTitle:l,selectFile:c,enableRename:d,updateFile:u}=e,h=["fileManagerEntry"];o&&h.push("fileManagerEntry-isSelected"),a&&h.push("fileManagerEntry-isRenamed");const m=C.createRef();R.useEffect(()=>{a&&m.current.focus()},[a,m]);function f(){o||c(s)}function g(b){a||(d(s),b.target.select())}function y(b){if(a&&b.which===13){b.preventDefault(),window.getSelection().removeAllRanges();const z=b.target.value;j(z)}}function w(b){n(b.target.value)}function N(b){a&&b.target.select()}function F(b){if(a){const z=b.target.value;j(z)}}function j(b){b=b||l,u(s,{title:b}),n(b),m.current.scrollLeft=0}return r.jsx("li",{className:h.join(" "),onClick:f,onDoubleClick:g,children:r.jsx("input",{className:"fileManagerEntry-input",ref:m,type:"text",value:t,readOnly:a?null:"readOnly",autoFocus:a?"autoFocus":null,onChange:w,onBlur:F,onFocus:N,onKeyPress:y})})}ct.propTypes={title:i.string.isRequired,fileId:i.string.isRequired,isSelected:i.bool.isRequired,isRenamed:i.bool.isRequired,defaultTitle:i.string.isRequired,selectFile:i.func.isRequired,enableRename:i.func.isRequired,updateFile:i.func.isRequired};function dt(e){const[t,n]=R.useState(!1),{allTitles:s,selected:o,renamed:a,defaultTitle:l,createFile:c,deleteFile:d,enableRename:u,startImport:h,selectFile:m,updateFile:f,setEditorMode:g}=e;return r.jsxs("div",{className:"fileManager",children:[r.jsx(ot,{deleteFile:d,isDeleting:t,selected:o,setIsDeleting:n}),r.jsx("div",{className:"fileManager-isCollapsed",children:r.jsx("span",{className:"fileManager-icon",children:r.jsx(x,{iconName:"file_copy"})})}),r.jsxs("div",{className:"fileManager-isExpanded",children:[r.jsx(Xr,{selected:o,createFile:()=>c(l),deleteFile:()=>n(!0),enableRename:()=>u(o),startImport:()=>h(),exportAsText:()=>{g("export"),setTimeout(()=>Jr(),0)},printFile:()=>{g("print"),setTimeout(()=>window.print(),0)}}),r.jsx("ul",{className:"fileManager-entriesList",children:s.map(y=>r.jsx(ct,{title:y.title,defaultTitle:l,fileId:y.id,isSelected:o===y.id,isRenamed:a===y.id,selectFile:m,updateFile:f,enableRename:u},y.id))})]})]})}dt.propTypes={allTitles:i.arrayOf(i.shape({title:i.string.isRequired,id:i.string.isRequired})).isRequired,selected:i.string.isRequired,renamed:i.string.isRequired,defaultTitle:i.string.isRequired,selectFile:i.func.isRequired,createFile:i.func.isRequired,deleteFile:i.func.isRequired,enableRename:i.func.isRequired,startImport:i.func.isRequired,updateFile:i.func.isRequired,setEditorMode:i.func.isRequired};const Zr=T(e=>({selected:S(e),renamed:cn(e),defaultTitle:dn(e),allTitles:ee(e)}),{selectFile:Ur,createFile:Yn,deleteFile:Jn,updateFile:Ve,enableRename:Kr,setEditorMode:Je,startImport:Wn})(dt);function ut(e){return Q.sanitize(e)}function he(e){const{content:t,useChartFormat:n}=e,s=k(e,["chartFormat","transposeValue","accidentalsType","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy"]),o=rt(t,s,n);return r.jsx("div",{className:"songRenderer",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:ut(o)}})})}he.propTypes={useChartFormat:i.bool.isRequired,chartFormat:i.string.isRequired,content:i.string};he.defaultProps={content:"",useChartFormat:!1};const ge=T(e=>({transposeValue:p(e,"songPreferences","transposeValue"),accidentalsType:p(e,"songPreferences","preferredAccidentals"),symbolType:p(e,"songPreferences","symbolType"),chartFormat:p(e,"editorPreferences","chartFormat"),chartType:p(e,"songFormatting","chartType"),alignChordsWithLyrics:p(e,"songFormatting","alignChordsWithLyrics"),alignBars:p(e,"songFormatting","alignBars"),autoRepeatChords:p(e,"songFormatting","autoRepeatChords"),expandSectionCopy:p(e,"songFormatting","expandSectionCopy")}))(he);function pt(e){const{selectedFile:t}=e,n=["editorPreview"];return r.jsx("div",{className:n.join(" "),children:r.jsx(ge,{content:t.content})})}pt.propTypes={selectedFile:i.object.isRequired};function es(){return[Kt(),Te({"Mod-z":Yt,"Mod-y":Jt}),Te(Qt)]}const ts=new Xt({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}},text:{group:"inline"}}});function ns(e){return e.toJSON().doc.content.map(n=>n.content?n.content.reduce((s,o)=>(s+=o.text||`
+`,s),""):"").join(`
+`)}function Ee(e){const t={ALLOWED_TAGS:["p","#text"],KEEP_CONTENT:!1};return Q.sanitize(e,t)}function rs(e){const t=Ee(e).split(`
+`).map(s=>`${s}
`).join(""),n=document.createElement("div");return n.innerHTML=Ee(t),n}function ss(e){return Zt.create({doc:en.fromSchema(ts).parse(rs(e),{preserveWhitespace:"full"}),plugins:es()})}function is(e,t,n){return new tn(null,{state:e,dispatchTransaction:function(o){const{state:a,transactions:l}=this.state.applyTransaction(o);this.updateState(a),l.some(c=>c.docChanged)&&t(n,{content:ns(a)})}})}function $(e){const{selectedFileId:t,editorContent:n,updateFile:s}=e,o=R.useRef(),a=R.useRef(),l=os(t);function c(){return t&&(!o.current||l!==t)}function d(){return u()&&!t}function u(){return o.current&&o.current.dom.parentNode}function h(){o.current.dom.parentNode.removeChild(o.current.dom)}return R.useEffect(()=>{if(c()){u()&&h();const m=ss(n);o.current=is(m,s,t),a.current.appendChild(o.current.dom),$.editorView=o.current}else d()&&h()}),r.jsx("div",{className:"prosemirrorWrapper",ref:a})}$.defaultProps={selectedFileId:"",editorContent:""};$.propTypes={selectedFileId:i.string,editorContent:i.string,updateFile:i.func.isRequired};function os(e){const t=R.useRef();return R.useEffect(()=>{t.current=e}),t.current}function mt(e){const{selectedFile:t,updateFile:n,theme:s}=e,o=["songEditor-preview","cmTheme-"+s,"cmTheme-fadeRepeats"];return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"songEditor-headers",children:[r.jsxs("div",{className:"songEditor-sourceHeader",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"ChordMark source (",r.jsx("a",{href:"https://chordmark.netlify.app/docs/getting-started",target:"_blank",rel:"noreferrer",className:"link1",children:"tutorial"}),")",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsxs("div",{className:"songEditor-previewHeader",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"Result preview",r.jsx(x,{iconName:"arrow_drop_down"})]})]}),r.jsx(nn,{children:r.jsxs("div",{className:"songEditor",children:[r.jsx(Se,{group:"a",children:r.jsx("div",{className:"songEditor-source",children:r.jsx($,{editorContent:t.content,updateFile:n,selectedFileId:t.id})})}),r.jsx(Se,{group:"a",children:r.jsx("div",{className:o.join(" "),children:r.jsx(pt,{selectedFile:t})})})]})})]})}mt.propTypes={selectedFile:i.object,theme:i.string.isRequired,updateFile:i.func.isRequired};const as=T(e=>({theme:p(e,"editorPreferences","theme")}))(mt);function ht(e){const{selectedFile:t}=e,n=C.createRef(),s=o=>{(o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="a"&&(o.preventDefault(),window.getSelection().selectAllChildren(n.current))};return R.useEffect(()=>(window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)})),r.jsx("div",{className:"exportPreview exp-SongRenderer",ref:n,children:r.jsx(ge,{content:t.content,useChartFormat:!0})})}ht.propTypes={selectedFile:i.object.isRequired};function gt(e){const{theme:t,selectedFile:n,fontSize:s,columnsCount:o}=e,a=["playRendererWrapper1"];a.push("cmTheme-"+t),a.push("cmSong--fontSize"+s);const l=["playRenderer"];return l.push("playRenderer--columns-"+o),r.jsx("div",{className:a.join(" "),"data-testid":"playRendererWrapper1",children:r.jsx("div",{className:"playRendererWrapper2",children:r.jsx("div",{className:l.join(" "),"data-testid":"playRenderer",children:r.jsx(ge,{content:n.content})})})})}gt.propTypes={theme:i.string.isRequired,fontSize:i.number.isRequired,selectedFile:i.object.isRequired,columnsCount:i.number.isRequired};const ls=T(e=>({theme:p(e,"editorPreferences","theme"),fontSize:p(e,"songFormatting","fontSize"),columnsCount:p(e,"songFormatting","columnsCount")}))(gt);function fe(e){const{pageHeader:t,allColumnsLines:n,documentSize:s,documentMargins:o,fontSize:a}=e,l=n.map((u,h)=>{const m=u.join("");return r.jsx("div",{className:"printPreview-pageColumn","data-testid":"printPreview-pageColumn",dangerouslySetInnerHTML:{__html:ut(m)}},h)}),c=["printPreview-page"];c.push("printPreview-page--"+s),c.push("cmSong--fontSize"+a),c.push("cmSong");const d=["printPreview-pageContentWrapper"];return d.push("printPreview-pageContentWrapper--padding"+o),r.jsx("div",{className:c.join(" "),"data-testid":"printPreview-page",children:r.jsx("div",{className:d.join(" "),"data-testid":"printPreview-pageContentWrapper",children:r.jsxs("div",{className:"printPreview-pageContent",children:[t,r.jsx("div",{className:"printPreview-pageColumnWrapper",children:l})]})})})}fe.defaultProps={allColumnsLines:[]};fe.propTypes={pageHeader:i.element,allColumnsLines:i.arrayOf(i.arrayOf(i.string)),documentSize:i.string.isRequired,documentMargins:i.number.isRequired,fontSize:i.number.isRequired};const ye=C.memo(fe);function be(e){const{title:t}=e;return r.jsx("div",{className:"printPreview-pageHeader",children:t})}be.defaultProps={allColumnsLines:[]};be.propTypes={title:i.string.isRequired};const ft=C.memo(be),xe={emptyLine:"cmEmptyLine",chordLine:"cmChordLine",textLine:"cmLyricLine"};function cs(e,{columnsCount:t,firstPageHeight:n,normalPageHeight:s,columnBreakOnSection:o,noEmptyLinesOnColumnStart:a=!0,noOrphanTextLine:l=!0}){const c=hs({columnsCount:t,firstPageHeight:n,normalPageHeight:s,noEmptyLinesOnColumnStart:a});let d=[],u=0;return(n||s)>0&&e.forEach((m,f)=>{ds(c,m,d,a)&&(d.push(m),u+=m.height),d.length>0&&us(m,e[f+1],{noOrphanTextLine:l,columnBreakOnSection:o})&&(c.fitsOnCurrentColumn(u)?c.insert(d):c.fitsOnNextColumn(u)?c.insertOnNextColumn(d):c.insert(d),d=[],u=0)}),c.get()}function ds(e,t,n,s){return!(J(t)&&!e.fitsOnCurrentColumn(t.height)&&n.length===0&&s===!0)}function us(e,t,{noOrphanTextLine:n,columnBreakOnSection:s}){if(J(e)||!t)return!0;const o=ps(e)&&ms(t);if(n===!0&&o)return!1;const a=J(t);return!(s===!0&&!a)}function J(e){return Ce(e.content,xe.emptyLine)}function ps(e){return Ce(e.content,xe.chordLine)}function ms(e){return Ce(e.content,xe.textLine)}function Ce(e,t){return e.indexOf(t)>-1}function hs({firstPageHeight:e,normalPageHeight:t,columnsCount:n}){const s=[];let o=0,a=0,l=u(),c=0;s[o]=[],s[o][a]=[];function d(g){g.forEach(y=>{h(c+y.height)&&m(),s[o][a].push(y.content),c+=y.height})}function u(){return o===0&&e?e:t}function h(g){return g>l}function m(){f()?(o++,s[o]=[],a=0):a++,s[o][a]=[],c=0,l=u()}function f(){return a===n-1}return{insert(g){d(g)},insertOnNextColumn(g){m(),d(g)},fitsOnCurrentColumn(g){return c+g<=l},fitsOnNextColumn(g){const y=o===0&&a{const a=()=>(R.useLayoutEffect(()=>{const l=t(n);o(l)}),r.jsx("div",{children:e}));s.render(r.jsx(a,{}))}).then(o=>(s.unmount(),n.parentNode.removeChild(n),o))}function je(e,t=[]){for(let n=t.length||0;n{const d=[];return c.querySelectorAll(fs.line).forEach(u=>{d.push(gs(u))}),d})}async function bs(e,{columnsCount:t,documentSize:n,documentMargins:s,fontSize:o}){const a=r.jsx(ye,{pageHeader:r.jsx(ft,{title:e}),allColumnsLines:je(t),documentSize:n,documentMargins:s,fontSize:o});return await yt(a,c=>{const d=c.querySelector(".printPreview-pageContent"),u=c.querySelector(".printPreview-pageColumnWrapper");return{firstPageHeight:Pe(u),normalPageHeight:Pe(d)}})}function bt(e){const[t,n]=R.useState([]),{title:s,allLines:o,columnsCount:a,columnBreakOnSection:l,documentSize:c,documentMargins:d,fontSize:u}=e;R.useLayoutEffect(()=>{(async()=>{const f={columnsCount:a,documentSize:c,documentMargins:d,fontSize:u},g=await ys(o,f),{normalPageHeight:y,firstPageHeight:w}=await bs(s,f),N=o.map((j,b)=>({content:j,height:g[b]})),F=cs(N,{columnsCount:a,columnBreakOnSection:l,normalPageHeight:y,firstPageHeight:w});n(F)})()},[o,s,a,l,c,d,u]);const h=t.map((m,f)=>r.jsx(ye,{pageHeader:f===0?r.jsx(ft,{title:s}):null,allColumnsLines:je(a,m),documentSize:c,documentMargins:d,fontSize:u},f));return r.jsx(C.Fragment,{children:h})}bt.propTypes={title:i.string.isRequired,allLines:i.arrayOf(i.string).isRequired,columnsCount:i.number.isRequired,columnBreakOnSection:i.bool.isRequired,documentSize:i.string.isRequired,documentMargins:i.number.isRequired,fontSize:i.number.isRequired};function xt(e){const{selectedFile:t}=e,n=k(e,["transposeValue","accidentalsType","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy"]),o=rt(t.content||"",{...n}).match(/(.*?<\/p>)/gm),a=["printPreview","cmTheme-print"];return r.jsx("div",{className:a.join(" "),"data-testid":"printPreview",children:r.jsx(bt,{title:t.title||"",allLines:o,columnsCount:e.columnsCount,columnBreakOnSection:e.columnBreakOnSection,documentSize:e.documentSize||"a4",documentMargins:e.documentMargins,fontSize:e.fontSize})})}xt.propTypes={chartType:i.string.isRequired,selectedFile:i.object.isRequired,columnsCount:i.number.isRequired,columnBreakOnSection:i.bool.isRequired,documentSize:i.string,documentMargins:i.number.isRequired,fontSize:i.number.isRequired};const xs=T(e=>({accidentalsType:p(e,"songPreferences","preferredAccidentals"),transposeValue:p(e,"songPreferences","transposeValue"),symbolType:p(e,"songPreferences","symbolType"),chartType:p(e,"songFormatting","chartType"),alignChordsWithLyrics:p(e,"songFormatting","alignChordsWithLyrics"),alignBars:p(e,"songFormatting","alignBars"),autoRepeatChords:p(e,"songFormatting","autoRepeatChords"),expandSectionCopy:p(e,"songFormatting","expandSectionCopy"),columnsCount:p(e,"songFormatting","columnsCount"),columnBreakOnSection:p(e,"songFormatting","columnBreakOnSection"),documentMargins:p(e,"songFormatting","documentMargins"),fontSize:p(e,"songFormatting","fontSize")}))(xt);function Ct(e){const{editorMode:t}=e;switch(t){case"edit":return r.jsx(as,{...e});case"play":return r.jsx(ls,{...e});case"print":return r.jsx(xs,{...e});case"export":return r.jsx(ht,{...e})}}Ct.propTypes={editorMode:i.string.isRequired};const Cs=T(e=>({selectedFile:te(e,S(e))||{},editorMode:P(e)}),{updateFile:Ve})(Ct);function jt(e){const{id:t,allWidgets:n,nonInteractableWidgets:s,hiddenWidgets:o,setOption:a,getEntryComponent:l}=e,c=["optionsPanel","optionsPanel-"+t];let d,u,h,m,f,g,y;const w=n.widgetsOrder.filter(F=>!o.includes(F)).map(F=>(d=n.allWidgets[F],d.type==="optionsGroup"?(y=d.groupWidgetsOrder.filter(j=>!o.includes(j)).map(j=>(u=d.allGroupWidgets[j],g=!s.includes(F)&&!s.includes(j),N(j,u,g))),y.length===0?null:(m=l(d.type),f=!s.includes(F),r.jsx(m,{isInteractable:f,label:d.label,icon:d.icon,children:y},F))):N(F,d,!s.includes(F))));function N(F,j,b){return h=l(j.type),r.jsx(h,{isInteractable:b,optionContext:j.option.context,optionKey:j.option.key,optionValue:e[j.option.key],setOption:a,label:j.label,...j.typeOptions},F)}return r.jsx("div",{className:c.join(" "),children:w})}jt.propTypes={id:i.string.isRequired,allWidgets:i.object.isRequired,nonInteractableWidgets:i.arrayOf(i.string).isRequired,hiddenWidgets:i.arrayOf(i.string).isRequired,setOption:i.func.isRequired,getEntryComponent:i.func.isRequired};function Re(e){const{isInteractable:t,icon:n,label:s}=e,o=["sb-optionsGroup"];a()||o.push("sb-optionsGroup-isNotInteractable");function a(){return t&&e.children&&e.children.length>0}return r.jsxs("div",{className:o.join(" "),children:[r.jsxs("div",{className:"sb-optionsGroup-title",children:[r.jsx("span",{className:"sb-optionsGroup-iconTitle",children:r.jsx(x,{iconName:n})})," ",s]}),r.jsx("div",{className:"sb-optionsGroup-content",children:e.children})]})}Re.propTypes={isInteractable:i.bool.isRequired,icon:i.string.isRequired,label:i.string.isRequired,children:i.arrayOf(i.element)};Re.defaultProps={};function Rt(e){const{isSelected:t,isInteractable:n,label:s,onClick:o}=e;let a;const l=["sb-optionSelectChoice"];t&&(l.push("sb-optionSelectChoice-isSelected"),a=r.jsx("span",{className:"sb-optionSelectChoice-checkIcon",children:r.jsx(x,{iconName:"check"})})),n||l.push("sb-optionSelectChoice-isNotInteractable");function c(){n&&o()}return r.jsxs("div",{className:l.join(" "),onClick:c,children:[r.jsx("div",{className:"sb-optionSelectChoice-check",children:t&&a}),r.jsx("div",{className:"sb-optionSelectChoice-label",children:s})]})}Rt.propTypes={isSelected:i.bool.isRequired,isInteractable:i.bool.isRequired,label:i.string.isRequired,onClick:i.func.isRequired};const js=C.memo(Rt);function vt(e){const[t,n]=R.useState(!1),{isInteractable:s,label:o,allChoices:a,optionContext:l,optionKey:c,optionValue:d,setOption:u}=e,h=["sb-optionSelect"];s||h.push("sb-optionSelect-isNotInteractable");const m=t?"keyboard_arrow_down":"keyboard_arrow_right";function f(){n(!t)}const g=t?r.jsx("div",{className:"sb-optionSelect-choices",children:a.map(N=>r.jsx(js,{label:N.label,isSelected:d===N.value,isInteractable:s,onClick:()=>{u(l,c,N.value)}},N.value))}):null,y=a.find(N=>d===N.value).label,w=t?o:r.jsxs("span",{children:[r.jsx("span",{children:o+": "}),r.jsx("span",{className:"sb-optionSelectChoice-activeLabel",children:y})]});return r.jsxs("div",{className:h.join(" "),children:[r.jsxs("div",{className:"sb-optionSelect-title",onClick:s?f:null,children:[r.jsx("div",{className:"sb-optionSelect-desc","data-testid":"selectLabel",children:w}),r.jsx("div",{className:"sb-optionSelect-toggle",children:r.jsx("span",{className:"sb-optionSelect-icon",children:r.jsx(x,{iconName:m})})})]}),g]})}vt.propTypes={isInteractable:i.bool.isRequired,label:i.string.isRequired,allChoices:i.array.isRequired,optionContext:i.string.isRequired,optionKey:i.string.isRequired,optionValue:i.string.isRequired,setOption:i.func.isRequired};function ve(e){const{isInteractable:t,label:n,min:s,max:o,showPlusSymbol:a,optionContext:l,optionKey:c,optionValue:d,setOption:u}=e,h=["sb-optionSlider"];t||h.push("sb-optionSlider-isNotInteractable");function m(g){u(l,c,Number.parseInt(g.target.value))}const f=d>0&&a?"+"+d:d;return r.jsxs("div",{className:h.join(" "),children:[r.jsx("div",{className:"sb-optionSlider-desc",children:n}),r.jsx("div",{className:"sb-optionSlider-value",children:f}),r.jsx("div",{className:"sb-optionSlider-range",children:r.jsx("input",{min:s,max:o,value:d,type:"range",onChange:t?m:null,disabled:!t})})]})}ve.propTypes={isInteractable:i.bool.isRequired,label:i.string.isRequired,min:i.number.isRequired,max:i.number.isRequired,showPlusSymbol:i.bool,optionContext:i.string.isRequired,optionKey:i.string.isRequired,optionValue:i.number.isRequired,setOption:i.func.isRequired};ve.defaultProps={showPlusSymbol:!0};const Rs=C.memo(ve);function Ft(e){const{isInteractable:t,label:n,optionContext:s,optionKey:o,optionValue:a,setOption:l}=e,c=["sb-optionToggle"];c.push(a===!0?"sb-optionToggle-isOn":"sb-optionToggle-isOff"),t||c.push("sb-optionToggle-isNotInteractable");function d(){l(s,o,!a)}return r.jsxs("div",{className:c.join(" "),onClick:t?d:null,children:[r.jsx("div",{className:"sb-optionToggle-desc",children:n}),r.jsx("div",{className:"sb-optionToggle-icon",children:r.jsx("span",{className:"sb-optionToggle-icon",children:r.jsx(x,{iconName:a===!0?"toggle_on":"toggle_off"})})})]})}Ft.propTypes={isInteractable:i.bool.isRequired,label:i.string.isRequired,optionContext:i.string.isRequired,optionKey:i.string.isRequired,optionValue:i.bool.isRequired,setOption:i.func.isRequired};const vs=C.memo(Ft);function Fs(e){switch(e){case"optionsGroup":return Re;case"select":return vt;case"slider":return Rs;case"toggle":return vs}}function Ns(e){return r.jsx("div",{className:"sb-optionsPanel",children:r.jsx(jt,{...e,getEntryComponent:Fs})})}function Ts(e){return r.jsxs("div",{className:"renderingOptionsPanel",children:[r.jsx("div",{className:"renderingOptionsPanel-isCollapsed",children:r.jsx("span",{className:"renderingOptionsPanel-icon",children:r.jsx(x,{iconName:"settings"})})}),r.jsx("div",{className:"renderingOptionsPanel-isExpanded",children:r.jsx(Ns,{...e,id:"rendering"})})]})}const Ss=(e,t,n)=>{if(!e)throw new TypeError("Cannot set an option without a context");if(!t)throw new TypeError("Cannot set an option without a key");return v(Z,{context:e,key:t,value:n})};function ws(e,t,n,s){return T(o=>{const a={allWidgets:e,nonInteractableWidgets:t(o),hiddenWidgets:n(o)};let l,c;return e.widgetsOrder.forEach(d=>{l=e.allWidgets[d],l.groupWidgetsOrder.forEach(u=>{c=l.allGroupWidgets[u],a[c.option.key]=p(o,c.option.context,c.option.key)})}),a},{setOption:Ss})(s)}const _s={widgetsOrder:["editorPreferences","key","preferences","layout"],allWidgets:{editorPreferences:{label:"Editor preferences",type:"optionsGroup",icon:"tune",groupWidgetsOrder:["theme","chartFormat"],allGroupWidgets:{theme:{label:"Theme",type:"select",typeOptions:{allChoices:[{id:"themeDark1",label:"Dark 1 (default)",value:"dark1"},{id:"themeDark2",label:"Dark 2",value:"dark2"},{id:"themeDark3",label:"Dark 3",value:"dark3"}]},option:{context:"editorPreferences",key:"theme"}},chartFormat:{label:"Export format",type:"select",typeOptions:{allChoices:[{id:"formatChordMark",label:"ChordMark",value:"chordmark"},{id:"formatChordMarkSrc",label:"ChordMark (Source)",value:"chordmarkSrc"},{id:"formatChordpro",label:"ChordPro",value:"chordpro"},{id:"formatUG",label:"UltimateGuitar",value:"ultimateGuitar"}]},option:{context:"editorPreferences",key:"chartFormat"}}}},key:{label:"Key",type:"optionsGroup",icon:"music_note",groupWidgetsOrder:["transposeValue","preferredAccidentals","symbolType"],allGroupWidgets:{transposeValue:{label:"Transpose",type:"slider",typeOptions:{min:-11,max:11,showPlusSymbol:!0},option:{context:"songPreferences",key:"transposeValue"}},preferredAccidentals:{label:"Preferred accidentals",type:"select",typeOptions:{allChoices:[{id:"preferredAccidentalsAuto",label:"Auto",value:"auto"},{id:"preferredAccidentalsSharp",label:"♯",value:"sharp"},{id:"preferredAccidentalsFlat",label:"♭",value:"flat"}]},option:{context:"songPreferences",key:"preferredAccidentals"}},symbolType:{label:"Symbols type",type:"select",typeOptions:{allChoices:[{id:"symbolTypeChord",label:"Chord symbols",value:"chord"},{id:"symbolTypeRoman",label:"Roman numerals",value:"roman"}]},option:{context:"songPreferences",key:"symbolType"}}}},preferences:{label:"Chart settings",type:"optionsGroup",icon:"tune",groupWidgetsOrder:["chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy"],allGroupWidgets:{chartType:{label:"Type",type:"select",typeOptions:{allChoices:[{id:"typedisplayAll",label:"Show everything",value:"all"},{id:"typedisplayLyrics",label:"Lyrics only",value:"lyrics"},{id:"typedisplayChords",label:"Chords only",value:"chords"},{id:"typedisplayChordsFirstLyricLine",label:"Chords + First lyric line",value:"chordsFirstLyricLine"}]},option:{context:"songFormatting",key:"chartType"}},alignChordsWithLyrics:{label:"Align chords with lyrics",type:"toggle",option:{context:"songFormatting",key:"alignChordsWithLyrics"}},alignBars:{label:"Align bars",type:"toggle",option:{context:"songFormatting",key:"alignBars"}},autoRepeatChords:{label:"Auto repeat chords",type:"toggle",option:{context:"songFormatting",key:"autoRepeatChords"}},expandSectionCopy:{label:"Expand copied sections",type:"toggle",option:{context:"songFormatting",key:"expandSectionCopy"}}}},layout:{type:"optionsGroup",label:"Layout",icon:"view_compact",groupWidgetsOrder:["fontSize","columnsCount","columnBreakOnSection","documentMargins"],allGroupWidgets:{fontSize:{label:"Font size",type:"slider",typeOptions:{min:-5,max:5,showPlusSymbol:!0},option:{context:"songFormatting",key:"fontSize"}},columnsCount:{label:"Columns",type:"slider",typeOptions:{min:1,max:4},option:{context:"songFormatting",key:"columnsCount"}},columnBreakOnSection:{label:"Column Break on section",type:"toggle",option:{context:"songFormatting",key:"columnBreakOnSection"}},documentMargins:{label:"Margins",type:"slider",typeOptions:{min:1,max:5},option:{context:"songFormatting",key:"documentMargins"}}}}}},Es=e=>{const t=[],n=p(e,"songFormatting","chartType");n==="lyrics"?(t.push("alignChordsWithLyrics"),t.push("alignBars"),t.push("autoRepeatChords")):n==="chords"&&t.push("alignChordsWithLyrics");const s=p(e,"editorPreferences","chartFormat");return P(e)==="export"&&s==="chordmarkSrc"&&(t.push("chartType"),t.push("alignChordsWithLyrics"),t.push("alignBars"),t.push("autoRepeatChords"),t.push("expandSectionCopy")),t},Ps=e=>{const t=[],n=Object.keys({...I(e,"editorPreferences"),...I(e,"songFormatting"),...I(e,"songPreferences")});if(!S(e))return n;const o=P(e),a=rn(n,re[o]);return t.push(...a),t},qs=ws(_s,Es,Ps,Ts);function Is(){const e=r.jsx(Zr,{}),t=r.jsx(qs,{});return r.jsx(Vr,{leftBar:e,rightBar:t,children:r.jsx(Cs,{})})}const Ms=[{name:"home",path:"",action:Is},...gr,...yr];Un();function Os(){Bn(),Zn();const e=window?window.location.pathname+window.location.search:"/";return rr.init(Ms),H(e)}Os();
diff --git a/packages/chord-chart-studio/build/assets/index-BwbBfjx-.js b/packages/chord-chart-studio/build/assets/index-BwbBfjx-.js
deleted file mode 100644
index 3108d3d..0000000
--- a/packages/chord-chart-studio/build/assets/index-BwbBfjx-.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import{c as Nt,_ as Tt,a as St,d as wt,b as _t,e as Pe,f as k,g as B,p as Q,h as Et,i as qt,v as Ie,R as C,j as r,P as i,k as Me,l as Pt,U as It,m as Mt,q as Oe,I as Ot,n as Lt,$ as kt,u as Le,r as R,o as Fe,s as Bt,t as T,w as Ne,x as At,y as Dt,z as Wt,A as Gt,B as Ht,F as $t,C as zt,D as Te,E as Vt,G as Ut,H as Kt,S as Yt,J as Jt,K as Qt,L as Xt,M as Zt,N as Se,O as en}from"./vendor-BWYuIjsn.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();const tn=()=>{try{const e=localStorage.getItem("state");return e?JSON.parse(e):void 0}catch{return}},nn=e=>{try{const t=JSON.stringify(e);localStorage.setItem("state",t)}catch{}};function ke(){return Date.now()}const A="db/files/Create",D="db/files/Delete",M="db/files/Import",X="db/files/Update",Z="db/options/setOptionValue",W="ui/layout/app/setEditorMode",Be="ui/layout/app/toggleLeftBar",Ae="ui/layout/app/toggleRightBar",rn=e=>e.ui.layout.app.isLeftBarCollapsed,sn=e=>e.ui.layout.app.isRightBarCollapsed,q=e=>e.ui.layout.app.editorMode,S=e=>e.fileManager.selected,on=e=>e.fileManager.renamed,an=e=>e.fileManager.defaultTitle,ln=Nt(wt,_t),ee=ln(e=>Tt(e.db.files.allFiles,({title:t,id:n})=>({title:t,id:n})),e=>St(e,t=>t.title.toLowerCase())),te=(e,t)=>e.db.files.allFiles[t],ne=(e,t,n)=>{const s=e.db.files.allFiles[t];if(s&&(s.options||{})[n])return Object.keys(s.options[n]).length===0?void 0:Pe(s.options[n])},De=(e,t)=>{const n=e.db.files.allFiles[t];if(!n)return;const s=n.options||{},o=[];if(s.edit&&o.push({...s.edit}),s.play&&o.push({...s.play}),s.print&&o.push({...s.print}),s.export&&o.push({...s.export}),!!o.length)return o.sort((a,l)=>a.updatedAt-l.updatedAt),o.reduce((a,l)=>Object.assign(a,l),{})},re={edit:["theme","transposeValue","preferredAccidentals","symbolType"],play:["theme","transposeValue","preferredAccidentals","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy","columnsCount","fontSize"],print:["transposeValue","preferredAccidentals","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy","columnsCount","columnBreakOnSection","documentMargins","fontSize"],export:["chartFormat","transposeValue","preferredAccidentals","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy"]},cn={allFiles:{}};function dn(e,t){const{id:n,title:s,content:o}=t.payload,a={...e.allFiles};return a[n]={id:n,title:s,content:o},{...e,allFiles:a}}function un(e,t){const{id:n,title:s,content:o}=t.payload;if(!s&&typeof o>"u"||!e.allFiles[n])return e;const a={...e.allFiles};return a[n]={...a[n]},s&&(a[n].title=s),typeof o<"u"&&(a[n].content=o),{...e,allFiles:a}}function pn(e,t){const{id:n}=t.payload;if(!n||!e.allFiles[n])return e;const s={...e.allFiles};return delete s[n],{...e,allFiles:s}}function mn(e,t,n){const{context:s,key:o,value:a}=t.payload,l=S(n),c={...e.allFiles};if(["songFormatting","songPreferences"].includes(s)&&c[l]){const d=q(n),u=s==="songPreferences"?"preferences":d;return c[l]=hn(c[l],u,o,a),{...e,allFiles:c}}return e}function hn(e,t,n,s){return{...e,options:{...e.options,[t]:{...(e.options||{})[t],updatedAt:ke(),[n]:s}}}}function gn(e,t,n){const s=S(n),o=t.payload.mode;if(!!!ne(n,s,o)){const l=k(De(n,s)||{},re[o]);if(Object.keys(l).length){l.updatedAt=ke();const c={...e.allFiles};return c[s]={...c[s],options:{...c[s].options,[o]:l}},{...e,allFiles:c}}}return e}const fn=(e=cn,t={},n={})=>{switch(t.type){case A:case M:return dn(e,t);case X:return un(e,t);case D:return pn(e,t);case Z:return mn(e,t,n);case W:return gn(e,t,n)}return e},se="fileManager/select",We="fileManager/enableRename",p=(e,t,n)=>{if(!(!e.db.options[t]||!e.db.options[t].values||typeof e.db.options[t].values[n]>"u"))return e.db.options[t].values[n]},I=(e,t)=>{if(!(!e.db.options[t]||!e.db.options[t].defaults))return Pe(e.db.options[t].defaults)},yn={};function bn(e,t){const{context:n,key:s,value:o}=t.payload;if(!e[n]||!e[n].values||typeof e[n].values[s]>"u")return e;const a={...e,[n]:{...e[n],values:{...e[n].values}}};return a[n].values[s]=o,a}function xn(e,t,n){const s=S(n),o=t.payload.mode,a=Ge(n,s,o);return{...e,songFormatting:{...e.songFormatting,values:{...a}}}}function Ge(e,t,n){const s=I(e,"songFormatting");let o=ne(e,t,n);return o||(o=De(e,t)||{}),delete o.updatedAt,o=k(o,re[n]),Object.assign(s,o)}function Cn(e,t,n){const{id:s}=t.payload,o=q(n),a=Ge(n,s,o),l=ne(n,s,"preferences")||{};delete l.updatedAt;const c=I(n,"songPreferences"),d=Object.assign(c,l);return{...e,songPreferences:{...e.songPreferences,values:{...d}},songFormatting:{...e.songFormatting,values:{...a}}}}const jn=(e=yn,t={},n={})=>{switch(t.type){case Z:return bn(e,t);case W:return xn(e,t,n);case se:return Cn(e,t,n)}return e},Rn=B({files:fn,options:jn}),vn={selected:"",renamed:"",defaultTitle:"[untitled]"};function Fn(e=vn,t={}){switch(t.type){case A:{const{id:n}=t.payload;return{...e,selected:n,renamed:n}}case M:{const{id:n}=t.payload;return{...e,selected:n,renamed:""}}case X:return{...e,renamed:""};case D:return{...e,selected:"",renamed:""};case se:{const{id:n}=t.payload;return{...e,selected:n,renamed:n===e.renamed?n:""}}case We:{const{id:n}=t.payload;return{...e,renamed:n}}}return e}const He="songImporter/import/cancel",ie="songImporter/import/start",$e="songImporter/setContent",ze="songImporter/setInputFormat";function P(e){return Q.sanitize(e,{ALLOWED_TAGS:["#text"],KEEP_CONTENT:!0})}const Nn={content:"",isFromWeb:!1,isImporting:!1,inputFormat:"auto",title:""};function Tn(e=Nn,t={}){switch(t.type){case $e:{const{content:n,title:s=""}=t.payload;return{...e,content:P(n),title:s?P(s):e.title}}case ze:{const{inputFormat:n}=t.payload;return{...e,inputFormat:n}}case M:case He:return{...e,content:"",title:"",isImporting:!1};case ie:{const{content:n,inputFormat:s,title:o,isFromWeb:a}=t.payload;return{...e,isImporting:!0,content:n?P(n):"",title:o?P(o):"",inputFormat:s||e.inputFormat,isFromWeb:a}}}return e}const Sn={isLeftBarCollapsed:!1,isRightBarCollapsed:!1,editorMode:"edit",activeModal:"none"};function wn(e=Sn,t={}){switch(t.type){case Be:return{...e,isLeftBarCollapsed:!e.isLeftBarCollapsed};case Ae:return{...e,isRightBarCollapsed:!e.isRightBarCollapsed};case W:{const{mode:n}=t.payload;return{...e,editorMode:n}}case D:case A:case M:return{...e,editorMode:"edit"}}return e}const _n=B({app:wn}),En=B({layout:_n}),qn=B({db:Rn,fileManager:Fn,songImporter:Tn,ui:En}),Pn={editorPreferences:{values:{theme:"dark1",chartFormat:"chordmark"},defaults:{theme:"dark1",chartFormat:"chordmark"}},songPreferences:{values:{transposeValue:0,preferredAccidentals:"auto",symbolType:"chord"},defaults:{transposeValue:0,preferredAccidentals:"auto",symbolType:"chord"}},songFormatting:{values:{chartType:"all",alignChordsWithLyrics:!0,alignBars:!0,autoRepeatChords:!0,expandSectionCopy:!0,fontSize:0,columnsCount:1,columnBreakOnSection:!0,documentMargins:3},defaults:{chartType:"all",alignChordsWithLyrics:!0,alignBars:!0,autoRepeatChords:!0,expandSectionCopy:!0,fontSize:0,columnsCount:1,columnBreakOnSection:!0,documentMargins:3}}},In={options:Pn},Mn={db:In};let L;function On(){const e=tn();e&&e.db&&e.db.options&&delete e.db.options.rendering;const t=Et(e,Mn);L=qt({reducer:qn,preloadedState:t}),L.subscribe(()=>{nn(L.getState())})}function G(){return L}function v(e,t){if(!e)throw new TypeError("Cannot create an action without an action type");return{type:e,payload:t}}const Ln=(e,t)=>v($e,{content:e,title:t}),kn=e=>v(ze,{inputFormat:e}),Bn=()=>v(ie,{isFromWeb:!1}),An=(e,t,n)=>v(ie,{content:t,inputFormat:e,title:n,isFromWeb:!0}),Dn=()=>v(He),Wn={"@CCS/IMPORT_TAB":e=>{const t=G(),n=Gn(e.title,e.artist);t.dispatch(An(e.inputFormat,e.chordChart,n))}},Gn=(e,t)=>"_"+(t?t+" - ":"")+e;function Hn(){return Wn}function $n(){window.addEventListener("message",zn)}const zn=e=>{const t={...Hn()};if(e.source!==window||e.origin!==window.location.origin)return!1;const n=e.data;return typeof t[n.type]=="function"&&t[n.type](n.payload),!0},Vn=(e,t="")=>{if(!e)throw new TypeError("Cannot create a file without title");const n={id:Ie(),title:e,content:t};return v(A,n)},K=(e,t="")=>{if(!e)throw new TypeError("Cannot import a file without title");const n={id:Ie(),title:e,content:t};return v(M,n)},Ve=(e,{title:t,content:n}={})=>{if(!e)throw new TypeError("Cannot update a file without an id");return v(X,{id:e,title:t,content:n})},Un=e=>v(D,{id:e}),Kn=`Welcome to Chord Chart Studio!
-
-Chord Chart Studio is the official editor of the ChordMark format.
-You can use it to quickly write accurate transcription of songs made up of chords and lyrics.
-
-A % D7.. E7..
-_Just write _some chords, some _lyrics
-%
-_And see how it _looks: _terrific!
-
-Where to start? You can either:
-- check the sample song on the left
-- read the user guide, by clicking the big yellow button in the top right corner
-
-Have fun!
-`,Yn=`#i
-C.. Am.. %
-%
-
-#v
-C.. Am..
-I _heard there was a _secret chord
-%
-That _David played and it _pleased the lord
-F... G. C.. G..
-But _you don't really care for _music, _do you?
-C.. F. G.
-Well it _goes like this the _fourth, the _fifth
-Am.. F..
-The _minor fall and the _major lift
-G.. E7.. Am
-The _baffled king com_posing halle_lujah
-
-#c
-F
-Halle_lujah
-Am
-Halle_lujah
-F
-Halle_lujah
-C.. G.. C.. Am..
-Halle_lu_u_jah
-
-#v
-Well, your _faith was strong but you _needed proof
-You _saw her bathing _on the roof
-Her _beauty and the moonlight _over_threw you
-She _tied you to her _kitchen _chair
-She _broke your throne and she _cut your hair
-And _from your lips she _drew the halle_lujah
-
-#c
-`;function Jn(){const e=G(),t=e.getState();ee(t).length===0&&(e.dispatch(K("Hallelujah - Leonard Cohen",Yn)),e.dispatch(K("Getting started",Kn)))}class Ue extends C.Component{constructor(t){super(t),this.state={error:null,errorInfo:null}}componentDidCatch(t,n){this.setState({error:t,errorInfo:n})}render(){return this.state.errorInfo?r.jsxs("div",{className:"ErrorBoundary",children:[r.jsx("h2",{children:"Something went wrong"}),r.jsxs("details",{style:{whiteSpace:"pre-wrap"},open:!0,children:[this.state.error&&this.state.error.toString(),r.jsx("br",{}),this.state.errorInfo.componentStack]})]}):this.props.children}}Ue.propTypes={children:i.any};let V;function Qn(e,t){const n=document.getElementById("app");V||(V=Me(n)),V.render(r.jsx(Pt,{store:G(),children:r.jsx(C.StrictMode,{children:r.jsx(Ue,{children:r.jsx(e,{...t})})})}))}const Xn={base:"/app"};let Y,Ke;const Zn={init(e){const t=e.map(n=>({...n,path:Xn.base+n.path,action:s=>({Controller:n.action,params:s.params})}));Y=new It(t,{errorHandler(n,s){console.error(`Error: Cannot find route for path: ${s.pathname}`)}}),Ke=Mt(Y,{stringifyQueryParams:Oe.stringify})}};function H(e,t=!0){const n=new URL(e,window.location.origin);return Y.resolve(n.pathname).then(({Controller:s,params:o}={})=>{if(s){t&&er(e);const a=Oe.parse(n.search,{ignoreQueryPrefix:!0});Qn(s,{...o,...a})}})}function Ye(e,t){try{return Ke(e,t)}catch(n){console.error(n.toString())}}function er(e){window.history.pushState({url:e},null,e)}window.addEventListener("popstate",()=>{const e=window.location.pathname+window.location.search;H(e,!1)});const tr="_button_18d4b_1",nr="_icon_18d4b_8",rr="_label_18d4b_8",sr="_primary_18d4b_41",ir="_secondary_18d4b_58",or="_tertiary_18d4b_76",E={button:tr,icon:nr,label:rr,primary:sr,secondary:ir,tertiary:or};function ar({id:e,size:t}){let n;switch(e){case"plus":n=Lt;break;case"import":n=Ot;break}return r.jsx(n,{size:t})}const we="primary";function lr({children:e,type:t=we,icon:n="",onPress:s}){const o=[E.button,E[t]?E[t]:E[we]],a=n?r.jsx("span",{className:E.icon,children:r.jsx(ar,{id:n,size:20})}):"";return r.jsxs(kt,{onPress:s,className:o.join(" "),children:[a,r.jsx("span",{className:E.label,children:e})]})}function cr(){const t=Le(ee).map(n=>r.jsx(dr,{song:n},n.id));return r.jsxs("div",{children:["Full Library",r.jsx("ul",{children:t}),r.jsx(lr,{children:"My Nice Button"})]})}const dr=({song:e})=>{const t=n=>{n.preventDefault(),H(Ye("songView",{songId:e.id}))};return r.jsx("li",{children:r.jsx("a",{href:`/song/${e.id}`,onClick:t,children:e.title})})},ur=[{name:"library",path:"/library",action:cr}];function pr({songId:e}){const t=Le(s=>te(s,e)),n=s=>{s.preventDefault(),H(Ye("library"))};return r.jsxs("div",{children:[r.jsx("a",{href:"",onClick:n,children:"Go back to list"}),r.jsx("br",{}),r.jsx("b",{children:t.title}),r.jsx("p",{children:t.content})]})}const mr=[{name:"songView",path:"/songView/:songId",action:pr}],Je=e=>v(W,{mode:e}),hr=()=>v(Be),gr=()=>v(Ae),fr="/app/assets/logo-D2B3txiq.svg";function yr(){return r.jsx("div",{className:"logo",children:r.jsx("div",{className:"logo-isExpanded",children:r.jsx("div",{className:"logo-img",children:r.jsxs("svg",{className:"stacked",children:[r.jsx("title",{children:"Chord Chart Studio"}),r.jsx("use",{href:fr+"#stacked"})]})})})})}const br=C.memo(yr);function Qe(e){const{iconName:t}=e,n=["icon","material-icons"];return r.jsx("i",{className:n.join(" "),children:t})}Qe.propTypes={iconName:i.string.isRequired};const x=C.memo(Qe);function Xe(e){const{label:t,icon:n,editorMode:s,setEditorMode:o,isActive:a,isDisabled:l}=e,c=["mainNavEntry"];a&&c.push("mainNavEntry-isActive"),l&&c.push("mainNavEntry-isDisabled");function d(){l||o(s)}return r.jsxs("li",{className:c.join(" "),onClick:d,children:[r.jsx("span",{className:"mainNavEntry-icon",children:r.jsx(x,{iconName:n})}),t]})}Xe.propTypes={label:i.string.isRequired,icon:i.string.isRequired,editorMode:i.string.isRequired,setEditorMode:i.func.isRequired,isActive:i.bool.isRequired,isDisabled:i.bool.isRequired};const xr=C.memo(Xe);function Ze(e){const{currentMode:t,allEntries:n,setEditorMode:s,selectedId:o}=e;return r.jsx("nav",{className:"mainNav",children:r.jsx("ul",{className:"mainNav-entries",children:n.map((a,l)=>r.jsx(xr,{isActive:!!o&&a.editorMode===t,isDisabled:!o,setEditorMode:s,...a},l))})})}Ze.propTypes={currentMode:i.string.isRequired,setEditorMode:i.func.isRequired,selectedId:i.string,allEntries:i.arrayOf(i.shape({id:i.string.isRequired,label:i.string.isRequired,icon:i.string.isRequired,editorMode:i.string.isRequired}))};const Cr=C.memo(Ze),_=({children:e,isDisabled:t,buttonName:n,onClick:s,type:o})=>{const a=["Button"];return o==="primary"&&a.push("Button-primary"),o==="secondary"&&a.push("Button-secondary"),t&&a.push("Button-isDisabled"),r.jsx("button",{className:a.join(" "),disabled:t,type:"button",name:n,onClick:s,children:e})};_.propTypes={children:i.string.isRequired,isDisabled:i.bool,buttonName:i.string.isRequired,type:i.string.isRequired,onClick:i.func.isRequired};_.defaultProps={isDisabled:!1};const jr="https://chord-chart-studio.netlify.app",oe=()=>{const e=()=>{window.open(jr,"_blank").focus()};return r.jsxs("div",{className:"userGuide",children:[r.jsx("div",{className:"userGuide-isCollapsed",children:r.jsx(x,{iconName:"help_outline"})}),r.jsx("div",{className:"userGuide-isExpanded",children:r.jsx(_,{buttonName:"userGuide",type:"primary",onClick:e,children:"User Guide"})})]})};oe.propTypes={};oe.defaultProps={};const Rr=C.memo(oe),vr=()=>({"chord-chart-studio":"v0.14.0","chord-symbol":"v4.0.0","chord-mark":"v0.16.2"});function Fr(){const e=vr();return r.jsx("div",{className:"versions",children:r.jsxs("div",{className:"versions-isExpanded",children:["Chord Chart Studio ",e["chord-chart-studio"],r.jsx("br",{}),"ChordSymbol ",e["chord-symbol"]," ",r.jsx("br",{}),"ChordMark ",e["chord-mark"]," ",r.jsx("br",{}),"Logo by"," ",r.jsx("a",{href:"https://spelling-bee-assistant.app/",target:"_blank",rel:"noreferrer",children:"Dieter Raber"})]})})}const Nr=C.memo(Fr),Tr=e=>e.songImporter.content,Sr=e=>e.songImporter.inputFormat,wr=e=>e.songImporter.title,_r=e=>e.songImporter.isImporting,Er=e=>e.songImporter.isFromWeb;function ae(e){const{children:t,closeModal:n}=e;return R.useEffect(()=>{const s=o=>{o.key==="Escape"&&n()};return window.addEventListener("keyup",s),()=>{window.removeEventListener("keyup",s)}}),r.jsxs("section",{className:"mod-ModalContainer",children:[r.jsx("div",{className:"mod-Overlay",onClick:n,"data-testid":"modal-overlay"}),r.jsx("div",{className:"mod-ContentContainer",children:t})]})}ae.propTypes={children:i.element.isRequired,closeModal:i.func.isRequired};const et=({cancelImport:e,chordMarkContent:t,importFile:n,title:s,content:o,error:a})=>{const l=s?'Import "'+s+'"':"Import song",c=()=>{n(s||"[untitled]",t)};return r.jsxs("div",{className:"sim-Header_Container",children:[r.jsx("div",{className:"sim-Header_Title",children:l}),r.jsxs("div",{className:"sim-Header_Actions",children:[r.jsx(_,{onClick:e,buttonName:"cancel",type:"secondary",children:"CANCEL"}),r.jsx(_,{onClick:c,buttonName:"import",type:"primary",isDisabled:o===""||a!=="",children:"IMPORT"})]})]})};et.propTypes={cancelImport:i.func.isRequired,chordMarkContent:i.string,content:i.string,error:i.string,importFile:i.func.isRequired,title:i.string};const tt=50*1024,qr=e=>new Promise((t,n)=>{if(e.length){const s=e[0];Ir(s)?n(Or(s.size)):Mr(s)?s.text().then(o=>{t({content:o,title:Pr(s)})}).catch(o=>{n(o)}):n(Lr(s))}else n(kr())}),Pr=e=>e.name.substr(0,e.name.lastIndexOf(".")),Ir=e=>e.size>tt,Mr=e=>e.type.indexOf("text")===0||e.type.length===0,Or=e=>"The selected file is too big: "+Fe(e,{round:0})+" (maximum allowed file size is "+Fe(tt,{round:0})+").",Lr=e=>"Cannot import file of type "+e.type+".",kr=()=>"No file selected.",Br="text/*,.cho,.crd,.chopro,.chord,.pro,.txt,.md",nt=({setContent:e})=>{const t=n=>{qr(n.target.files).then(s=>{e(s.content,s.title)}).catch(s=>{e(s)})};return r.jsxs("div",{children:[r.jsx("label",{htmlFor:"importSong-Input",className:"Button Button-primary",children:"Select File"}),r.jsx("input",{id:"importSong-Input",name:"importSong-Input",type:"file",className:"sim-InputFile_Input",onChange:t,accept:Br})]})};nt.propTypes={setContent:i.func.isRequired};function le(e){const{content:t,setContent:n,isDisabled:s}=e,o=l=>{n(l.target.value)},a=["sim-Input_Textarea"];return s&&a.push("sim-Input_Textarea-Disabled"),r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"sim-Input_Header",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"Copy/paste below",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsx("textarea",{className:a.join(" "),onChange:o,value:t,disabled:s,"data-testid":"sim-input"})]})}le.propTypes={content:i.string.isRequired,isDisabled:i.bool.isRequired,setContent:i.func.isRequired};le.defaultProps={};function ce(e){const{inputFormat:t,error:n}=e;return r.jsxs("div",{className:"sim-Preview_Error",children:[r.jsxs("p",{children:["There was an error when trying to parse the song in the specified input format (",t,").",r.jsx("br",{}),"Please correct the input or try another format.",r.jsx("br",{}),"The error was:"]}),r.jsxs("p",{children:['"',n,'"']}),r.jsx("p",{children:'Hint: most of the time, this is related to an unclosed "[" or "{" or an unsupported ChordPro directive'})]})}ce.propTypes={error:i.string,inputFormat:i.string.isRequired};ce.defaultProps={};function de(e){const{setInputFormat:t,inputFormat:n,id:s,label:o,isDisabled:a}=e,l=u=>{a||t(u.target.value)},c=["sim-InputFormat_Entry"],d=["sim-InputFormat_Label"];return a&&(c.push("sim-InputFormat_Entry-Disabled"),d.push("sim-InputFormat_Label-Disabled")),r.jsxs(r.Fragment,{children:[r.jsx("input",{className:c.join(" "),type:"radio",name:"inputFormat",id:s,value:s,onChange:l,checked:n===s}),r.jsx("label",{className:d.join(" "),htmlFor:s,children:o})]})}de.propTypes={setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired,id:i.string.isRequired,label:i.string.isRequired,isDisabled:i.bool.isRequired};de.defaultProps={};const Ar=[{id:"auto",label:"Detect"},{id:"chordPro",label:"Bracketed chords (ChordPro)"},{id:"chordsOverLyrics",label:"Chords over lyrics (Ultimate Guitar...)"}];function ue(e){const{setInputFormat:t,inputFormat:n,disableAll:s}=e,o=Ar.map(a=>r.jsx(de,{setInputFormat:t,id:a.id,label:a.label,inputFormat:n,isDisabled:s},a.id));return r.jsxs("div",{className:"sim-InputFormat",children:["Input format:",o]})}ue.propTypes={disableAll:i.bool.isRequired,setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired};ue.defaultProps={};function pe(e){const{cancelImport:t,content:n,importFile:s,isFromWeb:o,isImporting:a,setContent:l,setInputFormat:c,inputFormat:d,title:u}=e;if(!a)return null;let h="",m="";try{h=Bt(n,{inputFormat:d})}catch(f){m=f.message}return r.jsx(ae,{closeModal:t,children:r.jsxs("div",{className:"sim-SongImporterModal_Container","data-testid":"song-importer",children:[r.jsx(et,{cancelImport:t,chordMarkContent:h,content:n,error:m,importFile:s,title:u}),r.jsxs("div",{className:"sim-TwoColumns_Container",children:[r.jsx("div",{className:"sim-Column_Container",children:r.jsx(nt,{setContent:l})}),r.jsx("div",{className:"sim-Column_Container",children:r.jsx(ue,{inputFormat:d,setInputFormat:c,disableAll:o===!0})})]}),r.jsxs("div",{className:"sim-TwoColumns_Container sim-TwoColumns_Container-autoHeight",children:[r.jsx("div",{className:"sim-Column_Container",children:r.jsx(le,{content:n,setContent:l,isDisabled:o})}),r.jsxs("div",{className:"sim-Column_Container",children:[r.jsxs("div",{className:"sim-Input_Header",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"ChordMark preview",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsx("div",{className:"sim-Preview_Container","data-testid":"sim-preview",children:m?r.jsx(ce,{inputFormat:d,error:m}):h})]})]})]})})}pe.propTypes={cancelImport:i.func.isRequired,content:i.string.isRequired,importFile:i.func.isRequired,isFromWeb:i.bool.isRequired,isImporting:i.bool.isRequired,setContent:i.func.isRequired,setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired,title:i.string};pe.defaultProps={};const Dr=T(e=>({content:Tr(e),isFromWeb:Er(e),isImporting:_r(e),inputFormat:Sr(e),title:wr(e)}),{setContent:Ln,setInputFormat:kn,cancelImport:Dn,importFile:K})(pe),Wr=[{id:"edit",label:"Edit",icon:"create",editorMode:"edit"},{id:"play",label:"Screen view",icon:"music_note",editorMode:"play"},{id:"print",label:"Print/PDF Preview",icon:"print",editorMode:"print"},{id:"export",label:"Export Preview",icon:"save_alt",editorMode:"export"}];function me(e){const{editorMode:t,isLeftBarCollapsed:n,isRightBarCollapsed:s,toggleLeftBar:o,toggleRightBar:a,setEditorMode:l,selectedId:c,leftBar:d,rightBar:u}=e,h=["leftBar"];n&&h.push("leftBar-isCollapsed");const m=["rightBar"];return s&&m.push("rightBar-isCollapsed"),r.jsxs("div",{className:"appLayout-wrapper",children:[r.jsx(Dr,{}),r.jsxs("section",{className:h.join(" "),children:[r.jsxs("div",{className:"leftBar-content",onClick:n?o:null,children:[r.jsx(br,{}),d]}),r.jsx("div",{className:"leftBar-collapser",onClick:o,"data-testid":"leftBar-collapser",children:r.jsx("span",{className:"leftBar-collapserIcon",children:r.jsx(x,{iconName:"keyboard_arrow_left"})})})]}),r.jsxs("section",{className:"appLayout-main",children:[r.jsx("section",{className:"appLayout-header",children:r.jsx(Cr,{allEntries:Wr,currentMode:t,setEditorMode:l,selectedId:c})}),r.jsx("section",{className:"appLayout-content",children:e.children})]}),r.jsxs("section",{className:m.join(" "),children:[r.jsx("div",{className:"rightBar-collapser",onClick:a,"data-testid":"rightBar-collapser",children:r.jsx("span",{className:"rightBar-collapserIcon",children:r.jsx(x,{iconName:"keyboard_arrow_right"})})}),r.jsxs("div",{className:"rightBar-content",onClick:s?a:null,children:[r.jsx(Rr,{}),u,r.jsx(Nr,{})]})]})]})}me.propTypes={children:i.element,isLeftBarCollapsed:i.bool,isRightBarCollapsed:i.bool,selectedId:i.string,toggleLeftBar:i.func.isRequired,toggleRightBar:i.func.isRequired,editorMode:i.string.isRequired,setEditorMode:i.func.isRequired,leftBar:i.element.isRequired,rightBar:i.element.isRequired};me.defaultProps={isLeftBarCollapsed:!1,isRightBarCollapsed:!1};const Gr=T(e=>({editorMode:q(e),isLeftBarCollapsed:rn(e),isRightBarCollapsed:sn(e),selectedId:S(e)}),{toggleLeftBar:hr,toggleRightBar:gr,setEditorMode:Je})(me),Hr=e=>v(se,{id:e}),$r=e=>v(We,{id:e});function zr(e,t={},n=!1){return st(e,t,n,"text")}function rt(e,t={},n=!1){return st(e,t,n,"html")}function st(e,t,n,s){if(n)switch(t.chartFormat){case"chordmark":{const a=O(e,t);return s==="html"?a:_e(a)}case"chordmarkSrc":return s==="html"?U(e):e;case"chordpro":{t.customRenderer=Wt();const a=O(e,t);return s==="html"?U(a):a}case"ultimateGuitar":{t.customRenderer=Ne();const a=O(e,{...t,customRenderer:Ne(),printBarSeparators:"grids",printChordsDuration:"never",printSubBeatDelimiters:!1,printInlineTimeSignatures:!1,chordSymbolRenderer:At({customFilters:[Dt()],useShortNamings:!0,accidentalsType:t.accidentalsType==="auto"?"original":t.accidentalsType,...t})})+`
-
-Created with Chord Chart Studio (https://chord-chart-studio.netlify.app)`;return s==="html"?U(a):a}}const o=O(e,{...t,wrapChordLyricLines:!0});return s==="html"?o:_e(o)}function O(e,t){try{const n=Gt(e);return Ht(n,{...t})}catch(n){return n.message}}function U(e){return e.split(`
-`).map(t=>t===""?" ":t).map(t=>`${t}`).join("")}function _e(e){return e.match(/(.*?<\/p>)/gm).map(n=>P(n)).map(n=>n===" "?"":n).join(`
-`)}function Vr(){const t=G().getState(),n=S(t),s=te(t,n),o={chartFormat:p(t,"editorPreferences","chartFormat"),transposeValue:p(t,"songPreferences","transposeValue"),accidentalsType:p(t,"songPreferences","accidentalsType"),symbolType:p(t,"songPreferences","symbolType"),chartType:p(t,"songFormatting","chartType"),alignChordsWithLyrics:p(t,"songFormatting","alignChordsWithLyrics"),alignBars:p(t,"songFormatting","alignBars"),autoRepeatChords:p(t,"songFormatting","autoRepeatChords"),expandSectionCopy:p(t,"songFormatting","expandSectionCopy")},a=zr(s.content,o,!0),l=o.chartFormat==="chordpro"?"cho":"txt",c=`${s.title}.${l}`,d=new Blob([a],{type:"text/plain;charset=utf-8",endings:"native"});$t.saveAs(d,c)}function it(e){const{confirmAction:t,confirmTitle:n="OK",cancelAction:s,cancelTitle:o="CANCEL",children:a}=e;return r.jsx(ae,{closeModal:s,children:r.jsxs("section",{className:"mod-ModalConfirmContainer",children:[r.jsx("div",{className:"mod-ModalConfirmMessage",children:a}),r.jsxs("div",{className:"mod-ModalConfirmButtons",children:[r.jsx(_,{onClick:s,type:"secondary",buttonName:"cancel",children:o}),r.jsx(_,{onClick:t,type:"primary",buttonName:"confirm",children:n})]})]})})}it.propTypes={confirmAction:i.func.isRequired,confirmTitle:i.string,cancelAction:i.func.isRequired,cancelTitle:i.string,children:i.node.isRequired};function ot(e){const{selected:t,deleteFile:n,isDeleting:s,setIsDeleting:o}=e;if(!s)return null;const a=()=>o(!1),l=()=>{o(!1),n(t)};return r.jsxs(it,{confirmAction:l,confirmTitle:"DELETE",cancelAction:a,children:["Are you sure you want to delete this file?",r.jsx("br",{}),"This action cannot be undone."]})}ot.propTypes={deleteFile:i.func.isRequired,isDeleting:i.bool.isRequired,selected:i.string.isRequired,setIsDeleting:i.func.isRequired};function at(e){const{icon:t,text:n,action:s,isDisabled:o}=e,a=["fileManagerAction"];o&&a.push("fileManagerAction-isDisabled");const l=()=>{o||s()};return r.jsx("span",{className:a.join(" "),onClick:l,children:r.jsxs("span",{className:"fileManagerAction-icon",children:[r.jsx(x,{iconName:t})," ",n]})})}at.propTypes={icon:i.string.isRequired,text:i.string.isRequired,action:i.func.isRequired,isDisabled:i.bool.isRequired};const Ur=C.memo(at);function lt(e){const{selected:t,createFile:n,deleteFile:s,enableRename:o,startImport:a,exportAsText:l,printFile:c}=e,d=[{icon:"upload",text:"Import",action:a,isDisabled:!1},{icon:"add_circle",text:"New",action:n,isDisabled:!1},{icon:"create",text:"Rename",action:o,isDisabled:!t},{icon:"delete",text:"Delete",action:s,isDisabled:!t},{icon:"print",text:"Print",action:c,isDisabled:!t},{icon:"download",text:"Export",action:l,isDisabled:!t}];return r.jsx("div",{className:"fileManager-actionsList",children:d.map((u,h)=>R.createElement(Ur,{...u,key:h}))})}lt.propTypes={selected:i.string,createFile:i.func.isRequired,deleteFile:i.func.isRequired,enableRename:i.func.isRequired,exportAsText:i.func.isRequired,printFile:i.func.isRequired,startImport:i.func.isRequired};const Kr=C.memo(lt);function ct(e){const[t,n]=R.useState(e.title),{fileId:s,isSelected:o,isRenamed:a,defaultTitle:l,selectFile:c,enableRename:d,updateFile:u}=e,h=["fileManagerEntry"];o&&h.push("fileManagerEntry-isSelected"),a&&h.push("fileManagerEntry-isRenamed");const m=C.createRef();R.useEffect(()=>{a&&m.current.focus()},[a,m]);function f(){o||c(s)}function g(b){a||(d(s),b.target.select())}function y(b){if(a&&b.which===13){b.preventDefault(),window.getSelection().removeAllRanges();const z=b.target.value;j(z)}}function w(b){n(b.target.value)}function N(b){a&&b.target.select()}function F(b){if(a){const z=b.target.value;j(z)}}function j(b){b=b||l,u(s,{title:b}),n(b),m.current.scrollLeft=0}return r.jsx("li",{className:h.join(" "),onClick:f,onDoubleClick:g,children:r.jsx("input",{className:"fileManagerEntry-input",ref:m,type:"text",value:t,readOnly:a?null:"readOnly",autoFocus:a?"autoFocus":null,onChange:w,onBlur:F,onFocus:N,onKeyPress:y})})}ct.propTypes={title:i.string.isRequired,fileId:i.string.isRequired,isSelected:i.bool.isRequired,isRenamed:i.bool.isRequired,defaultTitle:i.string.isRequired,selectFile:i.func.isRequired,enableRename:i.func.isRequired,updateFile:i.func.isRequired};function dt(e){const[t,n]=R.useState(!1),{allTitles:s,selected:o,renamed:a,defaultTitle:l,createFile:c,deleteFile:d,enableRename:u,startImport:h,selectFile:m,updateFile:f,setEditorMode:g}=e;return r.jsxs("div",{className:"fileManager",children:[r.jsx(ot,{deleteFile:d,isDeleting:t,selected:o,setIsDeleting:n}),r.jsx("div",{className:"fileManager-isCollapsed",children:r.jsx("span",{className:"fileManager-icon",children:r.jsx(x,{iconName:"file_copy"})})}),r.jsxs("div",{className:"fileManager-isExpanded",children:[r.jsx(Kr,{selected:o,createFile:()=>c(l),deleteFile:()=>n(!0),enableRename:()=>u(o),startImport:()=>h(),exportAsText:()=>{g("export"),setTimeout(()=>Vr(),0)},printFile:()=>{g("print"),setTimeout(()=>window.print(),0)}}),r.jsx("ul",{className:"fileManager-entriesList",children:s.map(y=>r.jsx(ct,{title:y.title,defaultTitle:l,fileId:y.id,isSelected:o===y.id,isRenamed:a===y.id,selectFile:m,updateFile:f,enableRename:u},y.id))})]})]})}dt.propTypes={allTitles:i.arrayOf(i.shape({title:i.string.isRequired,id:i.string.isRequired})).isRequired,selected:i.string.isRequired,renamed:i.string.isRequired,defaultTitle:i.string.isRequired,selectFile:i.func.isRequired,createFile:i.func.isRequired,deleteFile:i.func.isRequired,enableRename:i.func.isRequired,startImport:i.func.isRequired,updateFile:i.func.isRequired,setEditorMode:i.func.isRequired};const Yr=T(e=>({selected:S(e),renamed:on(e),defaultTitle:an(e),allTitles:ee(e)}),{selectFile:Hr,createFile:Vn,deleteFile:Un,updateFile:Ve,enableRename:$r,setEditorMode:Je,startImport:Bn})(dt);function ut(e){return Q.sanitize(e)}function he(e){const{content:t,useChartFormat:n}=e,s=k(e,["chartFormat","transposeValue","accidentalsType","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy"]),o=rt(t,s,n);return r.jsx("div",{className:"songRenderer",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:ut(o)}})})}he.propTypes={useChartFormat:i.bool.isRequired,chartFormat:i.string.isRequired,content:i.string};he.defaultProps={content:"",useChartFormat:!1};const ge=T(e=>({transposeValue:p(e,"songPreferences","transposeValue"),accidentalsType:p(e,"songPreferences","preferredAccidentals"),symbolType:p(e,"songPreferences","symbolType"),chartFormat:p(e,"editorPreferences","chartFormat"),chartType:p(e,"songFormatting","chartType"),alignChordsWithLyrics:p(e,"songFormatting","alignChordsWithLyrics"),alignBars:p(e,"songFormatting","alignBars"),autoRepeatChords:p(e,"songFormatting","autoRepeatChords"),expandSectionCopy:p(e,"songFormatting","expandSectionCopy")}))(he);function pt(e){const{selectedFile:t}=e,n=["editorPreview"];return r.jsx("div",{className:n.join(" "),children:r.jsx(ge,{content:t.content})})}pt.propTypes={selectedFile:i.object.isRequired};function Jr(){return[zt(),Te({"Mod-z":Vt,"Mod-y":Ut}),Te(Kt)]}const Qr=new Yt({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}},text:{group:"inline"}}});function Xr(e){return e.toJSON().doc.content.map(n=>n.content?n.content.reduce((s,o)=>(s+=o.text||`
-`,s),""):"").join(`
-`)}function Ee(e){const t={ALLOWED_TAGS:["p","#text"],KEEP_CONTENT:!1};return Q.sanitize(e,t)}function Zr(e){const t=Ee(e).split(`
-`).map(s=>`${s}
`).join(""),n=document.createElement("div");return n.innerHTML=Ee(t),n}function es(e){return Jt.create({doc:Qt.fromSchema(Qr).parse(Zr(e),{preserveWhitespace:"full"}),plugins:Jr()})}function ts(e,t,n){return new Xt(null,{state:e,dispatchTransaction:function(o){const{state:a,transactions:l}=this.state.applyTransaction(o);this.updateState(a),l.some(c=>c.docChanged)&&t(n,{content:Xr(a)})}})}function $(e){const{selectedFileId:t,editorContent:n,updateFile:s}=e,o=R.useRef(),a=R.useRef(),l=ns(t);function c(){return t&&(!o.current||l!==t)}function d(){return u()&&!t}function u(){return o.current&&o.current.dom.parentNode}function h(){o.current.dom.parentNode.removeChild(o.current.dom)}return R.useEffect(()=>{if(c()){u()&&h();const m=es(n);o.current=ts(m,s,t),a.current.appendChild(o.current.dom),$.editorView=o.current}else d()&&h()}),r.jsx("div",{className:"prosemirrorWrapper",ref:a})}$.defaultProps={selectedFileId:"",editorContent:""};$.propTypes={selectedFileId:i.string,editorContent:i.string,updateFile:i.func.isRequired};function ns(e){const t=R.useRef();return R.useEffect(()=>{t.current=e}),t.current}function mt(e){const{selectedFile:t,updateFile:n,theme:s}=e,o=["songEditor-preview","cmTheme-"+s,"cmTheme-fadeRepeats"];return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"songEditor-headers",children:[r.jsxs("div",{className:"songEditor-sourceHeader",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"ChordMark source (",r.jsx("a",{href:"https://chordmark.netlify.app/docs/getting-started",target:"_blank",rel:"noreferrer",className:"link1",children:"tutorial"}),")",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsxs("div",{className:"songEditor-previewHeader",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"Result preview",r.jsx(x,{iconName:"arrow_drop_down"})]})]}),r.jsx(Zt,{children:r.jsxs("div",{className:"songEditor",children:[r.jsx(Se,{group:"a",children:r.jsx("div",{className:"songEditor-source",children:r.jsx($,{editorContent:t.content,updateFile:n,selectedFileId:t.id})})}),r.jsx(Se,{group:"a",children:r.jsx("div",{className:o.join(" "),children:r.jsx(pt,{selectedFile:t})})})]})})]})}mt.propTypes={selectedFile:i.object,theme:i.string.isRequired,updateFile:i.func.isRequired};const rs=T(e=>({theme:p(e,"editorPreferences","theme")}))(mt);function ht(e){const{selectedFile:t}=e,n=C.createRef(),s=o=>{(o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="a"&&(o.preventDefault(),window.getSelection().selectAllChildren(n.current))};return R.useEffect(()=>(window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)})),r.jsx("div",{className:"exportPreview exp-SongRenderer",ref:n,children:r.jsx(ge,{content:t.content,useChartFormat:!0})})}ht.propTypes={selectedFile:i.object.isRequired};function gt(e){const{theme:t,selectedFile:n,fontSize:s,columnsCount:o}=e,a=["playRendererWrapper1"];a.push("cmTheme-"+t),a.push("cmSong--fontSize"+s);const l=["playRenderer"];return l.push("playRenderer--columns-"+o),r.jsx("div",{className:a.join(" "),"data-testid":"playRendererWrapper1",children:r.jsx("div",{className:"playRendererWrapper2",children:r.jsx("div",{className:l.join(" "),"data-testid":"playRenderer",children:r.jsx(ge,{content:n.content})})})})}gt.propTypes={theme:i.string.isRequired,fontSize:i.number.isRequired,selectedFile:i.object.isRequired,columnsCount:i.number.isRequired};const ss=T(e=>({theme:p(e,"editorPreferences","theme"),fontSize:p(e,"songFormatting","fontSize"),columnsCount:p(e,"songFormatting","columnsCount")}))(gt);function fe(e){const{pageHeader:t,allColumnsLines:n,documentSize:s,documentMargins:o,fontSize:a}=e,l=n.map((u,h)=>{const m=u.join("");return r.jsx("div",{className:"printPreview-pageColumn","data-testid":"printPreview-pageColumn",dangerouslySetInnerHTML:{__html:ut(m)}},h)}),c=["printPreview-page"];c.push("printPreview-page--"+s),c.push("cmSong--fontSize"+a),c.push("cmSong");const d=["printPreview-pageContentWrapper"];return d.push("printPreview-pageContentWrapper--padding"+o),r.jsx("div",{className:c.join(" "),"data-testid":"printPreview-page",children:r.jsx("div",{className:d.join(" "),"data-testid":"printPreview-pageContentWrapper",children:r.jsxs("div",{className:"printPreview-pageContent",children:[t,r.jsx("div",{className:"printPreview-pageColumnWrapper",children:l})]})})})}fe.defaultProps={allColumnsLines:[]};fe.propTypes={pageHeader:i.element,allColumnsLines:i.arrayOf(i.arrayOf(i.string)),documentSize:i.string.isRequired,documentMargins:i.number.isRequired,fontSize:i.number.isRequired};const ye=C.memo(fe);function be(e){const{title:t}=e;return r.jsx("div",{className:"printPreview-pageHeader",children:t})}be.defaultProps={allColumnsLines:[]};be.propTypes={title:i.string.isRequired};const ft=C.memo(be),xe={emptyLine:"cmEmptyLine",chordLine:"cmChordLine",textLine:"cmLyricLine"};function is(e,{columnsCount:t,firstPageHeight:n,normalPageHeight:s,columnBreakOnSection:o,noEmptyLinesOnColumnStart:a=!0,noOrphanTextLine:l=!0}){const c=ds({columnsCount:t,firstPageHeight:n,normalPageHeight:s,noEmptyLinesOnColumnStart:a});let d=[],u=0;return(n||s)>0&&e.forEach((m,f)=>{os(c,m,d,a)&&(d.push(m),u+=m.height),d.length>0&&as(m,e[f+1],{noOrphanTextLine:l,columnBreakOnSection:o})&&(c.fitsOnCurrentColumn(u)?c.insert(d):c.fitsOnNextColumn(u)?c.insertOnNextColumn(d):c.insert(d),d=[],u=0)}),c.get()}function os(e,t,n,s){return!(J(t)&&!e.fitsOnCurrentColumn(t.height)&&n.length===0&&s===!0)}function as(e,t,{noOrphanTextLine:n,columnBreakOnSection:s}){if(J(e)||!t)return!0;const o=ls(e)&&cs(t);if(n===!0&&o)return!1;const a=J(t);return!(s===!0&&!a)}function J(e){return Ce(e.content,xe.emptyLine)}function ls(e){return Ce(e.content,xe.chordLine)}function cs(e){return Ce(e.content,xe.textLine)}function Ce(e,t){return e.indexOf(t)>-1}function ds({firstPageHeight:e,normalPageHeight:t,columnsCount:n}){const s=[];let o=0,a=0,l=u(),c=0;s[o]=[],s[o][a]=[];function d(g){g.forEach(y=>{h(c+y.height)&&m(),s[o][a].push(y.content),c+=y.height})}function u(){return o===0&&e?e:t}function h(g){return g>l}function m(){f()?(o++,s[o]=[],a=0):a++,s[o][a]=[],c=0,l=u()}function f(){return a===n-1}return{insert(g){d(g)},insertOnNextColumn(g){m(),d(g)},fitsOnCurrentColumn(g){return c+g<=l},fitsOnNextColumn(g){const y=o===0&&a{const a=()=>(R.useLayoutEffect(()=>{const l=t(n);o(l)}),r.jsx("div",{children:e}));s.render(r.jsx(a,{}))}).then(o=>(s.unmount(),n.parentNode.removeChild(n),o))}function je(e,t=[]){for(let n=t.length||0;n{const d=[];return c.querySelectorAll(ps.line).forEach(u=>{d.push(us(u))}),d})}async function hs(e,{columnsCount:t,documentSize:n,documentMargins:s,fontSize:o}){const a=r.jsx(ye,{pageHeader:r.jsx(ft,{title:e}),allColumnsLines:je(t),documentSize:n,documentMargins:s,fontSize:o});return await yt(a,c=>{const d=c.querySelector(".printPreview-pageContent"),u=c.querySelector(".printPreview-pageColumnWrapper");return{firstPageHeight:qe(u),normalPageHeight:qe(d)}})}function bt(e){const[t,n]=R.useState([]),{title:s,allLines:o,columnsCount:a,columnBreakOnSection:l,documentSize:c,documentMargins:d,fontSize:u}=e;R.useLayoutEffect(()=>{(async()=>{const f={columnsCount:a,documentSize:c,documentMargins:d,fontSize:u},g=await ms(o,f),{normalPageHeight:y,firstPageHeight:w}=await hs(s,f),N=o.map((j,b)=>({content:j,height:g[b]})),F=is(N,{columnsCount:a,columnBreakOnSection:l,normalPageHeight:y,firstPageHeight:w});n(F)})()},[o,s,a,l,c,d,u]);const h=t.map((m,f)=>r.jsx(ye,{pageHeader:f===0?r.jsx(ft,{title:s}):null,allColumnsLines:je(a,m),documentSize:c,documentMargins:d,fontSize:u},f));return r.jsx(C.Fragment,{children:h})}bt.propTypes={title:i.string.isRequired,allLines:i.arrayOf(i.string).isRequired,columnsCount:i.number.isRequired,columnBreakOnSection:i.bool.isRequired,documentSize:i.string.isRequired,documentMargins:i.number.isRequired,fontSize:i.number.isRequired};function xt(e){const{selectedFile:t}=e,n=k(e,["transposeValue","accidentalsType","symbolType","chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy"]),o=rt(t.content||"",{...n}).match(/(.*?<\/p>)/gm),a=["printPreview","cmTheme-print"];return r.jsx("div",{className:a.join(" "),"data-testid":"printPreview",children:r.jsx(bt,{title:t.title||"",allLines:o,columnsCount:e.columnsCount,columnBreakOnSection:e.columnBreakOnSection,documentSize:e.documentSize||"a4",documentMargins:e.documentMargins,fontSize:e.fontSize})})}xt.propTypes={chartType:i.string.isRequired,selectedFile:i.object.isRequired,columnsCount:i.number.isRequired,columnBreakOnSection:i.bool.isRequired,documentSize:i.string,documentMargins:i.number.isRequired,fontSize:i.number.isRequired};const gs=T(e=>({accidentalsType:p(e,"songPreferences","preferredAccidentals"),transposeValue:p(e,"songPreferences","transposeValue"),symbolType:p(e,"songPreferences","symbolType"),chartType:p(e,"songFormatting","chartType"),alignChordsWithLyrics:p(e,"songFormatting","alignChordsWithLyrics"),alignBars:p(e,"songFormatting","alignBars"),autoRepeatChords:p(e,"songFormatting","autoRepeatChords"),expandSectionCopy:p(e,"songFormatting","expandSectionCopy"),columnsCount:p(e,"songFormatting","columnsCount"),columnBreakOnSection:p(e,"songFormatting","columnBreakOnSection"),documentMargins:p(e,"songFormatting","documentMargins"),fontSize:p(e,"songFormatting","fontSize")}))(xt);function Ct(e){const{editorMode:t}=e;switch(t){case"edit":return r.jsx(rs,{...e});case"play":return r.jsx(ss,{...e});case"print":return r.jsx(gs,{...e});case"export":return r.jsx(ht,{...e})}}Ct.propTypes={editorMode:i.string.isRequired};const fs=T(e=>({selectedFile:te(e,S(e))||{},editorMode:q(e)}),{updateFile:Ve})(Ct);function jt(e){const{id:t,allWidgets:n,nonInteractableWidgets:s,hiddenWidgets:o,setOption:a,getEntryComponent:l}=e,c=["optionsPanel","optionsPanel-"+t];let d,u,h,m,f,g,y;const w=n.widgetsOrder.filter(F=>!o.includes(F)).map(F=>(d=n.allWidgets[F],d.type==="optionsGroup"?(y=d.groupWidgetsOrder.filter(j=>!o.includes(j)).map(j=>(u=d.allGroupWidgets[j],g=!s.includes(F)&&!s.includes(j),N(j,u,g))),y.length===0?null:(m=l(d.type),f=!s.includes(F),r.jsx(m,{isInteractable:f,label:d.label,icon:d.icon,children:y},F))):N(F,d,!s.includes(F))));function N(F,j,b){return h=l(j.type),r.jsx(h,{isInteractable:b,optionContext:j.option.context,optionKey:j.option.key,optionValue:e[j.option.key],setOption:a,label:j.label,...j.typeOptions},F)}return r.jsx("div",{className:c.join(" "),children:w})}jt.propTypes={id:i.string.isRequired,allWidgets:i.object.isRequired,nonInteractableWidgets:i.arrayOf(i.string).isRequired,hiddenWidgets:i.arrayOf(i.string).isRequired,setOption:i.func.isRequired,getEntryComponent:i.func.isRequired};function Re(e){const{isInteractable:t,icon:n,label:s}=e,o=["sb-optionsGroup"];a()||o.push("sb-optionsGroup-isNotInteractable");function a(){return t&&e.children&&e.children.length>0}return r.jsxs("div",{className:o.join(" "),children:[r.jsxs("div",{className:"sb-optionsGroup-title",children:[r.jsx("span",{className:"sb-optionsGroup-iconTitle",children:r.jsx(x,{iconName:n})})," ",s]}),r.jsx("div",{className:"sb-optionsGroup-content",children:e.children})]})}Re.propTypes={isInteractable:i.bool.isRequired,icon:i.string.isRequired,label:i.string.isRequired,children:i.arrayOf(i.element)};Re.defaultProps={};function Rt(e){const{isSelected:t,isInteractable:n,label:s,onClick:o}=e;let a;const l=["sb-optionSelectChoice"];t&&(l.push("sb-optionSelectChoice-isSelected"),a=r.jsx("span",{className:"sb-optionSelectChoice-checkIcon",children:r.jsx(x,{iconName:"check"})})),n||l.push("sb-optionSelectChoice-isNotInteractable");function c(){n&&o()}return r.jsxs("div",{className:l.join(" "),onClick:c,children:[r.jsx("div",{className:"sb-optionSelectChoice-check",children:t&&a}),r.jsx("div",{className:"sb-optionSelectChoice-label",children:s})]})}Rt.propTypes={isSelected:i.bool.isRequired,isInteractable:i.bool.isRequired,label:i.string.isRequired,onClick:i.func.isRequired};const ys=C.memo(Rt);function vt(e){const[t,n]=R.useState(!1),{isInteractable:s,label:o,allChoices:a,optionContext:l,optionKey:c,optionValue:d,setOption:u}=e,h=["sb-optionSelect"];s||h.push("sb-optionSelect-isNotInteractable");const m=t?"keyboard_arrow_down":"keyboard_arrow_right";function f(){n(!t)}const g=t?r.jsx("div",{className:"sb-optionSelect-choices",children:a.map(N=>r.jsx(ys,{label:N.label,isSelected:d===N.value,isInteractable:s,onClick:()=>{u(l,c,N.value)}},N.value))}):null,y=a.find(N=>d===N.value).label,w=t?o:r.jsxs("span",{children:[r.jsx("span",{children:o+": "}),r.jsx("span",{className:"sb-optionSelectChoice-activeLabel",children:y})]});return r.jsxs("div",{className:h.join(" "),children:[r.jsxs("div",{className:"sb-optionSelect-title",onClick:s?f:null,children:[r.jsx("div",{className:"sb-optionSelect-desc","data-testid":"selectLabel",children:w}),r.jsx("div",{className:"sb-optionSelect-toggle",children:r.jsx("span",{className:"sb-optionSelect-icon",children:r.jsx(x,{iconName:m})})})]}),g]})}vt.propTypes={isInteractable:i.bool.isRequired,label:i.string.isRequired,allChoices:i.array.isRequired,optionContext:i.string.isRequired,optionKey:i.string.isRequired,optionValue:i.string.isRequired,setOption:i.func.isRequired};function ve(e){const{isInteractable:t,label:n,min:s,max:o,showPlusSymbol:a,optionContext:l,optionKey:c,optionValue:d,setOption:u}=e,h=["sb-optionSlider"];t||h.push("sb-optionSlider-isNotInteractable");function m(g){u(l,c,Number.parseInt(g.target.value))}const f=d>0&&a?"+"+d:d;return r.jsxs("div",{className:h.join(" "),children:[r.jsx("div",{className:"sb-optionSlider-desc",children:n}),r.jsx("div",{className:"sb-optionSlider-value",children:f}),r.jsx("div",{className:"sb-optionSlider-range",children:r.jsx("input",{min:s,max:o,value:d,type:"range",onChange:t?m:null,disabled:!t})})]})}ve.propTypes={isInteractable:i.bool.isRequired,label:i.string.isRequired,min:i.number.isRequired,max:i.number.isRequired,showPlusSymbol:i.bool,optionContext:i.string.isRequired,optionKey:i.string.isRequired,optionValue:i.number.isRequired,setOption:i.func.isRequired};ve.defaultProps={showPlusSymbol:!0};const bs=C.memo(ve);function Ft(e){const{isInteractable:t,label:n,optionContext:s,optionKey:o,optionValue:a,setOption:l}=e,c=["sb-optionToggle"];c.push(a===!0?"sb-optionToggle-isOn":"sb-optionToggle-isOff"),t||c.push("sb-optionToggle-isNotInteractable");function d(){l(s,o,!a)}return r.jsxs("div",{className:c.join(" "),onClick:t?d:null,children:[r.jsx("div",{className:"sb-optionToggle-desc",children:n}),r.jsx("div",{className:"sb-optionToggle-icon",children:r.jsx("span",{className:"sb-optionToggle-icon",children:r.jsx(x,{iconName:a===!0?"toggle_on":"toggle_off"})})})]})}Ft.propTypes={isInteractable:i.bool.isRequired,label:i.string.isRequired,optionContext:i.string.isRequired,optionKey:i.string.isRequired,optionValue:i.bool.isRequired,setOption:i.func.isRequired};const xs=C.memo(Ft);function Cs(e){switch(e){case"optionsGroup":return Re;case"select":return vt;case"slider":return bs;case"toggle":return xs}}function js(e){return r.jsx("div",{className:"sb-optionsPanel",children:r.jsx(jt,{...e,getEntryComponent:Cs})})}function Rs(e){return r.jsxs("div",{className:"renderingOptionsPanel",children:[r.jsx("div",{className:"renderingOptionsPanel-isCollapsed",children:r.jsx("span",{className:"renderingOptionsPanel-icon",children:r.jsx(x,{iconName:"settings"})})}),r.jsx("div",{className:"renderingOptionsPanel-isExpanded",children:r.jsx(js,{...e,id:"rendering"})})]})}const vs=(e,t,n)=>{if(!e)throw new TypeError("Cannot set an option without a context");if(!t)throw new TypeError("Cannot set an option without a key");return v(Z,{context:e,key:t,value:n})};function Fs(e,t,n,s){return T(o=>{const a={allWidgets:e,nonInteractableWidgets:t(o),hiddenWidgets:n(o)};let l,c;return e.widgetsOrder.forEach(d=>{l=e.allWidgets[d],l.groupWidgetsOrder.forEach(u=>{c=l.allGroupWidgets[u],a[c.option.key]=p(o,c.option.context,c.option.key)})}),a},{setOption:vs})(s)}const Ns={widgetsOrder:["editorPreferences","key","preferences","layout"],allWidgets:{editorPreferences:{label:"Editor preferences",type:"optionsGroup",icon:"tune",groupWidgetsOrder:["theme","chartFormat"],allGroupWidgets:{theme:{label:"Theme",type:"select",typeOptions:{allChoices:[{id:"themeDark1",label:"Dark 1 (default)",value:"dark1"},{id:"themeDark2",label:"Dark 2",value:"dark2"},{id:"themeDark3",label:"Dark 3",value:"dark3"}]},option:{context:"editorPreferences",key:"theme"}},chartFormat:{label:"Export format",type:"select",typeOptions:{allChoices:[{id:"formatChordMark",label:"ChordMark",value:"chordmark"},{id:"formatChordMarkSrc",label:"ChordMark (Source)",value:"chordmarkSrc"},{id:"formatChordpro",label:"ChordPro",value:"chordpro"},{id:"formatUG",label:"UltimateGuitar",value:"ultimateGuitar"}]},option:{context:"editorPreferences",key:"chartFormat"}}}},key:{label:"Key",type:"optionsGroup",icon:"music_note",groupWidgetsOrder:["transposeValue","preferredAccidentals","symbolType"],allGroupWidgets:{transposeValue:{label:"Transpose",type:"slider",typeOptions:{min:-11,max:11,showPlusSymbol:!0},option:{context:"songPreferences",key:"transposeValue"}},preferredAccidentals:{label:"Preferred accidentals",type:"select",typeOptions:{allChoices:[{id:"preferredAccidentalsAuto",label:"Auto",value:"auto"},{id:"preferredAccidentalsSharp",label:"♯",value:"sharp"},{id:"preferredAccidentalsFlat",label:"♭",value:"flat"}]},option:{context:"songPreferences",key:"preferredAccidentals"}},symbolType:{label:"Symbols type",type:"select",typeOptions:{allChoices:[{id:"symbolTypeChord",label:"Chord symbols",value:"chord"},{id:"symbolTypeRoman",label:"Roman numerals",value:"roman"}]},option:{context:"songPreferences",key:"symbolType"}}}},preferences:{label:"Chart settings",type:"optionsGroup",icon:"tune",groupWidgetsOrder:["chartType","alignChordsWithLyrics","alignBars","autoRepeatChords","expandSectionCopy"],allGroupWidgets:{chartType:{label:"Type",type:"select",typeOptions:{allChoices:[{id:"typedisplayAll",label:"Show everything",value:"all"},{id:"typedisplayLyrics",label:"Lyrics only",value:"lyrics"},{id:"typedisplayChords",label:"Chords only",value:"chords"},{id:"typedisplayChordsFirstLyricLine",label:"Chords + First lyric line",value:"chordsFirstLyricLine"}]},option:{context:"songFormatting",key:"chartType"}},alignChordsWithLyrics:{label:"Align chords with lyrics",type:"toggle",option:{context:"songFormatting",key:"alignChordsWithLyrics"}},alignBars:{label:"Align bars",type:"toggle",option:{context:"songFormatting",key:"alignBars"}},autoRepeatChords:{label:"Auto repeat chords",type:"toggle",option:{context:"songFormatting",key:"autoRepeatChords"}},expandSectionCopy:{label:"Expand copied sections",type:"toggle",option:{context:"songFormatting",key:"expandSectionCopy"}}}},layout:{type:"optionsGroup",label:"Layout",icon:"view_compact",groupWidgetsOrder:["fontSize","columnsCount","columnBreakOnSection","documentMargins"],allGroupWidgets:{fontSize:{label:"Font size",type:"slider",typeOptions:{min:-5,max:5,showPlusSymbol:!0},option:{context:"songFormatting",key:"fontSize"}},columnsCount:{label:"Columns",type:"slider",typeOptions:{min:1,max:4},option:{context:"songFormatting",key:"columnsCount"}},columnBreakOnSection:{label:"Column Break on section",type:"toggle",option:{context:"songFormatting",key:"columnBreakOnSection"}},documentMargins:{label:"Margins",type:"slider",typeOptions:{min:1,max:5},option:{context:"songFormatting",key:"documentMargins"}}}}}},Ts=e=>{const t=[],n=p(e,"songFormatting","chartType");n==="lyrics"?(t.push("alignChordsWithLyrics"),t.push("alignBars"),t.push("autoRepeatChords")):n==="chords"&&t.push("alignChordsWithLyrics");const s=p(e,"editorPreferences","chartFormat");return q(e)==="export"&&s==="chordmarkSrc"&&(t.push("chartType"),t.push("alignChordsWithLyrics"),t.push("alignBars"),t.push("autoRepeatChords"),t.push("expandSectionCopy")),t},Ss=e=>{const t=[],n=Object.keys({...I(e,"editorPreferences"),...I(e,"songFormatting"),...I(e,"songPreferences")});if(!S(e))return n;const o=q(e),a=en(n,re[o]);return t.push(...a),t},ws=Fs(Ns,Ts,Ss,Rs);function _s(){const e=r.jsx(Yr,{}),t=r.jsx(ws,{});return r.jsx(Gr,{leftBar:e,rightBar:t,children:r.jsx(fs,{})})}const Es=[{name:"home",path:"",action:_s},...ur,...mr];$n();function qs(){On(),Jn();const e=window?window.location.pathname+window.location.search:"/";return Zn.init(Es),H(e)}qs();
diff --git a/packages/chord-chart-studio/build/assets/vendor-3z0Gt4wU.js b/packages/chord-chart-studio/build/assets/vendor-3z0Gt4wU.js
new file mode 100644
index 0000000..14cf498
--- /dev/null
+++ b/packages/chord-chart-studio/build/assets/vendor-3z0Gt4wU.js
@@ -0,0 +1,142 @@
+var En=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function gS(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}function mO(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var yS=mO;function gO(t){return t}var $l=gO,yO=yS,jg=Math.max;function vO(t,e,n){return e=jg(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=jg(r.length-e,0),s=Array(o);++i0){if(++e>=T$)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var A$=k$,P$=x$,N$=A$,M$=N$(P$),xS=M$,_$=$l,I$=vS,D$=xS;function R$(t,e){return D$(I$(t,e,_$),t+"")}var zo=R$;function L$(){this.__data__=[],this.size=0}var F$=L$;function B$(t,e){return t===e||t!==t&&e!==e}var kl=B$,z$=kl;function j$(t,e){for(var n=t.length;n--;)if(z$(t[n][0],e))return n;return-1}var qu=j$,U$=qu,V$=Array.prototype,W$=V$.splice;function H$(t){var e=this.__data__,n=U$(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():W$.call(e,n,1),--this.size,!0}var G$=H$,K$=qu;function q$(t){var e=this.__data__,n=K$(e,t);return n<0?void 0:e[n][1]}var Y$=q$,J$=qu;function Q$(t){return J$(this.__data__,t)>-1}var X$=Q$,Z$=qu;function ek(t,e){var n=this.__data__,r=Z$(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var tk=ek,nk=F$,rk=G$,ik=Y$,ok=X$,sk=tk;function jo(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=dP}var Sh=pP,hP=fh,mP=Sh;function gP(t){return t!=null&&mP(t.length)&&!hP(t)}var Oi=gP,yP=Oi,vP=Nn;function SP(t){return vP(t)&&yP(t)}var ec=SP,Ya={exports:{}};function bP(){return!1}var wP=bP;Ya.exports;(function(t,e){var n=mn,r=wP,i=e&&!e.nodeType&&e,o=i&&!0&&t&&!t.nodeType&&t,s=o&&o.exports===i,l=s?n.Buffer:void 0,a=l?l.isBuffer:void 0,u=a||r;t.exports=u})(Ya,Ya.exports);var tc=Ya.exports,EP=xi,CP=gh,xP=Nn,TP="[object Object]",OP=Function.prototype,$P=Object.prototype,IS=OP.toString,kP=$P.hasOwnProperty,AP=IS.call(Object);function PP(t){if(!xP(t)||EP(t)!=TP)return!1;var e=CP(t);if(e===null)return!0;var n=kP.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&IS.call(n)==AP}var DS=PP,NP=xi,MP=Sh,_P=Nn,IP="[object Arguments]",DP="[object Array]",RP="[object Boolean]",LP="[object Date]",FP="[object Error]",BP="[object Function]",zP="[object Map]",jP="[object Number]",UP="[object Object]",VP="[object RegExp]",WP="[object Set]",HP="[object String]",GP="[object WeakMap]",KP="[object ArrayBuffer]",qP="[object DataView]",YP="[object Float32Array]",JP="[object Float64Array]",QP="[object Int8Array]",XP="[object Int16Array]",ZP="[object Int32Array]",eN="[object Uint8Array]",tN="[object Uint8ClampedArray]",nN="[object Uint16Array]",rN="[object Uint32Array]",we={};we[YP]=we[JP]=we[QP]=we[XP]=we[ZP]=we[eN]=we[tN]=we[nN]=we[rN]=!0;we[IP]=we[DP]=we[KP]=we[RP]=we[qP]=we[LP]=we[FP]=we[BP]=we[zP]=we[jP]=we[UP]=we[VP]=we[WP]=we[HP]=we[GP]=!1;function iN(t){return _P(t)&&MP(t.length)&&!!we[NP(t)]}var oN=iN;function sN(t){return function(e){return t(e)}}var Ho=sN,Ja={exports:{}};Ja.exports;(function(t,e){var n=bS,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,l=function(){try{var a=i&&i.require&&i.require("util").types;return a||s&&s.binding&&s.binding("util")}catch{}}();t.exports=l})(Ja,Ja.exports);var bh=Ja.exports,lN=oN,aN=Ho,Zg=bh,ey=Zg&&Zg.isTypedArray,uN=ey?aN(ey):lN,wh=uN;function cN(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var RS=cN,fN=hh,dN=kl,pN=Object.prototype,hN=pN.hasOwnProperty;function mN(t,e,n){var r=t[e];(!(hN.call(t,e)&&dN(r,n))||n===void 0&&!(e in t))&&fN(t,e,n)}var Eh=mN,gN=Eh,yN=hh;function vN(t,e,n,r){var i=!n;n||(n={});for(var o=-1,s=e.length;++o-1&&t%1==0&&t1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&xM(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++r"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ge(1));return n(Ch)(t,e)}if(typeof t!="function")throw new Error(Ge(2));var i=t,o=e,s=[],l=s,a=!1;function u(){l===s&&(l=s.slice())}function c(){if(a)throw new Error(Ge(3));return o}function d(v){if(typeof v!="function")throw new Error(Ge(4));if(a)throw new Error(Ge(5));var b=!0;return u(),l.push(v),function(){if(b){if(a)throw new Error(Ge(6));b=!1,u();var y=l.indexOf(v);l.splice(y,1),s=null}}}function f(v){if(!zM(v))throw new Error(Ge(7));if(typeof v.type>"u")throw new Error(Ge(8));if(a)throw new Error(Ge(9));try{a=!0,o=i(o,v)}finally{a=!1}for(var b=s=l,m=0;m"u")throw new Error(Ge(12));if(typeof n(void 0,{type:Ys.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ge(13))})}function VM(t){for(var e=Object.keys(t),n={},r=0;r"u")throw u&&u.type,new Error(Ge(14));d[p]=b,c=c||b!==v}return c=c||o.length!==Object.keys(a).length,c?d:a}}function uy(t,e){return function(){return e(t.apply(this,arguments))}}function WM(t,e){if(typeof t=="function")return uy(t,e);if(typeof t!="object"||t===null)throw new Error(Ge(16));var n={};for(var r in t){var i=t[r];typeof i=="function"&&(n[r]=uy(i,e))}return n}function US(){for(var t=arguments.length,e=new Array(t),n=0;n"u"){if(e)throw new Error("Reducer must return the initial state if the state is undefined.");return!1}return!0}Object.defineProperty(HS,"__esModule",{value:!0});var OQ=HS.default=ZM,JM=xh,QM=XM(JM);function XM(t){return t&&t.__esModule?t:{default:t}}function ZM(t){var e=Object.keys(t),n=void 0;try{for(var r=0;r"u"?{}:Object.assign({},i);function u(c,d,f){for(var p=0;p"u"?u(function(c){},o,void 0):typeof s>"u"?u(function(c){return i[c]},o,i):u(function(c){return i[c]},o,s),l?a:i}}var e_=xi,t_=Nn,n_="[object Symbol]";function r_(t){return typeof t=="symbol"||t_(t)&&e_(t)==n_}var Pl=r_,i_=vt,o_=Pl,s_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l_=/^\w*$/;function a_(t,e){if(i_(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||o_(t)?!0:l_.test(t)||!s_.test(t)||e!=null&&t in Object(e)}var Th=a_,GS=ph,u_="Expected a function";function Oh(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(u_);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Oh.Cache||GS),n}Oh.Cache=GS;var c_=Oh,f_=c_,d_=500;function p_(t){var e=f_(t,function(r){return n.size===d_&&n.clear(),r}),n=e.cache;return e}var h_=p_,m_=h_,g_=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,y_=/\\(\\)?/g,v_=m_(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(g_,function(n,r,i,o){e.push(i?o.replace(y_,"$1"):r||n)}),e}),S_=v_;function b_(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n0&&n(l)?e>1?JS(l,e-1,n,r,i):vI(i,l):r||(i[i.length]=l)}return i}var kh=JS,bI=kh;function wI(t){var e=t==null?0:t.length;return e?bI(t,1):[]}var EI=wI,CI=EI,xI=vS,TI=xS;function OI(t){return TI(xI(t,void 0,CI),t+"")}var QS=OI,$I=dI,kI=QS,AI=kI(function(t,e){return t==null?{}:$I(t,e)}),PI=AI;const $Q=xe(PI);var NI="__lodash_hash_undefined__";function MI(t){return this.__data__.set(t,NI),this}var _I=MI;function II(t){return this.__data__.has(t)}var DI=II,RI=ph,LI=_I,FI=DI;function Qa(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new RI;++el))return!1;var u=o.get(t),c=o.get(e);if(u&&c)return u==e&&c==t;var d=-1,f=!0,p=n&GI?new UI:void 0;for(o.set(t,e),o.set(e,t);++de||o&&s&&a&&!l&&!u||r&&s&&a||!n&&a||!i)return 1;if(!r&&!o&&!u&&t=l)return a;var u=n[r];return a*(u=="desc"?-1:1)}}return t.index-e.index}var C3=E3,uf=$i,x3=Nl,T3=sc,O3=ab,$3=v3,k3=Ho,A3=C3,P3=$l,N3=vt;function M3(t,e,n){e.length?e=uf(e,function(o){return N3(o)?function(s){return x3(s,o.length===1?o[0]:o)}:o}):e=[P3];var r=-1;e=uf(e,k3(T3));var i=O3(t,function(o,s,l){var a=uf(e,function(u){return u(o)});return{criteria:a,index:++r,value:o}});return $3(i,function(o,s){return A3(o,s,n)})}var _3=M3,I3=kh,D3=_3,R3=zo,Uy=jS,L3=R3(function(t,e){if(t==null)return[];var n=e.length;return n>1&&Uy(t,e[0],e[1])?e=[]:n>2&&Uy(e[0],e[1],e[2])&&(e=[e[0]]),D3(t,I3(e,1),[])}),F3=L3;const AQ=xe(F3);var Xa="NOT_FOUND";function B3(t){var e;return{get:function(r){return e&&t(e.key,r)?e.value:Xa},put:function(r,i){e={key:r,value:i}},getEntries:function(){return e?[e]:[]},clear:function(){e=void 0}}}function z3(t,e){var n=[];function r(l){var a=n.findIndex(function(c){return e(l,c.key)});if(a>-1){var u=n[a];return a>0&&(n.splice(a,1),n.unshift(u)),u.value}return Xa}function i(l,a){r(l)===Xa&&(n.unshift({key:l,value:a}),n.length>t&&n.pop())}function o(){return n}function s(){n=[]}return{get:r,put:i,getEntries:o,clear:s}}var j3=function(e,n){return e===n};function U3(t){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?e-1:0),r=1;r1?n-1:0),i=1;i2&&arguments[2]!==void 0?arguments[2]:Aa;Vy&&Vy(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const o=n(i);o!==i&&(W3(e)||(e[r]=o),i=o)}t[i]=!0}return t}function Q3(t){for(let e=0;e/gm),nB=dn(/\${[\w\W]*}/gm),rB=dn(/^data-[\-\w.\u00B7-\uFFFF]/),iB=dn(/^aria-[\-\w]+$/),gb=dn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),oB=dn(/^(?:\w+script|data):/i),sB=dn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yb=dn(/^html$/i);var Yy=Object.freeze({__proto__:null,MUSTACHE_EXPR:eB,ERB_EXPR:tB,TMPLIT_EXPR:nB,DATA_ATTR:rB,ARIA_ATTR:iB,IS_ALLOWED_URI:gb,IS_SCRIPT_OR_DATA:oB,ATTR_WHITESPACE:sB,DOCTYPE_NAME:yb});const lB=function(){return typeof window>"u"?null:window},aB=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}};function vb(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lB();const e=G=>vb(G);if(e.version="3.0.9",e.removed=[],!t||!t.document||t.document.nodeType!==9)return e.isSupported=!1,e;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:l,Element:a,NodeFilter:u,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=t,h=a.prototype,v=Yl(h,"cloneNode"),b=Yl(h,"nextSibling"),m=Yl(h,"childNodes"),y=Yl(h,"parentNode");if(typeof s=="function"){const G=n.createElement("template");G.content&&G.content.ownerDocument&&(n=G.content.ownerDocument)}let g,w="";const{implementation:C,createNodeIterator:x,createDocumentFragment:P,getElementsByTagName:S}=n,{importNode:A}=r;let I={};e.isSupported=typeof hb=="function"&&typeof y=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:$,TMPLIT_EXPR:T,DATA_ATTR:k,ARIA_ATTR:U,IS_SCRIPT_OR_DATA:ie,ATTR_WHITESPACE:De}=Yy;let{IS_ALLOWED_URI:B}=Yy,V=null;const q=Z({},[...Hy,...ff,...df,...pf,...Gy]);let Y=null;const ce=Z({},[...Ky,...hf,...qy,...Jl]);let L=Object.seal(mb(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Q=null,X=null,Ae=!0,ge=!0,Mn=!1,gn=!0,Pt=!1,tr=!1,wt=!1,_n=!1,Pi=!1,Vl=!1,Wl=!1,wg=!0,Eg=!1;const sO="user-content-";let Xc=!0,rs=!1,Ni={},Mi=null;const Cg=Z({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let xg=null;const Tg=Z({},["audio","video","img","source","image","track"]);let Zc=null;const Og=Z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Hl="http://www.w3.org/1998/Math/MathML",Gl="http://www.w3.org/2000/svg",In="http://www.w3.org/1999/xhtml";let _i=In,ef=!1,tf=null;const lO=Z({},[Hl,Gl,In],cf);let is=null;const aO=["application/xhtml+xml","text/html"],uO="text/html";let Re=null,Ii=null;const cO=n.createElement("form"),$g=function(E){return E instanceof RegExp||E instanceof Function},nf=function(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ii&&Ii===E)){if((!E||typeof E!="object")&&(E={}),E=Kr(E),is=aO.indexOf(E.PARSER_MEDIA_TYPE)===-1?uO:E.PARSER_MEDIA_TYPE,Re=is==="application/xhtml+xml"?cf:Aa,V=nn(E,"ALLOWED_TAGS")?Z({},E.ALLOWED_TAGS,Re):q,Y=nn(E,"ALLOWED_ATTR")?Z({},E.ALLOWED_ATTR,Re):ce,tf=nn(E,"ALLOWED_NAMESPACES")?Z({},E.ALLOWED_NAMESPACES,cf):lO,Zc=nn(E,"ADD_URI_SAFE_ATTR")?Z(Kr(Og),E.ADD_URI_SAFE_ATTR,Re):Og,xg=nn(E,"ADD_DATA_URI_TAGS")?Z(Kr(Tg),E.ADD_DATA_URI_TAGS,Re):Tg,Mi=nn(E,"FORBID_CONTENTS")?Z({},E.FORBID_CONTENTS,Re):Cg,Q=nn(E,"FORBID_TAGS")?Z({},E.FORBID_TAGS,Re):{},X=nn(E,"FORBID_ATTR")?Z({},E.FORBID_ATTR,Re):{},Ni=nn(E,"USE_PROFILES")?E.USE_PROFILES:!1,Ae=E.ALLOW_ARIA_ATTR!==!1,ge=E.ALLOW_DATA_ATTR!==!1,Mn=E.ALLOW_UNKNOWN_PROTOCOLS||!1,gn=E.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Pt=E.SAFE_FOR_TEMPLATES||!1,tr=E.WHOLE_DOCUMENT||!1,Pi=E.RETURN_DOM||!1,Vl=E.RETURN_DOM_FRAGMENT||!1,Wl=E.RETURN_TRUSTED_TYPE||!1,_n=E.FORCE_BODY||!1,wg=E.SANITIZE_DOM!==!1,Eg=E.SANITIZE_NAMED_PROPS||!1,Xc=E.KEEP_CONTENT!==!1,rs=E.IN_PLACE||!1,B=E.ALLOWED_URI_REGEXP||gb,_i=E.NAMESPACE||In,L=E.CUSTOM_ELEMENT_HANDLING||{},E.CUSTOM_ELEMENT_HANDLING&&$g(E.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(L.tagNameCheck=E.CUSTOM_ELEMENT_HANDLING.tagNameCheck),E.CUSTOM_ELEMENT_HANDLING&&$g(E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(L.attributeNameCheck=E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),E.CUSTOM_ELEMENT_HANDLING&&typeof E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Pt&&(ge=!1),Vl&&(Pi=!0),Ni&&(V=Z({},Gy),Y=[],Ni.html===!0&&(Z(V,Hy),Z(Y,Ky)),Ni.svg===!0&&(Z(V,ff),Z(Y,hf),Z(Y,Jl)),Ni.svgFilters===!0&&(Z(V,df),Z(Y,hf),Z(Y,Jl)),Ni.mathMl===!0&&(Z(V,pf),Z(Y,qy),Z(Y,Jl))),E.ADD_TAGS&&(V===q&&(V=Kr(V)),Z(V,E.ADD_TAGS,Re)),E.ADD_ATTR&&(Y===ce&&(Y=Kr(Y)),Z(Y,E.ADD_ATTR,Re)),E.ADD_URI_SAFE_ATTR&&Z(Zc,E.ADD_URI_SAFE_ATTR,Re),E.FORBID_CONTENTS&&(Mi===Cg&&(Mi=Kr(Mi)),Z(Mi,E.FORBID_CONTENTS,Re)),Xc&&(V["#text"]=!0),tr&&Z(V,["html","head","body"]),V.table&&(Z(V,["tbody"]),delete Q.tbody),E.TRUSTED_TYPES_POLICY){if(typeof E.TRUSTED_TYPES_POLICY.createHTML!="function")throw cs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof E.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw cs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');g=E.TRUSTED_TYPES_POLICY,w=g.createHTML("")}else g===void 0&&(g=aB(p,i)),g!==null&&typeof w=="string"&&(w=g.createHTML(""));ht&&ht(E),Ii=E}},kg=Z({},["mi","mo","mn","ms","mtext"]),Ag=Z({},["foreignobject","desc","title","annotation-xml"]),fO=Z({},["title","style","font","a","script"]),Pg=Z({},[...ff,...df,...X3]),Ng=Z({},[...pf,...Z3]),dO=function(E){let R=y(E);(!R||!R.tagName)&&(R={namespaceURI:_i,tagName:"template"});const H=Aa(E.tagName),ye=Aa(R.tagName);return tf[E.namespaceURI]?E.namespaceURI===Gl?R.namespaceURI===In?H==="svg":R.namespaceURI===Hl?H==="svg"&&(ye==="annotation-xml"||kg[ye]):!!Pg[H]:E.namespaceURI===Hl?R.namespaceURI===In?H==="math":R.namespaceURI===Gl?H==="math"&&Ag[ye]:!!Ng[H]:E.namespaceURI===In?R.namespaceURI===Gl&&!Ag[ye]||R.namespaceURI===Hl&&!kg[ye]?!1:!Ng[H]&&(fO[H]||!Pg[H]):!!(is==="application/xhtml+xml"&&tf[E.namespaceURI]):!1},Vr=function(E){as(e.removed,{element:E});try{E.parentNode.removeChild(E)}catch{E.remove()}},rf=function(E,R){try{as(e.removed,{attribute:R.getAttributeNode(E),from:R})}catch{as(e.removed,{attribute:null,from:R})}if(R.removeAttribute(E),E==="is"&&!Y[E])if(Pi||Vl)try{Vr(R)}catch{}else try{R.setAttribute(E,"")}catch{}},Mg=function(E){let R=null,H=null;if(_n)E=""+E;else{const Ze=K3(E,/^[\r\n\t ]+/);H=Ze&&Ze[0]}is==="application/xhtml+xml"&&_i===In&&(E=''+E+"");const ye=g?g.createHTML(E):E;if(_i===In)try{R=new f().parseFromString(ye,is)}catch{}if(!R||!R.documentElement){R=C.createDocument(_i,"template",null);try{R.documentElement.innerHTML=ef?w:ye}catch{}}const Xe=R.body||R.documentElement;return E&&H&&Xe.insertBefore(n.createTextNode(H),Xe.childNodes[0]||null),_i===In?S.call(R,tr?"html":"body")[0]:tr?R.documentElement:Xe},_g=function(E){return x.call(E.ownerDocument||E,E,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,null)},pO=function(E){return E instanceof d&&(typeof E.nodeName!="string"||typeof E.textContent!="string"||typeof E.removeChild!="function"||!(E.attributes instanceof c)||typeof E.removeAttribute!="function"||typeof E.setAttribute!="function"||typeof E.namespaceURI!="string"||typeof E.insertBefore!="function"||typeof E.hasChildNodes!="function")},Ig=function(E){return typeof l=="function"&&E instanceof l},Dn=function(E,R,H){I[E]&&ql(I[E],ye=>{ye.call(e,R,H,Ii)})},Dg=function(E){let R=null;if(Dn("beforeSanitizeElements",E,null),pO(E))return Vr(E),!0;const H=Re(E.nodeName);if(Dn("uponSanitizeElement",E,{tagName:H,allowedTags:V}),E.hasChildNodes()&&!Ig(E.firstElementChild)&&Nt(/<[/\w]/g,E.innerHTML)&&Nt(/<[/\w]/g,E.textContent))return Vr(E),!0;if(!V[H]||Q[H]){if(!Q[H]&&Lg(H)&&(L.tagNameCheck instanceof RegExp&&Nt(L.tagNameCheck,H)||L.tagNameCheck instanceof Function&&L.tagNameCheck(H)))return!1;if(Xc&&!Mi[H]){const ye=y(E)||E.parentNode,Xe=m(E)||E.childNodes;if(Xe&&ye){const Ze=Xe.length;for(let Et=Ze-1;Et>=0;--Et)ye.insertBefore(v(Xe[Et],!0),b(E))}}return Vr(E),!0}return E instanceof a&&!dO(E)||(H==="noscript"||H==="noembed"||H==="noframes")&&Nt(/<\/no(script|embed|frames)/i,E.innerHTML)?(Vr(E),!0):(Pt&&E.nodeType===3&&(R=E.textContent,ql([M,$,T],ye=>{R=us(R,ye," ")}),E.textContent!==R&&(as(e.removed,{element:E.cloneNode()}),E.textContent=R)),Dn("afterSanitizeElements",E,null),!1)},Rg=function(E,R,H){if(wg&&(R==="id"||R==="name")&&(H in n||H in cO))return!1;if(!(ge&&!X[R]&&Nt(k,R))){if(!(Ae&&Nt(U,R))){if(!Y[R]||X[R]){if(!(Lg(E)&&(L.tagNameCheck instanceof RegExp&&Nt(L.tagNameCheck,E)||L.tagNameCheck instanceof Function&&L.tagNameCheck(E))&&(L.attributeNameCheck instanceof RegExp&&Nt(L.attributeNameCheck,R)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(R))||R==="is"&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&Nt(L.tagNameCheck,H)||L.tagNameCheck instanceof Function&&L.tagNameCheck(H))))return!1}else if(!Zc[R]){if(!Nt(B,us(H,De,""))){if(!((R==="src"||R==="xlink:href"||R==="href")&&E!=="script"&&q3(H,"data:")===0&&xg[E])){if(!(Mn&&!Nt(ie,us(H,De,"")))){if(H)return!1}}}}}}return!0},Lg=function(E){return E!=="annotation-xml"&&E.indexOf("-")>0},Fg=function(E){Dn("beforeSanitizeAttributes",E,null);const{attributes:R}=E;if(!R)return;const H={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y};let ye=R.length;for(;ye--;){const Xe=R[ye],{name:Ze,namespaceURI:Et,value:Wr}=Xe,ss=Re(Ze);let Ct=Ze==="value"?Wr:Y3(Wr);if(H.attrName=ss,H.attrValue=Ct,H.keepAttr=!0,H.forceKeepAttr=void 0,Dn("uponSanitizeAttribute",E,H),Ct=H.attrValue,H.forceKeepAttr||(rf(Ze,E),!H.keepAttr))continue;if(!gn&&Nt(/\/>/i,Ct)){rf(Ze,E);continue}Pt&&ql([M,$,T],zg=>{Ct=us(Ct,zg," ")});const Bg=Re(E.nodeName);if(Rg(Bg,ss,Ct)){if(Eg&&(ss==="id"||ss==="name")&&(rf(Ze,E),Ct=sO+Ct),g&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Et)switch(p.getAttributeType(Bg,ss)){case"TrustedHTML":{Ct=g.createHTML(Ct);break}case"TrustedScriptURL":{Ct=g.createScriptURL(Ct);break}}try{Et?E.setAttributeNS(Et,Ze,Ct):E.setAttribute(Ze,Ct),Wy(e.removed)}catch{}}}Dn("afterSanitizeAttributes",E,null)},hO=function G(E){let R=null;const H=_g(E);for(Dn("beforeSanitizeShadowDOM",E,null);R=H.nextNode();)Dn("uponSanitizeShadowNode",R,null),!Dg(R)&&(R.content instanceof o&&G(R.content),Fg(R));Dn("afterSanitizeShadowDOM",E,null)};return e.sanitize=function(G){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=null,H=null,ye=null,Xe=null;if(ef=!G,ef&&(G=""),typeof G!="string"&&!Ig(G))if(typeof G.toString=="function"){if(G=G.toString(),typeof G!="string")throw cs("dirty is not a string, aborting")}else throw cs("toString is not a function");if(!e.isSupported)return G;if(wt||nf(E),e.removed=[],typeof G=="string"&&(rs=!1),rs){if(G.nodeName){const Wr=Re(G.nodeName);if(!V[Wr]||Q[Wr])throw cs("root node is forbidden and cannot be sanitized in-place")}}else if(G instanceof l)R=Mg(""),H=R.ownerDocument.importNode(G,!0),H.nodeType===1&&H.nodeName==="BODY"||H.nodeName==="HTML"?R=H:R.appendChild(H);else{if(!Pi&&!Pt&&!tr&&G.indexOf("<")===-1)return g&&Wl?g.createHTML(G):G;if(R=Mg(G),!R)return Pi?null:Wl?w:""}R&&_n&&Vr(R.firstChild);const Ze=_g(rs?G:R);for(;ye=Ze.nextNode();)Dg(ye)||(ye.content instanceof o&&hO(ye.content),Fg(ye));if(rs)return G;if(Pi){if(Vl)for(Xe=P.call(R.ownerDocument);R.firstChild;)Xe.appendChild(R.firstChild);else Xe=R;return(Y.shadowroot||Y.shadowrootmode)&&(Xe=A.call(r,Xe,!0)),Xe}let Et=tr?R.outerHTML:R.innerHTML;return tr&&V["!doctype"]&&R.ownerDocument&&R.ownerDocument.doctype&&R.ownerDocument.doctype.name&&Nt(yb,R.ownerDocument.doctype.name)&&(Et="
+`+Et),Pt&&ql([M,$,T],Wr=>{Et=us(Et,Wr," ")}),g&&Wl?g.createHTML(Et):Et},e.setConfig=function(){let G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nf(G),wt=!0},e.clearConfig=function(){Ii=null,wt=!1},e.isValidAttribute=function(G,E,R){Ii||nf({});const H=Re(G),ye=Re(E);return Rg(H,ye,R)},e.addHook=function(G,E){typeof E=="function"&&(I[G]=I[G]||[],as(I[G],E))},e.removeHook=function(G){if(I[G])return Wy(I[G])},e.removeHooks=function(G){I[G]&&(I[G]=[])},e.removeAllHooks=function(){I={}},e}var lc=vb();let Ql;const uB=new Uint8Array(16);function cB(){if(!Ql&&(Ql=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ql))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ql(uB)}const He=[];for(let t=0;t<256;++t)He.push((t+256).toString(16).slice(1));function fB(t,e=0){return He[t[e+0]]+He[t[e+1]]+He[t[e+2]]+He[t[e+3]]+"-"+He[t[e+4]]+He[t[e+5]]+"-"+He[t[e+6]]+He[t[e+7]]+"-"+He[t[e+8]]+He[t[e+9]]+"-"+He[t[e+10]]+He[t[e+11]]+He[t[e+12]]+He[t[e+13]]+He[t[e+14]]+He[t[e+15]]}const dB=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Jy={randomUUID:dB};function MQ(t,e,n){if(Jy.randomUUID&&!e&&!t)return Jy.randomUUID();t=t||{};const r=t.random||(t.rng||cB)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return fB(r)}function pB(t){for(var e=[],n=0;n=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||s===95){i+=t[o++];continue}break}if(!i)throw new TypeError("Missing parameter name at ".concat(n));e.push({type:"NAME",index:n,value:i}),n=o;continue}if(r==="("){var l=1,a="",o=n+1;if(t[o]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(o));for(;o)?(?!\?)/g,r=0,i=n.exec(t.source);i;)e.push({name:i[1]||r++,prefix:"",suffix:"",modifier:"",pattern:""}),i=n.exec(t.source);return t}function vB(t,e,n){var r=t.map(function(i){return bb(i,e,n).source});return new RegExp("(?:".concat(r.join("|"),")"),_h(n))}function SB(t,e,n){return bB(Sb(t,n),e,n)}function bB(t,e,n){n===void 0&&(n={});for(var r=n.strict,i=r===void 0?!1:r,o=n.start,s=o===void 0?!0:o,l=n.end,a=l===void 0?!0:l,u=n.encode,c=u===void 0?function(I){return I}:u,d=n.delimiter,f=d===void 0?"/#?":d,p=n.endsWith,h=p===void 0?"":p,v="[".concat(Vi(h),"]|$"),b="[".concat(Vi(f),"]"),m=s?"^":"",y=0,g=t;y-1:S===void 0;i||(m+="(?:".concat(b,"(?=").concat(v,"))?")),A||(m+="(?=".concat(b,"|").concat(v,")"))}return new RegExp(m,_h(n))}function bb(t,e,n){return t instanceof RegExp?yB(t,e):Array.isArray(t)?vB(t,e,n):SB(t,e,n)}/*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */function wB(t){try{return decodeURIComponent(t)}catch{return t}}function wb(t,e,n,r,i){var o,s,l=0;return{next:function(u){if(t===u)return{done:!0,value:!1};if(!o){var c=t,d=!c.children;if(c.match||(c.match=mB(c.path||"",Object.assign({end:d},n))),o=c.match(r),o){var f=o,p=f.path;return o.path=!d&&p.charAt(p.length-1)==="/"?p.substr(1):p,o.params=Object.assign({},i,o.params),{done:!1,value:{route:t,baseUrl:e,path:o.path,params:o.params}}}}if(o&&t.children)for(;l"u"||!Fe?ee:Fe(Uint8Array),si={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ee:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ee:ArrayBuffer,"%ArrayIteratorPrototype%":Di&&Fe?Fe([][Symbol.iterator]()):ee,"%AsyncFromSyncIteratorPrototype%":ee,"%AsyncFunction%":Wi,"%AsyncGenerator%":Wi,"%AsyncGeneratorFunction%":Wi,"%AsyncIteratorPrototype%":Wi,"%Atomics%":typeof Atomics>"u"?ee:Atomics,"%BigInt%":typeof BigInt>"u"?ee:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ee:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ee:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ee:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":GB,"%eval%":eval,"%EvalError%":KB,"%Float32Array%":typeof Float32Array>"u"?ee:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ee:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ee:FinalizationRegistry,"%Function%":xb,"%GeneratorFunction%":Wi,"%Int8Array%":typeof Int8Array>"u"?ee:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ee:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ee:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Di&&Fe?Fe(Fe([][Symbol.iterator]())):ee,"%JSON%":typeof JSON=="object"?JSON:ee,"%Map%":typeof Map>"u"?ee:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Di||!Fe?ee:Fe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ee:Promise,"%Proxy%":typeof Proxy>"u"?ee:Proxy,"%RangeError%":qB,"%ReferenceError%":YB,"%Reflect%":typeof Reflect>"u"?ee:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ee:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Di||!Fe?ee:Fe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ee:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Di&&Fe?Fe(""[Symbol.iterator]()):ee,"%Symbol%":Di?Symbol:ee,"%SyntaxError%":Eo,"%ThrowTypeError%":QB,"%TypedArray%":ZB,"%TypeError%":ao,"%Uint8Array%":typeof Uint8Array>"u"?ee:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ee:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ee:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ee:Uint32Array,"%URIError%":JB,"%WeakMap%":typeof WeakMap>"u"?ee:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ee:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ee:WeakSet};if(Fe)try{null.error}catch(t){var e6=Fe(Fe(t));si["%Error.prototype%"]=e6}var t6=function t(e){var n;if(e==="%AsyncFunction%")n=gf("async function () {}");else if(e==="%GeneratorFunction%")n=gf("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=gf("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Fe&&(n=Fe(i.prototype))}return si[e]=n,n},Zy={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},_l=Ih,Za=HB,n6=_l.call(Function.call,Array.prototype.concat),r6=_l.call(Function.apply,Array.prototype.splice),ev=_l.call(Function.call,String.prototype.replace),eu=_l.call(Function.call,String.prototype.slice),i6=_l.call(Function.call,RegExp.prototype.exec),o6=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,s6=/\\(\\)?/g,l6=function(e){var n=eu(e,0,1),r=eu(e,-1);if(n==="%"&&r!=="%")throw new Eo("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Eo("invalid intrinsic syntax, expected opening `%`");var i=[];return ev(e,o6,function(o,s,l,a){i[i.length]=l?ev(a,s6,"$1"):s||o}),i},a6=function(e,n){var r=e,i;if(Za(Zy,r)&&(i=Zy[r],r="%"+i[0]+"%"),Za(si,r)){var o=si[r];if(o===Wi&&(o=t6(r)),typeof o>"u"&&!n)throw new ao("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Eo("intrinsic "+e+" does not exist!")},Qo=function(e,n){if(typeof e!="string"||e.length===0)throw new ao("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new ao('"allowMissing" argument must be a boolean');if(i6(/^%?[^%]*%?$/,e)===null)throw new Eo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=l6(e),i=r.length>0?r[0]:"",o=a6("%"+i+"%",n),s=o.name,l=o.value,a=!1,u=o.alias;u&&(i=u[0],r6(r,n6([0,1],u)));for(var c=1,d=!0;c=r.length){var v=oi(l,f);d=!!v,d&&"get"in v&&!("originalValue"in v.get)?l=v.get:l=l[f]}else d=Za(l,f),l=l[f];d&&!a&&(si[s]=l)}}return l},Tb={exports:{}},vf,tv;function Dh(){if(tv)return vf;tv=1;var t=Qo,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return vf=e,vf}var u6=Qo,Pa=u6("%Object.getOwnPropertyDescriptor%",!0);if(Pa)try{Pa([],"length")}catch{Pa=null}var Ob=Pa,nv=Dh(),c6=Cb,Ri=Ml,rv=Ob,f6=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Ri("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Ri("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ri("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ri("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ri("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ri("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,a=!!rv&&rv(e,n);if(nv)nv(e,n,{configurable:s===null&&a?a.configurable:!s,enumerable:i===null&&a?a.enumerable:!i,value:r,writable:o===null&&a?a.writable:!o});else if(l||!i&&!o&&!s)e[n]=r;else throw new c6("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Dd=Dh(),$b=function(){return!!Dd};$b.hasArrayLengthDefineBug=function(){if(!Dd)return null;try{return Dd([],"length",{value:1}).length!==1}catch{return!0}};var d6=$b,p6=Qo,iv=f6,h6=d6(),ov=Ob,sv=Ml,m6=p6("%Math.floor%"),g6=function(e,n){if(typeof e!="function")throw new sv("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||m6(n)!==n)throw new sv("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&ov){var s=ov(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(o=!1)}return(i||o||!r)&&(h6?iv(e,"length",n,!0,!0):iv(e,"length",n)),e};(function(t){var e=Ih,n=Qo,r=g6,i=Ml,o=n("%Function.prototype.apply%"),s=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||e.call(s,o),a=Dh(),u=n("%Math.max%");t.exports=function(f){if(typeof f!="function")throw new i("a function is required");var p=l(e,s,arguments);return r(p,1+u(0,f.length-(arguments.length-1)),!0)};var c=function(){return l(e,o,arguments)};a?a(t.exports,"apply",{value:c}):t.exports.apply=c})(Tb);var y6=Tb.exports,kb=Qo,Ab=y6,v6=Ab(kb("String.prototype.indexOf")),S6=function(e,n){var r=kb(e,!!n);return typeof r=="function"&&v6(e,".prototype.")>-1?Ab(r):r};const b6={},w6=Object.freeze(Object.defineProperty({__proto__:null,default:b6},Symbol.toStringTag,{value:"Module"})),E6=gS(w6);var Rh=typeof Map=="function"&&Map.prototype,Sf=Object.getOwnPropertyDescriptor&&Rh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,tu=Rh&&Sf&&typeof Sf.get=="function"?Sf.get:null,lv=Rh&&Map.prototype.forEach,Lh=typeof Set=="function"&&Set.prototype,bf=Object.getOwnPropertyDescriptor&&Lh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,nu=Lh&&bf&&typeof bf.get=="function"?bf.get:null,av=Lh&&Set.prototype.forEach,C6=typeof WeakMap=="function"&&WeakMap.prototype,As=C6?WeakMap.prototype.has:null,x6=typeof WeakSet=="function"&&WeakSet.prototype,Ps=x6?WeakSet.prototype.has:null,T6=typeof WeakRef=="function"&&WeakRef.prototype,uv=T6?WeakRef.prototype.deref:null,O6=Boolean.prototype.valueOf,$6=Object.prototype.toString,k6=Function.prototype.toString,A6=String.prototype.match,Fh=String.prototype.slice,pr=String.prototype.replace,P6=String.prototype.toUpperCase,cv=String.prototype.toLowerCase,Pb=RegExp.prototype.test,fv=Array.prototype.concat,wn=Array.prototype.join,N6=Array.prototype.slice,dv=Math.floor,Rd=typeof BigInt=="function"?BigInt.prototype.valueOf:null,wf=Object.getOwnPropertySymbols,Ld=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Co=typeof Symbol=="function"&&typeof Symbol.iterator=="object",lt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Co||!0)?Symbol.toStringTag:null,Nb=Object.prototype.propertyIsEnumerable,pv=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function hv(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Pb.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-dv(-t):dv(t);if(r!==t){var i=String(r),o=Fh.call(e,i.length+1);return pr.call(i,n,"$&_")+"."+pr.call(pr.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return pr.call(e,n,"$&_")}var Fd=E6,mv=Fd.custom,gv=_b(mv)?mv:null,M6=function t(e,n,r,i){var o=n||{};if(ir(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ir(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=ir(o,"customInspect")?o.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ir(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ir(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Db(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return l?hv(e,a):a}if(typeof e=="bigint"){var u=String(e)+"n";return l?hv(e,u):u}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof e=="object")return Bd(e)?"[Array]":"[Object]";var d=J6(o,r);if(typeof i>"u")i=[];else if(Ib(i,e)>=0)return"[Circular]";function f(T,k,U){if(k&&(i=N6.call(i),i.push(k)),U){var ie={depth:o.depth};return ir(o,"quoteStyle")&&(ie.quoteStyle=o.quoteStyle),t(T,ie,r+1,i)}return t(T,o,r+1,i)}if(typeof e=="function"&&!yv(e)){var p=j6(e),h=Xl(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(h.length>0?" { "+wn.call(h,", ")+" }":"")}if(_b(e)){var v=Co?pr.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ld.call(e);return typeof e=="object"&&!Co?fs(v):v}if(K6(e)){for(var b="<"+cv.call(String(e.nodeName)),m=e.attributes||[],y=0;y",e.childNodes&&e.childNodes.length&&(b+="..."),b+=""+cv.call(String(e.nodeName))+">",b}if(Bd(e)){if(e.length===0)return"[]";var g=Xl(e,f);return d&&!Y6(g)?"["+zd(g,d)+"]":"[ "+wn.call(g,", ")+" ]"}if(D6(e)){var w=Xl(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!Nb.call(e,"cause")?"{ ["+String(e)+"] "+wn.call(fv.call("[cause]: "+f(e.cause),w),", ")+" }":w.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+wn.call(w,", ")+" }"}if(typeof e=="object"&&s){if(gv&&typeof e[gv]=="function"&&Fd)return Fd(e,{depth:c-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(U6(e)){var C=[];return lv&&lv.call(e,function(T,k){C.push(f(k,e,!0)+" => "+f(T,e))}),vv("Map",tu.call(e),C,d)}if(H6(e)){var x=[];return av&&av.call(e,function(T){x.push(f(T,e))}),vv("Set",nu.call(e),x,d)}if(V6(e))return Ef("WeakMap");if(G6(e))return Ef("WeakSet");if(W6(e))return Ef("WeakRef");if(L6(e))return fs(f(Number(e)));if(B6(e))return fs(f(Rd.call(e)));if(F6(e))return fs(O6.call(e));if(R6(e))return fs(f(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===En)return"{ [object globalThis] }";if(!I6(e)&&!yv(e)){var P=Xl(e,f),S=pv?pv(e)===Object.prototype:e instanceof Object||e.constructor===Object,A=e instanceof Object?"":"null prototype",I=!S&<&&Object(e)===e&< in e?Fh.call(Fr(e),8,-1):A?"Object":"",M=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",$=M+(I||A?"["+wn.call(fv.call([],I||[],A||[]),": ")+"] ":"");return P.length===0?$+"{}":d?$+"{"+zd(P,d)+"}":$+"{ "+wn.call(P,", ")+" }"}return String(e)};function Mb(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function _6(t){return pr.call(String(t),/"/g,""")}function Bd(t){return Fr(t)==="[object Array]"&&(!lt||!(typeof t=="object"&< in t))}function I6(t){return Fr(t)==="[object Date]"&&(!lt||!(typeof t=="object"&< in t))}function yv(t){return Fr(t)==="[object RegExp]"&&(!lt||!(typeof t=="object"&< in t))}function D6(t){return Fr(t)==="[object Error]"&&(!lt||!(typeof t=="object"&< in t))}function R6(t){return Fr(t)==="[object String]"&&(!lt||!(typeof t=="object"&< in t))}function L6(t){return Fr(t)==="[object Number]"&&(!lt||!(typeof t=="object"&< in t))}function F6(t){return Fr(t)==="[object Boolean]"&&(!lt||!(typeof t=="object"&< in t))}function _b(t){if(Co)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Ld)return!1;try{return Ld.call(t),!0}catch{}return!1}function B6(t){if(!t||typeof t!="object"||!Rd)return!1;try{return Rd.call(t),!0}catch{}return!1}var z6=Object.prototype.hasOwnProperty||function(t){return t in this};function ir(t,e){return z6.call(t,e)}function Fr(t){return $6.call(t)}function j6(t){if(t.name)return t.name;var e=A6.call(k6.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Ib(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return Db(Fh.call(t,0,e.maxStringLength),e)+r}var i=pr.call(pr.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,q6);return Mb(i,"single",e)}function q6(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+P6.call(e.toString(16))}function fs(t){return"Object("+t+")"}function Ef(t){return t+" { ? }"}function vv(t,e,n,r){var i=r?zd(n,r):wn.call(n,", ");return t+" ("+e+") {"+i+"}"}function Y6(t){for(var e=0;e=0)return!1;return!0}function J6(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=wn.call(Array(t.indent+1)," ");else return null;return{base:n,prev:wn.call(Array(e+1),n)}}function zd(t,e){if(t.length===0)return"";var n=`
+`+e.prev+e.base;return n+wn.call(t,","+n)+`
+`+e.prev}function Xl(t,e){var n=Bd(t),r=[];if(n){r.length=t.length;for(var i=0;i1;){var n=e.pop(),r=n.obj[n.prop];if(Qr(r)){for(var i=[],o=0;o=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===f4.RFC1738&&(u===40||u===41)){l+=s.charAt(a);continue}if(u<128){l=l+yn[u];continue}if(u<2048){l=l+(yn[192|u>>6]+yn[128|u&63]);continue}if(u<55296||u>=57344){l=l+(yn[224|u>>12]+yn[128|u>>6&63]+yn[128|u&63]);continue}a+=1,u=65536+((u&1023)<<10|s.charCodeAt(a)&1023),l+=yn[240|u>>18]+yn[128|u>>12&63]+yn[128|u>>6&63]+yn[128|u&63]}return l},y4=function(e){for(var n=[{obj:{o:e},prop:"o"}],r=[],i=0;i"u"&&(g=0)}if(typeof a=="function"?m=a(n,m):m instanceof Date?m=d(m):r==="comma"&&jn(m)&&(m=Na.maybeMap(m,function(ie){return ie instanceof Date?d(ie):ie})),m===null){if(o)return l&&!h?l(n,nt.encoder,v,"key",f):n;m=""}if(T4(m)||Na.isBuffer(m)){if(l){var x=h?n:l(n,nt.encoder,v,"key",f);return[p(x)+"="+p(l(m,nt.encoder,v,"value",f))]}return[p(n)+"="+p(String(m))]}var P=[];if(typeof m>"u")return P;var S;if(r==="comma"&&jn(m))h&&l&&(m=Na.maybeMap(m,l)),S=[{value:m.length>0?m.join(",")||null:void 0}];else if(jn(a))S=a;else{var A=Object.keys(m);S=u?A.sort(u):A}for(var I=i&&jn(m)&&m.length===1?n+"[]":n,M=0;M"u"?nt.allowDots:!!e.allowDots,charset:n,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:nt.charsetSentinel,delimiter:typeof e.delimiter>"u"?nt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:nt.encode,encoder:typeof e.encoder=="function"?e.encoder:nt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:nt.encodeValuesOnly,filter:o,format:r,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:nt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:nt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:nt.strictNullHandling}},k4=function(t,e){var n=t,r=$4(e),i,o;typeof r.filter=="function"?(o=r.filter,n=o("",n)):jn(r.filter)&&(o=r.filter,i=o);var s=[];if(typeof n!="object"||n===null)return"";var l;e&&e.arrayFormat in Sv?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var a=Sv[l];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=a==="comma"&&e&&e.commaRoundTrip;i||(i=Object.keys(n)),r.sort&&i.sort(r.sort);for(var c=Bb(),d=0;d0?h+p:""},xo=Fb,jd=Object.prototype.hasOwnProperty,A4=Array.isArray,Le={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:xo.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},P4=function(t){return t.replace(/(\d+);/g,function(e,n){return String.fromCharCode(parseInt(n,10))})},jb=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},N4="utf8=%26%2310003%3B",M4="utf8=%E2%9C%93",_4=function(e,n){var r={__proto__:null},i=n.ignoreQueryPrefix?e.replace(/^\?/,""):e,o=n.parameterLimit===1/0?void 0:n.parameterLimit,s=i.split(n.delimiter,o),l=-1,a,u=n.charset;if(n.charsetSentinel)for(a=0;a-1&&(h=A4(h)?[h]:h),jd.call(r,p)?r[p]=xo.combine(r[p],h):r[p]=h}return r},I4=function(t,e,n,r){for(var i=r?e:jb(e,n),o=t.length-1;o>=0;--o){var s,l=t[o];if(l==="[]"&&n.parseArrays)s=[].concat(i);else{s=n.plainObjects?Object.create(null):{};var a=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=parseInt(a,10);!n.parseArrays&&a===""?s={0:i}:!isNaN(u)&&l!==a&&String(u)===a&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(s=[],s[u]=i):a!=="__proto__"&&(s[a]=i)}i=s}return i},D4=function(e,n,r,i){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,a=r.depth>0&&s.exec(o),u=a?o.slice(0,a.index):o,c=[];if(u){if(!r.plainObjects&&jd.call(Object.prototype,u)&&!r.allowPrototypes)return;c.push(u)}for(var d=0;r.depth>0&&(a=l.exec(o))!==null&&d"u"?Le.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Le.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Le.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Le.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Le.arrayLimit,charset:n,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Le.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Le.comma,decoder:typeof e.decoder=="function"?e.decoder:Le.decoder,delimiter:typeof e.delimiter=="string"||xo.isRegExp(e.delimiter)?e.delimiter:Le.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Le.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Le.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Le.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Le.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Le.strictNullHandling}},L4=function(t,e){var n=R4(e);if(t===""||t===null||typeof t>"u")return n.plainObjects?Object.create(null):{};for(var r=typeof t=="string"?_4(t,n):t,i=n.plainObjects?Object.create(null):{},o=Object.keys(r),s=0;s>>1,ce=B[Y];if(0>>1;Yi(X,q))Aei(ge,X)?(B[Y]=ge,B[Ae]=q,Y=Ae):(B[Y]=X,B[Q]=q,Y=Q);else if(Aei(ge,q))B[Y]=ge,B[Ae]=q,Y=Ae;else break e}}return V}function i(B,V){var q=B.sortIndex-V.sortIndex;return q!==0?q:B.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,f=3,p=!1,h=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(B){for(var V=n(u);V!==null;){if(V.callback===null)r(u);else if(V.startTime<=B)r(u),V.sortIndex=V.expirationTime,e(a,V);else break;V=n(u)}}function w(B){if(v=!1,g(B),!h)if(n(a)!==null)h=!0,ie(C);else{var V=n(u);V!==null&&De(w,V.startTime-B)}}function C(B,V){h=!1,v&&(v=!1,m(S),S=-1),p=!0;var q=f;try{for(g(V),d=n(a);d!==null&&(!(d.expirationTime>V)||B&&!M());){var Y=d.callback;if(typeof Y=="function"){d.callback=null,f=d.priorityLevel;var ce=Y(d.expirationTime<=V);V=t.unstable_now(),typeof ce=="function"?d.callback=ce:d===n(a)&&r(a),g(V)}else r(a);d=n(a)}if(d!==null)var L=!0;else{var Q=n(u);Q!==null&&De(w,Q.startTime-V),L=!1}return L}finally{d=null,f=q,p=!1}}var x=!1,P=null,S=-1,A=5,I=-1;function M(){return!(t.unstable_now()-IB||125Y?(B.sortIndex=q,e(u,B),n(a)===null&&B===n(u)&&(v?(m(S),S=-1):v=!0,De(w,q-Y))):(B.sortIndex=ce,e(a,B),h||p||(h=!0,ie(C))),B},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(B){var V=f;return function(){var q=f;f=V;try{return B.apply(this,arguments)}finally{f=q}}}})(ew);Zb.exports=ew;var uz=Zb.exports;/**
+ * @license React
+ * react-dom.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var tw=N,Bt=uz;function D(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ud=Object.prototype.hasOwnProperty,cz=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,xv={},Tv={};function fz(t){return Ud.call(Tv,t)?!0:Ud.call(xv,t)?!1:cz.test(t)?Tv[t]=!0:(xv[t]=!0,!1)}function dz(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function pz(t,e,n,r){if(e===null||typeof e>"u"||dz(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function bt(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Qe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Qe[t]=new bt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Qe[e]=new bt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Qe[t]=new bt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Qe[t]=new bt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Qe[t]=new bt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Qe[t]=new bt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Qe[t]=new bt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Qe[t]=new bt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Qe[t]=new bt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Hh=/[\-:]([a-z])/g;function Gh(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Hh,Gh);Qe[e]=new bt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Hh,Gh);Qe[e]=new bt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Hh,Gh);Qe[e]=new bt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Qe[t]=new bt(t,1,!1,t.toLowerCase(),null,!1,!1)});Qe.xlinkHref=new bt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Qe[t]=new bt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Kh(t,e,n,r){var i=Qe.hasOwnProperty(e)?Qe[e]:null;(i!==null?i.type!==0:r||!(2l||i[s]!==o[l]){var a=`
+`+i[s].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{kf=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?ws(t):""}function hz(t){switch(t.tag){case 5:return ws(t.type);case 16:return ws("Lazy");case 13:return ws("Suspense");case 19:return ws("SuspenseList");case 0:case 2:case 15:return t=Af(t.type,!1),t;case 11:return t=Af(t.type.render,!1),t;case 1:return t=Af(t.type,!0),t;default:return""}}function Gd(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Ji:return"Fragment";case Yi:return"Portal";case Vd:return"Profiler";case qh:return"StrictMode";case Wd:return"Suspense";case Hd:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case iw:return(t.displayName||"Context")+".Consumer";case rw:return(t._context.displayName||"Context")+".Provider";case Yh:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Jh:return e=t.displayName||null,e!==null?e:Gd(t.type)||"Memo";case or:e=t._payload,t=t._init;try{return Gd(t(e))}catch{}}return null}function mz(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Gd(e);case 8:return e===qh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function _r(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function sw(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function gz(t){var e=sw(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function ra(t){t._valueTracker||(t._valueTracker=gz(t))}function lw(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=sw(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function ru(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Kd(t,e){var n=e.checked;return $e({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function $v(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=_r(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function aw(t,e){e=e.checked,e!=null&&Kh(t,"checked",e,!1)}function qd(t,e){aw(t,e);var n=_r(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Yd(t,e.type,n):e.hasOwnProperty("defaultValue")&&Yd(t,e.type,_r(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function kv(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Yd(t,e,n){(e!=="number"||ru(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Es=Array.isArray;function uo(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=ia.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Xs(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ms={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},yz=["Webkit","ms","Moz","O"];Object.keys(Ms).forEach(function(t){yz.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ms[e]=Ms[t]})});function dw(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ms.hasOwnProperty(t)&&Ms[t]?(""+e).trim():e+"px"}function pw(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=dw(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var vz=$e({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Xd(t,e){if(e){if(vz[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(D(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(D(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(D(61))}if(e.style!=null&&typeof e.style!="object")throw Error(D(62))}}function Zd(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ep=null;function Qh(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var tp=null,co=null,fo=null;function Nv(t){if(t=Ll(t)){if(typeof tp!="function")throw Error(D(280));var e=t.stateNode;e&&(e=pc(e),tp(t.stateNode,t.type,e))}}function hw(t){co?fo?fo.push(t):fo=[t]:co=t}function mw(){if(co){var t=co,e=fo;if(fo=co=null,Nv(t),e)for(t=0;t>>=0,t===0?32:31-(Az(t)/Pz|0)|0}var oa=64,sa=4194304;function Cs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function lu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var l=s&~i;l!==0?r=Cs(l):(o&=s,o!==0&&(r=Cs(o)))}else s=n&~i,s!==0?r=Cs(s):o!==0&&(r=Cs(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Dl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-cn(e),t[e]=n}function Iz(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Is),zv=" ",jv=!1;function Dw(t,e){switch(t){case"keyup":return a5.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rw(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Qi=!1;function c5(t,e){switch(t){case"compositionend":return Rw(e);case"keypress":return e.which!==32?null:(jv=!0,zv);case"textInput":return t=e.data,t===zv&&jv?null:t;default:return null}}function f5(t,e){if(Qi)return t==="compositionend"||!om&&Dw(t,e)?(t=_w(),Da=nm=hr=null,Qi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hv(n)}}function zw(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?zw(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function jw(){for(var t=window,e=ru();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ru(t.document)}return e}function sm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function b5(t){var e=jw(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&zw(n.ownerDocument.documentElement,n)){if(r!==null&&sm(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=Gv(n,o);var s=Gv(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Xi=null,lp=null,Rs=null,ap=!1;function Kv(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ap||Xi==null||Xi!==ru(r)||(r=Xi,"selectionStart"in r&&sm(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rs&&il(Rs,r)||(Rs=r,r=cu(lp,"onSelect"),0to||(t.current=hp[to],hp[to]=null,to--)}function Se(t,e){to++,hp[to]=t.current,t.current=e}var Ir={},at=zr(Ir),Ot=zr(!1),mi=Ir;function Oo(t,e){var n=t.type.contextTypes;if(!n)return Ir;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function $t(t){return t=t.childContextTypes,t!=null}function du(){Ee(Ot),Ee(at)}function e0(t,e,n){if(at.current!==Ir)throw Error(D(168));Se(at,e),Se(Ot,n)}function Jw(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(D(108,mz(t)||"Unknown",i));return $e({},n,r)}function pu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ir,mi=at.current,Se(at,t),Se(Ot,Ot.current),!0}function t0(t,e,n){var r=t.stateNode;if(!r)throw Error(D(169));n?(t=Jw(t,e,mi),r.__reactInternalMemoizedMergedChildContext=t,Ee(Ot),Ee(at),Se(at,t)):Ee(Ot),Se(Ot,n)}var Un=null,hc=!1,Vf=!1;function Qw(t){Un===null?Un=[t]:Un.push(t)}function M5(t){hc=!0,Qw(t)}function jr(){if(!Vf&&Un!==null){Vf=!0;var t=0,e=de;try{var n=Un;for(de=1;t>=s,i-=s,Wn=1<<32-cn(e)+i|n<S?(A=P,P=null):A=P.sibling;var I=f(m,P,g[S],w);if(I===null){P===null&&(P=A);break}t&&P&&I.alternate===null&&e(m,P),y=o(I,y,S),x===null?C=I:x.sibling=I,x=I,P=A}if(S===g.length)return n(m,P),Ce&&qr(m,S),C;if(P===null){for(;SS?(A=P,P=null):A=P.sibling;var M=f(m,P,I.value,w);if(M===null){P===null&&(P=A);break}t&&P&&M.alternate===null&&e(m,P),y=o(M,y,S),x===null?C=M:x.sibling=M,x=M,P=A}if(I.done)return n(m,P),Ce&&qr(m,S),C;if(P===null){for(;!I.done;S++,I=g.next())I=d(m,I.value,w),I!==null&&(y=o(I,y,S),x===null?C=I:x.sibling=I,x=I);return Ce&&qr(m,S),C}for(P=r(m,P);!I.done;S++,I=g.next())I=p(P,m,S,I.value,w),I!==null&&(t&&I.alternate!==null&&P.delete(I.key===null?S:I.key),y=o(I,y,S),x===null?C=I:x.sibling=I,x=I);return t&&P.forEach(function($){return e(m,$)}),Ce&&qr(m,S),C}function b(m,y,g,w){if(typeof g=="object"&&g!==null&&g.type===Ji&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case na:e:{for(var C=g.key,x=y;x!==null;){if(x.key===C){if(C=g.type,C===Ji){if(x.tag===7){n(m,x.sibling),y=i(x,g.props.children),y.return=m,m=y;break e}}else if(x.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===or&&a0(C)===x.type){n(m,x.sibling),y=i(x,g.props),y.ref=ys(m,x,g),y.return=m,m=y;break e}n(m,x);break}else e(m,x);x=x.sibling}g.type===Ji?(y=ai(g.props.children,m.mode,w,g.key),y.return=m,m=y):(w=Va(g.type,g.key,g.props,null,m.mode,w),w.ref=ys(m,y,g),w.return=m,m=w)}return s(m);case Yi:e:{for(x=g.key;y!==null;){if(y.key===x)if(y.tag===4&&y.stateNode.containerInfo===g.containerInfo&&y.stateNode.implementation===g.implementation){n(m,y.sibling),y=i(y,g.children||[]),y.return=m,m=y;break e}else{n(m,y);break}else e(m,y);y=y.sibling}y=Qf(g,m.mode,w),y.return=m,m=y}return s(m);case or:return x=g._init,b(m,y,x(g._payload),w)}if(Es(g))return h(m,y,g,w);if(ds(g))return v(m,y,g,w);pa(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,y!==null&&y.tag===6?(n(m,y.sibling),y=i(y,g),y.return=m,m=y):(n(m,y),y=Jf(g,m.mode,w),y.return=m,m=y),s(m)):n(m,y)}return b}var ko=oE(!0),sE=oE(!1),Fl={},kn=zr(Fl),al=zr(Fl),ul=zr(Fl);function ti(t){if(t===Fl)throw Error(D(174));return t}function mm(t,e){switch(Se(ul,e),Se(al,t),Se(kn,Fl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Qd(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Qd(e,t)}Ee(kn),Se(kn,e)}function Ao(){Ee(kn),Ee(al),Ee(ul)}function lE(t){ti(ul.current);var e=ti(kn.current),n=Qd(e,t.type);e!==n&&(Se(al,t),Se(kn,n))}function gm(t){al.current===t&&(Ee(kn),Ee(al))}var Te=zr(0);function Su(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Wf=[];function ym(){for(var t=0;tn?n:4,t(!0);var r=Hf.transition;Hf.transition={};try{t(!1),e()}finally{de=n,Hf.transition=r}}function CE(){return Xt().memoizedState}function R5(t,e,n){var r=Tr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},xE(t))TE(e,n);else if(n=tE(t,e,n,r),n!==null){var i=pt();fn(n,t,r,i),OE(n,e,r)}}function L5(t,e,n){var r=Tr(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(xE(t))TE(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,n);if(i.hasEagerState=!0,i.eagerState=l,pn(l,s)){var a=e.interleaved;a===null?(i.next=i,pm(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=tE(t,e,i,r),n!==null&&(i=pt(),fn(n,t,r,i),OE(n,e,r))}}function xE(t){var e=t.alternate;return t===Oe||e!==null&&e===Oe}function TE(t,e){Ls=bu=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function OE(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Zh(t,n)}}var wu={readContext:Qt,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useInsertionEffect:et,useLayoutEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useMutableSource:et,useSyncExternalStore:et,useId:et,unstable_isNewReconciler:!1},F5={readContext:Qt,useCallback:function(t,e){return Sn().memoizedState=[t,e===void 0?null:e],t},useContext:Qt,useEffect:c0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Ba(4194308,4,vE.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Ba(4194308,4,t,e)},useInsertionEffect:function(t,e){return Ba(4,2,t,e)},useMemo:function(t,e){var n=Sn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Sn();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=R5.bind(null,Oe,t),[r.memoizedState,t]},useRef:function(t){var e=Sn();return t={current:t},e.memoizedState=t},useState:u0,useDebugValue:Em,useDeferredValue:function(t){return Sn().memoizedState=t},useTransition:function(){var t=u0(!1),e=t[0];return t=D5.bind(null,t[1]),Sn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Oe,i=Sn();if(Ce){if(n===void 0)throw Error(D(407));n=n()}else{if(n=e(),je===null)throw Error(D(349));yi&30||cE(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,c0(dE.bind(null,r,o,t),[t]),r.flags|=2048,dl(9,fE.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=Sn(),e=je.identifierPrefix;if(Ce){var n=Hn,r=Wn;n=(r&~(1<<32-cn(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=cl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Cn]=e,t[ll]=r,DE(t,e,!1,!1),e.stateNode=t;e:{switch(s=Zd(n,r),n){case"dialog":be("cancel",t),be("close",t),i=r;break;case"iframe":case"object":case"embed":be("load",t),i=r;break;case"video":case"audio":for(i=0;iNo&&(e.flags|=128,r=!0,vs(o,!1),e.lanes=4194304)}else{if(!r)if(t=Su(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),vs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Ce)return tt(e),null}else 2*Pe()-o.renderingStartTime>No&&n!==1073741824&&(e.flags|=128,r=!0,vs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=Pe(),e.sibling=null,n=Te.current,Se(Te,r?n&1|2:n&1),e):(tt(e),null);case 22:case 23:return km(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Mt&1073741824&&(tt(e),e.subtreeFlags&6&&(e.flags|=8192)):tt(e),null;case 24:return null;case 25:return null}throw Error(D(156,e.tag))}function G5(t,e){switch(am(e),e.tag){case 1:return $t(e.type)&&du(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ao(),Ee(Ot),Ee(at),ym(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return gm(e),null;case 13:if(Ee(Te),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(D(340));$o()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ee(Te),null;case 4:return Ao(),null;case 10:return dm(e.type._context),null;case 22:case 23:return km(),null;case 24:return null;default:return null}}var ma=!1,it=!1,K5=typeof WeakSet=="function"?WeakSet:Set,j=null;function oo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ke(t,e,r)}else n.current=null}function Op(t,e,n){try{n()}catch(r){ke(t,e,r)}}var S0=!1;function q5(t,e){if(up=au,t=jw(),sm(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,f=null;t:for(;;){for(var p;d!==n||i!==0&&d.nodeType!==3||(l=s+i),d!==o||r!==0&&d.nodeType!==3||(a=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++u===i&&(l=s),f===o&&++c===r&&(a=s),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(cp={focusedElem:t,selectionRange:n},au=!1,j=e;j!==null;)if(e=j,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,j=t;else for(;j!==null;){e=j;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var v=h.memoizedProps,b=h.memoizedState,m=e.stateNode,y=m.getSnapshotBeforeUpdate(e.elementType===e.type?v:rn(e.type,v),b);m.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var g=e.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(D(163))}}catch(w){ke(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,j=t;break}j=e.return}return h=S0,S0=!1,h}function Fs(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Op(e,n,o)}i=i.next}while(i!==r)}}function yc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function $p(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function FE(t){var e=t.alternate;e!==null&&(t.alternate=null,FE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Cn],delete e[ll],delete e[pp],delete e[P5],delete e[N5])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function BE(t){return t.tag===5||t.tag===3||t.tag===4}function b0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||BE(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function kp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=fu));else if(r!==4&&(t=t.child,t!==null))for(kp(t,e,n),t=t.sibling;t!==null;)kp(t,e,n),t=t.sibling}function Ap(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Ap(t,e,n),t=t.sibling;t!==null;)Ap(t,e,n),t=t.sibling}var Ke=null,on=!1;function nr(t,e,n){for(n=n.child;n!==null;)zE(t,e,n),n=n.sibling}function zE(t,e,n){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(uc,n)}catch{}switch(n.tag){case 5:it||oo(n,e);case 6:var r=Ke,i=on;Ke=null,nr(t,e,n),Ke=r,on=i,Ke!==null&&(on?(t=Ke,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Ke.removeChild(n.stateNode));break;case 18:Ke!==null&&(on?(t=Ke,n=n.stateNode,t.nodeType===8?Uf(t.parentNode,n):t.nodeType===1&&Uf(t,n),nl(t)):Uf(Ke,n.stateNode));break;case 4:r=Ke,i=on,Ke=n.stateNode.containerInfo,on=!0,nr(t,e,n),Ke=r,on=i;break;case 0:case 11:case 14:case 15:if(!it&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Op(n,e,s),i=i.next}while(i!==r)}nr(t,e,n);break;case 1:if(!it&&(oo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ke(n,e,l)}nr(t,e,n);break;case 21:nr(t,e,n);break;case 22:n.mode&1?(it=(r=it)||n.memoizedState!==null,nr(t,e,n),it=r):nr(t,e,n);break;default:nr(t,e,n)}}function w0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new K5),e.forEach(function(r){var i=r8.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function tn(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Pe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*J5(r/1960))-r,10t?16:t,mr===null)var r=!1;else{if(t=mr,mr=null,xu=0,se&6)throw Error(D(331));var i=se;for(se|=4,j=t.current;j!==null;){var o=j,s=o.child;if(j.flags&16){var l=o.deletions;if(l!==null){for(var a=0;aPe()-Om?li(t,0):Tm|=n),kt(t,e)}function qE(t,e){e===0&&(t.mode&1?(e=sa,sa<<=1,!(sa&130023424)&&(sa=4194304)):e=1);var n=pt();t=Qn(t,e),t!==null&&(Dl(t,e,n),kt(t,n))}function n8(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),qE(t,n)}function r8(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(D(314))}r!==null&&r.delete(e),qE(t,n)}var YE;YE=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ot.current)Tt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Tt=!1,W5(t,e,n);Tt=!!(t.flags&131072)}else Tt=!1,Ce&&e.flags&1048576&&Xw(e,mu,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;za(t,e),t=e.pendingProps;var i=Oo(e,at.current);ho(e,n),i=Sm(null,e,r,t,i,n);var o=bm();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,$t(r)?(o=!0,pu(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,hm(e),i.updater=mc,e.stateNode=i,i._reactInternals=e,Sp(e,r,t,n),e=Ep(null,e,r,!0,o,n)):(e.tag=0,Ce&&o&&lm(e),ct(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(za(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=o8(r),t=rn(r,t),i){case 0:e=wp(null,e,r,t,n);break e;case 1:e=g0(null,e,r,t,n);break e;case 11:e=h0(null,e,r,t,n);break e;case 14:e=m0(null,e,r,rn(r.type,t),n);break e}throw Error(D(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:rn(r,i),wp(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:rn(r,i),g0(t,e,r,i,n);case 3:e:{if(ME(e),t===null)throw Error(D(387));r=e.pendingProps,o=e.memoizedState,i=o.element,nE(t,e),vu(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Po(Error(D(423)),e),e=y0(t,e,r,n,i);break e}else if(r!==i){i=Po(Error(D(424)),e),e=y0(t,e,r,n,i);break e}else for(It=Er(e.stateNode.containerInfo.firstChild),Dt=e,Ce=!0,sn=null,n=sE(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if($o(),r===i){e=Xn(t,e,n);break e}ct(t,e,r,n)}e=e.child}return e;case 5:return lE(e),t===null&&gp(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,fp(r,i)?s=null:o!==null&&fp(r,o)&&(e.flags|=32),NE(t,e),ct(t,e,s,n),e.child;case 6:return t===null&&gp(e),null;case 13:return _E(t,e,n);case 4:return mm(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ko(e,null,r,n):ct(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:rn(r,i),h0(t,e,r,i,n);case 7:return ct(t,e,e.pendingProps,n),e.child;case 8:return ct(t,e,e.pendingProps.children,n),e.child;case 12:return ct(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Se(gu,r._currentValue),r._currentValue=s,o!==null)if(pn(o.value,s)){if(o.children===i.children&&!Ot.current){e=Xn(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=Kn(-1,n&-n),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),yp(o.return,n,e),l.lanes|=n;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(D(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),yp(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ct(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,ho(e,n),i=Qt(i),r=r(i),e.flags|=1,ct(t,e,r,n),e.child;case 14:return r=e.type,i=rn(r,e.pendingProps),i=rn(r.type,i),m0(t,e,r,i,n);case 15:return AE(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:rn(r,i),za(t,e),e.tag=1,$t(r)?(t=!0,pu(e)):t=!1,ho(e,n),iE(e,r,i),Sp(e,r,i,n),Ep(null,e,r,!0,t,n);case 19:return IE(t,e,n);case 22:return PE(t,e,n)}throw Error(D(156,e.tag))};function JE(t,e){return Ew(t,e)}function i8(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qt(t,e,n,r){return new i8(t,e,n,r)}function Pm(t){return t=t.prototype,!(!t||!t.isReactComponent)}function o8(t){if(typeof t=="function")return Pm(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Yh)return 11;if(t===Jh)return 14}return 2}function Or(t,e){var n=t.alternate;return n===null?(n=qt(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Va(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")Pm(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Ji:return ai(n.children,i,o,e);case qh:s=8,i|=8;break;case Vd:return t=qt(12,n,e,i|2),t.elementType=Vd,t.lanes=o,t;case Wd:return t=qt(13,n,e,i),t.elementType=Wd,t.lanes=o,t;case Hd:return t=qt(19,n,e,i),t.elementType=Hd,t.lanes=o,t;case ow:return Sc(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case rw:s=10;break e;case iw:s=9;break e;case Yh:s=11;break e;case Jh:s=14;break e;case or:s=16,r=null;break e}throw Error(D(130,t==null?t:typeof t,""))}return e=qt(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function ai(t,e,n,r){return t=qt(7,t,r,e),t.lanes=n,t}function Sc(t,e,n,r){return t=qt(22,t,r,e),t.elementType=ow,t.lanes=n,t.stateNode={isHidden:!1},t}function Jf(t,e,n){return t=qt(6,t,null,e),t.lanes=n,t}function Qf(t,e,n){return e=qt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function s8(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nf(0),this.expirationTimes=Nf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nf(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Nm(t,e,n,r,i,o,s,l,a){return t=new s8(t,e,n,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=qt(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},hm(o),t}function l8(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eC)}catch(t){console.error(t)}}eC(),Xb.exports=zt;var tC=Xb.exports,d8,A0=tC;d8=A0.createRoot,A0.hydrateRoot;var nC={exports:{}},rC={};/**
+ * @license React
+ * use-sync-external-store-shim.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Mo=N;function p8(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var h8=typeof Object.is=="function"?Object.is:p8,m8=Mo.useState,g8=Mo.useEffect,y8=Mo.useLayoutEffect,v8=Mo.useDebugValue;function S8(t,e){var n=e(),r=m8({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return y8(function(){i.value=n,i.getSnapshot=e,Xf(i)&&o({inst:i})},[t,n,e]),g8(function(){return Xf(i)&&o({inst:i}),t(function(){Xf(i)&&o({inst:i})})},[t]),v8(n),n}function Xf(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!h8(t,n)}catch{return!0}}function b8(t,e){return e()}var w8=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?b8:S8;rC.useSyncExternalStore=Mo.useSyncExternalStore!==void 0?Mo.useSyncExternalStore:w8;nC.exports=rC;var Dm=nC.exports,iC={exports:{}},oC={};/**
+ * @license React
+ * use-sync-external-store-shim/with-selector.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var xc=N,E8=Dm;function C8(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var x8=typeof Object.is=="function"?Object.is:C8,T8=E8.useSyncExternalStore,O8=xc.useRef,$8=xc.useEffect,k8=xc.useMemo,A8=xc.useDebugValue;oC.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=O8(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=k8(function(){function a(p){if(!u){if(u=!0,c=p,p=r(p),i!==void 0&&s.hasValue){var h=s.value;if(i(h,p))return d=h}return d=p}if(h=d,x8(c,p))return h;var v=r(p);return i!==void 0&&i(h,v)?h:(c=p,d=v)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(e())},f===null?void 0:function(){return a(f())}]},[e,n,r,i]);var l=T8(t,o[0],o[1]);return $8(function(){s.hasValue=!0,s.value=l},[l]),A8(l),l};iC.exports=oC;var P8=iC.exports;function N8(t){t()}let sC=N8;const M8=t=>sC=t,_8=()=>sC,P0=Symbol.for("react-redux-context"),N0=typeof globalThis<"u"?globalThis:{};function I8(){var t;if(!N.createContext)return{};const e=(t=N0[P0])!=null?t:N0[P0]=new Map;let n=e.get(N.createContext);return n||(n=N.createContext(null),e.set(N.createContext,n)),n}const hl=I8();function lC(t=hl){return function(){return N.useContext(t)}}const D8=lC(),aC=()=>{throw new Error("uSES not initialized!")};let uC=aC;const R8=t=>{uC=t},L8=(t,e)=>t===e;function F8(t=hl){const e=t===hl?D8:lC(t);return function(r,i={}){const{equalityFn:o=L8,stabilityCheck:s=void 0,noopCheck:l=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:a,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=e();N.useRef(!0);const p=N.useCallback({[r.name](v){return r(v)}}[r.name],[r,d,s]),h=uC(u.addNestedSub,a.getState,c||a.getState,p,o);return N.useDebugValue(h),h}}const LQ=F8();function go(){return go=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}var fC={exports:{}},pe={};/** @license React v16.13.1
+ * react-is.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var We=typeof Symbol=="function"&&Symbol.for,Rm=We?Symbol.for("react.element"):60103,Lm=We?Symbol.for("react.portal"):60106,Tc=We?Symbol.for("react.fragment"):60107,Oc=We?Symbol.for("react.strict_mode"):60108,$c=We?Symbol.for("react.profiler"):60114,kc=We?Symbol.for("react.provider"):60109,Ac=We?Symbol.for("react.context"):60110,Fm=We?Symbol.for("react.async_mode"):60111,Pc=We?Symbol.for("react.concurrent_mode"):60111,Nc=We?Symbol.for("react.forward_ref"):60112,Mc=We?Symbol.for("react.suspense"):60113,B8=We?Symbol.for("react.suspense_list"):60120,_c=We?Symbol.for("react.memo"):60115,Ic=We?Symbol.for("react.lazy"):60116,z8=We?Symbol.for("react.block"):60121,j8=We?Symbol.for("react.fundamental"):60117,U8=We?Symbol.for("react.responder"):60118,V8=We?Symbol.for("react.scope"):60119;function Ut(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case Rm:switch(t=t.type,t){case Fm:case Pc:case Tc:case $c:case Oc:case Mc:return t;default:switch(t=t&&t.$$typeof,t){case Ac:case Nc:case Ic:case _c:case kc:return t;default:return e}}case Lm:return e}}}function dC(t){return Ut(t)===Pc}pe.AsyncMode=Fm;pe.ConcurrentMode=Pc;pe.ContextConsumer=Ac;pe.ContextProvider=kc;pe.Element=Rm;pe.ForwardRef=Nc;pe.Fragment=Tc;pe.Lazy=Ic;pe.Memo=_c;pe.Portal=Lm;pe.Profiler=$c;pe.StrictMode=Oc;pe.Suspense=Mc;pe.isAsyncMode=function(t){return dC(t)||Ut(t)===Fm};pe.isConcurrentMode=dC;pe.isContextConsumer=function(t){return Ut(t)===Ac};pe.isContextProvider=function(t){return Ut(t)===kc};pe.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===Rm};pe.isForwardRef=function(t){return Ut(t)===Nc};pe.isFragment=function(t){return Ut(t)===Tc};pe.isLazy=function(t){return Ut(t)===Ic};pe.isMemo=function(t){return Ut(t)===_c};pe.isPortal=function(t){return Ut(t)===Lm};pe.isProfiler=function(t){return Ut(t)===$c};pe.isStrictMode=function(t){return Ut(t)===Oc};pe.isSuspense=function(t){return Ut(t)===Mc};pe.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===Tc||t===Pc||t===$c||t===Oc||t===Mc||t===B8||typeof t=="object"&&t!==null&&(t.$$typeof===Ic||t.$$typeof===_c||t.$$typeof===kc||t.$$typeof===Ac||t.$$typeof===Nc||t.$$typeof===j8||t.$$typeof===U8||t.$$typeof===V8||t.$$typeof===z8)};pe.typeOf=Ut;fC.exports=pe;var W8=fC.exports,Bm=W8,H8={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},G8={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},K8={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},pC={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},zm={};zm[Bm.ForwardRef]=K8;zm[Bm.Memo]=pC;function M0(t){return Bm.isMemo(t)?pC:zm[t.$$typeof]||H8}var q8=Object.defineProperty,Y8=Object.getOwnPropertyNames,_0=Object.getOwnPropertySymbols,J8=Object.getOwnPropertyDescriptor,Q8=Object.getPrototypeOf,I0=Object.prototype;function hC(t,e,n){if(typeof e!="string"){if(I0){var r=Q8(e);r&&r!==I0&&hC(t,r,n)}var i=Y8(e);_0&&(i=i.concat(_0(e)));for(var o=M0(t),s=M0(e),l=0;le(i(...o)))}return n}function Ip(t){return function(n){const r=t(n);function i(){return r}return i.dependsOnOwnProps=!1,i}}function R0(t){return t.dependsOnOwnProps?!!t.dependsOnOwnProps:t.length!==1}function yC(t,e){return function(r,{displayName:i}){const o=function(l,a){return o.dependsOnOwnProps?o.mapToProps(l,a):o.mapToProps(l,void 0)};return o.dependsOnOwnProps=!0,o.mapToProps=function(l,a){o.mapToProps=t,o.dependsOnOwnProps=R0(t);let u=o(l,a);return typeof u=="function"&&(o.mapToProps=u,o.dependsOnOwnProps=R0(u),u=o(l,a)),u},o}}function Vm(t,e){return(n,r)=>{throw new Error(`Invalid value of type ${typeof t} for ${e} argument when connecting component ${r.wrappedComponentName}.`)}}function s7(t){return t&&typeof t=="object"?Ip(e=>o7(t,e)):t?typeof t=="function"?yC(t):Vm(t,"mapDispatchToProps"):Ip(e=>({dispatch:e}))}function l7(t){return t?typeof t=="function"?yC(t):Vm(t,"mapStateToProps"):Ip(()=>({}))}function a7(t,e,n){return go({},n,t,e)}function u7(t){return function(n,{displayName:r,areMergedPropsEqual:i}){let o=!1,s;return function(a,u,c){const d=t(a,u,c);return o?i(d,s)||(s=d):(o=!0,s=d),s}}}function c7(t){return t?typeof t=="function"?u7(t):Vm(t,"mergeProps"):()=>a7}function f7(){const t=_8();let e=null,n=null;return{clear(){e=null,n=null},notify(){t(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=e;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:e=o,function(){!i||e===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}const L0={notify(){},get:()=>[]};function vC(t,e){let n,r=L0,i=0,o=!1;function s(v){c();const b=r.subscribe(v);let m=!1;return()=>{m||(m=!0,b(),d())}}function l(){r.notify()}function a(){h.onStateChange&&h.onStateChange()}function u(){return o}function c(){i++,n||(n=e?e.addNestedSub(a):t.subscribe(a),r=f7())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=L0)}function f(){o||(o=!0,c())}function p(){o&&(o=!1,d())}const h={addNestedSub:s,notifyNestedSubs:l,handleChangeWrapper:a,isSubscribed:u,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return h}const d7=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$u=d7?N.useLayoutEffect:N.useEffect;function F0(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function Zf(t,e){if(F0(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i{SC=t},m7=[null,null];function g7(t,e,n){$u(()=>t(...e),n)}function y7(t,e,n,r,i,o){t.current=r,n.current=!1,i.current&&(i.current=null,o())}function v7(t,e,n,r,i,o,s,l,a,u,c){if(!t)return()=>{};let d=!1,f=null;const p=()=>{if(d||!l.current)return;const v=e.getState();let b,m;try{b=r(v,i.current)}catch(y){m=y,f=y}m||(f=null),b===o.current?s.current||u():(o.current=b,a.current=b,s.current=!0,c())};return n.onStateChange=p,n.trySubscribe(),p(),()=>{if(d=!0,n.tryUnsubscribe(),n.onStateChange=null,f)throw f}}function S7(t,e){return t===e}function FQ(t,e,n,{pure:r,areStatesEqual:i=S7,areOwnPropsEqual:o=Zf,areStatePropsEqual:s=Zf,areMergedPropsEqual:l=Zf,forwardRef:a=!1,context:u=hl}={}){const c=u,d=l7(t),f=s7(e),p=c7(n),h=!!t;return b=>{const m=b.displayName||b.name||"Component",y=`Connect(${m})`,g={shouldHandleStateChanges:h,displayName:y,wrappedComponentName:m,WrappedComponent:b,initMapStateToProps:d,initMapDispatchToProps:f,initMergeProps:p,areStatesEqual:i,areStatePropsEqual:s,areOwnPropsEqual:o,areMergedPropsEqual:l};function w(P){const[S,A,I]=N.useMemo(()=>{const{reactReduxForwardedRef:wt}=P,_n=cC(P,p7);return[P.context,wt,_n]},[P]),M=N.useMemo(()=>S&&S.Consumer&&t7.isContextConsumer(N.createElement(S.Consumer,null))?S:c,[S,c]),$=N.useContext(M),T=!!P.store&&!!P.store.getState&&!!P.store.dispatch,k=!!$&&!!$.store,U=T?P.store:$.store,ie=k?$.getServerState:U.getState,De=N.useMemo(()=>i7(U.dispatch,g),[U]),[B,V]=N.useMemo(()=>{if(!h)return m7;const wt=vC(U,T?void 0:$.subscription),_n=wt.notifyNestedSubs.bind(wt);return[wt,_n]},[U,T,$]),q=N.useMemo(()=>T?$:go({},$,{subscription:B}),[T,$,B]),Y=N.useRef(),ce=N.useRef(I),L=N.useRef(),Q=N.useRef(!1);N.useRef(!1);const X=N.useRef(!1),Ae=N.useRef();$u(()=>(X.current=!0,()=>{X.current=!1}),[]);const ge=N.useMemo(()=>()=>L.current&&I===ce.current?L.current:De(U.getState(),I),[U,I]),Mn=N.useMemo(()=>_n=>B?v7(h,U,B,De,ce,Y,Q,X,L,V,_n):()=>{},[B]);g7(y7,[ce,Y,Q,I,L,V]);let gn;try{gn=SC(Mn,ge,ie?()=>De(ie(),I):ge)}catch(wt){throw Ae.current&&(wt.message+=`
+The error may be correlated with this previous error:
+${Ae.current.stack}
+
+`),wt}$u(()=>{Ae.current=void 0,L.current=void 0,Y.current=gn});const Pt=N.useMemo(()=>N.createElement(b,go({},gn,{ref:A})),[A,b,gn]);return N.useMemo(()=>h?N.createElement(M.Provider,{value:q},Pt):Pt,[M,Pt,q])}const x=N.memo(w);if(x.WrappedComponent=b,x.displayName=w.displayName=y,a){const S=N.forwardRef(function(I,M){return N.createElement(x,go({},I,{reactReduxForwardedRef:M}))});return S.displayName=y,S.WrappedComponent=b,D0(S,b)}return D0(x,b)}}function BQ({store:t,context:e,children:n,serverState:r,stabilityCheck:i="once",noopCheck:o="once"}){const s=N.useMemo(()=>{const u=vC(t);return{store:t,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[t,r,i,o]),l=N.useMemo(()=>t.getState(),[t]);$u(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),l!==t.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,l]);const a=e||hl;return N.createElement(a.Provider,{value:s},n)}R8(P8.useSyncExternalStoreWithSelector);h7(Dm.useSyncExternalStore);M8(tC.unstable_batchedUpdates);var bC={exports:{}},b7="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",w7=b7,E7=w7;function wC(){}function EC(){}EC.resetWarningCache=wC;var C7=function(){function t(r,i,o,s,l,a){if(a!==E7){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:EC,resetWarningCache:wC};return n.PropTypes=n,n};bC.exports=C7();var x7=bC.exports;const zQ=xe(x7),ku={prefix:String(Math.round(Math.random()*1e10)),current:0},CC=Ve.createContext(ku),T7=Ve.createContext(!1);let O7=!!(typeof window<"u"&&window.document&&window.document.createElement),ed=new WeakMap;function $7(t=!1){let e=N.useContext(CC),n=N.useRef(null);if(n.current===null&&!t){var r,i;let o=(i=Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||i===void 0||(r=i.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(o){let s=ed.get(o);s==null?ed.set(o,{id:e.current,state:o.memoizedState}):o.memoizedState!==s.state&&(e.current=s.id,ed.delete(o))}n.current=++e.current}return n.current}function k7(t){let e=N.useContext(CC);e===ku&&!O7&&console.warn("When server rendering, you must wrap your application in an to ensure consistent ids are generated between the client and server.");let n=$7(!!t),r=`react-aria${e.prefix}`;return t||`${r}-${n}`}function A7(t){let e=Ve.useId(),[n]=N.useState(xC()),r=n?"react-aria":`react-aria${ku.prefix}`;return t||`${r}-${e}`}Ve.useId;function P7(){return!1}function N7(){return!0}function M7(t){return()=>{}}function xC(){return typeof Ve.useSyncExternalStore=="function"?Ve.useSyncExternalStore(M7,P7,N7):N.useContext(T7)}function TC(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{};function Hi(t){const e=N.useRef(null);return Wm(()=>{e.current=t},[t]),N.useCallback((...n)=>{const r=e.current;return r==null?void 0:r(...n)},[])}let B0=new Map;function I7(t,e){if(t===e)return t;let n=B0.get(t);if(n)return n(e),e;let r=B0.get(e);return r?(r(t),t):e}function OC(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const Kt=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},Tn=t=>t&&"window"in t&&t.window===t?t:Kt(t).defaultView||window;function Dr(...t){let e={...t[0]};for(let n=1;n=65&&i.charCodeAt(2)<=90?e[i]=OC(o,s):(i==="className"||i==="UNSAFE_className")&&typeof o=="string"&&typeof s=="string"?e[i]=_7(o,s):i==="id"&&o&&s?e.id=I7(o,s):e[i]=s!==void 0?s:o}}return e}function D7(...t){return t.length===1?t[0]:e=>{for(let n of t)typeof n=="function"?n(e):n!=null&&(n.current=e)}}const R7=new Set(["id"]),L7=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),F7=new Set(["href","target","rel","download","ping","referrerPolicy"]),B7=/^(data-.*)$/;function $C(t,e={}){let{labelable:n,isLink:r,propNames:i}=e,o={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(R7.has(s)||n&&L7.has(s)||r&&F7.has(s)||i!=null&&i.has(s)||B7.test(s))&&(o[s]=t[s]);return o}function ni(t){if(z7())t.focus({preventScroll:!0});else{let e=j7(t);t.focus(),U7(e)}}let va=null;function z7(){if(va==null){va=!1;try{document.createElement("div").focus({get preventScroll(){return va=!0,!0}})}catch{}}return va}function j7(t){let e=t.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==r;)(e.offsetHeight"u"||window.navigator==null?!1:((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands.some(n=>t.test(n.brand)))||t.test(window.navigator.userAgent)}function Hm(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function ml(){return Hm(/^Mac/i)}function V7(){return Hm(/^iPhone/i)}function kC(){return Hm(/^iPad/i)||ml()&&navigator.maxTouchPoints>1}function AC(){return V7()||kC()}function W7(){return Hc(/AppleWebKit/i)&&!H7()}function H7(){return Hc(/Chrome/i)}function PC(){return Hc(/Android/i)}function G7(){return Hc(/Firefox/i)}function gl(t,e,n=!0){var r,i;let{metaKey:o,ctrlKey:s,altKey:l,shiftKey:a}=e;G7()&&(!((i=window.event)===null||i===void 0||(r=i.type)===null||r===void 0)&&r.startsWith("key"))&&t.target==="_blank"&&(ml()?o=!0:s=!0);let u=W7()&&ml()&&!kC()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:s,altKey:l,shiftKey:a}):new MouseEvent("click",{metaKey:o,ctrlKey:s,altKey:l,shiftKey:a,bubbles:!0,cancelable:!0});gl.isOpening=n,ni(t),t.dispatchEvent(u),gl.isOpening=!1}gl.isOpening=!1;let Gi=new Map,Dp=new Set;function z0(){if(typeof window>"u")return;function t(r){return"propertyName"in r}let e=r=>{if(!t(r)||!r.target)return;let i=Gi.get(r.target);i||(i=new Set,Gi.set(r.target,i),r.target.addEventListener("transitioncancel",n,{once:!0})),i.add(r.propertyName)},n=r=>{if(!t(r)||!r.target)return;let i=Gi.get(r.target);if(i&&(i.delete(r.propertyName),i.size===0&&(r.target.removeEventListener("transitioncancel",n),Gi.delete(r.target)),Gi.size===0)){for(let o of Dp)o();Dp.clear()}};document.body.addEventListener("transitionrun",e),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?z0():document.addEventListener("DOMContentLoaded",z0));function NC(t){requestAnimationFrame(()=>{Gi.size===0?t():Dp.add(t)})}function K7(){let t=N.useRef(new Map),e=N.useCallback((i,o,s,l)=>{let a=l!=null&&l.once?(...u)=>{t.current.delete(s),s(...u)}:s;t.current.set(s,{type:o,eventTarget:i,fn:a,options:l}),i.addEventListener(o,s,l)},[]),n=N.useCallback((i,o,s,l)=>{var a;let u=((a=t.current.get(s))===null||a===void 0?void 0:a.fn)||s;i.removeEventListener(o,u,l),t.current.delete(s)},[]),r=N.useCallback(()=>{t.current.forEach((i,o)=>{n(i.eventTarget,i.type,o,i.options)})},[n]);return N.useEffect(()=>r,[r]),{addGlobalListener:e,removeGlobalListener:n,removeAllGlobalListeners:r}}function q7(t){const e=N.useRef(null);return N.useMemo(()=>({get current(){return e.current},set current(n){e.current=n,typeof t=="function"?t(n):t&&(t.current=n)}}),[t])}function MC(t,e){Wm(()=>{if(t&&t.ref&&e)return t.ref.current=e.current,()=>{t.ref&&(t.ref.current=null)}})}function Rp(t){return t.mozInputSource===0&&t.isTrusted?!0:PC()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Y7(t){return!PC()&&t.width===0&&t.height===0||t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"}function J7(t,e){return e.get?e.get.call(t):e.value}function _C(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function Q7(t,e){var n=_C(t,e,"get");return J7(t,n)}function X7(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Z7(t,e,n){X7(t,e),e.set(t,n)}function e9(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}function j0(t,e,n){var r=_C(t,e,"set");return e9(t,r,n),n}let lo="default",Lp="",Wa=new WeakMap;function U0(t){if(AC()){if(lo==="default"){const e=Kt(t);Lp=e.documentElement.style.webkitUserSelect,e.documentElement.style.webkitUserSelect="none"}lo="disabled"}else(t instanceof HTMLElement||t instanceof SVGElement)&&(Wa.set(t,t.style.userSelect),t.style.userSelect="none")}function Sa(t){if(AC()){if(lo!=="disabled")return;lo="restoring",setTimeout(()=>{NC(()=>{if(lo==="restoring"){const e=Kt(t);e.documentElement.style.webkitUserSelect==="none"&&(e.documentElement.style.webkitUserSelect=Lp||""),Lp="",lo="default"}})},300)}else if((t instanceof HTMLElement||t instanceof SVGElement)&&t&&Wa.has(t)){let e=Wa.get(t);t.style.userSelect==="none"&&(t.style.userSelect=e),t.getAttribute("style")===""&&t.removeAttribute("style"),Wa.delete(t)}}const IC=Ve.createContext({register:()=>{}});IC.displayName="PressResponderContext";function t9(t){let e=N.useContext(IC);if(e){let{register:n,...r}=e;t=Dr(r,t),n()}return MC(e,t.ref),t}var ba=new WeakMap;class wa{continuePropagation(){j0(this,ba,!1)}get shouldStopPropagation(){return Q7(this,ba)}constructor(e,n,r){Z7(this,ba,{writable:!0,value:void 0}),j0(this,ba,!0),this.type=e,this.pointerType=n,this.target=r.currentTarget,this.shiftKey=r.shiftKey,this.metaKey=r.metaKey,this.ctrlKey=r.ctrlKey,this.altKey=r.altKey}}const V0=Symbol("linkClicked");function n9(t){let{onPress:e,onPressChange:n,onPressStart:r,onPressEnd:i,onPressUp:o,isDisabled:s,isPressed:l,preventFocusOnPress:a,shouldCancelOnPointerExit:u,allowTextSelectionOnPress:c,ref:d,...f}=t9(t),[p,h]=N.useState(!1),v=N.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:b,removeAllGlobalListeners:m}=K7(),y=Hi((S,A)=>{let I=v.current;if(s||I.didFirePressStart)return!1;let M=!0;if(I.isTriggeringEvent=!0,r){let $=new wa("pressstart",A,S);r($),M=$.shouldStopPropagation}return n&&n(!0),I.isTriggeringEvent=!1,I.didFirePressStart=!0,h(!0),M}),g=Hi((S,A,I=!0)=>{let M=v.current;if(!M.didFirePressStart)return!1;M.ignoreClickAfterPress=!0,M.didFirePressStart=!1,M.isTriggeringEvent=!0;let $=!0;if(i){let T=new wa("pressend",A,S);i(T),$=T.shouldStopPropagation}if(n&&n(!1),h(!1),e&&I&&!s){let T=new wa("press",A,S);e(T),$&&($=T.shouldStopPropagation)}return M.isTriggeringEvent=!1,$}),w=Hi((S,A)=>{let I=v.current;if(s)return!1;if(o){I.isTriggeringEvent=!0;let M=new wa("pressup",A,S);return o(M),I.isTriggeringEvent=!1,M.shouldStopPropagation}return!0}),C=Hi(S=>{let A=v.current;A.isPressed&&A.target&&(A.isOverTarget&&A.pointerType!=null&&g(Rn(A.target,S),A.pointerType,!1),A.isPressed=!1,A.isOverTarget=!1,A.activePointerId=null,A.pointerType=null,m(),c||Sa(A.target))}),x=Hi(S=>{u&&C(S)}),P=N.useMemo(()=>{let S=v.current,A={onKeyDown(M){if(td(M.nativeEvent,M.currentTarget)&&M.currentTarget.contains(M.target)){var $;H0(M.target,M.key)&&M.preventDefault();let T=!0;if(!S.isPressed&&!M.repeat){S.target=M.currentTarget,S.isPressed=!0,T=y(M,"keyboard");let k=M.currentTarget,U=ie=>{td(ie,k)&&!ie.repeat&&k.contains(ie.target)&&S.target&&w(Rn(S.target,ie),"keyboard")};b(Kt(M.currentTarget),"keyup",OC(U,I),!0)}T&&M.stopPropagation(),M.metaKey&&ml()&&(($=S.metaKeyEvents)===null||$===void 0||$.set(M.key,M.nativeEvent))}else M.key==="Meta"&&(S.metaKeyEvents=new Map)},onClick(M){if(!(M&&!M.currentTarget.contains(M.target))&&M&&M.button===0&&!S.isTriggeringEvent&&!gl.isOpening){let $=!0;if(s&&M.preventDefault(),!S.ignoreClickAfterPress&&!S.ignoreEmulatedMouseEvents&&!S.isPressed&&(S.pointerType==="virtual"||Rp(M.nativeEvent))){!s&&!a&&ni(M.currentTarget);let T=y(M,"virtual"),k=w(M,"virtual"),U=g(M,"virtual");$=T&&k&&U}S.ignoreEmulatedMouseEvents=!1,S.ignoreClickAfterPress=!1,$&&M.stopPropagation()}}},I=M=>{var $;if(S.isPressed&&S.target&&td(M,S.target)){var T;H0(M.target,M.key)&&M.preventDefault();let U=M.target;g(Rn(S.target,M),"keyboard",S.target.contains(U)),m(),M.key!=="Enter"&&Gm(S.target)&&S.target.contains(U)&&!M[V0]&&(M[V0]=!0,gl(S.target,M,!1)),S.isPressed=!1,(T=S.metaKeyEvents)===null||T===void 0||T.delete(M.key)}else if(M.key==="Meta"&&(!(($=S.metaKeyEvents)===null||$===void 0)&&$.size)){var k;let U=S.metaKeyEvents;S.metaKeyEvents=void 0;for(let ie of U.values())(k=S.target)===null||k===void 0||k.dispatchEvent(new KeyboardEvent("keyup",ie))}};if(typeof PointerEvent<"u"){A.onPointerDown=k=>{if(k.button!==0||!k.currentTarget.contains(k.target))return;if(Y7(k.nativeEvent)){S.pointerType="virtual";return}nd(k.currentTarget)&&k.preventDefault(),S.pointerType=k.pointerType;let U=!0;S.isPressed||(S.isPressed=!0,S.isOverTarget=!0,S.activePointerId=k.pointerId,S.target=k.currentTarget,!s&&!a&&ni(k.currentTarget),c||U0(S.target),U=y(k,S.pointerType),b(Kt(k.currentTarget),"pointermove",M,!1),b(Kt(k.currentTarget),"pointerup",$,!1),b(Kt(k.currentTarget),"pointercancel",T,!1)),U&&k.stopPropagation()},A.onMouseDown=k=>{k.currentTarget.contains(k.target)&&k.button===0&&(nd(k.currentTarget)&&k.preventDefault(),k.stopPropagation())},A.onPointerUp=k=>{!k.currentTarget.contains(k.target)||S.pointerType==="virtual"||k.button===0&&Fi(k,k.currentTarget)&&w(k,S.pointerType||k.pointerType)};let M=k=>{k.pointerId===S.activePointerId&&(S.target&&Fi(k,S.target)?!S.isOverTarget&&S.pointerType!=null&&(S.isOverTarget=!0,y(Rn(S.target,k),S.pointerType)):S.target&&S.isOverTarget&&S.pointerType!=null&&(S.isOverTarget=!1,g(Rn(S.target,k),S.pointerType,!1),x(k)))},$=k=>{k.pointerId===S.activePointerId&&S.isPressed&&k.button===0&&S.target&&(Fi(k,S.target)&&S.pointerType!=null?g(Rn(S.target,k),S.pointerType):S.isOverTarget&&S.pointerType!=null&&g(Rn(S.target,k),S.pointerType,!1),S.isPressed=!1,S.isOverTarget=!1,S.activePointerId=null,S.pointerType=null,m(),c||Sa(S.target))},T=k=>{C(k)};A.onDragStart=k=>{k.currentTarget.contains(k.target)&&C(k)}}else{A.onMouseDown=T=>{if(T.button!==0||!T.currentTarget.contains(T.target))return;if(nd(T.currentTarget)&&T.preventDefault(),S.ignoreEmulatedMouseEvents){T.stopPropagation();return}S.isPressed=!0,S.isOverTarget=!0,S.target=T.currentTarget,S.pointerType=Rp(T.nativeEvent)?"virtual":"mouse",!s&&!a&&ni(T.currentTarget),y(T,S.pointerType)&&T.stopPropagation(),b(Kt(T.currentTarget),"mouseup",M,!1)},A.onMouseEnter=T=>{if(!T.currentTarget.contains(T.target))return;let k=!0;S.isPressed&&!S.ignoreEmulatedMouseEvents&&S.pointerType!=null&&(S.isOverTarget=!0,k=y(T,S.pointerType)),k&&T.stopPropagation()},A.onMouseLeave=T=>{if(!T.currentTarget.contains(T.target))return;let k=!0;S.isPressed&&!S.ignoreEmulatedMouseEvents&&S.pointerType!=null&&(S.isOverTarget=!1,k=g(T,S.pointerType,!1),x(T)),k&&T.stopPropagation()},A.onMouseUp=T=>{T.currentTarget.contains(T.target)&&!S.ignoreEmulatedMouseEvents&&T.button===0&&w(T,S.pointerType||"mouse")};let M=T=>{if(T.button===0){if(S.isPressed=!1,m(),S.ignoreEmulatedMouseEvents){S.ignoreEmulatedMouseEvents=!1;return}S.target&&Fi(T,S.target)&&S.pointerType!=null?g(Rn(S.target,T),S.pointerType):S.target&&S.isOverTarget&&S.pointerType!=null&&g(Rn(S.target,T),S.pointerType,!1),S.isOverTarget=!1}};A.onTouchStart=T=>{if(!T.currentTarget.contains(T.target))return;let k=r9(T.nativeEvent);if(!k)return;S.activePointerId=k.identifier,S.ignoreEmulatedMouseEvents=!0,S.isOverTarget=!0,S.isPressed=!0,S.target=T.currentTarget,S.pointerType="touch",!s&&!a&&ni(T.currentTarget),c||U0(S.target),y(T,S.pointerType)&&T.stopPropagation(),b(Tn(T.currentTarget),"scroll",$,!0)},A.onTouchMove=T=>{if(!T.currentTarget.contains(T.target))return;if(!S.isPressed){T.stopPropagation();return}let k=W0(T.nativeEvent,S.activePointerId),U=!0;k&&Fi(k,T.currentTarget)?!S.isOverTarget&&S.pointerType!=null&&(S.isOverTarget=!0,U=y(T,S.pointerType)):S.isOverTarget&&S.pointerType!=null&&(S.isOverTarget=!1,U=g(T,S.pointerType,!1),x(T)),U&&T.stopPropagation()},A.onTouchEnd=T=>{if(!T.currentTarget.contains(T.target))return;if(!S.isPressed){T.stopPropagation();return}let k=W0(T.nativeEvent,S.activePointerId),U=!0;k&&Fi(k,T.currentTarget)&&S.pointerType!=null?(w(T,S.pointerType),U=g(T,S.pointerType)):S.isOverTarget&&S.pointerType!=null&&(U=g(T,S.pointerType,!1)),U&&T.stopPropagation(),S.isPressed=!1,S.activePointerId=null,S.isOverTarget=!1,S.ignoreEmulatedMouseEvents=!0,S.target&&!c&&Sa(S.target),m()},A.onTouchCancel=T=>{T.currentTarget.contains(T.target)&&(T.stopPropagation(),S.isPressed&&C(T))};let $=T=>{S.isPressed&&T.target.contains(S.target)&&C({currentTarget:S.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};A.onDragStart=T=>{T.currentTarget.contains(T.target)&&C(T)}}return A},[b,s,a,m,c,C,x,g,y,w]);return N.useEffect(()=>()=>{var S;c||Sa((S=v.current.target)!==null&&S!==void 0?S:void 0)},[c]),{isPressed:l||p,pressProps:Dr(f,P)}}function Gm(t){return t.tagName==="A"&&t.hasAttribute("href")}function td(t,e){const{key:n,code:r}=t,i=e,o=i.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||r==="Space")&&!(i instanceof Tn(i).HTMLInputElement&&!DC(i,n)||i instanceof Tn(i).HTMLTextAreaElement||i.isContentEditable)&&!((o==="link"||!o&&Gm(i))&&n!=="Enter")}function r9(t){const{targetTouches:e}=t;return e.length>0?e[0]:null}function W0(t,e){const n=t.changedTouches;for(let r=0;re.right||e.left>t.right||t.top>e.bottom||e.top>t.bottom)}function Fi(t,e){let n=e.getBoundingClientRect(),r=i9(t);return o9(n,r)}function nd(t){return!(t instanceof HTMLElement)||!t.hasAttribute("draggable")}function H0(t,e){return t instanceof HTMLInputElement?!DC(t,e):t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!Gm(t)}const s9=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function DC(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":s9.has(t.type)}class l9{isDefaultPrevented(){return this.nativeEvent.defaultPrevented}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPropagationStopped=()=>!0}isPropagationStopped(){return!1}persist(){}constructor(e,n){this.nativeEvent=n,this.target=n.target,this.currentTarget=n.currentTarget,this.relatedTarget=n.relatedTarget,this.bubbles=n.bubbles,this.cancelable=n.cancelable,this.defaultPrevented=n.defaultPrevented,this.eventPhase=n.eventPhase,this.isTrusted=n.isTrusted,this.timeStamp=n.timeStamp,this.type=e}}function RC(t){let e=N.useRef({isFocused:!1,observer:null});Wm(()=>{const r=e.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Hi(r=>{t==null||t(r)});return N.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){e.current.isFocused=!0;let i=r.target,o=s=>{e.current.isFocused=!1,i.disabled&&n(new l9("blur",s)),e.current.observer&&(e.current.observer.disconnect(),e.current.observer=null)};i.addEventListener("focusout",o,{once:!0}),e.current.observer=new MutationObserver(()=>{if(e.current.isFocused&&i.disabled){var s;(s=e.current.observer)===null||s===void 0||s.disconnect();let l=i===document.activeElement?null:document.activeElement;i.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),i.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),e.current.observer.observe(i,{attributes:!0,attributeFilter:["disabled"]})}},[n])}function LC(t){let{isDisabled:e,onFocus:n,onBlur:r,onFocusChange:i}=t;const o=N.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),i&&i(!1),!0},[r,i]),s=RC(o),l=N.useCallback(a=>{a.target===a.currentTarget&&document.activeElement===a.target&&(n&&n(a),i&&i(!0),s(a))},[i,n,s]);return{focusProps:{onFocus:!e&&(n||i||r)?l:void 0,onBlur:!e&&(r||i)?o:void 0}}}let ns=null,Fp=new Set,js=new Map,bi=!1,Bp=!1;const a9={Tab:!0,Escape:!0};function Km(t,e){for(let n of Fp)n(t,e)}function u9(t){return!(t.metaKey||!ml()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function Au(t){bi=!0,u9(t)&&(ns="keyboard",Km("keyboard",t))}function Gt(t){ns="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(bi=!0,Km("pointer",t))}function FC(t){Rp(t)&&(bi=!0,ns="virtual")}function BC(t){t.target===window||t.target===document||(!bi&&!Bp&&(ns="virtual",Km("virtual",t)),bi=!1,Bp=!1)}function zC(){bi=!1,Bp=!0}function zp(t){if(typeof window>"u"||js.get(Tn(t)))return;const e=Tn(t),n=Kt(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){bi=!0,r.apply(this,arguments)},n.addEventListener("keydown",Au,!0),n.addEventListener("keyup",Au,!0),n.addEventListener("click",FC,!0),e.addEventListener("focus",BC,!0),e.addEventListener("blur",zC,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Gt,!0),n.addEventListener("pointermove",Gt,!0),n.addEventListener("pointerup",Gt,!0)):(n.addEventListener("mousedown",Gt,!0),n.addEventListener("mousemove",Gt,!0),n.addEventListener("mouseup",Gt,!0)),e.addEventListener("beforeunload",()=>{jC(t)},{once:!0}),js.set(e,{focus:r})}const jC=(t,e)=>{const n=Tn(t),r=Kt(t);e&&r.removeEventListener("DOMContentLoaded",e),js.has(n)&&(n.HTMLElement.prototype.focus=js.get(n).focus,r.removeEventListener("keydown",Au,!0),r.removeEventListener("keyup",Au,!0),r.removeEventListener("click",FC,!0),n.removeEventListener("focus",BC,!0),n.removeEventListener("blur",zC,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Gt,!0),r.removeEventListener("pointermove",Gt,!0),r.removeEventListener("pointerup",Gt,!0)):(r.removeEventListener("mousedown",Gt,!0),r.removeEventListener("mousemove",Gt,!0),r.removeEventListener("mouseup",Gt,!0)),js.delete(n))};function c9(t){const e=Kt(t);let n;return e.readyState!=="loading"?zp(t):(n=()=>{zp(t)},e.addEventListener("DOMContentLoaded",n)),()=>jC(t,n)}typeof document<"u"&&c9();function UC(){return ns!=="pointer"}function f9(){return ns}const d9=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function p9(t,e,n){var r;const i=typeof window<"u"?Tn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,o=typeof window<"u"?Tn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,s=typeof window<"u"?Tn(n==null?void 0:n.target).HTMLElement:HTMLElement,l=typeof window<"u"?Tn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return t=t||(n==null?void 0:n.target)instanceof i&&!d9.has(n==null||(r=n.target)===null||r===void 0?void 0:r.type)||(n==null?void 0:n.target)instanceof o||(n==null?void 0:n.target)instanceof s&&(n==null?void 0:n.target.isContentEditable),!(t&&e==="keyboard"&&n instanceof l&&!a9[n.key])}function h9(t,e,n){zp(),N.useEffect(()=>{let r=(i,o)=>{p9(!!(n!=null&&n.isTextInput),i,o)&&t(UC())};return Fp.add(r),()=>{Fp.delete(r)}},e)}function m9(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=t,o=N.useRef({isFocusWithin:!1}),s=N.useCallback(u=>{o.current.isFocusWithin&&!u.currentTarget.contains(u.relatedTarget)&&(o.current.isFocusWithin=!1,n&&n(u),i&&i(!1))},[n,i,o]),l=RC(s),a=N.useCallback(u=>{!o.current.isFocusWithin&&document.activeElement===u.target&&(r&&r(u),i&&i(!0),o.current.isFocusWithin=!0,l(u))},[r,i,l]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:a,onBlur:s}}}let Pu=!1,rd=0;function jp(){Pu=!0,setTimeout(()=>{Pu=!1},50)}function G0(t){t.pointerType==="touch"&&jp()}function g9(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",G0):document.addEventListener("touchend",jp),rd++,()=>{rd--,!(rd>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",G0):document.removeEventListener("touchend",jp))}}function y9(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:i}=t,[o,s]=N.useState(!1),l=N.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;N.useEffect(g9,[]);let{hoverProps:a,triggerHoverEnd:u}=N.useMemo(()=>{let c=(p,h)=>{if(l.pointerType=h,i||h==="touch"||l.isHovered||!p.currentTarget.contains(p.target))return;l.isHovered=!0;let v=p.currentTarget;l.target=v,e&&e({type:"hoverstart",target:v,pointerType:h}),n&&n(!0),s(!0)},d=(p,h)=>{if(l.pointerType="",l.target=null,h==="touch"||!l.isHovered)return;l.isHovered=!1;let v=p.currentTarget;r&&r({type:"hoverend",target:v,pointerType:h}),n&&n(!1),s(!1)},f={};return typeof PointerEvent<"u"?(f.onPointerEnter=p=>{Pu&&p.pointerType==="mouse"||c(p,p.pointerType)},f.onPointerLeave=p=>{!i&&p.currentTarget.contains(p.target)&&d(p,p.pointerType)}):(f.onTouchStart=()=>{l.ignoreEmulatedMouseEvents=!0},f.onMouseEnter=p=>{!l.ignoreEmulatedMouseEvents&&!Pu&&c(p,"mouse"),l.ignoreEmulatedMouseEvents=!1},f.onMouseLeave=p=>{!i&&p.currentTarget.contains(p.target)&&d(p,"mouse")}),{hoverProps:f,triggerHoverEnd:d}},[e,n,r,i,l]);return N.useEffect(()=>{i&&u({currentTarget:l.target},l.pointerType)},[i]),{hoverProps:a,isHovered:o}}function K0(t){if(!t)return;let e=!0;return n=>{let r={...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.")},continuePropagation(){e=!1}};t(r),e&&n.stopPropagation()}}function v9(t){return{keyboardProps:t.isDisabled?{}:{onKeyDown:K0(t.onKeyDown),onKeyUp:K0(t.onKeyUp)}}}function S9(t){const e=Kt(t);if(f9()==="virtual"){let n=e.activeElement;NC(()=>{e.activeElement===n&&t.isConnected&&ni(t)})}else ni(t)}function b9(t,e){return!t||!e?!1:e.some(n=>n.contains(t))}class qm{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,n,r){let i=this.fastMap.get(n??null);if(!i)return;let o=new q0({scopeRef:e});i.addChild(o),o.parent=i,this.fastMap.set(e,o),r&&(o.nodeToRestore=r)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let n=this.fastMap.get(e);if(!n)return;let r=n.parent;for(let o of this.traverse())o!==n&&n.nodeToRestore&&o.nodeToRestore&&n.scopeRef&&n.scopeRef.current&&b9(o.nodeToRestore,n.scopeRef.current)&&(o.nodeToRestore=n.nodeToRestore);let i=n.children;r&&(r.removeChild(n),i.size>0&&i.forEach(o=>r&&r.addChild(o))),this.fastMap.delete(n.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let n of e.children)yield*this.traverse(n)}clone(){var e;let n=new qm;var r;for(let i of this.traverse())n.addTreeNode(i.scopeRef,(r=(e=i.parent)===null||e===void 0?void 0:e.scopeRef)!==null&&r!==void 0?r:null,i.nodeToRestore);return n}constructor(){this.fastMap=new Map,this.root=new q0({scopeRef:null}),this.fastMap.set(null,this.root)}}class q0{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}new qm;function w9(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,i=N.useRef({isFocused:!1,isFocusVisible:e||UC()}),[o,s]=N.useState(!1),[l,a]=N.useState(()=>i.current.isFocused&&i.current.isFocusVisible),u=N.useCallback(()=>a(i.current.isFocused&&i.current.isFocusVisible),[]),c=N.useCallback(p=>{i.current.isFocused=p,s(p),u()},[u]);h9(p=>{i.current.isFocusVisible=p,u()},[],{isTextInput:n});let{focusProps:d}=LC({isDisabled:r,onFocusChange:c}),{focusWithinProps:f}=m9({isDisabled:!r,onFocusWithinChange:c});return{isFocused:o,isFocusVisible:l,focusProps:r?f:d}}let E9=Ve.createContext(null);function C9(t){let e=N.useContext(E9)||{};MC(e,t);let{ref:n,...r}=e;return r}function x9(t,e){let{focusProps:n}=LC(t),{keyboardProps:r}=v9(t),i=Dr(n,r),o=C9(e),s=t.isDisabled?{}:o,l=N.useRef(t.autoFocus);return N.useEffect(()=>{l.current&&e.current&&S9(e.current),l.current=!1},[e]),{focusableProps:Dr({...i,tabIndex:t.excludeFromTabOrder&&!t.isDisabled?-1:void 0},s)}}function T9(t,e){let{elementType:n="button",isDisabled:r,onPress:i,onPressStart:o,onPressEnd:s,onPressUp:l,onPressChange:a,preventFocusOnPress:u,allowFocusWhenDisabled:c,onClick:d,href:f,target:p,rel:h,type:v="button"}=t,b;n==="button"?b={type:v,disabled:r}:b={role:"button",tabIndex:r?void 0:0,href:n==="a"&&r?void 0:f,target:n==="a"?p:void 0,type:n==="input"?v:void 0,disabled:n==="input"?r:void 0,"aria-disabled":!r||n==="input"?void 0:r,rel:n==="a"?h:void 0};let{pressProps:m,isPressed:y}=n9({onPressStart:o,onPressEnd:s,onPressChange:a,onPress:i,onPressUp:l,isDisabled:r,preventFocusOnPress:u,ref:e}),{focusableProps:g}=x9(t,e);c&&(g.tabIndex=r?-1:g.tabIndex);let w=Dr(g,m,$C(t,{labelable:!0}));return{isPressed:y,buttonProps:Dr(b,w,{"aria-haspopup":t["aria-haspopup"],"aria-expanded":t["aria-expanded"],"aria-controls":t["aria-controls"],"aria-pressed":t["aria-pressed"],onClick:C=>{d&&(d(C),console.warn("onClick is deprecated, please use onPress"))}})}}function O9(t,e,n){let r=xC(),i=N.useRef(r);i.current=r;let o=N.useCallback(()=>i.current?n():e(),[e,n]);return Dm.useSyncExternalStore(t,o)}typeof Ve.useSyncExternalStore=="function"&&Ve.useSyncExternalStore;const $9=Symbol("callback"),Y0=Symbol("default");function k9(t){let{className:e,style:n,children:r,defaultClassName:i,defaultChildren:o,values:s}=t;return N.useMemo(()=>{let l,a,u;return typeof e=="function"?l=e(s):l=e,typeof n=="function"?a=n(s):a=n,typeof r=="function"?u=r(s):r==null?u=o:u=r,{className:l??i,style:a,children:u,"data-rac":""}},[e,n,r,i,o,s])}function A9(t,e){let n=N.useContext(t);if(e===null)return null;if(n&&typeof n=="object"&&"slots"in n&&n.slots){let r=new Intl.ListFormat().format(Object.keys(n.slots).map(o=>`"${o}"`));if(!e&&!n.slots[Y0])throw new Error(`A slot prop is required. Valid slot names are ${r}.`);let i=e||Y0;if(!n.slots[i])throw new Error(`Invalid slot "${e}". Valid slot names are ${r}.`);return n.slots[i]}return n}function P9(t,e,n){let r=A9(n,t.slot)||{},{ref:i,[$9]:o,...s}=r,l=q7(N.useMemo(()=>D7(e,i),[e,i])),a=Dr(s,t);return"style"in s&&s.style&&typeof s.style=="object"&&"style"in t&&t.style&&typeof t.style=="object"&&(a.style={...s.style,...t.style}),N.useEffect(()=>{o&&o(t)},[o,t]),[a,l]}if(typeof HTMLTemplateElement<"u"){const t=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild").get;Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.dataset.reactAriaHidden?this.content.firstChild:t.call(this)}})}const N9=N.createContext(!1);typeof DocumentFragment<"u"&&new DocumentFragment;function M9(t){let e=(n,r)=>N.useContext(N9)?null:t(n,r);return e.displayName=t.displayName||t.name,Ve.forwardRef(e)}const _9=new Set(["form","formAction","formEncType","formMethod","formNoValidate","formTarget","name","value"]),I9=N.createContext({});function D9(t,e){[t,e]=P9(t,e,I9);let n=t,{buttonProps:r,isPressed:i}=T9(t,e),{focusProps:o,isFocused:s,isFocusVisible:l}=w9(t),{hoverProps:a,isHovered:u}=y9(t),c=k9({...t,values:{isHovered:u,isPressed:i,isFocused:s,isFocusVisible:l,isDisabled:t.isDisabled||!1},defaultClassName:"react-aria-Button"});return Ve.createElement("button",{...$C(t,{propNames:_9}),...Dr(r,o,a),...c,ref:e,slot:t.slot||void 0,"data-disabled":t.isDisabled||void 0,"data-pressed":n.isPressed||i||void 0,"data-hovered":u||void 0,"data-focused":s||void 0,"data-focus-visible":l||void 0})}const jQ=M9(D9);/**
+ * @license lucide-react v0.349.0 - ISC
+ *
+ * This source code is licensed under the ISC license.
+ * See the LICENSE file in the root directory of this source tree.
+ */var R9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
+ * @license lucide-react v0.349.0 - ISC
+ *
+ * This source code is licensed under the ISC license.
+ * See the LICENSE file in the root directory of this source tree.
+ */const L9=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
+ * @license lucide-react v0.349.0 - ISC
+ *
+ * This source code is licensed under the ISC license.
+ * See the LICENSE file in the root directory of this source tree.
+ */const VC=(t,e)=>{const n=N.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:s,className:l="",children:a,...u},c)=>N.createElement("svg",{ref:c,...R9,width:i,height:i,stroke:r,strokeWidth:s?Number(o)*24/Number(i):o,className:["lucide",`lucide-${L9(t)}`,l].join(" "),...u},[...e.map(([d,f])=>N.createElement(d,f)),...Array.isArray(a)?a:[a]]));return n.displayName=`${t}`,n};/**
+ * @license lucide-react v0.349.0 - ISC
+ *
+ * This source code is licensed under the ISC license.
+ * See the LICENSE file in the root directory of this source tree.
+ */const UQ=VC("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
+ * @license lucide-react v0.349.0 - ISC
+ *
+ * This source code is licensed under the ISC license.
+ * See the LICENSE file in the root directory of this source tree.
+ */const VQ=VC("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function WC(t){return lc.sanitize(t,{ALLOWED_TAGS:["#text"],KEEP_CONTENT:!0})}function Bl(t,e){return t.reduce((n,r)=>n?r(n):null,e)}var F9=xi,B9=vt,z9=Nn,j9="[object String]";function U9(t){return typeof t=="string"||!B9(t)&&z9(t)&&F9(t)==j9}var V9=U9;const _o=xe(V9),HC=t=>{if(!Array.isArray(t))throw new TypeError("customFilters should be given as an array");if(t.some(e=>typeof e!="function"))throw new TypeError("The given filter is not a function");return!0};var W9=lb;function H9(t,e,n,r){return W9(t,function(i,o,s){e(r,n(i),o,s)}),r}var G9=H9,K9=G9;function q9(t,e){return function(n,r){return K9(n,t,e(r),{})}}var Y9=q9,J9=SS,Q9=Y9,X9=$l,Z9=Object.prototype,ej=Z9.toString,tj=Q9(function(t,e,n){e!=null&&typeof e.toString!="function"&&(e=ej.call(e)),t[e]=n},J9(X9)),nj=tj;const GC=xe(nj);function rj(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var KC=rj;const yo=xe(KC);function ij(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r1),o}),Cj(t,Oj(t),n),r&&(n=bj(n,$j|kj|Aj,xj));for(var i=e.length;i--;)wj(n,e[i]);return n}),Nj=Pj;const Up=xe(Nj),_={AFlat:"Ab",A:"A",ASharp:"A#",BFlat:"Bb",B:"B",C:"C",CSharp:"C#",DFlat:"Db",D:"D",DSharp:"D#",EFlat:"Eb",E:"E",F:"F",FSharp:"F#",GFlat:"Gb",G:"G",GSharp:"G#"},Vp={Ab:_.AFlat,A:_.A,"A#":_.ASharp,Bb:_.BFlat,B:_.B,"B#":_.C,Cb:_.B,C:_.C,"C#":_.CSharp,Db:_.DFlat,D:_.D,"D#":_.DSharp,Eb:_.EFlat,E:_.E,"E#":_.F,Fb:_.E,F:_.F,"F#":_.FSharp,Gb:_.GFlat,G:_.G,"G#":_.GSharp},J0={Lab:_.AFlat,La:_.A,"La#":_.ASharp,Sib:_.BFlat,Si:_.B,"Si#":_.C,Dob:_.B,Do:_.C,"Do#":_.CSharp,Reb:_.DFlat,Réb:_.DFlat,Re:_.D,Ré:_.D,"Re#":_.DSharp,"Ré#":_.DSharp,Mib:_.EFlat,Mi:_.E,"Mi#":_.F,Fab:_.E,Fa:_.F,"Fa#":_.FSharp,Solb:_.GFlat,Sol:_.G,"Sol#":_.GSharp},Q0={...Up(Vp,["Bb","B","B#"]),As:_.AFlat,Ais:_.ASharp,Hb:_.BFlat,Hes:_.BFlat,H:_.B,His:_.C,"H#":_.C,Ces:_.B,Cis:_.CSharp,Des:_.DFlat,Dis:_.DSharp,Es:_.EFlat,Eis:_.F,Fes:_.E,Fis:_.FSharp,Ges:_.GFlat,Gis:_.GSharp};function Ym(t){let e;return Object.keys(t).reduce((n,r)=>(r.match(/.[b|#]$/)&&(e=r.replace("#","♯").replace("b","♭"),n[e]=t[r]),n),{})}const qC={...Vp,...Ym(Vp)},YC={...J0,...Ym(J0)},JC={...Q0,...Ym(Q0)},Wp={...qC,...YC,...JC};Object.keys(Wp).sort((t,e)=>e.length-t.length);const Mj=Object.keys(qC).sort((t,e)=>e.length-t.length),_j=Object.keys(YC).sort((t,e)=>e.length-t.length),Ij=Object.keys(JC).sort((t,e)=>e.length-t.length),Dj=[{name:"english",notes:Mj},{name:"german",notes:Ij},{name:"latin",notes:_j}],yl=[_.A,_.ASharp,_.B,_.C,_.CSharp,_.D,_.DSharp,_.E,_.F,_.FSharp,_.G,_.GSharp],Rj=[_.A,_.BFlat,_.B,_.C,_.DFlat,_.D,_.EFlat,_.E,_.F,_.GFlat,_.G,_.AFlat],QC={[_.CSharp]:_.DFlat,[_.DSharp]:_.EFlat,[_.FSharp]:_.GFlat,[_.GSharp]:_.AFlat,[_.ASharp]:_.BFlat},vl=GC(QC),Lj=[...Object.values(_),...Object.values(_).map(t=>t+"m")];class Fj extends Error{constructor(){super("The given symbol is not a valid string"),this.name="InvalidInput"}}class Bj extends Error{constructor(){super("An unexpected error happened. Maybe a custom filter returned null instead of throwing an exception?"),this.name="UnexpectedError"}}class Jm extends Error{constructor(e,n,r){super(e),this.name=r,this.chord=n}}class XC extends Jm{constructor(e){const n=`"${e.input.symbol}" does not seems to be a chord`;super(n,e,"NoSymbolFound")}}class zj extends Jm{constructor(e,n){const r=`The chord descriptor "${e.input.descriptor}" contains unknown or duplicated modifiers: "${n}"`;super(r,e,"InvalidModifier")}}class jj extends Jm{constructor(e,n){const r=`"${e.input.symbol}" describes a chord with an invalid intervals combo: `+n.join(" and ");super(r,e,"InvalidIntervals")}}function zl(t,e){const n=vh(e)?e:[e];return Js(t,n)}function ue(t,e){return Xm(t,e,"oneOf")}function Qm(t,e){return Xm(t,e,"all")}function $r(t,e){return Xm(t,e,"none")}function Xm(t,e,n){return(vh(e)?e:[e])[n==="oneOf"?"some":"every"](o=>n==="none"?!t.includes(o):t.includes(o))}const Uj=[["2","3"],["2","9"],["3","b3"],["4","11"],["5","b5"],["5","#5"],["b6","#5"],["b6","6"],["b6","13"],["6","13"],["b7","bb7"],["7","b7"],["9","b9"],["9","#9"],["11","#11"],["13","b13"]];function Vj(t){const e=t.normalized.intervals,n=Uj.find(r=>Qm(e,r));if(n)throw new jj(t,n);return t}function ZC(t){const{rootNote:e,bassNote:n,descriptor:r,chordChanges:i}=t.formatted;let o=e;return r&&(o+=r),i&&i.length&&(o+="("+i.join(",")+")"),n&&(o+="/"+n),t.formatted.symbol=o,t}const z={ma:"major",ma6:"major6",ma7:"major7",dom7:"dominant7",mi:"minor",mi6:"minor6",mi7:"minor7",miMa7:"minorMajor7",aug:"augmented",dim:"diminished",dim7:"diminished7",power:"power",bass:"bass"},ex=[z.mi,z.mi6,z.mi7,z.miMa7,z.dim,z.dim7],Wj={[z.ma]:()=>"",[z.ma6]:t=>t.normalized.intervals.includes("9")?"69":"6",[z.ma7]:t=>"ma"+Ea(t),[z.dom7]:t=>t.normalized.intents.alt?"7alt":Ea(t),[z.mi]:()=>"mi",[z.mi6]:t=>t.normalized.intervals.includes("9")?"mi69":"mi6",[z.mi7]:t=>"mi"+Ea(t),[z.miMa7]:t=>"miMa"+Ea(t),[z.aug]:()=>"+",[z.dim]:()=>"dim",[z.dim7]:()=>"dim7",[z.power]:()=>"5",[z.bass]:()=>" bass"},Nu={add:"add",add7:"Ma7",omit:"omit",sus:"sus"};function tx(t){return t.formatted={rootNote:t.normalized.rootNote,bassNote:t.normalized.bassNote,descriptor:Hj(t),chordChanges:Gj(t)},t}function Hj(t){let e=Wj[t.normalized.quality](t);return t.normalized.isSuspended&&(e+=Nu.sus),e}function Ea(t){const e=t.normalized.extensions;let n=e[e.length-1];return n==="11"&&t.normalized.intents.major&&(n=$r(t.normalized.alterations,["b9","#9"])?"9":"7"),n||"7"}function Gj(t){const e=Yj(t.normalized.omits);if(Kj(t))return e;const n=qj(t.normalized.quality,t.normalized.adds);return[...t.normalized.alterations,...n,...e]}function Kj(t){return t.normalized.intents.alt&&t.normalized.quality===z.dom7}function qj(t,e){return e.filter(n=>!([z.ma6,z.mi6].includes(t)&&n==="9")).map((n,r)=>{let i="";return r===0&&(i+=Nu.add,["b","#"].includes(n[0])&&(i+=" ")),i+=n==="7"?Nu.add7:n,i})}function Yj(t){return t.map((e,n)=>{let r="";return n===0&&(r+=Nu.omit),r+=e==="b3"?"3":e,r})}const Bi={flat:"♭",sharp:"♯"},Jj={major:{0:"I",2:"II",3:`${Bi.flat}III`,4:"III",5:"IV",7:"V",8:`${Bi.flat}VI`,9:"VI",10:`${Bi.flat}VII`,11:"VII"},minor:{0:"I",2:"II",3:"III",4:`${Bi.sharp}III`,5:"IV",7:"V",8:"VI",9:`${Bi.sharp}VI`,10:"VII",11:`${Bi.sharp}VII`}},te={sup2:"²",sup4:"⁴",sup5:"⁵",sup6:"⁶",sup7:"⁷",sub3:"₃",sub4:"₄",sub5:"₅",flat:"♭",sharp:"♯"},Ca={major:["I","ii","iii","IV","V","vi","vii°"],dom7:["IΔ",`ii${te.sup7}`,`iii${te.sup7}`,"IVΔ",`V${te.sup7}`,`vi${te.sup7}`,"viiø"],minor:["i","ii°","III","iv","v","VI","VII"],minor7:[`i${te.sup7}`,"iiø","IIIΔ",`iv${te.sup7}`,`v${te.sup7}`,"VIΔ","VIIΔ"]},xa={borrowedFromMinor:["i","ii°",`${te.flat}III`,"iv","v",`${te.flat}VI`,`${te.flat}VII`],borrowedFromMinor7:[`i${te.sup7}`,"iiø",`${te.flat}IIIΔ`,`iv${te.sup7}`,`v${te.sup7}`,`${te.flat}VIΔ`,`${te.flat}VIIΔ`],borrowedFromMajor:["I","ii",`${te.sharp}iii`,"IV","V",`${te.sharp}vi`,`${te.sharp}vii°`],borrowedFromDom7:["IΔ",`ii${te.sup7}`,`${te.sharp}iii${te.sup7}`,"IVΔ",`V${te.sup7}`,`${te.sharp}vi${te.sup7}`,`${te.sharp}viiø`]};function Qj(t="",e){let n,r,i;t||(t=e.normalized.rootNote);const o=t.indexOf("m")>-1?"minor":"major",s=ex.includes(e.normalized.quality)?"minor":"major";n=Xj(t,o,e,s);const l=rU(e),a=eU[e.normalized.quality](e,l);return r=`${n}${a}`,tU(o,r)?i="diatonic":nU(o,r)?i="borrowed":(i="unknown",n="?",r=`${n}${a}`),r+=l,e.numeral={symbol:r,degree:n,descriptor:a,inversion:l,type:i,thirdQuality:s},e}function Xj(t,e,n,r){const i=t.replace("m",""),o=Zj(i,n.normalized.rootNote),s=Jj[e][o]||"?";return r==="minor"?s.toLowerCase():s}function Zj(t,e){const n=yl.indexOf(vl[t]||t);return(yl.indexOf(vl[e]||e)-n+12)%12}const eU={[z.ma]:()=>"",[z.ma6]:()=>"",[z.ma7]:()=>"Δ",[z.dom7]:(t,e)=>e===""?`${te.sup7}`:"",[z.mi]:()=>"",[z.mi6]:()=>"",[z.mi7]:(t,e)=>t.normalized.intervals.includes("b5")?"ø":e===""?`${te.sup7}`:"",[z.miMa7]:()=>"mΔ",[z.aug]:()=>"+",[z.dim]:()=>"°",[z.dim7]:(t,e)=>e===""?`°${te.sup7}`:"°",[z.power]:()=>"",[z.bass]:()=>""};function tU(t,e){return t==="major"?Ca.major.includes(e)||Ca.dom7.includes(e):Ca.minor.includes(e)||Ca.minor7.includes(e)}function nU(t,e){return t==="major"?xa.borrowedFromMinor.includes(e)||xa.borrowedFromMinor7.includes(e):xa.borrowedFromMajor.includes(e)||xa.borrowedFromDom7.includes(e)}function rU(t){let e="";return t.normalized.bassNote&&(iU(t)?e=X0(t)?`${te.sup6}${te.sub5}`:`${te.sup6}`:oU(t)?e=X0(t)?`${te.sup4}${te.sub3}`:`${te.sup6}${te.sub4}`:sU(t)&&(e="²")),e}function X0(t){return[z.ma7,z.mi7,z.miMa7,z.dom7,z.dim7].includes(t.normalized.quality)}function iU(t){return kr(t,"b3")||kr(t,"3")}function oU(t){return kr(t,"b5")||kr(t,"5")||kr(t,"#5")}function sU(t){return kr(t,"bb7")||kr(t,"b7")||kr(t,"7")}function kr(t,e){const n=t.normalized.intervals.indexOf(e);if(n===-1)return!1;const r=vl[t.normalized.bassNote]||t.normalized.bassNote,i=vl[t.normalized.notes[n]]||t.normalized.notes[n];return r===i}function lU(t){const e=[aU,uU,cU,fU];return t.input.descriptor&&(t.input.parsableDescriptor=Bl(e,t.input.descriptor)),t}function aU(t){return t.replace(/[A-LN-Za-z]+/g,e=>e.toLowerCase()).replace("oMit","omit").replace("diM","dim").replace("augMented","augmented")}function uU(t){return t.replace(/ /g,"")}function cU(t){return t.replace(/(7?dim)(alt|add)/g,"$1 $2").replace(/([m|M])(alt|add)/g,"$1 $2").replace(/i(no[35])/g,"i $1").replace(/([b♭#♯]9)6/g,"$1 6").replace(/(9\/?6)/g," $1").replaceAll("+5","#5").replaceAll("-5","b5")}function fU(t){let e,n,r;return t.replace(/\((.*?)\)/g,(i,o)=>(e=[],n="",o.split(",").forEach(s=>{r=!0,s.startsWith("add")?n="add":s.startsWith("omit")?n="omit":s.startsWith("no")?n="no":r=!1,r?e.push(s):e.push(n+s)})," "+e.join(" ")+" "))}function dU(t={},e){return{input:{symbol:e},normalized:{},formatted:{},parserConfiguration:oe(t)}}const pU={C:"flat",D:"sharp",E:"sharp",F:"flat",G:"sharp",A:"sharp",B:"sharp",Cm:"flat",Dm:"flat",Em:"sharp",Fm:"flat",Gm:"flat",Am:"flat",Bm:"sharp"};function hU(t){return t.indexOf("#")>-1?"sharp":t.indexOf("b")>-1?"flat":pU[t]}function Zm(t){const e=t.normalized.rootNote,n=t.normalized.semitones,r=t.normalized.quality;let i=e;ex.includes(r)&&(i+="m");const o=hU(i)==="sharp"?yl:Rj,s=o.indexOf(e),l=[...o.slice(s),...o.slice(0,s),...o.slice(s),...o.slice(0,s)];return t.normalized.notes=n.map(a=>l[a]),t}function mU(t){return t.normalized.rootNote=Wp[t.input.rootNote],t.input.bassNote&&(t.normalized.bassNote=Wp[t.input.bassNote]),t}var gU=Mh,yU=4;function vU(t){return gU(t,yU)}var SU=vU;const eg=xe(SU);var bU=sc,wU=Oi,EU=Yo;function CU(t){return function(e,n,r){var i=Object(e);if(!wU(e)){var o=bU(n);e=EU(e),n=function(l){return o(i[l],l,i)}}var s=t(e,n,r);return s>-1?i[o?e[s]:s]:void 0}}var xU=CU;function TU(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o-1}var tg=hV;function mV(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=AV){var u=e?null:$V(t);if(u)return kV(u);s=!1,i=OV,a=new CV}else a=e?[]:l;e:for(;++r=jV&&(o=zV,s=!1,e=new DV(e));e:for(;++il.qualityIntervals.length-s.qualityIntervals.length);return rV(o,s=>Qm(i,s.qualityIntervals))}function ZV(t,e,n,r){const i=[eW.bind(null,r),tW.bind(null,n,e.normalized.intents.major),nW.bind(null,e.normalized.intents.alt),ox];return Bl(i,eg(t))}function eW(t,e){const n=eg(e);return t.includes("3")?n.push("3"):t.includes("b3")&&n.push("b3"),n}function tW(t,e,n){if(t){const r=lx(n,"4");return r.push(e?"3":"b3"),r}return n}function nW(t,e){if(t){const n=lx(e,"b5","#5");return n.push("5"),n}return e}function rW(t,e){const n=[];return iW(e)&&(oW(t,e)?n.push("9","11","13"):sW(t,e)?n.push("9","13"):lW(t)?n.push("9","11"):aW(t)&&n.push("9")),n}function iW(t){return[z.ma7,z.dom7,z.mi7,z.miMa7].includes(t)}function ux(t){return[z.mi7,z.miMa7].includes(t)}function oW(t,e){return ux(e)&&ue(t,"13")&&ue(t,["11","#11"])&&ue(t,["b9","9","#9"])}function sW(t,e){return!ux(e)&&ue(t,"13")&&ue(t,["b9","9","#9"])}function lW(t){return ue(t,"11")&&ue(t,["b9","9","#9"])}function aW(t){return t.includes("9")}function uW(t,e,n){const r=[],i=[];return t.filter(o=>o!=="5"&&o!=="4").forEach(o=>{e.includes(o)||(cW(n,o)?i.push(o):r.push(o))}),fW(t)&&r.push("3"),{adds:n1(r),alterations:n1(i)}}function cW(t,e){return{[z.ma]:["b5","#5","#11","b13"],[z.ma6]:["b5","#5","#11","b13"],[z.ma7]:["b5","#5","#11","b13"],[z.dom7]:["b5","#5","b9","#9","#11","b13"],[z.mi]:["b5","#5","#11","b13"],[z.mi6]:["b5","#5","#11","b13"],[z.mi7]:["b5","#5","#11","b13"],[z.miMa7]:["b5","#5","#11","b13"],[z.aug]:[],[z.dim]:[],[z.dim7]:[]}[t].includes(e)}function fW(t){return Qm(t,["3","4"])}function n1(t){return t.sort((e,n)=>{const r=Number.parseInt(e.replace(/[b#]/,"")),i=Number.parseInt(n.replace(/[b#]/,""));return r-i})}function dW(t,e){const{symbol:n}=e.input,r=t.join("|"),i=new RegExp("^("+r+")(.*?)(/("+r+"))?$"),o=n.match(i);if(o&&o[1])return e.input.rootNote=o[1],o[2]&&(e.input.descriptor=o[2]),o[4]&&(e.input.bassNote=o[4]),e;throw new XC(e)}const O={ma:"ma",mi:"mi",dim:"dim",halfDim:"halfDim",aug:"aug",seventh:"seventh",sus:"sus",sus2:"sus2",ninth:"ninth",eleventh:"eleventh",thirteenth:"thirteenth",fifthFlat:"b5",fifthSharp:"#5",ninthFlat:"b9",ninthSharp:"#9",eleventhSharp:"#11",thirteenthFlat:"b13",add3:"add3",add4:"add4",addb6:"addb6",add6:"add6",add69:"add69",add7:"add7",add9:"add9",add11:"add11",add13:"add13",bass:"bass",omit3:"omit3",omit5:"omit5",power:"power",alt:"alt"},rg={"^":[O.ma,O.add7],Δ:[O.ma,O.add7],M:O.ma,Ma:O.ma,Maj:O.ma,Major:O.ma,ma:O.ma,maj:O.ma,major:O.ma},pW=fx(rg,O.add7,t=>t+"7"),hW=fx(rg,O.add7,t=>"add"+t+"7"),cx={...rg,...pW,"-":O.mi,m:O.mi,Mi:O.mi,Min:O.mi,Minor:O.mi,mi:O.mi,min:O.mi,minor:O.mi,"°":O.dim,o:O.dim,0:O.dim,dim:O.dim,"dim.":O.dim,diminished:O.dim,Ø:O.halfDim,ø:O.halfDim,h:O.halfDim,"+":O.aug,aug:O.aug,augmented:O.aug,7:O.seventh,4:O.sus,sus:O.sus,sus4:O.sus,suspended:O.sus,suspended4:O.sus,sus2:O.sus2,suspended2:O.sus2,9:O.ninth,11:O.eleventh,13:O.thirteenth,b3:O.mi,b5:O.fifthFlat,"♭5":O.fifthFlat,"#5":O.fifthSharp,"♯5":O.fifthSharp,b9:O.ninthFlat,"♭9":O.ninthFlat,addb9:O.ninthFlat,"add♭9":O.ninthFlat,"#9":O.ninthSharp,"♯9":O.ninthSharp,"add#9":O.ninthSharp,"add♯9":O.ninthSharp,"#11":O.eleventhSharp,"♯11":O.eleventhSharp,"add#11":O.eleventhSharp,b13:O.thirteenthFlat,"♭13":O.thirteenthFlat,addb13:O.thirteenthFlat,"add♭13":O.thirteenthFlat,...hW,2:O.add9,add2:O.add9,add3:O.add3,add4:O.add4,addb6:O.addb6,b6:O.addb6,6:O.add6,add6:O.add6,"6/9":O.add69,69:O.add69,96:O.add69,"9/6":O.add69,add9:O.add9,add11:O.add11,add13:O.add13,bass:O.bass,omit3:O.omit3,no3:O.omit3,omit5:O.omit5,no5:O.omit5,5:O.power,alt:O.alt,"alt.":O.alt,altered:O.alt};function fx(t,e,n){return Object.keys(t).map(n).reduce((r,i)=>(r[i]=e,r),{})}const mW=Object.keys(cx).sort((t,e)=>e.length-t.length),Mu={1:0,2:2,b3:3,3:4,4:5,b5:6,5:7,"#5":8,b6:8,6:9,bb7:9,b7:10,7:11,b9:13,9:14,"#9":15,11:17,"#11":18,b13:20,13:21};function gW(t,e){let n=[];return e.input.parsableDescriptor&&(n=yW(e)),e.input.modifiers=n,e.normalized.intervals=vW(n,t),e.normalized.semitones=kW(e.normalized.intervals),e.normalized.intents=AW(n),e}function yW(t){const{parsableDescriptor:e}=t.input,n=[],r=new RegExp(mW.map($W).join("|"),"g"),i=e.match(r);let o=e,s;if(i&&i.forEach(l=>{s=cx[l],Array.isArray(s)||(s=[s]),s.forEach(a=>{n.includes(a)||(n.push(a),o=o.replace(l,""))})}),n.length===0)throw new XC(t);if(o.trim().length>0)throw new zj(t,o);return n}function vW(t,e){return t.includes(O.power)?["1","5"]:t.includes(O.bass)?["1"]:ox(["1",...SW(t),...bW(t),...wW(t,e),...EW(t),...CW(t),...xW(t,e),...TW(t,e),...OW(t,e)]).sort((n,r)=>Mu[n]-Mu[r])}function SW(t){const e=[];return t.includes(O.omit3)?[]:(ue(t,[O.sus,O.sus2])||(ig(t)?t.includes(O.eleventh)||e.push("3"):e.push("b3")),t.includes(O.add3)&&e.push("3"),e)}function bW(t){const e=[];return ue(t,[O.sus,O.add4])&&e.push("4"),e}function wW(t,e){const n=[];return t.includes(O.omit5)?[]:((ue(t,[O.dim,O.halfDim,O.fifthFlat])||Io(t,e,"b5"))&&n.push("b5"),(ue(t,[O.aug,O.fifthSharp])||Io(t,e,"#5"))&&n.push("#5"),!n.length&&!t.includes(O.thirteenthFlat)&&n.push("5"),n)}function EW(t){const e=[];return ue(t,[O.addb6])&&e.push("b6"),ue(t,[O.add6,O.add69])&&!dx(t)&&!ue(t,[O.halfDim])&&e.push("6"),e}function CW(t){const e=[];return ue(t,[O.alt])&&e.push("b7"),ue(t,[O.seventh,O.halfDim])?t.includes(O.dim)?e.push("bb7"):t.includes(O.halfDim)?e.push("b7"):e.push(r1(t)):ue(t,[O.ninth,O.eleventh,O.thirteenth])&&e.push(r1(t)),t.includes(O.add7)&&e.push("7"),e}function r1(t){return t.includes(O.ma)?"7":"b7"}function xW(t,e){const n=[];return ue(t,[O.add69,O.ninth,O.eleventh,O.thirteenth])&&$r(t,[O.ninthFlat,O.ninthSharp])&&n.push("9"),ue(t,[O.sus2,O.add9])&&n.push("9"),(ue(t,[O.ninthFlat])||Io(t,e,"b9"))&&n.push("b9"),(ue(t,[O.ninthSharp])||Io(t,e,"#9"))&&n.push("#9"),n}function TW(t,e){const n=[];return(ue(t,[O.thirteenth])&&!ig(t)||ue(t,[O.eleventh,O.add11]))&&n.push("11"),(ue(t,[O.eleventhSharp])||Io(t,e,"#11"))&&n.push("#11"),n}function OW(t,e){const n=[];return(ue(t,[O.add13,O.thirteenth])||ue(t,[O.add6,O.add69])&&dx(t)||ue(t,[O.add6,O.add69])&&ue(t,[O.halfDim]))&&n.push("13"),(ue(t,[O.thirteenthFlat])||Io(t,e,"b13"))&&n.push("b13"),n}function Io(t,e,n){return t.includes(O.alt)&&e.includes(n)}function ig(t){return $r(t,[O.mi,O.dim,O.dim7,O.halfDim])}function dx(t){return ue(t,[O.seventh,O.ninth,O.eleventh,O.thirteenth])}function $W(t){return t.replace(/[.\-*+?^${}()|[\]\\]/g,"\\$&")}function kW(t){return t.map(e=>Mu[e]).sort((e,n)=>e-n)}function AW(t){return{major:ig(t),eleventh:t.includes(O.eleventh),alt:t.includes(O.alt)}}function Gc(t={}){const e=["b5","#5","b9","#9","#11","b13"],n=["english","german","latin"],{notationSystems:r=oe(n),altIntervals:i=oe(e),customFilters:o=[],key:s=""}=t;return PW(i,e),NW(r,n),HC(o),MW(s),l;function l(a){const u=[];if(!_W(a)){const h=new Fj;u.push(Hp(h))}const c=oe(Dj).filter(h=>r.includes(h.name));let d,f,p;if(!u.length)for(;c.length&&!d;){p=c.shift(),f=[dU.bind(null,t),dW.bind(null,p.notes),lU,gW.bind(null,i),Vj,mU,ax,tx,ZC,Zm,Qj.bind(null,s),...o];try{d=Bl(f,a),d?d.input.notationSystem=p.name:u.push(IW(p.name))}catch(h){u.push(Hp(h,p.name))}}return d||{error:u}}}function PW(t,e){px("altIntervals",t,e,!0)}function NW(t,e){px("notationSystems",t,e)}function px(t,e,n,r){if(!Array.isArray(e))throw new TypeError(`'${t}' should be an array`);if(!r&&e.length===0)throw new TypeError(`'${t}' cannot be empty`);e.forEach(i=>{if(!n.includes(i))throw new TypeError(`'${i}' is not a valid value for ${t}`)})}function MW(t){if(t!==""&&(!_o(t)||!Lj.includes(t)))throw new TypeError(`'${t}' is not a valid value for key`)}function _W(t){return typeof t=="string"&&t.length>0}function IW(t){const e=new Bj;return Hp(e,t)}function Hp(t,e){return{type:t.name,chord:t.chord,message:t.message,notationSystem:e}}const Ln={sus2:"sus2",add2:"2",omit:"no",ma:"M",mi:"m",dim:"°",aug7:"7+",eleventh:"11"};function DW(t){let e,n=t.formatted.chordChanges;return RW(t)?(e=Ln.sus2,n=[]):LW(t)?(e=Ln.add2,n=[]):FW(t)?(e=Ln.aug7,n=[]):(e=t.formatted.descriptor.replace("mi",Ln.mi).replace(/[m|M]a/,Ln.ma).replace("dim",Ln.dim),BW(t)&&(e=e.replace(/7sus|9sus/,Ln.eleventh))),n=n.map(r=>r.replace(/[m|M]a/,Ln.ma).replace("omit",Ln.omit)),{...t,formatted:{...t.formatted,descriptor:e,chordChanges:n}}}function RW(t){return zl(t.normalized.intervals,["1","5","9"])}function LW(t){return zl(t.normalized.intervals,["1","3","5","9"])}function FW(t){return zl(t.normalized.intervals,["1","3","#5","b7"])}function BW(t){return t.normalized.intents.eleventh}var zW=sx,jW=kh,UW=zo,i1=ec,VW=UW(function(t,e){return i1(t)?zW(t,jW(e,1,i1,!0)):[]}),WW=VW;const HW=xe(WW);function GW(t="none",e){if(t==="none")return e;const n={max:["4","b5","#5","6","bb7","b7","7","b9","9","#9","11","#11","b13","13"],core:["4","b9","9","#9","11","#11","b13","13"]},r=HW(e.normalized.intervals,n[t]);return $r(r,["b3","3"])&&r.push(e.normalized.intents.major?"3":"b3"),$r(r,["b5","5","#5"])&&r.push("5"),e.normalized.intervals=r,e.normalized.semitones=r.map(o=>Mu[o]),e.normalized.intents.eleventh=!1,e.normalized.intents.alt=!1,t==="max"&&delete e.normalized.bassNote,Bl([ax,tx,Zm],e)}function KW(t,e,n){const{rootNote:r,bassNote:i}=n.normalized,o=s1(r);if(n.normalized.rootNote=o1(o,t,e),n.formatted.rootNote=n.normalized.rootNote,i){const s=s1(i);n.normalized.bassNote=o1(s,t,e),n.formatted.bassNote=n.normalized.bassNote}return Zm(n)}function o1(t,e,n){const i=yl.indexOf(t)+e,o=Math.floor(i/12),s=i-o*12,l=yl[s];return n==="flat"&&QC[l]||l}function s1(t){return vl[t]||t}const Gp={german:{Ab:"As",A:"A","A#":"Ais",Bb:"Hes",B:"H",C:"C","C#":"Cis",Db:"Des",D:"D","D#":"Dis",Eb:"Es",E:"E",F:"F","F#":"Fis",Gb:"Ges",G:"G","G#":"Gis"},latin:{Ab:"Lab",A:"La","A#":"La#",Bb:"Sib",B:"Si",C:"Do","C#":"Do#",Db:"Reb",D:"Re","D#":"Re#",Eb:"Mib",E:"Mi",F:"Fa","F#":"Fa#",Gb:"Solb",G:"Sol","G#":"Sol#"}},qW=Object.keys(Gp);function YW(t="english",e){const n=t==="auto"?e.input.notationSystem:t;return n==="english"?e:qW.includes(n)?(e.formatted.rootNote=Gp[n][e.formatted.rootNote],e.formatted.bassNote&&(e.formatted.bassNote=Gp[n][e.formatted.bassNote]),e):null}function hx(t){return t&&t.formatted&&t.formatted.symbol?t.formatted.symbol:null}function JW(t){delete t.parserConfiguration.notationSystems;const e=oe(t),n=hx(t),i=Gc(t.parserConfiguration)(n);return e.input=i.input,e}function mx({accidental:t="original",customFilters:e=[],notationSystem:n="english",printer:r="text",simplify:i="none",transposeValue:o=0,useShortNamings:s=!1}={}){HC(e);const l=[];return["max","core"].includes(i)&&l.push(GW.bind(null,i)),(t!=="original"||o!==0)&&l.push(KW.bind(null,o,t)),s&&l.push(DW),l.push(YW.bind(null,n),ZC,...e),a;function a(u){if(!QW(u))return null;const c=Bl(l,oe(u));return r==="raw"?JW(c):hx(c)}}const QW=t=>t&&typeof t=="object"&&!t.error&&t.input,gx=/([^\s]+)/g,Kp=/\[([^\]]*)]/g,yx=t=>{const e=t.trim().match(gx);return e?e.every(Sx):!1},vx=t=>{const e=t.trim().match(Kp);return e?e.map(n=>n.replace(/[[\]]/g,"")).every(Sx):!1};function Sx(t){return!Gc()(t).error}const bx=(t,e)=>{for(;t.length&&e(t[0]);)t.shift();for(;t.length&&e(t[t.length-1]);)t.pop();return t},XW={adlib:"a","ad-lib":"a","ad.lib.":"a",bridge:"b",chorus:"c",intro:"i",introduction:"i",outro:"o",prechorus:"p","pre-chorus":"p","pre chorus":"p",solo:"s",interlude:"u",verse:"v"},wx=t=>{let e="#";const n="(.*?)",r="([\\s]+[0-9]{1,2})?",i="([\\s]+[x][0-9]{1,2})?",o=new RegExp(`^${n}${r}${i}$`),[,s,,l]=t.trim().match(o),a=s.trim().toLowerCase();return e+=XW[a]||s.trim(),l&&(e+=" "+l.trim()),e},ft={EMPTY:"empty",DIRECTIVE:"directive",COMMENT:"comment",LYRICS:"lyrics",CHORDS_LYRICS:"chordsLyrics",SECTION_START:"sectionStart",SECTION_CLOSE:"sectionClose",SECTION_REPEAT:"sectionRepeat"},ZW=["chorus","verse","bridge","comment","comment_italic","comment_bold","c","ci","cb"],eH=["start_of_chorus","start_of_verse","start_of_bridge","start_of_part","soc","sov","sob","sop"],tH=["end_of_chorus","end_of_verse","end_of_bridge","end_of_part","eoc","eov","eob","sop"],nH={chorus:"c",verse:"v",bridge:"b",start_of_chorus:"c",start_of_verse:"v",start_of_bridge:"b",start_of_part:"v",soc:"c",sov:"v",sob:"b",sop:"v",c:"c",ci:"c",cb:"c",comment:"c",comment_italic:"c",comment_bold:"c"},rH=t=>{const e=[],n=t.map(i=>iH(i)).filter(i=>cH(i)),r=fH(n);return r.forEach((i,o)=>{e.push(i.label),i.allLines.forEach(s=>{e.push(s)}),o{const e={content:t};if(oH(t))e.type=ft.COMMENT;else if(sH(t))e.type=ft.EMPTY;else if(lH(t)){const[n,r]=aH(t);e.key=n,e.value=r,eH.includes(n)?e.type=ft.SECTION_START:tH.includes(n)?e.type=ft.SECTION_CLOSE:ZW.includes(n)?e.type=ft.SECTION_REPEAT:e.type=ft.DIRECTIVE}else if(vx(t)){e.type=ft.CHORDS_LYRICS;const[n,r]=uH(t);e.chords=n,e.lyrics=r}else e.type=ft.LYRICS;return e},oH=t=>{const e=/^#.*$/;return t.trim().match(e)!==null},sH=t=>t.trim()==="",Ex=/^{([^:]+):?(.*)?}$/,lH=t=>t.trim().match(Ex)!==null,aH=t=>{const e=t.trim().match(Ex),n=e[1].trim(),r=e[2]?e[2].trim():void 0;return[n,r]},uH=t=>{const n=t.trim().match(Kp).map(i=>i.replace("[","").replace("]","")).join(" "),r=t.replace(Kp,"_");return[n,r]},cH=t=>![ft.COMMENT,ft.DIRECTIVE].includes(t.type),fH=t=>{let e=[],n;const r=()=>{n&&(e.push(n),n=void 0)},i=o=>{n={label:o?dH(o):"#v",allLines:[]}};return t.forEach(o=>{o.type===ft.SECTION_START?(r(),i(o)):o.type===ft.SECTION_CLOSE?r():o.type===ft.SECTION_REPEAT?(r(),i(o),r()):o.type===ft.EMPTY?n&&n.allLines.push(o.content):(n||i(),o.type===ft.CHORDS_LYRICS?(n.allLines.push(o.chords),n.allLines.push(o.lyrics)):n.allLines.push(o.content))}),r(),e.map(o=>(o.allLines=bx(o.allLines,s=>s===""),o))},dH=t=>{let e;return t.value?e=wx(t.value):e="#"+nH[t.key],e},pH=t=>{let n=0;return t.replace(/\t/g,(i,o)=>{let s=4-(o+n)%4;return n+=s-1," ".repeat(s)}).length},ui=(t,e,n)=>(n>t.length&&(t+=" ".repeat(n-t.length)),t.slice(0,n)+e+t.slice(n)),hH=t=>{const e=[];let n=[];return t.forEach(r=>{yx(r)?(e.push(yH(r)),n=vH(r)):(mH(r)?e.push(gH(r)):n.length&&r.trim()!==""?e.push(wH(r,n)):e.push(r),n=[])}),e.join(`
+`)},Cx=/^\[([^\]]+)]$/,mH=t=>{const e=t.trim().match(Cx);return e!==null&&e[1].trim()!==""},gH=t=>{const e=t.trim().match(Cx)[1];return wx(e)};function yH(t){return t.match(gx).join(" ")}function vH(t){const e=[];let n=0;const r=t.match(/([\s])+/g)||[],i=t.match(/([^\s])+/g);return SH(t)||r.unshift(""),bH(t)&&r.pop(),r.forEach((o,s)=>{const l=pH(" ".repeat(n)+o);e.push(l),n=l+i[s].length}),e}const SH=t=>xx(t.charAt(0)),bH=t=>xx(t.charAt(t.length-1)),xx=t=>t.match(/[\s]/),wH=(t,e)=>{const n="_";let r=t,i=0;return e.forEach(o=>{const s=Math.min(o+i,r.length+1);r=ui(r,n,s),i+=n.length}),r.replace(/[\s]+/g," ").trim()},Jr={AUTO:"auto",CP:"chordPro",COL:"chordsOverLyrics"},WQ=(t,{inputFormat:e=Jr.AUTO}={})=>{EH(e);const n=CH(t);let r=e;e===Jr.AUTO&&(r=xH(n)?Jr.CP:Jr.COL);let i;switch(r){case Jr.CP:i=rH;break;case Jr.COL:i=hH;break}return i(n)},EH=t=>{if(!Object.values(Jr).includes(t))throw new Error("unknown input format: "+t)},CH=t=>WC(t).replace(/\r\n/g,`
+`).replace(/\n\r/g,`
+`).replace(/\r/g,`
+`).replace(/\[\/?ch]/g,"").replace(/\[\/?tab]/g,"").split(`
+`),xH=t=>{const e=t.filter(vx),n=t.filter(yx);return e.length>n.length};function TH(t){return lc.sanitize(t)}function Tx(t){return lc.sanitize(t,{ALLOWED_TAGS:["#text"],KEEP_CONTENT:!0})}const K={CHORD:"chord",EMPTY_LINE:"emptyLine",KEY_DECLARATION:"keyDeclaration",LYRIC:"lyric",SECTION_LABEL:"sectionLabel",TIME_SIGNATURE:"timeSignature"};var OH=qS,Ox=/[\\^$.*+?()[\]{}|]/g,$H=RegExp(Ox.source);function kH(t){return t=OH(t),t&&$H.test(t)?t.replace(Ox,"\\$&"):t}var AH=kH;const Rr=xe(AH);function er(t){return t.replace(/\t+/g," ").replace(/ +/g," ").trim()}const PH=["2/2","3/2","4/2","2/4","3/4","4/4","5/4","6/4","7/4","9/4","10/4","3/8","4/8","5/8","6/8","7/8","9/8","12/8"];function Sl(t){return PH.includes(t)}function _u(t){if(!Sl(t))throw new TypeError("Expected time signature string, received: "+t);const e=t.split("/"),n=Number.parseInt(e[0],10),r=Number.parseInt(e[1],10);let i=n;return r===2?i=n*2:r===8&&(i=n/3),{string:t,count:n,value:r,beatCount:i}}const fe={barRepeat:"%",chordBeatCount:".",chordLineRepeat:"%",chordPositionMarker:"_",lyricLine:":",keyDeclarationPrefix:"key ",noChord:"NC",sectionLabel:"#",subBeatOpener:"[",subBeatCloser:"]"},$x=_u("4/4");function NH(t){return!Gc()(t).error}const MH=new RegExp(Rr(fe.chordBeatCount)+"*$","g"),_H=new RegExp("^"+Rr(fe.barRepeat)+"+$");function IH(t=""){return er(kx(t)).split(" ").every((e,n,r)=>{const i=Ax(e);return NH(i)||e.match(_H)&&n>0||i===fe.noChord||Sl(e)&&r.length>1})}const kx=t=>t.replaceAll("add ","add"),Ax=t=>RH(DH(t)),DH=t=>t.replace(MH,""),RH=t=>{let e=t;return t.startsWith(fe.subBeatOpener)&&(e=e.substring(fe.subBeatOpener.length)),t.endsWith(fe.subBeatCloser)&&(e=e.substring(0,e.length-fe.subBeatCloser.length)),e};function LH(t){const e=er(t);return e===fe.chordLineRepeat||e===fe.chordLineRepeat.repeat(2)}function l1(t){return er(t)===""}const Px=new RegExp("^"+Rr(fe.sectionLabel)+"([a-zA-Z]+)([1-9])?( x[1-9][0-9]?)?$");function Iu(t){return er(t).match(Px)!==null}function FH(t,e={}){return Gc({key:e.string})(t)}var BH=mn,zH=BH.isFinite;function jH(t){return typeof t=="number"&&zH(t)}var UH=jH;const vo=xe(UH);class VH extends Error{constructor({string:e,duration:n,currentBeatCount:r,beatCount:i}={}){if(!e||!_o(e))throw new TypeError("InvalidBeatCountException cannot be created without chord string, received: "+e);if(!n||!vo(n))throw new TypeError("InvalidBeatCountException cannot be created without chord duration, received: "+n);if(!r||!vo(r))throw new TypeError("InvalidBeatCountException cannot be created without currentBeatCount, received: "+r);if(!i||!vo(i))throw new TypeError("InvalidBeatCountException cannot be created without beatCount, received: "+i);super(),this.name="InvalidBeatCountException",this.string=e,this.duration=n,this.currentBeatCount=r,this.beatCount=i}}class WH extends Error{constructor({string:e}={}){if(!e||!_o(e))throw new TypeError("InvalidChordRepetitionException cannot be created without chord string, received: "+e);super(),this.name="InvalidChordRepetitionException",this.string=e}}class Us extends Error{constructor({chordLine:e,symbol:n,position:r}={}){if(!e||!_o(e))throw new TypeError("InvalidSubBeatGroupException cannot be created without a chordLine, received: "+e);if(!n||!_o(n))throw new TypeError("InvalidSubBeatGroupException cannot be created without symbol, received: "+n);if(!vo(r))throw new TypeError("InvalidSubBeatGroupException cannot be created without symbol position, received: "+r);super(),this.name="InvalidSubBeatGroupException",this.chordLine=e,this.symbol=n,this.position=r}}class HH extends Error{constructor({string:e}={}){if(!e||!_o(e))throw new TypeError("InvalidBarRepeatException cannot be created without chord string, received: "+e);super(),this.name="InvalidBarRepeatException",this.string=e}}const GH=new RegExp(Rr(fe.chordBeatCount),"g"),KH=new RegExp("^"+Rr(fe.barRepeat)+"+$");function qH(t,{timeSignature:e=$x,originalKey:n={}}={}){let{beatCount:r}=e;const i=[],o={allChords:[]},s={};let l=oe(o),a={},u,c=0,d,f=!1,p=0,h=!1;aG(t);const v=er(kx(t)).split(" ");return v.forEach((x,P)=>{x.match(KH)?b(x):Sl(x)?m(x):(y(x),tG(c,r)?C():nG(a,c,r,v.length===P+1))}),lG(i,s),{allBars:i,originalKey:n};function b(x){if(c===0&&d&&Js(e,d.timeSignature)){const P=oe(d);P.isRepeated=!0;for(let S=0;S4)throw new Us({chordLine:t,symbol:x,position:0})}function C(){l.timeSignature=e,l.lineHadTimeSignatureChange=h,l.hasUnevenChordsDurations=sG(l);const x=oe(l);l.isRepeated=Js(l,d),i.push(oe(l)),d=x,l=oe(o),c=0}}function YH(t,e){if(JH(e))throw new Us({chordLine:t,symbol:e,position:0})}function JH(t){return t.indexOf(fe.chordBeatCount)>-1}function QH(t){return t===fe.noChord}function XH(t,e,n){return n?0:(t.match(GH)||[]).length||e}function ZH(t,e){if(t.allChords.length>0){const n=t.allChords[t.allChords.length-1];if(Js(n.model,e.model)&&!eG(n,e))throw new WH({string:e.string})}}function eG(t,e){return e.string.startsWith(fe.subBeatOpener)||t.string.endsWith(fe.subBeatCloser)&&!e.model.isInSubBeatGroup}function tG(t,e){return t===e}function nG(t,e,n,r){if(rG(e,n,r))throw new VH({string:t.string,duration:t.duration,currentBeatCount:e,beatCount:n})}function rG(t,e,n){return iG(t,e)||oG(t,e,n)}function iG(t,e){return t>e}function oG(t,e,n){return n&&tn.duration!==e)}function lG(t,e){let n=-1,r=0,i="";t.forEach((o,s)=>{o.allChords.forEach(l=>{if(l.isInSubBeatGroup){const a=s+l.beat;a!==i&&(n++,r=0);const u=(1/e[n]).toPrecision(2);l.duration=Number.parseFloat(u),l.isFirstOfSubBeat=r===0,l.isLastOfSubBeat=r===e[n]-1,i=a,r++}})})}function aG(t){const e={};let n=!1,r;const i=new RegExp(Rr(fe.subBeatOpener)+"|"+Rr(fe.subBeatCloser),"g");for(;r=i.exec(t);){const o=r[0];if(e.chordLine=t,e.symbol=o,e.position=i.lastIndex-1,r[0]===fe.subBeatOpener){if(n)throw new Us(e);n=!0}else{if(!n)throw new Us(e);n=!1}}if(n)throw new Us(e)}const fr="A,A#,B,C,C#,D,D#,E,F,F#,G,G#".split(","),uG="Ab,Bb,Db,Eb,Gb".split(","),a1=[...fr,...uG],cG=[...a1,...a1.map(t=>t+"m")],Du={Ab:"G#",Bb:"A#",Db:"C#",Eb:"D#",Gb:"F#"},fG=GC(Du);function dG(t){return cG.includes(t)}function og(t){return["G","Em","D","Bm","A","F#m","E","C#m","B","G#m","F#","D#m","C#","A#m","G#","D#","A#"].includes(t)?"sharp":"flat"}function u1(t,e,n){const r={"G#":"Ab","D#":"Eb","A#":"Bb",Dbm:"C#m",Gbm:"F#m"};let i;if(e===0&&n==="auto")i=t.string;else{const s=n==="auto"?e<0?"flat":"sharp":n;i=pG(t.string,e,s)}const o=n==="auto"&&r[i]?r[i]:i;return{string:o,accidental:og(o)}}function pG(t,e,n){const r=t.endsWith("m"),i=t.replace("m",""),o=Du[i]||i;let l=fr.indexOf(o)+e;l<0?l+=fr.length:l>=fr.length&&(l-=fr.length);const a=fr[l],u=n==="flat"&&fG[a]||a;return r?u+"m":u}function hG(t){const e=mG(t);return e?{string:e,accidental:og(e)}:void 0}function mG(t){const e=gG(t);if(e.length===0)return;if(e.length===1)return e[0].keyString;const n=e.find(i=>i.isLast===!0);if(n)return n.keyString;const r=e.find(i=>i.isFirst===!0);return r?r.keyString:e[0].keyString}function gG(t){let e=0,n=[];const r=[];return oe(t).map(i=>(i.keyString=yG(i),i)).forEach(i=>{const o=ix(r,s=>s.keyString===i.keyString);o===-1?r.push(i):(r[o].duration+=i.duration,i.isLast&&(r[o].isLast=!0))}),r.map(i=>(i.isLast&&(i.duration*=1.25),i.isFirst&&(i.duration*=1.25),i)).forEach(i=>{i.duration>e?(n=[i],e=i.duration):i.duration===e&&n.push(i)}),n}function yG(t){const e=oe(t.model),n=["major","major6","major7","dominant7","augmented","power","bass"];let r=e.formatted.rootNote;return n.includes(e.normalized.quality)||(r+="m"),r}function vG(t,e){return!t||!e?0:SG(t.replace("m",""),e.replace("m",""))}function SG(t,e){const n=Du[t]||t,r=Du[e]||e,i=fr.indexOf(n),o=fr.indexOf(r);if(i===-1||o===-1)return 0;const s=o-i;return s<0?s+12:s}const Nx=new RegExp("^"+Rr(fe.keyDeclarationPrefix)+"([ABCDEFG].*)$");function qp(t){const e=er(t).match(Nx);return e===null?!1:dG(e[1])}function bG(t){if(!qp(t))throw new TypeError("Expected key declaration, received: "+t);const n=er(t).match(Nx)[1];return{string:n,accidental:og(n)}}function wG(t){const e=t.startsWith(fe.lyricLine)?t.substring(1):t,n=new RegExp(fe.chordPositionMarker,"g"),r=e.replace(n,""),i=[];let o=e,s;for(;(s=o.indexOf(fe.chordPositionMarker))!==-1;)i.includes(s)||i.push(s),o=o.replace(fe.chordPositionMarker,"");return{lyrics:r,chordPositions:i}}function EG(t){if(!Iu(t))throw new TypeError("Expected section identifier string, received: "+t);const e=er(t).match(Px);return{string:t,label:e[1],copyIndex:e[2]?Number.parseInt(e[2]):1,multiplyTimes:e[3]?Number.parseInt(e[3].replace(" x","")):0}}function CG(t,e){const n=oe(t);return n.forEach(r=>{r.type===K.CHORD&&r.model.allBars.forEach(i=>{i.allChords.forEach(o=>{e(o)})})}),n}function c1(t,e){const n=oe(t);return n.allBars.forEach((r,i)=>{r.allChords.forEach((o,s)=>{e(o,s,i)})}),n}function od(t,e,n){const r=[],i={};let o=!1,s="";for(t.forEach(l=>{l.type===K.SECTION_LABEL?(s=l.model.label,i[s]?i[s]++:i[s]=1,o=l.id===e+n):o&&r.push(l)});yo(r)&&(yo(r).type===K.KEY_DECLARATION||yo(r).type===K.TIME_SIGNATURE);)r.pop();return r}const xG="4/4";function TG(){const t=[],e={};let n=_u(xG),r,i,o={};const s=2;let l=[],a,u=[],c=0,d=!1,f=!1;function p($){return n=_u($),{string:$,type:K.TIME_SIGNATURE,model:n}}function h($){return o=bG($),{string:$,type:K.KEY_DECLARATION,model:oe(o)}}function v($,T,k){r=EG($),C(r.label),i=x(r.label);const U={string:$,type:K.SECTION_LABEL,model:r,index:i.count,indexWithoutMultiply:i.withoutMultiply,id:r.label+i.count};return f=I(T,k)&&i.count>1,f&&(U.isFromSectionCopy=!0),d=r.multiplyTimes>0,a=oe(U),u=i.count>1?od(t,r.label,1):[],c=0,U}function b($){return{string:$,type:K.EMPTY_LINE}}function m($){let T;try{const k=qH($,{timeSignature:n,originalKey:o});T={string:$,type:K.CHORD,model:k},y(T)}catch{T=w($)}return T}function y($){l.length>=s&&l.shift(),l.push($)}function g($){const T=er($),k=-T.length,U=k<-1?k+1:void 0;return l.length>=T.length?{...oe(...l.slice(k,U)),isFromChordLineRepeater:!0}:w($)}function w($){return{string:$,type:K.LYRIC,model:wG($)}}function C($,T=!1){e[$]?(e[$].count++,T||e[$].withoutMultiply++):e[$]={count:1,withoutMultiply:1}}function x($){return e[$]}function P($){if(u.length&&$.type!==K.SECTION_LABEL){let T=u[c],k;for(;S(T,$);)T.type===K.CHORD&&y(oe(T)),k={...oe(T),isFromAutoRepeatChords:!0},t.push(k),c++,T=u[c];c++}}function S($,T){const k=[K.LYRIC,K.EMPTY_LINE];return $&&!k.includes($.type)&&$.type!==T.type&&T.type!==K.EMPTY_LINE}function A(){if(f){const $=od(t,r.label,r.copyIndex).map(T=>({...oe(T),isFromSectionCopy:!0}));if(!$.length)return;kG($)&&$.pop(),t.push(...oe($)),f=!1}}function I($,T){const k=T.slice($+1);let U=k.findIndex(De=>Iu(De));return U===0?!0:k.slice(0,U!==-1?U:void 0).filter(De=>!(Sl(De)||qp(De)||l1(De))).length===0}function M($,T){if(d&&OG($,T)){const k=od(t,r.label,i.count).map(ie=>({...oe(ie),isFromSectionMultiply:!0}));let U;for(let ie=1;ie{$=t[U+1],$G(k,$)?(T=0,k.model.hasPositionedChords=!0,k.model=c1(k.model,ie=>{ie.isPositioned=T<$.model.chordPositions.length,T++})):k.type===K.CHORD&&(k.model.hasPositionedChords=!1,k.model=c1(k.model,ie=>{ie.isPositioned=!1}))})}}}function OG(t,e){const n=e[t+1];return typeof n>"u"||Iu(n)}function $G(t,e){return t.type===K.CHORD&&e&&e.type===K.LYRIC&&e.model.chordPositions.length>0}function kG(t){return t[t.length-1].type===K.EMPTY_LINE}function AG(t){const e=[];let n;return CG(t,r=>{r.model!==fe.noChord&&(n=ix(e,i=>Js(Up(i.model,["numeral"]),Up(r.model,["numeral"]))),n===-1?(e.push({model:oe(r.model),occurrences:1,duration:r.duration}),n=e.length-1):(e[n].occurrences++,e[n].duration+=r.duration))}),e.length&&(e[0].isFirst=!0,e[n].isLast=!0),e}function PG(t,e){const n={auto:void 0,explicit:[]};if(t.forEach(r=>{r.type===K.KEY_DECLARATION&&n.explicit.push(oe(r.model))}),n.explicit.length===0){const r=hG(e);r&&(n.auto=r)}return n}function HQ(t){const e=vh(t)?t:t.split(`
+`),n=TG();e.map(TH).map(Tx).forEach(n.addLine),n.flagPositionedChords();const r=n.asArray(),i=AG(r),o=PG(r,i);return{allLines:r,allChords:i,allKeys:o}}const re={barRepeat:"%",barSeparator:"|",chordBeat:".",chordLineOffsetSpacer:" ",emptyBeatSpaces:1,keyDeclarationPrefix:"key: ",lyricsSpacer:" ",noChordSymbol:"NC",spacesAfterDefault:2,spacesAfterSubBeatDefault:1,spacesAfterTimeSignature:1,subBeatGroupOpener:"[",subBeatGroupCloser:"]"};function Mx(t,e,{shouldPrintSubBeatDelimiters:n=!0,symbolType:r="chord"}={}){const i=t.allChords.filter(o=>o.beat===e);switch(i.length){case 0:return"";case 1:return Yp(t,i[0],{shouldPrintSubBeatDelimiters:n,symbolType:r});default:return i.reduce((o,s,l)=>{const a=l>0?" ".repeat(re.spacesAfterSubBeatDefault):"";return o+a+Yp(t,s,{shouldPrintSubBeatDelimiters:n,symbolType:r})},"")}}function Yp(t,e,{shouldPrintSubBeatDelimiters:n,symbolType:r="chord"}){const o=r==="chord"||e.model===re.barRepeat||e.model===re.noChordSymbol?e.symbol:e.model.numeral.symbol;if(e.isInSubBeatGroup)return n&&e.isFirstOfSubBeat?re.subBeatGroupOpener+o:n&&e.isLastOfSubBeat?o+re.subBeatGroupCloser:o;{const s=t.shouldPrintChordsDuration?re.chordBeat.repeat(e.duration):"";return o+s}}function NG(t,{shouldAlignChordsWithLyrics:e,shouldPrintSubBeatDelimiters:n=!0,symbolType:r="chord"}){const i=[];return t.filter(o=>o.type===K.CHORD).filter(o=>!e(o)).forEach(o=>{o.model.allBars.filter(s=>!s.lineHadTimeSignatureChange).forEach((s,l)=>{if(!i[l]){i[l]={};for(let a=1;a<=s.timeSignature.beatCount;a++)i[l][a]=0}s.allChords.filter(a=>!a.isInSubBeatGroup||a.isLastOfSubBeat).forEach(a=>{const u=Mx(s,a.beat,{shouldPrintSubBeatDelimiters:n,symbolType:r});i[l][a.beat]=Math.max(i[l][a.beat],u.length)})})}),i}function MG(t){const e=oe(t);return e.allBars.forEach(n=>{_x(n)}),e}function _x(t){t.allChords.forEach(e=>{e.spacesAfter=e.isInSubBeatGroup&&!e.isLastOfSubBeat?re.spacesAfterSubBeatDefault:re.spacesAfterDefault,e.spacesWithin=0})}function _G(t,e,{shouldPrintBarSeparators:n=!0,shouldPrintSubBeatDelimiters:r=!0,symbolType:i="chord"}){const o=oe(t);return o.allBars.forEach((s,l)=>{s.lineHadTimeSignatureChange?_x(s):s.allChords.forEach(a=>{const u=Mx(s,a.beat,{shouldPrintSubBeatDelimiters:r,symbolType:i});a.isInSubBeatGroup&&!a.isLastOfSubBeat?(a.spacesWithin=0,a.spacesAfter=re.spacesAfterSubBeatDefault):(a.spacesWithin=e[l][a.beat]-u.length,a.spacesAfter=0),IG(s,a)&&(a.spacesAfter=re.spacesAfterDefault+DG(s,a,e[l])),RG(s,a,n)&&(a.spacesAfter=re.spacesAfterDefault)})}),o}const IG=(t,e)=>(!e.isInSubBeatGroup||e.isLastOfSubBeat)&&!Ix(t,e),DG=(t,e,n)=>{let r=0;for(let i=e.beat+1;ie.beat===t.timeSignature.beatCount,RG=(t,e,n)=>!n&&Ix(t,e)&&(!e.isInSubBeatGroup||e.isLastOfSubBeat),sd=1;function LG(t,e,{shouldPrintBarSeparators:n=!0,shouldPrintSubBeatDelimiters:r=!0,shouldPrintInlineTimeSignatures:i=!0,symbolType:o="chord"}={}){if(FG(e))return{chordLine:t,lyricsLine:e};const s=oe(t),l=oe(e),a=l.chordPositions.map((m,y,g)=>l.lyrics.substring(m,g[y+1]));let u="",c="",d,f;if(s.allBars.forEach((m,y)=>{m.allChords.forEach((g,w,C)=>{if(f=a.shift(),f){u=w===0&&i&&m.shouldPrintBarTimeSignature?m.timeSignature.string+re.spacesAfterTimeSignature:"";const x=y===0&&w===0&&l.chordPositions[0]===0;d=p(m,g,x),f=h(x,g.isFirstOfSubBeat);const P=w===C.length-1,S=C[w+1]&&C[w+1].isFirstOfSubBeat;if(f.length-d.length>0){const A=a.length===0;g.spacesAfter=v(P,A,S)}else g.spacesAfter=sd,f+=re.lyricsSpacer.repeat(b(P,S));c+=f}else g.spacesAfter=sd;g.spacesWithin=0})}),BG(l)){const m=l.chordPositions[0];s.offset=m,n&&s.offset--,c=l.lyrics.substring(0,m)+c}return a.length&&(c+=a.join("")),l.lyrics=zG(c),{chordLine:s,lyricsLine:l};function p(m,y,g){let w=u+Yp(m,y,{shouldPrintSubBeatDelimiters:y.isLastOfSubBeat&&r,symbolType:o});return g&&(r&&y.isFirstOfSubBeat&&(w=re.subBeatGroupOpener+w),n&&(w=re.barSeparator+w)),w}function h(m,y){let g=f;if(jG(g))g=re.lyricsSpacer.repeat(d.length-1)+g;else{if(m){let w=0;n&&w++,r&&y&&w++,g=re.lyricsSpacer.repeat(w)+g}u.length&&(g=" ".repeat(u.length)+g)}return g}function v(m,y,g){let w=f.length-d.length;return(m&&n&&!y||!m&&r&&g)&&(w>1?w-=1:f+=re.lyricsSpacer),w}function b(m,y){let g=d.length-f.length+sd;return(m&&n||y)&&g++,g}}const FG=t=>t.chordPositions.length===0,BG=t=>t.chordPositions[0]>0,zG=t=>{const e=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;return t.replace(e,"")},jG=t=>t.indexOf(" ")===0,UG=({chordLineOffset:t,chordLine:e,symbolType:n})=>{const r=["cmChordLine"];return n==="roman"&&r.push("cmChordLine-romanNumeral"),`${t?`${t}`:""}${e}`},VG=({chordSymbol:t,chordDuration:e,subBeatGroupOpener:n,subBeatGroupCloser:r,numeralType:i})=>{const o=n?`${n}`:"",s=r?`${r}`:"",l=["cmChordSymbol"];return i&&l.push("cmRomanNumeral",`cmRomanNumeral-${i}`),`${o}${t}${e?`${e}`:""}${s}`};function WG(t,{shouldPrintChordsDuration:e=!1,shouldPrintSubBeatOpener:n=!1,shouldPrintSubBeatCloser:r=!1,symbolType:i="chord"}){const o=i==="chord"||t.model===re.barRepeat||t.model===re.noChordSymbol,s=o?t.symbol:t.model.numeral.symbol;return VG({chordSymbol:s,chordDuration:e?re.chordBeat.repeat(t.duration):!1,subBeatGroupOpener:n?re.subBeatGroupOpener:"",subBeatGroupCloser:r?re.subBeatGroupCloser:"",numeralType:o?"":t.model.numeral.type})}const HG=({timeSignature:t})=>`${t}`;function Dx(t){return HG({timeSignature:t.string})}const GG=({barContent:t})=>`${t}`,f1=" ",KG=0,qG=2;function YG(t,e=!1,{shouldPrintBarSeparators:n=!0,shouldPrintSubBeatDelimiters:r=!0,shouldPrintTimeSignature:i=!1,symbolType:o="chord"}={}){let s=0,l=0,a="";return i&&(a+=Dx(t.timeSignature)+" ".repeat(re.spacesAfterTimeSignature)),a+=t.allChords.reduce((u,c,d)=>{s=vo(c.spacesWithin)?c.spacesWithin:KG,l=vo(c.spacesAfter)?c.spacesAfter:qG,u+=WG(c,{shouldPrintChordsDuration:c.isInSubBeatGroup?!1:t.shouldPrintChordsDuration,shouldPrintSubBeatOpener:r&&c.isFirstOfSubBeat,shouldPrintSubBeatCloser:r&&c.isLastOfSubBeat,symbolType:o}),f()&&(u+=f1.repeat(s)+f1.repeat(l));function f(){const p=JG(t,d)&&e;return!p||p&&n}return u},""),GG({barContent:a})}function JG(t,e){return!t.allChords[e+1]}const QG=({barSeparator:t})=>`${t}`;function XG(t,{shouldPrintBarSeparators:e=!0,shouldPrintSubBeatDelimiters:n=!0,shouldPrintInlineTimeSignatures:r=!0,symbolType:i="chord"}={}){const o=t.allBars.map((u,c)=>{const d=!t.allBars[c+1],f=r&&u.shouldPrintBarTimeSignature;return YG(u,d,{shouldPrintBarSeparators:e,shouldPrintSubBeatDelimiters:n,shouldPrintTimeSignature:f,symbolType:i})}),s=e?QG({barSeparator:re.barSeparator}):"",l=s+o.join(s)+s,a=re.chordLineOffsetSpacer.repeat(t.offset||0);return UG({chordLineOffset:a,chordLine:l,symbolType:i})}const ZG=({chordLyricsPairs:t})=>{let e='';return t.forEach(n=>{e+=`${n.chords||" "}${n.lyrics}`}),e+="",e};var eK=rc,tK=tg,nK=ng,rK=$i,iK=Ho,d1=ic,oK=Math.min;function sK(t,e,n){for(var r=n?nK:tK,i=t[0].length,o=t.length,s=o,l=Array(o),a=1/0,u=[];s--;){var c=t[s];s&&e&&(c=rK(c,iK(e))),a=oK(c.length,a),l[s]=!n&&(e||i>=120&&c.length>=120)?new eK(s&&c):void 0}c=t[0];var d=-1,f=l[0];e:for(;++d{if(r.nodeType===Node.TEXT_NODE){const i=r.textContent;for(const o of i)e.push(Vs(o,n.i)),n.i++}else SK.includes(r.classList.value)?(e.push(Vs(r.textContent,n.i,r.outerHTML)),n.i+=r.textContent.length):Rx(r,e,n)})}function Vs(t,e,n){return{text:t,textIndex:e,html:n}}function EK(t){const e=[],n=Tx(t);let r="";return Array.from(n).forEach((i,o)=>{i===" "?(r&&(e.push(Vs(r,o-r.length)),r=""),e.push(Vs(" ",o))):r+=i}),e.push(Vs(r,n.length-r.length)),e}function CK(t,e){const n=p1(t),r=p1(e),i=yK(n,r);let o,s;yo(n)>yo(r)?(s=n,o=r):(s=r,o=n);const l=s.filter(a=>a>yo(o));return l.length&&i.push(...l),i.shift(),i}function p1(t){const e=t.map(r=>r.textIndex),n=t.reduce((r,i)=>r+i.text,"").length;return e.push(n),e}function xK(t,e,n){const r=[];return t.forEach(i=>{let o="",s="";for(;e.length&&e[0].textIndex' ';function OK(){return TK()}const $K=({keyDeclarationPrefix:t,key:e})=>`${t}${e}`;function kK(t){return $K({keyDeclarationPrefix:re.keyDeclarationPrefix,key:t.symbol})}const AK=({line:t,lineClasses:e,shouldOpenSection:n,sectionWrapperClasses:r,shouldClosePriorSection:i,shouldCloseFinalSection:o})=>{let s="";return i&&(s+=""),n&&(s+=`"),s};function PK(t,{isFromAutoRepeatChords:e=!1,isFromChordLineRepeater:n=!1,isFromSectionCopy:r=!1,isFromSectionMultiply:i=!1,shouldOpenSection:o=!1,shouldClosePriorSection:s=!1,shouldCloseFinalSection:l=!1,sectionWrapperClasses:a=[]}={}){const u=["cmLine"];return e&&u.push("cmLine--isFromAutoRepeatChords"),n&&u.push("cmLine--isFromChordLineRepeater"),r&&u.push("cmLine--isFromSectionCopy"),i&&u.push("cmLine--isFromSectionMultiply"),AK({line:t,lineClasses:u.join(" "),shouldOpenSection:o,sectionWrapperClasses:a.join(" "),shouldClosePriorSection:s,shouldCloseFinalSection:l})}const NK=({lyricLine:t})=>`${t}`;function MK(t,{alignChordsWithLyrics:e=!1,chartType:n="all"}={}){const r=_K(e,n)?t.model.lyrics.trim():t.model.lyrics;return NK({lyricLine:r})}const _K=(t,e)=>!t||e==="lyrics",IK=({label:t,multiplier:e})=>`${t}${e?` ${e}`:""}`;function DK(t){return IK(t.model.rendered)}const RK=({song:t})=>`${t}
`,h1={a:"adlib",b:"bridge",c:"chorus",i:"intro",o:"outro",p:"pre-chorus",s:"solo",u:"interlude",v:"verse"};function LK(t,{expandSectionMultiply:e}){const n=FK(t);return t.forEach(r=>{if(r.type===K.SECTION_LABEL){const{model:i,index:o,indexWithoutMultiply:s}=r,l=h1[i.label]?h1[i.label]:i.label;let a=l[0].toUpperCase()+l.substring(1),u;n[i.label]>1&&(a+=" ",a+=e?o:s),!e&&i.multiplyTimes&&(u="x"+i.multiplyTimes),r.model.rendered={label:a,multiplier:u}}}),t}function FK(t){const e={};return t.filter(n=>n.type===K.SECTION_LABEL).forEach(n=>{e[n.model.label]?e[n.model.label]++:e[n.model.label]=1}),e}const BK=mx();function zK(t,e=BK){switch(t){case fe.noChord:return re.noChordSymbol;case re.barRepeat:return re.barRepeat;default:return e(t)}}function jK(t,e,{transposeValue:n,accidentalsType:r,chordSymbolRenderer:i,simplifyChords:o,useShortNamings:s}){let l,a;e&&(l=u1(e,n,r));let u=f();function c(p){if(p.type===K.KEY_DECLARATION)l=u1(p.model,n,r),p.symbol=l.string,a||(a=l);else if(p.type===K.CHORD){let h=0;d(p)&&(h=vG(a&&a.string,l&&l.string)),u=f(h),p.model.allBars.forEach(v=>{v.allChords.forEach(b=>{b.symbol=zK(b.model,u)})})}return p}function d(p){const h=l&&p.model.originalKey&&p.model.originalKey.string===l.string;return(p.isFromAutoRepeatChords||p.isFromSectionCopy||p.isFromChordLineRepeater)&&!h}function f(p){if(typeof i=="function")return i;const h=r==="auto"?l?l.accidental:"sharp":r;return mx({simplify:o,useShortNamings:s,transposeValue:n+p,accidental:h})}return t.map(c)}const UK=(t,{alignChordsWithLyrics:e})=>(t.type===K.CHORD&&t.model.allBars.forEach(n=>{VK(t,n,e)&&(n.allChords=[{string:re.barRepeat,model:re.barRepeat,symbol:re.barRepeat,duration:n.timeSignature.beatCount,beat:1}],n.shouldPrintChordsDuration=!1)}),t),VK=(t,e,n)=>e.isRepeated&&!WK(t,e,n),WK=(t,e,n)=>n&&t.model.hasPositionedChords&&e.allChords.length>1&&e.allChords.some(r=>r.isPositioned);function GQ(t,{accidentalsType:e="auto",alignBars:n=!0,alignChordsWithLyrics:r=!0,autoRepeatChords:i=!0,chartType:o="all",chordSymbolRenderer:s=!1,customRenderer:l=!1,expandSectionCopy:a=!0,expandSectionMultiply:u=!1,printChordsDuration:c="uneven",printBarSeparators:d="always",printSubBeatDelimiters:f=!0,printInlineTimeSignatures:p=!0,simplifyChords:h="none",symbolType:v="chord",transposeValue:b=0,useShortNamings:m=!0,wrapChordLyricLines:y=!1}={}){let{allLines:g,allKeys:w}=t,C=!1,x=$x.string,P;g=jK(g,w.auto,{transposeValue:b,accidentalsType:e,chordSymbolRenderer:s,simplifyChords:h,useShortNamings:m}).map(M).map($).filter(k).map(L=>UK(L,{alignChordsWithLyrics:r}));const S=NG(g,{shouldAlignChordsWithLyrics:q,shouldPrintSubBeatDelimiters:f,symbolType:v});g=LK(g,{expandSectionMultiply:u}),g.forEach(B);const A=V();if(l)return l(g,A,{alignChordsWithLyrics:r,alignBars:n});return RK({song:A.join("")});function I(L){return["cmSection","cmSection-"+L.model.rendered.label.replace(/[\d\s]/gi,"")]}function M(L){return L.type===K.CHORD&&L.model.allBars.forEach(Q=>{Q.shouldPrintChordsDuration=T(Q)}),L}function $(L){return L.type===K.TIME_SIGNATURE?x=L.string:L.type===K.CHORD&&L.model.allBars.forEach((Q,X)=>{Q.shouldPrintBarTimeSignature=X===0&&Q.timeSignature.string!==x||X>0&&Q.timeSignature.string!==P,P=Q.timeSignature.string}),L}function T(L){return L.allChords.length>1&&(c==="uneven"&&L.hasUnevenChordsDurations||c==="always")}function k(L){return U(L)&&!De(L)}function U(L){const Q=!i&&(L.isFromAutoRepeatChords||L.type===K.CHORD&&L.isFromSectionCopy),X=L.isFromSectionMultiply&&!u,Ae=L.type!==K.SECTION_LABEL&&L.isFromSectionCopy&&!a;return!X&&!Q&&!Ae}function ie(L){return g.length-1===L}function De(L){if(o==="chordsFirstLyricLine"){if(L.type===K.SECTION_LABEL)return C=!0,!1;if(C&&L.type===K.LYRIC)return C=!1,!1}return["chords","chordsFirstLyricLine"].includes(o)&&L.type===K.LYRIC||o==="lyrics"&&L.type===K.CHORD}function B(L,Q){if(L.type===K.CHORD){let X=n&&!q(L)?_G(L.model,S,{shouldPrintBarSeparators:ce(L.model),shouldPrintSubBeatDelimiters:f,symbolType:v}):MG(L.model);const Ae=g[Q+1];if(q(L)){const{chordLine:ge,lyricsLine:Mn}=LG(X,Ae.model,{shouldPrintBarSeparators:ce(L.model),shouldPrintSubBeatDelimiters:f,shouldPrintInlineTimeSignatures:p,symbolType:v});g[Q+1].model=Mn,X=ge}g[Q].model=X}}function V(){let L=!1,Q;return g.map((X,Ae)=>{let ge,Mn=!1,gn=[],Pt;return X.type===K.CHORD?(ge=XG(X.model,{symbolType:v,shouldPrintBarSeparators:ce(X.model),shouldPrintSubBeatDelimiters:f,shouldPrintInlineTimeSignatures:p}),Y(X,g[Ae+1])&&(Q=ge,ge=!1)):X.type===K.EMPTY_LINE?ge=OK():X.type===K.SECTION_LABEL?(Mn=!0,Pt=L,L=!0,gn=I(X),ge=DK(X)):X.type===K.TIME_SIGNATURE?ge=Dx(X):X.type===K.KEY_DECLARATION?ge=kK(X):(ge=MK(X,{alignChordsWithLyrics:r,chartType:o}),Q&&(ge=bK(Q,ge),Q="")),ge&&PK(ge,{isFromSectionMultiply:X.isFromSectionMultiply,isFromAutoRepeatChords:X.isFromAutoRepeatChords,isFromChordLineRepeater:X.isFromChordLineRepeater,isFromSectionCopy:X.isFromSectionCopy,shouldOpenSection:Mn,shouldClosePriorSection:Pt,shouldCloseFinalSection:ie(Ae)&&L,sectionWrapperClasses:gn})}).filter(Boolean)}function q(L){return o==="all"&&r&&L.model.hasPositionedChords}function Y(L,Q){return Q&&Q.type===K.LYRIC&&y&&q(L)}function ce(L){return d==="always"||d==="grids"&&!L.hasPositionedChords}}const KQ=(t={})=>HK.bind(null,t),HK=({showBarSeparators:t=!0},e,n,{alignBars:r,alignChordsWithLyrics:i})=>{const o=[];let s;return GK(e).forEach((l,a)=>{l.sectionLine&&(l.allLines.length>0?(a>0&&o.push(""),o.push(KK(l.sectionLine))):o.push(Bx(Fx(l.sectionLine.model.rendered)))),l.allLines.forEach((u,c,d)=>{switch(u.type){case K.CHORD:YK(d,c)?s=u:o.push(JK(u));break;case K.LYRIC:o.push(QK(u,s,{showBarSeparators:t,alignChordsWithLyrics:i,alignBars:r})),s=void 0;break;case K.EMPTY_LINE:o.push(""),s=void 0;break}}),l.sectionLine&&l.allLines.length>0&&o.push(qK(l.sectionLine))}),o.join(`
+`)},GK=t=>{const e=[];let n;const r=()=>{n&&(e.push(n),n=void 0)},i=o=>{n={sectionLine:o,allLines:[]}};return t.forEach(o=>{o.type===K.SECTION_LABEL?(r(),i(o)):(n||i(),n.allLines.push(o))}),r(),e.map(o=>(o.allLines=bx(o.allLines,s=>s.type===K.EMPTY_LINE),o))};function KK(t){return`{start_of_${Lx(t.model.label)}: ${Fx(t.model.rendered)}}`}function qK(t){return`{end_of_${Lx(t.model.label)}}`}function Lx(t){switch(t){case"b":case"bridge":return"bridge";case"c":case"chorus":return"chorus";default:case"v":case"verse":return"verse"}}function Fx({label:t,multiplier:e}){return e?`${t} ${e}`:t}function Bx(t){return`{c:${t}}`}function YK(t,e){const n=t[e+1];return n&&n.type===K.LYRIC}function JK(t){let e="";return t.model.allBars.map(n=>{e+="|",n.allChords.map(r=>{e+=r.symbol+" ".repeat(r.spacesWithin+r.spacesAfter)})}),e+="|",Bx(e.trim())}function QK(t,e,{alignChordsWithLyrics:n,alignBars:r,showBarSeparators:i}){let o=t.string.trim();return e&&e.type===K.CHORD&&(e.model.hasPositionedChords&&n?o=XK(o,e,{showBarSeparators:i}):o=ZK(o,e,{showBarSeparators:i,alignBars:r})),o}const XK=(t,e,{showBarSeparators:n})=>{let r=t;return e.model.allBars.map(i=>{i.allChords.map((o,s)=>{let[l]=zx(i,o);if(s===0&&n){const a=r.indexOf("_");a>-1?r=ui(r,"[|] ",a):r=ui(r,"[|]",r.length+1)}r.indexOf("_")>-1?r=r.replace("_",l):r=ui(r,l,r.length+1)})}),r=r.replace(/_/g,"").trim(),n&&(r+=" [|]"),r},ZK=(t,e,{showBarSeparators:n,alignBars:r})=>{let i=t.replace(/_/g,""),o=0;return e.model.allBars.map(s=>{s.allChords.map((l,a)=>{let[u,c]=zx(s,l);a===0&&n&&(i=ui(i,"[|]",o),o+=5),i=ui(i,u,o);const d=r&&!s.allChords[a+1]?1:0;o+=u.length+c.length+l.spacesAfter+l.spacesWithin+d})}),n&&(i=ui(i,"[|]",o)),i},zx=(t,e)=>{const n=t.shouldPrintChordsDuration?e.symbol+".".repeat(e.duration):e.symbol;return[`[${n}]`,n]},qQ=()=>eq.bind(null),eq=(t,e)=>e.map((n,r)=>{const i=t[r],o=WC(n);return i.type===K.SECTION_LABEL?`[${o}]`:i.type===K.CHORD?tq(i,o):o.replace(" ","")}).join(`
+`),tq=(t,e)=>{const n=/([^\s.|]+)/g;return e.replace(n,"[ch]$1[/ch]")};/**
+ * filesize
+ *
+ * @copyright 2023 Jason Mulligan
+ * @license BSD-3-Clause
+ * @version 10.1.0
+ */const nq="array",rq="bit",m1="bits",iq="byte",g1="bytes",zi="",oq="exponent",sq="function",y1="iec",lq="Invalid number",aq="Invalid rounding method",ld="jedec",uq="object",v1=".",cq="round",fq="s",dq="si",pq="kbit",hq="kB",mq=" ",gq="string",yq="0",ad={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function YQ(t,{bits:e=!1,pad:n=!1,base:r=-1,round:i=2,locale:o=zi,localeOptions:s={},separator:l=zi,spacer:a=mq,symbols:u={},standard:c=zi,output:d=gq,fullform:f=!1,fullforms:p=[],exponent:h=-1,roundingMethod:v=cq,precision:b=0}={}){let m=h,y=Number(t),g=[],w=0,C=zi;c===dq?(r=10,c=ld):c===y1||c===ld?r=2:r===2?c=y1:(r=10,c=ld);const x=r===10?1e3:1024,P=f===!0,S=y<0,A=Math[v];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(lq);if(typeof A!==sq)throw new TypeError(aq);if(S&&(y=-y),(m===-1||isNaN(m))&&(m=Math.floor(Math.log(y)/Math.log(x)),m<0&&(m=0)),m>8&&(b>0&&(b+=8-m),m=8),d===oq)return m;if(y===0)g[0]=0,C=g[1]=ad.symbol[c][e?m1:g1][m];else{w=y/(r===2?Math.pow(2,m*10):Math.pow(1e3,m)),e&&(w=w*8,w>=x&&m<8&&(w=w/x,m++));const I=Math.pow(10,m>0?i:0);g[0]=A(w*I)/I,g[0]===x&&m<8&&h===-1&&(g[0]=1,m++),C=g[1]=r===10&&m===1?e?pq:hq:ad.symbol[c][e?m1:g1][m]}if(S&&(g[0]=-g[0]),b>0&&(g[0]=g[0].toPrecision(b)),g[1]=u[g[1]]||g[1],o===!0?g[0]=g[0].toLocaleString():o.length>0?g[0]=g[0].toLocaleString(o,s):l.length>0&&(g[0]=g[0].toString().replace(v1,l)),n&&Number.isInteger(g[0])===!1&&i>0){const I=l||v1,M=g[0].toString().split(I),$=M[1]||zi,T=$.length,k=i-T;g[0]=`${M[0]}${I}${$.padEnd(T+k,yq)}`}return P&&(g[1]=p[m]?p[m]:ad.fullform[c][m]+(e?rq:iq)+(g[0]===1?zi:fq)),d===nq?g:d===uq?{value:g[0],symbol:g[1],exponent:m,unit:C}:g.join(a)}var jx={exports:{}};(function(t,e){(function(n,r){r()})(En,function(){function n(u,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(u.type)?new Blob(["\uFEFF",u],{type:u.type}):u}function r(u,c,d){var f=new XMLHttpRequest;f.open("GET",u),f.responseType="blob",f.onload=function(){a(f.response,c,d)},f.onerror=function(){console.error("could not download file")},f.send()}function i(u){var c=new XMLHttpRequest;c.open("HEAD",u,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function o(u){try{u.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),u.dispatchEvent(c)}}var s=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof En=="object"&&En.global===En?En:void 0,l=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(u,c,d){var f=s.URL||s.webkitURL,p=document.createElement("a");c=c||u.name||"download",p.download=c,p.rel="noopener",typeof u=="string"?(p.href=u,p.origin===location.origin?o(p):i(p.href)?r(u,c,d):o(p,p.target="_blank")):(p.href=f.createObjectURL(u),setTimeout(function(){f.revokeObjectURL(p.href)},4e4),setTimeout(function(){o(p)},0))}:"msSaveOrOpenBlob"in navigator?function(u,c,d){if(c=c||u.name||"download",typeof u!="string")navigator.msSaveOrOpenBlob(n(u,d),c);else if(i(u))r(u,c,d);else{var f=document.createElement("a");f.href=u,f.target="_blank",setTimeout(function(){o(f)})}}:function(u,c,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof u=="string")return r(u,c,d);var p=u.type==="application/octet-stream",h=/constructor/i.test(s.HTMLElement)||s.safari,v=/CriOS\/[\d]+/.test(navigator.userAgent);if((v||p&&h||l)&&typeof FileReader<"u"){var b=new FileReader;b.onloadend=function(){var g=b.result;g=v?g:g.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=g:location=g,f=null},b.readAsDataURL(u)}else{var m=s.URL||s.webkitURL,y=m.createObjectURL(u);f?f.location=y:location.href=y,f=null,setTimeout(function(){m.revokeObjectURL(y)},4e4)}});s.saveAs=a.saveAs=a,t.exports=a})})(jx);var JQ=jx.exports;const QQ=()=>t=>(t.formatted.symbol=t.formatted.symbol.replace(/[() ]/g,"").replace("mM","mMaj").replace("°","dim"),t);/*! *****************************************************************************
+Copyright (c) Microsoft Corporation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */var Jp=function(){return Jp=Object.assign||function(e){for(var n,r=1,i=arguments.length;r0||t.deltaX<0?"X":t.deltaY>0||t.deltaY<0?"Y":(t.deltaY>0||t.deltaY<0)&&(t.deltaX>0||t.deltaX<0)?"XY":null},bq=N.forwardRef(function(t,e){var n=t.children,r=t.group,i=r===void 0?"default":r,o=t.scroll,s=o===void 0?"two-way":o,l=t.selfLockAxis,a=l===void 0?null:l,u=t.onScroll,c=u===void 0?function(){}:u,d=N.useContext(Ux),f=d.registerNode,p=d.unregisterNode,h=d.onScroll,v=n.ref,b=v!=null&&e!=null;b&&console.warn(`scroll-sync-react:
+WARNING: ref used on both ScrollSyncNode and its direct child.
+Using the ref from the ScrollSyncNode component.`);var m=v&&!e?v:N.useRef(null);N.useEffect(function(){typeof e=="function"&&e(m.current)},[]);var y=function(C){var x=Sq(C);(a==="X"&&x==="X"||a==="Y"&&x==="Y"||a==="XY"&&(x==="XY"||x==="X"||x==="Y"))&&C.preventDefault()};N.useEffect(function(){var C,x={node:m.current,scroll:s};return x&&f(x,Hr(i)),(C=m.current)===null||C===void 0||C.addEventListener("wheel",y,{passive:!1}),function(){var P;p(x,Hr(i)),(P=m.current)===null||P===void 0||P.removeEventListener("wheel",y)}},[]),N.useEffect(function(){var C={node:m.current,scroll:s};return p(C,Hr(i)),f(C,Hr(i)),function(){return p(C,Hr(i))}},[s,i]);var g=s==="syncer-only",w=s==="two-way";return Ve.cloneElement(n,{ref:m,onScroll:function(C){typeof n.props.onScroll=="function"&&n.props.onScroll(C),C.persist(),(g||w)&&(h(C,Hr(i)),c(C))},onWheel:function(C){typeof n.props.onWheel=="function"&&n.props.onWheel(C),C.persist(),(g||w)&&(h(C,Hr(i)),c(C))}})});bq.displayName="ScrollSyncNode";function qe(t){this.content=t}qe.prototype={constructor:qe,find:function(t){for(var e=0;e>1}};qe.from=function(t){if(t instanceof qe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new qe(e)};function Vx(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Vx(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Wx(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let u=0,c=Math.min(s.text.length,l.text.length);for(;ue&&r(a,i+l,o||null,s)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,n-c),r,i+c)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);oe)for(let o=0,s=0;se&&((sn)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),i+=l.nodeSize),s=a}return new F(r,i)}cutByIndex(e,n){return e==n?F.empty:e==0&&n==this.content.length?this:new F(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new F(i,o)}addToStart(e){return new F([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new F(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?Ta(r+1,s):Ta(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return F.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new F(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return F.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}}le.none=[];class Lu extends Error{}class W{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Gx(this.content,e+this.openStart,n);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,n){return new W(Hx(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return W.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(F.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new W(e,r,i)}}W.empty=new W(F.empty,0,0);function Hx(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Hx(o.content,e-i-1,n-i-1)))}function Gx(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Gx(s.content,e-o-1,n);return l&&t.replaceChild(i,s.copy(l))}function wq(t,e,n){if(n.openStart>t.depth)throw new Lu("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Lu("Inconsistent open depths");return Kx(t,e,n,0)}function Kx(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ws(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(ci(t.nodeAfter,r),o++));for(let l=o;li&&Qp(t,e,i+1),s=r.depth>i&&Qp(n,r,i+1),l=[];return Ws(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(qx(o,s),ci(fi(o,Yx(t,e,n,r,i+1)),l)):(o&&ci(fi(o,Fu(t,e,i+1)),l),Ws(e,n,i,l),s&&ci(fi(s,Fu(n,r,i+1)),l)),Ws(r,null,i,l),new F(l)}function Fu(t,e,n){let r=[];if(Ws(null,t,n,r),t.depth>n){let i=Qp(t,e,n+1);ci(fi(i,Fu(t,e,n+1)),r)}return Ws(e,null,n,r),new F(r)}function Eq(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(F.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class bl{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new xq(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),u=o-a;if(r.push(s,l,i+a),!u||(s=s.child(l),s.isText))break;o=u-1,i+=a+1}return new bl(n,r,o)}static resolveCached(e,n){for(let i=0;ie&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Jx(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=F.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;an.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=F.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};di.prototype.text=void 0;class Bu extends di{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Jx(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Bu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Bu(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Jx(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class wi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Oq(e,n);if(r.next==null)return wi.empty;let i=Qx(r);r.next&&r.err("Unexpected trailing text");let o=_q(Mq(i));return Iq(o,r),o}matchType(e){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return o}).join(`
+`)}}wi.empty=new wi(!0);class Oq{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Qx(t){let e=[];do e.push($q(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function $q(t){let e=[];do e.push(kq(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function kq(t){let e=Nq(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Aq(t,e);else break;return e}function S1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Aq(t,e){let n=S1(t),r=n;return t.eat(",")&&(t.next!="}"?r=S1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Pq(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.groups.indexOf(e)>-1&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Nq(t){if(t.eat("(")){let e=Qx(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Pq(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Mq(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let u={term:a,to:l};return e[s].push(u),u}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(o(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=o(s.exprs[a],l);if(a==s.exprs.length-1)return u;i(u,l=n())}else if(s.type=="star"){let a=n();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let u=0;u{t[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let c=0;c{u||i.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[r.join(",")]=new wi(r.indexOf(t.length-1)>-1);for(let s=0;s-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[o]=new nT(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Dq{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Kc{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=tT(i.attrs),this.excluded=null;let o=Zx(this.attrs);this.instance=o?new le(this,o):null}create(e=null){return!e&&this.instance?this.instance:new le(this,eT(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Kc(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n-1}}class XQ{constructor(e){this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=qe.from(e.nodes),n.marks=qe.from(e.marks||{}),this.nodes=w1.compile(this.spec.nodes,this),this.marks=Kc.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;o.contentMatch=r[s]||(r[s]=wi.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet=l=="_"?null:l?E1(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:E1(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof w1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Bu(r,r.defaultAttrs,e,le.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return di.fromJSON(this,e)}markFromJSON(e){return le.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function E1(t,e){let n=[];for(let r=0;r-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class wl{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new x1(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new x1(this,n,!0);return r.addAll(e,n.from,n.to),W.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s{r(s=T1(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=T1(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wl(e,wl.schemaRules(e)))}}const rT={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Rq={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},iT={ol:!0,ul:!0},zu=1,ju=2,Hs=4;function C1(t,e,n){return e!=null?(e?zu:0)|(e==="full"?ju:0):t&&t.whitespace=="pre"?zu|ju:n&~Hs}class Oa{constructor(e,n,r,i,o,s,l){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=l,this.content=[],this.activeMarks=le.none,this.stashMarks=[],this.match=s||(l&Hs?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(F.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zu)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=F.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(F.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;nthis.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,o,o.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
+`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=le.none,r=le.none;for(let i=0;i{s.clearMark(l)&&(r=l.addToSet(r))}):n=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(n),s.consuming===!1)o=s;else break}return[n,r]}addElementByRule(e,n,r){let i,o,s;n.node?(o=this.parser.schema.nodes[n.node],o.isLeaf?this.insertNode(o.create(n.attrs))||this.leafFallback(e):i=this.enter(o,n.attrs||null,n.preserveWhitespace)):(s=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(s));let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=r==null?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o);this.findAtPoint(e,i)}findPlace(e){let n,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],s=o.findWrapping(e);if(s&&(!n||n.length>s.length)&&(n=s,r=o,!s.length)||o.solid)break}if(!n)return!1;this.sync(r);for(let i=0;ithis.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let c=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=jq(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let s=i.popFromStashMark(e);s&&i.type&&i.type.allowsMarkType(s.type)&&(i.activeMarks=s.addToSet(i.activeMarks))}if(i==n)break}}}function Lq(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&iT.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Fq(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Bq(t){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=e.exec(t);)r.push(n[1],n[2].trim());return r}function T1(t){let e={};for(let n in t)e[n]=t[n];return e}function zq(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=l=>{o.push(l);for(let a=0;a{if(o.length||s.marks.length){let l=0,a=0;for(;l=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Gn.renderSpec(dd(r),i(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let i=n[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let s,l=r?e.createElementNS(r,i):e.createElement(i),a=n[1],u=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){u=2;for(let c in a)if(a[c]!=null){let d=c.indexOf(" ");d>0?l.setAttributeNS(c.slice(0,d),c.slice(d+1),a[c]):l.setAttribute(c,a[c])}}for(let c=u;cu)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=Gn.renderSpec(e,d,r);if(l.appendChild(f),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:l,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Gn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=O1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return O1(e.marks)}}function O1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function dd(t){return t.document||window.document}const oT=65535,sT=Math.pow(2,16);function Uq(t,e){return t+e*sT}function $1(t){return t&oT}function Vq(t){return(t-(t&oT))/sT}const lT=1,aT=2,Ha=4,uT=8;class Zp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&uT)>0}get deletedBefore(){return(this.delInfo&(lT|Ha))>0}get deletedAfter(){return(this.delInfo&(aT|Ha))>0}get deletedAcross(){return(this.delInfo&Ha)>0}}class _t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&_t.empty)return _t.empty}recover(e){let n=0,r=$1(e);if(!this.inverted)for(let i=0;ie)break;let u=this.ranges[l+o],c=this.ranges[l+s],d=a+u;if(e<=d){let f=u?e==a?-1:e==d?1:n:n,p=a+i+(f<0?0:c);if(r)return p;let h=e==(n<0?a:d)?null:Uq(l/3,e-a),v=e==a?aT:e==d?lT:Ha;return(n<0?e!=a:e!=d)&&(v|=uT),new Zp(p,v,h)}i+=c-u}return r?e+i:new Zp(e+i,0,null)}touches(e,n){let r=0,i=$1(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;le)break;let u=this.ranges[l+o],c=a+u;if(e<=c&&l==i*3)return!0;r+=this.ranges[l+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new So;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ro&&a!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Me.fromReplace(e,this.from,this.to,o)}invert(){return new On(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new gr(n.pos,r.pos,this.mark)}merge(e){return e instanceof gr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new gr(n.from,n.to,e.markFromJSON(n.mark))}}ut.jsonID("addMark",gr);class On extends ut{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new W(sg(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Me.fromReplace(e,this.from,this.to,r)}invert(){return new gr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new On(n.pos,r.pos,this.mark)}merge(e){return e instanceof On&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new On(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new On(n.from,n.to,e.markFromJSON(n.mark))}}ut.jsonID("removeMark",On);class yr extends ut{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Me.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Me.fromReplace(e,this.pos,this.pos+1,new W(F.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new Rt(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Rt(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(e,n.slice),n.insert,!!n.structure)}}ut.jsonID("replaceAround",Rt);function eh(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Wq(t,e,n,r){let i=[],o=[],s,l;t.doc.nodesBetween(e,n,(a,u,c)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(u,e),p=Math.min(u+a.nodeSize,n),h=r.addToSet(d);for(let v=0;vt.step(a)),o.forEach(a=>t.step(a))}function Hq(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof Kc){let u=s.marks,c;for(;c=r.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,n);for(let c=0;ct.step(new On(s.from,s.to,s.style)))}function Gq(t,e,n,r=n.contentMatch){let i=t.doc.nodeAt(e),o=[],s=e+1;for(let l=0;l=0;l--)t.step(o[l])}function Kq(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function lg(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),o=t.$from.index(r),s=t.$to.indexAfter(r);if(rn;h--)v||r.index(h)>0?(v=!0,c=F.from(r.node(h).copy(c)),d++):a--;let f=F.empty,p=0;for(let h=o,v=!1;h>n;h--)v||i.after(h+1)=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=F.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Rt(i,o,i,o,new W(r,0,0),n.length,!0))}function Jq(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{if(s.isTextblock&&!s.hasMarkup(r,i)&&Qq(t.doc,t.mapping.slice(o).map(l),r)){t.clearIncompatible(t.mapping.slice(o).map(l,1),r);let a=t.mapping.slice(o),u=a.map(l,1),c=a.map(l+s.nodeSize,1);return t.step(new Rt(u,c,u+1,c-1,new W(F.from(r.create(i,null,s.marks)),0,0),1,!0)),!1}})}function Qq(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Xq(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Rt(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new W(F.from(s),0,0),1,!0))}function Ga(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>o;u--,c--){let d=i.node(u),f=i.index(u);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[c+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let v=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!v.type.validContent(p))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function Zq(t,e,n=1,r){let i=t.doc.resolve(e),o=F.empty,s=F.empty;for(let l=i.depth,a=i.depth-n,u=n-1;l>a;l--,u--){o=F.from(i.node(l).copy(o));let c=r&&r[u];s=F.from(c?c.type.create(c.attrs,s):i.node(l).copy(s))}t.step(new ot(e,e,new W(o.append(s),n,n),!0))}function cT(t,e){let n=t.resolve(e),r=n.index();return eY(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function eY(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function tY(t,e,n){let r=new ot(e-n,e+n,W.empty,!0);t.step(r)}function nY(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),u=r.node(s),c=!1;if(o==1)c=u.canReplace(a,a,i);else{let d=u.contentMatchAt(a).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(a,a,d[0])}if(c)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function ag(t,e,n=e,r=W.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return fT(i,o,r)?new ot(e,n,r):new iY(i,o,r).fit()}function fT(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class iY{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=F.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=F.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new W(o,s,l);return e>-1?new Rt(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new ot(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=hd(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],c,d=null;if(n==1&&(s?u.matchType(s.type)||(d=u.fillBefore(F.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:d};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:c};if(o&&u.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=hd(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new W(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=hd(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new W(Ts(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new W(Ts(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let v=0;v1||a==0||v.content.size)&&(d=b,c.push(dT(v.mark(f.allowedMarks(v.marks)),u==1?a:0,u==l.childCount?p:-1)))}let h=u==l.childCount;h||(p=-1),this.placed=Os(this.placed,n,F.from(c)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,b=l;v1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n=0;l--){let{match:a,type:u}=this.frontier[l],c=md(e,l,u,a,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Os(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Os(this.placed,this.depth,F.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(F.empty,!0);n.childCount&&(this.placed=Os(this.placed,this.frontier.length,n))}}function Ts(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ts(t.firstChild.content,e-1,n)))}function Os(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Os(t.lastChild.content,e-1,n)))}function hd(t,e){for(let n=0;n1&&(r=r.replaceChild(0,dT(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(F.empty,!0)))),t.copy(r)}function md(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!oY(n,o.content,s)?l:null}function oY(t,e,n){for(let r=n;r0;f--,p--){let h=i.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?l=f:i.before(f)==p&&s.splice(1,0,-f)}let a=s.indexOf(l),u=[],c=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(u.push(h),p==r.openStart)break;f=h.content}for(let f=c-1;f>=0;f--){let p=u[f],h=sY(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(l)-1)))c=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+c+1)%(r.openStart+1),h=u[p];if(h)for(let v=0;v=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=s[f];p<0||(e=i.before(p),n=o.after(p))}}function pT(t,e,n,r,i){if(er){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(F.empty,!0))}return t}function aY(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=nY(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new W(F.from(r),0,0))}function uY(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=hT(r,i);for(let s=0;s0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s)return t.delete(r.before(s),n);t.delete(e,n)}function hT(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(oe.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class bo extends ut{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Me.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Me.fromReplace(e,this.pos,this.pos+1,new W(F.from(i),0,n.isLeaf?0:1))}getMap(){return _t.empty}invert(e){return new bo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new bo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new bo(n.pos,n.attr,n.value)}}ut.jsonID("attr",bo);class El extends ut{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Me.ok(r)}getMap(){return _t.empty}invert(e){return new El(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new El(n.attr,n.value)}}ut.jsonID("docAttr",El);let Ro=class extends Error{};Ro=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ro.prototype=Object.create(Error.prototype);Ro.prototype.constructor=Ro;Ro.prototype.name="TransformError";class cY{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new So}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ro(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=W.empty){let i=ag(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new W(F.from(r),0,0))}delete(e,n){return this.replace(e,n,W.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return lY(this,e,n,r),this}replaceRangeWith(e,n,r){return aY(this,e,n,r),this}deleteRange(e,n){return uY(this,e,n),this}lift(e,n){return qq(this,e,n),this}join(e,n=1){return tY(this,e,n),this}wrap(e,n){return Yq(this,e,n),this}setBlockType(e,n=e,r,i=null){return Jq(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Xq(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new bo(e,n,r)),this}setDocAttribute(e,n){return this.step(new El(e,n)),this}addNodeMark(e,n){return this.step(new yr(e,n)),this}removeNodeMark(e,n){if(!(n instanceof le)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Do(e,n)),this}split(e,n=1,r){return Zq(this,e,n,r),this}addMark(e,n,r){return Wq(this,e,n,r),this}removeMark(e,n,r){return Hq(this,e,n,r),this}clearIncompatible(e,n,r){return Gq(this,e,n,r),this}}const gd=Object.create(null);class ae{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new fY(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;o--){let s=n<0?Ki(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Ki(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Lt(e.node(0))}static atStart(e){return Ki(e,e,0,0,1)||new Lt(e)}static atEnd(e){return Ki(e,e,e.content.size,e.childCount,-1)||new Lt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=gd[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in gd)throw new RangeError("Duplicate use of selection JSON ID "+e);return gd[e]=n,n.prototype.jsonID=e,n}getBookmark(){return me.between(this.$anchor,this.$head).getBookmark()}}ae.prototype.visible=!0;class fY{constructor(e,n){this.$from=e,this.$to=n}}let k1=!1;function A1(t){!k1&&!t.parent.inlineContent&&(k1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class me extends ae{constructor(e,n=e){A1(e),A1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ae.near(r);let i=e.resolve(n.map(this.anchor));return new me(i.parent.inlineContent?i:r,r)}replace(e,n=W.empty){if(super.replace(e,n),n==W.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof me&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new qc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new me(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=ae.findFrom(n,r,!0)||ae.findFrom(n,-r,!0);if(o)n=o.$head;else return ae.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ae.findFrom(e,-r,!0)||ae.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?s=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&J.isSelectable(l))return J.create(t,n-(i<0?l.nodeSize:0))}else{let a=Ki(t,l,n+i,i<0?l.childCount:0,i,o);if(a)return a}n+=l.nodeSize*i}return null}function P1(t,e,n){let r=t.steps.length-1;if(r{s==null&&(s=c)}),t.setSelection(ae.near(t.doc.resolve(s),n))}const N1=1,$a=2,M1=4;class pY extends cY{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=$a,this}ensureMarks(e){return le.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&$a)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~$a,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||le.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(ae.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=M1,this}get scrolledIntoView(){return(this.updated&M1)>0}}function _1(t,e){return!e||!t?t:t.bind(e)}class $s{constructor(e,n,r){this.name=e,this.init=_1(n.init,r),this.apply=_1(n.apply,r)}}const hY=[new $s("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new $s("selection",{init(t,e){return t.selection||ae.atStart(e.doc)},apply(t){return t.selection}}),new $s("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new $s("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class yd{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=hY.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new $s(r.key,r.spec.state,r))})}}class ks{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new yd(e.schema,e.plugins),o=new ks(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=di.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=ae.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){o[s.name]=u.fromJSON.call(a,e,n[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function mT(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=mT(i,e,{})),n[r]=i}return n}class gT{constructor(e){this.spec=e,this.props={},e.props&&mT(e.props,this,this.props),this.key=e.key?e.key.key:yT("plugin")}getState(e){return e[this.key]}}const vd=Object.create(null);function yT(t){return t in vd?t+"$"+ ++vd[t]:(vd[t]=0,t+"$")}class vT{constructor(e="key"){this.key=yT(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const dt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Cl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let I1=null;const zn=function(t,e,n){let r=I1||(I1=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Ei=function(t,e,n,r){return n&&(D1(t,e,n,r,-1)||D1(t,e,n,r,1))},mY=/^(img|br|input|textarea|hr)$/i;function D1(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:xn(t))){let o=t.parentNode;if(!o||o.nodeType!=1||cg(t)||mY.test(t.nodeName)||t.contentEditable=="false")return!1;e=dt(t)+(i<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?xn(t):0}else return!1}}function xn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function gY(t,e,n){for(let r=e==0,i=e==xn(t);r||i;){if(t==n)return!0;let o=dt(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==xn(t)}}function cg(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Yc=function(t){return t.focusNode&&Ei(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Xr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function yY(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function vY(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const An=typeof navigator<"u"?navigator:null,R1=typeof document<"u"?document:null,Ur=An&&An.userAgent||"",th=/Edge\/(\d+)/.exec(Ur),ST=/MSIE \d/.exec(Ur),nh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ur),At=!!(ST||nh||th),Ar=ST?document.documentMode:nh?+nh[1]:th?+th[1]:0,hn=!At&&/gecko\/(\d+)/i.test(Ur);hn&&+(/Firefox\/(\d+)/.exec(Ur)||[0,0])[1];const rh=!At&&/Chrome\/(\d+)/.exec(Ur),st=!!rh,SY=rh?+rh[1]:0,mt=!At&&!!An&&/Apple Computer/.test(An.vendor),Lo=mt&&(/Mobile\/\w+/.test(Ur)||!!An&&An.maxTouchPoints>2),Vt=Lo||(An?/Mac/.test(An.platform):!1),bY=An?/Win/.test(An.platform):!1,ln=/Android \d/.test(Ur),jl=!!R1&&"webkitFontSmoothing"in R1.documentElement.style,wY=jl?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function EY(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Fn(t,e){return typeof t=="number"?t:t[e]}function CY(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function L1(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=Cl(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,u=a?EY(o):CY(l),c=0,d=0;if(e.topu.bottom-Fn(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+Fn(i,"top")-u.top:e.bottom-u.bottom+Fn(i,"bottom")),e.leftu.right-Fn(r,"right")&&(c=e.right-u.right+Fn(i,"right")),c||d)if(a)o.defaultView.scrollBy(c,d);else{let f=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),c&&(l.scrollLeft+=c);let h=l.scrollLeft-f,v=l.scrollTop-p;e={left:e.left-h,top:e.top-v,right:e.right-h,bottom:e.bottom-v}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function xY(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:bT(t.dom)}}function bT(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Cl(r));return e}function TY({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;wT(n,r==0?0:r-e)}function wT(t,e){for(let n=0;n=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let v=h.left>e.left?h.left-e.left:h.right=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=c,u={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(o=d+1)}}return!n&&a&&(n=a,i=u,r=0),n&&n.nodeType==3?$Y(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:ET(n,i)}function $Y(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function fg(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function kY(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function PY(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let l=t.docView.nearestDesc(o,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!s||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!s&&(s=!0,a.left>r.left||a.top>r.top?i=l.posBefore:(a.right-1?i:t.docView.posFromDOM(e,n,-1)}function CT(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let u;jl&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=PY(t,r,i,e))}l==null&&(l=AY(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function F1(t){return t.top=0&&i==r.nodeValue.length?(a--,c=1):n<0?a--:u++,bs(rr(zn(r,a,u),c),c<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==xn(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Sd(a.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==xn(r))){let a=r.childNodes[i-1],u=a.nodeType==3?zn(a,xn(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return bs(rr(u,1),!1)}if(o==null&&i=0)}function bs(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Sd(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function TT(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function _Y(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return TT(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=xT(t,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=zn(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;uc.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const IY=/[\u0590-\u08ac]/;function DY(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=t.domSelection();return!IY.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?o:s:TT(t,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:v}=t.domSelectionRange(),b=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&u==v;try{l.collapse(c,d),a&&(a!=c||u!=d)&&l.extend&&l.extend(a,u)}catch{}return f!=null&&(l.caretBidiLevel=f),b})}let B1=null,z1=null,j1=!1;function RY(t,e,n){return B1==e&&z1==n?j1:(B1=e,z1=n,j1=n=="up"||n=="down"?_Y(t,e,n):DY(t,e,n))}const Jt=0,U1=1,ri=2,Pn=3;class Ul{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Jt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;ndt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||s instanceof $T){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof OT&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?dt(o.dom)+1:0}}else{let o,s=!0;for(;o=r=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,c);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=dt(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(u>n||l==this.children.length-1)){n=u;for(let c=l+1;cp&&sn){let p=l;l=a,a=p}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let l=r+o.border,a=s-o.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?ri:U1,e==l&&n==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Pn:o.markDirty(e-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?ri:Pn}r=s}this.dirty=ri}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ri:U1;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Jt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class LY extends Ul{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ci extends Ul{constructor(e,n,r,i){super(e,[],r,i),this.mark=n}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=Gn.renderSpec(document,n.type.spec.toDOM(n,r))),new Ci(e,n,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&Pn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Pn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Jt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(o=sh(o,0,e,r));for(let l=0;l{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=Gn.renderSpec(document,n.type.spec.toDOM(n)));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=PT(c,r,n),u?a=new FY(e,n,r,i,c,d||null,f,u,o,s+1):n.isText?new Jc(e,n,r,i,c,f,o):new Pr(e,n,r,i,c,d||null,f,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>F.empty)}return e}matchesNode(e,n,r){return this.dirty==Jt&&e.eq(this.node)&&oh(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new zY(this,s&&s.node,e);VY(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!d&&a.syncToMarks(c==this.node.childCount?le.none:this.node.child(c).marks,r,e),a.placeWidget(u,e,i)},(u,c,d,f)=>{a.syncToMarks(u.marks,r,e);let p;a.findNodeMatch(u,c,d,f)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(u,c,d,p,e)||a.updateNextNode(u,c,d,e,f,i)||a.addNode(u,c,d,e,i),i+=u.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ri)&&(s&&this.protectLocalComposition(e,s),kT(this.contentDOM,this.children,e),Lo&&WY(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof me)||rn+this.node.content.size)return null;let o=e.domSelectionRange(),s=HY(o.focusNode,o.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,a=GY(this.node.content,l,r-n,i-n);return a<0?null:{node:s,pos:a,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new LY(this,o,n,i);e.input.compositionNodes.push(s),this.children=sh(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Pn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Jt}updateOuterDeco(e){if(oh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=AT(this.dom,this.nodeDOM,ih(this.outerDeco,this.node,n),ih(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function V1(t,e,n,r,i){PT(r,e,t);let o=new Pr(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Jc extends Pr{constructor(e,n,r,i,o,s,l){super(e,n,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Pn||this.dirty!=Jt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Jt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Jt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Jc(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Pn)}get domAtom(){return!1}}class $T extends Ul{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Jt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class FY extends Pr{constructor(e,n,r,i,o,s,l,a,u,c){super(e,n,r,i,o,s,l,u,c),this.spec=a}update(e,n,r,i){if(this.dirty==Pn)return!1;if(this.spec.update){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function kT(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o>1,s=Math.min(o,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Ci.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof Ci)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function UY(t,e){return t.type.side-e.type.side}function VY(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let u=0;uo;)l.push(i[s++]);let h=o+f.nodeSize;if(f.isText){let b=h;s!b.inline):l.slice();r(f,v,e.forChild(o,f),p),o=h}}function WY(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function HY(t,e){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0){if(t.childNodes.length>e&&t.childNodes[e].nodeType==3)return t.childNodes[e];t=t.childNodes[e-1],e=xn(t)}else if(t.nodeType==1&&e=n){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l=0&&u+e.length+l>=n)return l+u;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function sh(t,e,n,r,i){let o=[];for(let s=0,l=0;s=n||c<=e?o.push(a):(un&&o.push(a.slice(n-u,a.size,r)))}return o}function dg(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,u;if(Yc(n)){for(a=l;i&&!i.node;)i=i.parent;let c=i.node;if(i&&c.isAtom&&J.isSelectable(c)&&i.parent&&!(c.isInline&&gY(n.focusNode,n.focusOffset,i.dom))){let d=i.posBefore;u=new J(s==d?l:r.resolve(d))}}else{let c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null;a=r.resolve(c)}if(!u){let c=e=="pointer"||t.state.selection.head{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!NT(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function qY(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,dt(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&At&&Ar<=11&&(r.disabled=!0,r.disabled=!1)}function MT(t,e){if(e instanceof J){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(q1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else q1(t)}function q1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function pg(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||me.between(e,n,r)}function Y1(t){return t.editable&&!t.hasFocus()?!1:_T(t)}function _T(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function YY(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ei(e.node,e.offset,n.anchorNode,n.anchorOffset)}function lh(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&ae.findFrom(o,e)}function lr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function J1(t,e,n){let r=t.state.selection;if(r instanceof me)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return lr(t,new me(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=lh(t.state,e);return i&&i instanceof J?lr(t,i):!1}else if(!(Vt&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?J.isSelectable(o)?lr(t,new J(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):jl?lr(t,new me(t.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof J&&r.node.isInline)return lr(t,new me(e>0?r.$to:r.$from));{let i=lh(t.state,e);return i?lr(t,i):!1}}}function Uu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ks(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ui(t,e){return e<0?JY(t):QY(t)}function JY(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(hn&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Ks(l,-1))i=n,o=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(IT(n))break;{let l=n.previousSibling;for(;l&&Ks(l,-1);)i=n.parentNode,o=dt(l),l=l.previousSibling;if(l)n=l,r=Uu(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?ah(t,n,r):i&&ah(t,i,o)}function QY(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Uu(n),o,s;for(;;)if(r{t.state==i&&qn(t)},50)}function Q1(t,e){let n=t.state.doc.resolve(e);if(!(st||bY)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s1)return o.lefti.top&&s1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function X1(t,e,n){let r=t.state.selection;if(r instanceof me&&!r.empty||n.indexOf("s")>-1||Vt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=lh(t.state,e);if(s&&s instanceof J)return lr(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Lt?ae.near(s,e):ae.findFrom(s,e);return l?lr(t,l):!1}return!1}function Z1(t,e){if(!(t.state.selection instanceof me))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function eS(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function eJ(t){if(!mt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;eS(t,r,"true"),setTimeout(()=>eS(t,r,"false"),20)}return!1}function tJ(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function nJ(t,e){let n=e.keyCode,r=tJ(e);if(n==8||Vt&&n==72&&r=="c")return Z1(t,-1)||Ui(t,-1);if(n==46&&!e.shiftKey||Vt&&n==68&&r=="c")return Z1(t,1)||Ui(t,1);if(n==13||n==27)return!0;if(n==37||Vt&&n==66&&r=="c"){let i=n==37?Q1(t,t.state.selection.from)=="ltr"?-1:1:-1;return J1(t,i,r)||Ui(t,i)}else if(n==39||Vt&&n==70&&r=="c"){let i=n==39?Q1(t,t.state.selection.from)=="ltr"?1:-1:1;return J1(t,i,r)||Ui(t,i)}else{if(n==38||Vt&&n==80&&r=="c")return X1(t,-1,r)||Ui(t,-1);if(n==40||Vt&&n==78&&r=="c")return eJ(t)||X1(t,1,r)||Ui(t,1);if(r==(Vt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function DT(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||Gn.fromSchema(t.state.schema),l=jT(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let u=a.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=zT[u.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let h=l.createElement(c[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),d++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
+
+`);return{dom:a,text:f}}function RT(t,e,n,r,i){let o=i.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=e&&(r||o||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,o||r,t)}),o)return e?new W(F.from(t.state.schema.text(e.replace(/\r\n?/g,`
+`))),0,0):W.empty;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)l=d;else{let f=i.marks(),{schema:p}=t.state,h=Gn.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let b=s.appendChild(document.createElement("p"));v&&b.appendChild(h.serializeNode(p.text(v,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=oJ(n),jl&&sJ(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||wl.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!rJ.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)l=lJ(tS(l,+c[1],+c[2]),c[4]);else if(l=W.maxOpen(iJ(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let p=l.content.firstChild;d{l=d(l,t)}),l}const rJ=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function iJ(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),u;if(!a)return s=null;if(u=s.length&&o.length&&FT(a,o,l,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=BT(s[s.length-1],o.length));let c=LT(l,a);s.push(c),i=i.matchType(c.type),o=a}}),s)return F.from(s)}return t}function LT(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,F.from(t));return t}function FT(t,e,n,r,i){if(i1&&(o=0),i=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(F.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function tS(t,e,n){return e]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=jT().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&zT[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>""+o+">").reverse().join("")),n.innerHTML=t,i)for(let o=0;o=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=F.from(a.create(r[l+1],i)),o++,s++}return new W(i,o,s)}const gt={},yt={},aJ={touchstart:!0,touchmove:!0};class uJ{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function cJ(t){for(let e in gt){let n=gt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{dJ(t,r)&&!hg(t,r)&&(t.editable||!(r.type in yt))&&n(t,r)},aJ[e]?{passive:!0}:void 0)}mt&&t.dom.addEventListener("input",()=>null),ch(t)}function vr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function fJ(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ch(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>hg(t,r))})}function hg(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function dJ(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function pJ(t,e){!hg(t,e)&>[e.type]&&(t.editable||!(e.type in yt))&>[e.type](t,e)}yt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!VT(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ln&&st&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Lo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Xr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||nJ(t,n)?n.preventDefault():vr(t,"key")};yt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};yt.keypress=(t,e)=>{let n=e;if(VT(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Vt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof me)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Qc(t){return{left:t.clientX,top:t.clientY}}function hJ(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function mg(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,l=>s>o.depth?l(t,n,o.nodeAfter,o.before(s),i,!0):l(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function wo(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function mJ(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&J.isSelectable(r)?(wo(t,new J(n),"pointer"),!0):!1}function gJ(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof J&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(J.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(wo(t,J.create(t.state.doc,i),"pointer"),!0):!1}function yJ(t,e,n,r,i){return mg(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?gJ(t,n):mJ(t,n))}function vJ(t,e,n,r){return mg(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function SJ(t,e,n,r){return mg(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||bJ(t,n,r)}function bJ(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(wo(t,me.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)wo(t,me.create(r,l+1,l+1+s.content.size),"pointer");else if(J.isSelectable(s))wo(t,J.create(r,l),"pointer");else continue;return!0}}function gg(t){return Vu(t)}const UT=Vt?"metaKey":"ctrlKey";gt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=gg(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&hJ(n,t.input.lastClick)&&!n[UT]&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords(Qc(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new wJ(t,s,n,!!r)):(o=="doubleClick"?vJ:SJ)(t,s.pos,s.inside,n)?n.preventDefault():vr(t,"pointer"))};class wJ{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[UT],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);o=c.parent,s=c.depth?c.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a?a.dom:null;let{selection:u}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof J&&u.from<=s&&u.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&hn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),vr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>qn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Qc(e))),this.updateAllowDefault(e),this.allowDefault||!n?vr(this.view,"pointer"):yJ(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||mt&&this.mightDrag&&!this.mightDrag.node.isAtom||st&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(wo(this.view,ae.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):vr(this.view,"pointer")}move(e){this.updateAllowDefault(e),vr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}gt.touchstart=t=>{t.input.lastTouch=Date.now(),gg(t),vr(t,"pointer")};gt.touchmove=t=>{t.input.lastTouch=Date.now(),vr(t,"pointer")};gt.contextmenu=t=>gg(t);function VT(t,e){return t.composing?!0:mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const EJ=ln?5e3:-1;yt.compositionstart=yt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Vu(t,!0),t.markCursor=null;else if(Vu(t),hn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){t.domSelection().collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}WT(t,EJ)};yt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,WT(t,20))};function WT(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Vu(t),e))}function HT(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=CJ());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function CJ(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Vu(t,e=!1){if(!(ln&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),HT(t),e||t.docView&&t.docView.dirty){let n=dg(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function xJ(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const xl=At&&Ar<15||Lo&&wY<604;gt.copy=yt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=xl?null:n.clipboardData,s=r.content(),{dom:l,text:a}=DT(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):xJ(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function TJ(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function OJ(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Tl(t,r.value,null,i,e):Tl(t,r.textContent,r.innerHTML,i,e)},50)}function Tl(t,e,n,r,i){let o=RT(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,o||W.empty)))return!0;if(!o)return!1;let s=TJ(o),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function GT(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}yt.paste=(t,e)=>{let n=e;if(t.composing&&!ln)return;let r=xl?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Tl(t,GT(r),r.getData("text/html"),i,n)?n.preventDefault():OJ(t,n)};class KT{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const qT=Vt?"altKey":"ctrlKey";gt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Qc(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof J?i.to-1:i.to))){if(r&&r.mightDrag)s=J.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let c=t.docView.nearestDesc(n.target,!0);c&&c.node.type.spec.draggable&&c!=t.docView&&(s=J.create(t.state.doc,c.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:u}=DT(t,l);n.dataTransfer.clearData(),n.dataTransfer.setData(xl?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",xl||n.dataTransfer.setData("text/plain",u),t.dragging=new KT(l,!n[qT],s)};gt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};yt.dragover=yt.dragenter=(t,e)=>e.preventDefault();yt.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Qc(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",h=>{s=h(s,t)}):s=RT(t,GT(n.dataTransfer),xl?null:n.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!n[qT]);if(t.someProp("handleDrop",h=>h(t,n,s||W.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?rY(t.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let u=t.state.tr;if(l){let{node:h}=r;h?h.replace(u):u.deleteSelection()}let c=u.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=u.doc;if(d?u.replaceRangeWith(c,c,s.content.firstChild):u.replaceRange(c,c,s),u.doc.eq(f))return;let p=u.doc.resolve(c);if(d&&J.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new J(p));else{let h=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((v,b,m,y)=>h=y),u.setSelection(pg(t,p,u.doc.resolve(h)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};gt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&qn(t)},20))};gt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};gt.beforeinput=(t,e)=>{if(st&&ln&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Xr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in yt)gt[t]=yt[t];function Ol(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Wu{constructor(e,n){this.toDOM=e,this.spec=n||pi,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new un(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Wu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ol(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Nr{constructor(e,n){this.attrs=e,this.spec=n||pi}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new un(o,s,this)}valid(e,n){return n.from=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;se){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,i+l,o)}}map(e,n,r){return this==rt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||pi)}mapInner(e,n,r,i,o){let s;for(let l=0;l{let u=a+r,c;if(c=JT(n,l,u)){for(i||(i=this.children.slice());ol&&d.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+n.content.size;for(let l=0;lo&&a.type instanceof Nr){let u=Math.max(o,a.from)-o,c=Math.min(s,a.to)-o;ui.map(e,n,pi));return dr.from(r)}forChild(e,n){if(n.isLeaf)return ze.empty;let r=[];for(let i=0;in instanceof ze)?e:e.reduce((n,r)=>n.concat(r instanceof ze?r:r.members),[]))}}}function $J(t,e,n,r,i,o,s){let l=t.slice();for(let u=0,c=o;u{let b=v-h-(p-f);for(let m=0;my+c-d)continue;let g=l[m]+c-d;p>=g?l[m+1]=f<=g?-2:-1:f>=c&&b&&(l[m]+=b,l[m+1]+=b)}d+=b}),c=n.maps[u].map(c,-1)}let a=!1;for(let u=0;u=r.content.size){a=!0;continue}let f=n.map(t[u+1]+o,-1),p=f-i,{index:h,offset:v}=r.content.findIndex(d),b=r.maybeChild(h);if(b&&v==d&&v+b.nodeSize==p){let m=l[u+2].mapInner(n,b,c+1,t[u]+o+1,s);m!=rt?(l[u]=d,l[u+1]=p,l[u+2]=m):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=kJ(l,t,e,n,i,o,s),c=Hu(u,r,0,s);e=c.local;for(let d=0;dn&&s.to{let u=JT(t,l,a+n);if(u){o=!0;let c=Hu(u,l,n+a+1,r);c!=rt&&i.push(a,a+l.nodeSize,c)}});let s=YT(o?QT(t):t,-n).sort(hi);for(let l=0;l0;)e++;t.splice(e,0,n)}function wd(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=rt&&e.push(r)}),t.cursorWrapper&&e.push(ze.create(t.state.doc,[t.cursorWrapper.deco])),dr.from(e)}const AJ={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},PJ=At&&Ar<=11;class NJ{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class MJ{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new NJ,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),PJ&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,AJ)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Y1(this.view)){if(this.suppressingSelectionUpdates)return qn(this.view);if(At&&Ar<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ei(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=Cl(o))n.add(o);for(let o=e.anchorNode;o;o=Cl(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Y1(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let c=0;c1){let c=a.filter(d=>d.nodeName=="BR");if(c.length==2){let d=c[0],f=c[1];d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}}let u=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(o>-1&&(e.docView.markDirty(o,s),_J(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||qn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;ci;b--){let m=r.childNodes[b-1],y=m.pmViewDesc;if(m.nodeName=="BR"&&!y){o=b;break}if(!y||y.size)break}let d=t.state.doc,f=t.someProp("domParser")||wl.fromSchema(t.state.schema),p=d.resolve(s),h=null,v=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:RJ,context:p});if(u&&u[0].pos!=null){let b=u[0].pos,m=u[1]&&u[1].pos;m==null&&(m=b),h={anchor:b+s,head:m+s}}return{doc:v,sel:h,from:s,to:l}}function RJ(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(mt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||mt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const LJ=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function FJ(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let A=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=dg(t,A);if(I&&!t.state.selection.eq(I)){if(st&&ln&&t.input.lastKeyCode===13&&Date.now()-100$(t,Xr(13,"Enter"))))return;let M=t.state.tr.setSelection(I);A=="pointer"?M.setMeta("pointer",!0):A=="key"&&M.scrollIntoView(),o&&M.setMeta("composition",o),t.dispatch(M)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,u=DJ(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),f,p;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ln)&&i.some(A=>A.nodeType==1&&!LJ.test(A.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",A=>A(t,Xr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&a instanceof me&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let A=sS(t,t.state.doc,u.sel);if(A&&!A.eq(t.state.selection)){let I=t.state.tr.setSelection(A);o&&I.setMeta("composition",o),t.dispatch(I)}}return}if(st&&t.cursorWrapper&&u.sel&&u.sel.anchor==t.cursorWrapper.deco.from&&u.sel.head==u.sel.anchor){let A=h.endB-h.start;u.sel={anchor:u.sel.anchor+A,head:u.sel.anchor+A}}t.input.domChangeCount++,t.state.selection.fromt.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?h.start=t.state.selection.from:h.endA=t.state.selection.to-2&&t.state.selection.to<=u.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),At&&Ar<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>u.from&&u.doc.textBetween(h.start-u.from-1,h.start-u.from+1)==" "&&(h.start--,h.endA--,h.endB--);let v=u.doc.resolveNoCache(h.start-u.from),b=u.doc.resolveNoCache(h.endB-u.from),m=c.resolve(h.start),y=v.sameParent(b)&&v.parent.inlineContent&&m.end()>=h.endA,g;if((Lo&&t.input.lastIOSEnter>Date.now()-225&&(!y||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!y&&v.posA(t,Xr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&zJ(c,h.start,h.endA,v,b)&&t.someProp("handleKeyDown",A=>A(t,Xr(8,"Backspace")))){ln&&st&&t.domObserver.suppressSelectionUpdates();return}st&&ln&&h.endB==h.start&&(t.input.lastAndroidDelete=Date.now()),ln&&!y&&v.start()!=b.start()&&b.parentOffset==0&&v.depth==b.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==h.endA&&(h.endB-=2,b=u.doc.resolveNoCache(h.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,Xr(13,"Enter"))})},20));let w=h.start,C=h.endA,x,P,S;if(y){if(v.pos==b.pos)At&&Ar<=11&&v.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>qn(t),20)),x=t.state.tr.delete(w,C),P=c.resolve(h.start).marksAcross(c.resolve(h.endA));else if(h.endA==h.endB&&(S=BJ(v.parent.content.cut(v.parentOffset,b.parentOffset),m.parent.content.cut(m.parentOffset,h.endA-m.start()))))x=t.state.tr,S.type=="add"?x.addMark(w,C,S.mark):x.removeMark(w,C,S.mark);else if(v.parent.child(v.index()).isText&&v.index()==b.index()-(b.textOffset?0:1)){let A=v.parent.textBetween(v.parentOffset,b.parentOffset);if(t.someProp("handleTextInput",I=>I(t,w,C,A)))return;x=t.state.tr.insertText(A,w,C)}}if(x||(x=t.state.tr.replace(w,C,u.doc.slice(h.start-u.from,h.endB-u.from))),u.sel){let A=sS(t,x.doc,u.sel);A&&!(st&&ln&&t.composing&&A.empty&&(h.start!=h.endB||t.input.lastAndroidDeletee.content.size?null:pg(t,e.resolve(n.anchor),e.resolve(n.head))}function BJ(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,l,a;for(let c=0;cc.mark(l.addToSet(c.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=c=>c.mark(l.removeFromSet(c.marks));else return null;let u=[];for(let c=0;cn||Ed(s,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function jJ(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s=s?o-r:0;o-=a,o&&o=l?o-r:0;o-=a,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}class ZQ{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new uJ,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(dS),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=cS(this),uS(this),this.nodeViews=fS(this),this.docView=V1(this.state.doc,aS(this),wd(this),this.dom,this),this.domObserver=new MJ(this,(r,i,o,s)=>FJ(this,r,i,o,s)),this.domObserver.start(),cJ(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ch(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(dS),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(HT(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=fS(this);VJ(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&ch(this),this.editable=cS(this),uS(this);let a=wd(this),u=aS(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,u,a);(d||!e.selection.eq(i.selection))&&(s=!0);let f=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&xY(this);if(s){this.domObserver.stop();let p=d&&(At||st)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&UJ(i.selection,e.selection);if(d){let h=st?this.trackWrites=this.domSelectionRange().focusNode:null;(o||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=V1(e.doc,u,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&YY(this))?qn(this,p):(MT(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&TY(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof J){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&L1(this,n.getBoundingClientRect(),e)}else L1(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new KT(e.slice,e.move,i<0?void 0:J.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;sn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return NY(this,e)}coordsAtPos(e,n=1){return xT(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return RY(this,n||this.state,e)}pasteHTML(e,n){return Tl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Tl(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(fJ(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],wd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return pJ(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return mt&&this.root.nodeType===11&&yY(this.dom.ownerDocument)==this.dom?IJ(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function aS(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[un.node(0,t.state.doc.content.size,e)]}function uS(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:un.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function cS(t){return!t.someProp("editable",e=>e(t.state)===!1)}function UJ(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function fS(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function VJ(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function dS(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Lr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Gu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},WJ=typeof navigator<"u"&&/Mac/.test(navigator.platform),HJ=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ye=0;Ye<10;Ye++)Lr[48+Ye]=Lr[96+Ye]=String(Ye);for(var Ye=1;Ye<=24;Ye++)Lr[Ye+111]="F"+Ye;for(var Ye=65;Ye<=90;Ye++)Lr[Ye]=String.fromCharCode(Ye+32),Gu[Ye]=String.fromCharCode(Ye);for(var Cd in Lr)Gu.hasOwnProperty(Cd)||(Gu[Cd]=Lr[Cd]);function GJ(t){var e=WJ&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||HJ&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Gu:Lr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const KJ=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function qJ(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let l=0;l127)&&(o=Lr[r.keyCode])&&o!=i){let l=e[xd(o,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const XT=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function QJ(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const XJ=(t,e,n)=>{let r=QJ(t,n);if(!r)return!1;let i=ZT(r);if(!i){let s=r.blockRange(),l=s&&lg(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&tO(t,i,e))return!0;if(r.parent.content.size==0&&(Fo(o,"end")||J.isSelectable(o))){let s=ag(t.doc,r.before(),r.after(),W.empty);if(s&&s.slice.size{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=ZT(r)}let s=o&&o.nodeBefore;return!s||!J.isSelectable(s)?!1:(e&&e(t.tr.setSelection(J.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function ZT(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function eQ(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=eQ(t,n);if(!r)return!1;let i=eO(r);if(!i)return!1;let o=i.nodeAfter;if(tO(t,i,e))return!0;if(r.parent.content.size==0&&(Fo(o,"start")||J.isSelectable(o))){let s=ag(t.doc,r.before(),r.after(),W.empty);if(s&&s.slice.size{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
+`).scrollIntoView()),!0)};function Sg(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Sg(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(ae.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},oQ=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Lt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Sg(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Ga(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&lg(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function lQ(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof J&&e.selection.node.isBlock)return!r.parentOffset||!Ga(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let o=i.parentOffset==i.parent.content.size,s=e.tr;(e.selection instanceof me||e.selection instanceof Lt)&&s.deleteSelection();let l=r.depth==0?null:Sg(r.node(-1).contentMatchAt(r.indexAfter(-1))),a=t&&t(i.parent,o),u=a?[a]:o&&l?[{type:l}]:void 0,c=Ga(s.doc,s.mapping.map(r.pos),1,u);if(!u&&!c&&Ga(s.doc,s.mapping.map(r.pos),1,l?[{type:l}]:void 0)&&(l&&(u=[{type:l}]),c=!0),c&&(s.split(s.mapping.map(r.pos),1,u),!o&&!r.parentOffset&&r.parent.type!=l)){let d=s.mapping.map(r.before()),f=s.doc.resolve(d);l&&r.node(-1).canReplaceWith(f.index(),f.index()+1,l)&&s.setNodeMarkup(s.mapping.map(r.before()),l)}n(s.scrollIntoView())}return!0}}const aQ=lQ(),uQ=(t,e)=>(e&&e(t.tr.setSelection(new Lt(t.doc))),!0);function cQ(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||cT(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function tO(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o,s;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(cQ(t,e,n))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(o=(s=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&s.matchType(o[0]||i.type).validEnd){if(n){let d=e.pos+i.nodeSize,f=F.empty;for(let v=o.length-1;v>=0;v--)f=F.from(o[v].create(null,f));f=F.from(r.copy(f));let p=t.tr.step(new Rt(e.pos-1,d,e.pos,d,new W(f,1,0),o.length,!0)),h=d+2*o.length;cT(p.doc,h)&&p.join(h),n(p.scrollIntoView())}return!0}let a=ae.findFrom(e,1),u=a&&a.$from.blockRange(a.$to),c=u&&lg(u);if(c!=null&&c>=e.depth)return n&&n(t.tr.lift(u,c).scrollIntoView()),!0;if(l&&Fo(i,"start",!0)&&Fo(r,"end")){let d=r,f=[];for(;f.push(d),!d.isTextblock;)d=d.lastChild;let p=i,h=1;for(;!p.isTextblock;p=p.firstChild)h++;if(d.canReplace(d.childCount,d.childCount,p.content)){if(n){let v=F.empty;for(let m=f.length-1;m>=0;m--)v=F.from(f[m].copy(v));let b=t.tr.step(new Rt(e.pos-f.length,e.pos+i.nodeSize,e.pos+h,e.pos+i.nodeSize-h,new W(v,f.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function nO(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(me.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const fQ=nO(-1),dQ=nO(1);function bg(...t){return function(e,n,r){for(let i=0;i=n?Ue.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ue.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ue.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ue.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};Ue.from=function(e){return e instanceof Ue?e:e&&e.length?new iO(e):Ue.empty};var iO=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ku)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ku)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ue);Ue.empty=new iO([]);var hQ=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ue);const mQ=500;class an{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,c.push(d);return}if(i){c.push(new bn(d.map));let p=d.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],u.push(new bn(h,void 0,void 0,u.length+c.length))),o--,h&&i.appendMap(h,o)}else s.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(o)):d.selection,a=new an(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let c=0;cyQ&&(l=gQ(l,u),s-=u),new an(l.append(o),s)}remapping(e,n){let r=new So;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new an(this.items.append(e.map(n=>new bn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=n;this.items.forEach(f=>{let p=o.getMirror(--a);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(f.step){let v=e.steps[p].invert(e.docs[p]),b=f.selection&&f.selection.map(o.slice(a+1,p));b&&l++,r.push(new bn(h,v,b))}else r.push(new bn(h))},i);let u=[];for(let f=n;fmQ&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(n.slice(r)),u=a&&a.getMap();if(r--,u&&n.appendMap(u,r),a){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let d=new bn(u.invert(),a,c),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new an(Ue.from(i.reverse()),o)}}an.empty=new an(Ue.empty,0);function gQ(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class bn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new bn(n.getMap().invert(),n,this.selection)}}}class ar{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const yQ=20;function vQ(t,e,n,r){let i=n.getMeta(Mr),o;if(i)return i.historyState;n.getMeta(bQ)&&(t=new ar(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Mr))return s.getMeta(Mr).redo?new ar(t.done.addTransform(n,void 0,r,Ka(e)),t.undone,hS(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new ar(t.done,t.undone.addTransform(n,void 0,r,Ka(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!SQ(n,t.prevRanges)),u=s?Od(t.prevRanges,n.mapping):hS(n.mapping.maps[n.steps.length-1]);return new ar(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Ka(e)),an.empty,u,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new ar(t.done.rebased(n,o),t.undone.rebased(n,o),Od(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ar(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Od(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function SQ(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function hS(t){let e=[];return t.forEach((n,r,i,o)=>e.push(i,o)),e}function Od(t,e){if(!t)return null;let n=[];for(let r=0;r{let n=Mr.getState(t);return!n||n.done.eventCount==0?!1:(e&&oO(n,t,e,!1),!0)},EQ=(t,e)=>{let n=Mr.getState(t);return!n||n.undone.eventCount==0?!1:(e&&oO(n,t,e,!0),!0)};export{jQ as $,mx as A,QQ as B,KQ as C,HQ as D,GQ as E,JQ as F,nX as G,eX as H,UQ as I,wQ as J,EQ as K,tX as L,ks as M,wl as N,ZQ as O,zQ as P,vq as Q,Ve as R,XQ as S,bq as T,_Q as U,HW as V,kQ as _,AQ as a,Js as b,NQ as c,PQ as d,oe as e,$Q as f,OQ as g,xQ as h,HM as i,CQ as j,Ch as k,RQ as l,d8 as m,BQ as n,IQ as o,lc as p,DQ as q,VQ as r,N as s,TQ as t,LQ as u,MQ as v,YQ as w,WQ as x,FQ as y,qQ as z};
diff --git a/packages/chord-chart-studio/build/assets/vendor-BWYuIjsn.js b/packages/chord-chart-studio/build/assets/vendor-BWYuIjsn.js
deleted file mode 100644
index cad176a..0000000
--- a/packages/chord-chart-studio/build/assets/vendor-BWYuIjsn.js
+++ /dev/null
@@ -1,142 +0,0 @@
-var Tn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function o$(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}function s$(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var XS=s$;function l$(t){return t}var Rl=l$,a$=XS,by=Math.max;function u$(t,e,n){return e=by(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=by(r.length-e,0),s=Array(o);++i0){if(++e>=gk)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var bk=Sk,wk=mk,Ek=bk,Ck=Ek(wk),ob=Ck,xk=Rl,Tk=ZS,Ok=ob;function $k(t,e){return Ok(Tk(t,e,xk),t+"")}var qo=$k;function kk(){this.__data__=[],this.size=0}var Ak=kk;function Pk(t,e){return t===e||t!==t&&e!==e}var Ll=Pk,_k=Ll;function Mk(t,e){for(var n=t.length;n--;)if(_k(t[n][0],e))return n;return-1}var cc=Mk,Nk=cc,Ik=Array.prototype,Dk=Ik.splice;function Rk(t){var e=this.__data__,n=Nk(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Dk.call(e,n,1),--this.size,!0}var Lk=Rk,Fk=cc;function Bk(t){var e=this.__data__,n=Fk(e,t);return n<0?void 0:e[n][1]}var zk=Bk,jk=cc;function Uk(t){return jk(this.__data__,t)>-1}var Wk=Uk,Vk=cc;function Hk(t,e){var n=this.__data__,r=Vk(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var Kk=Hk,Gk=Ak,qk=Lk,Yk=zk,Jk=Wk,Qk=Kk;function Yo(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=r_}var qh=i_,o_=zh,s_=qh;function l_(t){return t!=null&&s_(t.length)&&!o_(t)}var Ni=l_,a_=Ni,u_=In;function c_(t){return u_(t)&&a_(t)}var gc=c_,su={exports:{}};function f_(){return!1}var d_=f_;su.exports;(function(t,e){var n=vn,r=d_,i=e&&!e.nodeType&&e,o=i&&!0&&t&&!t.nodeType&&t,s=o&&o.exports===i,l=s?n.Buffer:void 0,a=l?l.isBuffer:void 0,u=a||r;t.exports=u})(su,su.exports);var yc=su.exports,p_=_i,h_=Hh,m_=In,g_="[object Object]",y_=Function.prototype,v_=Object.prototype,mb=y_.toString,S_=v_.hasOwnProperty,b_=mb.call(Object);function w_(t){if(!m_(t)||p_(t)!=g_)return!1;var e=h_(t);if(e===null)return!0;var n=S_.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&mb.call(n)==b_}var gb=w_,E_=_i,C_=qh,x_=In,T_="[object Arguments]",O_="[object Array]",$_="[object Boolean]",k_="[object Date]",A_="[object Error]",P_="[object Function]",__="[object Map]",M_="[object Number]",N_="[object Object]",I_="[object RegExp]",D_="[object Set]",R_="[object String]",L_="[object WeakMap]",F_="[object ArrayBuffer]",B_="[object DataView]",z_="[object Float32Array]",j_="[object Float64Array]",U_="[object Int8Array]",W_="[object Int16Array]",V_="[object Int32Array]",H_="[object Uint8Array]",K_="[object Uint8ClampedArray]",G_="[object Uint16Array]",q_="[object Uint32Array]",we={};we[z_]=we[j_]=we[U_]=we[W_]=we[V_]=we[H_]=we[K_]=we[G_]=we[q_]=!0;we[T_]=we[O_]=we[F_]=we[$_]=we[B_]=we[k_]=we[A_]=we[P_]=we[__]=we[M_]=we[N_]=we[I_]=we[D_]=we[R_]=we[L_]=!1;function Y_(t){return x_(t)&&C_(t.length)&&!!we[E_(t)]}var J_=Y_;function Q_(t){return function(e){return t(e)}}var Zo=Q_,lu={exports:{}};lu.exports;(function(t,e){var n=tb,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,l=function(){try{var a=i&&i.require&&i.require("util").types;return a||s&&s.binding&&s.binding("util")}catch{}}();t.exports=l})(lu,lu.exports);var Yh=lu.exports,X_=J_,Z_=Zo,My=Yh,Ny=My&&My.isTypedArray,eM=Ny?Z_(Ny):X_,Jh=eM;function tM(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var yb=tM,nM=Wh,rM=Ll,iM=Object.prototype,oM=iM.hasOwnProperty;function sM(t,e,n){var r=t[e];(!(oM.call(t,e)&&rM(r,n))||n===void 0&&!(e in t))&&nM(t,e,n)}var Qh=sM,lM=Qh,aM=Wh;function uM(t,e,n,r){var i=!n;n||(n={});for(var o=-1,s=e.length;++o-1&&t%1==0&&t1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&mN(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++rMath.random().toString(36).substring(7).split("").join("."),AN={INIT:`@@redux/INIT${$f()}`,REPLACE:`@@redux/REPLACE${$f()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$f()}`},au=AN;function Xh(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function Cb(t,e,n){if(typeof t!="function")throw new Error(Ke(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Ke(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ke(1));return n(Cb)(t,e)}let r=t,i=e,o=new Map,s=o,l=0,a=!1;function u(){s===o&&(s=new Map,o.forEach((S,m)=>{s.set(m,S)}))}function c(){if(a)throw new Error(Ke(3));return i}function f(S){if(typeof S!="function")throw new Error(Ke(4));if(a)throw new Error(Ke(5));let m=!0;u();const y=l++;return s.set(y,S),function(){if(m){if(a)throw new Error(Ke(6));m=!1,u(),s.delete(y),o=null}}}function d(S){if(!Xh(S))throw new Error(Ke(7));if(typeof S.type>"u")throw new Error(Ke(8));if(typeof S.type!="string")throw new Error(Ke(17));if(a)throw new Error(Ke(9));try{a=!0,i=r(i,S)}finally{a=!1}return(o=s).forEach(y=>{y()}),S}function p(S){if(typeof S!="function")throw new Error(Ke(10));r=S,d({type:au.REPLACE})}function h(){const S=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(Ke(11));function y(){const w=m;w.next&&w.next(c())}return y(),{unsubscribe:S(y)}},[By](){return this}}}return d({type:au.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:p,[By]:h}}function PN(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:au.INIT})>"u")throw new Error(Ke(12));if(typeof n(void 0,{type:au.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ke(13))})}function _N(t){const e=Object.keys(t),n={};for(let o=0;o"u")throw l&&l.type,new Error(Ke(14));u[f]=h,a=a||h!==p}return a=a||r.length!==Object.keys(s).length,a?u:s}}function uu(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function MN(...t){return e=>(n,r)=>{const i=e(n,r);let o=()=>{throw new Error(Ke(15))};const s={getState:i.getState,dispatch:(a,...u)=>o(a,...u)},l=t.map(a=>a(s));return o=uu(...l)(i.dispatch),{...i,dispatch:o}}}function NN(t){return Xh(t)&&"type"in t&&typeof t.type=="string"}var xb=Symbol.for("immer-nothing"),zy=Symbol.for("immer-draftable"),Ft=Symbol.for("immer-state");function cn(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Ao=Object.getPrototypeOf;function Si(t){return!!t&&!!t[Ft]}function bi(t){var e;return t?Tb(t)||Array.isArray(t)||!!t[zy]||!!((e=t.constructor)!=null&&e[zy])||bc(t)||wc(t):!1}var IN=Object.prototype.constructor.toString();function Tb(t){if(!t||typeof t!="object")return!1;const e=Ao(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===IN}function cu(t,e){Sc(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}function Sc(t){const e=t[Ft];return e?e.type_:Array.isArray(t)?1:bc(t)?2:wc(t)?3:0}function Qd(t,e){return Sc(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Ob(t,e,n){const r=Sc(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function DN(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function bc(t){return t instanceof Map}function wc(t){return t instanceof Set}function Yr(t){return t.copy_||t.base_}function Xd(t,e){if(bc(t))return new Map(t);if(wc(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);if(!e&&Tb(t))return Ao(t)?{...t}:Object.assign(Object.create(null),t);const n=Object.getOwnPropertyDescriptors(t);delete n[Ft];let r=Reflect.ownKeys(n);for(let i=0;i1&&(t.set=t.add=t.clear=t.delete=RN),Object.freeze(t),e&&Object.entries(t).forEach(([n,r])=>Zh(r,!0))),t}function RN(){cn(2)}function Ec(t){return Object.isFrozen(t)}var LN={};function wi(t){const e=LN[t];return e||cn(0,t),e}var rl;function $b(){return rl}function FN(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function jy(t,e){e&&(wi("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Zd(t){ep(t),t.drafts_.forEach(BN),t.drafts_=null}function ep(t){t===rl&&(rl=t.parent_)}function Uy(t){return rl=FN(rl,t)}function BN(t){const e=t[Ft];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Wy(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ft].modified_&&(Zd(e),cn(4)),bi(t)&&(t=fu(e,t),e.parent_||du(e,t)),e.patches_&&wi("Patches").generateReplacementPatches_(n[Ft].base_,t,e.patches_,e.inversePatches_)):t=fu(e,n,[]),Zd(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==xb?t:void 0}function fu(t,e,n){if(Ec(e))return e;const r=e[Ft];if(!r)return cu(e,(i,o)=>Vy(t,r,e,i,o,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return du(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),cu(o,(l,a)=>Vy(t,r,i,l,a,n,s)),du(t,i,!1),n&&t.patches_&&wi("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function Vy(t,e,n,r,i,o,s){if(Si(i)){const l=o&&e&&e.type_!==3&&!Qd(e.assigned_,r)?o.concat(r):void 0,a=fu(t,i,l);if(Ob(n,r,a),Si(a))t.canAutoFreeze_=!1;else return}else s&&n.add(i);if(bi(i)&&!Ec(i)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;fu(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&du(t,i)}}function du(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Zh(e,n)}function zN(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:$b(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=em;n&&(i=[r],o=il);const{revoke:s,proxy:l}=Proxy.revocable(i,o);return r.draft_=l,r.revoke_=s,l}var em={get(t,e){if(e===Ft)return t;const n=Yr(t);if(!Qd(n,e))return jN(t,n,e);const r=n[e];return t.finalized_||!bi(r)?r:r===kf(t.base_,e)?(Af(t),t.copy_[e]=np(r,t)):r},has(t,e){return e in Yr(t)},ownKeys(t){return Reflect.ownKeys(Yr(t))},set(t,e,n){const r=kb(Yr(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=kf(Yr(t),e),o=i==null?void 0:i[Ft];if(o&&o.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(DN(n,i)&&(n!==void 0||Qd(t.base_,e)))return!0;Af(t),tp(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return kf(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Af(t),tp(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Yr(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){cn(11)},getPrototypeOf(t){return Ao(t.base_)},setPrototypeOf(){cn(12)}},il={};cu(em,(t,e)=>{il[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});il.deleteProperty=function(t,e){return il.set.call(this,t,e,void 0)};il.set=function(t,e,n){return em.set.call(this,t[0],e,n,t[0])};function kf(t,e){const n=t[Ft];return(n?Yr(n):t)[e]}function jN(t,e,n){var i;const r=kb(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function kb(t,e){if(!(e in t))return;let n=Ao(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Ao(n)}}function tp(t){t.modified_||(t.modified_=!0,t.parent_&&tp(t.parent_))}function Af(t){t.copy_||(t.copy_=Xd(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var UN=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const o=n;n=e;const s=this;return function(a=o,...u){return s.produce(a,c=>n.call(this,c,...u))}}typeof n!="function"&&cn(6),r!==void 0&&typeof r!="function"&&cn(7);let i;if(bi(e)){const o=Uy(this),s=np(e,void 0);let l=!0;try{i=n(s),l=!1}finally{l?Zd(o):ep(o)}return jy(o,r),Wy(i,o)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===xb&&(i=void 0),this.autoFreeze_&&Zh(i,!0),r){const o=[],s=[];wi("Patches").generateReplacementPatches_(e,i,o,s),r(o,s)}return i}else cn(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(s,...l)=>this.produceWithPatches(s,a=>e(a,...l));let r,i;return[this.produce(e,n,(s,l)=>{r=s,i=l}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){bi(t)||cn(8),Si(t)&&(t=Ab(t));const e=Uy(this),n=np(t,void 0);return n[Ft].isManual_=!0,ep(e),n}finishDraft(t,e){const n=t&&t[Ft];(!n||!n.isManual_)&&cn(9);const{scope_:r}=n;return jy(r,e),Wy(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=wi("Patches").applyPatches_;return Si(t)?r(t,e):this.produce(t,i=>r(i,e))}};function np(t,e){const n=bc(t)?wi("MapSet").proxyMap_(t,e):wc(t)?wi("MapSet").proxySet_(t,e):zN(t,e);return(e?e.scope_:$b()).drafts_.push(n),n}function Ab(t){return Si(t)||cn(10,t),Pb(t)}function Pb(t){if(!bi(t)||Ec(t))return t;const e=t[Ft];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=Xd(t,e.scope_.immer_.useStrictShallowCopy_)}else n=Xd(t,!0);return cu(n,(r,i)=>{Ob(n,r,Pb(i))}),e&&(e.finalized_=!1),n}var Bt=new UN;Bt.produce;Bt.produceWithPatches.bind(Bt);Bt.setAutoFreeze.bind(Bt);Bt.setUseStrictShallowCopy.bind(Bt);Bt.applyPatches.bind(Bt);Bt.createDraft.bind(Bt);Bt.finishDraft.bind(Bt);function WN(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function VN(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function HN(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Hy=t=>Array.isArray(t)?t:[t];function KN(t){const e=Array.isArray(t[0])?t[0]:t;return HN(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function GN(t,e){const n=[],{length:r}=t;for(let i=0;i{n=ra(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function _b(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let o=0,s=0,l,a={},u=i.pop();typeof u=="object"&&(a=u,u=i.pop()),WN(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const c={...n,...a},{memoize:f,memoizeOptions:d=[],argsMemoize:p=tm,argsMemoizeOptions:h=[],devModeChecks:v={}}=c,S=Hy(d),m=Hy(h),y=KN(i),g=f(function(){return o++,u.apply(null,arguments)},...S),w=p(function(){s++;const x=GN(y,arguments);return l=g.apply(null,x),l},...m);return Object.assign(w,{resultFunc:u,memoizedResultFunc:g,dependencies:y,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>l,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:f,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var QN=_b(tm),XN=Object.assign((t,e=QN)=>{VN(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(o=>t[o]);return e(r,(...o)=>o.reduce((s,l,a)=>(s[n[a]]=l,s),{}))},{withTypes:()=>XN});function Mb(t){return({dispatch:n,getState:r})=>i=>o=>typeof o=="function"?o(n,r,t):i(o)}var ZN=Mb(),eI=Mb,tI=(...t)=>{const e=_b(...t),n=Object.assign((...r)=>{const i=e(...r),o=(s,...l)=>i(Si(s)?Ab(s):s,...l);return Object.assign(o,i),o},{withTypes:()=>n});return n};tI(tm);var nI=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?uu:uu.apply(null,arguments)};function Cc(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(Bl(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>NN(r)&&r.type===t,n}var Nb=class As extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,As.prototype)}static get[Symbol.species](){return As}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new As(...e[0].concat(this)):new As(...e.concat(this))}};function rI(t){return typeof t=="boolean"}var iI=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=e??{};let s=new Nb;return n&&(rI(n)?s.push(ZN):s.push(eI(n.extraArgument))),s},oI="RTK_autoBatch",Ib=t=>e=>{setTimeout(e,t)},sI=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Ib(10),lI=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,o=!1,s=!1;const l=new Set,a=t.type==="tick"?queueMicrotask:t.type==="raf"?sI:t.type==="callback"?t.queueNotification:Ib(t.timeout),u=()=>{s=!1,o&&(o=!1,l.forEach(c=>c()))};return Object.assign({},r,{subscribe(c){const f=()=>i&&c(),d=r.subscribe(f);return l.add(c),()=>{d(),l.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[oI]),o=!i,o&&(s||(s=!0,a(u))),r.dispatch(c)}finally{i=!0}}})},aI=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Nb(t);return r&&i.push(lI(typeof r=="object"?r:void 0)),i},uI=!0;function GX(t){const e=iI(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:o=void 0,enhancers:s=void 0}=t||{};let l;if(typeof n=="function")l=n;else if(Xh(n))l=_N(n);else throw new Error(Bl(1));let a;typeof r=="function"?a=r(e):a=e();let u=uu;i&&(u=nI({trace:!uI,...typeof i=="object"&&i}));const c=MN(...a),f=aI(c);let d=typeof s=="function"?s(f):f();const p=u(...d);return Cb(l,o,p)}var cI="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",fI=(t=21)=>{let e="",n=t;for(;n--;)e+=cI[Math.random()*64|0];return e},dI=(t,e)=>{if(typeof t!="function")throw new Error(Bl(32))},nm="listenerMiddleware",pI=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:o}=t;if(e)i=Cc(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(Bl(21));return dI(o),{predicate:i,type:e,effect:o}},hI=Object.assign(t=>{const{type:e,predicate:n,effect:r}=pI(t);return{id:fI(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Bl(22))}}},{withTypes:()=>hI}),mI=Object.assign(Cc(`${nm}/add`),{withTypes:()=>mI});Cc(`${nm}/removeAll`);var gI=Object.assign(Cc(`${nm}/remove`),{withTypes:()=>gI});function Bl(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var Db={},rm={};Object.defineProperty(rm,"__esModule",{value:!0});rm.default=vI;function yI(){return"@@is-valid-redux-reducer/"+Math.random().toString(36).substring(7).split("").join("\\")}function vI(t){var e=arguments.length<=1||arguments[1]===void 0?!1:arguments[1];if(typeof t!="function"){if(e)throw new Error("Reducer must be a function.");return!1}var n=t(void 0,{type:yI()});if(typeof n>"u"){if(e)throw new Error("Reducer must return the initial state if the state is undefined.");return!1}return!0}Object.defineProperty(Db,"__esModule",{value:!0});var qX=Db.default=EI,SI=rm,bI=wI(SI);function wI(t){return t&&t.__esModule?t:{default:t}}function EI(t){var e=Object.keys(t),n=void 0;try{for(var r=0;r