/* ! * Tiny PowerPaste plugin * * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * * Version: 6.2.4-639 */ !function(){"use strict";const e=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&((e,t,n)=>{var r,o;return o=e,!!t.prototype.isPrototypeOf(o)||(null===(r=e.constructor)||void 0===r?void 0:r.name)===t.name})(e,String)?"string":t})(t)===e,t=e=>t=>typeof t===e,n=e("string"),r=e("object"),o=e("array"),s=t("boolean"),a=(void 0,e=>undefined===e);const i=e=>null==e,l=e=>!i(e),c=t("function"),u=t("number"),d=()=>{},h=(e,t)=>(...n)=>e(t.apply(null,n)),m=e=>()=>e,p=e=>e,f=(e,t)=>e===t;function g(e,...t){return(...n)=>{const r=t.concat(n);return e.apply(null,r)}}const v=e=>()=>{throw new Error(e)},y=e=>e(),b=m(!1),x=m(!0);class k{constructor(e,t){this.tag=e,this.value=t}static some(e){return new k(!0,e)}static none(){return k.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?k.some(e(this.value)):k.none()}bind(e){return this.tag?e(this.value):k.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:k.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return l(e)?k.some(e):k.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}k.singletonNone=new k(!1);const w=Array.prototype.slice,S=Array.prototype.indexOf,C=Array.prototype.push,T=(e,t)=>((e,t)=>S.call(e,t))(e,t)>-1,I=(e,t)=>{for(let n=0,r=e.length;n{const n=e.length,r=new Array(n);for(let o=0;o{for(let n=0,r=e.length;n{const n=[],r=[];for(let o=0,s=e.length;o{const n=[];for(let r=0,o=e.length;r(O(e,((e,r)=>{n=t(n,e,r)})),n),_=(e,t)=>((e,t,n)=>{for(let r=0,o=e.length;r{for(let n=0,r=e.length;n{const t=[];for(let n=0,r=e.length;nP(A(e,t)),M=(e,t)=>{for(let n=0,r=e.length;n{const n={};for(let r=0,o=e.length;r{const n=w.call(e,0);return n.sort(t),n},U=e=>((e,t)=>0{for(let n=0;n""===t||e.length>=t.length&&e.substr(n,n+t.length)===t,H=(e,t)=>$(e,t)?((e,t)=>e.substring(t))(e,t.length):e,W=(e,t,n=0,r)=>{const o=e.indexOf(t,n);return-1!==o&&(!!a(r)||o+t.length<=r)},$=(e,t)=>z(e,t,0),V=(e,t)=>z(e,t,e.length-t.length),G=(q=/^\s+|\s+$/g,e=>e.replace(q,""));var q;const K=e=>parseInt(e,10),J=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},Y=(e,t,n)=>({major:e,minor:t,patch:n}),X=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?Y(K(t[1]),K(t[2]),K(t[3])):Y(0,0,0)},Z=e=>t=>t.options.get(e),Q=Z("paste_as_text"),ee=Z("paste_merge_formats"),te=Z("paste_tab_spaces"),ne=Z("smart_paste"),re=Z("cache_suffix"),oe=Z("automatic_uploads"),se=Z("indent_use_margin"),ae=Z("powerpaste_block_drop"),ie=Z("powerpaste_keep_unsupported_src"),le=Z("powerpaste_allow_local_images"),ce=Z("powerpaste_word_import"),ue=Z("powerpaste_googledocs_import"),de=Z("powerpaste_html_import"),he=Z("powerpaste_clean_filtered_inline_elements"),me=Z("link_default_protocol"),pe=e=>{var t;return tinymce.explode(null!==(t=e.options.get("images_file_types"))&&void 0!==t?t:"")},fe=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},ge=()=>{const e=(e=>{const t=fe(k.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(k.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(k.some(e))}}})(d);return{...e,on:t=>e.get().each(t)}},ve=(e,t)=>{const n=t=>e(t)?k.from(t.dom.nodeValue):k.none();return{get:r=>{if(!e(r))throw new Error("Can only get "+t+" value of a "+t+" node");return n(r).getOr("")},getOption:n,set:(n,r)=>{if(!e(n))throw new Error("Can only set raw "+t+" value of a "+t+" node");n.dom.nodeValue=r}}},ye="undefined"!=typeof window?window:Function("return this;")(),be=(e,t)=>(void 0!==e[t]&&null!==e[t]||(e[t]={}),e[t]),xe=(e,t)=>((e,t)=>{let n=void 0!==t?t:ye;for(let t=0;te.dom.nodeName.toLowerCase(),we=e=>e.dom.nodeType,Se=e=>t=>we(t)===e,Ce=e=>8===we(e)||"#comment"===ke(e),Te=Se(1),Ie=Se(3),Ae=Se(9),Oe=Se(11),Ee=e=>t=>Te(t)&&ke(t)===e,Le=ve(Ce,"comment"),Ne=e=>Le.get(e),_e=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},De={fromHtml:(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return _e(n.childNodes[0])},fromTag:(e,t)=>{const n=(t||document).createElement(e);return _e(n)},fromText:(e,t)=>{const n=(t||document).createTextNode(e);return _e(n)},fromDom:_e,fromPoint:(e,t,n)=>k.from(e.dom.elementFromPoint(t,n)).map(_e)},Pe=Object.keys,Re=Object.hasOwnProperty,Me=(e,t)=>{const n=Pe(e);for(let r=0,o=n.length;rFe(e,((e,n)=>({k:n,v:t(e,n)}))),Fe=(e,t)=>{const n={};return Me(e,((e,r)=>{const o=t(e,r);n[o.k]=o.v})),n},Ue=(e,t)=>{const n={};return((e,t,n,r)=>{Me(e,((e,o)=>{(t(e,o)?n:r)(e,o)}))})(e,t,(e=>(t,n)=>{e[n]=t})(n),d),n},Be=e=>Pe(e).length,ze=(e,t)=>Re.call(e,t),He=e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e.apply(null,r)),t)},We=()=>$e(0,0),$e=(e,t)=>({major:e,minor:t}),Ve={nu:$e,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?We():((e,t)=>{const n=((e,t)=>{for(let n=0;nNumber(t.replace(n,"$"+e));return $e(r(1),r(2))})(e,n)},unknown:We},Ge=(e,t)=>{const n=String(t).toLowerCase();return _(e,(e=>e.search(n)))},qe=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Ke=e=>t=>W(t,e),Je=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>W(e,"edge/")&&W(e,"chrome")&&W(e,"safari")&&W(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,qe],search:e=>W(e,"chrome")&&!W(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>W(e,"msie")||W(e,"trident")},{name:"Opera",versionRegexes:[qe,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Ke("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Ke("firefox")},{name:"Safari",versionRegexes:[qe,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(W(e,"safari")||W(e,"mobile/"))&&W(e,"applewebkit")}],Ye=[{name:"Windows",search:Ke("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>W(e,"iphone")||W(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Ke("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Ke("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Ke("linux"),versionRegexes:[]},{name:"Solaris",search:Ke("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Ke("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Ke("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Xe={browsers:m(Je),oses:m(Ye)},Ze="Edge",Qe="Chromium",et="Opera",tt="Firefox",nt="Safari",rt=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isEdge:r(Ze),isChromium:r(Qe),isIE:r("IE"),isOpera:r(et),isFirefox:r(tt),isSafari:r(nt)}},ot=()=>rt({current:void 0,version:Ve.unknown()}),st=rt,at=(m(Ze),m(Qe),m("IE"),m(et),m(tt),m(nt),"Windows"),it="Android",lt="Linux",ct="macOS",ut="Solaris",dt="FreeBSD",ht="ChromeOS",mt=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isWindows:r(at),isiOS:r("iOS"),isAndroid:r(it),isMacOS:r(ct),isLinux:r(lt),isSolaris:r(ut),isFreeBSD:r(dt),isChromeOS:r(ht)}},pt=()=>mt({current:void 0,version:Ve.unknown()}),ft=mt,gt=(m(at),m("iOS"),m(it),m(lt),m(ct),m(ut),m(dt),m(ht),e=>window.matchMedia(e).matches);let vt=He((()=>((e,t,n)=>{const r=Xe.browsers(),o=Xe.oses(),s=t.bind((e=>((e,t)=>B(t.brands,(t=>{const n=t.brand.toLowerCase();return _(e,(e=>{var t;return n===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:Ve.nu(parseInt(t.version,10),0)})))})))(r,e))).orThunk((()=>((e,t)=>Ge(e,t).map((e=>{const n=Ve.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e))).fold(ot,st),a=((e,t)=>Ge(e,t).map((e=>{const n=Ve.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e).fold(pt,ft),i=((e,t,n,r)=>{const o=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!o,a=e.isiOS()||e.isAndroid(),i=a||r("(pointer:coarse)"),l=o||!s&&a&&r("(min-device-width:768px)"),c=s||a&&!l,u=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),d=!c&&!l&&!u;return{isiPad:m(o),isiPhone:m(s),isTablet:m(l),isPhone:m(c),isTouch:m(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:m(u),isDesktop:m(d)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}})(navigator.userAgent,k.from(navigator.userAgentData),gt)));const yt=()=>vt(),bt=yt(),xt=bt.deviceType.isiOS()||bt.deviceType.isAndroid(),kt=m({isSupported:!1,cleanDocument:()=>Promise.reject("not supported")});var wt=xt?kt:(e,t,n)=>{const r=t+"/wordimport.js"+(e=>k.from(e).filter((e=>0!==e.length)).map((e=>(-1===e.indexOf("?")?"?":"")+e)).getOr(""))(n||"v=9.2.3"),o=e.loadScript("ephox.wimp",r);return o.catch((e=>{console.error("Unable to load word import: ",e)})),{isSupported:!0,cleanDocument:(e,t,n)=>o.then((r=>r.cleanDocument(e,t,n.cleanFilteredInlineElements)))}};const St=e=>{let t=[];return{bind:e=>{if(void 0===e)throw new Error("Event bind error: undefined handler");t.push(e)},unbind:e=>{t=L(t,(t=>t!==e))},trigger:(...n)=>{const r={};O(e,((e,t)=>{r[e]=n[t]})),O(t,(e=>{e(r)}))}}},Ct=e=>{const t=je(e,(e=>({bind:e.bind,unbind:e.unbind}))),n=je(e,(e=>e.trigger));return{registry:t,trigger:n}},Tt=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},It=(e,t)=>{const n=void 0===t?document:t.dom;return 1!==(r=n).nodeType&&9!==r.nodeType&&11!==r.nodeType||0===r.childElementCount?[]:A(n.querySelectorAll(e),De.fromDom);var r},At=(e,t)=>e.dom===t.dom,Ot=Tt,Et=(e,t,n)=>{const r=e.document.createRange();var o;return o=r,t.fold((e=>{o.setStartBefore(e.dom)}),((e,t)=>{o.setStart(e.dom,t)}),(e=>{o.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,n)=>{e.setEnd(t.dom,n)}),(t=>{e.setEndAfter(t.dom)}))})(r,n),r},Lt=(e,t,n,r,o)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(r.dom,o),s},Nt=e=>{if(!o(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],n={};return O(e,((r,s)=>{const a=Pe(r);if(1!==a.length)throw new Error("one and only one name per case");const i=a[0],l=r[i];if(void 0!==n[i])throw new Error("duplicate key detected:"+i);if("cata"===i)throw new Error("cannot have a case named cata (sorry)");if(!o(l))throw new Error("case arguments must be an array");t.push(i),n[i]=(...n)=>{const r=n.length;if(r!==l.length)throw new Error("Wrong number of arguments to case "+i+". Expected "+l.length+" ("+l+"), got "+r);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[s].apply(null,n)},match:e=>{const r=Pe(e);if(t.length!==r.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+r.join(","));if(!M(t,(e=>T(r,e))))throw new Error("Not all branches were specified when using match. Specified: "+r.join(", ")+"\nRequired: "+t.join(", "));return e[i].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:i,params:n})}}}})),n},_t=Nt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Dt=(e,t,n)=>t(De.fromDom(n.startContainer),n.startOffset,De.fromDom(n.endContainer),n.endOffset);_t.ltr,_t.rtl;const Pt=(e,t,n,r)=>({start:e,soffset:t,finish:n,foffset:r}),Rt=e=>De.fromDom(e.dom.ownerDocument),Mt=e=>Ae(e)?e:Rt(e),jt=e=>De.fromDom(Mt(e).dom.defaultView),Ft=e=>k.from(e.dom.parentNode).map(De.fromDom),Ut=e=>k.from(e.dom.previousSibling).map(De.fromDom),Bt=e=>k.from(e.dom.nextSibling).map(De.fromDom),zt=e=>(e=>{const t=w.call(e,0);return t.reverse(),t})(((e,t)=>{const n=[],r=e=>(n.push(e),t(e));let o=t(e);do{o=o.bind(r)}while(o.isSome());return n})(e,Ut)),Ht=e=>A(e.dom.childNodes,De.fromDom),Wt=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode),$t=m(Wt),Vt=Wt?e=>De.fromDom(e.dom.getRootNode()):Mt,Gt=e=>De.fromDom(e.dom.host),qt=e=>{const t=Ie(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=Vt(e);return Oe(n=t)&&l(n.dom.host)?k.some(t):k.none();var n})(De.fromDom(t)).fold((()=>n.body.contains(t)),(r=qt,o=Gt,e=>r(o(e))));var r,o},Kt=(e,t)=>{let n=[];return O(Ht(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(Kt(e,t))})),n},Jt=(e,t)=>It(t,e),Yt=Nt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Xt={before:Yt.before,on:Yt.on,after:Yt.after,cata:(e,t,n,r)=>e.fold(t,n,r),getStart:e=>e.fold(p,p,p)},Zt=Nt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Qt={domRange:Zt.domRange,relative:Zt.relative,exact:Zt.exact,exactFromRange:e=>Zt.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>De.fromDom(e.startContainer),relative:(e,t)=>Xt.getStart(e),exact:(e,t,n,r)=>e}))(e);return jt(t)},range:Pt},en=(e,t)=>{const n=ke(e);return"input"===n?Xt.after(e):T(["br","img"],n)?0===t?Xt.before(e):Xt.after(e):Xt.on(e,t)},tn=(e,t,n,r)=>{const o=Rt(e).dom.createRange();return o.setStart(e.dom,t),o.setEnd(n.dom,r),o},nn=e=>k.from(e.getSelection()),rn=(e,t,n,r,o)=>{((e,t)=>{nn(e).each((e=>{e.removeAllRanges(),e.addRange(t)}))})(e,Lt(e,t,n,r,o))},on=(e,t,n,r,o)=>{const s=((e,t,n,r)=>{const o=en(e,t),s=en(n,r);return Qt.relative(o,s)})(t,n,r,o);((e,t)=>{((e,t)=>{const n=((e,t)=>t.match({domRange:e=>({ltr:m(e),rtl:k.none}),relative:(t,n)=>({ltr:He((()=>Et(e,t,n))),rtl:He((()=>k.some(Et(e,n,t))))}),exact:(t,n,r,o)=>({ltr:He((()=>Lt(e,t,n,r,o))),rtl:He((()=>k.some(Lt(e,r,o,t,n))))})}))(e,t);return((e,t)=>{const n=t.ltr();return n.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>_t.rtl(De.fromDom(e.endContainer),e.endOffset,De.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>Dt(0,_t.ltr,n))):Dt(0,_t.ltr,n)})(0,n)})(e,t).match({ltr:(t,n,r,o)=>{rn(e,t,n,r,o)},rtl:(t,n,r,o)=>{nn(e).each((s=>{if(s.setBaseAndExtent)s.setBaseAndExtent(t.dom,n,r.dom,o);else if(s.extend)try{((e,t,n,r,o,s)=>{t.collapse(n.dom,r),t.extend(o.dom,s)})(0,s,t,n,r,o)}catch(s){rn(e,r,o,t,n)}else rn(e,r,o,t,n)}))}})})(e,s)},sn=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return k.some(Pt(De.fromDom(t.startContainer),t.startOffset,De.fromDom(n.endContainer),n.endOffset))}return k.none()},an=e=>{if(null===e.anchorNode||null===e.focusNode)return sn(e);{const t=De.fromDom(e.anchorNode),n=De.fromDom(e.focusNode);return((e,t,n,r)=>{const o=tn(e,t,n,r),s=At(e,n)&&t===r;return o.collapsed&&!s})(t,e.anchorOffset,n,e.focusOffset)?k.some(Pt(t,e.anchorOffset,n,e.focusOffset)):sn(e)}},ln=e=>nn(e).filter((e=>e.rangeCount>0)).bind(an),cn=(e,t)=>{Ft(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},un=(e,t)=>{Bt(e).fold((()=>{Ft(e).each((e=>{hn(e,t)}))}),(e=>{cn(e,t)}))},dn=(e,t)=>{(e=>((e,t)=>{const n=e.dom.childNodes;return k.from(n[0]).map(De.fromDom)})(e))(e).fold((()=>{hn(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},hn=(e,t)=>{e.dom.appendChild(t.dom)},mn=(e,t)=>{cn(e,t),hn(t,e)},pn=(e,t)=>{O(t,((n,r)=>{const o=0===r?e:t[r-1];un(o,n)}))},fn=(e,t)=>{O(t,(t=>{hn(e,t)}))},gn=e=>{e.dom.textContent="",O(Ht(e),(e=>{vn(e)}))},vn=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},yn=e=>{const t=Ht(e);t.length>0&&pn(e,t),vn(e)},bn=(e,t,n,r)=>{const o=At(e,n)&&t===r;return{startContainer:m(e),startOffset:m(t),endContainer:m(n),endOffset:m(r),collapsed:m(o)}};let xn=0;const kn=e=>{const t=(new Date).getTime(),n=Math.floor(1e9*Math.random());return xn++,e+"_"+n+xn+String(t)},wn=(e,t,r)=>{if(!(n(r)||s(r)||u(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")},Sn=(e,t,n)=>{wn(e.dom,t,n)},Cn=(e,t)=>{const n=e.dom;Me(t,((e,t)=>{wn(n,t,e)}))},Tn=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},In=(e,t)=>k.from(Tn(e,t)),An=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},On=(e,t)=>{e.dom.removeAttribute(t)},En=(e,t)=>{const n=Tn(e,t);return void 0===n||""===n?[]:n.split(" ")},Ln=e=>void 0!==e.dom.classList,Nn=e=>En(e,"class"),_n=(e,t)=>{Ln(e)?e.dom.classList.add(t):((e,t)=>{((e,t,n)=>{const r=En(e,t).concat([n]);Sn(e,t,r.join(" "))})(e,"class",t)})(e,t)},Dn=(e,t)=>{Ln(e)?e.dom.classList.remove(t):((e,t)=>{((e,t,n)=>{const r=L(En(e,t),(e=>e!==n));r.length>0?Sn(e,t,r.join(" ")):On(e,t)})(e,"class",t)})(e,t),(e=>{0===(Ln(e)?e.dom.classList:Nn(e)).length&&On(e,"class")})(e)},Pn=(e,t)=>Ln(e)&&e.dom.classList.contains(t),Rn=(e,t,n=f)=>e.exists((e=>n(e,t))),Mn=(e,t)=>e?k.some(t):k.none(),jn=e=>void 0!==e.style&&c(e.style.getPropertyValue),Fn=(e,t,r)=>{if(!n(r))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",r,":: Element ",e),new Error("CSS value must be a string: "+r);jn(e)&&e.style.setProperty(t,r)},Un=(e,t)=>{jn(e)&&e.style.removeProperty(t)},Bn=(e,t,n)=>{const r=e.dom;Fn(r,t,n)},zn=(e,t)=>{const n=e.dom;Me(t,((e,t)=>{Fn(n,t,e)}))},Hn=(e,t)=>{const n=e.dom,r=window.getComputedStyle(n).getPropertyValue(t);return""!==r||qt(e)?r:Wn(n,t)},Wn=(e,t)=>jn(e)?e.style.getPropertyValue(t):"",$n=(e,t)=>{const n=e.dom,r=Wn(n,t);return k.from(r).filter((e=>e.length>0))},Vn=e=>{const t={},n=e.dom;if(jn(n))for(let e=0;e{const n=e.dom;Un(n,t),Rn(In(e,"style").map(G),"")&&On(e,"style")},qn=e=>"rtl"===Hn(e,"direction")?"rtl":"ltr",Kn=(e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,Ht(De.fromDom(n))},Jn=e=>e.dom.innerHTML,Yn=(e,t,n)=>{let r=e.dom;const o=c(n)?n:b;for(;r.parentNode;){r=r.parentNode;const e=De.fromDom(r);if(t(e))return k.some(e);if(o(e))break}return k.none()},Xn=(e,t)=>_(e.dom.childNodes,(e=>t(De.fromDom(e)))).map(De.fromDom),Zn=(e,t)=>{const n=e=>{for(let r=0;rYn(e,(e=>Tt(e,t)),n),er=(e,t,n)=>((e,t,n,r,o)=>((e,t)=>Tt(e,t))(n,r)?k.some(n):c(o)&&o(n)?k.none():t(n,r,o))(0,Qn,e,t,n),tr=e=>{const t=nr(e);return{resolve:e=>{const n=e.split(" ");return A(n,(e=>rr(t,e))).join(" ")}}},nr=e=>e.replace(/\./g,"-"),rr=(e,t)=>e+"-"+t,or=tr("ephox-sloth").resolve,sr=m(or("bin")),ar=["b","i","u","sub","sup","strike"],ir=sr(),lr=ir+kn(""),cr=("-100000px","100000px",e=>"rtl"===qn(e)?"100000px":"-100000px");const ur=(e,t)=>{const n=De.fromTag("div");var r;Cn(n,t),Cn(n,{contenteditable:"true","aria-hidden":"true"}),zn(n,{position:"fixed",top:"0px",width:"100px",height:"100px",overflow:"hidden",opacity:"0"}),r=n,O([ir,lr],(e=>{_n(r,e)}));const o=e=>Pn(e,lr);return{attach:e=>{gn(n),Bn(n,"left",cr(e)),hn(e,n)},focus:()=>{Qn(n,"body").each((t=>{e.toOff(t,n)}))},contents:()=>(((e,t)=>{Bt(e).filter(t).each((t=>{const n=Ht(t);fn(e,n),vn(t)})),((e,t)=>{const n=Ht(e);O(n,(e=>{t(e)&&((e,t)=>{const n=Ht(e),r=De.fromTag("div",Rt(e).dom);fn(r,n),cn(e,r),vn(e)})(e)}))})(e,t),O(Ht(e),(e=>{(e=>Te(e)&&!e.dom.hasChildNodes()&&T(ar,ke(e)))(e)&&vn(e)}))})(n,o),{elements:Ht(n),html:Jn(n),offscreen:n}),container:m(n),detach:()=>{vn(n)}}},dr=e=>{const t=At(e.start,e.finish)&&e.soffset===e.foffset;return{startContainer:m(e.start),startOffset:m(e.soffset),endContainer:m(e.finish),endOffset:m(e.foffset),collapsed:m(t)}},hr={set:(e,t)=>{on(e,t.startContainer(),t.startOffset(),t.endContainer(),t.endOffset())},get:e=>ln(e).map(dr)};var mr=e=>t=>{const n=Ct({after:St(["container"])}),r=(e=>{const t=De.fromTag("br");let n=k.none();const r=e=>jt(e).dom;return{cleanup:()=>{vn(t)},toOn:(t,o)=>{const s=r(o);n.each((n=>{const r=(e=>e.dom.childNodes.length)(t),o=At(t,n.startContainer())&&r{const a=r(s);hn(s,t),n=e.get(a),e.set(a,bn(t,0,t,0))}}})(hr),o=((e,t,n)=>{const r=ur(e,n),o=()=>{e.cleanup();const t=r.contents();r.detach(),s.trigger.after(t.elements,t.html,r.container())},s=Ct({before:St([]),after:St(["elements","html","container"])}),a=d;return{instance:m((()=>{s.trigger.before(),r.attach(t),r.focus(),((e,t)=>{((e,t)=>{setTimeout(t,1)})(0,t)})(Rt(t),o)})),destroy:a,events:s.registry}})(r,t,e);return o.events.after.bind((e=>{r.toOn(t,e.container),n.trigger.after(e.container)})),{run:()=>{o.instance()()},events:n.registry}};const pr=tr("ephox-cement").resolve,fr={cacheSuffix:"",pasteBinAttrs:{},keepSrc:!1,sanitizer:{sanitizeHtml:m(""),sanitizeText:m("")},tabSpaces:4,cleanFilteredInlineElements:[],indentUseMargin:!1,defaultProtocol:"https"},gr=m(pr("smartpaste-eph-bin")),vr=e=>{let t=k.none(),n=[];const r=e=>{o()?s(e):n.push(e)},o=()=>t.isSome(),s=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{o()||(t=k.some(e),O(n,s),n=[])})),{get:r,map:e=>vr((t=>{r((n=>{t(e(n))}))})),isReady:o}},yr={nu:vr,pure:e=>vr((t=>{t(e)}))},br=e=>{setTimeout((()=>{throw e}),0)},xr=e=>{const t=t=>{e().then(t,br)};return{map:t=>xr((()=>e().then(t))),bind:t=>xr((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>xr((()=>e().then((()=>t.toPromise())))),toLazy:()=>yr.nu(t),toCached:()=>{let t=null;return xr((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},kr=e=>xr((()=>new Promise(e))),wr=e=>((e,t)=>t((t=>{const n=[];let r=0;0===e.length?t([]):O(e,((o,s)=>{o.get((o=>s=>{n[o]=s,r++,r>=e.length&&t(n)})(s))}))})))(e,kr),Sr=()=>{const e={};return{getOrSetIndexed:(t,n)=>(t=>void 0!==e[t])(t)?e[t]:((t,n)=>(e[t]=n,n))(t,n()),waitForLoad:()=>{const t=((e,t)=>{const n=[];return Me(e,((e,r)=>{n.push(t(e,r))})),n})(e,p);return wr(t)}}},Cr=e=>{const t=t=>t(e),n=m(e),r=()=>o,o={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:x,isError:b,map:t=>Ir.value(t(e)),mapError:r,bind:t,exists:t,forall:t,getOr:n,or:r,getOrThunk:n,orThunk:r,getOrDie:n,each:t=>{t(e)},toOptional:()=>k.some(e)};return o},Tr=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:b,isError:x,map:t,mapError:t=>Ir.error(t(e)),bind:t,exists:b,forall:x,getOr:p,or:p,getOrThunk:y,orThunk:y,getOrDie:v(String(e)),each:d,toOptional:k.none};return n},Ir={value:Cr,error:Tr,fromOption:(e,t)=>e.fold((()=>Tr(t)),Cr)},Ar=e=>{const t=De.fromDom((e=>{if($t()&&l(e.target)){const t=De.fromDom(e.target);if(Te(t)&&l(t.dom.shadowRoot)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return U(t)}}return k.from(e.target)})(e).getOr(e.target)),n=()=>e.stopPropagation(),r=()=>e.preventDefault(),o=h(r,n);return((e,t,n,r,o,s,a)=>({target:e,x:t,y:n,stop:r,prevent:o,kill:s,raw:a}))(t,e.clientX,e.clientY,n,r,o,e)},Or=(e,t,n,r)=>{e.dom.removeEventListener(t,n,r)},Er=x,Lr=(e,t,n)=>((e,t,n,r)=>((e,t,n,r,o)=>{const s=((e,t)=>n=>{e(n)&&t(Ar(n))})(n,r);return e.dom.addEventListener(t,s,o),{unbind:g(Or,e,t,s,o)}})(e,t,n,r,!1))(e,t,Er,n),Nr=(e=>{const t=g(xe,e);xe("callbacks",t());const n=(n,o)=>{const s=t(),a=(e=>{const t=void 0===e.count?0:e.count,n="callback_"+t;return e.count=t+1,n})(s);return s.callbacks[a]=(...e)=>{o||r(a),n(...e)},(t=>e+".callbacks."+t)(a)},r=e=>{const n=e.substring(e.lastIndexOf(".")+1),r=t();void 0!==r.callbacks[n]&&delete r.callbacks[n]};return{ephemeral:e=>n(e,!1),permanent:e=>n(e,!0),unregister:r}})("ephox.henchman.features"),_r=(e,t)=>yr.nu((n=>{const o=t=>{O(a,(e=>{e.unbind()})),n(t.fold((t=>Ir.error(t+'Unable to download editor stylesheets from "'+e+'"')),Ir.value))},s=((e,t)=>{const n=De.fromDom(document),r=De.fromTag("link",n.dom);return Cn(r,{rel:"stylesheet",type:"text/css",href:e}),((e,t)=>{const n=(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return De.fromDom(t)})(e);hn(n,t)})(n,r),r})(e),a=[Lr(s,"load",(e=>{(e=>{var t;try{const n=null===(t=e.target.dom.sheet)||void 0===t?void 0:t.cssRules;return r(n)&&0===n.length}catch(e){}return!1})(e)?o(Ir.error("")):t(o)})),Lr(s,"error",g(o,Ir.error("")))]})),Dr=(()=>{const e=Sr(),t=()=>e.waitForLoad();return{preload:()=>{t().get(p)},addStylesheet:(t,n)=>e.getOrSetIndexed(t,(()=>_r(t,n))),addScript:(t,n)=>e.getOrSetIndexed(t,(()=>(e=>yr.nu((t=>{const n=()=>{o.unbind(),s.unbind()},r=De.fromTag("script");Sn(r,"src",e),Sn(r,"type","text/javascript"),Sn(r,"async","async"),Sn(r,"data-main",Nr.ephemeral((e=>{t(Ir.value(e))})));const o=Lr(r,"error",(()=>{n(),t(Ir.error("Error loading external script tag "+e))})),s=Lr(r,"load",n);hn(De.fromDom(document.head),r)})))(t).map(n))),waitForLoad:t}})(),Pr={loadScript:(e,t)=>new Promise(((e,n)=>{((e,t)=>Dr.addScript(e,t))(t,p).get((t=>{t.fold(n,e)}))}))},Rr=Nt([{error:["message"]},{paste:["elements","correlated"]},{cancel:[]},{incomplete:["elements","correlated","message"]}]),Mr=(e,t,n,r,o)=>e.fold(t,n,r,o),jr=Rr.error,Fr=Rr.paste,Ur=Rr.cancel,Br=Rr.incomplete,zr=["officeStyles","htmlStyles","gdocsStyles","isWord","isGoogleDocs","proxyBin","isInternal"],Hr=(e,t)=>{const n={};return O(zr,(r=>{t[r].or(e[r]).each((e=>{n[r]=e}))})),Wr(n)},Wr=e=>j(zr,(t=>k.from(e[t]))),$r=e=>({response:jr(e),bundle:Wr({})}),Vr=e=>Promise.resolve($r(e)),Gr={response:Ur(),bundle:Wr({})},qr=e=>l(e.then),Kr=(e,t,n,r)=>({steps:e,input:t,label:n,capture:r}),Jr=(e,t)=>{const n=Hr(e.bundle,t.bundle),r=((e,t)=>Mr(e,k.none,k.none,k.none,((e,n,r)=>Mr(t,k.none,((e,t)=>k.some(Rr.incomplete(e,t,r))),k.none,k.none))).getOr(t))(e.response,t.response);return{response:r,bundle:n}},Yr=(e,t,n)=>{const r=()=>e,o=()=>{const r=n(t,e);return qr(r)?r.then((t=>Jr(e,t))):Jr(e,r)};return Mr(e.response,r,o,r,o)},Xr=(Zr=(e,t)=>t,(...e)=>{if(0===e.length)throw new Error("Can't merge zero objects");const t={};for(let n=0;ne.fold(((e,n)=>0===n(t).indexOf(n(e))),((e,n)=>e.test(n(t))),((e,n)=>n(t).indexOf(n(e))>=0),((e,n)=>n(t)===n(e)),x,(e=>!to(e,t))),no={starts:Qr.starts,pattern:Qr.pattern,contains:Qr.contains,exact:Qr.exact,all:Qr.all,not:Qr.not,cata:(e,t,n,r,o,s,a)=>e.fold(t,n,r,o,s,a),matches:to,caseSensitive:eo,caseInsensitive:e=>e.toLowerCase()},ro=(e,t)=>{const n=ke(e),r=t.name,o=void 0!==t.condition?t.condition:x;return no.matches(r,n)&&o(e)},oo=(e,t,n)=>{const r=(e=>{const t={},n=l(e)?e.split(";"):[];return O(n,(e=>{const n=e.split(":");2===n.length&&(t[G(n[0])]=G(n[1]))})),t})(e.dom.getAttribute("style")),o={};return O(t,(e=>{const t=r[e];void 0===t||n(t,e)||(o[e]=t)})),o},so=e=>{const t=Pe(e);return A(t,(t=>t+": "+e[t])).join("; ")},ao=["mso-list"],io=(e,t)=>{const n=oo(e,ao,t),r=((e,t)=>{const n=e.dom.style,r=i(n)?[]:n,o={};return O(r,(n=>{$n(e,n).each((e=>{t(e,n)||(o[n]=e)}))})),o})(e,t);((e,t,n)=>{Sn(e,"style","");const r=Be(t),o=Be(n);if(0===r&&0===o)On(e,"style");else if(0===r)Sn(e,"style",so(n));else{Me(t,((t,n)=>{Bn(e,n,t)}));const r=Tn(e,"style"),s=o>0?so(n)+"; ":"";Sn(e,"style",s+r)}})(e,r,n)},lo=(e,t)=>{const n=((e,t)=>{const n={};return O(e.dom.attributes,(e=>{t(e.value,e.name)||(n[e.name]=e.value)})),n})(e,t);((e,t)=>{const n=A(e.dom.attributes,(e=>e.name));Be(t)!==n.length&&((e,t,n)=>{O(t,(t=>{On(e,t)})),Me(n,((t,n)=>{Sn(e,n,t)}))})(e,n,t)})(e,n)},co=(e,t)=>{io(De.fromDom(e),t)},uo=(e,t,n)=>{e(n,((e,r)=>I(t,(t=>((e,t,n,r)=>{const o=r.name,s=void 0!==r.condition?r.condition:x,a=void 0!==r.value?r.value:no.all();return no.matches(o,n)&&no.matches(a,t)&&s(e)})(n,e,r,t)))))},ho="startElement",mo="endElement",po="text",fo="comment",go=(e,t,n)=>{let r,o,s;const a=De.fromDom(e);switch(e.nodeType){case 1:t?r=mo:(r=ho,zn(a,n||{}));const i=e;o="HTML"!==i.scopeName&&i.scopeName&&i.tagName&&i.tagName.indexOf(":")<=0?(i.scopeName+":"+i.tagName).toLowerCase():i.tagName.toLowerCase();break;case 3:r=po,s=e.nodeValue;break;case 8:r=fo,s=e.nodeValue;break;default:console.log("WARNING: Unsupported node type encountered: "+e.nodeType)}return{getNode:m(e),tag:()=>o,type:()=>r,text:()=>s}},vo=(e,t,n,r)=>{const o=r.createElement(e);return Me(t,((e,t)=>{o.setAttribute(t,e+"")})),go(o,!1,n)},yo=(e,t)=>go(t.createElement(e),!0),bo=yo("html",window.document),xo=e=>{const t=e.createDocumentFragment();let n=t;const r=e=>{n.appendChild(e)};return{dom:t,receive:o=>{switch(o.type()){case ho:s=o.getNode().cloneNode(!1),r(s),n=s;break;case po:(t=>{const n=e.createTextNode(t.text());r(n)})(o);break;case mo:(()=>{const e=n.parentNode;n=null===e?t:e})();break;case fo:break;default:throw new Error("Unsupported token type: "+o.type())}var s},label:"SERIALISER"}},ko=e=>t=>{((e,t)=>{const n=Xr({styles:[],attributes:[],classes:[],tags:[]},t),r=Jt(e,"*");O(r,(e=>{uo(io,n.styles,e),uo(lo,n.attributes,e),O(n.classes,(t=>{const n=An(e,"class")?(e=>Ln(e)?(e=>{const t=e.dom.classList,n=new Array(t.length);for(let e=0;e{no.matches(t.name,n)&&Dn(e,n)}))}))}));const o=Jt(e,"*");O(o,(e=>{I(n.tags,g(ro,e))&&vn(e)}))})(t,e)},wo=e=>t=>{((e,t)=>{const n=Xr({tags:[]},t),r=Jt(e,"*");O(r,(e=>{I(n.tags,g(ro,e))&&yn(e)}))})(t,e)},So=e=>t=>{((e,t)=>{const n=Xr({tags:[]},t),r=Jt(e,"*");O(r,(e=>{_(n.tags,g(ro,e)).each((t=>{t.mutate(e)}))}))})(t,e)},Co=e=>t=>{const n=Jn(t),r=((e,t,n)=>{const r=xo(e),o=((e,t=window.document)=>{const n=t.createElement("div");t.body.appendChild(n),n.style.position="absolute",n.style.left="-10000px",n.innerHTML=e;let r=n.firstChild||bo;const o=[];let s=!1;return{hasNext:()=>void 0!==r,next:()=>{const e=r,a=r,i=s;return!s&&e.firstChild?(o.push(e),r=e.firstChild):s||1!==e.nodeType?e.nextSibling?(r=e.nextSibling,s=!1):(r=o.pop(),s=!0):s=!0,a===bo||r||(t.body.removeChild(n),r=bo),(l=a)===bo?l:l?go(l,i):void 0;var l}}})(t,e),s=((e,t,n)=>{let r=n;for(let n=t.length-1;n>=0;n--)r=t[n](r,{},e);return r})(e,n,r);for(;o.hasNext();){const e=o.next();s.receive(e)}return r.dom})(Rt(t).dom,n,e);gn(t),t.dom.appendChild(r)},To=(e,t,n)=>{const r=De.fromTag("div",e.dom);zn(r,{position:"fixed",left:"-100000px",top:"0px"}),hn((e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return De.fromDom(t)})(e),r),r.dom.innerHTML=t,O(n,(e=>{e(r)}));const o=Jn(r);return vn(r),o},Io=(e,t)=>n=>{const r=e=>{n.receive(e)},o=(e,t,n)=>(n=void 0!==n?n:e.type()===mo,go(t,n,{})),s={emit:r,emitTokens:e=>{O(e,r)},receive:t=>{e(s,t,o)},document:window.document};return t(s),s},Ao=(e,t)=>{if(void 0===e||void 0===t)throw console.trace(),new Error("brick");e.nextFilter.set(t)},Oo=(e,t,n=!1)=>e===t||l(e)&&l(t)&&e.tag===t.tag&&e.type===t.type&&(n||e.variant===t.variant),Eo=(e,t)=>An(De.fromDom(t.getNode()),"data-list-level"),Lo=(e,t,n,r)=>{const o=n.getCurrentListType(),s=n.getCurrentLevel()==r.level()?o:null;return(a=r.emblems(),i=s,_(a,(e=>"ul"===e.tag||l(i)&&Oo(e,i,!0))).orThunk((()=>U(a)))).filter((e=>!("ol"===e.tag&&(e=>{if(T(["p"],e.tag())){const t=((e,t)=>{const n=De.fromDom(e.getNode());return Tn(n,"class")})(e);return l(t)&&/^MsoHeading/.test(t)}return!0})(t))));var a,i},No=e=>(t,n,r)=>{const o=r,s=(e=>{const t=parseInt(Tn(e,"data-list-level"),10),n=Tn(e,"data-list-emblems"),r=l(n)?JSON.parse(n):[];return On(e,"data-list-level"),On(e,"data-list-emblems"),{level:m(t),emblems:m(r)}})(De.fromDom(o.getNode()));n.originalToken.set(o);const a=((e,t,n)=>(Lo(n.listType.get(),e,n.emitter,t).each(n.listType.set),((e,t,n)=>({level:m(e),token:m(t),type:m(n)}))(t.level(),n.originalToken.get(),n.listType.get())))(o,s,n);n.emitter.openItem(a.level(),a.token(),a.type()),Ao(n,e.inside())},_o=(e,t,n)=>({pred:e,action:t,label:m(n)});var Do=(e,t,n)=>{const r=(e,r,o)=>{_(t,(e=>e.pred(r,o))).fold(m(n),(e=>e.action))(e,r,o)};return r.toString=()=>"Handlers for "+e,r};const Po=(e,t)=>({state:m(e),result:m(t)}),Ro=(e,t)=>({state:m(e),value:m(t)}),Mo=(e,t,n,r)=>({level:m(e),type:m(t),types:m(n),items:m(r)}),jo=e=>{const t=e.items().slice(0);if(t.length>0&&"p"!==t[t.length-1]){const n=t[t.length-1];t[t.length-1]="p";const r=Mo(e.level(),e.type(),e.types(),t);return Ro(r,k.some(n))}return Ro(e,k.none())},Fo=(e,t,n)=>{let r=[],o=e;for(;t(o);){const e=n(o);o=e.state(),r=r.concat(e.result())}return Po(o,r)},Uo=(e,t,n)=>{const r=t.start&&t.start>1?{start:t.start}:{},o=e.level()+1,s=t,a=e.types().concat([t]),i=[g(vo,t.tag,r,n)],l=Mo(o,s,a,e.items());return Po(l,i)},Bo=e=>{const t=e.types().slice(0),n=[g(yo,t.pop().tag)],r=e.level()-1,o=t[t.length-1],s=Mo(r,o,t,e.items());return Po(s,n)},zo=(e,t,n)=>{const r=(c=t)?(e=>{const t=((e,t)=>{const n=De.fromDom(e.getNode());return Hn(n,"margin-left")})(e);return l(t)&&"0px"!==t?{"margin-left":t}:{}})(c):{"list-style-type":"none"},o=e.type()&&!Oo(e.type(),n)?((e,t)=>{const n=Bo(e),r=Uo(n.state(),t,t.type?{"list-style-type":t.type}:{});return Po(r.state(),n.result().concat(r.result()))})(e,n):Po(e,[]),s=[g(vo,"li",{},r)],a=((e,t)=>{const n=e.items().slice(0),r=void 0!==t&&"p"!==t?k.some(t):k.none();r.fold((()=>{n.push("p")}),(e=>{n.push(e)}));const o=Mo(e.level(),e.type(),e.types(),n);return Ro(o,r)})(o.state(),t&&t.tag()),i=a.value().map((e=>{const n=t;return co(n.getNode(),x),[m(n)]})).getOr([]);var c;return Po(a.state(),o.result().concat(s).concat(i))},Ho=e=>{const t=g(yo,"li"),n=jo(e),r=n.value().fold((()=>[t]),(e=>[g(yo,e),t]));return Po(n.state(),r)},Wo=e=>{if(0===e.length)throw new Error("Compose must have at least one element in the list");const t=e[e.length-1],n=R(e,(e=>e.result()));return Po(t.state(),n)},$o=e=>{const t=Ho(e),n=Bo(t.state());return Wo([t,n])},Vo=(e,t)=>((e,t,n)=>Fo(e,(e=>e.level()>t),n))(e,t,$o),Go=(e,t,n,r)=>{const o=e.level()>t?Vo(e,t):Po(e,[]),s=o.state().level()===t?((e,t,n)=>{const r=e.level()>0?Ho(e):Po(e,[]),o=zo(r.state(),n,t);return Wo([r,o])})(o.state(),r,n):((e,t,n,r)=>{const o=n>1?jo(e):Ro(e,k.none()),s=o.value().map((e=>[g(yo,e)])).getOr([]),a=((e,t,n,r)=>((e,t,n)=>Fo(e,(e=>e.level()((e,t,n,r)=>{const o=e.level()===n-1&&t.type?{"list-style-type":t.type}:{},s=Uo(e,t,o),a=zo(s.state(),s.state().level()==n?r:void 0,t);return Wo([s,a])})(e,t,n,r))))(o.state(),t,n,r);return Po(a.state(),s.concat(a.result()))})(o.state(),r,t,n);return Wo([o,s])},qo=Vo,Ko=["disc","circle","square"],Jo={getCurrentListType:()=>Yo().getCurrentListType(),getCurrentLevel:()=>Yo().getCurrentLevel(),closeAllLists:()=>Yo().closeAllLists(),openItem:(e,t,n)=>Yo().openItem(e,t,n)};let Yo=()=>({getCurrentListType:m({}),getCurrentLevel:m(1),closeAllLists:d,openItem:p});const Xo={inside:()=>Qo,outside:()=>es},Zo=(()=>{let e=!1;return{check:t=>!(!e||t.type()!==po)||(t.type()===ho&&"style"===t.tag()?(e=!0,!0):t.type()===mo&&"style"===t.tag()&&(e=!1,!0))}})(),Qo=(e=>Do("Inside.List.Item",[_o(((e,t)=>{const n=e.originalToken.get();return t.type()===mo&&null!==n&&t.tag()===n.tag()}),((t,n)=>{Ao(n,e.outside())}),"Closing open tag")],((e,t,n)=>{e.emit(n)})))(Xo),es=(e=>Do("Outside.List.Item",[_o(Eo,No(e),"Data List ****"),_o(((e,t)=>t.type()===po&&(e=>e.type()===po&&/^[\s\u00A0]*$/.test(e.text()))(t)),((e,t,n)=>{e.emit(n)}),"Whitespace")],((t,n,r)=>{n.emitter.closeAllLists(),t.emit(r),Ao(n,e.outside())})))(Xo),ts=(e=>{const t=fe(e),n=fe(null),r=fe(null);return{reset:o=>{t.set(e),n.set(null),r.set(null),Yo=m(((e,t)=>{let n=Mo(0,void 0,[],[]);const r=n=>{O(n.result(),(n=>{const r=n(t);e.emit(r)}))};return{closeAllLists:()=>{const e=qo(n,0);n=e.state(),r(e)},openItem:(e,t,o)=>{if(!o)return;const s=((e,t)=>"ul"===e.tag&&Ko[t-1]===e.type?{tag:"ul"}:e)(o,e),a=Go(n,e,t,s);n=a.state(),r(a)},getCurrentListType:()=>n.type(),getCurrentLevel:()=>n.level()}})(o,o.document))},nextFilter:t,originalToken:n,listType:r,emitter:Jo}})(es);var ns=Io(((e,t,n)=>{Zo.check(t)||((e,t,n)=>{t.nextFilter.get()(e,t,n)})(e,ts,t)}),ts.reset);const rs=e=>e.dom.textContent,os=[{regex:/^\(?[dc][\.\)]$/,type:{tag:"ol",type:"lower-alpha"}},{regex:/^\(?[DC][\.\)]$/,type:{tag:"ol",type:"upper-alpha"}},{regex:/^\(?M*(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})[\.\)]$/,type:{tag:"ol",type:"upper-roman"}},{regex:/^\(?m*(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})[\.\)]$/,type:{tag:"ol",type:"lower-roman"}},{regex:/^\(?[0-9]+[\.\)]$/,type:{tag:"ol"}},{regex:/^([0-9]+\.)*[0-9]+\.?$/,type:{tag:"ol",variant:"outline"}},{regex:/^\(?[a-z]+[\.\)]$/,type:{tag:"ol",type:"lower-alpha"}},{regex:/^\(?[A-Z]+[\.\)]$/,type:{tag:"ol",type:"upper-alpha"}}],ss={"\u2022":{tag:"ul",type:"disc"},"\xb7":{tag:"ul",type:"disc"},"\xa7":{tag:"ul",type:"square"}},as={o:{tag:"ul",type:"circle"},"-":{tag:"ul",type:"disc"},"\u25cf":{tag:"ul",type:"disc"},"\ufffd":{tag:"ul",type:"circle"}},is=(e,t)=>a(e.variant)?"("===t.charAt(0)?"()":")"===t.charAt(t.length-1)?")":".":e.variant,ls=e=>{const t=e.split("."),n=(()=>{if(0===t.length)return e;const n=t[t.length-1];return 0===n.length&&t.length>1?t[t.length-2]:n})(),r=parseInt(n,10);return isNaN(r)?{}:{start:r}},cs=e=>{const t=(e=>oo(e,["mso-list"],b)["mso-list"])(e),n=l(t)&&/ level([0-9]+)/.exec(t);return n&&n[1]?k.some(parseInt(n[1],10)):k.none()},us=(e,t)=>{const n=((e,t)=>{const n=as[e]?[as[e]]:[],r=((e,t)=>t&&ss[e]?[ss[e]]:t?[{tag:"ul",variant:e}]:[])(e,t),o=R(os,(t=>t.regex.test(e)?[Xr(t.type,ls(e),{variant:is(t.type,e)})]:[])),s=n.concat(r).concat(o);return A(s,(t=>void 0!==t.variant?t:Xr(t,{variant:e})))})(rs(e).trim(),t);return n.length>0?k.some(n):k.none()},ds=e=>Xn(e,Ce).bind(Bt).filter(Ee("span")),hs=e=>Zn(e,(e=>!!(Te(e)?oo(e,["mso-list"],b):{})["mso-list"])),ms=e=>Te(e)&&$n(e,"font-family").exists((e=>T(["wingdings","symbol"],e.toLowerCase()))),ps=(e,t,n,r)=>{((e,t,n)=>{Sn(e,"data-list-level",t);const r=JSON.stringify(n);Sn(e,"data-list-emblems",r)})(e,t,n),(e=>{const t=((e,t)=>{const n=t.getOr(x);return(e=>{const t=[];for(;null!==e.nextNode();)t.push(De.fromDom(e.currentNode));return t})(document.createTreeWalker(e.dom,NodeFilter.SHOW_COMMENT,{acceptNode:e=>n(e.nodeValue)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))})(e,k.none());O(t,vn)})(e),O(r,vn),On(e,"style"),On(e,"class")},fs=e=>(e=>cs(e).bind((t=>(e=>Xn(e,ms))(e).bind((n=>us(n,!0).map((r=>({mutate:()=>{ps(e,t,r,[n])}}))))))))(e).orThunk((()=>(e=>cs(e).bind((t=>ds(e).bind((n=>us(n,ms(n)).map((r=>({mutate:()=>{ps(e,t,r,[n])}}))))))))(e))).orThunk((()=>(e=>cs(e).bind((t=>ds(e).bind((n=>us(n,ms(n)).map((r=>({mutate:()=>{ps(e,t,r,[n])}}))))))))(e))).orThunk((()=>(e=>"p"!==ke(e)?k.none():cs(e).bind((t=>hs(e).bind((n=>us(n,!1).map((r=>({mutate:()=>{ps(e,t,r,[Ft(n).getOr(n)])}}))))))))(e))).orThunk((()=>(e=>"p"!==ke(e)?k.none():hs(e).bind((t=>{const n=Ft(t).getOr(t),r=ms(n);return us(t,r).bind((t=>(e=>$n(e,"margin-left").bind((e=>{const t=parseInt(e,10);return isNaN(t)?k.none():k.some(Math.max(1,Math.ceil(t/18)))})))(e).map((r=>({mutate:()=>{ps(e,r,t,[n])}})))))})))(e))),gs=So({tags:[{name:no.pattern(/^(p|h\d+)$/,no.caseInsensitive),mutate:e=>{fs(e).each((e=>{e.mutate()}))}}]}),vs=ns,ys=e=>{return(o=e,Ce(o)?(t=o,n="v:shape",k.from((r=t,r.dom.nodeValue)).bind((e=>{const t=e.indexOf("]>"),r=(e=>{try{return(new DOMParser).parseFromString(e,"text/html").body}catch(t){const n=document.implementation.createHTMLDocument("").body;return n.innerHTML=e,n}})(`
${e.slice(t+2,e.lastIndexOf("`);return Zn(De.fromDom(r),(e=>ke(e)===n))}))):k.none()).map((e=>{const t=Tn(e,"o:spid"),n=void 0===t?In(e,"id").getOr(""):t,r=De.fromTag("img");return _n(r,"rtf-data-image"),Sn(r,"data-image-id",n.substr(7)),Sn(r,"data-image-type","code"),((e,t)=>{const n=e.dom;Me(t,((e,t)=>{e.fold((()=>{Un(n,t)}),(e=>{Fn(n,t,e)}))}))})(r,{width:$n(e,"width"),height:$n(e,"height")}),r}));var t,n,r,o},bs=e=>{if(Ee("img")(e)){const t=Tn(e,"src");if(null!=t&&$(t,"file://")){const n=(e=>((e,t)=>De.fromDom(e.dom.cloneNode(!1)))(e))(e),r=t.split(/[\/\\]/),o=r[r.length-1];return Sn(n,"data-image-id",o),On(n,"src"),Sn(n,"data-image-type","local"),_n(n,"rtf-data-image"),k.some(n)}return k.none()}return k.none()};var xs;!function(e){e[e.Word=0]="Word",e[e.GoogleDocs=1]="GoogleDocs",e[e.Html=2]="Html"}(xs||(xs={}));const ks=e=>t=>{In(t,e.attrName).each((n=>{const r=l(e.styleName)?e.styleName:e.attrName;if($n(t,r).isNone()){const o=e.mapValue(n);Bn(t,r,o)}On(t,e.attrName)}))},ws=e=>{const t=ke(e);return"td"===t||"tr"===t||"col"===t||"th"===t},Ss=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Cs=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Ts=e=>H(e,"#").toUpperCase(),Is=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},As=e=>(e=>({value:Ts(e)}))(Is(e.red)+Is(e.green)+Is(e.blue)),Os=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,Es=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,Ls=(e,t,n,r)=>({red:e,green:t,blue:n,alpha:r}),Ns=(e,t,n,r)=>{const o=parseInt(e,10),s=parseInt(t,10),a=parseInt(n,10),i=parseFloat(r);return Ls(o,s,a,i)},_s=["background-repeat-x","background-repeat-y"],Ds=e=>{return"currentcolor"===e||"transparent"===e?e:"#"+(t=H(e,"#").toUpperCase(),(e=>Ss.test(e)||Cs.test(e))(t)?k.some({value:Ts(t)}):k.none()).orThunk((()=>(e=>{if("transparent"===e)return k.some(Ls(0,0,0,0));const t=Os.exec(e);if(null!==t)return k.some(Ns(t[1],t[2],t[3],"1"));const n=Es.exec(e);return null!==n?k.some(Ns(n[1],n[2],n[3],n[4])):k.none()})(e).map(As))).getOrThunk((()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const n=t.getContext("2d");n.clearRect(0,0,t.width,t.height),n.fillStyle="#FFFFFF",n.fillStyle=e,n.fillRect(0,0,1,1);const r=n.getImageData(0,0,1,1).data,o=r[0],s=r[1],a=r[2],i=r[3];return As(Ls(o,s,a,i))})).value;var t},Ps=(e,t)=>{if(a(e))return"";switch(t){case"color":return Ds(e);case"font-family":return e.replace(/['"]/g,"");case"font-weight":return(e=>{switch(e){case"bold":return"700";case"normal":return"400";default:return e}})(e);default:return V(t,"-color")?Ds(e):(e=>e.replace(/^0(pt|px|pc|in|cm|mm|Q|cap|ch|ic|em|ex|lh|rlh|rem|vw|vh|vb|vi|vmax|vmin|%)$/,"0"))(e)}},Rs=So({tags:[{name:no.pattern(/^(p|div)$/,no.caseInsensitive),mutate:e=>{const t="ltr"===qn(e),n=t?"margin-left":"margin-right",r=t?"padding-left":"padding-right";$n(e,n).each((()=>{const t=Hn(e,n);Bn(e,r,t),Gn(e,n)}))}}]}),Ms=wo({tags:[{name:no.exact("b",no.caseInsensitive),condition:e=>In(e,"id").exists((e=>$(e,"docs-internal-guid")))}]}),js=ko({attributes:[{name:no.exact("id",no.caseInsensitive),value:no.starts("docs-internal-guid",no.caseInsensitive)}]}),Fs=[So({tags:[{name:no.exact("col",no.caseInsensitive),mutate:ks({attrName:"width",mapValue:e=>e.replace(/^(\d+)$/,"$1px")})}]})],Us=e=>So({tags:[{name:no.exact(e.matchTag,no.caseInsensitive),mutate:t=>{var n,r;(n=Vn(t),r=e.key,ze(n,r)?k.from(n[r]):k.none()).exists((t=>T(e.values,t)))&&(mn(t,De.fromTag(e.newTag)),Gn(t,e.key),o(e.removeExtra)&&O(e.removeExtra,(e=>Gn(t,e))))}}]}),Bs=[Us({matchTag:"span",key:"font-weight",values:["700","bold"],newTag:"strong"}),Us({matchTag:"span",key:"font-style",values:["italic"],newTag:"em"}),Us({matchTag:"span",key:"vertical-align",values:["sub"],newTag:"sub",removeExtra:["font-size"]}),Us({matchTag:"span",key:"vertical-align",values:["super"],newTag:"sup",removeExtra:["font-size"]})],zs=e=>t=>{const n=[],r={border:e.browser.isFirefox()?"medium none":"none","text-decoration":"none"},o=(e,t)=>{if(!a(t)){const r=De.fromTag(ke(e));hn(t,r),n.push({me:e,fake:r})}const r=L(Ht(e),Te);O(r,(t=>o(t,e)))};o(t);const s=A(n,(e=>{const{fake:t,me:n}=e,o=Vn(n),s=Ue(o,((e,r)=>{const o=((e,t)=>T(_s,t)?$n(e,"background-repeat"):k.none())(n,r).getOr(e),s=((e,t)=>T(_s,t)?Hn(e,"background-repeat"):Hn(e,t))(t,r);return Ps(o,r)===Ps(s,r)})),a=Ue(r,((e,t)=>Rn($n(n,t),e)));return{fake:t,me:n,toRemove:s,toPreserve:a}}));O(s,(e=>{const{me:t,toRemove:n,toPreserve:r,fake:o}=e;Me(n,((e,n)=>{Gn(t,n)})),Me(r,((e,n)=>{Bn(t,n,e)})),vn(o)}))},Hs=["p","div","article","aside","details","dt","figcaption","footer","form","fieldset","header","hgroup","html","main","nav","section","summary","body","dl","multicol","dd","figure","address","center","blockquote","h1","h2","h3","h4","h5","h6","listing","xmp","pre","plaintext","menu","dir","ul","ol","li","hr","table","tbody","thead","tfoot","th","tr","td","caption"],Ws=ko({styles:[{name:no.exact("background-color",no.caseInsensitive),value:no.exact("transparent",no.caseInsensitive)},{name:no.exact("white-space",no.caseInsensitive),value:no.starts("pre",no.caseInsensitive)},{name:no.exact("white-space-collapse",no.caseInsensitive),value:no.starts("preserve",no.caseInsensitive)},{name:no.exact("text-wrap",no.caseInsensitive),value:no.not(no.exact("wrap",no.caseInsensitive))},{name:no.pattern(/^overflow(-[xy])?$/,no.caseInsensitive),condition:e=>ws(e)&&Rn($n(e,"overflow"),"hidden")},{name:no.exact("overflow-wrap",no.caseInsensitive),condition:ws},{name:no.exact("table-layout",no.caseInsensitive),value:no.exact("fixed",no.caseInsensitive),condition:Ee("table")},{name:no.exact("line-height",no.caseInsensitive),value:no.exact("1.38",no.caseInsensitive)},{name:no.exact("vertical-align",no.caseInsensitive),value:no.exact("baseline",no.caseInsensitive)},{name:no.exact("font-style",no.caseInsensitive),value:no.exact("normal",no.caseInsensitive)},{name:no.exact("font-variant",no.caseInsensitive),value:no.exact("normal",no.caseInsensitive)},{name:no.exact("background-color",no.caseInsensitive),value:no.exact("transparent",no.caseInsensitive)},{name:no.starts("padding",no.caseInsensitive),condition:ws},{name:no.pattern(/^text-decoration(-(line|thickness|style|color))?$/,no.caseInsensitive),condition:e=>!Ee("a")(e)&&Rn($n(e,"text-decoration"),"none")}],attributes:[{name:no.exact("aria-level",no.caseInsensitive),condition:Ee("li")},{name:no.exact("dir",no.caseInsensitive),value:no.exact("ltr",no.caseInsensitive),condition:e=>T(Hs,ke(e))},{name:no.exact("role",no.caseInsensitive),value:no.exact("presentation",no.caseInsensitive),condition:e=>Ee("p")(e)&&Ft(e).exists(Ee("li"))}]}),$s=ko({styles:[{name:no.exact("text-align",no.caseInsensitive),value:no.exact("right",no.caseInsensitive),condition:e=>"rtl"===qn(e)}]}),Vs=So({tags:[{name:no.exact("p",no.caseInsensitive),condition:e=>{const t=t=>$n(e,t).map((e=>parseInt(e,10))).filter((e=>!isNaN(e))).getOr(0),n=qn(e);return t("text-indent")+t("rtl"===n?"padding-right":"padding-left")===0},mutate:e=>{const t=qn(e);Gn(e,"text-indent"),Gn(e,"rtl"===t?"padding-right":"padding-left")}}]}),Gs=e=>t=>Pn(t,e),qs=ve(Ie,"text"),Ks=e=>qs.get(e),Js=e=>{const t=e.dom.attributes;return null==t||0===t.length||1===t.length&&"style"===t[0].name},Ys=(e,t)=>{const n=De.fromTag(e);cn(t,n);const r=t.dom.attributes;O(r,(e=>{n.dom.setAttribute(e.name,e.value)}));const o=Ht(t);return fn(n,o),vn(t),n},Xs=Ee("li"),Zs=e=>Ut(e).bind((e=>Ie(e)&&0===Ks(e).trim().length?Zs(e):Xs(e)?k.some(e):k.none())),Qs=e=>{const t=Ys("span",e),n={"font-size":{1:"8pt",2:"10pt",3:"12pt",4:"14pt",5:"18pt",6:"24pt",7:"36pt"}};Me({face:"font-family",size:"font-size",color:"color"},((e,r)=>{In(t,r).each((o=>{const s=n[e],a=void 0!==s&&void 0!==s[o]?s[o]:o;Bn(t,e,a),On(t,r)}))}))},ea=ko({tags:[{name:no.exact("script",no.caseInsensitive)},{name:no.exact("link",no.caseInsensitive)},{name:no.exact("style",no.caseInsensitive),condition:e=>0===Jn(e).length}],attributes:[{name:no.starts("on",no.caseInsensitive)},{name:no.exact('"',no.caseInsensitive)},{name:no.exact("lang",no.caseInsensitive)},{name:no.exact("language",no.caseInsensitive)}],styles:[{name:no.all(),value:no.pattern(/OLE_LINK/i,no.caseInsensitive)}]}),ta=ko({tags:[{name:no.exact("meta",no.caseInsensitive)}]}),na=ko({tags:[{name:no.exact("style",no.caseInsensitive)}]}),ra=ko({styles:[{name:no.not(no.pattern(/^(width|height|list-style-type)$/,no.caseInsensitive)),condition:e=>!Pn(e,"ephox-limbo-transform")},{name:no.pattern(/^(width|height)$/,no.caseInsensitive),condition:e=>{return(e=>"img"!==ke(e))(e)&&!("table"===ke(t=e)||ws(t));var t}}]}),oa=(e=[])=>{const t=A(e,(e=>({name:no.exact(e,no.caseInsensitive)})));return wo({tags:t})},sa=ko({classes:[{name:no.not(no.exact("rtf-data-image",no.caseInsensitive))}]}),aa=ko({styles:[{name:no.pattern(/^(mso-.*|tab-stops|tab-interval|language|text-underline|text-effect|text-line-through|font-color|horiz-align|list-image-[0-9]+|separator-image|table-border-color-(dark|light)|vert-align|vnd\..*)$/,no.caseInsensitive)}]}),ia=ko({classes:[{name:no.pattern(/mso/i,no.caseInsensitive)}]}),la=wo({tags:[{name:no.exact("img",no.caseInsensitive),condition:e=>{const t=Tn(e,"src");return n(t)&&/^file:/.test(t)}}]}),ca=wo({tags:[{name:no.exact("a",no.caseInsensitive),condition:Js}]}),ua=ko({attributes:[{name:no.exact("style",no.caseInsensitive),value:no.exact("",no.caseInsensitive)}]}),da=ko({attributes:[{name:no.exact("class",no.caseInsensitive),value:no.exact("",no.caseInsensitive)}]}),ha=wo({tags:[{name:no.pattern(/^(font|em|strong|samp|acronym|cite|code|dfn|kbd|tt|b|i|u|s|sub|sup|ins|del|var|span)$/,no.caseInsensitive),condition:(ma=e=>!Js(e)||(e=>{const t=e.dom.attributes,n=null!=t&&t.length>0;return"span"!==ke(e)||n})(e)&&Zn(e,(e=>{const t=!Js(e),n=!T(["font","em","strong","samp","acronym","cite","code","dfn","kbd","tt","b","i","u","s","sub","sup","ins","del","var","span"],ke(e));return Ie(e)||t||n})).isSome(),e=>!ma(e))}]});var ma;const pa=So({tags:[{name:no.exact("p",no.caseInsensitive),mutate:e=>{0===Jn(e).length&&hn(e,De.fromTag("br"))}}]}),fa=e=>{const t=Ys("span",e);_n(t,"ephox-limbo-transform"),Bn(t,"text-decoration","underline")},ga=So({tags:[{name:no.pattern(/ol|ul/,no.caseInsensitive),mutate:e=>{Ft(e).each((t=>{const n=ke(t);T(["ol","ul"],n)&&Zs(e).fold((()=>{const t=De.fromTag("li");Bn(t,"list-style-type","none"),mn(e,t)}),(t=>{hn(t,e)}))}))}}]}),va=e=>{const t=[{name:"b",transform:{mutate:g(Ys,"strong")}},{name:"i",transform:{mutate:g(Ys,"em")}},{name:"u",transform:{mutate:fa}},{name:"s",transform:{mutate:g(Ys,"strike")}},{name:"font",transform:{mutate:Qs,debug:!0}}],n=L(t,(t=>!T(e,t.name))).map((e=>({name:no.exact(e.name,no.caseInsensitive),...e.transform})));return So({tags:n})},ya=ko({classes:[{name:no.exact("ephox-limbo-transform",no.caseInsensitive)}]}),ba=ko({tags:[{name:no.exact("br",no.caseInsensitive),condition:Gs("Apple-interchange-newline")}]}),xa=ko({styles:[{name:no.pattern(/^-/,no.caseInsensitive)},{name:no.all(),value:no.exact("initial",no.caseInsensitive)},{name:no.exact("background-color",no.caseInsensitive),value:no.exact("transparent",no.caseInsensitive)},{name:no.exact("font-style",no.caseInsensitive),value:no.exact("normal",no.caseInsensitive)},{name:no.pattern(/font-variant.*/,no.caseInsensitive)},{name:no.exact("letter-spacing",no.caseInsensitive)},{name:no.exact("font-weight",no.caseInsensitive),value:no.pattern(/400|normal/,no.caseInsensitive)},{name:no.exact("orphans",no.caseInsensitive)},{name:no.exact("text-decoration",no.caseInsensitive),value:no.exact("none",no.caseInsensitive)},{name:no.exact("text-size-adjust",no.caseInsensitive)},{name:no.exact("text-indent",no.caseInsensitive),value:no.exact("0px",no.caseInsensitive)},{name:no.exact("text-transform",no.caseInsensitive),value:no.exact("none",no.caseInsensitive)},{name:no.exact("white-space",no.caseInsensitive),value:no.exact("normal",no.caseInsensitive)},{name:no.exact("widows",no.caseInsensitive)},{name:no.exact("word-spacing",no.caseInsensitive),value:no.exact("0px",no.caseInsensitive)},{name:no.exact("text-align",no.caseInsensitive),value:no.pattern(/start|end/,no.caseInsensitive)},{name:no.exact("font-weight",no.caseInsensitive),value:no.pattern(/700|bold/,no.caseInsensitive),condition:e=>/^h\d$/.test(ke(e))}]}),ka=(()=>{const e=(e,t)=>n=>e(n).filter((e=>Ie(n)&&t(rs(e)||""," "))).isSome(),t=e(Ut,V),n=e(Bt,$);return So({tags:[{name:no.exact("span",no.caseInsensitive),condition:Gs("Apple-converted-space"),mutate:e=>{"\xa0"===rs(e)&&(t(e)||n(e)?yn(e):(cn(e,De.fromText(" ")),vn(e)))}}]})})(),wa=(()=>{const e=/^file:\/\/\/[^#]+(#[^#]+)$/;return So({tags:[{name:no.exact("a",no.caseInsensitive),condition:t=>{const n=Tn(t,"href");return!!n&&e.test(n)},mutate:t=>{In(t,"href").each((n=>{Sn(t,"href",n.replace(e,"$1"))}))}}]})})(),Sa=ko({attributes:[{name:no.exact("href",no.caseInsensitive),value:no.starts("file:///",no.caseInsensitive)}]}),Ca=(()=>{const e=(e,t,n)=>({name:no.exact(e,no.caseInsensitive),condition:e=>An(e,t),mutate:e=>{In(e,t).each((r=>{Sn(e,n,r),On(e,t)}))}});return So({tags:[e("a","data-ephox-href","href"),e("img","data-ephox-src","src")]})})(),Ta=e=>{const t=["table","thead","tbody","tfoot","th","tr","td","ul","ol","li"],n=Kt(e,Ce),r=_(n,(e=>W(Ne(e),"StartFragment"))),o=_(n,(e=>W(Ne(e),"EndFragment")));r.each((n=>{o.each((r=>{let o=n;const s=[];let a=((e,t,n,r)=>{const o=tn(e,0,n,0);return De.fromDom(o.commonAncestorContainer)})(n,0,r);for(;void 0!==a&&!At(a,e);)T(t,ke(a))?o=a:s.push(a),a=Ft(a).getOrUndefined();O(s,yn),O(zt(o),vn)})),vn(n)})),o.each(vn)},Ia=So({tags:[{name:no.pattern(/^(img|table)$/,no.caseInsensitive),mutate:e=>{$n(e,"margin-left").exists((e=>$(e,"-")))&&Gn(e,"margin-left"),$(Hn(e,"margin-left"),"-")&&(Bn(e,"margin-top",Hn(e,"margin-top")),Bn(e,"margin-bottom",Hn(e,"margin-bottom")),Bn(e,"margin-right",Hn(e,"margin-right")),Gn(e,"margin"))}}]}),Aa=So({tags:[{name:no.exact("p",no.caseInsensitive),mutate:ks({attrName:"align",styleName:"text-align",mapValue:p})}]}),Oa=(e,t)=>{return(n=e,qs.getOption(n)).exists((e=>0===t(e).length));var n},Ea=ko({tags:[{name:no.exact("font",no.caseInsensitive),condition:e=>{const t=Ht(e),n=e=>e.replace(/[ \r\n\uFEFF]+/g,"");return 0===t.length||M(t,(e=>Oa(e,n)))}}]}),La=e=>O(Ht(e),(e=>{Oa(e,G)&&vn(e)})),Na=So({tags:[{name:no.exact("ol",no.caseInsensitive),mutate:La},{name:no.exact("ul",no.caseInsensitive),mutate:La}]}),_a=wo({tags:[{name:no.pattern(/^([OVWXP]|U[0-9]+|ST[0-9]+):/i,no.caseInsensitive)}]}),Da=[Co([vs])],Pa=ko({attributes:[{name:no.exact("height",no.caseInsensitive),condition:Ee("table")}]}),Ra=ko({attributes:[{name:no.pattern(/^(width|height)$/,no.caseInsensitive),condition:ws}]}),Ma=So({tags:[{name:no.exact("table",no.caseInsensitive),mutate:ks({attrName:"width",mapValue:e=>e.replace(/^(\d+)$/,"$1px")})}]}),ja=ko({styles:[{name:no.exact("height",no.caseInsensitive),condition:Ee("td")},{name:no.exact("width",no.caseInsensitive),condition:Ee("tr")},{name:no.exact("height",no.caseInsensitive),condition:Ee("col")}]}),Fa=ko({attributes:[{name:no.pattern(/^v:/,no.caseInsensitive)},{name:no.exact("href",no.caseInsensitive),value:no.contains("#_toc",no.caseInsensitive)},{name:no.exact("href",no.caseInsensitive),value:no.contains("#_mso",no.caseInsensitive)},{name:no.pattern(/^xmlns(:|$)/,no.caseInsensitive)},{name:no.exact("type",no.caseInsensitive),condition:e=>"ol"===ke(e)||"ul"===ke(e)}]});wo({tags:[{name:no.exact("p",no.caseInsensitive),condition:("li",e=>Ft(e).exists((e=>"li"===ke(e)&&1===Ht(e).length)))}]}),So({tags:[{name:no.pattern(/^(img|table)$/,no.caseInsensitive),mutate:e=>{$n(e,"margin-left").exists((e=>$(e,"-")))&&Gn(e,"margin-left"),$(Hn(e,"margin-left"),"-")&&(Bn(e,"margin-top",Hn(e,"margin-top")),Bn(e,"margin-bottom",Hn(e,"margin-bottom")),Bn(e,"margin-right",Hn(e,"margin-right")),Gn(e,"margin"))}}]});const Ua=e=>{const t=[Aa,aa,ia],n=[Aa,ra,oa(e.cleanFilteredInlineElements),sa];return e.merge?t:n},Ba=e=>e.type===xs.Word?[gs]:[],za=e=>e.type===xs.Word?[_a,...Da,Fa]:[],Ha=e=>e.type===xs.GoogleDocs?[Ms]:[],Wa=e=>e.type!==xs.GoogleDocs||e.indentUseMargin?[]:[Rs],$a=(e,t)=>e.type===xs.GoogleDocs?[Ws,...Bs,...Fs,zs(t),$s,Vs,...Wa(e)]:[],Va=e=>e.type===xs.Html&&e.merge?[xa]:[],Ga=e=>e.type===xs.Word?[ja,Ma,Ra,Pa]:[];Nt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const qa=(e,t)=>Ya(document.createElement("canvas"),e,t),Ka=e=>{const t=qa(e.width,e.height);return Ja(t).drawImage(e,0,0),t},Ja=e=>e.getContext("2d"),Ya=(e,t,n)=>(e.width=t,e.height=n,e),Xa=e=>e.naturalWidth||e.width,Za=e=>e.naturalHeight||e.height,Qa=e=>fetch(e).then((e=>e.ok?e.blob():Promise.reject(new Error("Error "+e.status+" downloading image"))),(()=>Promise.reject((()=>{const e=new Error("No access to download image");return e.code=18,e.name="SecurityError",e})()))),ei=e=>{const t=e.split(","),n=/data:([^;]+)/.exec(t[0]);if(!n)return k.none();const r=n[1],o=t[1],s=1024,a=atob(o),i=a.length,l=Math.ceil(i/s),c=new Array(l);for(let e=0;enew Promise(((t,n)=>{ei(e).fold((()=>{n("uri is not base64: "+e)}),t)})),ni=(e,t,n)=>(t=t||"image/png",c(HTMLCanvasElement.prototype.toBlob)?new Promise(((r,o)=>{e.toBlob((e=>{e?r(e):o()}),t,n)})):ti(e.toDataURL(t,n))),ri=e=>(e=>{const t=URL.createObjectURL(e),n=new Image;return n.src=t,(e=>new Promise(((t,n)=>{const r=()=>{s(),t(e)},o=[Lr(e,"load",r),Lr(e,"error",(()=>{s(),n("Unable to load data from image: "+e.dom.src)}))],s=()=>O(o,(e=>e.unbind()));e.dom.complete&&r()})))(De.fromDom(n)).then((e=>e.dom))})(e).then((e=>{si(e);const t=qa(Xa(e),Za(e));return Ja(t).drawImage(e,0,0),t})),oi=e=>new Promise((t=>{const n=new FileReader;n.onloadend=()=>{t(n.result)},n.readAsDataURL(e)})),si=e=>{URL.revokeObjectURL(e.src)},ai=(e,t,n)=>{const r=t.type,o=m(r),s=m(n),a=(t,n)=>e.then((e=>((e,t,n)=>(t=t||"image/png",e.toDataURL(t,n)))(e,t,n)));return{getType:o,toBlob:()=>Promise.resolve(t),toDataURL:s,toBase64:()=>n.split(",")[1],toAdjustedBlob:(t,n)=>e.then((e=>ni(e,t,n))),toAdjustedDataURL:a,toAdjustedBase64:(e,t)=>a(e,t).then((e=>e.split(",")[1])),toCanvas:()=>e.then(Ka)}},ii=(e,t)=>ni(e,t).then((t=>ai(Promise.resolve(e),t,e.toDataURL()))),li=(e,t,n)=>{const r=Xa(e),o=Za(e);let s=t/r,a=n/o,i=!1;(s<.5||s>2)&&(s=s<.5?.5:2,i=!0),(a<.5||a>2)&&(a=a<.5?.5:2,i=!0);const l=ci(e,s,a);return i?l.then((e=>li(e,t,n))):l},ci=(e,t,n)=>new Promise((r=>{const o=Xa(e),s=Za(e),a=Math.floor(o*t),i=Math.floor(s*n),l=qa(a,i);Ja(l).drawImage(e,0,0,o,s,0,0,a,i),r(l)})),ui=(e,t=2)=>{const n=Math.pow(10,t),r=Math.round(e*n);return Math.ceil(r/n)},di=(e,t,n,r,o)=>((e,t,n,r,o)=>e.toCanvas().then((s=>((e,t,n,r,o,s)=>{const a=qa(o,s);return Ja(a).drawImage(e,-n,-r),ii(a,t)})(s,e.getType(),t,n,r,o))))(e,t,n,r,o),hi=(e,t)=>((e,t)=>e.toCanvas().then((n=>((e,t,n)=>{const r=(n<0?360+n:n)*Math.PI/180,o=e.width,s=e.height,a=Math.sin(r),i=Math.cos(r),l=ui(Math.abs(o*i)+Math.abs(s*a)),c=ui(Math.abs(o*a)+Math.abs(s*i)),u=qa(l,c),d=Ja(u);return d.translate(l/2,c/2),d.rotate(r),d.drawImage(e,-o/2,-s/2),ii(u,t)})(n,e.getType(),t))))(e,t),mi=(e,t)=>((e,t)=>ai(ri(e),e,t))(e,t),pi=e=>(e=>(e=>{const t=e.src;return 0===t.indexOf("data:")?ti(t):Qa(t)})(e).then((e=>(e=>oi(e).then((t=>ai(ri(e),e,t))))(e))))(e),fi=e=>e.toBlob(),gi=e=>e.toDataURL(),vi=e=>parseInt(e,10),yi=e=>e.isPx&&(e.cropWidth!==e.width||e.cropHeight!==e.height),bi=/rotate\((\d\.\d+)rad\)/,xi=(e,t,n)=>pi(e.dom).then((e=>t=>((e,t,n)=>((e,t,n)=>e.toCanvas().then((r=>li(r,t,n).then((t=>ii(t,e.getType()))))))(e,t,n))(t,e.width,e.height))(t)).then(((e,t)=>n=>{if(yi(t)){const r=-1*vi(Hn(e,"margin-top")),o=-1*vi(Hn(e,"margin-left"));return di(n,o,r,t.cropWidth,t.cropHeight).then((n=>(Cn(e,{width:t.cropWidth,height:t.cropHeight}),n)))}return Promise.resolve(n)})(e,t)).then(((e,t)=>n=>(e=>{const t=Hn(e,"transform");return k.from(bi.exec(t)).map((e=>Math.round(parseFloat(e[1])*(180/Math.PI))))})(t).fold((()=>Promise.resolve(n)),(r=>hi(n,r).then((n=>(Gn(t,"transform"),On(e,"width"),On(e,"height"),n))))))(e,n)).then((t=>{const n=gi(t);return Sn(e,"src",n),Promise.resolve()})),ki=e=>Ft(e).filter(Ee("span")).map((t=>{const n=()=>((e,t)=>{var n,r,o;Gn(e,"margin-top"),Gn(e,"margin-left"),Gn(t,"width"),Gn(t,"height"),Gn(t,"overflow"),Gn(t,"display"),r=e,o=["transform"],Te(n=t)&&Te(r)&&O(o,(e=>{((e,t,n)=>{$n(e,n).each((e=>{$n(t,n).isNone()&&Bn(t,n,e)}))})(n,r,e)})),Gn(t,"transform")})(e,t),r=((e,t)=>{const n=(e,t)=>In(e,t).map(vi).filter((e=>!isNaN(e))).getOr(0),r=Hn(t,"width"),o=Hn(t,"height"),s=n(e,"width"),a=n(e,"height"),i=/^\d+px$/;return{isPx:i.test(r)&&i.test(o),cropWidth:vi(r),cropHeight:vi(o),width:s,height:a}})(e,t);return(yi(r)||bi.test(Hn(t,"transform"))?xi(e,r,t):Promise.resolve()).then(n,n)})).getOrThunk((()=>Promise.resolve()));var wi=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];const Si=(e,t)=>D(e,(e=>e.start===t)),Ci=(e,t,n=0)=>N(e,((e,n)=>t(n,e.len).fold(m(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:n,list:[]}).list,Ti=(e,t,n)=>0===t.length?e:R(e,(e=>{const r=R(t,(t=>((e,t)=>t>=e.start&&t<=e.finish)(e,t)?[t-e.start]:[]));return r.length>0?((e,t,n)=>((e,t)=>A(e,(e=>({...e,start:e.start+t,finish:e.finish+t}))))(n(e,t),e.start))(e,r,n):[e]})),Ii=(e,t)=>{const n=R(t,(t=>{const n=((e,t)=>{const n=t.term(),r=[];let o=n.exec(e);for(;o;){const s=o.index+t.prefix(o),a=o[0].length-t.prefix(o)-t.suffix(o);r.push({start:s,finish:s+a}),n.lastIndex=s+a,o=n.exec(e)}return r})(e,t.pattern);return A(n,(e=>({...t,...e})))}));return(e=>{const t=(e=>F(e,((e,t)=>e.start-t.start)))(e);return N(t,((e,t)=>{const n=I(e,(e=>t.start>=e.start&&t.finish<=e.finish));return D(e,(e=>t.start===e.start)).fold((()=>n?e:[...e,t]),(n=>t.finish>e[n].finish?[...e.slice(0,n),t]:e))}),[])})(n)},Ai=(e,t,n)=>({element:e,start:t,finish:n}),Oi=Nt([{include:["item"]},{excludeWith:["item"]},{excludeWithout:["item"]}]),Ei={include:Oi.include,excludeWith:Oi.excludeWith,excludeWithout:Oi.excludeWithout,cata:(e,t,n,r)=>e.fold(t,n,r)},Li=Nt([{boundary:["item","universe"]},{empty:["item","universe"]},{text:["item","universe"]},{nonEditable:["item","universe"]}]),Ni=b,_i=x,Di=m(0),Pi=m(1),Ri=e=>({...e,isBoundary:()=>e.fold(_i,Ni,Ni,Ni),toText:()=>e.fold(k.none,k.none,(e=>k.some(e)),k.none),is:t=>e.fold(Ni,Ni,((e,n)=>n.eq(e,t)),Ni),len:()=>e.fold(Di,Pi,((e,t)=>t.property().getText(e).length),Pi)}),Mi={text:h(Ri,Li.text),boundary:h(Ri,Li.boundary),empty:h(Ri,Li.empty),nonEditable:h(Ri,Li.empty),cata:(e,t,n,r,o)=>e.fold(t,n,r,o)},ji=m([]),Fi=(e,t,n)=>{if(e.property().isText(t))return[Mi.text(t,e)];if(e.property().isEmptyTag(t))return[Mi.empty(t,e)];if(e.property().isNonEditable(t))return[];if(e.property().isElement(t)){const r=e.property().children(t),o=e.property().isBoundary(t)?[Mi.boundary(t,e)]:[],s=void 0!==n&&n(t)?[]:R(r,(t=>Fi(e,t,n)));return o.concat(s).concat(o)}return[]},Ui=Fi,Bi=(e,t,n)=>{const r=((e,t)=>{const n=[];let r=[];return O(e,(e=>{const o=t(e);Ei.cata(o,(()=>{r.push(e)}),(()=>{r.length>0&&n.push(r),n.push([e]),r=[]}),(()=>{r.length>0&&n.push(r),r=[]}))})),r.length>0&&n.push(r),n})(R(t,(t=>Ui(e,t,n))),(e=>e.match({boundary:()=>Ei.excludeWithout(e),empty:()=>Ei.excludeWith(e),text:()=>Ei.include(e),nonEditable:()=>Ei.excludeWithout(e)})));return L(r,(e=>e.length>0))},zi=(e,t,n)=>{const r=R(n,(e=>[e.start,e.finish])),o=Ti(t,r,((t,n)=>((e,t,n)=>{const r=e.property().getText(t),o=L(((e,t)=>{if(0===t.length)return[e];const n=N(t,((t,n)=>{if(0===n)return t;const r=e.substring(t.prev,n);return{prev:n,values:t.values.concat([r])}}),{prev:0,values:[]}),r=t[t.length-1];return re.length>0));if(o.length<=1)return[Ai(t,0,r.length)];e.property().setText(t,o[0]);const s=Ci(o.slice(1),((t,n)=>{const r=e.create().text(t),o=Ai(r,n,n+t.length);return k.some(o)}),o[0].length),a=A(s,(e=>e.element));return e.insert().afterAll(t,a),[Ai(t,0,o[0].length)].concat(s)})(e,t.element,n)));return A(n,(t=>{const n=((e,t,n)=>{const r=Si(e,t),o=Si(e,n);return r.bind((t=>{const r=o.getOr(((e,t)=>e[e.length-1]&&e[e.length-1].finish===t?e.length+1:-1)(e,n));return r>-1?k.some(e.slice(t,r)):k.none()})).getOr([])})(o,t.start,t.finish),r=A(n,(e=>e.element)),s=A(r,e.property().getText).join("");return{elements:r,word:t.word,exact:s}}))},Hi={up:m({selector:Qn,closest:er,predicate:Yn,all:(e,t)=>{const n=c(t)?t:b;let r=e.dom;const o=[];for(;null!==r.parentNode&&void 0!==r.parentNode;){const e=r.parentNode,t=De.fromDom(e);if(o.push(t),!0===n(t))break;r=e}return o}}),down:m({selector:Jt,predicate:Kt}),styles:m({get:Hn,getRaw:$n,set:Bn,remove:Gn}),attrs:m({get:Tn,set:Sn,remove:On,copyTo:(e,t)=>{const n=N(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{});Cn(t,n)}}),insert:m({before:cn,after:un,afterAll:pn,append:hn,appendAll:fn,prepend:dn,wrap:mn}),remove:m({unwrap:yn,remove:vn}),create:m({nu:De.fromTag,clone:e=>De.fromDom(e.dom.cloneNode(!1)),text:De.fromText}),query:m({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:Ut,nextSibling:Bt}),property:m({children:Ht,name:ke,parent:Ft,document:e=>Mt(e).dom,isText:Ie,isComment:Ce,isElement:Te,isSpecial:e=>{const t=ke(e);return T(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>Te(e)?In(e,"lang"):k.none(),getText:Ks,setText:(e,t)=>qs.set(e,t),isBoundary:e=>!!Te(e)&&("body"===ke(e)||T(wi,ke(e))),isEmptyTag:e=>!!Te(e)&&T(["br","img","hr","input"],ke(e)),isNonEditable:e=>Te(e)&&"false"===Tn(e,"contenteditable")}),eq:At,is:Ot},Wi=/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source,$i=e=>{return((e,t,n)=>((e,t,n,r)=>{const o=Bi(e,t,r),s=R(o,(t=>{const r=R(t,(e=>e.fold(ji,ji,(e=>[e]),ji))),o=A(r,e.property().getText).join(""),s=Ii(o,n),a=((e,t)=>Ci(t,((t,n)=>{const r=n+e.property().getText(t).length;return k.from(Ai(t,n,r))})))(e,r);return zi(e,a,s)}));return s})(Hi,e,t,void 0))(e,[{word:"__INTERNAL__",pattern:(t=Wi,((e,t,n,r)=>({term:()=>new RegExp(e,r.getOr("g")),prefix:t,suffix:n}))(t,m(0),m(0),k.none()))}]);var t},Vi=e=>!er(e,"a",undefined).isSome(),Gi=(e,t)=>{const n=$i(e);O(n,(e=>{const n=e.exact;if(n.indexOf("@")<0||qi(n)){const r=W(n,"://")?n:`${t.defaultProtocol}://${n}`;((e,t)=>{k.from(e[0]).filter(Vi).map((n=>{const r=De.fromTag("a");return cn(n,r),fn(r,e),Sn(r,"href",t),r}))})(e.elements,r)}}))},qi=e=>{const t=e.indexOf("://");return t>=3&&t<=9},Ki=(e,t)=>{O(e,(e=>{Te(e)&&$n(e,"position").isSome()&&Gn(e,"position")}))},Ji=(e,t)=>{const n=L(e,Ee("li"));if(n.length>0){const t=zt(n[0]),r=De.fromTag("ul");if(cn(e[0],r),t.length>0){const e=De.fromTag("li");hn(r,e),fn(e,t)}fn(r,n)}},Yi=(e,t)=>{const n=Ht(e);O([Gi,Ki,Ji],(e=>{e(n,t)}))},Xi={disabled:()=>({discriminator:"disabled",data:{}}),fromClipboard:e=>({discriminator:"fromClipboard",data:{rtf:e}})},Zi=Pe(Xi),Qi=Xi.disabled,el=Xi.fromClipboard,tl=e=>void 0!==e&&void 0!==e.types&&null!==e.types,nl=(e,t)=>{const n=new RegExp(t,"i");return B(e,(e=>Mn(null!==n.exec(e),{type:e,flavor:t})))};function rl(e){return rl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rl(e)}function ol(e,t){return ol=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ol(e,t)}function sl(e,t,n){return sl=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&ol(o,n.prototype),o},sl.apply(null,arguments)}function al(e){return function(e){if(Array.isArray(e))return il(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return il(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?il(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function il(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?n-1:0),o=1;o/gm),Kl=pl(/\${[\w\W]*}/gm),Jl=pl(/^data-[\-\w.\u00B7-\uFFFF]/),Yl=pl(/^aria-[\-\w]+$/),Xl=pl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zl=pl(/^(?:\w+script|data):/i),Ql=pl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ec=pl(/^html$/i),tc=function(){return"undefined"==typeof window?null:window},nc=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tc(),n=function(t){return e(t)};if(n.version="2.4.7",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,s=t.DocumentFragment,a=t.HTMLTemplateElement,i=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,d=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,h=t.HTMLFormElement,m=t.DOMParser,p=t.trustedTypes,f=l.prototype,g=Pl(f,"cloneNode"),v=Pl(f,"nextSibling"),y=Pl(f,"childNodes"),b=Pl(f,"parentNode");if("function"==typeof a){var x=o.createElement("template");x.content&&x.content.ownerDocument&&(o=x.content.ownerDocument)}var k=function(e,t){if("object"!==rl(e)||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(p,r),w=k?k.createHTML(""):"",S=o,C=S.implementation,T=S.createNodeIterator,I=S.createDocumentFragment,A=S.getElementsByTagName,O=r.importNode,E={};try{E=Dl(o).documentMode?o.documentMode:{}}catch(e){}var L={};n.isSupported="function"==typeof b&&C&&void 0!==C.createHTMLDocument&&9!==E;var N,_,D=Gl,P=ql,R=Kl,M=Jl,j=Yl,F=Zl,U=Ql,B=Xl,z=null,H=_l({},[].concat(al(Rl),al(Ml),al(jl),al(Ul),al(zl))),W=null,$=_l({},[].concat(al(Hl),al(Wl),al($l),al(Vl))),V=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),G=null,q=null,K=!0,J=!0,Y=!1,X=!0,Z=!1,Q=!1,ee=!1,te=!1,ne=!1,re=!1,oe=!1,se=!0,ae=!1,ie=!0,le=!1,ce={},ue=null,de=_l({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),he=null,me=_l({},["audio","video","img","source","image","track"]),pe=null,fe=_l({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",ve="http://www.w3.org/2000/svg",ye="http://www.w3.org/1999/xhtml",be=ye,xe=!1,ke=null,we=_l({},[ge,ve,ye],Cl),Se=["application/xhtml+xml","text/html"],Ce=null,Te=o.createElement("form"),Ie=function(e){return e instanceof RegExp||e instanceof Function},Ae=function(e){Ce&&Ce===e||(e&&"object"===rl(e)||(e={}),e=Dl(e),N=N=-1===Se.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,_="application/xhtml+xml"===N?Cl:Sl,z="ALLOWED_TAGS"in e?_l({},e.ALLOWED_TAGS,_):H,W="ALLOWED_ATTR"in e?_l({},e.ALLOWED_ATTR,_):$,ke="ALLOWED_NAMESPACES"in e?_l({},e.ALLOWED_NAMESPACES,Cl):we,pe="ADD_URI_SAFE_ATTR"in e?_l(Dl(fe),e.ADD_URI_SAFE_ATTR,_):fe,he="ADD_DATA_URI_TAGS"in e?_l(Dl(me),e.ADD_DATA_URI_TAGS,_):me,ue="FORBID_CONTENTS"in e?_l({},e.FORBID_CONTENTS,_):de,G="FORBID_TAGS"in e?_l({},e.FORBID_TAGS,_):{},q="FORBID_ATTR"in e?_l({},e.FORBID_ATTR,_):{},ce="USE_PROFILES"in e&&e.USE_PROFILES,K=!1!==e.ALLOW_ARIA_ATTR,J=!1!==e.ALLOW_DATA_ATTR,Y=e.ALLOW_UNKNOWN_PROTOCOLS||!1,X=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Z=e.SAFE_FOR_TEMPLATES||!1,Q=e.WHOLE_DOCUMENT||!1,ne=e.RETURN_DOM||!1,re=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,te=e.FORCE_BODY||!1,se=!1!==e.SANITIZE_DOM,ae=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,le=e.IN_PLACE||!1,B=e.ALLOWED_URI_REGEXP||B,be=e.NAMESPACE||ye,V=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ie(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ie(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(V.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Z&&(J=!1),re&&(ne=!0),ce&&(z=_l({},al(zl)),W=[],!0===ce.html&&(_l(z,Rl),_l(W,Hl)),!0===ce.svg&&(_l(z,Ml),_l(W,Wl),_l(W,Vl)),!0===ce.svgFilters&&(_l(z,jl),_l(W,Wl),_l(W,Vl)),!0===ce.mathMl&&(_l(z,Ul),_l(W,$l),_l(W,Vl))),e.ADD_TAGS&&(z===H&&(z=Dl(z)),_l(z,e.ADD_TAGS,_)),e.ADD_ATTR&&(W===$&&(W=Dl(W)),_l(W,e.ADD_ATTR,_)),e.ADD_URI_SAFE_ATTR&&_l(pe,e.ADD_URI_SAFE_ATTR,_),e.FORBID_CONTENTS&&(ue===de&&(ue=Dl(ue)),_l(ue,e.FORBID_CONTENTS,_)),ie&&(z["#text"]=!0),Q&&_l(z,["html","head","body"]),z.table&&(_l(z,["tbody"]),delete G.tbody),ml&&ml(e),Ce=e)},Oe=_l({},["mi","mo","mn","ms","mtext"]),Ee=_l({},["foreignobject","desc","title","annotation-xml"]),Le=_l({},["title","style","font","a","script"]),Ne=_l({},Ml);_l(Ne,jl),_l(Ne,Fl);var _e=_l({},Ul);_l(_e,Bl);var De=function(e){wl(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=w}catch(t){e.remove()}}},Pe=function(e,t){try{wl(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){wl(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!W[e])if(ne||re)try{De(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){var t,n;if(te)e=""+e;else{var r=Tl(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===N&&be===ye&&(e=''+e+"");var s=k?k.createHTML(e):e;if(be===ye)try{t=(new m).parseFromString(s,N)}catch(e){}if(!t||!t.documentElement){t=C.createDocument(be,"template",null);try{t.documentElement.innerHTML=xe?w:s}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),be===ye?A.call(t,Q?"html":"body")[0]:Q?t.documentElement:a},Me=function(e){return T.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},je=function(e){return"object"===rl(i)?e instanceof i:e&&"object"===rl(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Fe=function(e,t,r){L[e]&&xl(L[e],(function(e){e.call(n,t,r,Ce)}))},Ue=function(e){var t,r;if(Fe("beforeSanitizeElements",e,null),(r=e)instanceof h&&("string"!=typeof r.nodeName||"string"!=typeof r.textContent||"function"!=typeof r.removeChild||!(r.attributes instanceof d)||"function"!=typeof r.removeAttribute||"function"!=typeof r.setAttribute||"string"!=typeof r.namespaceURI||"function"!=typeof r.insertBefore||"function"!=typeof r.hasChildNodes))return De(e),!0;if(El(/[\u0080-\uFFFF]/,e.nodeName))return De(e),!0;var o=_(e.nodeName);if(Fe("uponSanitizeElement",e,{tagName:o,allowedTags:z}),e.hasChildNodes()&&!je(e.firstElementChild)&&(!je(e.content)||!je(e.content.firstElementChild))&&El(/<[/\w]/g,e.innerHTML)&&El(/<[/\w]/g,e.textContent))return De(e),!0;if("select"===o&&El(/