@beterdichtbij/component-library 0.27.4 → 0.27.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,7 +8,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
8
8
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var E=!0,N=!1,I;return{s:function(){w=A[Symbol.iterator]()},n:function(){var L=w.next();return E=L.done,L},e:function(L){N=!0,I=L},f:function(){try{!E&&w.return!=null&&w.return()}finally{if(N)throw I}}}}function v(A,M){if(A){if(typeof A=="string")return C(A,M);var w=Object.prototype.toString.call(A).slice(8,-1);if(w==="Object"&&A.constructor&&(w=A.constructor.name),w==="Map"||w==="Set")return Array.from(A);if(w==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(w))return C(A,M)}}function C(A,M){(M==null||M>A.length)&&(M=A.length);for(var w=0,O=new Array(M);w<M;w++)O[w]=A[w];return O}var S={url:null,method:"post",withCredentials:!1,timeout:null,parallelUploads:2,uploadMultiple:!1,chunking:!1,forceChunking:!1,chunkSize:2e6,parallelChunkUploads:!1,retryChunks:!1,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,disablePreviews:!1,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:!1,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function(){},params:function(M,w,O){if(O)return{dzuuid:O.file.upload.uuid,dzchunkindex:O.index,dztotalfilesize:O.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:O.file.upload.totalChunkCount,dzchunkbyteoffset:O.index*this.options.chunkSize}},accept:function(M,w){return w()},chunksUploaded:function(M,w){w()},fallback:function(){var M;this.element.className="".concat(this.element.className," dz-browser-not-supported");var w=g(this.element.getElementsByTagName("div"),!0),O;try{for(w.s();!(O=w.n()).done;){var y=O.value;if(/(^| )dz-message($| )/.test(y.className)){M=y,y.className="dz-message";break}}}catch(N){w.e(N)}finally{w.f()}M||(M=j.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(M));var E=M.getElementsByTagName("span")[0];return E&&(E.textContent!=null?E.textContent=this.options.dictFallbackMessage:E.innerText!=null&&(E.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(M,w,O,y){var E={srcX:0,srcY:0,srcWidth:M.width,srcHeight:M.height},N=M.width/M.height;w==null&&O==null?(w=E.srcWidth,O=E.srcHeight):w==null?w=O*N:O==null&&(O=w/N),w=Math.min(w,E.srcWidth),O=Math.min(O,E.srcHeight);var I=w/O;if(E.srcWidth>w||E.srcHeight>O)if(y==="crop")N>I?(E.srcHeight=M.height,E.srcWidth=E.srcHeight*I):(E.srcWidth=M.width,E.srcHeight=E.srcWidth/I);else if(y==="contain")N>I?O=w/N:w=O*N;else throw new Error("Unknown resizeMethod '".concat(y,"'"));return E.srcX=(M.width-E.srcWidth)/2,E.srcY=(M.height-E.srcHeight)/2,E.trgWidth=w,E.trgHeight=O,E},transformFile:function(M,w){return(this.options.resizeWidth||this.options.resizeHeight)&&M.type.match(/image.*/)?this.resizeImage(M,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,w):w(M)},previewTemplate:m,drop:function(M){return this.element.classList.remove("dz-drag-hover")},dragstart:function(M){},dragend:function(M){return this.element.classList.remove("dz-drag-hover")},dragenter:function(M){return this.element.classList.add("dz-drag-hover")},dragover:function(M){return this.element.classList.add("dz-drag-hover")},dragleave:function(M){return this.element.classList.remove("dz-drag-hover")},paste:function(M){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(M){var w=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){M.previewElement=j.createElement(this.options.previewTemplate.trim()),M.previewTemplate=M.previewElement,this.previewsContainer.appendChild(M.previewElement);var O=g(M.previewElement.querySelectorAll("[data-dz-name]"),!0),y;try{for(O.s();!(y=O.n()).done;){var E=y.value;E.textContent=M.name}}catch(U){O.e(U)}finally{O.f()}var N=g(M.previewElement.querySelectorAll("[data-dz-size]"),!0),I;try{for(N.s();!(I=N.n()).done;)E=I.value,E.innerHTML=this.filesize(M.size)}catch(U){N.e(U)}finally{N.f()}this.options.addRemoveLinks&&(M._removeLink=j.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>")),M.previewElement.appendChild(M._removeLink));var _=function(K){return K.preventDefault(),K.stopPropagation(),M.status===j.UPLOADING?j.confirm(w.options.dictCancelUploadConfirmation,function(){return w.removeFile(M)}):w.options.dictRemoveFileConfirmation?j.confirm(w.options.dictRemoveFileConfirmation,function(){return w.removeFile(M)}):w.removeFile(M)},L=g(M.previewElement.querySelectorAll("[data-dz-remove]"),!0),z;try{for(L.s();!(z=L.n()).done;){var W=z.value;W.addEventListener("click",_)}}catch(U){L.e(U)}finally{L.f()}}},removedfile:function(M){return M.previewElement!=null&&M.previewElement.parentNode!=null&&M.previewElement.parentNode.removeChild(M.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(M,w){if(M.previewElement){M.previewElement.classList.remove("dz-file-preview");var O=g(M.previewElement.querySelectorAll("[data-dz-thumbnail]"),!0),y;try{for(O.s();!(y=O.n()).done;){var E=y.value;E.alt=M.name,E.src=w}}catch(N){O.e(N)}finally{O.f()}return setTimeout(function(){return M.previewElement.classList.add("dz-image-preview")},1)}},error:function(M,w){if(M.previewElement){M.previewElement.classList.add("dz-error"),typeof w!="string"&&w.error&&(w=w.error);var O=g(M.previewElement.querySelectorAll("[data-dz-errormessage]"),!0),y;try{for(O.s();!(y=O.n()).done;){var E=y.value;E.textContent=w}}catch(N){O.e(N)}finally{O.f()}}},errormultiple:function(){},processing:function(M){if(M.previewElement&&(M.previewElement.classList.add("dz-processing"),M._removeLink))return M._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(M,w,O){if(M.previewElement){var y=g(M.previewElement.querySelectorAll("[data-dz-uploadprogress]"),!0),E;try{for(y.s();!(E=y.n()).done;){var N=E.value;N.nodeName==="PROGRESS"?N.value=w:N.style.width="".concat(w,"%")}}catch(I){y.e(I)}finally{y.f()}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(M){if(M.previewElement)return M.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(M){return this.emit("error",M,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(M){if(M._removeLink&&(M._removeLink.innerHTML=this.options.dictRemoveFile),M.previewElement)return M.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}},k=S;function b(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?b=function(w){return typeof w}:b=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},b(A)}function D(A,M){var w;if(typeof Symbol>"u"||A[Symbol.iterator]==null){if(Array.isArray(A)||(w=x(A))||M&&A&&typeof A.length=="number"){w&&(A=w);var O=0,y=function(){};return{s:y,n:function(){return O>=A.length?{done:!0}:{done:!1,value:A[O++]}},e:function(L){throw L},f:y}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
9
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var E=!0,N=!1,I;return{s:function(){w=A[Symbol.iterator]()},n:function(){var L=w.next();return E=L.done,L},e:function(L){N=!0,I=L},f:function(){try{!E&&w.return!=null&&w.return()}finally{if(N)throw I}}}}function x(A,M){if(A){if(typeof A=="string")return P(A,M);var w=Object.prototype.toString.call(A).slice(8,-1);if(w==="Object"&&A.constructor&&(w=A.constructor.name),w==="Map"||w==="Set")return Array.from(A);if(w==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(w))return P(A,M)}}function P(A,M){(M==null||M>A.length)&&(M=A.length);for(var w=0,O=new Array(M);w<M;w++)O[w]=A[w];return O}function F(A,M){if(!(A instanceof M))throw new TypeError("Cannot call a class as a function")}function V(A,M){for(var w=0;w<M.length;w++){var O=M[w];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(A,O.key,O)}}function $(A,M,w){return M&&V(A.prototype,M),w&&V(A,w),A}function B(A,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(M&&M.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),M&&R(A,M)}function R(A,M){return R=Object.setPrototypeOf||function(O,y){return O.__proto__=y,O},R(A,M)}function H(A){var M=X();return function(){var O=oe(A),y;if(M){var E=oe(this).constructor;y=Reflect.construct(O,arguments,E)}else y=O.apply(this,arguments);return Y(this,y)}}function Y(A,M){return M&&(b(M)==="object"||typeof M=="function")?M:Z(A)}function Z(A){if(A===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function X(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function oe(A){return oe=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},oe(A)}var j=function(A){B(w,A);var M=H(w);function w(O,y){var E;F(this,w),E=M.call(this);var N,I;if(E.element=O,E.version=w.version,E.clickableElements=[],E.listeners=[],E.files=[],typeof E.element=="string"&&(E.element=document.querySelector(E.element)),!E.element||E.element.nodeType==null)throw new Error("Invalid dropzone element.");if(E.element.dropzone)throw new Error("Dropzone already attached.");w.instances.push(Z(E)),E.element.dropzone=Z(E);var _=(I=w.optionsForElement(E.element))!=null?I:{};if(E.options=w.extend({},k,_,y??{}),E.options.previewTemplate=E.options.previewTemplate.replace(/\n*/g,""),E.options.forceFallback||!w.isBrowserSupported())return Y(E,E.options.fallback.call(Z(E)));if(E.options.url==null&&(E.options.url=E.element.getAttribute("action")),!E.options.url)throw new Error("No URL provided.");if(E.options.acceptedFiles&&E.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");if(E.options.uploadMultiple&&E.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");return E.options.acceptedMimeTypes&&(E.options.acceptedFiles=E.options.acceptedMimeTypes,delete E.options.acceptedMimeTypes),E.options.renameFilename!=null&&(E.options.renameFile=function(L){return E.options.renameFilename.call(Z(E),L.name,L)}),typeof E.options.method=="string"&&(E.options.method=E.options.method.toUpperCase()),(N=E.getExistingFallback())&&N.parentNode&&N.parentNode.removeChild(N),E.options.previewsContainer!==!1&&(E.options.previewsContainer?E.previewsContainer=w.getElement(E.options.previewsContainer,"previewsContainer"):E.previewsContainer=E.element),E.options.clickable&&(E.options.clickable===!0?E.clickableElements=[E.element]:E.clickableElements=w.getElements(E.options.clickable,"clickable")),E.init(),E}return $(w,[{key:"getAcceptedFiles",value:function(){return this.files.filter(function(y){return y.accepted}).map(function(y){return y})}},{key:"getRejectedFiles",value:function(){return this.files.filter(function(y){return!y.accepted}).map(function(y){return y})}},{key:"getFilesWithStatus",value:function(y){return this.files.filter(function(E){return E.status===y}).map(function(E){return E})}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(w.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(w.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(w.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter(function(y){return y.status===w.UPLOADING||y.status===w.QUEUED}).map(function(y){return y})}},{key:"init",value:function(){var y=this;if(this.element.tagName==="form"&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(w.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>"))),this.clickableElements.length){var E=function W(){y.hiddenFileInput&&y.hiddenFileInput.parentNode.removeChild(y.hiddenFileInput),y.hiddenFileInput=document.createElement("input"),y.hiddenFileInput.setAttribute("type","file"),(y.options.maxFiles===null||y.options.maxFiles>1)&&y.hiddenFileInput.setAttribute("multiple","multiple"),y.hiddenFileInput.className="dz-hidden-input",y.options.acceptedFiles!==null&&y.hiddenFileInput.setAttribute("accept",y.options.acceptedFiles),y.options.capture!==null&&y.hiddenFileInput.setAttribute("capture",y.options.capture),y.hiddenFileInput.setAttribute("tabindex","-1"),y.hiddenFileInput.style.visibility="hidden",y.hiddenFileInput.style.position="absolute",y.hiddenFileInput.style.top="0",y.hiddenFileInput.style.left="0",y.hiddenFileInput.style.height="0",y.hiddenFileInput.style.width="0",w.getElement(y.options.hiddenInputContainer,"hiddenInputContainer").appendChild(y.hiddenFileInput),y.hiddenFileInput.addEventListener("change",function(){var U=y.hiddenFileInput.files;if(U.length){var K=D(U,!0),G;try{for(K.s();!(G=K.n()).done;){var q=G.value;y.addFile(q)}}catch(ue){K.e(ue)}finally{K.f()}}y.emit("addedfiles",U),W()})};E()}this.URL=window.URL!==null?window.URL:window.webkitURL;var N=D(this.events,!0),I;try{for(N.s();!(I=N.n()).done;){var _=I.value;this.on(_,this.options[_])}}catch(W){N.e(W)}finally{N.f()}this.on("uploadprogress",function(){return y.updateTotalUploadProgress()}),this.on("removedfile",function(){return y.updateTotalUploadProgress()}),this.on("canceled",function(W){return y.emit("complete",W)}),this.on("complete",function(W){if(y.getAddedFiles().length===0&&y.getUploadingFiles().length===0&&y.getQueuedFiles().length===0)return setTimeout(function(){return y.emit("queuecomplete")},0)});var L=function(U){if(U.dataTransfer.types){for(var K=0;K<U.dataTransfer.types.length;K++)if(U.dataTransfer.types[K]==="Files")return!0}return!1},z=function(U){if(L(U))return U.stopPropagation(),U.preventDefault?U.preventDefault():U.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:function(U){return y.emit("dragstart",U)},dragenter:function(U){return z(U),y.emit("dragenter",U)},dragover:function(U){var K;try{K=U.dataTransfer.effectAllowed}catch{}return U.dataTransfer.dropEffect=K==="move"||K==="linkMove"?"move":"copy",z(U),y.emit("dragover",U)},dragleave:function(U){return y.emit("dragleave",U)},drop:function(U){return z(U),y.drop(U)},dragend:function(U){return y.emit("dragend",U)}}}],this.clickableElements.forEach(function(W){return y.listeners.push({element:W,events:{click:function(K){return(W!==y.element||K.target===y.element||w.elementInside(K.target,y.element.querySelector(".dz-message")))&&y.hiddenFileInput.click(),!0}}})}),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),this.hiddenFileInput!=null&&this.hiddenFileInput.parentNode&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,w.instances.splice(w.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var y,E=0,N=0,I=this.getActiveFiles();if(I.length){var _=D(this.getActiveFiles(),!0),L;try{for(_.s();!(L=_.n()).done;){var z=L.value;E+=z.upload.bytesSent,N+=z.upload.total}}catch(W){_.e(W)}finally{_.f()}y=100*E/N}else y=100;return this.emit("totaluploadprogress",y,N,E)}},{key:"_getParamName",value:function(y){return typeof this.options.paramName=="function"?this.options.paramName(y):"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(y,"]"):"")}},{key:"_renameFile",value:function(y){return typeof this.options.renameFile!="function"?y.name:this.options.renameFile(y)}},{key:"getFallbackForm",value:function(){var y,E;if(y=this.getExistingFallback())return y;var N='<div class="dz-fallback">';this.options.dictFallbackText&&(N+="<p>".concat(this.options.dictFallbackText,"</p>")),N+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':void 0,' /><input type="submit" value="Upload!"></div>');var I=w.createElement(N);return this.element.tagName!=="FORM"?(E=w.createElement('<form action="'.concat(this.options.url,'" enctype="multipart/form-data" method="').concat(this.options.method,'"></form>')),E.appendChild(I)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),E??I}},{key:"getExistingFallback",value:function(){for(var y=function(z){var W=D(z,!0),U;try{for(W.s();!(U=W.n()).done;){var K=U.value;if(/(^| )fallback($| )/.test(K.className))return K}}catch(G){W.e(G)}finally{W.f()}},E=0,N=["div","form"];E<N.length;E++){var I=N[E],_;if(_=y(this.element.getElementsByTagName(I)))return _}}},{key:"setupEventListeners",value:function(){return this.listeners.map(function(y){return function(){var E=[];for(var N in y.events){var I=y.events[N];E.push(y.element.addEventListener(N,I,!1))}return E}()})}},{key:"removeEventListeners",value:function(){return this.listeners.map(function(y){return function(){var E=[];for(var N in y.events){var I=y.events[N];E.push(y.element.removeEventListener(N,I,!1))}return E}()})}},{key:"disable",value:function(){var y=this;return this.clickableElements.forEach(function(E){return E.classList.remove("dz-clickable")}),this.removeEventListeners(),this.disabled=!0,this.files.map(function(E){return y.cancelUpload(E)})}},{key:"enable",value:function(){return delete this.disabled,this.clickableElements.forEach(function(y){return y.classList.add("dz-clickable")}),this.setupEventListeners()}},{key:"filesize",value:function(y){var E=0,N="b";if(y>0){for(var I=["tb","gb","mb","kb","b"],_=0;_<I.length;_++){var L=I[_],z=Math.pow(this.options.filesizeBase,4-_)/10;if(y>=z){E=y/Math.pow(this.options.filesizeBase,4-_),N=L;break}}E=Math.round(10*E)/10}return"<strong>".concat(E,"</strong> ").concat(this.options.dictFileSizeUnits[N])}},{key:"_updateMaxFilesReachedClass",value:function(){return this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(y){if(y.dataTransfer){this.emit("drop",y);for(var E=[],N=0;N<y.dataTransfer.files.length;N++)E[N]=y.dataTransfer.files[N];if(E.length){var I=y.dataTransfer.items;I&&I.length&&I[0].webkitGetAsEntry!=null?this._addFilesFromItems(I):this.handleFiles(E)}this.emit("addedfiles",E)}}},{key:"paste",value:function(y){if(xe(y!=null?y.clipboardData:void 0,function(N){return N.items})!=null){this.emit("paste",y);var E=y.clipboardData.items;if(E.length)return this._addFilesFromItems(E)}}},{key:"handleFiles",value:function(y){var E=D(y,!0),N;try{for(E.s();!(N=E.n()).done;){var I=N.value;this.addFile(I)}}catch(_){E.e(_)}finally{E.f()}}},{key:"_addFilesFromItems",value:function(y){var E=this;return function(){var N=[],I=D(y,!0),_;try{for(I.s();!(_=I.n()).done;){var L=_.value,z;L.webkitGetAsEntry!=null&&(z=L.webkitGetAsEntry())?z.isFile?N.push(E.addFile(L.getAsFile())):z.isDirectory?N.push(E._addFilesFromDirectory(z,z.name)):N.push(void 0):L.getAsFile!=null&&(L.kind==null||L.kind==="file")?N.push(E.addFile(L.getAsFile())):N.push(void 0)}}catch(W){I.e(W)}finally{I.f()}return N}()}},{key:"_addFilesFromDirectory",value:function(y,E){var N=this,I=y.createReader(),_=function(W){return Oe(console,"log",function(U){return U.log(W)})},L=function z(){return I.readEntries(function(W){if(W.length>0){var U=D(W,!0),K;try{for(U.s();!(K=U.n()).done;){var G=K.value;G.isFile?G.file(function(q){if(!(N.options.ignoreHiddenFiles&&q.name.substring(0,1)==="."))return q.fullPath="".concat(E,"/").concat(q.name),N.addFile(q)}):G.isDirectory&&N._addFilesFromDirectory(G,"".concat(E,"/").concat(G.name))}}catch(q){U.e(q)}finally{U.f()}z()}return null},_)};return L()}},{key:"accept",value:function(y,E){this.options.maxFilesize&&y.size>this.options.maxFilesize*1024*1024?E(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(y.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):w.isValidFile(y,this.options.acceptedFiles)?this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(E(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",y)):this.options.accept.call(this,y,E):E(this.options.dictInvalidFileType)}},{key:"addFile",value:function(y){var E=this;y.upload={uuid:w.uuidv4(),progress:0,total:y.size,bytesSent:0,filename:this._renameFile(y)},this.files.push(y),y.status=w.ADDED,this.emit("addedfile",y),this._enqueueThumbnail(y),this.accept(y,function(N){N?(y.accepted=!1,E._errorProcessing([y],N)):(y.accepted=!0,E.options.autoQueue&&E.enqueueFile(y)),E._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(y){var E=D(y,!0),N;try{for(E.s();!(N=E.n()).done;){var I=N.value;this.enqueueFile(I)}}catch(_){E.e(_)}finally{E.f()}return null}},{key:"enqueueFile",value:function(y){var E=this;if(y.status===w.ADDED&&y.accepted===!0){if(y.status=w.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return E.processQueue()},0)}else throw new Error("This file can't be queued because it has already been processed or was rejected.")}},{key:"_enqueueThumbnail",value:function(y){var E=this;if(this.options.createImageThumbnails&&y.type.match(/image.*/)&&y.size<=this.options.maxThumbnailFilesize*1024*1024)return this._thumbnailQueue.push(y),setTimeout(function(){return E._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var y=this;if(!(this._processingThumbnail||this._thumbnailQueue.length===0)){this._processingThumbnail=!0;var E=this._thumbnailQueue.shift();return this.createThumbnail(E,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(N){return y.emit("thumbnail",E,N),y._processingThumbnail=!1,y._processThumbnailQueue()})}}},{key:"removeFile",value:function(y){if(y.status===w.UPLOADING&&this.cancelUpload(y),this.files=ce(this.files,y),this.emit("removedfile",y),this.files.length===0)return this.emit("reset")}},{key:"removeAllFiles",value:function(y){y==null&&(y=!1);var E=D(this.files.slice(),!0),N;try{for(E.s();!(N=E.n()).done;){var I=N.value;(I.status!==w.UPLOADING||y)&&this.removeFile(I)}}catch(_){E.e(_)}finally{E.f()}return null}},{key:"resizeImage",value:function(y,E,N,I,_){var L=this;return this.createThumbnail(y,E,N,I,!0,function(z,W){if(W==null)return _(y);var U=L.options.resizeMimeType;U==null&&(U=y.type);var K=W.toDataURL(U,L.options.resizeQuality);return(U==="image/jpeg"||U==="image/jpg")&&(K=Ee.restore(y.dataURL,K)),_(w.dataURItoBlob(K))})}},{key:"createThumbnail",value:function(y,E,N,I,_,L){var z=this,W=new FileReader;W.onload=function(){if(y.dataURL=W.result,y.type==="image/svg+xml"){L!=null&&L(W.result);return}z.createThumbnailFromUrl(y,E,N,I,_,L)},W.readAsDataURL(y)}},{key:"displayExistingFile",value:function(y,E,N,I){var _=this,L=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;if(this.emit("addedfile",y),this.emit("complete",y),!L)this.emit("thumbnail",y,E),N&&N();else{var z=function(U){_.emit("thumbnail",y,U),N&&N()};y.dataURL=E,this.createThumbnailFromUrl(y,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,z,I)}}},{key:"createThumbnailFromUrl",value:function(y,E,N,I,_,L,z){var W=this,U=document.createElement("img");return z&&(U.crossOrigin=z),_=getComputedStyle(document.body).imageOrientation=="from-image"?!1:_,U.onload=function(){var K=function(q){return q(1)};return typeof EXIF<"u"&&EXIF!==null&&_&&(K=function(q){return EXIF.getData(U,function(){return q(EXIF.getTag(this,"Orientation"))})}),K(function(G){y.width=U.width,y.height=U.height;var q=W.options.resize.call(W,y,E,N,I),ue=document.createElement("canvas"),ge=ue.getContext("2d");switch(ue.width=q.trgWidth,ue.height=q.trgHeight,G>4&&(ue.width=q.trgHeight,ue.height=q.trgWidth),G){case 2:ge.translate(ue.width,0),ge.scale(-1,1);break;case 3:ge.translate(ue.width,ue.height),ge.rotate(Math.PI);break;case 4:ge.translate(0,ue.height),ge.scale(1,-1);break;case 5:ge.rotate(.5*Math.PI),ge.scale(1,-1);break;case 6:ge.rotate(.5*Math.PI),ge.translate(0,-ue.width);break;case 7:ge.rotate(.5*Math.PI),ge.translate(ue.height,-ue.width),ge.scale(-1,1);break;case 8:ge.rotate(-.5*Math.PI),ge.translate(-ue.height,0);break}we(ge,U,q.srcX!=null?q.srcX:0,q.srcY!=null?q.srcY:0,q.srcWidth,q.srcHeight,q.trgX!=null?q.trgX:0,q.trgY!=null?q.trgY:0,q.trgWidth,q.trgHeight);var Ne=ue.toDataURL("image/png");if(L!=null)return L(Ne,ue)})},L!=null&&(U.onerror=L),U.src=y.dataURL}},{key:"processQueue",value:function(){var y=this.options.parallelUploads,E=this.getUploadingFiles().length,N=E;if(!(E>=y)){var I=this.getQueuedFiles();if(I.length>0){if(this.options.uploadMultiple)return this.processFiles(I.slice(0,y-E));for(;N<y;){if(!I.length)return;this.processFile(I.shift()),N++}}}}},{key:"processFile",value:function(y){return this.processFiles([y])}},{key:"processFiles",value:function(y){var E=D(y,!0),N;try{for(E.s();!(N=E.n()).done;){var I=N.value;I.processing=!0,I.status=w.UPLOADING,this.emit("processing",I)}}catch(_){E.e(_)}finally{E.f()}return this.options.uploadMultiple&&this.emit("processingmultiple",y),this.uploadFiles(y)}},{key:"_getFilesWithXhr",value:function(y){return this.files.filter(function(E){return E.xhr===y}).map(function(E){return E})}},{key:"cancelUpload",value:function(y){if(y.status===w.UPLOADING){var E=this._getFilesWithXhr(y.xhr),N=D(E,!0),I;try{for(N.s();!(I=N.n()).done;){var _=I.value;_.status=w.CANCELED}}catch(U){N.e(U)}finally{N.f()}typeof y.xhr<"u"&&y.xhr.abort();var L=D(E,!0),z;try{for(L.s();!(z=L.n()).done;){var W=z.value;this.emit("canceled",W)}}catch(U){L.e(U)}finally{L.f()}this.options.uploadMultiple&&this.emit("canceledmultiple",E)}else(y.status===w.ADDED||y.status===w.QUEUED)&&(y.status=w.CANCELED,this.emit("canceled",y),this.options.uploadMultiple&&this.emit("canceledmultiple",[y]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(y){if(typeof y=="function"){for(var E=arguments.length,N=new Array(E>1?E-1:0),I=1;I<E;I++)N[I-1]=arguments[I];return y.apply(this,N)}return y}},{key:"uploadFile",value:function(y){return this.uploadFiles([y])}},{key:"uploadFiles",value:function(y){var E=this;this._transformFiles(y,function(N){if(E.options.chunking){var I=N[0];y[0].upload.chunked=E.options.chunking&&(E.options.forceChunking||I.size>E.options.chunkSize),y[0].upload.totalChunkCount=Math.ceil(I.size/E.options.chunkSize)}if(y[0].upload.chunked){var _=y[0],L=N[0];_.upload.chunks=[];var z=function(){for(var q=0;_.upload.chunks[q]!==void 0;)q++;if(!(q>=_.upload.totalChunkCount)){var ue=q*E.options.chunkSize,ge=Math.min(ue+E.options.chunkSize,L.size),Ne={name:E._getParamName(0),data:L.webkitSlice?L.webkitSlice(ue,ge):L.slice(ue,ge),filename:_.upload.filename,chunkIndex:q};_.upload.chunks[q]={file:_,index:q,dataBlock:Ne,status:w.UPLOADING,progress:0,retries:0},E._uploadData(y,[Ne])}};if(_.upload.finishedChunkUpload=function(G,q){var ue=!0;G.status=w.SUCCESS,G.dataBlock=null,G.xhr=null;for(var ge=0;ge<_.upload.totalChunkCount;ge++){if(_.upload.chunks[ge]===void 0)return z();_.upload.chunks[ge].status!==w.SUCCESS&&(ue=!1)}ue&&E.options.chunksUploaded(_,function(){E._finished(y,q,null)})},E.options.parallelChunkUploads)for(var W=0;W<_.upload.totalChunkCount;W++)z();else z()}else{for(var U=[],K=0;K<y.length;K++)U[K]={name:E._getParamName(K),data:N[K],filename:y[K].upload.filename};E._uploadData(y,U)}})}},{key:"_getChunk",value:function(y,E){for(var N=0;N<y.upload.totalChunkCount;N++)if(y.upload.chunks[N]!==void 0&&y.upload.chunks[N].xhr===E)return y.upload.chunks[N]}},{key:"_uploadData",value:function(y,E){var N=this,I=new XMLHttpRequest,_=D(y,!0),L;try{for(_.s();!(L=_.n()).done;){var z=L.value;z.xhr=I}}catch(le){_.e(le)}finally{_.f()}y[0].upload.chunked&&(y[0].upload.chunks[E[0].chunkIndex].xhr=I);var W=this.resolveOption(this.options.method,y),U=this.resolveOption(this.options.url,y);I.open(W,U,!0);var K=this.resolveOption(this.options.timeout,y);K&&(I.timeout=this.resolveOption(this.options.timeout,y)),I.withCredentials=!!this.options.withCredentials,I.onload=function(le){N._finishedUploading(y,I,le)},I.ontimeout=function(){N._handleUploadError(y,I,"Request timedout after ".concat(N.options.timeout/1e3," seconds"))},I.onerror=function(){N._handleUploadError(y,I)};var G=I.upload!=null?I.upload:I;G.onprogress=function(le){return N._updateFilesUploadProgress(y,I,le)};var q={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};this.options.headers&&w.extend(q,this.options.headers);for(var ue in q){var ge=q[ue];ge&&I.setRequestHeader(ue,ge)}var Ne=new FormData;if(this.options.params){var Fe=this.options.params;typeof Fe=="function"&&(Fe=Fe.call(this,y,I,y[0].upload.chunked?this._getChunk(y[0],I):null));for(var $e in Fe){var Ie=Fe[$e];if(Array.isArray(Ie))for(var Ke=0;Ke<Ie.length;Ke++)Ne.append($e,Ie[Ke]);else Ne.append($e,Ie)}}var gt=D(y,!0),tt;try{for(gt.s();!(tt=gt.n()).done;){var Cn=tt.value;this.emit("sending",Cn,I,Ne)}}catch(le){gt.e(le)}finally{gt.f()}this.options.uploadMultiple&&this.emit("sendingmultiple",y,I,Ne),this._addFormElementData(Ne);for(var J=0;J<E.length;J++){var ae=E[J];Ne.append(ae.name,ae.data,ae.filename)}this.submitRequest(I,Ne,y)}},{key:"_transformFiles",value:function(y,E){for(var N=this,I=[],_=0,L=function(U){N.options.transformFile.call(N,y[U],function(K){I[U]=K,++_===y.length&&E(I)})},z=0;z<y.length;z++)L(z)}},{key:"_addFormElementData",value:function(y){if(this.element.tagName==="FORM"){var E=D(this.element.querySelectorAll("input, textarea, select, button"),!0),N;try{for(E.s();!(N=E.n()).done;){var I=N.value,_=I.getAttribute("name"),L=I.getAttribute("type");if(L&&(L=L.toLowerCase()),!(typeof _>"u"||_===null))if(I.tagName==="SELECT"&&I.hasAttribute("multiple")){var z=D(I.options,!0),W;try{for(z.s();!(W=z.n()).done;){var U=W.value;U.selected&&y.append(_,U.value)}}catch(K){z.e(K)}finally{z.f()}}else(!L||L!=="checkbox"&&L!=="radio"||I.checked)&&y.append(_,I.value)}}catch(K){E.e(K)}finally{E.f()}}}},{key:"_updateFilesUploadProgress",value:function(y,E,N){if(y[0].upload.chunked){var z=y[0],W=this._getChunk(z,E);N?(W.progress=100*N.loaded/N.total,W.total=N.total,W.bytesSent=N.loaded):(W.progress=100,W.bytesSent=W.total),z.upload.progress=0,z.upload.total=0,z.upload.bytesSent=0;for(var U=0;U<z.upload.totalChunkCount;U++)z.upload.chunks[U]&&typeof z.upload.chunks[U].progress<"u"&&(z.upload.progress+=z.upload.chunks[U].progress,z.upload.total+=z.upload.chunks[U].total,z.upload.bytesSent+=z.upload.chunks[U].bytesSent);z.upload.progress=z.upload.progress/z.upload.totalChunkCount,this.emit("uploadprogress",z,z.upload.progress,z.upload.bytesSent)}else{var I=D(y,!0),_;try{for(I.s();!(_=I.n()).done;){var L=_.value;L.upload.total&&L.upload.bytesSent&&L.upload.bytesSent==L.upload.total||(N?(L.upload.progress=100*N.loaded/N.total,L.upload.total=N.total,L.upload.bytesSent=N.loaded):(L.upload.progress=100,L.upload.bytesSent=L.upload.total),this.emit("uploadprogress",L,L.upload.progress,L.upload.bytesSent))}}catch(K){I.e(K)}finally{I.f()}}}},{key:"_finishedUploading",value:function(y,E,N){var I;if(y[0].status!==w.CANCELED&&E.readyState===4){if(E.responseType!=="arraybuffer"&&E.responseType!=="blob"&&(I=E.responseText,E.getResponseHeader("content-type")&&~E.getResponseHeader("content-type").indexOf("application/json")))try{I=JSON.parse(I)}catch(_){N=_,I="Invalid JSON response from server."}this._updateFilesUploadProgress(y,E),200<=E.status&&E.status<300?y[0].upload.chunked?y[0].upload.finishedChunkUpload(this._getChunk(y[0],E),I):this._finished(y,I,N):this._handleUploadError(y,E,I)}}},{key:"_handleUploadError",value:function(y,E,N){if(y[0].status!==w.CANCELED){if(y[0].upload.chunked&&this.options.retryChunks){var I=this._getChunk(y[0],E);if(I.retries++<this.options.retryChunksLimit){this._uploadData(y,[I.dataBlock]);return}else console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(y,N||this.options.dictResponseError.replace("{{statusCode}}",E.status),E)}}},{key:"submitRequest",value:function(y,E,N){if(y.readyState!=1){console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.");return}y.send(E)}},{key:"_finished",value:function(y,E,N){var I=D(y,!0),_;try{for(I.s();!(_=I.n()).done;){var L=_.value;L.status=w.SUCCESS,this.emit("success",L,E,N),this.emit("complete",L)}}catch(z){I.e(z)}finally{I.f()}if(this.options.uploadMultiple&&(this.emit("successmultiple",y,E,N),this.emit("completemultiple",y)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(y,E,N){var I=D(y,!0),_;try{for(I.s();!(_=I.n()).done;){var L=_.value;L.status=w.ERROR,this.emit("error",L,E,N),this.emit("complete",L)}}catch(z){I.e(z)}finally{I.f()}if(this.options.uploadMultiple&&(this.emit("errormultiple",y,E,N),this.emit("completemultiple",y)),this.options.autoProcessQueue)return this.processQueue()}}],[{key:"initClass",value:function(){this.prototype.Emitter=h,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"extend",value:function(y){for(var E=arguments.length,N=new Array(E>1?E-1:0),I=1;I<E;I++)N[I-1]=arguments[I];for(var _=0,L=N;_<L.length;_++){var z=L[_];for(var W in z){var U=z[W];y[W]=U}}return y}},{key:"uuidv4",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(y){var E=Math.random()*16|0,N=y==="x"?E:E&3|8;return N.toString(16)})}}]),w}(h);j.initClass(),j.version="5.9.3",j.options={},j.optionsForElement=function(A){if(A.getAttribute("id"))return j.options[fe(A.getAttribute("id"))]},j.instances=[],j.forElement=function(A){if(typeof A=="string"&&(A=document.querySelector(A)),(A!=null?A.dropzone:void 0)==null)throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return A.dropzone},j.autoDiscover=!0,j.discover=function(){var A;if(document.querySelectorAll)A=document.querySelectorAll(".dropzone");else{A=[];var M=function(O){return function(){var y=[],E=D(O,!0),N;try{for(E.s();!(N=E.n()).done;){var I=N.value;/(^| )dropzone($| )/.test(I.className)?y.push(A.push(I)):y.push(void 0)}}catch(_){E.e(_)}finally{E.f()}return y}()};M(document.getElementsByTagName("div")),M(document.getElementsByTagName("form"))}return function(){var w=[],O=D(A,!0),y;try{for(O.s();!(y=O.n()).done;){var E=y.value;j.optionsForElement(E)!==!1?w.push(new j(E)):w.push(void 0)}}catch(N){O.e(N)}finally{O.f()}return w}()},j.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],j.isBrowserSupported=function(){var A=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!("classList"in document.createElement("a")))A=!1;else{j.blacklistedBrowsers!==void 0&&(j.blockedBrowsers=j.blacklistedBrowsers);var M=D(j.blockedBrowsers,!0),w;try{for(M.s();!(w=M.n()).done;){var O=w.value;if(O.test(navigator.userAgent)){A=!1;continue}}}catch(y){M.e(y)}finally{M.f()}}else A=!1;return A},j.dataURItoBlob=function(A){for(var M=atob(A.split(",")[1]),w=A.split(",")[0].split(":")[1].split(";")[0],O=new ArrayBuffer(M.length),y=new Uint8Array(O),E=0,N=M.length,I=0<=N;I?E<=N:E>=N;I?E++:E--)y[E]=M.charCodeAt(E);return new Blob([O],{type:w})};var ce=function(M,w){return M.filter(function(O){return O!==w}).map(function(O){return O})},fe=function(M){return M.replace(/[\-_](\w)/g,function(w){return w.charAt(1).toUpperCase()})};j.createElement=function(A){var M=document.createElement("div");return M.innerHTML=A,M.childNodes[0]},j.elementInside=function(A,M){if(A===M)return!0;for(;A=A.parentNode;)if(A===M)return!0;return!1},j.getElement=function(A,M){var w;if(typeof A=="string"?w=document.querySelector(A):A.nodeType!=null&&(w=A),w==null)throw new Error("Invalid `".concat(M,"` option provided. Please provide a CSS selector or a plain HTML element."));return w},j.getElements=function(A,M){var w,O;if(A instanceof Array){O=[];try{var y=D(A,!0),E;try{for(y.s();!(E=y.n()).done;)w=E.value,O.push(this.getElement(w,M))}catch(_){y.e(_)}finally{y.f()}}catch{O=null}}else if(typeof A=="string"){O=[];var N=D(document.querySelectorAll(A),!0),I;try{for(N.s();!(I=N.n()).done;)w=I.value,O.push(w)}catch(_){N.e(_)}finally{N.f()}}else A.nodeType!=null&&(O=[A]);if(O==null||!O.length)throw new Error("Invalid `".concat(M,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."));return O},j.confirm=function(A,M,w){if(window.confirm(A))return M();if(w!=null)return w()},j.isValidFile=function(A,M){if(!M)return!0;M=M.split(",");var w=A.type,O=w.replace(/\/.*$/,""),y=D(M,!0),E;try{for(y.s();!(E=y.n()).done;){var N=E.value;if(N=N.trim(),N.charAt(0)==="."){if(A.name.toLowerCase().indexOf(N.toLowerCase(),A.name.length-N.length)!==-1)return!0}else if(/\/\*$/.test(N)){if(O===N.replace(/\/.*$/,""))return!0}else if(w===N)return!0}}catch(I){y.e(I)}finally{y.f()}return!1},typeof jQuery<"u"&&jQuery!==null&&(jQuery.fn.dropzone=function(A){return this.each(function(){return new j(this,A)})}),j.ADDED="added",j.QUEUED="queued",j.ACCEPTED=j.QUEUED,j.UPLOADING="uploading",j.PROCESSING=j.UPLOADING,j.CANCELED="canceled",j.ERROR="error",j.SUCCESS="success";var be=function(M){M.naturalWidth;var w=M.naturalHeight,O=document.createElement("canvas");O.width=1,O.height=w;var y=O.getContext("2d");y.drawImage(M,0,0);for(var E=y.getImageData(1,0,1,w),N=E.data,I=0,_=w,L=w;L>I;){var z=N[(L-1)*4+3];z===0?_=L:I=L,L=_+I>>1}var W=L/w;return W===0?1:W},we=function(M,w,O,y,E,N,I,_,L,z){var W=be(w);return M.drawImage(w,O,y,E,N,I,_,L,z/W)},Ee=function(){function A(){F(this,A)}return $(A,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(w){for(var O="",y=void 0,E=void 0,N="",I=void 0,_=void 0,L=void 0,z="",W=0;y=w[W++],E=w[W++],N=w[W++],I=y>>2,_=(y&3)<<4|E>>4,L=(E&15)<<2|N>>6,z=N&63,isNaN(E)?L=z=64:isNaN(N)&&(z=64),O=O+this.KEY_STR.charAt(I)+this.KEY_STR.charAt(_)+this.KEY_STR.charAt(L)+this.KEY_STR.charAt(z),y=E=N="",I=_=L=z="",W<w.length;);return O}},{key:"restore",value:function(w,O){if(!w.match("data:image/jpeg;base64,"))return O;var y=this.decode64(w.replace("data:image/jpeg;base64,","")),E=this.slice2Segments(y),N=this.exifManipulation(O,E);return"data:image/jpeg;base64,".concat(this.encode64(N))}},{key:"exifManipulation",value:function(w,O){var y=this.getExifArray(O),E=this.insertExif(w,y),N=new Uint8Array(E);return N}},{key:"getExifArray",value:function(w){for(var O=void 0,y=0;y<w.length;){if(O=w[y],O[0]===255&O[1]===225)return O;y++}return[]}},{key:"insertExif",value:function(w,O){var y=w.replace("data:image/jpeg;base64,",""),E=this.decode64(y),N=E.indexOf(255,3),I=E.slice(0,N),_=E.slice(N),L=I;return L=L.concat(O),L=L.concat(_),L}},{key:"slice2Segments",value:function(w){for(var O=0,y=[];;){var E;if(w[O]===255&w[O+1]===218)break;if(w[O]===255&w[O+1]===216)O+=2;else{E=w[O+2]*256+w[O+3];var N=O+E+2,I=w.slice(O,N);y.push(I),O=N}if(O>w.length)break}return y}},{key:"decode64",value:function(w){var O=void 0,y=void 0,E="",N=void 0,I=void 0,_=void 0,L="",z=0,W=[],U=/[^A-Za-z0-9\+\/\=]/g;for(U.exec(w)&&console.warn(`There were invalid base64 characters in the input text.
|
|
10
10
|
Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='
|
|
11
|
-
Expect errors in decoding.`),w=w.replace(/[^A-Za-z0-9\+\/\=]/g,"");N=this.KEY_STR.indexOf(w.charAt(z++)),I=this.KEY_STR.indexOf(w.charAt(z++)),_=this.KEY_STR.indexOf(w.charAt(z++)),L=this.KEY_STR.indexOf(w.charAt(z++)),O=N<<2|I>>4,y=(I&15)<<4|_>>2,E=(_&3)<<6|L,W.push(O),_!==64&&W.push(y),L!==64&&W.push(E),O=y=E="",N=I=_=L="",z<w.length;);return W}}]),A}();Ee.initClass();var Ae=function(M,w){var O=!1,y=!0,E=M.document,N=E.documentElement,I=E.addEventListener?"addEventListener":"attachEvent",_=E.addEventListener?"removeEventListener":"detachEvent",L=E.addEventListener?"":"on",z=function U(K){if(!(K.type==="readystatechange"&&E.readyState!=="complete")&&((K.type==="load"?M:E)[_](L+K.type,U,!1),!O&&(O=!0)))return w.call(M,K.type||K)},W=function U(){try{N.doScroll("left")}catch{setTimeout(U,50);return}return z("poll")};if(E.readyState!=="complete"){if(E.createEventObject&&N.doScroll){try{y=!M.frameElement}catch{}y&&W()}return E[I](L+"DOMContentLoaded",z,!1),E[I](L+"readystatechange",z,!1),M[I](L+"load",z,!1)}};j._autoDiscoverFunction=function(){if(j.autoDiscover)return j.discover()},Ae(window,j._autoDiscoverFunction);function xe(A,M){return typeof A<"u"&&A!==null?M(A):void 0}function Oe(A,M,w){if(typeof A<"u"&&A!==null&&typeof A[M]=="function")return w(A,M)}window.Dropzone=j;var ve=j}(),i}()})})(Yf);var Yv=Yf.exports;const au=Gv(Yv),Jv={class:"fallback"},Zv=f.createElementVNode("input",{id:"file",type:"file",name:"file",multiple:""},null,-1),Xv={for:"file"},Qv={class:"dz-message","data-dz-message":""},qv={id:"bd-dropzone-theme",style:{display:"none"}},e2={class:"dz-preview dz-file-preview"},t2={class:"dz-details"},n2=f.createElementVNode("img",{"data-dz-thumbnail":"",class:"dz-image"},null,-1),r2=f.createElementVNode("div",{class:"dz-filename"},[f.createElementVNode("small",{"data-dz-name":""})],-1),o2=f.createElementVNode("div",{class:"dz-progress"},[f.createElementVNode("div",{class:"spinner-border text-primary spinner-border-sm",role:"status"},[f.createElementVNode("span",{class:"visually-hidden"},"Loading...")])],-1),i2={class:"dz-success-mark"},s2={class:"dz-error-message text-danger"},a2=f.createElementVNode("small",{"data-dz-errormessage":""},null,-1),Jf=f.defineComponent({__name:"BDDropzone",props:{modelValue:{default:[]},buttonText:{default:void 0},multiple:{type:Boolean,default:!1},errorMessage:{default:void 0},fileSizeExceededMessage:{default:void 0},acceptedFiles:{default:".jpg"},url:{default:""},tag:{default:"form"},token:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=f.computed(()=>({variant:As.PRIMARY,size:at.SM})),o=gr(t,"modelValue",e);let i=null;au.autoDiscover=!1,f.watch(()=>t.modelValue,()=>{s()}),f.onMounted(()=>{document.getElementById("dropzone")&&l()});const s=()=>{i&&(i.destroy(),l())},l=()=>{var p;i=new au("#dropzone",{url:t.url,method:"post",acceptedFiles:t.acceptedFiles,addRemoveLinks:!1,maxFilesize:10,maxFiles:t.multiple?3:1,headers:{RequestVerificationToken:t.token},dictResponseError:t.errorMessage,dictFileTooBig:t.fileSizeExceededMessage,previewTemplate:(p=document.querySelector("#bd-dropzone-theme"))==null?void 0:p.innerHTML}),i.on("error",c),i.on("success",a),i.on("removedfile",d)},a=function(p,m){var g;o.value.push({UUID:(g=p.upload)==null?void 0:g.uuid,CorrelationId:m.CorrelationId,Naam:m.Naam}),u(p)},c=function(p){u(p)},u=function(p){const m=p.name;if(!(m.endsWith(".png")||m.endsWith(".jpg")||m.endsWith(".jpeg")||m.endsWith(".gif"))){const g=p.previewElement.getElementsByClassName("icon-file"),v=p.previewElement.getElementsByClassName("dz-image");g[0].classList.remove("d-none"),v[0].classList.add("d-none")}},d=function(p){const m=o.value.findIndex(g=>{var v,C;return((v=g.upload)==null?void 0:v.uuid)===((C=p.upload)==null?void 0:C.uuid)});m!==-1&&o.value.splice(m,1)},h=f.computed(()=>t.tag??"form");return(p,m)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(h.value),{id:"dropzone",class:"dropzone bd-dropzone",enctype:"multipart/form-data"},{default:f.withCtx(()=>[f.createElementVNode("div",Jv,[Zv,f.createTextVNode(" test "),f.createElementVNode("label",Xv,[f.createVNode(f.unref(cr)),f.createTextVNode(" "+f.toDisplayString(t.buttonText),1)])]),f.createElementVNode("div",Qv,[f.createVNode(f.unref(lt),f.normalizeProps(f.guardReactiveProps(r.value)),{default:f.withCtx(()=>[f.createVNode(f.unref(cr)),f.createTextVNode(" "+f.toDisplayString(t.buttonText),1)]),_:1},16)])]),_:1})),f.createElementVNode("div",qv,[f.createElementVNode("div",e2,[f.createElementVNode("div",t2,[n2,f.createVNode(f.unref(Pl),{"data-dz-thumbnail":"",class:"d-none"}),r2,f.createVNode(f.unref(lt),{class:"dz-remove",alt:"Click me to remove the file.","data-dz-remove":""},{default:f.withCtx(()=>[f.createVNode(f.unref($o))]),_:1})]),o2,f.createElementVNode("div",i2,[f.createVNode(f.unref(Po))]),f.createElementVNode("div",s2,[f.createVNode(f.unref(xs)),a2])])])],64))}});function Qe(n){this.content=n}Qe.prototype={constructor:Qe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new Qe(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qe(t)},addToStart:function(n,e){return new Qe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qe(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new Qe(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Qe.from(n),n.size?new Qe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qe.from(n),n.size?new Qe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Qe.from=function(n){if(n instanceof Qe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qe(e)};function Zf(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=Zf(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Xf(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=Xf(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class se{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(i+=l.text.slice(Math.max(e,a)-a,t-a),s=!r):l.isLeaf?(o?i+=typeof o=="function"?o(l):o:l.type.spec.leafText&&(i+=l.type.spec.leafText(l)),s=!r):!s&&l.isBlock&&(i+=r,s=!0)},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new se(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new se(r,o)}cutByIndex(e,t){return e==t?se.empty:e==0&&t==this.content.length?this:new se(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new se(o,i)}addToStart(e){return new se([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new se(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Zf(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Xf(this,e,t,r)}findIndex(e,t=-1){if(e==0)return Qo(0,e);if(e==this.size)return Qo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||t>0?Qo(r+1,s):Qo(r,o);o=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,t){if(!t)return se.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new se(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return se.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new se(t||e,r)}static from(e){if(!e)return se.empty;if(e instanceof se)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new se([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}se.empty=new se([],0);const na={index:0,offset:0};function Qo(n,e){return na.index=n,na.offset=e,na}function xi(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!xi(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!xi(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Pe=class Ja{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&xi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ja.none;if(e instanceof Ja)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};Pe.none=[];class Ti extends Error{}class he{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=qf(this.content,e+this.openStart,t);return r&&new he(r,this.openStart,this.openEnd)}removeBetween(e,t){return new he(Qf(this.content,e+this.openStart,t+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,t){if(!t)return he.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new he(se.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new he(e,r,o)}}he.empty=new he(se.empty,0,0);function Qf(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Qf(i.content,e-o-1,t-o-1)))}function qf(n,e,t,r){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qf(s.content,e-i-1,t);return l&&n.replaceChild(o,s.copy(l))}function l2(n,e,t){if(t.openStart>n.depth)throw new Ti("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ti("Inconsistent open depths");return eh(n,e,t,0)}function eh(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=eh(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return or(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=c2(t,n);return or(i,nh(n,s,l,e,r))}else return or(i,Ai(n,e,r))}function th(n,e){if(!e.type.compatibleContent(n.type))throw new Ti("Cannot join "+e.type.name+" onto "+n.type.name)}function Za(n,e,t){let r=n.node(t);return th(r,e.node(t)),r}function rr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ho(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(rr(n.nodeAfter,r),i++));for(let l=i;l<s;l++)rr(o.child(l),r);e&&e.depth==t&&e.textOffset&&rr(e.nodeBefore,r)}function or(n,e){return n.type.checkContent(e),n.copy(e)}function nh(n,e,t,r,o){let i=n.depth>o&&Za(n,e,o+1),s=r.depth>o&&Za(t,r,o+1),l=[];return ho(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(th(i,s),rr(or(i,nh(n,e,t,r,o+1)),l)):(i&&rr(or(i,Ai(n,e,o+1)),l),ho(e,t,o,l),s&&rr(or(s,Ai(t,r,o+1)),l)),ho(r,null,o,l),new se(l)}function Ai(n,e,t){let r=[];if(ho(null,n,t,r),n.depth>t){let o=Za(n,e,t+1);rr(or(o,Ai(n,e,t+1)),r)}return ho(e,null,t,r),new se(r)}function c2(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(se.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class ko{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pe.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Oi(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<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new ko(t,r,i)}static resolveCached(e,t){for(let o=0;o<ra.length;o++){let i=ra[o];if(i.pos==t&&i.doc==e)return i}let r=ra[oa]=ko.resolve(e,t);return oa=(oa+1)%u2,r}}let ra=[],oa=0,u2=12;class Oi{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const d2=Object.create(null);let ir=class Xa{constructor(e,t,r,o=Pe.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||se.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&xi(this.attrs,t||e.defaultAttrs||d2)&&Pe.sameSet(this.marks,r||Pe.none)}copy(e=null){return e==this.content?this:new Xa(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Xa(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return he.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new he(c,o.depth-s,i.depth-s)}replace(e,t,r){return l2(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return ko.resolveCached(this,e)}resolveNoCache(e){return ko.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),rh(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=se.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=Pe.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!Pe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=se.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};ir.prototype.text=void 0;class Mi extends ir{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):rh(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Mi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Mi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function rh(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ur{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new f2(e,t);if(r.next==null)return ur.empty;let o=oh(r);r.next&&r.err("Unexpected trailing text");let i=b2(y2(o));return E2(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return se.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let h=i(d,l.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
11
|
+
Expect errors in decoding.`),w=w.replace(/[^A-Za-z0-9\+\/\=]/g,"");N=this.KEY_STR.indexOf(w.charAt(z++)),I=this.KEY_STR.indexOf(w.charAt(z++)),_=this.KEY_STR.indexOf(w.charAt(z++)),L=this.KEY_STR.indexOf(w.charAt(z++)),O=N<<2|I>>4,y=(I&15)<<4|_>>2,E=(_&3)<<6|L,W.push(O),_!==64&&W.push(y),L!==64&&W.push(E),O=y=E="",N=I=_=L="",z<w.length;);return W}}]),A}();Ee.initClass();var Ae=function(M,w){var O=!1,y=!0,E=M.document,N=E.documentElement,I=E.addEventListener?"addEventListener":"attachEvent",_=E.addEventListener?"removeEventListener":"detachEvent",L=E.addEventListener?"":"on",z=function U(K){if(!(K.type==="readystatechange"&&E.readyState!=="complete")&&((K.type==="load"?M:E)[_](L+K.type,U,!1),!O&&(O=!0)))return w.call(M,K.type||K)},W=function U(){try{N.doScroll("left")}catch{setTimeout(U,50);return}return z("poll")};if(E.readyState!=="complete"){if(E.createEventObject&&N.doScroll){try{y=!M.frameElement}catch{}y&&W()}return E[I](L+"DOMContentLoaded",z,!1),E[I](L+"readystatechange",z,!1),M[I](L+"load",z,!1)}};j._autoDiscoverFunction=function(){if(j.autoDiscover)return j.discover()},Ae(window,j._autoDiscoverFunction);function xe(A,M){return typeof A<"u"&&A!==null?M(A):void 0}function Oe(A,M,w){if(typeof A<"u"&&A!==null&&typeof A[M]=="function")return w(A,M)}window.Dropzone=j;var ve=j}(),i}()})})(Yf);var Yv=Yf.exports;const au=Gv(Yv),Jv={class:"fallback"},Zv=f.createElementVNode("input",{id:"file",type:"file",name:"file",multiple:""},null,-1),Xv={for:"file"},Qv={class:"dz-message","data-dz-message":""},qv={id:"bd-dropzone-theme",style:{display:"none"}},e2={class:"dz-preview dz-file-preview"},t2={class:"dz-details"},n2=f.createElementVNode("img",{"data-dz-thumbnail":"",class:"dz-image"},null,-1),r2=f.createElementVNode("div",{class:"dz-filename"},[f.createElementVNode("small",{"data-dz-name":""})],-1),o2=f.createElementVNode("div",{class:"dz-progress"},[f.createElementVNode("div",{class:"spinner-border text-primary spinner-border-sm",role:"status"},[f.createElementVNode("span",{class:"visually-hidden"},"Loading...")])],-1),i2={class:"dz-success-mark"},s2={class:"dz-error-message text-danger"},a2=f.createElementVNode("small",{"data-dz-errormessage":""},null,-1),Jf=f.defineComponent({__name:"BDDropzone",props:{modelValue:{default:[]},buttonText:{default:void 0},multiple:{type:Boolean,default:!1},errorMessage:{default:void 0},fileSizeExceededMessage:{default:void 0},acceptedFiles:{default:".jpg"},url:{default:""},tag:{default:"form"},token:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=f.computed(()=>({variant:As.PRIMARY,size:at.SM})),o=gr(t,"modelValue",e);let i=null;au.autoDiscover=!1,f.watch(()=>t.modelValue,()=>{s()}),f.onMounted(()=>{document.getElementById("dropzone")&&l()});const s=()=>{i&&(i.destroy(),l())},l=()=>{var p;i=new au("#dropzone",{url:t.url,method:"post",acceptedFiles:t.acceptedFiles,addRemoveLinks:!1,maxFilesize:10,maxFiles:t.multiple?3:1,headers:{RequestVerificationToken:t.token},dictResponseError:t.errorMessage,dictFileTooBig:t.fileSizeExceededMessage,previewTemplate:(p=document.querySelector("#bd-dropzone-theme"))==null?void 0:p.innerHTML}),i.on("error",c),i.on("success",a),i.on("removedfile",d)},a=function(p,m){var g;o.value.push({UUID:(g=p.upload)==null?void 0:g.uuid,CorrelationId:m.CorrelationId,Naam:m.Naam}),u(p)},c=function(p){u(p)},u=function(p){const m=p.name;if(!(m.endsWith(".png")||m.endsWith(".jpg")||m.endsWith(".jpeg")||m.endsWith(".gif"))){const g=p.previewElement.getElementsByClassName("icon-file"),v=p.previewElement.getElementsByClassName("dz-image");g[0].classList.remove("d-none"),v[0].classList.add("d-none")}},d=function(p){const m=o.value.findIndex(g=>{var v;return(g==null?void 0:g.UUID)===((v=p.upload)==null?void 0:v.uuid)});m!==-1&&o.value.splice(m,1)},h=f.computed(()=>t.tag??"form");return(p,m)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(h.value),{id:"dropzone",class:"dropzone bd-dropzone",enctype:"multipart/form-data"},{default:f.withCtx(()=>[f.createElementVNode("div",Jv,[Zv,f.createTextVNode(" test "),f.createElementVNode("label",Xv,[f.createVNode(f.unref(cr)),f.createTextVNode(" "+f.toDisplayString(t.buttonText),1)])]),f.createElementVNode("div",Qv,[f.createVNode(f.unref(lt),f.normalizeProps(f.guardReactiveProps(r.value)),{default:f.withCtx(()=>[f.createVNode(f.unref(cr)),f.createTextVNode(" "+f.toDisplayString(t.buttonText),1)]),_:1},16)])]),_:1})),f.createElementVNode("div",qv,[f.createElementVNode("div",e2,[f.createElementVNode("div",t2,[n2,f.createVNode(f.unref(Pl),{"data-dz-thumbnail":"",class:"d-none"}),r2,f.createVNode(f.unref(lt),{class:"dz-remove",alt:"Click me to remove the file.","data-dz-remove":""},{default:f.withCtx(()=>[f.createVNode(f.unref($o))]),_:1})]),o2,f.createElementVNode("div",i2,[f.createVNode(f.unref(Po))]),f.createElementVNode("div",s2,[f.createVNode(f.unref(xs)),a2])])])],64))}});function Qe(n){this.content=n}Qe.prototype={constructor:Qe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new Qe(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qe(t)},addToStart:function(n,e){return new Qe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qe(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new Qe(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Qe.from(n),n.size?new Qe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qe.from(n),n.size?new Qe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Qe.from=function(n){if(n instanceof Qe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qe(e)};function Zf(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=Zf(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Xf(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=Xf(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class se{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(i+=l.text.slice(Math.max(e,a)-a,t-a),s=!r):l.isLeaf?(o?i+=typeof o=="function"?o(l):o:l.type.spec.leafText&&(i+=l.type.spec.leafText(l)),s=!r):!s&&l.isBlock&&(i+=r,s=!0)},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new se(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new se(r,o)}cutByIndex(e,t){return e==t?se.empty:e==0&&t==this.content.length?this:new se(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new se(o,i)}addToStart(e){return new se([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new se(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Zf(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Xf(this,e,t,r)}findIndex(e,t=-1){if(e==0)return Qo(0,e);if(e==this.size)return Qo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||t>0?Qo(r+1,s):Qo(r,o);o=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,t){if(!t)return se.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new se(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return se.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new se(t||e,r)}static from(e){if(!e)return se.empty;if(e instanceof se)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new se([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}se.empty=new se([],0);const na={index:0,offset:0};function Qo(n,e){return na.index=n,na.offset=e,na}function xi(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!xi(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!xi(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Pe=class Ja{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&xi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ja.none;if(e instanceof Ja)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};Pe.none=[];class Ti extends Error{}class he{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=qf(this.content,e+this.openStart,t);return r&&new he(r,this.openStart,this.openEnd)}removeBetween(e,t){return new he(Qf(this.content,e+this.openStart,t+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,t){if(!t)return he.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new he(se.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new he(e,r,o)}}he.empty=new he(se.empty,0,0);function Qf(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Qf(i.content,e-o-1,t-o-1)))}function qf(n,e,t,r){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qf(s.content,e-i-1,t);return l&&n.replaceChild(o,s.copy(l))}function l2(n,e,t){if(t.openStart>n.depth)throw new Ti("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ti("Inconsistent open depths");return eh(n,e,t,0)}function eh(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=eh(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return or(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=c2(t,n);return or(i,nh(n,s,l,e,r))}else return or(i,Ai(n,e,r))}function th(n,e){if(!e.type.compatibleContent(n.type))throw new Ti("Cannot join "+e.type.name+" onto "+n.type.name)}function Za(n,e,t){let r=n.node(t);return th(r,e.node(t)),r}function rr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ho(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(rr(n.nodeAfter,r),i++));for(let l=i;l<s;l++)rr(o.child(l),r);e&&e.depth==t&&e.textOffset&&rr(e.nodeBefore,r)}function or(n,e){return n.type.checkContent(e),n.copy(e)}function nh(n,e,t,r,o){let i=n.depth>o&&Za(n,e,o+1),s=r.depth>o&&Za(t,r,o+1),l=[];return ho(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(th(i,s),rr(or(i,nh(n,e,t,r,o+1)),l)):(i&&rr(or(i,Ai(n,e,o+1)),l),ho(e,t,o,l),s&&rr(or(s,Ai(t,r,o+1)),l)),ho(r,null,o,l),new se(l)}function Ai(n,e,t){let r=[];if(ho(null,n,t,r),n.depth>t){let o=Za(n,e,t+1);rr(or(o,Ai(n,e,t+1)),r)}return ho(e,null,t,r),new se(r)}function c2(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(se.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class ko{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pe.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Oi(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<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new ko(t,r,i)}static resolveCached(e,t){for(let o=0;o<ra.length;o++){let i=ra[o];if(i.pos==t&&i.doc==e)return i}let r=ra[oa]=ko.resolve(e,t);return oa=(oa+1)%u2,r}}let ra=[],oa=0,u2=12;class Oi{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const d2=Object.create(null);let ir=class Xa{constructor(e,t,r,o=Pe.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||se.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&xi(this.attrs,t||e.defaultAttrs||d2)&&Pe.sameSet(this.marks,r||Pe.none)}copy(e=null){return e==this.content?this:new Xa(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Xa(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return he.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new he(c,o.depth-s,i.depth-s)}replace(e,t,r){return l2(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return ko.resolveCached(this,e)}resolveNoCache(e){return ko.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),rh(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=se.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=Pe.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!Pe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=se.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};ir.prototype.text=void 0;class Mi extends ir{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):rh(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Mi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Mi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function rh(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ur{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new f2(e,t);if(r.next==null)return ur.empty;let o=oh(r);r.next&&r.err("Unexpected trailing text");let i=b2(y2(o));return E2(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return se.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let h=i(d,l.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
12
12
|
`)}}ur.empty=new ur(!0);class f2{constructor(e,t){this.string=e,this.nodeTypes=t,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 oh(n){let e=[];do e.push(h2(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function h2(n){let e=[];do e.push(p2(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function p2(n){let e=v2(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=m2(n,e);else break;return e}function lu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function m2(n,e){let t=lu(n),r=t;return n.eat(",")&&(n.next!="}"?r=lu(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function g2(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.groups.indexOf(e)>-1&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function v2(n){if(n.eat("(")){let e=oh(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=g2(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function y2(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=t();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=t();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function ih(n,e){return e-n}function cu(n,e){let t=[];return r(e),t.sort(ih);function r(o){let i=n[o];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&r(a)}}}function b2(n){let e=Object.create(null);return t(cu(n,0));function t(r){let o=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);cu(n,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new ur(r.indexOf(n.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(ih);i.next.push({type:o[s][0],next:e[l.join(",")]||t(l)})}return i}}function E2(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function sh(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function ah(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let i=n[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function lh(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new C2(n[t]);return e}let uu=class ch{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=lh(r.attrs),this.defaultAttrs=sh(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ur.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ah(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ir(this,this.computeAttrs(e),se.from(t),Pe.setFrom(r))}createChecked(e=null,t,r){return t=se.from(t),this.checkContent(t),new ir(this,this.computeAttrs(e),t,Pe.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=se.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(se.empty,!0);return i?new ir(this,e,t.append(i),Pe.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Pe.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,s)=>r[i]=new ch(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class C2{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Ms{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=lh(o.attrs),this.excluded=null;let i=sh(this.attrs);this.instance=i?new Pe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Pe(this,ah(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Ms(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class S2{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=Qe.from(e.nodes),t.marks=Qe.from(e.marks||{}),this.nodes=uu.compile(this.spec.nodes,this),this.marks=Ms.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;i.contentMatch=r[s]||(r[s]=ur.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=l=="_"?null:l?du(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:du(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,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof uu){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(t,r,o)}text(e,t){let r=this.nodes.text;return new Mi(r,r.defaultAttrs,e,Pe.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return ir.fromJSON(this,e)}markFromJSON(e){return Pe.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function du(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n.marks[o],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class Hr{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.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 o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new hu(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new hu(this,t,!0);return r.addAll(e,t.from,t.to),he.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(x2(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=pu(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=pu(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Hr(e,Hr.schemaRules(e)))}}const uh={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},w2={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},dh={ol:!0,ul:!0},Ni=1,Ii=2,po=4;function fu(n,e,t){return e!=null?(e?Ni:0)|(e==="full"?Ii:0):n&&n.whitespace=="pre"?Ni|Ii:t&~po}class qo{constructor(e,t,r,o,i,s,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=o,this.solid=i,this.options=l,this.content=[],this.activeMarks=Pe.none,this.stashMarks=[],this.match=s||(l&po?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(se.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ni)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=se.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(se.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let o=r[t];(this.type?this.type.allowsMarkType(o.type):A2(o.type,e))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!uh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class hu{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let o=t.topNode,i,s=fu(null,t.preserveWhitespace,0)|(r?po:0);o?i=new qo(o.type,o.attrs,Pe.none,Pe.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new qo(null,null,Pe.none,Pe.none,!0,null,s):i=new qo(e.schema.topNodeType,null,Pe.none,Pe.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.getAttribute("style");if(!r)return t();let o=this.readStyles(T2(r));if(!o)return;let[i,s]=o,l=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<i.length;a++)this.addPendingMark(i[a]);t();for(let a=0;a<i.length;a++)this.removePendingMark(i[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&Ii||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&Ni)r.options&Ii?t=t.replace(/\r\n?/g,`
|
|
13
13
|
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],i=e.previousSibling;(!o||i&&i.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),o;dh.hasOwnProperty(r)&&this.parser.normalizeLists&&k2(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,t));if(i?i.ignore:w2.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let s,l=this.top,a=this.needsBlock;if(uh.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),s=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}i&&i.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
14
14
|
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=Pe.none,r=Pe.none;for(let o=0;o<e.length;o+=2)for(let i=void 0;;){let s=this.parser.matchStyle(e[o],e[o+1],this,i);if(!s)break;if(s.ignore)return null;if(s.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(l=>{s.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(t),s.consuming===!1)i=s;else break}return[t,r]}addElementByRule(e,t,r){let o,i,s;t.node?(i=this.parser.schema.nodes[t.node],i.isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):o=this.enter(i,t.attrs||null,t.preserveWhitespace)):(s=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(s));let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}o&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,t,r){let o=t||0;for(let i=t?e.childNodes[t]:e.firstChild,s=r==null?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i);this.findAtPoint(e,o)}findPlace(e){let t,r;for(let o=this.open;o>=0;o--){let i=this.nodes[o],s=i.findWrapping(e);if(s&&(!t||t.length>s.length)&&(t=s,r=i,!s.length)||i.solid)break}if(!t)return!1;this.sync(r);for(let o=0;o<t.length;o++)this.enterInner(t[o],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let o=0;o<e.marks.length;o++)(!t.type||t.type.allowsMarkType(e.marks[o].type))&&(r=e.marks[o].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let o=this.findPlace(e.create(t));return o&&this.enterInner(e,t,!0,r),o}enterInner(e,t=null,r=!1,o){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let s=fu(e,o,i.options);i.options&po&&i.content.length==0&&(s|=po),this.nodes.push(new qo(e,t,i.activeMarks,i.pendingMarks,r,null,s)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=O2(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let s=o.popFromStashMark(e);s&&o.type&&o.type.allowsMarkType(s.type)&&(o.activeMarks=s.addToSet(o.activeMarks))}if(o==t)break}}}function k2(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&dh.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function x2(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function T2(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function pu(n){let e={};for(let t in n)e[t]=n[t];return e}function A2(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}function O2(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class tn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ia(t).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,t);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=tn.renderSpec(ia(t),this.nodes[e.type.name](e));if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&tn.renderSpec(ia(r),o(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i=o.indexOf(" ");i>0&&(r=o.slice(0,i),o=o.slice(i+1));let s,l=r?e.createElementNS(r,o):e.createElement(o),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let u in a)if(a[u]!=null){let d=u.indexOf(" ");d>0?l.setAttributeNS(u.slice(0,d),u.slice(d+1),a[u]):l.setAttribute(u,a[u])}}for(let u=c;u<t.length;u++){let d=t[u];if(d===0){if(u<t.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=tn.renderSpec(e,d,r);if(l.appendChild(h),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 tn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=mu(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return mu(e.marks)}}function mu(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ia(n){return n.document||window.document}const fh=65535,hh=Math.pow(2,16);function M2(n,e){return n+e*hh}function gu(n){return n&fh}function N2(n){return(n-(n&fh))/hh}const ph=1,mh=2,pi=4,gh=8;class Qa{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&gh)>0}get deletedBefore(){return(this.delInfo&(ph|pi))>0}get deletedAfter(){return(this.delInfo&(mh|pi))>0}get deletedAcross(){return(this.delInfo&pi)>0}}class St{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&St.empty)return St.empty}recover(e){let t=0,r=gu(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+N2(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let h=c?e==a?-1:e==d?1:t:t,p=a+o+(h<0?0:u);if(r)return p;let m=e==(t<0?a:d)?null:M2(l/3,e-a),g=e==a?mh:e==d?ph:pi;return(t<0?e!=a:e!=d)&&(g|=gh),new Qa(p,g,m)}o+=u-c}return r?e+o:new Qa(e+o,0,null)}touches(e,t){let r=0,o=gu(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+t],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new St(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?St.empty:new St(e<0?[0,-e,0]:[0,0,e])}}St.empty=new St([]);class mo{constructor(e=[],t,r=0,o=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=o}slice(e=0,t=this.maps.length){return new mo(this.maps,this.mirror,e,t)}copy(){return new mo(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?r+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new mo;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Qa(e,o,null)}}const sa=Object.create(null);class ot{getMap(){return St.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=sa[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in sa)throw new RangeError("Duplicate use of step JSON ID "+e);return sa[e]=t,t.prototype.jsonID=e,t}}class We{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new We(e,null)}static fail(e){return new We(null,e)}static fromReplace(e,t,r,o){try{return We.ok(e.replace(t,r,o))}catch(i){if(i instanceof Ti)return We.fail(i.message);throw i}}}function Yl(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(Yl(i.content,e,i))),i.isInline&&(i=e(i,t,o)),r.push(i)}return se.fromArray(r)}class In extends ot{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new he(Yl(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return We.fromReplace(e,this.from,this.to,i)}invert(){return new nn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new In(t.pos,r.pos,this.mark)}merge(e){return e instanceof In&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new In(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new In(t.from,t.to,e.markFromJSON(t.mark))}}ot.jsonID("addMark",In);class nn extends ot{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new he(Yl(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return We.fromReplace(e,this.from,this.to,r)}invert(){return new In(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new nn(t.pos,r.pos,this.mark)}merge(e){return e instanceof nn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new nn(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new nn(t.from,t.to,e.markFromJSON(t.mark))}}ot.jsonID("removeMark",nn);class Dn extends ot{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return We.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return We.fromReplace(e,this.pos,this.pos+1,new he(se.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new Dn(this.pos,t.marks[o]);return new Dn(this.pos,this.mark)}}return new Ur(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Dn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Dn(t.pos,e.markFromJSON(t.mark))}}ot.jsonID("addNodeMark",Dn);class Ur extends ot{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return We.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return We.fromReplace(e,this.pos,this.pos+1,new he(se.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Dn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ur(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ur(t.pos,e.markFromJSON(t.mark))}}ot.jsonID("removeNodeMark",Ur);class qe extends ot{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&qa(e,this.from,this.to)?We.fail("Structure replace would overwrite content"):We.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new St([this.from,this.to-this.from,this.slice.size])}invert(e){return new qe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new qe(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof qe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?he.empty:new he(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new qe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?he.empty:new he(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new qe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new qe(t.from,t.to,he.fromJSON(e,t.slice),!!t.structure)}}ot.jsonID("replace",qe);class Je extends ot{constructor(e,t,r,o,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(qa(e,this.from,this.gapFrom)||qa(e,this.gapTo,this.to)))return We.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return We.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?We.fromReplace(e,this.from,this.to,r):We.fail("Content does not fit in gap")}getMap(){return new St([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Je(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=e.map(this.gapFrom,-1),i=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos?null:new Je(t.pos,r.pos,o,i,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Je(t.from,t.to,t.gapFrom,t.gapTo,he.fromJSON(e,t.slice),t.insert,!!t.structure)}}ot.jsonID("replaceAround",Je);function qa(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function I2(n,e,t,r){let o=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),p=Math.min(c+a.nodeSize,t),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(s&&s.to==h&&s.mark.eq(d[g])?s.to=p:o.push(s=new nn(h,p,d[g])));l&&l.to==h?l.to=p:i.push(l=new In(h,p,r))}}),o.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function D2(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof Ms){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],h;for(let p=0;p<o.length;p++){let m=o[p];m.step==i-1&&d.eq(o[p].style)&&(h=m)}h?(h.to=c,h.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>n.step(new nn(s.from,s.to,s.style)))}function _2(n,e,t,r=t.contentMatch){let o=n.doc.nodeAt(e),i=[],s=e+1;for(let l=0;l<o.childCount;l++){let a=o.child(l),c=s+a.nodeSize,u=r.matchType(a.type);if(!u)i.push(new qe(s,c,he.empty));else{r=u;for(let d=0;d<a.marks.length;d++)t.allowsMarkType(a.marks[d].type)||n.step(new nn(s,c,a.marks[d]));if(a.isText&&!t.spec.code){let d,h=/\r?\n|\r/g,p;for(;d=h.exec(a.text);)p||(p=new he(se.from(t.schema.text(" ",t.allowedMarks(a.marks))),0,0)),i.push(new qe(s+d.index,s+d.index+d[0].length,p))}}s=c}if(!r.validEnd){let l=r.fillBefore(se.empty,!0);n.replace(s,s,new he(l,0,0))}for(let l=i.length-1;l>=0;l--)n.step(i[l])}function L2(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function eo(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),i=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(i,s,t))return r;if(r==0||o.type.spec.isolating||!L2(o,i,s))break}return null}function R2(n,e,t){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=se.empty,d=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=se.from(r.node(m).copy(u)),d++):a--;let h=se.empty,p=0;for(let m=i,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,h=se.from(o.node(m).copy(h)),p++):c++;n.step(new Je(a,c,s,l,new he(u.append(h),d,p),u.size-d,!0))}function Jl(n,e,t=null,r=n){let o=B2(n,e),i=o&&P2(r,e);return i?o.map(vu).concat({type:e,attrs:t}).concat(i.map(vu)):null}function vu(n){return{type:n,attrs:null}}function B2(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(r,o,s)?i:null}function P2(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function $2(n,e,t){let r=se.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[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=se.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new Je(o,i,o,i,new he(r,0,0),t.length,!0))}function F2(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{if(s.isTextblock&&!s.hasMarkup(r,o)&&V2(n.doc,n.mapping.slice(i).map(l),r)){n.clearIncompatible(n.mapping.slice(i).map(l,1),r);let a=n.mapping.slice(i),c=a.map(l,1),u=a.map(l+s.nodeSize,1);return n.step(new Je(c,u,c+1,u-1,new he(se.from(r.create(o,null,s.marks)),0,0),1,!0)),!1}})}function V2(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function z2(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Je(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new he(se.from(s),0,0),1,!0))}function $r(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=t-2;c>i;c--,u--){let d=o.node(c),h=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!g.type.validContent(p))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function H2(n,e,t=1,r){let o=n.doc.resolve(e),i=se.empty,s=se.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=se.from(o.node(l).copy(i));let u=r&&r[c];s=se.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}n.step(new qe(e,e,new he(i.append(s),t,t),!0))}function zn(n,e){let t=n.resolve(e),r=t.index();return vh(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function vh(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Ns(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):t>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&vh(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function U2(n,e,t){let r=new qe(e-t,e+t,he.empty,!0);n.step(r)}function j2(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function W2(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=r.depth;s>=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),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Zl(n,e,t=e,r=he.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return yh(o,i,r)?new qe(e,t,r):new K2(o,i,r).fit()}function yh(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class K2{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=se.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=se.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new he(i,s,l);return e>-1?new Je(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new qe(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=aa(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(se.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=aa(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new he(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=aa(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new he(lo(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new he(lo(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));d=d.matchFragment(o)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let g=l.child(c),v=d.matchType(g.type);if(!v)break;c++,(c>1||a==0||g.content.size)&&(d=v,u.push(bh(g.mark(h.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?p:-1)))}let m=c==l.childCount;m||(p=-1),this.placed=co(this.placed,t,se.from(u)),this.frontier[t].match=d,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=l;g<p;g++){let C=v.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),v=C.content}this.unplaced=m?e==0?he.empty:new he(lo(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new he(lo(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!la(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=la(e,t,o,r,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=la(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=co(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=co(this.placed,this.depth,se.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(se.empty,!0);t.childCount&&(this.placed=co(this.placed,this.frontier.length,t))}}function lo(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(lo(n.firstChild.content,e-1,t)))}function co(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(co(n.lastChild.content,e-1,t)))}function aa(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function bh(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,bh(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(se.empty,!0)))),n.copy(r)}function la(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!G2(t,i.content,s)?l:null}function G2(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Y2(n){return n.spec.defining||n.spec.definingForContent}function J2(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(yh(o,i,r))return n.step(new qe(e,t,r));let s=Ch(o,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let m=o.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?l=h:o.before(h)==p&&s.splice(1,0,-h)}let a=s.indexOf(l),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=c[h],m=Y2(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(l)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=c[p];if(m)for(let g=0;g<s.length;g++){let v=s[(g+a)%s.length],C=!0;v<0&&(C=!1,v=-v);let S=o.node(v-1),k=o.index(v-1);if(S.canReplaceWith(k,k,m.type,m.marks))return n.replace(o.before(v),C?i.after(v):t,new he(Eh(r.content,0,r.openStart,p),p,r.openEnd))}}let d=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>d));h--){let p=s[h];p<0||(e=o.before(p),t=i.after(p))}}function Eh(n,e,t,r,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Eh(i.content,e+1,t,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(se.empty,!0))}return n}function Z2(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=j2(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new he(se.from(r),0,0))}function X2(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),i=Ch(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s)return n.delete(r.before(s),t);n.delete(e,t)}function Ch(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}class Fr extends ot{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return We.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return We.fromReplace(e,this.pos,this.pos+1,new he(se.from(o),0,t.isLeaf?0:1))}getMap(){return St.empty}invert(e){return new Fr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Fr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Fr(t.pos,t.attr,t.value)}}ot.jsonID("attr",Fr);class xo extends ot{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return We.ok(r)}getMap(){return St.empty}invert(e){return new xo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new xo(t.attr,t.value)}}ot.jsonID("docAttr",xo);let jr=class extends Error{};jr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};jr.prototype=Object.create(Error.prototype);jr.prototype.constructor=jr;jr.prototype.name="TransformError";class Sh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new mo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new jr(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=he.empty){let o=Zl(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new he(se.from(r),0,0))}delete(e,t){return this.replace(e,t,he.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return J2(this,e,t,r),this}replaceRangeWith(e,t,r){return Z2(this,e,t,r),this}deleteRange(e,t){return X2(this,e,t),this}lift(e,t){return R2(this,e,t),this}join(e,t=1){return U2(this,e,t),this}wrap(e,t){return $2(this,e,t),this}setBlockType(e,t=e,r,o=null){return F2(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return z2(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new Fr(e,t,r)),this}setDocAttribute(e,t){return this.step(new xo(e,t)),this}addNodeMark(e,t){return this.step(new Dn(e,t)),this}removeNodeMark(e,t){if(!(t instanceof Pe)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Ur(e,t)),this}split(e,t=1,r){return H2(this,e,t,r),this}addMark(e,t,r){return I2(this,e,t,r),this}removeMark(e,t,r){return D2(this,e,t,r),this}clearIncompatible(e,t,r){return _2(this,e,t,r),this}}const ca=Object.create(null);class _e{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Q2(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=he.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?he.empty:t),l==0&&Eu(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Eu(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new Le(e):Ar(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=t<0?Ar(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Ar(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ht(e.node(0))}static atStart(e){return Ar(e,e,0,0,1)||new Ht(e)}static atEnd(e){return Ar(e,e,e.content.size,e.childCount,-1)||new Ht(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ca[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ca)throw new RangeError("Duplicate use of selection JSON ID "+e);return ca[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Le.between(this.$anchor,this.$head).getBookmark()}}_e.prototype.visible=!0;class Q2{constructor(e,t){this.$from=e,this.$to=t}}let yu=!1;function bu(n){!yu&&!n.parent.inlineContent&&(yu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Le extends _e{constructor(e,t=e){bu(e),bu(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return _e.near(r);let o=e.resolve(t.map(this.anchor));return new Le(o.parent.inlineContent?o:r,r)}replace(e,t=he.empty){if(super.replace(e,t),t==he.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Le&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Is(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Le(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=_e.findFrom(t,r,!0)||_e.findFrom(t,-r,!0);if(i)t=i.$head;else return _e.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(_e.findFrom(e,-r,!0)||_e.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new Le(e,t)}}_e.jsonID("text",Le);class Is{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Is(e.map(this.anchor),e.map(this.head))}resolve(e){return Le.between(e.resolve(this.anchor),e.resolve(this.head))}}class Se extends _e{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return r?_e.near(i):new Se(i)}content(){return new he(se.from(this.node),0,0)}eq(e){return e instanceof Se&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Xl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Se(e.resolve(t.anchor))}static create(e,t){return new Se(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Se.prototype.visible=!1;_e.jsonID("node",Se);class Xl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Is(r,r):new Xl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Se.isSelectable(r)?new Se(t):_e.near(t)}}class Ht extends _e{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=he.empty){if(t==he.empty){e.delete(0,e.doc.content.size);let r=_e.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ht(e)}map(e){return new Ht(e)}eq(e){return e instanceof Ht}getBookmark(){return q2}}_e.jsonID("all",Ht);const q2={map(){return this},resolve(n){return new Ht(n)}};function Ar(n,e,t,r,o,i=!1){if(e.inlineContent)return Le.create(n,t);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&Se.isSelectable(l))return Se.create(n,t-(o<0?l.nodeSize:0))}else{let a=Ar(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function Eu(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof qe||o instanceof Je))return;let i=n.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),n.setSelection(_e.near(n.doc.resolve(s),t))}const Cu=1,ei=2,Su=4;class ey extends Sh{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.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Cu)&~ei,this.storedMarks=null,this}get selectionSet(){return(this.updated&Cu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ei,this}ensureMarks(e){return Pe.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&ei)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ei,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Pe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),this.selection.empty||this.setSelection(_e.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=Su,this}get scrolledIntoView(){return(this.updated&Su)>0}}function wu(n,e){return!e||!n?n:n.bind(e)}class uo{constructor(e,t,r){this.name=e,this.init=wu(t.init,r),this.apply=wu(t.apply,r)}}const ty=[new uo("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new uo("selection",{init(n,e){return n.selection||_e.atStart(e.doc)},apply(n){return n.selection}}),new uo("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new uo("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class ua{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ty.slice(),t&&t.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 uo(r.key,r.spec.state,r))})}}class Rr{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,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Rr(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new ey(this)}static create(e){let t=new ua(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Rr(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new ua(this.schema,e.plugins),r=t.fields,o=new Rr(t);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.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 o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new ua(e.schema,e.plugins),i=new Rr(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=ir.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=_e.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=c.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function wh(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=wh(o,e,{})),t[r]=o}return t}class Et{constructor(e){this.spec=e,this.props={},e.props&&wh(e.props,this,this.props),this.key=e.key?e.key.key:kh("plugin")}getState(e){return e[this.key]}}const da=Object.create(null);function kh(n){return n in da?n+"$"+ ++da[n]:(da[n]=0,n+"$")}class Kt{constructor(e="key"){this.key=kh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ct=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},To=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ku=null;const hn=function(n,e,t){let r=ku||(ku=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},dr=function(n,e,t,r){return t&&(xu(n,e,t,r,-1)||xu(n,e,t,r,1))},ny=/^(img|br|input|textarea|hr)$/i;function xu(n,e,t,r,o){for(;;){if(n==t&&e==r)return!0;if(e==(o<0?0:en(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Ql(n)||ny.test(n.nodeName)||n.contentEditable=="false")return!1;e=ct(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?en(n):0}else return!1}}function en(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ry(n,e,t){for(let r=e==0,o=e==en(n);r||o;){if(n==t)return!0;let i=ct(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==en(n)}}function Ql(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ds=function(n){return n.focusNode&&dr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Zn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function oy(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function iy(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const on=typeof navigator<"u"?navigator:null,Tu=typeof document<"u"?document:null,Hn=on&&on.userAgent||"",el=/Edge\/(\d+)/.exec(Hn),xh=/MSIE \d/.exec(Hn),tl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Hn),bt=!!(xh||tl||el),Ln=xh?document.documentMode:tl?+tl[1]:el?+el[1]:0,jt=!bt&&/gecko\/(\d+)/i.test(Hn);jt&&+(/Firefox\/(\d+)/.exec(Hn)||[0,0])[1];const nl=!bt&&/Chrome\/(\d+)/.exec(Hn),rt=!!nl,sy=nl?+nl[1]:0,ft=!bt&&!!on&&/Apple Computer/.test(on.vendor),Wr=ft&&(/Mobile\/\w+/.test(Hn)||!!on&&on.maxTouchPoints>2),Lt=Wr||(on?/Mac/.test(on.platform):!1),ay=on?/Win/.test(on.platform):!1,zt=/Android \d/.test(Hn),zo=!!Tu&&"webkitFontSmoothing"in Tu.documentElement.style,ly=zo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cy(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function dn(n,e){return typeof n=="number"?n:n[e]}function uy(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Au(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;s=To(s)){if(s.nodeType!=1)continue;let l=s,a=l==i.body,c=a?cy(i):uy(l),u=0,d=0;if(e.top<c.top+dn(r,"top")?d=-(c.top-e.top+dn(o,"top")):e.bottom>c.bottom-dn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+dn(o,"top")-c.top:e.bottom-c.bottom+dn(o,"bottom")),e.left<c.left+dn(r,"left")?u=-(c.left-e.left+dn(o,"left")):e.right>c.right-dn(r,"right")&&(u=e.right-c.right+dn(o,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function dy(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Th(n.dom)}}function Th(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=To(r));return e}function fy({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Ah(t,r==0?0:r-e)}function Ah(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:i}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Cr=null;function hy(n){if(n.setActive)return n.setActive();if(Cr)return n.focus(Cr);let e=Th(n);n.focus(Cr==null?{get preventScroll(){return Cr={preventScroll:!0},!0}}:void 0),Cr||(Cr=!1,Ah(e,0))}function Oh(n,e){let t,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=hn(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,o=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(i=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=d+1)}}return!t&&a&&(t=a,o=c,r=0),t&&t.nodeType==3?py(t,o):!t||r&&t.nodeType==1?{node:n,offset:i}:Oh(t,o)}function py(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let i=Tn(r,1);if(i.top!=i.bottom&&ql(e,i))return{node:n,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function ql(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function my(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function gy(n,e,t){let{node:r,offset:o}=Oh(e,t),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function vy(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!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?o=l.posBefore:(a.right<r.left||a.bottom<r.top)&&(o=l.posAfter)),!l.contentDOM&&o<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}i=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function Mh(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let s=n.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(ql(e,c))return Mh(s,e,c)}}if((i=(i+1)%r)==o)break}return n}function yy(n,e){let t=n.dom.ownerDocument,r,o=0,i=iy(t,e.left,e.top);i&&({node:r,offset:o}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!ql(e,c)||(s=Mh(n.dom,e,c),!s))return null}if(ft)for(let c=s;r&&c;c=To(c))c.draggable&&(r=void 0);if(s=my(s,e),r){if(jt&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;zo&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=vy(n,r,o,e))}l==null&&(l=gy(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ou(n){return n.top<n.bottom||n.left<n.right}function Tn(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ou(r))return r}return Array.prototype.find.call(t,Ou)||n.getBoundingClientRect()}const by=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Nh(n,e,t){let{node:r,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=zo||jt;if(r.nodeType==3)if(s&&(by.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let a=Tn(hn(r,o,o),t);if(jt&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Tn(hn(r,o-1,o-1),-1);if(c.top==a.top){let u=Tn(hn(r,o,o+1),-1);if(u.top!=a.top)return io(u,u.left<c.left)}}return a}else{let a=o,c=o,u=t<0?1:-1;return t<0&&!o?(c++,u=-1):t>=0&&o==r.nodeValue.length?(a--,u=1):t<0?a--:c++,io(Tn(hn(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==en(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return fa(a.getBoundingClientRect(),!1)}if(i==null&&o<en(r)){let a=r.childNodes[o];if(a.nodeType==1)return fa(a.getBoundingClientRect(),!0)}return fa(r.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==en(r))){let a=r.childNodes[o-1],c=a.nodeType==3?hn(a,en(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return io(Tn(c,1),!1)}if(i==null&&o<en(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?hn(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return io(Tn(c,-1),!0)}return io(Tn(r.nodeType==3?hn(r):r,-t),t>=0)}function io(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function fa(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Ih(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function Ey(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Ih(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Nh(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=hn(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Cy=/[\u0590-\u08ac]/;function Sy(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=n.domSelection();return!Cy.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:Ih(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),v=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&c==g;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),v})}let Mu=null,Nu=null,Iu=!1;function wy(n,e,t){return Mu==e&&Nu==t?Iu:(Mu=e,Nu=t,Iu=t=="up"||t=="down"?Ey(n,e,t):Sy(n,e,t))}const Bt=0,Du=1,Qn=2,sn=3;class Ho{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=Bt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>ct(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e||s instanceof _h){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Dh&&i.side>=0;r--);if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?ct(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?ct(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=s;for(let d=l;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=ct(h.dom)+1;break}e-=h.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=ct(d.dom);break}t+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(i>p&&s<g)return m.setSelection(e-p-m.border,t-p-m.border,r,o);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),u=!1;if((jt||ft)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(u=!!(p&&h.nodeValue[p-1]==`
|
|
@@ -7549,8 +7549,8 @@ const gu = /* @__PURE__ */ I2(_2), N2 = { class: "fallback" }, D2 = /* @__PURE__
|
|
|
7549
7549
|
}
|
|
7550
7550
|
}, d = function(h) {
|
|
7551
7551
|
const p = s.value.findIndex((m) => {
|
|
7552
|
-
var g
|
|
7553
|
-
return (
|
|
7552
|
+
var g;
|
|
7553
|
+
return (m == null ? void 0 : m.UUID) === ((g = h.upload) == null ? void 0 : g.uuid);
|
|
7554
7554
|
});
|
|
7555
7555
|
p !== -1 && s.value.splice(p, 1);
|
|
7556
7556
|
}, f = xe(() => t.tag ?? "form");
|
|
@@ -8,7 +8,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
8
8
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var b=!0,N=!1,I;return{s:function(){w=x[Symbol.iterator]()},n:function(){var L=w.next();return b=L.done,L},e:function(L){N=!0,I=L},f:function(){try{!b&&w.return!=null&&w.return()}finally{if(N)throw I}}}}function y(x,M){if(x){if(typeof x=="string")return C(x,M);var w=Object.prototype.toString.call(x).slice(8,-1);if(w==="Object"&&x.constructor&&(w=x.constructor.name),w==="Map"||w==="Set")return Array.from(x);if(w==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(w))return C(x,M)}}function C(x,M){(M==null||M>x.length)&&(M=x.length);for(var w=0,O=new Array(M);w<M;w++)O[w]=x[w];return O}var S={url:null,method:"post",withCredentials:!1,timeout:null,parallelUploads:2,uploadMultiple:!1,chunking:!1,forceChunking:!1,chunkSize:2e6,parallelChunkUploads:!1,retryChunks:!1,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,disablePreviews:!1,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:!1,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function(){},params:function(M,w,O){if(O)return{dzuuid:O.file.upload.uuid,dzchunkindex:O.index,dztotalfilesize:O.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:O.file.upload.totalChunkCount,dzchunkbyteoffset:O.index*this.options.chunkSize}},accept:function(M,w){return w()},chunksUploaded:function(M,w){w()},fallback:function(){var M;this.element.className="".concat(this.element.className," dz-browser-not-supported");var w=g(this.element.getElementsByTagName("div"),!0),O;try{for(w.s();!(O=w.n()).done;){var v=O.value;if(/(^| )dz-message($| )/.test(v.className)){M=v,v.className="dz-message";break}}}catch(N){w.e(N)}finally{w.f()}M||(M=j.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(M));var b=M.getElementsByTagName("span")[0];return b&&(b.textContent!=null?b.textContent=this.options.dictFallbackMessage:b.innerText!=null&&(b.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(M,w,O,v){var b={srcX:0,srcY:0,srcWidth:M.width,srcHeight:M.height},N=M.width/M.height;w==null&&O==null?(w=b.srcWidth,O=b.srcHeight):w==null?w=O*N:O==null&&(O=w/N),w=Math.min(w,b.srcWidth),O=Math.min(O,b.srcHeight);var I=w/O;if(b.srcWidth>w||b.srcHeight>O)if(v==="crop")N>I?(b.srcHeight=M.height,b.srcWidth=b.srcHeight*I):(b.srcWidth=M.width,b.srcHeight=b.srcWidth/I);else if(v==="contain")N>I?O=w/N:w=O*N;else throw new Error("Unknown resizeMethod '".concat(v,"'"));return b.srcX=(M.width-b.srcWidth)/2,b.srcY=(M.height-b.srcHeight)/2,b.trgWidth=w,b.trgHeight=O,b},transformFile:function(M,w){return(this.options.resizeWidth||this.options.resizeHeight)&&M.type.match(/image.*/)?this.resizeImage(M,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,w):w(M)},previewTemplate:m,drop:function(M){return this.element.classList.remove("dz-drag-hover")},dragstart:function(M){},dragend:function(M){return this.element.classList.remove("dz-drag-hover")},dragenter:function(M){return this.element.classList.add("dz-drag-hover")},dragover:function(M){return this.element.classList.add("dz-drag-hover")},dragleave:function(M){return this.element.classList.remove("dz-drag-hover")},paste:function(M){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(M){var w=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){M.previewElement=j.createElement(this.options.previewTemplate.trim()),M.previewTemplate=M.previewElement,this.previewsContainer.appendChild(M.previewElement);var O=g(M.previewElement.querySelectorAll("[data-dz-name]"),!0),v;try{for(O.s();!(v=O.n()).done;){var b=v.value;b.textContent=M.name}}catch(U){O.e(U)}finally{O.f()}var N=g(M.previewElement.querySelectorAll("[data-dz-size]"),!0),I;try{for(N.s();!(I=N.n()).done;)b=I.value,b.innerHTML=this.filesize(M.size)}catch(U){N.e(U)}finally{N.f()}this.options.addRemoveLinks&&(M._removeLink=j.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>")),M.previewElement.appendChild(M._removeLink));var D=function(K){return K.preventDefault(),K.stopPropagation(),M.status===j.UPLOADING?j.confirm(w.options.dictCancelUploadConfirmation,function(){return w.removeFile(M)}):w.options.dictRemoveFileConfirmation?j.confirm(w.options.dictRemoveFileConfirmation,function(){return w.removeFile(M)}):w.removeFile(M)},L=g(M.previewElement.querySelectorAll("[data-dz-remove]"),!0),z;try{for(L.s();!(z=L.n()).done;){var W=z.value;W.addEventListener("click",D)}}catch(U){L.e(U)}finally{L.f()}}},removedfile:function(M){return M.previewElement!=null&&M.previewElement.parentNode!=null&&M.previewElement.parentNode.removeChild(M.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(M,w){if(M.previewElement){M.previewElement.classList.remove("dz-file-preview");var O=g(M.previewElement.querySelectorAll("[data-dz-thumbnail]"),!0),v;try{for(O.s();!(v=O.n()).done;){var b=v.value;b.alt=M.name,b.src=w}}catch(N){O.e(N)}finally{O.f()}return setTimeout(function(){return M.previewElement.classList.add("dz-image-preview")},1)}},error:function(M,w){if(M.previewElement){M.previewElement.classList.add("dz-error"),typeof w!="string"&&w.error&&(w=w.error);var O=g(M.previewElement.querySelectorAll("[data-dz-errormessage]"),!0),v;try{for(O.s();!(v=O.n()).done;){var b=v.value;b.textContent=w}}catch(N){O.e(N)}finally{O.f()}}},errormultiple:function(){},processing:function(M){if(M.previewElement&&(M.previewElement.classList.add("dz-processing"),M._removeLink))return M._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(M,w,O){if(M.previewElement){var v=g(M.previewElement.querySelectorAll("[data-dz-uploadprogress]"),!0),b;try{for(v.s();!(b=v.n()).done;){var N=b.value;N.nodeName==="PROGRESS"?N.value=w:N.style.width="".concat(w,"%")}}catch(I){v.e(I)}finally{v.f()}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(M){if(M.previewElement)return M.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(M){return this.emit("error",M,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(M){if(M._removeLink&&(M._removeLink.innerHTML=this.options.dictRemoveFile),M.previewElement)return M.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}},k=S;function E(x){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?E=function(w){return typeof w}:E=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},E(x)}function _(x,M){var w;if(typeof Symbol>"u"||x[Symbol.iterator]==null){if(Array.isArray(x)||(w=T(x))||M&&x&&typeof x.length=="number"){w&&(x=w);var O=0,v=function(){};return{s:v,n:function(){return O>=x.length?{done:!0}:{done:!1,value:x[O++]}},e:function(L){throw L},f:v}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
9
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var b=!0,N=!1,I;return{s:function(){w=x[Symbol.iterator]()},n:function(){var L=w.next();return b=L.done,L},e:function(L){N=!0,I=L},f:function(){try{!b&&w.return!=null&&w.return()}finally{if(N)throw I}}}}function T(x,M){if(x){if(typeof x=="string")return P(x,M);var w=Object.prototype.toString.call(x).slice(8,-1);if(w==="Object"&&x.constructor&&(w=x.constructor.name),w==="Map"||w==="Set")return Array.from(x);if(w==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(w))return P(x,M)}}function P(x,M){(M==null||M>x.length)&&(M=x.length);for(var w=0,O=new Array(M);w<M;w++)O[w]=x[w];return O}function F(x,M){if(!(x instanceof M))throw new TypeError("Cannot call a class as a function")}function V(x,M){for(var w=0;w<M.length;w++){var O=M[w];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(x,O.key,O)}}function $(x,M,w){return M&&V(x.prototype,M),w&&V(x,w),x}function B(x,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(M&&M.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),M&&R(x,M)}function R(x,M){return R=Object.setPrototypeOf||function(O,v){return O.__proto__=v,O},R(x,M)}function H(x){var M=X();return function(){var O=oe(x),v;if(M){var b=oe(this).constructor;v=Reflect.construct(O,arguments,b)}else v=O.apply(this,arguments);return Y(this,v)}}function Y(x,M){return M&&(E(M)==="object"||typeof M=="function")?M:Z(x)}function Z(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function X(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function oe(x){return oe=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},oe(x)}var j=function(x){B(w,x);var M=H(w);function w(O,v){var b;F(this,w),b=M.call(this);var N,I;if(b.element=O,b.version=w.version,b.clickableElements=[],b.listeners=[],b.files=[],typeof b.element=="string"&&(b.element=document.querySelector(b.element)),!b.element||b.element.nodeType==null)throw new Error("Invalid dropzone element.");if(b.element.dropzone)throw new Error("Dropzone already attached.");w.instances.push(Z(b)),b.element.dropzone=Z(b);var D=(I=w.optionsForElement(b.element))!=null?I:{};if(b.options=w.extend({},k,D,v??{}),b.options.previewTemplate=b.options.previewTemplate.replace(/\n*/g,""),b.options.forceFallback||!w.isBrowserSupported())return Y(b,b.options.fallback.call(Z(b)));if(b.options.url==null&&(b.options.url=b.element.getAttribute("action")),!b.options.url)throw new Error("No URL provided.");if(b.options.acceptedFiles&&b.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");if(b.options.uploadMultiple&&b.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");return b.options.acceptedMimeTypes&&(b.options.acceptedFiles=b.options.acceptedMimeTypes,delete b.options.acceptedMimeTypes),b.options.renameFilename!=null&&(b.options.renameFile=function(L){return b.options.renameFilename.call(Z(b),L.name,L)}),typeof b.options.method=="string"&&(b.options.method=b.options.method.toUpperCase()),(N=b.getExistingFallback())&&N.parentNode&&N.parentNode.removeChild(N),b.options.previewsContainer!==!1&&(b.options.previewsContainer?b.previewsContainer=w.getElement(b.options.previewsContainer,"previewsContainer"):b.previewsContainer=b.element),b.options.clickable&&(b.options.clickable===!0?b.clickableElements=[b.element]:b.clickableElements=w.getElements(b.options.clickable,"clickable")),b.init(),b}return $(w,[{key:"getAcceptedFiles",value:function(){return this.files.filter(function(v){return v.accepted}).map(function(v){return v})}},{key:"getRejectedFiles",value:function(){return this.files.filter(function(v){return!v.accepted}).map(function(v){return v})}},{key:"getFilesWithStatus",value:function(v){return this.files.filter(function(b){return b.status===v}).map(function(b){return b})}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(w.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(w.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(w.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter(function(v){return v.status===w.UPLOADING||v.status===w.QUEUED}).map(function(v){return v})}},{key:"init",value:function(){var v=this;if(this.element.tagName==="form"&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(w.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>"))),this.clickableElements.length){var b=function W(){v.hiddenFileInput&&v.hiddenFileInput.parentNode.removeChild(v.hiddenFileInput),v.hiddenFileInput=document.createElement("input"),v.hiddenFileInput.setAttribute("type","file"),(v.options.maxFiles===null||v.options.maxFiles>1)&&v.hiddenFileInput.setAttribute("multiple","multiple"),v.hiddenFileInput.className="dz-hidden-input",v.options.acceptedFiles!==null&&v.hiddenFileInput.setAttribute("accept",v.options.acceptedFiles),v.options.capture!==null&&v.hiddenFileInput.setAttribute("capture",v.options.capture),v.hiddenFileInput.setAttribute("tabindex","-1"),v.hiddenFileInput.style.visibility="hidden",v.hiddenFileInput.style.position="absolute",v.hiddenFileInput.style.top="0",v.hiddenFileInput.style.left="0",v.hiddenFileInput.style.height="0",v.hiddenFileInput.style.width="0",w.getElement(v.options.hiddenInputContainer,"hiddenInputContainer").appendChild(v.hiddenFileInput),v.hiddenFileInput.addEventListener("change",function(){var U=v.hiddenFileInput.files;if(U.length){var K=_(U,!0),G;try{for(K.s();!(G=K.n()).done;){var q=G.value;v.addFile(q)}}catch(ue){K.e(ue)}finally{K.f()}}v.emit("addedfiles",U),W()})};b()}this.URL=window.URL!==null?window.URL:window.webkitURL;var N=_(this.events,!0),I;try{for(N.s();!(I=N.n()).done;){var D=I.value;this.on(D,this.options[D])}}catch(W){N.e(W)}finally{N.f()}this.on("uploadprogress",function(){return v.updateTotalUploadProgress()}),this.on("removedfile",function(){return v.updateTotalUploadProgress()}),this.on("canceled",function(W){return v.emit("complete",W)}),this.on("complete",function(W){if(v.getAddedFiles().length===0&&v.getUploadingFiles().length===0&&v.getQueuedFiles().length===0)return setTimeout(function(){return v.emit("queuecomplete")},0)});var L=function(U){if(U.dataTransfer.types){for(var K=0;K<U.dataTransfer.types.length;K++)if(U.dataTransfer.types[K]==="Files")return!0}return!1},z=function(U){if(L(U))return U.stopPropagation(),U.preventDefault?U.preventDefault():U.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:function(U){return v.emit("dragstart",U)},dragenter:function(U){return z(U),v.emit("dragenter",U)},dragover:function(U){var K;try{K=U.dataTransfer.effectAllowed}catch{}return U.dataTransfer.dropEffect=K==="move"||K==="linkMove"?"move":"copy",z(U),v.emit("dragover",U)},dragleave:function(U){return v.emit("dragleave",U)},drop:function(U){return z(U),v.drop(U)},dragend:function(U){return v.emit("dragend",U)}}}],this.clickableElements.forEach(function(W){return v.listeners.push({element:W,events:{click:function(K){return(W!==v.element||K.target===v.element||w.elementInside(K.target,v.element.querySelector(".dz-message")))&&v.hiddenFileInput.click(),!0}}})}),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),this.hiddenFileInput!=null&&this.hiddenFileInput.parentNode&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,w.instances.splice(w.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var v,b=0,N=0,I=this.getActiveFiles();if(I.length){var D=_(this.getActiveFiles(),!0),L;try{for(D.s();!(L=D.n()).done;){var z=L.value;b+=z.upload.bytesSent,N+=z.upload.total}}catch(W){D.e(W)}finally{D.f()}v=100*b/N}else v=100;return this.emit("totaluploadprogress",v,N,b)}},{key:"_getParamName",value:function(v){return typeof this.options.paramName=="function"?this.options.paramName(v):"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(v,"]"):"")}},{key:"_renameFile",value:function(v){return typeof this.options.renameFile!="function"?v.name:this.options.renameFile(v)}},{key:"getFallbackForm",value:function(){var v,b;if(v=this.getExistingFallback())return v;var N='<div class="dz-fallback">';this.options.dictFallbackText&&(N+="<p>".concat(this.options.dictFallbackText,"</p>")),N+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':void 0,' /><input type="submit" value="Upload!"></div>');var I=w.createElement(N);return this.element.tagName!=="FORM"?(b=w.createElement('<form action="'.concat(this.options.url,'" enctype="multipart/form-data" method="').concat(this.options.method,'"></form>')),b.appendChild(I)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),b??I}},{key:"getExistingFallback",value:function(){for(var v=function(z){var W=_(z,!0),U;try{for(W.s();!(U=W.n()).done;){var K=U.value;if(/(^| )fallback($| )/.test(K.className))return K}}catch(G){W.e(G)}finally{W.f()}},b=0,N=["div","form"];b<N.length;b++){var I=N[b],D;if(D=v(this.element.getElementsByTagName(I)))return D}}},{key:"setupEventListeners",value:function(){return this.listeners.map(function(v){return function(){var b=[];for(var N in v.events){var I=v.events[N];b.push(v.element.addEventListener(N,I,!1))}return b}()})}},{key:"removeEventListeners",value:function(){return this.listeners.map(function(v){return function(){var b=[];for(var N in v.events){var I=v.events[N];b.push(v.element.removeEventListener(N,I,!1))}return b}()})}},{key:"disable",value:function(){var v=this;return this.clickableElements.forEach(function(b){return b.classList.remove("dz-clickable")}),this.removeEventListeners(),this.disabled=!0,this.files.map(function(b){return v.cancelUpload(b)})}},{key:"enable",value:function(){return delete this.disabled,this.clickableElements.forEach(function(v){return v.classList.add("dz-clickable")}),this.setupEventListeners()}},{key:"filesize",value:function(v){var b=0,N="b";if(v>0){for(var I=["tb","gb","mb","kb","b"],D=0;D<I.length;D++){var L=I[D],z=Math.pow(this.options.filesizeBase,4-D)/10;if(v>=z){b=v/Math.pow(this.options.filesizeBase,4-D),N=L;break}}b=Math.round(10*b)/10}return"<strong>".concat(b,"</strong> ").concat(this.options.dictFileSizeUnits[N])}},{key:"_updateMaxFilesReachedClass",value:function(){return this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(v){if(v.dataTransfer){this.emit("drop",v);for(var b=[],N=0;N<v.dataTransfer.files.length;N++)b[N]=v.dataTransfer.files[N];if(b.length){var I=v.dataTransfer.items;I&&I.length&&I[0].webkitGetAsEntry!=null?this._addFilesFromItems(I):this.handleFiles(b)}this.emit("addedfiles",b)}}},{key:"paste",value:function(v){if(Ae(v!=null?v.clipboardData:void 0,function(N){return N.items})!=null){this.emit("paste",v);var b=v.clipboardData.items;if(b.length)return this._addFilesFromItems(b)}}},{key:"handleFiles",value:function(v){var b=_(v,!0),N;try{for(b.s();!(N=b.n()).done;){var I=N.value;this.addFile(I)}}catch(D){b.e(D)}finally{b.f()}}},{key:"_addFilesFromItems",value:function(v){var b=this;return function(){var N=[],I=_(v,!0),D;try{for(I.s();!(D=I.n()).done;){var L=D.value,z;L.webkitGetAsEntry!=null&&(z=L.webkitGetAsEntry())?z.isFile?N.push(b.addFile(L.getAsFile())):z.isDirectory?N.push(b._addFilesFromDirectory(z,z.name)):N.push(void 0):L.getAsFile!=null&&(L.kind==null||L.kind==="file")?N.push(b.addFile(L.getAsFile())):N.push(void 0)}}catch(W){I.e(W)}finally{I.f()}return N}()}},{key:"_addFilesFromDirectory",value:function(v,b){var N=this,I=v.createReader(),D=function(W){return Me(console,"log",function(U){return U.log(W)})},L=function z(){return I.readEntries(function(W){if(W.length>0){var U=_(W,!0),K;try{for(U.s();!(K=U.n()).done;){var G=K.value;G.isFile?G.file(function(q){if(!(N.options.ignoreHiddenFiles&&q.name.substring(0,1)==="."))return q.fullPath="".concat(b,"/").concat(q.name),N.addFile(q)}):G.isDirectory&&N._addFilesFromDirectory(G,"".concat(b,"/").concat(G.name))}}catch(q){U.e(q)}finally{U.f()}z()}return null},D)};return L()}},{key:"accept",value:function(v,b){this.options.maxFilesize&&v.size>this.options.maxFilesize*1024*1024?b(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(v.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):w.isValidFile(v,this.options.acceptedFiles)?this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(b(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",v)):this.options.accept.call(this,v,b):b(this.options.dictInvalidFileType)}},{key:"addFile",value:function(v){var b=this;v.upload={uuid:w.uuidv4(),progress:0,total:v.size,bytesSent:0,filename:this._renameFile(v)},this.files.push(v),v.status=w.ADDED,this.emit("addedfile",v),this._enqueueThumbnail(v),this.accept(v,function(N){N?(v.accepted=!1,b._errorProcessing([v],N)):(v.accepted=!0,b.options.autoQueue&&b.enqueueFile(v)),b._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(v){var b=_(v,!0),N;try{for(b.s();!(N=b.n()).done;){var I=N.value;this.enqueueFile(I)}}catch(D){b.e(D)}finally{b.f()}return null}},{key:"enqueueFile",value:function(v){var b=this;if(v.status===w.ADDED&&v.accepted===!0){if(v.status=w.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return b.processQueue()},0)}else throw new Error("This file can't be queued because it has already been processed or was rejected.")}},{key:"_enqueueThumbnail",value:function(v){var b=this;if(this.options.createImageThumbnails&&v.type.match(/image.*/)&&v.size<=this.options.maxThumbnailFilesize*1024*1024)return this._thumbnailQueue.push(v),setTimeout(function(){return b._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var v=this;if(!(this._processingThumbnail||this._thumbnailQueue.length===0)){this._processingThumbnail=!0;var b=this._thumbnailQueue.shift();return this.createThumbnail(b,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(N){return v.emit("thumbnail",b,N),v._processingThumbnail=!1,v._processThumbnailQueue()})}}},{key:"removeFile",value:function(v){if(v.status===w.UPLOADING&&this.cancelUpload(v),this.files=ce(this.files,v),this.emit("removedfile",v),this.files.length===0)return this.emit("reset")}},{key:"removeAllFiles",value:function(v){v==null&&(v=!1);var b=_(this.files.slice(),!0),N;try{for(b.s();!(N=b.n()).done;){var I=N.value;(I.status!==w.UPLOADING||v)&&this.removeFile(I)}}catch(D){b.e(D)}finally{b.f()}return null}},{key:"resizeImage",value:function(v,b,N,I,D){var L=this;return this.createThumbnail(v,b,N,I,!0,function(z,W){if(W==null)return D(v);var U=L.options.resizeMimeType;U==null&&(U=v.type);var K=W.toDataURL(U,L.options.resizeQuality);return(U==="image/jpeg"||U==="image/jpg")&&(K=Ce.restore(v.dataURL,K)),D(w.dataURItoBlob(K))})}},{key:"createThumbnail",value:function(v,b,N,I,D,L){var z=this,W=new FileReader;W.onload=function(){if(v.dataURL=W.result,v.type==="image/svg+xml"){L!=null&&L(W.result);return}z.createThumbnailFromUrl(v,b,N,I,D,L)},W.readAsDataURL(v)}},{key:"displayExistingFile",value:function(v,b,N,I){var D=this,L=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;if(this.emit("addedfile",v),this.emit("complete",v),!L)this.emit("thumbnail",v,b),N&&N();else{var z=function(U){D.emit("thumbnail",v,U),N&&N()};v.dataURL=b,this.createThumbnailFromUrl(v,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,z,I)}}},{key:"createThumbnailFromUrl",value:function(v,b,N,I,D,L,z){var W=this,U=document.createElement("img");return z&&(U.crossOrigin=z),D=getComputedStyle(document.body).imageOrientation=="from-image"?!1:D,U.onload=function(){var K=function(q){return q(1)};return typeof EXIF<"u"&&EXIF!==null&&D&&(K=function(q){return EXIF.getData(U,function(){return q(EXIF.getTag(this,"Orientation"))})}),K(function(G){v.width=U.width,v.height=U.height;var q=W.options.resize.call(W,v,b,N,I),ue=document.createElement("canvas"),ye=ue.getContext("2d");switch(ue.width=q.trgWidth,ue.height=q.trgHeight,G>4&&(ue.width=q.trgHeight,ue.height=q.trgWidth),G){case 2:ye.translate(ue.width,0),ye.scale(-1,1);break;case 3:ye.translate(ue.width,ue.height),ye.rotate(Math.PI);break;case 4:ye.translate(0,ue.height),ye.scale(1,-1);break;case 5:ye.rotate(.5*Math.PI),ye.scale(1,-1);break;case 6:ye.rotate(.5*Math.PI),ye.translate(0,-ue.width);break;case 7:ye.rotate(.5*Math.PI),ye.translate(ue.height,-ue.width),ye.scale(-1,1);break;case 8:ye.rotate(-.5*Math.PI),ye.translate(-ue.height,0);break}ke(ye,U,q.srcX!=null?q.srcX:0,q.srcY!=null?q.srcY:0,q.srcWidth,q.srcHeight,q.trgX!=null?q.trgX:0,q.trgY!=null?q.trgY:0,q.trgWidth,q.trgHeight);var Ie=ue.toDataURL("image/png");if(L!=null)return L(Ie,ue)})},L!=null&&(U.onerror=L),U.src=v.dataURL}},{key:"processQueue",value:function(){var v=this.options.parallelUploads,b=this.getUploadingFiles().length,N=b;if(!(b>=v)){var I=this.getQueuedFiles();if(I.length>0){if(this.options.uploadMultiple)return this.processFiles(I.slice(0,v-b));for(;N<v;){if(!I.length)return;this.processFile(I.shift()),N++}}}}},{key:"processFile",value:function(v){return this.processFiles([v])}},{key:"processFiles",value:function(v){var b=_(v,!0),N;try{for(b.s();!(N=b.n()).done;){var I=N.value;I.processing=!0,I.status=w.UPLOADING,this.emit("processing",I)}}catch(D){b.e(D)}finally{b.f()}return this.options.uploadMultiple&&this.emit("processingmultiple",v),this.uploadFiles(v)}},{key:"_getFilesWithXhr",value:function(v){return this.files.filter(function(b){return b.xhr===v}).map(function(b){return b})}},{key:"cancelUpload",value:function(v){if(v.status===w.UPLOADING){var b=this._getFilesWithXhr(v.xhr),N=_(b,!0),I;try{for(N.s();!(I=N.n()).done;){var D=I.value;D.status=w.CANCELED}}catch(U){N.e(U)}finally{N.f()}typeof v.xhr<"u"&&v.xhr.abort();var L=_(b,!0),z;try{for(L.s();!(z=L.n()).done;){var W=z.value;this.emit("canceled",W)}}catch(U){L.e(U)}finally{L.f()}this.options.uploadMultiple&&this.emit("canceledmultiple",b)}else(v.status===w.ADDED||v.status===w.QUEUED)&&(v.status=w.CANCELED,this.emit("canceled",v),this.options.uploadMultiple&&this.emit("canceledmultiple",[v]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(v){if(typeof v=="function"){for(var b=arguments.length,N=new Array(b>1?b-1:0),I=1;I<b;I++)N[I-1]=arguments[I];return v.apply(this,N)}return v}},{key:"uploadFile",value:function(v){return this.uploadFiles([v])}},{key:"uploadFiles",value:function(v){var b=this;this._transformFiles(v,function(N){if(b.options.chunking){var I=N[0];v[0].upload.chunked=b.options.chunking&&(b.options.forceChunking||I.size>b.options.chunkSize),v[0].upload.totalChunkCount=Math.ceil(I.size/b.options.chunkSize)}if(v[0].upload.chunked){var D=v[0],L=N[0];D.upload.chunks=[];var z=function(){for(var q=0;D.upload.chunks[q]!==void 0;)q++;if(!(q>=D.upload.totalChunkCount)){var ue=q*b.options.chunkSize,ye=Math.min(ue+b.options.chunkSize,L.size),Ie={name:b._getParamName(0),data:L.webkitSlice?L.webkitSlice(ue,ye):L.slice(ue,ye),filename:D.upload.filename,chunkIndex:q};D.upload.chunks[q]={file:D,index:q,dataBlock:Ie,status:w.UPLOADING,progress:0,retries:0},b._uploadData(v,[Ie])}};if(D.upload.finishedChunkUpload=function(G,q){var ue=!0;G.status=w.SUCCESS,G.dataBlock=null,G.xhr=null;for(var ye=0;ye<D.upload.totalChunkCount;ye++){if(D.upload.chunks[ye]===void 0)return z();D.upload.chunks[ye].status!==w.SUCCESS&&(ue=!1)}ue&&b.options.chunksUploaded(D,function(){b._finished(v,q,null)})},b.options.parallelChunkUploads)for(var W=0;W<D.upload.totalChunkCount;W++)z();else z()}else{for(var U=[],K=0;K<v.length;K++)U[K]={name:b._getParamName(K),data:N[K],filename:v[K].upload.filename};b._uploadData(v,U)}})}},{key:"_getChunk",value:function(v,b){for(var N=0;N<v.upload.totalChunkCount;N++)if(v.upload.chunks[N]!==void 0&&v.upload.chunks[N].xhr===b)return v.upload.chunks[N]}},{key:"_uploadData",value:function(v,b){var N=this,I=new XMLHttpRequest,D=_(v,!0),L;try{for(D.s();!(L=D.n()).done;){var z=L.value;z.xhr=I}}catch(le){D.e(le)}finally{D.f()}v[0].upload.chunked&&(v[0].upload.chunks[b[0].chunkIndex].xhr=I);var W=this.resolveOption(this.options.method,v),U=this.resolveOption(this.options.url,v);I.open(W,U,!0);var K=this.resolveOption(this.options.timeout,v);K&&(I.timeout=this.resolveOption(this.options.timeout,v)),I.withCredentials=!!this.options.withCredentials,I.onload=function(le){N._finishedUploading(v,I,le)},I.ontimeout=function(){N._handleUploadError(v,I,"Request timedout after ".concat(N.options.timeout/1e3," seconds"))},I.onerror=function(){N._handleUploadError(v,I)};var G=I.upload!=null?I.upload:I;G.onprogress=function(le){return N._updateFilesUploadProgress(v,I,le)};var q={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};this.options.headers&&w.extend(q,this.options.headers);for(var ue in q){var ye=q[ue];ye&&I.setRequestHeader(ue,ye)}var Ie=new FormData;if(this.options.params){var Ve=this.options.params;typeof Ve=="function"&&(Ve=Ve.call(this,v,I,v[0].upload.chunked?this._getChunk(v[0],I):null));for(var Fe in Ve){var De=Ve[Fe];if(Array.isArray(De))for(var Ye=0;Ye<De.length;Ye++)Ie.append(Fe,De[Ye]);else Ie.append(Fe,De)}}var Ct=_(v,!0),it;try{for(Ct.s();!(it=Ct.n()).done;){var Kn=it.value;this.emit("sending",Kn,I,Ie)}}catch(le){Ct.e(le)}finally{Ct.f()}this.options.uploadMultiple&&this.emit("sendingmultiple",v,I,Ie),this._addFormElementData(Ie);for(var J=0;J<b.length;J++){var ae=b[J];Ie.append(ae.name,ae.data,ae.filename)}this.submitRequest(I,Ie,v)}},{key:"_transformFiles",value:function(v,b){for(var N=this,I=[],D=0,L=function(U){N.options.transformFile.call(N,v[U],function(K){I[U]=K,++D===v.length&&b(I)})},z=0;z<v.length;z++)L(z)}},{key:"_addFormElementData",value:function(v){if(this.element.tagName==="FORM"){var b=_(this.element.querySelectorAll("input, textarea, select, button"),!0),N;try{for(b.s();!(N=b.n()).done;){var I=N.value,D=I.getAttribute("name"),L=I.getAttribute("type");if(L&&(L=L.toLowerCase()),!(typeof D>"u"||D===null))if(I.tagName==="SELECT"&&I.hasAttribute("multiple")){var z=_(I.options,!0),W;try{for(z.s();!(W=z.n()).done;){var U=W.value;U.selected&&v.append(D,U.value)}}catch(K){z.e(K)}finally{z.f()}}else(!L||L!=="checkbox"&&L!=="radio"||I.checked)&&v.append(D,I.value)}}catch(K){b.e(K)}finally{b.f()}}}},{key:"_updateFilesUploadProgress",value:function(v,b,N){if(v[0].upload.chunked){var z=v[0],W=this._getChunk(z,b);N?(W.progress=100*N.loaded/N.total,W.total=N.total,W.bytesSent=N.loaded):(W.progress=100,W.bytesSent=W.total),z.upload.progress=0,z.upload.total=0,z.upload.bytesSent=0;for(var U=0;U<z.upload.totalChunkCount;U++)z.upload.chunks[U]&&typeof z.upload.chunks[U].progress<"u"&&(z.upload.progress+=z.upload.chunks[U].progress,z.upload.total+=z.upload.chunks[U].total,z.upload.bytesSent+=z.upload.chunks[U].bytesSent);z.upload.progress=z.upload.progress/z.upload.totalChunkCount,this.emit("uploadprogress",z,z.upload.progress,z.upload.bytesSent)}else{var I=_(v,!0),D;try{for(I.s();!(D=I.n()).done;){var L=D.value;L.upload.total&&L.upload.bytesSent&&L.upload.bytesSent==L.upload.total||(N?(L.upload.progress=100*N.loaded/N.total,L.upload.total=N.total,L.upload.bytesSent=N.loaded):(L.upload.progress=100,L.upload.bytesSent=L.upload.total),this.emit("uploadprogress",L,L.upload.progress,L.upload.bytesSent))}}catch(K){I.e(K)}finally{I.f()}}}},{key:"_finishedUploading",value:function(v,b,N){var I;if(v[0].status!==w.CANCELED&&b.readyState===4){if(b.responseType!=="arraybuffer"&&b.responseType!=="blob"&&(I=b.responseText,b.getResponseHeader("content-type")&&~b.getResponseHeader("content-type").indexOf("application/json")))try{I=JSON.parse(I)}catch(D){N=D,I="Invalid JSON response from server."}this._updateFilesUploadProgress(v,b),200<=b.status&&b.status<300?v[0].upload.chunked?v[0].upload.finishedChunkUpload(this._getChunk(v[0],b),I):this._finished(v,I,N):this._handleUploadError(v,b,I)}}},{key:"_handleUploadError",value:function(v,b,N){if(v[0].status!==w.CANCELED){if(v[0].upload.chunked&&this.options.retryChunks){var I=this._getChunk(v[0],b);if(I.retries++<this.options.retryChunksLimit){this._uploadData(v,[I.dataBlock]);return}else console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(v,N||this.options.dictResponseError.replace("{{statusCode}}",b.status),b)}}},{key:"submitRequest",value:function(v,b,N){if(v.readyState!=1){console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.");return}v.send(b)}},{key:"_finished",value:function(v,b,N){var I=_(v,!0),D;try{for(I.s();!(D=I.n()).done;){var L=D.value;L.status=w.SUCCESS,this.emit("success",L,b,N),this.emit("complete",L)}}catch(z){I.e(z)}finally{I.f()}if(this.options.uploadMultiple&&(this.emit("successmultiple",v,b,N),this.emit("completemultiple",v)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(v,b,N){var I=_(v,!0),D;try{for(I.s();!(D=I.n()).done;){var L=D.value;L.status=w.ERROR,this.emit("error",L,b,N),this.emit("complete",L)}}catch(z){I.e(z)}finally{I.f()}if(this.options.uploadMultiple&&(this.emit("errormultiple",v,b,N),this.emit("completemultiple",v)),this.options.autoProcessQueue)return this.processQueue()}}],[{key:"initClass",value:function(){this.prototype.Emitter=h,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"extend",value:function(v){for(var b=arguments.length,N=new Array(b>1?b-1:0),I=1;I<b;I++)N[I-1]=arguments[I];for(var D=0,L=N;D<L.length;D++){var z=L[D];for(var W in z){var U=z[W];v[W]=U}}return v}},{key:"uuidv4",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(v){var b=Math.random()*16|0,N=v==="x"?b:b&3|8;return N.toString(16)})}}]),w}(h);j.initClass(),j.version="5.9.3",j.options={},j.optionsForElement=function(x){if(x.getAttribute("id"))return j.options[he(x.getAttribute("id"))]},j.instances=[],j.forElement=function(x){if(typeof x=="string"&&(x=document.querySelector(x)),(x!=null?x.dropzone:void 0)==null)throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return x.dropzone},j.autoDiscover=!0,j.discover=function(){var x;if(document.querySelectorAll)x=document.querySelectorAll(".dropzone");else{x=[];var M=function(O){return function(){var v=[],b=_(O,!0),N;try{for(b.s();!(N=b.n()).done;){var I=N.value;/(^| )dropzone($| )/.test(I.className)?v.push(x.push(I)):v.push(void 0)}}catch(D){b.e(D)}finally{b.f()}return v}()};M(document.getElementsByTagName("div")),M(document.getElementsByTagName("form"))}return function(){var w=[],O=_(x,!0),v;try{for(O.s();!(v=O.n()).done;){var b=v.value;j.optionsForElement(b)!==!1?w.push(new j(b)):w.push(void 0)}}catch(N){O.e(N)}finally{O.f()}return w}()},j.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],j.isBrowserSupported=function(){var x=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!("classList"in document.createElement("a")))x=!1;else{j.blacklistedBrowsers!==void 0&&(j.blockedBrowsers=j.blacklistedBrowsers);var M=_(j.blockedBrowsers,!0),w;try{for(M.s();!(w=M.n()).done;){var O=w.value;if(O.test(navigator.userAgent)){x=!1;continue}}}catch(v){M.e(v)}finally{M.f()}}else x=!1;return x},j.dataURItoBlob=function(x){for(var M=atob(x.split(",")[1]),w=x.split(",")[0].split(":")[1].split(";")[0],O=new ArrayBuffer(M.length),v=new Uint8Array(O),b=0,N=M.length,I=0<=N;I?b<=N:b>=N;I?b++:b--)v[b]=M.charCodeAt(b);return new Blob([O],{type:w})};var ce=function(M,w){return M.filter(function(O){return O!==w}).map(function(O){return O})},he=function(M){return M.replace(/[\-_](\w)/g,function(w){return w.charAt(1).toUpperCase()})};j.createElement=function(x){var M=document.createElement("div");return M.innerHTML=x,M.childNodes[0]},j.elementInside=function(x,M){if(x===M)return!0;for(;x=x.parentNode;)if(x===M)return!0;return!1},j.getElement=function(x,M){var w;if(typeof x=="string"?w=document.querySelector(x):x.nodeType!=null&&(w=x),w==null)throw new Error("Invalid `".concat(M,"` option provided. Please provide a CSS selector or a plain HTML element."));return w},j.getElements=function(x,M){var w,O;if(x instanceof Array){O=[];try{var v=_(x,!0),b;try{for(v.s();!(b=v.n()).done;)w=b.value,O.push(this.getElement(w,M))}catch(D){v.e(D)}finally{v.f()}}catch{O=null}}else if(typeof x=="string"){O=[];var N=_(document.querySelectorAll(x),!0),I;try{for(N.s();!(I=N.n()).done;)w=I.value,O.push(w)}catch(D){N.e(D)}finally{N.f()}}else x.nodeType!=null&&(O=[x]);if(O==null||!O.length)throw new Error("Invalid `".concat(M,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."));return O},j.confirm=function(x,M,w){if(window.confirm(x))return M();if(w!=null)return w()},j.isValidFile=function(x,M){if(!M)return!0;M=M.split(",");var w=x.type,O=w.replace(/\/.*$/,""),v=_(M,!0),b;try{for(v.s();!(b=v.n()).done;){var N=b.value;if(N=N.trim(),N.charAt(0)==="."){if(x.name.toLowerCase().indexOf(N.toLowerCase(),x.name.length-N.length)!==-1)return!0}else if(/\/\*$/.test(N)){if(O===N.replace(/\/.*$/,""))return!0}else if(w===N)return!0}}catch(I){v.e(I)}finally{v.f()}return!1},typeof jQuery<"u"&&jQuery!==null&&(jQuery.fn.dropzone=function(x){return this.each(function(){return new j(this,x)})}),j.ADDED="added",j.QUEUED="queued",j.ACCEPTED=j.QUEUED,j.UPLOADING="uploading",j.PROCESSING=j.UPLOADING,j.CANCELED="canceled",j.ERROR="error",j.SUCCESS="success";var be=function(M){M.naturalWidth;var w=M.naturalHeight,O=document.createElement("canvas");O.width=1,O.height=w;var v=O.getContext("2d");v.drawImage(M,0,0);for(var b=v.getImageData(1,0,1,w),N=b.data,I=0,D=w,L=w;L>I;){var z=N[(L-1)*4+3];z===0?D=L:I=L,L=D+I>>1}var W=L/w;return W===0?1:W},ke=function(M,w,O,v,b,N,I,D,L,z){var W=be(w);return M.drawImage(w,O,v,b,N,I,D,L,z/W)},Ce=function(){function x(){F(this,x)}return $(x,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(w){for(var O="",v=void 0,b=void 0,N="",I=void 0,D=void 0,L=void 0,z="",W=0;v=w[W++],b=w[W++],N=w[W++],I=v>>2,D=(v&3)<<4|b>>4,L=(b&15)<<2|N>>6,z=N&63,isNaN(b)?L=z=64:isNaN(N)&&(z=64),O=O+this.KEY_STR.charAt(I)+this.KEY_STR.charAt(D)+this.KEY_STR.charAt(L)+this.KEY_STR.charAt(z),v=b=N="",I=D=L=z="",W<w.length;);return O}},{key:"restore",value:function(w,O){if(!w.match("data:image/jpeg;base64,"))return O;var v=this.decode64(w.replace("data:image/jpeg;base64,","")),b=this.slice2Segments(v),N=this.exifManipulation(O,b);return"data:image/jpeg;base64,".concat(this.encode64(N))}},{key:"exifManipulation",value:function(w,O){var v=this.getExifArray(O),b=this.insertExif(w,v),N=new Uint8Array(b);return N}},{key:"getExifArray",value:function(w){for(var O=void 0,v=0;v<w.length;){if(O=w[v],O[0]===255&O[1]===225)return O;v++}return[]}},{key:"insertExif",value:function(w,O){var v=w.replace("data:image/jpeg;base64,",""),b=this.decode64(v),N=b.indexOf(255,3),I=b.slice(0,N),D=b.slice(N),L=I;return L=L.concat(O),L=L.concat(D),L}},{key:"slice2Segments",value:function(w){for(var O=0,v=[];;){var b;if(w[O]===255&w[O+1]===218)break;if(w[O]===255&w[O+1]===216)O+=2;else{b=w[O+2]*256+w[O+3];var N=O+b+2,I=w.slice(O,N);v.push(I),O=N}if(O>w.length)break}return v}},{key:"decode64",value:function(w){var O=void 0,v=void 0,b="",N=void 0,I=void 0,D=void 0,L="",z=0,W=[],U=/[^A-Za-z0-9\+\/\=]/g;for(U.exec(w)&&console.warn(`There were invalid base64 characters in the input text.
|
|
10
10
|
Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='
|
|
11
|
-
Expect errors in decoding.`),w=w.replace(/[^A-Za-z0-9\+\/\=]/g,"");N=this.KEY_STR.indexOf(w.charAt(z++)),I=this.KEY_STR.indexOf(w.charAt(z++)),D=this.KEY_STR.indexOf(w.charAt(z++)),L=this.KEY_STR.indexOf(w.charAt(z++)),O=N<<2|I>>4,v=(I&15)<<4|D>>2,b=(D&3)<<6|L,W.push(O),D!==64&&W.push(v),L!==64&&W.push(b),O=v=b="",N=I=D=L="",z<w.length;);return W}}]),x}();Ce.initClass();var Oe=function(M,w){var O=!1,v=!0,b=M.document,N=b.documentElement,I=b.addEventListener?"addEventListener":"attachEvent",D=b.addEventListener?"removeEventListener":"detachEvent",L=b.addEventListener?"":"on",z=function U(K){if(!(K.type==="readystatechange"&&b.readyState!=="complete")&&((K.type==="load"?M:b)[D](L+K.type,U,!1),!O&&(O=!0)))return w.call(M,K.type||K)},W=function U(){try{N.doScroll("left")}catch{setTimeout(U,50);return}return z("poll")};if(b.readyState!=="complete"){if(b.createEventObject&&N.doScroll){try{v=!M.frameElement}catch{}v&&W()}return b[I](L+"DOMContentLoaded",z,!1),b[I](L+"readystatechange",z,!1),M[I](L+"load",z,!1)}};j._autoDiscoverFunction=function(){if(j.autoDiscover)return j.discover()},Oe(window,j._autoDiscoverFunction);function Ae(x,M){return typeof x<"u"&&x!==null?M(x):void 0}function Me(x,M,w){if(typeof x<"u"&&x!==null&&typeof x[M]=="function")return w(x,M)}window.Dropzone=j;var ve=j}(),i}()})})(Cu);var f2=Cu.exports;const Su=d2(f2),h2={class:"fallback"},p2=f.createElementVNode("input",{id:"file",type:"file",name:"file",multiple:""},null,-1),m2={for:"file"},g2={class:"dz-message","data-dz-message":""},y2={id:"bd-dropzone-theme",style:{display:"none"}},v2={class:"dz-preview dz-file-preview"},E2={class:"dz-details"},b2=f.createElementVNode("img",{"data-dz-thumbnail":"",class:"dz-image"},null,-1),C2=f.createElementVNode("div",{class:"dz-filename"},[f.createElementVNode("small",{"data-dz-name":""})],-1),S2=f.createElementVNode("div",{class:"dz-progress"},[f.createElementVNode("div",{class:"spinner-border text-primary spinner-border-sm",role:"status"},[f.createElementVNode("span",{class:"visually-hidden"},"Loading...")])],-1),w2={class:"dz-success-mark"},k2={class:"dz-error-message text-danger"},T2=f.createElementVNode("small",{"data-dz-errormessage":""},null,-1),wu=f.defineComponent({__name:"BDDropzone",props:{modelValue:{default:[]},buttonText:{default:void 0},multiple:{type:Boolean,default:!1},errorMessage:{default:void 0},fileSizeExceededMessage:{default:void 0},acceptedFiles:{default:".jpg"},url:{default:""},tag:{default:"form"},token:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=f.computed(()=>({variant:ni.PRIMARY,size:st.SM})),o=Jn(t,"modelValue",e);let i=null;Su.autoDiscover=!1,f.watch(()=>t.modelValue,()=>{s()}),f.onMounted(()=>{document.getElementById("dropzone")&&l()});const s=()=>{i&&(i.destroy(),l())},l=()=>{var p;i=new Su("#dropzone",{url:t.url,method:"post",acceptedFiles:t.acceptedFiles,addRemoveLinks:!1,maxFilesize:10,maxFiles:t.multiple?3:1,headers:{RequestVerificationToken:t.token},dictResponseError:t.errorMessage,dictFileTooBig:t.fileSizeExceededMessage,previewTemplate:(p=document.querySelector("#bd-dropzone-theme"))==null?void 0:p.innerHTML}),i.on("error",c),i.on("success",a),i.on("removedfile",d)},a=function(p,m){var g;o.value.push({UUID:(g=p.upload)==null?void 0:g.uuid,CorrelationId:m.CorrelationId,Naam:m.Naam}),u(p)},c=function(p){u(p)},u=function(p){const m=p.name;if(!(m.endsWith(".png")||m.endsWith(".jpg")||m.endsWith(".jpeg")||m.endsWith(".gif"))){const g=p.previewElement.getElementsByClassName("icon-file"),y=p.previewElement.getElementsByClassName("dz-image");g[0].classList.remove("d-none"),y[0].classList.add("d-none")}},d=function(p){const m=o.value.findIndex(g=>{var y,C;return((y=g.upload)==null?void 0:y.uuid)===((C=p.upload)==null?void 0:C.uuid)});m!==-1&&o.value.splice(m,1)},h=f.computed(()=>t.tag??"form");return(p,m)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(h.value),{id:"dropzone",class:"dropzone bd-dropzone",enctype:"multipart/form-data"},{default:f.withCtx(()=>[f.createElementVNode("div",h2,[p2,f.createTextVNode(" test "),f.createElementVNode("label",m2,[f.createVNode(f.unref(Yn)),f.createTextVNode(" "+f.toDisplayString(t.buttonText),1)])]),f.createElementVNode("div",g2,[f.createVNode(f.unref(pt),f.normalizeProps(f.guardReactiveProps(r.value)),{default:f.withCtx(()=>[f.createVNode(f.unref(Yn)),f.createTextVNode(" "+f.toDisplayString(t.buttonText),1)]),_:1},16)])]),_:1})),f.createElementVNode("div",y2,[f.createElementVNode("div",v2,[f.createElementVNode("div",E2,[b2,f.createVNode(f.unref(ia),{"data-dz-thumbnail":"",class:"d-none"}),C2,f.createVNode(f.unref(pt),{class:"dz-remove",alt:"Click me to remove the file.","data-dz-remove":""},{default:f.withCtx(()=>[f.createVNode(f.unref(ao))]),_:1})]),S2,f.createElementVNode("div",w2,[f.createVNode(f.unref(so))]),f.createElementVNode("div",k2,[f.createVNode(f.unref(qo)),T2])])])],64))}});function Qe(n){this.content=n}Qe.prototype={constructor:Qe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new Qe(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qe(t)},addToStart:function(n,e){return new Qe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qe(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new Qe(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Qe.from(n),n.size?new Qe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qe.from(n),n.size?new Qe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Qe.from=function(n){if(n instanceof Qe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qe(e)};function ku(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=ku(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Tu(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=Tu(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class ie{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(i+=l.text.slice(Math.max(e,a)-a,t-a),s=!r):l.isLeaf?(o?i+=typeof o=="function"?o(l):o:l.type.spec.leafText&&(i+=l.type.spec.leafText(l)),s=!r):!s&&l.isBlock&&(i+=r,s=!0)},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new ie(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new ie(r,o)}cutByIndex(e,t){return e==t?ie.empty:e==0&&t==this.content.length?this:new ie(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new ie(o,i)}addToStart(e){return new ie([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ie(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return ku(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Tu(this,e,t,r)}findIndex(e,t=-1){if(e==0)return ai(0,e);if(e==this.size)return ai(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||t>0?ai(r+1,s):ai(r,o);o=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,t){if(!t)return ie.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new ie(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ie.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new ie(t||e,r)}static from(e){if(!e)return ie.empty;if(e instanceof ie)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ie([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ie.empty=new ie([],0);const Ea={index:0,offset:0};function ai(n,e){return Ea.index=n,Ea.offset=e,Ea}function li(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!li(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!li(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Pe=class $c{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&li(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return $c.none;if(e instanceof $c)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};Pe.none=[];class ci extends Error{}class pe{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=xu(this.content,e+this.openStart,t);return r&&new pe(r,this.openStart,this.openEnd)}removeBetween(e,t){return new pe(Au(this.content,e+this.openStart,t+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,t){if(!t)return pe.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new pe(ie.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new pe(e,r,o)}}pe.empty=new pe(ie.empty,0,0);function Au(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Au(i.content,e-o-1,t-o-1)))}function xu(n,e,t,r){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=xu(s.content,e-i-1,t);return l&&n.replaceChild(o,s.copy(l))}function A2(n,e,t){if(t.openStart>n.depth)throw new ci("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ci("Inconsistent open depths");return Ou(n,e,t,0)}function Ou(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=Ou(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return Qn(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=x2(t,n);return Qn(i,Nu(n,s,l,e,r))}else return Qn(i,ui(n,e,r))}function Mu(n,e){if(!e.type.compatibleContent(n.type))throw new ci("Cannot join "+e.type.name+" onto "+n.type.name)}function ba(n,e,t){let r=n.node(t);return Mu(r,e.node(t)),r}function Xn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function fo(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Xn(n.nodeAfter,r),i++));for(let l=i;l<s;l++)Xn(o.child(l),r);e&&e.depth==t&&e.textOffset&&Xn(e.nodeBefore,r)}function Qn(n,e){return n.type.checkContent(e),n.copy(e)}function Nu(n,e,t,r,o){let i=n.depth>o&&ba(n,e,o+1),s=r.depth>o&&ba(t,r,o+1),l=[];return fo(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(Mu(i,s),Xn(Qn(i,Nu(n,e,t,r,o+1)),l)):(i&&Xn(Qn(i,ui(n,e,o+1)),l),fo(e,t,o,l),s&&Xn(Qn(s,ui(t,r,o+1)),l)),fo(r,null,o,l),new ie(l)}function ui(n,e,t){let r=[];if(fo(null,n,t,r),n.depth>t){let o=ba(n,e,t+1);Xn(Qn(o,ui(n,e,t+1)),r)}return fo(e,null,t,r),new ie(r)}function x2(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(ie.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class ho{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pe.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new di(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<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new ho(t,r,i)}static resolveCached(e,t){for(let o=0;o<Ca.length;o++){let i=Ca[o];if(i.pos==t&&i.doc==e)return i}let r=Ca[Sa]=ho.resolve(e,t);return Sa=(Sa+1)%O2,r}}let Ca=[],Sa=0,O2=12;class di{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const M2=Object.create(null);let qn=class Fc{constructor(e,t,r,o=Pe.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||ie.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&li(this.attrs,t||e.defaultAttrs||M2)&&Pe.sameSet(this.marks,r||Pe.none)}copy(e=null){return e==this.content?this:new Fc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return pe.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new pe(c,o.depth-s,i.depth-s)}replace(e,t,r){return A2(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return ho.resolveCached(this,e)}resolveNoCache(e){return ho.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),Iu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=ie.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=Pe.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!Pe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=ie.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};qn.prototype.text=void 0;class fi extends qn{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Iu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new fi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new fi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Iu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new N2(e,t);if(r.next==null)return er.empty;let o=_u(r);r.next&&r.err("Unexpected trailing text");let i=P2(B2(o));return $2(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return ie.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let h=i(d,l.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
11
|
+
Expect errors in decoding.`),w=w.replace(/[^A-Za-z0-9\+\/\=]/g,"");N=this.KEY_STR.indexOf(w.charAt(z++)),I=this.KEY_STR.indexOf(w.charAt(z++)),D=this.KEY_STR.indexOf(w.charAt(z++)),L=this.KEY_STR.indexOf(w.charAt(z++)),O=N<<2|I>>4,v=(I&15)<<4|D>>2,b=(D&3)<<6|L,W.push(O),D!==64&&W.push(v),L!==64&&W.push(b),O=v=b="",N=I=D=L="",z<w.length;);return W}}]),x}();Ce.initClass();var Oe=function(M,w){var O=!1,v=!0,b=M.document,N=b.documentElement,I=b.addEventListener?"addEventListener":"attachEvent",D=b.addEventListener?"removeEventListener":"detachEvent",L=b.addEventListener?"":"on",z=function U(K){if(!(K.type==="readystatechange"&&b.readyState!=="complete")&&((K.type==="load"?M:b)[D](L+K.type,U,!1),!O&&(O=!0)))return w.call(M,K.type||K)},W=function U(){try{N.doScroll("left")}catch{setTimeout(U,50);return}return z("poll")};if(b.readyState!=="complete"){if(b.createEventObject&&N.doScroll){try{v=!M.frameElement}catch{}v&&W()}return b[I](L+"DOMContentLoaded",z,!1),b[I](L+"readystatechange",z,!1),M[I](L+"load",z,!1)}};j._autoDiscoverFunction=function(){if(j.autoDiscover)return j.discover()},Oe(window,j._autoDiscoverFunction);function Ae(x,M){return typeof x<"u"&&x!==null?M(x):void 0}function Me(x,M,w){if(typeof x<"u"&&x!==null&&typeof x[M]=="function")return w(x,M)}window.Dropzone=j;var ve=j}(),i}()})})(Cu);var f2=Cu.exports;const Su=d2(f2),h2={class:"fallback"},p2=f.createElementVNode("input",{id:"file",type:"file",name:"file",multiple:""},null,-1),m2={for:"file"},g2={class:"dz-message","data-dz-message":""},y2={id:"bd-dropzone-theme",style:{display:"none"}},v2={class:"dz-preview dz-file-preview"},E2={class:"dz-details"},b2=f.createElementVNode("img",{"data-dz-thumbnail":"",class:"dz-image"},null,-1),C2=f.createElementVNode("div",{class:"dz-filename"},[f.createElementVNode("small",{"data-dz-name":""})],-1),S2=f.createElementVNode("div",{class:"dz-progress"},[f.createElementVNode("div",{class:"spinner-border text-primary spinner-border-sm",role:"status"},[f.createElementVNode("span",{class:"visually-hidden"},"Loading...")])],-1),w2={class:"dz-success-mark"},k2={class:"dz-error-message text-danger"},T2=f.createElementVNode("small",{"data-dz-errormessage":""},null,-1),wu=f.defineComponent({__name:"BDDropzone",props:{modelValue:{default:[]},buttonText:{default:void 0},multiple:{type:Boolean,default:!1},errorMessage:{default:void 0},fileSizeExceededMessage:{default:void 0},acceptedFiles:{default:".jpg"},url:{default:""},tag:{default:"form"},token:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=f.computed(()=>({variant:ni.PRIMARY,size:st.SM})),o=Jn(t,"modelValue",e);let i=null;Su.autoDiscover=!1,f.watch(()=>t.modelValue,()=>{s()}),f.onMounted(()=>{document.getElementById("dropzone")&&l()});const s=()=>{i&&(i.destroy(),l())},l=()=>{var p;i=new Su("#dropzone",{url:t.url,method:"post",acceptedFiles:t.acceptedFiles,addRemoveLinks:!1,maxFilesize:10,maxFiles:t.multiple?3:1,headers:{RequestVerificationToken:t.token},dictResponseError:t.errorMessage,dictFileTooBig:t.fileSizeExceededMessage,previewTemplate:(p=document.querySelector("#bd-dropzone-theme"))==null?void 0:p.innerHTML}),i.on("error",c),i.on("success",a),i.on("removedfile",d)},a=function(p,m){var g;o.value.push({UUID:(g=p.upload)==null?void 0:g.uuid,CorrelationId:m.CorrelationId,Naam:m.Naam}),u(p)},c=function(p){u(p)},u=function(p){const m=p.name;if(!(m.endsWith(".png")||m.endsWith(".jpg")||m.endsWith(".jpeg")||m.endsWith(".gif"))){const g=p.previewElement.getElementsByClassName("icon-file"),y=p.previewElement.getElementsByClassName("dz-image");g[0].classList.remove("d-none"),y[0].classList.add("d-none")}},d=function(p){const m=o.value.findIndex(g=>{var y;return(g==null?void 0:g.UUID)===((y=p.upload)==null?void 0:y.uuid)});m!==-1&&o.value.splice(m,1)},h=f.computed(()=>t.tag??"form");return(p,m)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(h.value),{id:"dropzone",class:"dropzone bd-dropzone",enctype:"multipart/form-data"},{default:f.withCtx(()=>[f.createElementVNode("div",h2,[p2,f.createTextVNode(" test "),f.createElementVNode("label",m2,[f.createVNode(f.unref(Yn)),f.createTextVNode(" "+f.toDisplayString(t.buttonText),1)])]),f.createElementVNode("div",g2,[f.createVNode(f.unref(pt),f.normalizeProps(f.guardReactiveProps(r.value)),{default:f.withCtx(()=>[f.createVNode(f.unref(Yn)),f.createTextVNode(" "+f.toDisplayString(t.buttonText),1)]),_:1},16)])]),_:1})),f.createElementVNode("div",y2,[f.createElementVNode("div",v2,[f.createElementVNode("div",E2,[b2,f.createVNode(f.unref(ia),{"data-dz-thumbnail":"",class:"d-none"}),C2,f.createVNode(f.unref(pt),{class:"dz-remove",alt:"Click me to remove the file.","data-dz-remove":""},{default:f.withCtx(()=>[f.createVNode(f.unref(ao))]),_:1})]),S2,f.createElementVNode("div",w2,[f.createVNode(f.unref(so))]),f.createElementVNode("div",k2,[f.createVNode(f.unref(qo)),T2])])])],64))}});function Qe(n){this.content=n}Qe.prototype={constructor:Qe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new Qe(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qe(t)},addToStart:function(n,e){return new Qe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qe(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new Qe(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Qe.from(n),n.size?new Qe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qe.from(n),n.size?new Qe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Qe.from=function(n){if(n instanceof Qe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qe(e)};function ku(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=ku(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Tu(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=Tu(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class ie{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(i+=l.text.slice(Math.max(e,a)-a,t-a),s=!r):l.isLeaf?(o?i+=typeof o=="function"?o(l):o:l.type.spec.leafText&&(i+=l.type.spec.leafText(l)),s=!r):!s&&l.isBlock&&(i+=r,s=!0)},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new ie(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new ie(r,o)}cutByIndex(e,t){return e==t?ie.empty:e==0&&t==this.content.length?this:new ie(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new ie(o,i)}addToStart(e){return new ie([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ie(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return ku(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Tu(this,e,t,r)}findIndex(e,t=-1){if(e==0)return ai(0,e);if(e==this.size)return ai(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||t>0?ai(r+1,s):ai(r,o);o=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,t){if(!t)return ie.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new ie(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ie.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new ie(t||e,r)}static from(e){if(!e)return ie.empty;if(e instanceof ie)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ie([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ie.empty=new ie([],0);const Ea={index:0,offset:0};function ai(n,e){return Ea.index=n,Ea.offset=e,Ea}function li(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!li(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!li(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Pe=class $c{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&li(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return $c.none;if(e instanceof $c)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};Pe.none=[];class ci extends Error{}class pe{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=xu(this.content,e+this.openStart,t);return r&&new pe(r,this.openStart,this.openEnd)}removeBetween(e,t){return new pe(Au(this.content,e+this.openStart,t+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,t){if(!t)return pe.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new pe(ie.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new pe(e,r,o)}}pe.empty=new pe(ie.empty,0,0);function Au(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Au(i.content,e-o-1,t-o-1)))}function xu(n,e,t,r){let{index:o,offset:i}=n.findIndex(e),s=n.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=xu(s.content,e-i-1,t);return l&&n.replaceChild(o,s.copy(l))}function A2(n,e,t){if(t.openStart>n.depth)throw new ci("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ci("Inconsistent open depths");return Ou(n,e,t,0)}function Ou(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=Ou(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return Qn(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=x2(t,n);return Qn(i,Nu(n,s,l,e,r))}else return Qn(i,ui(n,e,r))}function Mu(n,e){if(!e.type.compatibleContent(n.type))throw new ci("Cannot join "+e.type.name+" onto "+n.type.name)}function ba(n,e,t){let r=n.node(t);return Mu(r,e.node(t)),r}function Xn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function fo(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Xn(n.nodeAfter,r),i++));for(let l=i;l<s;l++)Xn(o.child(l),r);e&&e.depth==t&&e.textOffset&&Xn(e.nodeBefore,r)}function Qn(n,e){return n.type.checkContent(e),n.copy(e)}function Nu(n,e,t,r,o){let i=n.depth>o&&ba(n,e,o+1),s=r.depth>o&&ba(t,r,o+1),l=[];return fo(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(Mu(i,s),Xn(Qn(i,Nu(n,e,t,r,o+1)),l)):(i&&Xn(Qn(i,ui(n,e,o+1)),l),fo(e,t,o,l),s&&Xn(Qn(s,ui(t,r,o+1)),l)),fo(r,null,o,l),new ie(l)}function ui(n,e,t){let r=[];if(fo(null,n,t,r),n.depth>t){let o=ba(n,e,t+1);Xn(Qn(o,ui(n,e,t+1)),r)}return fo(e,null,t,r),new ie(r)}function x2(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(ie.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class ho{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Pe.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new di(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<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new ho(t,r,i)}static resolveCached(e,t){for(let o=0;o<Ca.length;o++){let i=Ca[o];if(i.pos==t&&i.doc==e)return i}let r=Ca[Sa]=ho.resolve(e,t);return Sa=(Sa+1)%O2,r}}let Ca=[],Sa=0,O2=12;class di{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const M2=Object.create(null);let qn=class Fc{constructor(e,t,r,o=Pe.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||ie.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&li(this.attrs,t||e.defaultAttrs||M2)&&Pe.sameSet(this.marks,r||Pe.none)}copy(e=null){return e==this.content?this:new Fc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return pe.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new pe(c,o.depth-s,i.depth-s)}replace(e,t,r){return A2(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return ho.resolveCached(this,e)}resolveNoCache(e){return ho.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),Iu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=ie.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=Pe.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!Pe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t 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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=ie.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};qn.prototype.text=void 0;class fi extends qn{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Iu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new fi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new fi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Iu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new N2(e,t);if(r.next==null)return er.empty;let o=_u(r);r.next&&r.err("Unexpected trailing text");let i=P2(B2(o));return $2(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return ie.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let h=i(d,l.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
12
12
|
`)}}er.empty=new er(!0);class N2{constructor(e,t){this.string=e,this.nodeTypes=t,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 _u(n){let e=[];do e.push(I2(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function I2(n){let e=[];do e.push(_2(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function _2(n){let e=R2(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=D2(n,e);else break;return e}function Du(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function D2(n,e){let t=Du(n),r=t;return n.eat(",")&&(n.next!="}"?r=Du(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function L2(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.groups.indexOf(e)>-1&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function R2(n){if(n.eat("(")){let e=_u(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=L2(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function B2(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=t();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=t();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Lu(n,e){return e-n}function Ru(n,e){let t=[];return r(e),t.sort(Lu);function r(o){let i=n[o];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&r(a)}}}function P2(n){let e=Object.create(null);return t(Ru(n,0));function t(r){let o=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);Ru(n,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new er(r.indexOf(n.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Lu);i.next.push({type:o[s][0],next:e[l.join(",")]||t(l)})}return i}}function $2(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Bu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Pu(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let i=n[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function $u(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new F2(n[t]);return e}let Fu=class Um{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=$u(r.attrs),this.defaultAttrs=Bu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==er.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Pu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new qn(this,this.computeAttrs(e),ie.from(t),Pe.setFrom(r))}createChecked(e=null,t,r){return t=ie.from(t),this.checkContent(t),new qn(this,this.computeAttrs(e),t,Pe.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=ie.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(ie.empty,!0);return i?new qn(this,e,t.append(i),Pe.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Pe.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Um(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class F2{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class hi{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=$u(o.attrs),this.excluded=null;let i=Bu(this.attrs);this.instance=i?new Pe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Pe(this,Pu(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new hi(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class V2{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=Qe.from(e.nodes),t.marks=Qe.from(e.marks||{}),this.nodes=Fu.compile(this.spec.nodes,this),this.marks=hi.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;i.contentMatch=r[s]||(r[s]=er.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=l=="_"?null:l?Vu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Vu(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,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Fu){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(t,r,o)}text(e,t){let r=this.nodes.text;return new fi(r,r.defaultAttrs,e,Pe.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return qn.fromJSON(this,e)}markFromJSON(e){return Pe.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Vu(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n.marks[o],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class wr{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.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 o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new ju(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ju(this,t,!0);return r.addAll(e,t.from,t.to),pe.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(U2(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Wu(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Wu(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wr(e,wr.schemaRules(e)))}}const zu={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},z2={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hu={ol:!0,ul:!0},pi=1,mi=2,po=4;function Uu(n,e,t){return e!=null?(e?pi:0)|(e==="full"?mi:0):n&&n.whitespace=="pre"?pi|mi:t&~po}class gi{constructor(e,t,r,o,i,s,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=o,this.solid=i,this.options=l,this.content=[],this.activeMarks=Pe.none,this.stashMarks=[],this.match=s||(l&po?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(ie.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&pi)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=ie.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(ie.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let o=r[t];(this.type?this.type.allowsMarkType(o.type):W2(o.type,e))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!zu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ju{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let o=t.topNode,i,s=Uu(null,t.preserveWhitespace,0)|(r?po:0);o?i=new gi(o.type,o.attrs,Pe.none,Pe.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new gi(null,null,Pe.none,Pe.none,!0,null,s):i=new gi(e.schema.topNodeType,null,Pe.none,Pe.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.getAttribute("style");if(!r)return t();let o=this.readStyles(j2(r));if(!o)return;let[i,s]=o,l=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<i.length;a++)this.addPendingMark(i[a]);t();for(let a=0;a<i.length;a++)this.removePendingMark(i[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&mi||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&pi)r.options&mi?t=t.replace(/\r\n?/g,`
|
|
13
13
|
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],i=e.previousSibling;(!o||i&&i.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),o;Hu.hasOwnProperty(r)&&this.parser.normalizeLists&&H2(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,t));if(i?i.ignore:z2.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let s,l=this.top,a=this.needsBlock;if(zu.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),s=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}i&&i.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
14
14
|
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=Pe.none,r=Pe.none;for(let o=0;o<e.length;o+=2)for(let i=void 0;;){let s=this.parser.matchStyle(e[o],e[o+1],this,i);if(!s)break;if(s.ignore)return null;if(s.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(l=>{s.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(t),s.consuming===!1)i=s;else break}return[t,r]}addElementByRule(e,t,r){let o,i,s;t.node?(i=this.parser.schema.nodes[t.node],i.isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):o=this.enter(i,t.attrs||null,t.preserveWhitespace)):(s=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(s));let l=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}o&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,t,r){let o=t||0;for(let i=t?e.childNodes[t]:e.firstChild,s=r==null?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i);this.findAtPoint(e,o)}findPlace(e){let t,r;for(let o=this.open;o>=0;o--){let i=this.nodes[o],s=i.findWrapping(e);if(s&&(!t||t.length>s.length)&&(t=s,r=i,!s.length)||i.solid)break}if(!t)return!1;this.sync(r);for(let o=0;o<t.length;o++)this.enterInner(t[o],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let o=0;o<e.marks.length;o++)(!t.type||t.type.allowsMarkType(e.marks[o].type))&&(r=e.marks[o].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let o=this.findPlace(e.create(t));return o&&this.enterInner(e,t,!0,r),o}enterInner(e,t=null,r=!1,o){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let s=Uu(e,o,i.options);i.options&po&&i.content.length==0&&(s|=po),this.nodes.push(new gi(e,t,i.activeMarks,i.pendingMarks,r,null,s)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=K2(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let s=o.popFromStashMark(e);s&&o.type&&o.type.allowsMarkType(s.type)&&(o.activeMarks=s.addToSet(o.activeMarks))}if(o==t)break}}}function H2(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function U2(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function j2(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function Wu(n){let e={};for(let t in n)e[t]=n[t];return e}function W2(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}function K2(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class Jt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=wa(t).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,t);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=Jt.renderSpec(wa(t),this.nodes[e.type.name](e));if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Jt.renderSpec(wa(r),o(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i=o.indexOf(" ");i>0&&(r=o.slice(0,i),o=o.slice(i+1));let s,l=r?e.createElementNS(r,o):e.createElement(o),a=t[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let u in a)if(a[u]!=null){let d=u.indexOf(" ");d>0?l.setAttributeNS(u.slice(0,d),u.slice(d+1),a[u]):l.setAttribute(u,a[u])}}for(let u=c;u<t.length;u++){let d=t[u];if(d===0){if(u<t.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=Jt.renderSpec(e,d,r);if(l.appendChild(h),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 Jt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ku(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Ku(e.marks)}}function Ku(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function wa(n){return n.document||window.document}const Gu=65535,Yu=Math.pow(2,16);function G2(n,e){return n+e*Yu}function Ju(n){return n&Gu}function Y2(n){return(n-(n&Gu))/Yu}const Zu=1,Xu=2,yi=4,Qu=8;class ka{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Qu)>0}get deletedBefore(){return(this.delInfo&(Zu|yi))>0}get deletedAfter(){return(this.delInfo&(Xu|yi))>0}get deletedAcross(){return(this.delInfo&yi)>0}}class St{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&St.empty)return St.empty}recover(e){let t=0,r=Ju(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+Y2(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let h=c?e==a?-1:e==d?1:t:t,p=a+o+(h<0?0:u);if(r)return p;let m=e==(t<0?a:d)?null:G2(l/3,e-a),g=e==a?Xu:e==d?Zu:yi;return(t<0?e!=a:e!=d)&&(g|=Qu),new ka(p,g,m)}o+=u-c}return r?e+o:new ka(e+o,0,null)}touches(e,t){let r=0,o=Ju(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+t],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new St(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?St.empty:new St(e<0?[0,-e,0]:[0,0,e])}}St.empty=new St([]);class mo{constructor(e=[],t,r=0,o=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=o}slice(e=0,t=this.maps.length){return new mo(this.maps,this.mirror,e,t)}copy(){return new mo(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?r+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new mo;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new ka(e,o,null)}}const Ta=Object.create(null);class nt{getMap(){return St.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ta[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ta)throw new RangeError("Duplicate use of step JSON ID "+e);return Ta[e]=t,t.prototype.jsonID=e,t}}class We{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new We(e,null)}static fail(e){return new We(null,e)}static fromReplace(e,t,r,o){try{return We.ok(e.replace(t,r,o))}catch(i){if(i instanceof ci)return We.fail(i.message);throw i}}}function Aa(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(Aa(i.content,e,i))),i.isInline&&(i=e(i,t,o)),r.push(i)}return ie.fromArray(r)}class Sn extends nt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new pe(Aa(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return We.fromReplace(e,this.from,this.to,i)}invert(){return new Zt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Sn(t.pos,r.pos,this.mark)}merge(e){return e instanceof Sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Sn(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Sn(t.from,t.to,e.markFromJSON(t.mark))}}nt.jsonID("addMark",Sn);class Zt extends nt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new pe(Aa(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return We.fromReplace(e,this.from,this.to,r)}invert(){return new Sn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Zt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Zt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zt(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Zt(t.from,t.to,e.markFromJSON(t.mark))}}nt.jsonID("removeMark",Zt);class wn extends nt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return We.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return We.fromReplace(e,this.pos,this.pos+1,new pe(ie.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new wn(this.pos,t.marks[o]);return new wn(this.pos,this.mark)}}return new kr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new wn(t.pos,e.markFromJSON(t.mark))}}nt.jsonID("addNodeMark",wn);class kr extends nt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return We.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return We.fromReplace(e,this.pos,this.pos+1,new pe(ie.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new wn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new kr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new kr(t.pos,e.markFromJSON(t.mark))}}nt.jsonID("removeNodeMark",kr);class qe extends nt{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&xa(e,this.from,this.to)?We.fail("Structure replace would overwrite content"):We.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new St([this.from,this.to-this.from,this.slice.size])}invert(e){return new qe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new qe(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof qe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?pe.empty:new pe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new qe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?pe.empty:new pe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new qe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new qe(t.from,t.to,pe.fromJSON(e,t.slice),!!t.structure)}}nt.jsonID("replace",qe);class Je extends nt{constructor(e,t,r,o,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(xa(e,this.from,this.gapFrom)||xa(e,this.gapTo,this.to)))return We.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return We.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?We.fromReplace(e,this.from,this.to,r):We.fail("Content does not fit in gap")}getMap(){return new St([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Je(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=e.map(this.gapFrom,-1),i=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos?null:new Je(t.pos,r.pos,o,i,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Je(t.from,t.to,t.gapFrom,t.gapTo,pe.fromJSON(e,t.slice),t.insert,!!t.structure)}}nt.jsonID("replaceAround",Je);function xa(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function J2(n,e,t,r){let o=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),p=Math.min(c+a.nodeSize,t),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(s&&s.to==h&&s.mark.eq(d[g])?s.to=p:o.push(s=new Zt(h,p,d[g])));l&&l.to==h?l.to=p:i.push(l=new Sn(h,p,r))}}),o.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function Z2(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof hi){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],h;for(let p=0;p<o.length;p++){let m=o[p];m.step==i-1&&d.eq(o[p].style)&&(h=m)}h?(h.to=c,h.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>n.step(new Zt(s.from,s.to,s.style)))}function X2(n,e,t,r=t.contentMatch){let o=n.doc.nodeAt(e),i=[],s=e+1;for(let l=0;l<o.childCount;l++){let a=o.child(l),c=s+a.nodeSize,u=r.matchType(a.type);if(!u)i.push(new qe(s,c,pe.empty));else{r=u;for(let d=0;d<a.marks.length;d++)t.allowsMarkType(a.marks[d].type)||n.step(new Zt(s,c,a.marks[d]));if(a.isText&&!t.spec.code){let d,h=/\r?\n|\r/g,p;for(;d=h.exec(a.text);)p||(p=new pe(ie.from(t.schema.text(" ",t.allowedMarks(a.marks))),0,0)),i.push(new qe(s+d.index,s+d.index+d[0].length,p))}}s=c}if(!r.validEnd){let l=r.fillBefore(ie.empty,!0);n.replace(s,s,new pe(l,0,0))}for(let l=i.length-1;l>=0;l--)n.step(i[l])}function Q2(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Tr(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),i=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(i,s,t))return r;if(r==0||o.type.spec.isolating||!Q2(o,i,s))break}return null}function q2(n,e,t){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=ie.empty,d=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=ie.from(r.node(m).copy(u)),d++):a--;let h=ie.empty,p=0;for(let m=i,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,h=ie.from(o.node(m).copy(h)),p++):c++;n.step(new Je(a,c,s,l,new pe(u.append(h),d,p),u.size-d,!0))}function Oa(n,e,t=null,r=n){let o=ey(n,e),i=o&&ty(r,e);return i?o.map(qu).concat({type:e,attrs:t}).concat(i.map(qu)):null}function qu(n){return{type:n,attrs:null}}function ey(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(r,o,s)?i:null}function ty(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function ny(n,e,t){let r=ie.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[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=ie.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new Je(o,i,o,i,new pe(r,0,0),t.length,!0))}function ry(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{if(s.isTextblock&&!s.hasMarkup(r,o)&&oy(n.doc,n.mapping.slice(i).map(l),r)){n.clearIncompatible(n.mapping.slice(i).map(l,1),r);let a=n.mapping.slice(i),c=a.map(l,1),u=a.map(l+s.nodeSize,1);return n.step(new Je(c,u,c+1,u-1,new pe(ie.from(r.create(o,null,s.marks)),0,0),1,!0)),!1}})}function oy(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function iy(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Je(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new pe(ie.from(s),0,0),1,!0))}function Ar(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=t-2;c>i;c--,u--){let d=o.node(c),h=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!g.type.validContent(p))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function sy(n,e,t=1,r){let o=n.doc.resolve(e),i=ie.empty,s=ie.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=ie.from(o.node(l).copy(i));let u=r&&r[c];s=ie.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}n.step(new qe(e,e,new pe(i.append(s),t,t),!0))}function kn(n,e){let t=n.resolve(e),r=t.index();return ed(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function ed(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function vi(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):t>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&ed(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function ay(n,e,t){let r=new qe(e-t,e+t,pe.empty,!0);n.step(r)}function ly(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function cy(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=r.depth;s>=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),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Ma(n,e,t=e,r=pe.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return td(o,i,r)?new qe(e,t,r):new uy(o,i,r).fit()}function td(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class uy{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=ie.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=ie.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new pe(i,s,l);return e>-1?new Je(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new qe(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Na(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(ie.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Na(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new pe(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Na(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new pe(go(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new pe(go(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));d=d.matchFragment(o)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let g=l.child(c),y=d.matchType(g.type);if(!y)break;c++,(c>1||a==0||g.content.size)&&(d=y,u.push(nd(g.mark(h.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?p:-1)))}let m=c==l.childCount;m||(p=-1),this.placed=yo(this.placed,t,ie.from(u)),this.frontier[t].match=d,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let C=y.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),y=C.content}this.unplaced=m?e==0?pe.empty:new pe(go(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new pe(go(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Ia(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Ia(e,t,o,r,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Ia(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=yo(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=yo(this.placed,this.depth,ie.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(ie.empty,!0);t.childCount&&(this.placed=yo(this.placed,this.frontier.length,t))}}function go(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(go(n.firstChild.content,e-1,t)))}function yo(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(yo(n.lastChild.content,e-1,t)))}function Na(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function nd(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,nd(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(ie.empty,!0)))),n.copy(r)}function Ia(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!dy(t,i.content,s)?l:null}function dy(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function fy(n){return n.spec.defining||n.spec.definingForContent}function hy(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(td(o,i,r))return n.step(new qe(e,t,r));let s=od(o,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let m=o.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?l=h:o.before(h)==p&&s.splice(1,0,-h)}let a=s.indexOf(l),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=c[h],m=fy(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(l)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=c[p];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],C=!0;y<0&&(C=!1,y=-y);let S=o.node(y-1),k=o.index(y-1);if(S.canReplaceWith(k,k,m.type,m.marks))return n.replace(o.before(y),C?i.after(y):t,new pe(rd(r.content,0,r.openStart,p),p,r.openEnd))}}let d=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>d));h--){let p=s[h];p<0||(e=o.before(p),t=i.after(p))}}function rd(n,e,t,r,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(rd(i.content,e+1,t,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(ie.empty,!0))}return n}function py(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=ly(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new pe(ie.from(r),0,0))}function my(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),i=od(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s)return n.delete(r.before(s),t);n.delete(e,t)}function od(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}class xr extends nt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return We.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return We.fromReplace(e,this.pos,this.pos+1,new pe(ie.from(o),0,t.isLeaf?0:1))}getMap(){return St.empty}invert(e){return new xr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new xr(t.pos,t.attr,t.value)}}nt.jsonID("attr",xr);class vo extends nt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return We.ok(r)}getMap(){return St.empty}invert(e){return new vo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vo(t.attr,t.value)}}nt.jsonID("docAttr",vo);let Or=class extends Error{};Or=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Or.prototype=Object.create(Error.prototype),Or.prototype.constructor=Or,Or.prototype.name="TransformError";class id{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new mo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Or(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=pe.empty){let o=Ma(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new pe(ie.from(r),0,0))}delete(e,t){return this.replace(e,t,pe.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return hy(this,e,t,r),this}replaceRangeWith(e,t,r){return py(this,e,t,r),this}deleteRange(e,t){return my(this,e,t),this}lift(e,t){return q2(this,e,t),this}join(e,t=1){return ay(this,e,t),this}wrap(e,t){return ny(this,e,t),this}setBlockType(e,t=e,r,o=null){return ry(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return iy(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new xr(e,t,r)),this}setDocAttribute(e,t){return this.step(new vo(e,t)),this}addNodeMark(e,t){return this.step(new wn(e,t)),this}removeNodeMark(e,t){if(!(t instanceof Pe)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new kr(e,t)),this}split(e,t=1,r){return sy(this,e,t,r),this}addMark(e,t,r){return J2(this,e,t,r),this}removeMark(e,t,r){return Z2(this,e,t,r),this}clearIncompatible(e,t,r){return X2(this,e,t,r),this}}const _a=Object.create(null);class Le{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new gy(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=pe.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?pe.empty:t),l==0&&ld(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),ld(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new Re(e):Mr(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=t<0?Mr(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Mr(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ht(e.node(0))}static atStart(e){return Mr(e,e,0,0,1)||new Ht(e)}static atEnd(e){return Mr(e,e,e.content.size,e.childCount,-1)||new Ht(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=_a[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in _a)throw new RangeError("Duplicate use of selection JSON ID "+e);return _a[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Re.between(this.$anchor,this.$head).getBookmark()}}Le.prototype.visible=!0;class gy{constructor(e,t){this.$from=e,this.$to=t}}let sd=!1;function ad(n){!sd&&!n.parent.inlineContent&&(sd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Re extends Le{constructor(e,t=e){ad(e),ad(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Le.near(r);let o=e.resolve(t.map(this.anchor));return new Re(o.parent.inlineContent?o:r,r)}replace(e,t=pe.empty){if(super.replace(e,t),t==pe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Re&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ei(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Re(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=Le.findFrom(t,r,!0)||Le.findFrom(t,-r,!0);if(i)t=i.$head;else return Le.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(Le.findFrom(e,-r,!0)||Le.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new Re(e,t)}}Le.jsonID("text",Re);class Ei{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ei(e.map(this.anchor),e.map(this.head))}resolve(e){return Re.between(e.resolve(this.anchor),e.resolve(this.head))}}class we extends Le{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return r?Le.near(i):new we(i)}content(){return new pe(ie.from(this.node),0,0)}eq(e){return e instanceof we&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Da(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new we(e.resolve(t.anchor))}static create(e,t){return new we(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}we.prototype.visible=!1,Le.jsonID("node",we);class Da{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Ei(r,r):new Da(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&we.isSelectable(r)?new we(t):Le.near(t)}}class Ht extends Le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=pe.empty){if(t==pe.empty){e.delete(0,e.doc.content.size);let r=Le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ht(e)}map(e){return new Ht(e)}eq(e){return e instanceof Ht}getBookmark(){return yy}}Le.jsonID("all",Ht);const yy={map(){return this},resolve(n){return new Ht(n)}};function Mr(n,e,t,r,o,i=!1){if(e.inlineContent)return Re.create(n,t);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&we.isSelectable(l))return we.create(n,t-(o<0?l.nodeSize:0))}else{let a=Mr(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function ld(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof qe||o instanceof Je))return;let i=n.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),n.setSelection(Le.near(n.doc.resolve(s),t))}const cd=1,bi=2,ud=4;class vy extends id{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.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|cd)&~bi,this.storedMarks=null,this}get selectionSet(){return(this.updated&cd)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=bi,this}ensureMarks(e){return Pe.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&bi)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~bi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Pe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),this.selection.empty||this.setSelection(Le.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,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|=ud,this}get scrolledIntoView(){return(this.updated&ud)>0}}function dd(n,e){return!e||!n?n:n.bind(e)}class Eo{constructor(e,t,r){this.name=e,this.init=dd(t.init,r),this.apply=dd(t.apply,r)}}const Ey=[new Eo("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Eo("selection",{init(n,e){return n.selection||Le.atStart(e.doc)},apply(n){return n.selection}}),new Eo("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Eo("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class La{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ey.slice(),t&&t.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 Eo(r.key,r.spec.state,r))})}}class Nr{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,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Nr(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new vy(this)}static create(e){let t=new La(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Nr(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new La(this.schema,e.plugins),r=t.fields,o=new Nr(t);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.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 o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new La(e.schema,e.plugins),i=new Nr(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=qn.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=Le.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=c.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function fd(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=fd(o,e,{})),t[r]=o}return t}class yt{constructor(e){this.spec=e,this.props={},e.props&&fd(e.props,this,this.props),this.key=e.key?e.key.key:hd("plugin")}getState(e){return e[this.key]}}const Ra=Object.create(null);function hd(n){return n in Ra?n+"$"+ ++Ra[n]:(Ra[n]=0,n+"$")}class Ut{constructor(e="key"){this.key=hd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const at=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},bo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let pd=null;const un=function(n,e,t){let r=pd||(pd=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},tr=function(n,e,t,r){return t&&(md(n,e,t,r,-1)||md(n,e,t,r,1))},by=/^(img|br|input|textarea|hr)$/i;function md(n,e,t,r,o){for(;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Xt(n))){let i=n.parentNode;if(!i||i.nodeType!=1||Ba(n)||by.test(n.nodeName)||n.contentEditable=="false")return!1;e=at(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?Xt(n):0}else return!1}}function Xt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Cy(n,e,t){for(let r=e==0,o=e==Xt(n);r||o;){if(n==t)return!0;let i=at(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==Xt(n)}}function Ba(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Ci=function(n){return n.focusNode&&tr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function nr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Sy(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function wy(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Qt=typeof navigator<"u"?navigator:null,gd=typeof document<"u"?document:null,Tn=Qt&&Qt.userAgent||"",Pa=/Edge\/(\d+)/.exec(Tn),yd=/MSIE \d/.exec(Tn),$a=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Tn),vt=!!(yd||$a||Pa),An=yd?document.documentMode:$a?+$a[1]:Pa?+Pa[1]:0,jt=!vt&&/gecko\/(\d+)/i.test(Tn);jt&&+(/Firefox\/(\d+)/.exec(Tn)||[0,0])[1];const Fa=!vt&&/Chrome\/(\d+)/.exec(Tn),rt=!!Fa,ky=Fa?+Fa[1]:0,lt=!vt&&!!Qt&&/Apple Computer/.test(Qt.vendor),Ir=lt&&(/Mobile\/\w+/.test(Tn)||!!Qt&&Qt.maxTouchPoints>2),Mt=Ir||(Qt?/Mac/.test(Qt.platform):!1),Ty=Qt?/Win/.test(Qt.platform):!1,Wt=/Android \d/.test(Tn),Co=!!gd&&"webkitFontSmoothing"in gd.documentElement.style,Ay=Co?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xy(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function dn(n,e){return typeof n=="number"?n:n[e]}function Oy(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function vd(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;s=bo(s)){if(s.nodeType!=1)continue;let l=s,a=l==i.body,c=a?xy(i):Oy(l),u=0,d=0;if(e.top<c.top+dn(r,"top")?d=-(c.top-e.top+dn(o,"top")):e.bottom>c.bottom-dn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+dn(o,"top")-c.top:e.bottom-c.bottom+dn(o,"bottom")),e.left<c.left+dn(r,"left")?u=-(c.left-e.left+dn(o,"left")):e.right>c.right-dn(r,"right")&&(u=e.right-c.right+dn(o,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function My(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Ed(n.dom)}}function Ed(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=bo(r));return e}function Ny({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;bd(t,r==0?0:r-e)}function bd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:i}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let _r=null;function Iy(n){if(n.setActive)return n.setActive();if(_r)return n.focus(_r);let e=Ed(n);n.focus(_r==null?{get preventScroll(){return _r={preventScroll:!0},!0}}:void 0),_r||(_r=!1,bd(e,0))}function Cd(n,e){let t,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=un(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,o=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(i=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=d+1)}}return!t&&a&&(t=a,o=c,r=0),t&&t.nodeType==3?_y(t,o):!t||r&&t.nodeType==1?{node:n,offset:i}:Cd(t,o)}function _y(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let i=xn(r,1);if(i.top!=i.bottom&&Va(e,i))return{node:n,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function Va(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Dy(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Ly(n,e,t){let{node:r,offset:o}=Cd(e,t),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function Ry(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!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?o=l.posBefore:(a.right<r.left||a.bottom<r.top)&&(o=l.posAfter)),!l.contentDOM&&o<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}i=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function Sd(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let s=n.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Va(e,c))return Sd(s,e,c)}}if((i=(i+1)%r)==o)break}return n}function By(n,e){let t=n.dom.ownerDocument,r,o=0,i=wy(t,e.left,e.top);i&&({node:r,offset:o}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!Va(e,c)||(s=Sd(n.dom,e,c),!s))return null}if(lt)for(let c=s;r&&c;c=bo(c))c.draggable&&(r=void 0);if(s=Dy(s,e),r){if(jt&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Co&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=Ry(n,r,o,e))}l==null&&(l=Ly(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function wd(n){return n.top<n.bottom||n.left<n.right}function xn(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(wd(r))return r}return Array.prototype.find.call(t,wd)||n.getBoundingClientRect()}const Py=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kd(n,e,t){let{node:r,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=Co||jt;if(r.nodeType==3)if(s&&(Py.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let a=xn(un(r,o,o),t);if(jt&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=xn(un(r,o-1,o-1),-1);if(c.top==a.top){let u=xn(un(r,o,o+1),-1);if(u.top!=a.top)return So(u,u.left<c.left)}}return a}else{let a=o,c=o,u=t<0?1:-1;return t<0&&!o?(c++,u=-1):t>=0&&o==r.nodeValue.length?(a--,u=1):t<0?a--:c++,So(xn(un(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==Xt(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return za(a.getBoundingClientRect(),!1)}if(i==null&&o<Xt(r)){let a=r.childNodes[o];if(a.nodeType==1)return za(a.getBoundingClientRect(),!0)}return za(r.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==Xt(r))){let a=r.childNodes[o-1],c=a.nodeType==3?un(a,Xt(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return So(xn(c,1),!1)}if(i==null&&o<Xt(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?un(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return So(xn(c,-1),!0)}return So(xn(r.nodeType==3?un(r):r,-t),t>=0)}function So(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function za(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Td(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function $y(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Td(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=kd(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=un(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Fy=/[\u0590-\u08ac]/;function Vy(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=n.domSelection();return!Fy.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:Td(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&c==g;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),y})}let Ad=null,xd=null,Od=!1;function zy(n,e,t){return Ad==e&&xd==t?Od:(Ad=e,xd=t,Od=t=="up"||t=="down"?$y(n,e,t):Vy(n,e,t))}const Nt=0,Md=1,rr=2,qt=3;class wo{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=Nt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>at(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e||s instanceof _d){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Nd&&i.side>=0;r--);if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?at(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?at(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=s;for(let d=l;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=at(h.dom)+1;break}e-=h.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=at(d.dom);break}t+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(i>p&&s<g)return m.setSelection(e-p-m.border,t-p-m.border,r,o);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),u=!1;if((jt||lt)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(u=!!(p&&h.nodeValue[p-1]==`
|
package/dist/scss/_dropzone.scss
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
font-family: $font-family-base;
|
|
10
10
|
width:fit-content;
|
|
11
11
|
|
|
12
|
-
.dz-message{
|
|
12
|
+
.dz-message {
|
|
13
13
|
margin-bottom: 1.25rem;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -55,18 +55,24 @@
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.dz-remove {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: -10px;
|
|
60
|
+
right: -10px;
|
|
61
|
+
margin: 0;
|
|
62
|
+
width: 21px;
|
|
63
|
+
height: 21px;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
padding: 0px;
|
|
66
|
+
background-color: $primary;
|
|
67
|
+
display: flex;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
align-items: center;
|
|
70
|
+
|
|
71
|
+
.icon {
|
|
72
|
+
margin: revert;
|
|
73
|
+
transform: revert;
|
|
74
|
+
transition: revert;
|
|
70
75
|
}
|
|
76
|
+
}
|
|
71
77
|
}
|
|
72
78
|
}
|