26 lines
94 KiB
JavaScript

/*!
* Tiny Revision History plugin
*
* Copyright (c) 2024 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
* Version: 8.3.0-112
*/
/*!
* This resource uses the code from the following libraries:
*
* visual-dom-diff
* https://github.com/Teamwork/visual-dom-diff
*
* preact
* Copyright (c) 2015-present Jason Miller
* https://github.com/preactjs/preact
*
* diff-match-patch
* Copyright 2018 The diff-match-patch Authors.
* https://github.com/google/diff-match-patch
*
*/
!function(){"use strict";var e=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},t=function(e){return{eq:e}},n=t((function(e,t){return e===t})),r=n,o=function(e){return t((function(t,n){if(t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e.eq(t[o],n[o]))return!1;return!0}))},i=t((function(n,s){if(n===s)return!0;var a,l=e(n);return l===e(s)&&(function(e){return-1!==["undefined","boolean","number","string","function","xml","null"].indexOf(e)}(l)?n===s:"array"===l?o(i).eq(n,s):"object"===l&&(a=i,t((function(e,n){var i=Object.keys(e),s=Object.keys(n);if(!function(e,n){return function(e,n){return t((function(t,r){return e.eq(n(t),n(r))}))}(o(e),(function(e){return function(e,t){return Array.prototype.slice.call(e).sort(t)}(e,n)}))}(r).eq(i,s))return!1;for(var l=i.length,c=0;c<l;c++){var u=i[c];if(!a.eq(e[u],n[u]))return!1}return!0}))).eq(n,s))}));const s=Object.getPrototypeOf,a=(e,t,n)=>!!n(e,t.prototype)||e.constructor?.name===t.name,l=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&a(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,c=e=>t=>typeof t===e,u=l("string"),h=l("object"),f=e=>((e,t)=>h(e)&&a(e,t,((e,t)=>s(e)===t)))(e,Object),d=c("boolean"),g=e=>void 0===e,_=e=>null==e,p=e=>!_(e),m=c("function"),v=c("number"),y=()=>{},b=e=>()=>e,w=e=>e,x=(e,t)=>e===t,C=e=>e(),S=b(!1),k=b(!0);class M{tag;value;static singletonNone=new M(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new M(!0,e)}static none(){return M.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?M.some(e(this.value)):M.none()}bind(e){return this.tag?e(this.value):M.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:M.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(e??"Called getOrDie on None")}static from(e){return p(e)?M.some(e):M.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()"}}const E=Array.prototype.slice,A=Array.prototype.indexOf,N=(e,t)=>((e,t)=>A.call(e,t))(e,t)>-1,R=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1},T=(e,t)=>{const n=e.length,r=new Array(n);for(let o=0;o<n;o++){const n=e[o];r[o]=t(n,o)}return r},D=(e,t)=>{for(let n=0,r=e.length;n<r;n++)t(e[n],n)},O=(e,t)=>{const n=[],r=[];for(let o=0,i=e.length;o<i;o++){const i=e[o];(t(i,o)?n:r).push(i)}return{pass:n,fail:r}},P=(e,t)=>{const n=[];for(let r=0,o=e.length;r<o;r++){const o=e[r];t(o,r)&&n.push(o)}return n},I=(e,t,n)=>(D(e,((e,r)=>{n=t(n,e,r)})),n),L=(e,t)=>((e,t,n)=>{for(let r=0,o=e.length;r<o;r++){const o=e[r];if(t(o,r))return M.some(o);if(n(o,r))break}return M.none()})(e,t,S),$=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(t(e[n],n))return M.some(n);return M.none()},j=(e,t)=>{for(let n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n))return!1;return!0},U=(e,t,n=i)=>o(n).eq(e,t),H=e=>{const t=E.call(e,0);return t.reverse(),t},B=(e,t)=>t>=0&&t<e.length?M.some(e[t]):M.none(),F=e=>B(e,0),V=e=>B(e,e.length-1),q=m(Array.from)?Array.from:e=>E.call(e),z=Object.keys,K=Object.hasOwnProperty,W=(e,t)=>{const n=z(e);for(let r=0,o=n.length;r<o;r++){const o=n[r];t(e[o],o)}},G=(e,t)=>Q(e,((e,n)=>({k:n,v:t(e,n)}))),Q=(e,t)=>{const n={};return W(e,((e,r)=>{const o=t(e,r);n[o.k]=o.v})),n},J=(e,t)=>{const n=[];return W(e,((e,r)=>{n.push(t(e,r))})),n},X=(e,t)=>Y(e,t)?M.from(e[t]):M.none(),Y=(e,t)=>K.call(e,t),Z=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},ee=e=>{const t=t=>t(e),n=b(e),r=()=>o,o={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:k,isError:S,map:t=>ne.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:()=>M.some(e)};return o},te=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:S,isError:k,map:t,mapError:t=>ne.error(t(e)),bind:t,exists:S,forall:k,getOr:w,or:w,getOrThunk:C,orThunk:C,getOrDie:(r=String(e),()=>{throw new Error(r)}),each:y,toOptional:M.none};var r;return n},ne={value:ee,error:te,fromOption:(e,t)=>e.fold((()=>te(t)),ee)};let re=0;const oe=e=>{const t=(new Date).getTime(),n=Math.floor(window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295*1e9);return re++,e+"_"+n+re+String(t)},ie=(se=(e,t)=>f(e)&&f(t)?ie(e,t):t,(...e)=>{if(0===e.length)throw new Error("Can't merge zero objects");const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)Y(r,e)&&(t[e]=se(t[e],r[e]))}return t});var se;const ae=(e,t)=>e?M.some(t):M.none(),le=e=>{const t=Z(M.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(M.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(M.some(e))}}},ce=(e,t,n=0,r)=>{const o=e.indexOf(t,n);return-1!==o&&(!!g(r)||o+t.length<=r)},ue=e=>e.length>0,he=(e,t)=>{const{type:n,message:r}=t;e.notificationManager.open({type:n,text:r})},fe=e=>{(e=>{switch(e){case"error":return console.error;case"info":return console.info;case"warn":return console.warn;default:return console.log}})(e.type)(e.message)},de=(e,t)=>{const{protect:n,allowList:r=[],blockList:o=[]}=null!=e?e:{};let i;return i=p(n)?n:r.length>0||o.length>0||t,{protect:i,allowList:r,blockList:o}},ge=e=>{const{protect:t,allowList:n,blockList:r}=null!=e?e:{};return e=>{const o=e.toLowerCase();return n.length>0?!R(n,(e=>e.toLowerCase()===o)):r.length>0?R(r,(e=>e.toLowerCase()===o)):t}},_e=e=>{const t=ge(e);return(e,n)=>{const r=((e,t)=>`${e}:${t}`)(n,e.toLowerCase());return t(r)}},pe=(e,t,n,r)=>{const o=Reflect.get(e,"on"),i={protectedEventHandlers:[],cleanupScheduled:!1},s=(e,t)=>{r&&console.log(`[EventsProxy] ${e}`,t||"")},a=t=>{"invalid"===t&&i.protectedEventHandlers.length>0&&(s("Removing event handlers",i.protectedEventHandlers),D(i.protectedEventHandlers,(t=>{e.off(t.name,t.callback)})),i.protectedEventHandlers=[])},l=t.onStatusChange(a);return e.on("remove",l),(r,l,c)=>{s(`Adding event listener: ${r}`,{shouldProtect:n(r)});const u=((e,r)=>{const o=n(e),s=t.getStatus(),a=o&&"invalid"===s?y:r;return o&&i.protectedEventHandlers.push({name:e,callback:a}),a})(r,l);return i.cleanupScheduled||(i.cleanupScheduled=!0,window.setTimeout((()=>{a(t.getStatus()),i.cleanupScheduled=!1}),0)),Reflect.apply(o,e,[r,u,c])}},me=(e,t,n)=>r=>{const o="invalid"!==t.getStatus()&&p(n)?n(r):y,i=((e,t,n)=>{const r=e=>{"invalid"===e&&n.setEnabled(!1)},o=()=>r(t.getStatus());r(t.getStatus()),e.on("NodeChange",o);const i=t.onStatusChange(r);return()=>{e.off("NodeChange",o),i()}})(e,t,r);return e=>{null==o||o(e),i()}},ve=(e,t,n)=>(...r)=>{var o;return"invalid"===e.getStatus()?n:null!==(o=null==t?void 0:t(...r))&&void 0!==o?o:n},ye=(e,t)=>ve(e,t,Promise.resolve([])),be=(e,t)=>ve(e,t,[]),we=(e,t)=>ve(e,t,!1),xe=(e,t,n,r)=>{const o=t=>{const{command:o,value:i}=t,s=M.from(i).filter(u).map((e=>e.toLowerCase())),a=o.toLowerCase()===r.toLowerCase(),l=s.exists((e=>n.has(e))),c=s.exists((t=>t===e.queryCommandValue(r)));a&&l&&!c&&t.preventDefault()},i=t.onStatusChange((t=>{if("invalid"===t){e.on("BeforeExecCommand",o);const t=()=>{const t=e.queryCommandValue(r);n.has(t.toLowerCase())&&e.execCommand(r,!1,t)};e.initialized?t():e.on("init",t)}}));e.on("remove",(()=>{i(),e.off("BeforeExecCommand",o)}))},Ce=(e,t,n,r,o,i=!1)=>{const s=new Set,a=new Set,l=(e,t)=>{i&&console.log(`[UiProxy] ${e}`,t||"")};((e,t,n)=>{xe(e,t,n,"ToggleView")})(e,n,s),((e,t,n)=>{xe(e,t,n,"ToggleSidebar")})(e,n,a);const c=(t,i,s,a)=>{const c=o(t,s);return l(`${a}: ${t}`,{spec:i,context:r,shouldProtect:c}),c?{...i,onSetup:me(e,n,i.onSetup)}:i};return new Proxy(t,{get:(e,t,i)=>{const h=Reflect.get(e,t,i);if(!u(t))return h;switch(t){case"addButton":case"addGroupToolbarButton":case"addToggleButton":case"addMenuButton":case"addSplitButton":return(...n)=>{const[r,o,...i]=n,s=c(r,o,"button",String(t));return Reflect.apply(h,e,[r,s,...i])};case"addMenuItem":case"addToggleMenuItem":case"addNestedMenuItem":return(...n)=>{const[r,o,...i]=n,s=c(r,o,"menuitem",String(t));return Reflect.apply(h,e,[r,s,...i])};case"addAutocompleter":return(...i)=>{const[s,a,...c]=i,u=o(s,"autocompleter");if(l(`${String(t)}: ${s}`,{spec:a,context:r,shouldProtect:u}),u){const t={...a,fetch:ye(n,a.fetch)};return Reflect.apply(h,e,[s,t,...c])}return Reflect.apply(h,e,[s,a,...c])};case"addSidebar":return(...n)=>{const[i,s,...c]=n,u=o(i,"sidebar");if(l(`${String(t)}: ${i}`,{spec:s,context:r,shouldProtect:u}),u){a.add(i.toLowerCase());const t={...s};return Reflect.apply(h,e,[i,t,...c])}return Reflect.apply(h,e,[i,s,...c])};case"addView":return(...n)=>{const[i,a,...c]=n,u=o(i,"view");if(l(`${String(t)}: ${i}`,{spec:a,context:r,shouldProtect:u}),u){s.add(i.toLowerCase());const t={...a};return Reflect.apply(h,e,[i,t,...c])}return Reflect.apply(h,e,[i,a,...c])};case"addContextMenu":return(...i)=>{const[s,a,...c]=i,u=o(s,"contextmenu");if(l(`${String(t)}: ${s}`,{spec:a,context:r,shouldProtect:u}),u){const t={...a,update:be(n,a.update)};return Reflect.apply(h,e,[s,t,...c])}return Reflect.apply(h,e,[s,a,...c])};case"addContextToolbar":case"addContextForm":return(...i)=>{const[s,a,...c]=i,u=o(s,"contexttoolbar");if(l(`${String(t)}: ${s}`,{spec:a,context:r,shouldProtect:u}),u){const t={...a,predicate:we(n,a.predicate)};return Reflect.apply(h,e,[s,t,...c])}return Reflect.apply(h,e,[s,a,...c])};case"addIcon":case"getAll":case"addContext":return h}}})},Se=new Set(["addCommand","addCommands","addQueryStateHandler","addQueryValueHandler"]),ke=e=>(t,n)=>{e&&console.log(`[EditorProxy] ${t}`,n||"")},Me=(e,t)=>{const{statusProvider:n,uiContext:r,protection:o,debug:i=!1}=t,{events:s,commands:a,ui:l}=o;ke(i)("Creating enhanced editor with options:",{hasStatusProvider:!!n,uiContext:r,debug:i,protection:o});const{editorUiProxy:c,editorCommandsProxy:u,editorEventListenerProxy:h}=((e,t,n,r,o,i,s)=>{const a=i.protect?{...e.ui,registry:Ce(e,e.ui.registry,t,n,_e(i),s)}:e.ui,l=r.protect?((e,t,n,r,o)=>{const i={protectedCommands:[],cleanupScheduled:!1},s=(e,t)=>{o&&console.log(`[CommandsProxy] ${e}`,t||"")},a=(e,t)=>{const o=r(e),s=n.getStatus();return o&&i.protectedCommands.push(e),o&&"invalid"===s?y:t},l=t=>{"invalid"===t&&i.protectedCommands.length>0&&(s("Removing commands",i.protectedCommands),D(i.protectedCommands,(t=>{e.editorCommands.removeCommand(t)})),i.protectedCommands=[])},c=()=>{i.cleanupScheduled||(i.cleanupScheduled=!0,window.setTimeout((()=>{l(n.getStatus()),i.cleanupScheduled=!1}),0))},u=n.onStatusChange(l);return e.on("remove",u),new Proxy(t,{get:(e,n,o)=>{if(s(`Accessing property: ${String(n)}`),"addCommand"===n){const i=Reflect.get(e,n,o);return(e,n,...o)=>{s(`Adding command: ${e}`,{shouldProtect:r(e)});const l=a(e,n);return c(),Reflect.apply(i,t,[e,l,...o])}}if("addCommands"===n){const r=Reflect.get(e,n,o);return(e,n="exec")=>{s(`Adding commands (${n})`,{commandCount:Object.keys(e).length,willApplyEnforcement:"exec"===n});const o="exec"!==n?e:G(e,((e,t)=>a(t,e)));return c(),Reflect.apply(r,t,[o,n])}}return Reflect.get(e,n,o)}})})(e,e.editorCommands,t,ge(r),s):e.editorCommands;return{editorUiProxy:a,editorCommandsProxy:l,editorEventListenerProxy:o.protect?pe(e,t,ge(o),s):e.on.bind(e)}})(e,n,r||"",a,s,l,i),f=((e,t,n,r)=>(o,i,s)=>{const a=String(i);if("on"===i)return ke(r)("on intercepted"),n;if(Se.has(a))return ke(r)(`${a} intercepted`),t[a].bind(t);if("editorCommands"===i)return ke(r)("editorCommands accessed"),t;if("ui"===i)return ke(r)("ui accessed"),e;const l=Reflect.get(o,i,s);return m(l)?l.bind(o):l})(c,u,h,i);return new Proxy(e,{get:f,set:(e,t,n,r)=>Reflect.set(e,t,n,r),has:(e,t)=>Reflect.has(e,t),ownKeys:e=>Reflect.ownKeys(e),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e,t),defineProperty:(e,t,n)=>Reflect.defineProperty(e,t,n),deleteProperty:(e,t)=>Reflect.deleteProperty(e,t),isExtensible:e=>Reflect.isExtensible(e),preventExtensions:e=>Reflect.preventExtensions(e),getPrototypeOf:e=>Reflect.getPrototypeOf(e),setPrototypeOf:(e,t)=>Reflect.setPrototypeOf(e,t)})},Ee=e=>parseInt(e,10),Ae=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},Ne=(e,t,n)=>({major:e,minor:t,patch:n}),Re=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?Ne(Ee(t[1]),Ee(t[2]),Ee(t[3])):Ne(0,0,0)},Te=(e,t)=>!!e&&-1===((e,t)=>{const n=Ae(e.major,t.major);if(0!==n)return n;const r=Ae(e.minor,t.minor);if(0!==r)return r;const o=Ae(e.patch,t.patch);return 0!==o?o:0})((e=>Re((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),Re(t)),De=Re("8.3.0"),Oe=`${De.major}.${De.minor}.0`,Pe=`${De.major+1}.0.0`,Ie=(e,t)=>{const{setup:n,protection:r}=t;return(o,i)=>{if(!((e,t)=>Te(e,Oe)?(console.error(`The "${t}" plugin requires at least version ${Oe} of TinyMCE.`),!1):!!Te(e,Pe)||(console.error(`The "${t}" plugin requires at least version ${Oe} of TinyMCE but less than ${Pe}.`),!1))(tinymce,e)||((e,t)=>!!(e=>{var t;const n=null===(t=e.options.get("license_key"))||void 0===t?void 0:t.toLowerCase(),r=e.options.get("online_license_key");return _(r)&&"gpl"===n})(e)&&(((e,t)=>{const{console:n,editor:r}=t;p(r)&&(e._skinLoaded?he(e,r):e.on("SkinLoaded",(()=>{he(e,r)}))),p(n)&&fe(n)})(e,{console:{type:"error",message:[`The "${t}" plugin requires a valid TinyMCE license key.`,"Read more: https://www.tiny.cloud/docs/tinymce/latest/license-key/"].join(" ")}}),!0))(o,e))return{};const s=(e=>{const{protect:t=!0,events:n,commands:r,ui:o,api:i}=null!=e?e:{};return{protect:t,events:de(n,false),commands:de(r,true),ui:de(o,true),api:de(i,true)}})(r),a=((e="pre-validation")=>{const t=Z(e),n=new Set;let r=!1;const{enableLogging:o=!1}={},i=(e,...t)=>{o&&console.log(`[StatusProvider] ${e}`,...t)};return{setStatus:e=>{const r=t.get();if(r===e)return i("Status unchanged:",e),!1;t.set(e),i("Status changed:",r,"->",e);const o={currentStatus:e,previousStatus:r},s=Array.from(n);return D(s,(e=>{e(o.currentStatus,o.previousStatus)})),!0},onStatusChange:e=>(n.add(e),i("Callback registered, total listeners:",n.size),()=>{n.delete(e)&&i("Callback unregistered, remaining listeners:",n.size)}),getStatus:t.get,hasListeners:()=>n.size>0,destroy:()=>{r||(i("Destroying StatusProvider, clearing",n.size,"listeners"),n.clear(),r=!0)}}})(),l=((e,t,n)=>{const r=`commercial-license-${t}`;return e.ui.registry.addContext(r,(()=>"invalid"!==n.getStatus()&&!e.mode.isReadOnly())),e.licenseKeyManager.validate({plugin:t}).then((e=>{n.setStatus(e?"valid":"invalid")}),(e=>{console.error(e),console.error(`An unknown error occurred when trying to validate "${t}" plugin.`),n.setStatus("invalid")})),{ui:{context:r}}})(o,e,a),c=s.protect?Me(o,{statusProvider:a,uiContext:l.ui.context,debug:t.debug||!1,protection:s}):o,u=((e,t)=>({pluginCode:e,enforcer:{isInvalid:()=>"invalid"===t.getStatus(),onInvalid:e=>t.onStatusChange(((t,n)=>{"invalid"===t&&e(t,n)}))}}))(e,a);return((e,t,n,r)=>{if(t.protect&&t.api.protect&&p(e)){const i=ge(t.api);return(o=e=>"invalid"===n.getStatus()&&i(e),(e,t)=>G(e,((e,n)=>m(e)?(...r)=>{if(o(n.toLowerCase())){const e=`Method "${p(t)?`${t}.`:""}${n}" is not available due to license key restrictions.`,r=new Error(e);throw console.error(e),r}return e(...r)}:e)))(e,r)}var o;return e})(n(c,i,u),s,a,e)}},Le=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},$e=(e,t)=>{const n=(t||document).createElement(e);return Le(n)},je=Le,Ue=(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")}},He=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Be=(e,t)=>e.dom===t.dom,Fe=()=>Ve(0,0),Ve=(e,t)=>({major:e,minor:t}),qe={nu:Ve,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?Fe():((e,t)=>{const n=((e,t)=>{for(let n=0;n<e.length;n++){const r=e[n];if(r.test(t))return r}})(e,t);if(!n)return{major:0,minor:0};const r=e=>Number(t.replace(n,"$"+e));return Ve(r(1),r(2))})(e,n)},unknown:Fe},ze=(e,t)=>{const n=String(t).toLowerCase();return L(e,(e=>e.search(n)))},Ke=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,We=e=>t=>ce(t,e),Ge=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>ce(e,"edge/")&&ce(e,"chrome")&&ce(e,"safari")&&ce(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ke],search:e=>ce(e,"chrome")&&!ce(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>ce(e,"msie")||ce(e,"trident")},{name:"Opera",versionRegexes:[Ke,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:We("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:We("firefox")},{name:"Safari",versionRegexes:[Ke,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(ce(e,"safari")||ce(e,"mobile/"))&&ce(e,"applewebkit")}],Qe=[{name:"Windows",search:We("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>ce(e,"iphone")||ce(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:We("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:We("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:We("linux"),versionRegexes:[]},{name:"Solaris",search:We("sunos"),versionRegexes:[]},{name:"FreeBSD",search:We("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:We("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Je={browsers:b(Ge),oses:b(Qe)},Xe=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isEdge:r("Edge"),isChromium:r("Chromium"),isIE:r("IE"),isOpera:r("Opera"),isFirefox:r("Firefox"),isSafari:r("Safari")}},Ye=()=>Xe({current:void 0,version:qe.unknown()}),Ze=Xe,et=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isWindows:r("Windows"),isiOS:r("iOS"),isAndroid:r("Android"),isMacOS:r("macOS"),isLinux:r("Linux"),isSolaris:r("Solaris"),isFreeBSD:r("FreeBSD"),isChromeOS:r("ChromeOS")}},tt=()=>et({current:void 0,version:qe.unknown()}),nt=et,rt=(e,t,n)=>{const r=Je.browsers(),o=Je.oses(),i=t.bind((e=>((e,t)=>((e,t)=>{for(let n=0;n<e.length;n++){const r=t(e[n]);if(r.isSome())return r}return M.none()})(t.brands,(t=>{const n=t.brand.toLowerCase();return L(e,(e=>n===e.brand?.toLowerCase())).map((e=>({current:e.name,version:qe.nu(parseInt(t.version,10),0)})))})))(r,e))).orThunk((()=>((e,t)=>ze(e,t).map((e=>{const n=qe.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e))).fold(Ye,Ze),s=((e,t)=>ze(e,t).map((e=>{const n=qe.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e).fold(tt,nt),a=((e,t,n,r)=>{const o=e.isiOS()&&!0===/ipad/i.test(n),i=e.isiOS()&&!o,s=e.isiOS()||e.isAndroid(),a=s||r("(pointer:coarse)"),l=o||!i&&s&&r("(min-device-width:768px)"),c=i||s&&!l,u=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),h=!c&&!l&&!u;return{isiPad:b(o),isiPhone:b(i),isTablet:b(l),isPhone:b(c),isTouch:b(a),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:b(u),isDesktop:b(h)}})(s,i,e,n);return{browser:i,os:s,deviceType:a}},ot=e=>window.matchMedia(e).matches;let it=(e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e.apply(null,r)),t)})((()=>rt(window.navigator.userAgent,M.from(window.navigator.userAgentData),ot)));const st=()=>it(),at=e=>t=>(e=>e.dom.nodeType)(t)===e,lt=at(3),ct=at(11),ut=e=>(e=>{const t=e.dom.childNodes;return M.from(t[0]).map(je)})(e),ht=e=>je(e.dom.getRootNode()),ft=e=>je(e.dom.host),dt=(e,t,n)=>{((e,t,n)=>{if(!(u(n)||d(n)||v(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")})(e.dom,t,n)},gt=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},_t=(e,t)=>{e.dom.removeAttribute(t)},pt=e=>{const t=$e("div");return((e,t)=>{e.dom.appendChild(t.dom)})(t,je(e.dom.cloneNode(!0))),(e=>e.dom.innerHTML)(t)},mt=e=>void 0!==e.style&&m(e.style.getPropertyValue),vt=e=>{const t=lt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=ht(e);return ct(n=t)&&p(n.dom.host)?M.some(t):M.none();var n})(je(t)).fold((()=>n.body.contains(t)),(r=vt,o=ft,e=>r(o(e))));var r,o},yt=(e,t)=>{const n=e.dom,r=window.getComputedStyle(n).getPropertyValue(t);return""!==r||vt(e)?r:bt(n,t)},bt=(e,t)=>mt(e)?e.style.getPropertyValue(t):"",wt=(e=>{const t=t=>{const n=(e=>{const t=e.dom;return vt(e)?t.getBoundingClientRect().height:t.offsetHeight})(t);if(n<=0||null===n){const n=yt(t,e);return parseFloat(n)||0}return n},n=(e,t)=>I(t,((t,n)=>{const r=yt(e,n),o=void 0===r?0:parseInt(r,10);return isNaN(o)?t:t+o}),0);return{set:(t,n)=>{if(!v(n)&&!n.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+n);const r=t.dom;mt(r)&&(r.style[e]=n+"px")},get:t,getOuter:t,aggregate:n,max:(e,t,r)=>{const o=n(e,r);return t>o?t-o:0}}})("height"),xt=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),Ct=(e,t)=>n=>"rtl"===St(n)?t:e,St=e=>"rtl"===yt(e,"direction")?"rtl":"ltr",kt=(e,t)=>{const n=gt(e,t);return void 0===n||""===n?[]:n.split(" ")},Mt=(e,t,n)=>((e,t,n)=>{let r=e.dom;const o=m(n)?n:S;for(;r.parentNode;){r=r.parentNode;const e=je(r);if(t(e))return M.some(e);if(o(e))break}return M.none()})(e,(e=>Ue(e,t)),n),Et=(e,t,n)=>((e,t,n,r,o)=>e(n,r)?M.some(n):m(o)&&o(n)?M.none():t(n,r,o))(((e,t)=>Ue(e,t)),Mt,e,t,n),At=e=>void 0!==e.dom.classList,Nt=(e,t)=>{D(t,(t=>{((e,t)=>{At(e)?e.dom.classList.add(t):((e,t)=>{((e,t,n)=>{const r=kt(e,t).concat([n]);dt(e,t,r.join(" "))})(e,"class",t)})(e,t)})(e,t)}))},Rt=(e,t)=>{D(t,(t=>{((e,t)=>{At(e)?e.dom.classList.remove(t):((e,t)=>{((e,t,n)=>{const r=P(kt(e,t),(e=>e!==n));r.length>0?dt(e,t,r.join(" ")):_t(e,t)})(e,"class",t)})(e,t),(e=>{const t=At(e)?e.dom.classList:(e=>kt(e,"class"))(e);0===t.length&&_t(e,"class")})(e)})(e,t)}))},Tt=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return He(n)?[]:T(n.querySelectorAll(e),je)})(t,e),Dt=(e,t)=>{const n=e.getAttribute(t);return null===n?void 0:n},Ot=(e,t)=>M.from(Dt(e,t)),Pt=(e,t,n)=>{const r=((e,t)=>{const n=Dt(e,t);return void 0===n||""===n?[]:n.split(" ")})(e,t);return((e,t,n)=>{((e,t,n)=>{if(!(u(n)||d(n)||v(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")})(e,t,n)})(e,t,r.concat([n]).join(" ")),!0},It=e=>void 0!==e.classList,Lt=(e,t)=>{It(e)?e.classList.add(t):((e,t)=>{Pt(e,"class",t)})(e,t)},$t=(e,t)=>(t||document).createElement(e),jt=(e,t)=>(t||document).createTextNode(e),Ut=e=>e.nodeName.toLowerCase(),Ht=e=>t=>t.nodeType===e,Bt=e=>8===e.nodeType||"#comment"===Ut(e),Ft=Ht(1),Vt=Ht(3),qt=Ht(9),zt=Ht(11),Kt=e=>e.ownerDocument,Wt=e=>qt(e)?e:Kt(e),Gt=e=>M.from(e.parentNode),Qt=e=>Gt(e),Jt=(e,t)=>{const n=m(t)?t:S;let r=e;const o=[];for(;null!==r.parentNode&&void 0!==r.parentNode;){const e=r.parentNode,t=e;if(o.push(t),!0===n(t))break;r=e}return o},Xt=e=>M.from(e.previousSibling),Yt=e=>M.from(e.nextSibling),Zt=e=>q(e.childNodes),en=e=>!e.hasChildNodes(),tn=(e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,Zt(n)},nn=(e,t)=>{const n=(t||document).createDocumentFragment();return D(e,(e=>{n.appendChild(e)})),n},rn=(e,t)=>{var n;null===(n=e.parentNode)||void 0===n||n.insertBefore(t,e),t.appendChild(e)},on=(e,t)=>e.cloneNode(t),sn=e=>on(e,!1),an=e=>on(e,!0),ln=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},cn=-1;(ln.Diff=function(e,t){this[0]=e,this[1]=t}).prototype.length=2,ln.Diff.prototype.toString=function(){return this[0]+","+this[1]},ln.Diff.prototype[Symbol.iterator]=function*(){yield this[0],yield this[1]},ln.prototype.diff_main=function(e,t,n,r){void 0===r&&(r=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var o=r;if(null==e||null==t)throw new Error("Null input. (diff_main)");if(e==t)return e?[new ln.Diff(0,e)]:[];void 0===n&&(n=!0);var i=n,s=this.diff_commonPrefix(e,t),a=e.substring(0,s);e=e.substring(s),t=t.substring(s),s=this.diff_commonSuffix(e,t);var l=e.substring(e.length-s);e=e.substring(0,e.length-s),t=t.substring(0,t.length-s);var c=this.diff_compute_(e,t,i,o);return a&&c.unshift(new ln.Diff(0,a)),l&&c.push(new ln.Diff(0,l)),this.diff_cleanupMerge(c),c},ln.prototype.diff_compute_=function(e,t,n,r){var o;if(!e)return[new ln.Diff(1,t)];if(!t)return[new ln.Diff(cn,e)];var i=e.length>t.length?e:t,s=e.length>t.length?t:e,a=i.indexOf(s);if(-1!=a)return o=[new ln.Diff(1,i.substring(0,a)),new ln.Diff(0,s),new ln.Diff(1,i.substring(a+s.length))],e.length>t.length&&(o[0][0]=o[2][0]=cn),o;if(1==s.length)return[new ln.Diff(cn,e),new ln.Diff(1,t)];var l=this.diff_halfMatch_(e,t);if(l){var c=l[0],u=l[1],h=l[2],f=l[3],d=l[4],g=this.diff_main(c,h,n,r),_=this.diff_main(u,f,n,r);return g.concat([new ln.Diff(0,d)],_)}return n&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,r):this.diff_bisect_(e,t,r)},ln.prototype.diff_lineMode_=function(e,t,n){var r=this.diff_linesToChars_(e,t);e=r.chars1,t=r.chars2;var o=r.lineArray,i=this.diff_main(e,t,!1,n);this.diff_charsToLines_(i,o),this.diff_cleanupSemantic(i),i.push(new ln.Diff(0,""));for(var s=0,a=0,l=0,c="",u="";s<i.length;){switch(i[s][0]){case 1:l++,u+=i[s][1];break;case cn:a++,c+=i[s][1];break;case 0:if(a>=1&&l>=1){i.splice(s-a-l,a+l),s=s-a-l;for(var h=this.diff_main(c,u,!1,n),f=h.length-1;f>=0;f--)i.splice(s,0,h[f]);s+=h.length}l=0,a=0,c="",u=""}s++}return i.pop(),i},ln.prototype.diff_bisect_=function(e,t,n){for(var r=e.length,o=t.length,i=Math.ceil((r+o)/2),s=i,a=2*i,l=new Array(a),c=new Array(a),u=0;u<a;u++)l[u]=-1,c[u]=-1;l[s+1]=0,c[s+1]=0;for(var h=r-o,f=h%2!=0,d=0,g=0,_=0,p=0,m=0;m<i&&!((new Date).getTime()>n);m++){for(var v=-m+d;v<=m-g;v+=2){for(var y=s+v,b=(k=v==-m||v!=m&&l[y-1]<l[y+1]?l[y+1]:l[y-1]+1)-v;k<r&&b<o&&e.charAt(k)==t.charAt(b);)k++,b++;if(l[y]=k,k>r)g+=2;else if(b>o)d+=2;else if(f&&(C=s+h-v)>=0&&C<a&&-1!=c[C]&&k>=(x=r-c[C]))return this.diff_bisectSplit_(e,t,k,b,n)}for(var w=-m+_;w<=m-p;w+=2){for(var x,C=s+w,S=(x=w==-m||w!=m&&c[C-1]<c[C+1]?c[C+1]:c[C-1]+1)-w;x<r&&S<o&&e.charAt(r-x-1)==t.charAt(o-S-1);)x++,S++;if(c[C]=x,x>r)p+=2;else if(S>o)_+=2;else if(!f){var k;if((y=s+h-w)>=0&&y<a&&-1!=l[y])if(b=s+(k=l[y])-y,k>=(x=r-x))return this.diff_bisectSplit_(e,t,k,b,n)}}}return[new ln.Diff(cn,e),new ln.Diff(1,t)]},ln.prototype.diff_bisectSplit_=function(e,t,n,r,o){var i=e.substring(0,n),s=t.substring(0,r),a=e.substring(n),l=t.substring(r),c=this.diff_main(i,s,!1,o),u=this.diff_main(a,l,!1,o);return c.concat(u)},ln.prototype.diff_linesToChars_=function(e,t){var n=[],r={};function o(e){for(var t="",o=0,s=-1,a=n.length;s<e.length-1;){-1==(s=e.indexOf("\n",o))&&(s=e.length-1);var l=e.substring(o,s+1);(r.hasOwnProperty?r.hasOwnProperty(l):void 0!==r[l])?t+=String.fromCharCode(r[l]):(a==i&&(l=e.substring(o),s=e.length),t+=String.fromCharCode(a),r[l]=a,n[a++]=l),o=s+1}return t}n[0]="";var i=4e4,s=o(e);return i=65535,{chars1:s,chars2:o(t),lineArray:n}},ln.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],o=[],i=0;i<r.length;i++)o[i]=t[r.charCodeAt(i)];e[n][1]=o.join("")}},ln.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),o=r,i=0;n<o;)e.substring(i,o)==t.substring(i,o)?i=n=o:r=o,o=Math.floor((r-n)/2+n);return o},ln.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),o=r,i=0;n<o;)e.substring(e.length-o,e.length-i)==t.substring(t.length-o,t.length-i)?i=n=o:r=o,o=Math.floor((r-n)/2+n);return o},ln.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(0==n||0==r)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var o=Math.min(n,r);if(e==t)return o;for(var i=0,s=1;;){var a=e.substring(o-s),l=t.indexOf(a);if(-1==l)return i;s+=l,0!=l&&e.substring(o-s)!=t.substring(0,s)||(i=s,s++)}},ln.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||2*r.length<n.length)return null;var o=this;function i(e,t,n){for(var r,i,s,a,l=e.substring(n,n+Math.floor(e.length/4)),c=-1,u="";-1!=(c=t.indexOf(l,c+1));){var h=o.diff_commonPrefix(e.substring(n),t.substring(c)),f=o.diff_commonSuffix(e.substring(0,n),t.substring(0,c));u.length<f+h&&(u=t.substring(c-f,c)+t.substring(c,c+h),r=e.substring(0,n-f),i=e.substring(n+h),s=t.substring(0,c-f),a=t.substring(c+h))}return 2*u.length>=e.length?[r,i,s,a,u]:null}var s,a,l,c,u,h=i(n,r,Math.ceil(n.length/4)),f=i(n,r,Math.ceil(n.length/2));return h||f?(s=f?h&&h[4].length>f[4].length?h:f:h,e.length>t.length?(a=s[0],l=s[1],c=s[2],u=s[3]):(c=s[0],u=s[1],a=s[2],l=s[3]),[a,l,c,u,s[4]]):null},ln.prototype.diff_cleanupSemantic=function(e){for(var t=!1,n=[],r=0,o=null,i=0,s=0,a=0,l=0,c=0;i<e.length;)0==e[i][0]?(n[r++]=i,s=l,a=c,l=0,c=0,o=e[i][1]):(1==e[i][0]?l+=e[i][1].length:c+=e[i][1].length,o&&o.length<=Math.max(s,a)&&o.length<=Math.max(l,c)&&(e.splice(n[r-1],0,new ln.Diff(cn,o)),e[n[r-1]+1][0]=1,r--,i=--r>0?n[r-1]:-1,s=0,a=0,l=0,c=0,o=null,t=!0)),i++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),i=1;i<e.length;){if(e[i-1][0]==cn&&1==e[i][0]){var u=e[i-1][1],h=e[i][1],f=this.diff_commonOverlap_(u,h),d=this.diff_commonOverlap_(h,u);f>=d?(f>=u.length/2||f>=h.length/2)&&(e.splice(i,0,new ln.Diff(0,h.substring(0,f))),e[i-1][1]=u.substring(0,u.length-f),e[i+1][1]=h.substring(f),i++):(d>=u.length/2||d>=h.length/2)&&(e.splice(i,0,new ln.Diff(0,u.substring(0,d))),e[i-1][0]=1,e[i-1][1]=h.substring(0,h.length-d),e[i+1][0]=cn,e[i+1][1]=u.substring(d),i++),i++}i++}},ln.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),o=n.match(ln.nonAlphaNumericRegex_),i=r.match(ln.nonAlphaNumericRegex_),s=o&&n.match(ln.whitespaceRegex_),a=i&&r.match(ln.whitespaceRegex_),l=s&&n.match(ln.linebreakRegex_),c=a&&r.match(ln.linebreakRegex_),u=l&&e.match(ln.blanklineEndRegex_),h=c&&t.match(ln.blanklineStartRegex_);return u||h?5:l||c?4:o&&!s&&a?3:s||a?2:o||i?1:0}for(var n=1;n<e.length-1;){if(0==e[n-1][0]&&0==e[n+1][0]){var r=e[n-1][1],o=e[n][1],i=e[n+1][1],s=this.diff_commonSuffix(r,o);if(s){var a=o.substring(o.length-s);r=r.substring(0,r.length-s),o=a+o.substring(0,o.length-s),i=a+i}for(var l=r,c=o,u=i,h=t(r,o)+t(o,i);o.charAt(0)===i.charAt(0);){r+=o.charAt(0),o=o.substring(1)+i.charAt(0),i=i.substring(1);var f=t(r,o)+t(o,i);f>=h&&(h=f,l=r,c=o,u=i)}e[n-1][1]!=l&&(l?e[n-1][1]=l:(e.splice(n-1,1),n--),e[n][1]=c,u?e[n+1][1]=u:(e.splice(n+1,1),n--))}n++}},ln.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,ln.whitespaceRegex_=/\s/,ln.linebreakRegex_=/[\r\n]/,ln.blanklineEndRegex_=/\n\r?\n$/,ln.blanklineStartRegex_=/^\r?\n\r?\n/,ln.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,n=[],r=0,o=null,i=0,s=!1,a=!1,l=!1,c=!1;i<e.length;)0==e[i][0]?(e[i][1].length<this.Diff_EditCost&&(l||c)?(n[r++]=i,s=l,a=c,o=e[i][1]):(r=0,o=null),l=c=!1):(e[i][0]==cn?c=!0:l=!0,o&&(s&&a&&l&&c||o.length<this.Diff_EditCost/2&&s+a+l+c==3)&&(e.splice(n[r-1],0,new ln.Diff(cn,o)),e[n[r-1]+1][0]=1,r--,o=null,s&&a?(l=c=!0,r=0):(i=--r>0?n[r-1]:-1,l=c=!1),t=!0)),i++;t&&this.diff_cleanupMerge(e)},ln.prototype.diff_cleanupMerge=function(e){e.push(new ln.Diff(0,""));for(var t,n=0,r=0,o=0,i="",s="";n<e.length;)switch(e[n][0]){case 1:o++,s+=e[n][1],n++;break;case cn:r++,i+=e[n][1],n++;break;case 0:r+o>1?(0!==r&&0!==o&&(0!==(t=this.diff_commonPrefix(s,i))&&(n-r-o>0&&0==e[n-r-o-1][0]?e[n-r-o-1][1]+=s.substring(0,t):(e.splice(0,0,new ln.Diff(0,s.substring(0,t))),n++),s=s.substring(t),i=i.substring(t)),0!==(t=this.diff_commonSuffix(s,i))&&(e[n][1]=s.substring(s.length-t)+e[n][1],s=s.substring(0,s.length-t),i=i.substring(0,i.length-t))),n-=r+o,e.splice(n,r+o),i.length&&(e.splice(n,0,new ln.Diff(cn,i)),n++),s.length&&(e.splice(n,0,new ln.Diff(1,s)),n++),n++):0!==n&&0==e[n-1][0]?(e[n-1][1]+=e[n][1],e.splice(n,1)):n++,o=0,r=0,i="",s=""}""===e[e.length-1][1]&&e.pop();var a=!1;for(n=1;n<e.length-1;)0==e[n-1][0]&&0==e[n+1][0]&&(e[n][1].substring(e[n][1].length-e[n-1][1].length)==e[n-1][1]?(e[n][1]=e[n-1][1]+e[n][1].substring(0,e[n][1].length-e[n-1][1].length),e[n+1][1]=e[n-1][1]+e[n+1][1],e.splice(n-1,1),a=!0):e[n][1].substring(0,e[n+1][1].length)==e[n+1][1]&&(e[n-1][1]+=e[n+1][1],e[n][1]=e[n][1].substring(e[n+1][1].length)+e[n+1][1],e.splice(n+1,1),a=!0)),n++;a&&this.diff_cleanupMerge(e)},ln.prototype.diff_cleanupSplitSurrogates=function(e){for(var t,n=0;n<e.length;n++){var r=e[n],o=r[1][0],i=r[1][r[1].length-1];0!==r[1].length?(i&&this.isHighSurrogate(i)&&(t=i,r[1]=r[1].slice(0,-1)),t&&o&&this.isHighSurrogate(t)&&this.isLowSurrogate(o)&&(r[1]=t+r[1]),0!==r[1].length||e.splice(n--,1)):e.splice(n--,1)}return e},ln.prototype.isHighSurrogate=function(e){var t=e.charCodeAt(0);return t>=55296&&t<=56319},ln.prototype.isLowSurrogate=function(e){var t=e.charCodeAt(0);return t>=56320&&t<=57343},ln.prototype.digit16=function(e){switch(e){case"0":return 0;case"1":return 1;case"2":return 2;case"3":return 3;case"4":return 4;case"5":return 5;case"6":return 6;case"7":return 7;case"8":return 8;case"9":return 9;case"A":case"a":return 10;case"B":case"b":return 11;case"C":case"c":return 12;case"D":case"d":return 13;case"E":case"e":return 14;case"F":case"f":return 15;default:throw new Error("Invalid hex-code")}},ln.prototype.decodeURI=function(e){try{return decodeURI(e)}catch(l){for(var t=0,n="";t<e.length;)if("%"===e[t]){var r=(this.digit16(e[t+1])<<4)+this.digit16(e[t+2]);if(128&r){if("%"!==e[t+3])throw new URIError("URI malformed");var o=(this.digit16(e[t+4])<<4)+this.digit16(e[t+5]);if(128!=(192&o))throw new URIError("URI malformed");if(o&=63,192!=(224&r)){if("%"!==e[t+6])throw new URIError("URI malformed");var i=(this.digit16(e[t+7])<<4)+this.digit16(e[t+8]);if(128!=(192&i))throw new URIError("URI malformed");if(i&=63,224!=(240&r)){if("%"!==e[t+9])throw new URIError("URI malformed");var s=(this.digit16(e[t+10])<<4)+this.digit16(e[t+11]);if(128!=(192&s))throw new URIError("URI malformed");if(s&=63,240==(248&r)){var a=(7&r)<<18|o<<12|i<<6|s;if(a>=65536&&a<=1114111){n+=String.fromCharCode((65535&a)>>>10&1023|55296),n+=String.fromCharCode(56320|1023&a),t+=12;continue}}throw new URIError("URI malformed")}n+=String.fromCharCode((15&r)<<12|o<<6|i),t+=9}else n+=String.fromCharCode((31&r)<<6|o),t+=6}else n+=String.fromCharCode(r),t+=3}else n+=e[t++];return n}},ln.prototype.diff_xIndex=function(e,t){var n,r=0,o=0,i=0,s=0;for(n=0;n<e.length&&(1!==e[n][0]&&(r+=e[n][1].length),e[n][0]!==cn&&(o+=e[n][1].length),!(r>t));n++)i=r,s=o;return e.length!=n&&e[n][0]===cn?s:s+(t-i)},ln.prototype.diff_prettyHtml=function(e){e=this.diff_cleanupSplitSurrogates(e);for(var t=[],n=/&/g,r=/</g,o=/>/g,i=/\n/g,s=0;s<e.length;s++){var a=e[s][0],l=e[s][1].replace(n,"&amp;").replace(r,"&lt;").replace(o,"&gt;").replace(i,"&para;<br>");switch(a){case 1:t[s]='<ins style="background:#e6ffe6;">'+l+"</ins>";break;case cn:t[s]='<del style="background:#ffe6e6;">'+l+"</del>";break;case 0:t[s]="<span>"+l+"</span>"}}return t.join("")},ln.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)1!==e[n][0]&&(t[n]=e[n][1]);return t.join("")},ln.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==cn&&(t[n]=e[n][1]);return t.join("")},ln.prototype.diff_levenshtein=function(e){for(var t=0,n=0,r=0,o=0;o<e.length;o++){var i=e[o][0],s=e[o][1];switch(i){case 1:n+=s.length;break;case cn:r+=s.length;break;case 0:t+=Math.max(n,r),n=0,r=0}}return t+Math.max(n,r)},ln.prototype.diff_toDelta=function(e){e=this.diff_cleanupSplitSurrogates(e);for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case 1:t[n]="+"+encodeURI(e[n][1]);break;case cn:t[n]="-"+e[n][1].length;break;case 0:t[n]="="+e[n][1].length}return t.join("\t").replace(/%20/g," ")},ln.prototype.diff_fromDelta=function(e,t){for(var n=[],r=0,o=0,i=t.split(/\t/g),s=0;s<i.length;s++){var a=i[s].substring(1);switch(i[s].charAt(0)){case"+":try{n[r++]=new ln.Diff(1,this.decodeURI(a))}catch(e){throw new Error("Illegal escape in diff_fromDelta: "+a)}break;case"-":case"=":var l=parseInt(a,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+a);var c=e.substring(o,o+=l);"="==i[s].charAt(0)?n[r++]=new ln.Diff(0,c):n[r++]=new ln.Diff(cn,c);break;default:if(i[s])throw new Error("Invalid diff operation in diff_fromDelta: "+i[s])}}if(o!=e.length)throw new Error("Delta length ("+o+") does not equal source text length ("+e.length+").");return n},ln.prototype.match_main=function(e,t,n){if(null==e||null==t||null==n)throw new Error("Null input. (match_main)");return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},ln.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var r=this.match_alphabet_(t),o=this;function i(e,r){var i=e/t.length,s=Math.abs(n-r);return o.Match_Distance?i+s/o.Match_Distance:s?1:i}var s=this.Match_Threshold,a=e.indexOf(t,n);-1!=a&&(s=Math.min(i(0,a),s),-1!=(a=e.lastIndexOf(t,n+t.length))&&(s=Math.min(i(0,a),s)));var l,c,u=1<<t.length-1;a=-1;for(var h,f=t.length+e.length,d=0;d<t.length;d++){for(l=0,c=f;l<c;)i(d,n+c)<=s?l=c:f=c,c=Math.floor((f-l)/2+l);f=c;var g=Math.max(1,n-c+1),_=Math.min(n+c,e.length)+t.length,p=Array(_+2);p[_+1]=(1<<d)-1;for(var m=_;m>=g;m--){var v=r[e.charAt(m-1)];if(p[m]=0===d?(p[m+1]<<1|1)&v:(p[m+1]<<1|1)&v|(h[m+1]|h[m])<<1|1|h[m+1],p[m]&u){var y=i(d,m-1);if(y<=s){if(s=y,!((a=m-1)>n))break;g=Math.max(1,2*n-a)}}}if(i(d+1,n)>s)break;h=p}return a},ln.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},ln.prototype.patch_addContext_=function(e,t){if(0!=t.length){if(null===e.start2)throw Error("patch not initialized");for(var n=t.substring(e.start2,e.start2+e.length1),r=0;t.indexOf(n)!=t.lastIndexOf(n)&&n.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)r+=this.Patch_Margin,n=t.substring(e.start2-r,e.start2+e.length1+r);r+=this.Patch_Margin,e.start2-r>0&&ln.prototype.isLowSurrogate(t[e.start2-r])&&r++;var o=t.substring(e.start2-r,e.start2);o&&e.diffs.unshift(new ln.Diff(0,o)),e.start2+e.length1+r<t.length&&ln.prototype.isHighSurrogate(t[e.start2+e.length1+r])&&r++;var i=t.substring(e.start2+e.length1,e.start2+e.length1+r);i&&e.diffs.push(new ln.Diff(0,i)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+i.length,e.length2+=o.length+i.length}},ln.prototype.patch_make=function(e,t,n){var r,o;if("string"==typeof e&&"string"==typeof t&&void 0===n)r=e,(o=this.diff_main(r,t,!0)).length>2&&(this.diff_cleanupSemantic(o),this.diff_cleanupEfficiency(o));else if(e&&"object"==typeof e&&void 0===t&&void 0===n)o=e,r=this.diff_text1(o);else if("string"==typeof e&&t&&"object"==typeof t&&void 0===n)r=e,o=t;else{if("string"!=typeof e||"string"!=typeof t||!n||"object"!=typeof n)throw new Error("Unknown call format to patch_make.");r=e,o=n}if(0===o.length)return[];o=this.diff_cleanupSplitSurrogates(o);for(var i=[],s=new ln.patch_obj,a=0,l=0,c=0,u=r,h=r,f=0;f<o.length;f++){var d=o[f][0],g=o[f][1];switch(a||0===d||(s.start1=l,s.start2=c),d){case 1:s.diffs[a++]=o[f],s.length2+=g.length,h=h.substring(0,c)+g+h.substring(c);break;case cn:s.length1+=g.length,s.diffs[a++]=o[f],h=h.substring(0,c)+h.substring(c+g.length);break;case 0:g.length<=2*this.Patch_Margin&&a&&o.length!=f+1?(s.diffs[a++]=o[f],s.length1+=g.length,s.length2+=g.length):g.length>=2*this.Patch_Margin&&a&&(this.patch_addContext_(s,u),i.push(s),s=new ln.patch_obj,a=0,u=h,l=c)}1!==d&&(l+=g.length),d!==cn&&(c+=g.length)}return a&&(this.patch_addContext_(s,u),i.push(s)),i},ln.prototype.patch_deepCopy=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],o=new ln.patch_obj;o.diffs=[];for(var i=0;i<r.diffs.length;i++)o.diffs[i]=new ln.Diff(r.diffs[i][0],r.diffs[i][1]);o.start1=r.start1,o.start2=r.start2,o.length1=r.length1,o.length2=r.length2,t[n]=o}return t},ln.prototype.patch_apply=function(e,t){if(0==e.length)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var r=0,o=[],i=0;i<e.length;i++){var s,a,l=e[i].start2+r,c=this.diff_text1(e[i].diffs),u=-1;if(c.length>this.Match_MaxBits?-1!=(s=this.match_main(t,c.substring(0,this.Match_MaxBits),l))&&(-1==(u=this.match_main(t,c.substring(c.length-this.Match_MaxBits),l+c.length-this.Match_MaxBits))||s>=u)&&(s=-1):s=this.match_main(t,c,l),-1==s)o[i]=!1,r-=e[i].length2-e[i].length1;else if(o[i]=!0,r=s-l,c==(a=-1==u?t.substring(s,s+c.length):t.substring(s,u+this.Match_MaxBits)))t=t.substring(0,s)+this.diff_text2(e[i].diffs)+t.substring(s+c.length);else{var h=this.diff_main(c,a,!1);if(c.length>this.Match_MaxBits&&this.diff_levenshtein(h)/c.length>this.Patch_DeleteThreshold)o[i]=!1;else{this.diff_cleanupSemanticLossless(h);for(var f,d=0,g=0;g<e[i].diffs.length;g++){var _=e[i].diffs[g];0!==_[0]&&(f=this.diff_xIndex(h,d)),1===_[0]?t=t.substring(0,s+f)+_[1]+t.substring(s+f):_[0]===cn&&(t=t.substring(0,s+f)+t.substring(s+this.diff_xIndex(h,d+_[1].length))),_[0]!==cn&&(d+=_[1].length)}}}}return[t=t.substring(n.length,t.length-n.length),o]},ln.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,n="",r=1;r<=t;r++)n+=String.fromCharCode(r);for(r=0;r<e.length;r++)e[r].start1+=t,e[r].start2+=t;var o=e[0],i=o.diffs;if(0==i.length||0!=i[0][0])i.unshift(new ln.Diff(0,n)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>i[0][1].length){var s=t-i[0][1].length;i[0][1]=n.substring(i[0][1].length)+i[0][1],o.start1-=s,o.start2-=s,o.length1+=s,o.length2+=s}return 0==(i=(o=e[e.length-1]).diffs).length||0!=i[i.length-1][0]?(i.push(new ln.Diff(0,n)),o.length1+=t,o.length2+=t):t>i[i.length-1][1].length&&(s=t-i[i.length-1][1].length,i[i.length-1][1]+=n.substring(0,s),o.length1+=s,o.length2+=s),n},ln.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,n=0;n<e.length;n++)if(!(e[n].length1<=t)){var r=e[n];e.splice(n--,1);for(var o=r.start1,i=r.start2,s="";0!==r.diffs.length;){var a=new ln.patch_obj,l=!0;for(a.start1=o-s.length,a.start2=i-s.length,""!==s&&(a.length1=a.length2=s.length,a.diffs.push(new ln.Diff(0,s)));0!==r.diffs.length&&a.length1<t-this.Patch_Margin;){var c=r.diffs[0][0],u=r.diffs[0][1];1===c?(a.length2+=u.length,i+=u.length,a.diffs.push(r.diffs.shift()),l=!1):c===cn&&1==a.diffs.length&&0==a.diffs[0][0]&&u.length>2*t?(a.length1+=u.length,o+=u.length,l=!1,a.diffs.push(new ln.Diff(c,u)),r.diffs.shift()):(u=u.substring(0,t-a.length1-this.Patch_Margin),a.length1+=u.length,o+=u.length,0===c?(a.length2+=u.length,i+=u.length):l=!1,a.diffs.push(new ln.Diff(c,u)),u==r.diffs[0][1]?r.diffs.shift():r.diffs[0][1]=r.diffs[0][1].substring(u.length))}s=(s=this.diff_text2(a.diffs)).substring(s.length-this.Patch_Margin);var h=this.diff_text1(r.diffs).substring(0,this.Patch_Margin);""!==h&&(a.length1+=h.length,a.length2+=h.length,0!==a.diffs.length&&0===a.diffs[a.diffs.length-1][0]?a.diffs[a.diffs.length-1][1]+=h:a.diffs.push(new ln.Diff(0,h))),l||e.splice(++n,0,a)}}},ln.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join("")},ln.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var n=e.split("\n"),r=0,o=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;r<n.length;){var i=n[r].match(o);if(!i)throw new Error("Invalid patch string: "+n[r]);var s=new ln.patch_obj;for(t.push(s),s.start1=parseInt(i[1],10),""===i[2]?(s.start1--,s.length1=1):"0"==i[2]?s.length1=0:(s.start1--,s.length1=parseInt(i[2],10)),s.start2=parseInt(i[3],10),""===i[4]?(s.start2--,s.length2=1):"0"==i[4]?s.length2=0:(s.start2--,s.length2=parseInt(i[4],10)),r++;r<n.length;){var a=n[r].charAt(0);try{var l=decodeURI(n[r].substring(1))}catch(e){throw new Error("Illegal escape in patch_fromText: "+l)}if("-"==a)s.diffs.push(new ln.Diff(cn,l));else if("+"==a)s.diffs.push(new ln.Diff(1,l));else if(" "==a)s.diffs.push(new ln.Diff(0,l));else{if("@"==a)break;if(""!==a)throw new Error('Invalid patch mode "'+a+'" in: '+l)}r++}}return t},(ln.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0}).prototype.toString=function(){var e,t=["@@ -"+(0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1)+" +"+(0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2)+" @@\n"];ln.prototype.diff_cleanupSplitSurrogates(this.diffs);for(var n=0;n<this.diffs.length;n++){switch(this.diffs[n][0]){case 1:e="+";break;case cn:e="-";break;case 0:e=" "}t[n+1]=e+encodeURI(this.diffs[n][1])+"\n"}return t.join("").replace(/%20/g," ")};const un=(e,t)=>{const n=Ut(e);return n===Ut(t)&&N(["img","iframe","audio","video","embed","source"],n)&&((e,t,n=x)=>((e,t,n)=>e.isSome()&&t.isSome()?M.some(n(e.getOrDie(),t.getOrDie())):M.none())(e,t,n).getOr(e.isNone()&&t.isNone()))(Ot(e,"src"),Ot(t,"src"))},hn=(e,t)=>{const n=new Set(t);return P(e.trim().split(/\s+/),(e=>!n.has(e)&&e.length>0))},fn=(e,t,n,r)=>{var o;const i=null===(o=r[e.toLowerCase()])||void 0===o?void 0:o[t];return!_(i)&&(!0===i.ignore||(i.predicate?i.predicate(n):!!i.ignoreTokens&&0===hn(n,i.ignoreTokens).length))},dn=(e,t)=>{if(!Ft(e))return!1;const n=Array.from(e.attributes);return 0!==n.length&&j(n,(({name:n,value:r})=>fn(e.tagName,n,r,t)))},gn=(e,t,n)=>{const r=e.tagName.toLowerCase(),o=n[r];return!!_(o)||j(z(o),(r=>_n(r,e,t,n)))},_n=(e,t,n,r)=>{var o,i;const s=null!==(o=t.getAttribute(e))&&void 0!==o?o:"",a=null!==(i=n.getAttribute(e))&&void 0!==i?i:"",l=(r[t.tagName.toLowerCase()]||{})[e];if(g(l))return s===a;if(null==l?void 0:l.predicate){const e=l.predicate(s),t=l.predicate(a);return!e&&!t||s===a}if(null==l?void 0:l.ignoreTokens){const e=hn(s,l.ignoreTokens),t=hn(a,l.ignoreTokens);return e.length===t.length&&U(e,t)}return s===a},pn=(e,t,r=!1,o={})=>{if(e===t)return!0;if(e.nodeType!==t.nodeType||Ut(e)!==Ut(t))return!1;if(Vt(e)||Bt(e)){if(e.data!==t.data)return!1}else if(Ft(e)){const r=e=>(e=>{const t=E.call(e,0);return t.sort(void 0),t})(e.getAttributeNames?e.getAttributeNames():Object.keys(I(e.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))),i=e=>P(r(e),(t=>{var n;return!fn(e.tagName,t,null!==(n=e.getAttribute(t))&&void 0!==n?n:"",o)})),s=i(e),a=i(t);if(!U(s,a,n))return!1;for(let n=0,r=s.length;n<r;++n)if(!_n(s[n],e,t,o))return!1}if(r){const n=Zt(e),r=Zt(t);return U(n,r,{eq:(e,t)=>pn(e,t,!0,o)})}return!0},mn=(e,t=M.none())=>t.fold((()=>Jt(e)),(t=>e===t?[]:Jt(e,(e=>e===t)))),vn=(e="visual-dom-diff: An error occurred when trying to calculate the diff between content")=>{throw new Error(e)},yn=(e,t)=>L(t,(t=>Ft(e)&&e.matches(t))),bn=e=>String.fromCharCode(57344+Math.abs((e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t})(e))%6400),wn=e=>{for(let t=0;t<e.length-2;){const n=e[t],r=e[t+1],o=e[t+2];if(0!==n[0]||0===r[0]||0!==o[0]){t++;continue}const i=n[1],s=r[1],a=o[1],l=i[i.length-1];l!==s[s.length-1]||l<"\ue000"||l>="\uf900"||l===bn("col")||l===bn("colgroup")?t++:(n[1]=i.substring(0,i.length-1),r[1]=l+s.substring(0,s.length-1),o[1]=l+a,0===n[1].length&&e.splice(t,1))}},xn=(e,t,n)=>{const r=(e=>{const t=new ln;return t.Diff_EditCost=null!=e?e:8,t.Diff_Timeout=10,t})(n),o=r.diff_main(e,t),i=[],s=[];wn(o);for(let e=0,t=o.length;e<t;++e){const t=o[e];if(0===t[0]){const e=t[1],n=e.length,o=M.from(/^[^\uE000-\uF8FF]*/.exec(e)).map((e=>e[0].length)).getOr(0);if(o<n){const t=M.from(/[^\uE000-\uF8FF]*$/.exec(e)).map((e=>e[0].length)).getOr(0);o>0&&s.push(new ln.Diff(0,e.substring(0,o))),r.diff_cleanupSemantic(s),r.diff_cleanupEfficiency(s),Cn(i,s),s.length=0,i.push(new ln.Diff(0,e.substring(o,n-t))),t>0&&s.push(new ln.Diff(0,e.substring(n-t)))}else s.push(t)}else s.push(t)}return r.diff_cleanupSemantic(s),r.diff_cleanupEfficiency(s),Cn(i,s),s.length=0,r.diff_cleanupMerge(i),wn(i),i},Cn=(e,t)=>{Array.prototype.push.apply(e,t)},Sn=(e,t,n)=>{if(Ft(e))Lt(e,n);else{const r=Wt(e);Xt(e).filter((e=>{return Ut(e)===t&&(o=n,It(r=e)&&r.classList.contains(o));var r,o})).fold((()=>{const o=$t(t,r);Lt(o,n),rn(e,o)}),(t=>t.appendChild(e)))}},kn=(e,t)=>{let n;const r=e=>{const t=Ut(e);return"th"===t||"td"===t},o=e=>{const o=e.nodeName.toLowerCase(),i=Zt(e);return("tbody"!==o||0!==i.length)&&j(i,((e,o)=>((e,o)=>{const i=Ut(e),s=Zt(e);if("tr"!==i||0===s.length)return!1;const a=e=>I(e,((e,t)=>{if(!Ft(t))return{columns:e.columns+1,rowspan:e.rowspan+1};const n=Ot(t,"colspan").map((e=>parseInt(e,10))).getOr(1);return{columns:e.columns+n,rowspan:e.rowspan+Ot(t,"rowspan").map((e=>parseInt(e,10)-1)).getOr(0)*n}}),{columns:0,rowspan:0});if(t)if(g(n))n=a(s);else{const e=a(s);if(n.rowspan>0){const t=e.columns+n.rowspan-n.columns<0,r=o&&n.rowspan+e.columns>n.columns;if(t||r)return!1;{const t=n.columns-e.columns;n={columns:n.columns,rowspan:n.rowspan-t+e.rowspan}}}else{if(n.columns!==e.columns)return!1;n=e}}return j(s,r)})(e,i.length-1===o)))};return(e=>{const t=Zt(e),n=t.length;let r=0;if(r<n&&"caption"===Ut(t[r])&&r++,r<n&&"colgroup"===t[r].nodeName.toLowerCase()){if(!(e=>{if(!Ft(e))return!1;const t=e=>Ot(e,"span").map((e=>parseInt(e,10))).getOr(1),n=Zt(e),r=t(e);return(0===n.length||j(n,(e=>!(!Ft(e)||"col"!==e.nodeName.toLowerCase())&&1===t(e))))&&1===r})(t[r]))return!1;r++}if(r<n&&"thead"===t[r].nodeName.toLowerCase()){if(!o(t[r]))return!1;r++}if(!(r<n&&"tbody"===Ut(t[r])))return!1;if(!o(t[r]))return!1;if(r++,r<n&&"tfoot"===Ut(t[r])){if(!o(t[r]))return!1;r++}return r===n})(e)},Mn=(e,t,n)=>M.from(e.get(t)).exists((e=>e===n)),En=(e,t)=>L(Array.from(e.entries()),(([e])=>e===t)).map((([,e])=>e)),An=new Set(["img","iframe","object","svg","br","hr","wbr","area","base","basefont","embed","frame","link","meta","param","source","track"]),Nn=new Set(["bdo","bdi","q","cite","code","data","time","var","dfn","abbr","strong","em","big","small","mark","sub","sup","samp","kbd","b","i","s","u","span","a"]);class Rn{constructor(e,t){this.descend=!0,this.nextNode=e,this.rootNode=e,this.config=t,this.skipSelf(this.nextNode)&&this.next()}toArray(){const e=[];let t=this.next();for(;!t.done;){const{value:n}=t;e.push(n),t=this.next()}return e}forEach(e){let t=0,n=this.next();for(;!n.done;)e(n.value,t),n=this.next(),t++}reduce(e,t){let n=t,r=this.next();for(;!r.done;)n=e(n,r.value),r=this.next();return n}some(e){let t=this.next();for(;!t.done;){if(e(t.value))return!0;t=this.next()}return!1}next(){const e=this.nextNode;if(!e)return{done:!0,value:this.rootNode};let t;do{t=this.nextImpl()}while(t.skip&&!t.done);return t.done?{done:!0,value:this.rootNode}:{done:!1,value:e}}nextImpl(){const e=this.nextNode;if(!e)return{done:!0,skip:!1};if(this.descend&&e.firstChild&&!this.skipChildren(e))this.nextNode=(t=e,(e=>{const t=e.childNodes;return M.from(t[0])})(t)).getOrNull();else if(e===this.rootNode)this.nextNode=null;else{if(!Yt(e).isSome())return this.nextNode=Gt(e).getOrNull(),this.descend=!1,{done:!1,skip:!0};this.nextNode=Yt(e).getOrNull(),this.descend=!0}var t;return{done:!1,skip:this.skipSelf(this.nextNode)}}skipSelf(e){return!!(e&&this.config&&this.config.skipSelf)&&this.config.skipSelf(e)}skipChildren(e){return!(!this.config||!this.config.skipChildren)&&this.config.skipChildren(e)}}const Tn=e=>{const t=e.toLowerCase();return"th"===t?"td":t},Dn=(e,t)=>{const n={},r=t.normaliseNbsp?e=>e.replace("\xa0"," "):w;return new Rn(e,t).reduce(((e,o)=>{const i=yn(o,t.atomicSelectors);return i.fold((()=>{switch(!0){case Vt(o):return e+r(o.data);case Ft(o):const n=bn(Tn(o.nodeName.toLowerCase()));return e+n;case Bt(o):const i=o.nodeName.toLowerCase()+(t.trackComment(o)?o.data:""),s=bn(Tn(i));return e+s;default:return e}}),(t=>{n[t]=(n[t]||0)+1;const r=o.nodeName+i+n[t];return e+bn(r)}))}),"")},On=e=>Vt(e)?e.length:1,Pn=e=>"tr"===e.nodeName.toLowerCase(),In={skipChildren:Pn,skipSelf:e=>!Pn(e)},Ln=e=>"colgroup"===e.nodeName.toLowerCase(),$n={skipChildren:Ln,skipSelf:e=>!Ln(e)},jn=(e,t,n)=>{const r=Wt(t),{diffText:o,skipSelf:i,skipChildren:s}=n,a=e=>!i(e),l=(e,t)=>P(mn(e,M.from(t)),a).length,c=e=>Ft(e)&&i(e),u=(e,t)=>H(P(mn(e,M.from(t)),c)),h=e=>Ft(e)&&yn(e,n.atomicSelectors).isSome(),f=o(Dn(e,n),Dn(t,n));let d=0;const g=new Rn(e,n),_=new Rn(t,n);let m,v,y,b,w,x=0,C=0,S=0;y=f[d++],({done:m,value:b}=g.next()),({done:v,value:w}=_.next());const k=nn([],r);let E=k,A=0,N=k,T=0,$=M.none(),U=M.none();const B=new Map,F=new Map,V=new Array,z=new Map,K=new Map,W=new Set,G=new Set,Q=e=>Vt(e)||Ft(e)&&en(e),J=(e,t)=>{const r=u(b,e),o=u(w,t),{pass:i,fail:s}=O(r,(e=>!dn(e,n.ignoreAttributes))),{pass:a,fail:l}=O(o,(e=>!dn(e,n.ignoreAttributes))),c=s.length!==l.length||R(s,((e,t)=>{const r=l[t];return Ft(e)&&Ft(r)&&!gn(e,r,n.ignoreAttributes)}));return{nonIgnoredChanged:i.length!==a.length||R(i,((e,t)=>!pn(e,a[t],!1,n.ignoreAttributes))),ignoredChanged:c,formatsToStore:o}},X={table:e=>V.push({newTable:w,oldTable:b,outputTable:e}),tr:e=>z.set(e,{newRow:w,oldRow:b}),colgroup:e=>K.set(e,{newRow:w,oldRow:b})},Y=()=>{const t=l(b,e);for(;A>t;)Gt(E).fold((()=>{vn()}),(e=>{$.each((e=>{E===e&&($=M.none())})),E=e,A--}));A!==t&&vn()},Z=()=>{const e=l(w,t);for(;T>e;)Gt(N).fold((()=>{vn()}),(e=>{U.each((e=>{N===e&&(U=M.none())})),N=e,T--}));T!==e&&vn()},ee=r=>{if((E!==N||U.isSome()||$.isSome())&&vn(),Vt(r)){const{nonIgnoredChanged:n,formatsToStore:o,ignoredChanged:i}=J(e,t);o.length>0&&F.set(r,o),n?B.set(r,"modify"):i&&W.add(r)}else if(!Ft(r)||h(b)||h(w))Bt(r)&&(n.trackComment(r)||W.add(r));else{const{nonIgnoredChanged:o,formatsToStore:i,ignoredChanged:s}=J(e,t);i.length>0&&en(w)&&F.set(r,i);const a=!pn(b,w,!1,n.ignoreAttributes)||en(w)&&o,l=Ft(b)&&Ft(w)&&!gn(b,w,n.ignoreAttributes);a||o?B.set(r,"modify"):(s||l)&&W.add(r);const c=b.nodeName.toLowerCase();X[c]&&X[c](r)}N.appendChild(r),E=r,N=r,A++,T++},te=t=>{$.isNone()&&($=M.from(t),B.set(t,"remove"));const n=u(b,e);n.length>0&&Q(t)&&F.set(t,n),E.appendChild(t),E=t,A++},ne=e=>{U.isNone()&&(U=M.from(e),B.set(e,"insert"));const n=u(w,t);n.length>0&&Q(e)&&F.set(e,n),N.appendChild(e),N=e,T++},re=e=>{const t=y[1].length;x+=e,x===t?(y=f[d++],x=0):x>t&&vn()},oe=e=>{const t=On(b);C+=e,C===t?(({done:m,value:b}=g.next()),C=0):C>t&&vn()},ie=e=>{const t=On(w);S+=e,S===t?(({done:v,value:w}=_.next()),S=0):S>t&&vn()};for(;y;){let e,t;switch(y[0]){case cn:m&&vn(),Y(),e=Math.min(y[1].length-x,On(b)-C),t=y[1].substring(x,x+e),te(Vt(b)?jt(t,r):h(b)?an(b):sn(b)),re(e),oe(e);break;case 1:v&&vn(),Z(),e=Math.min(y[1].length-x,On(w)-S),t=y[1].substring(x,x+e),ne(Vt(w)?jt(t,r):h(w)?an(w):sn(w)),re(e),ie(e);break;default:(m||v)&&vn(),Y(),Z(),e=Math.min(y[1].length-x,On(b)-C,On(w)-S),t=y[1].substring(x,x+e);const o=()=>E===N,i=()=>Vt(b)&&Vt(w),a=()=>Tn(b.nodeName)===Tn(w.nodeName),l=()=>!s(b)&&!s(w);if(h(b)&&h(w)){const e=an(w);ee(e),G.add(e)}else o()&&(i()||a()&&l()||pn(b,w,!1,n.ignoreAttributes)||un(b,w))?ee(Vt(w)?jt(t,r):sn(w)):(te(Vt(b)?jt(t,r):sn(b)),ne(Vt(w)?jt(t,r):sn(w)));re(e),oe(e),ie(e)}}B.forEach(((e,t)=>{var r,o;if(t.nodeType!==Node.COMMENT_NODE||n.trackComment(t)){if("remove"===e){const e=t;let n=Xt(e).getOrNull();for(;p(n)&&Mn(B,n,"insert");)null===(o=n.parentNode)||void 0===o||o.insertBefore(e,n),n=Xt(e).getOrNull()}}else"remove"===e&&(null===(r=t.parentNode)||void 0===r||r.removeChild(t)),W.add(t),B.delete(t)})),V.forEach((e=>{var t,r,o;const{newTable:i,oldTable:s,outputTable:a}=e,l=e=>{return(t=e,(e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount)(t)?[]:q(t.querySelectorAll("td[colspan],th[colspan],td[rowspan],th[rowspan]"))).length>0;var t};if(!kn(s,!0)||!kn(i,!0)||!kn(a,!1)||(l(i)||l(s))&&(c=z,!j(Array.from(c.values()),(({oldRow:e,newRow:t})=>((e,t)=>{const n=Zt(e),r=Zt(t);for(let e=0;e<Math.min(n.length,r.length);e++){const t=n[e],o=r[e];if(Ft(t)&&Ft(o)){const e=Dt(t,"colspan")||"1",n=Dt(o,"colspan")||"1",r=Dt(t,"rowspan")||"1",i=Dt(o,"rowspan")||"1";if(e!==n||r!==i)return!1}}return!0})(e,t))))){new Rn(a).forEach((e=>{B.delete(e),F.delete(e)}));const e=an(s),n=an(i);return null===(t=a.parentNode)||void 0===t||t.insertBefore(e,a),null===(r=a.parentNode)||void 0===r||r.insertBefore(n,a),null===(o=a.parentNode)||void 0===o||o.removeChild(a),B.set(e,"remove"),void B.set(n,"insert")}var c;const u=()=>{const e={rowsChanges:[],colGroupChanges:[]},t=(e,t,r)=>{const o=En(t,e);return o.each((e=>{const{oldRow:t,newRow:o}=e,i=jn(t,o,n),s=Zt(t),a=Zt(o),l=s.length,c=a.length,u=Math.max(l,c),h=Math.min(l,c),f=i.rootOutputNode.firstElementChild,d=f?Zt(f):[];if(d.length===u)D(d,(e=>{Mn(i.combinedMap,e,"insert")?r.push(1):Mn(i.combinedMap,e,"remove")?r.push(cn):r.push(0)}));else{let e=0,t=0;for(;e<h;)r[e++]=t;for(t=l<c?1:-1;e<u;)r[e++]=t}})),o.isSome()};new Rn(a,$n).some((n=>t(n,K,e.colGroupChanges)));const r=new Rn(a,In).toArray(),o=P(r,(e=>En(z,e).isSome())),i=L(o,(e=>{var t,n;return(null!==(n=null===(t=e.textContent)||void 0===t?void 0:t.replace(/\s+/g,""))&&void 0!==n?n:"").length>0})).orThunk((()=>M.from(o[0])));return i.fold((()=>e.rowsChanges.push(0)),(n=>t(n,z,e.rowsChanges))),e},h=e=>{const t=new Rn(e);for(t.next(),t.forEach((e=>{B.delete(e),F.delete(e)}));e.firstChild;)e.removeChild(e.firstChild)},f=(e,t,n,r)=>{if(!n||t.length>=n.length)return;const o=r?cn:1;for(let i=0;i<n.length;i++)if(n[i]===o){const n=$t("td"),o=p(t[i])?t[i]:null;e.insertBefore(n,o),r&&B.set(n,"remove")}},d=(e,t,r,o)=>{let i=0,s=0;for(const a of o)if(1===a){if(s<r.length){const t=an(r[s++]);e.appendChild(t),B.set(t,"insert")}}else if(a===cn){if(i<t.length){const n=an(t[i++]);e.appendChild(n),B.set(n,"remove")}}else if(0===a&&i<t.length&&s<r.length){const o=jn(t[i++],r[s++],n);for(const[e,t]of o.combinedMap)B.set(e,t);for(const[e,t]of o.formattingMap)F.set(e,t);for(const e of o.ignoreSet)W.add(e);e.appendChild(o.rootOutputNode)}};(()=>{const e=e=>Mn(B,e,"insert")?1:Mn(B,e,"remove")?cn:0;if(l(i)||l(s)){const t=(e=>{const t=(e=>{const t=[];return new Rn(a,In).forEach((n=>{En(z,n).each((r=>{const{oldRow:o,newRow:i}=r,s=Zt(o),a=Zt(i),l=s.length,c=a.length,u=Math.max(l,c),h=Math.min(l,c),f=[],d=Zt(n);if(d.length===u)for(let t=0;t<d.length;t++)f.push(e(d[t]));else{let e=0;for(;e<h;)f[e++]=0;const t=l<c?1:cn;for(;e<u;)f[e++]=t}t.push(f)}))})),t})(e);return 0===t.length&&vn(),new Rn(a,In).forEach(((n,r)=>{const o=Zt(n);Qt(n).each((i=>{if(Mn(B,n,"insert")||Mn(B,i,"insert"))f(n,o,t[r],!0);else if(Mn(B,n,"remove")||Mn(B,i,"remove"))f(n,o,t[r],!1);else{const i=t=>j(o,((n,r)=>!p(t)||e(n)===t[r]));i(t[r])||(h(n),En(z,n).each((({newRow:e,oldRow:o})=>{const i=Zt(e),s=Zt(o);d(n,s,i,t[r])})))}}))})),t})(e);u().colGroupChanges.length>0&&(e=>{new Rn(a,$n).forEach((t=>{j(e[0],(e=>0===e))||(h(t),En(K,t).each((({newRow:n,oldRow:r})=>{const o=Zt(n),i=Zt(r),s=I(e,((e,t)=>t.length>e.length?t:e),[]);d(t,i,o,s)})))}))})(t)}else{const n=(e=>{const t=u();return 0===t.rowsChanges.length&&vn(),new Rn(a,In).forEach((n=>{const r=Zt(n);Qt(n).each((o=>{if(Mn(B,n,"insert")||Mn(B,o,"insert"))f(n,r,t.rowsChanges,!0);else if(Mn(B,n,"remove")||Mn(B,o,"remove"))f(n,r,t.rowsChanges,!1);else{const o=j(r,((n,r)=>e(n)===t.rowsChanges[r]));o||(h(n),En(z,n).each((({newRow:e,oldRow:r})=>{const o=Zt(e),i=Zt(r);d(n,i,o,t.rowsChanges)})))}}))})),t})(e);n.colGroupChanges.length>0&&(t=n.rowsChanges,new Rn(a,$n).forEach((e=>{j(t,(e=>0===e))||(h(e),En(K,e).each((({newRow:n,oldRow:r})=>{const o=Zt(n),i=Zt(r);d(e,i,o,t)})))})))}var t})()}));const se=e=>{W.add(e),D(Zt(e),se)};return G.forEach((e=>{W.add(e),D(Zt(e),se)})),{ignoreSet:W,rootOutputNode:k,combinedMap:B,formattingMap:F}},Un=(e,t)=>{const n=[`pre ins.${t.addedClass}`,`pre del.${t.removedClass}`].join(","),r=q(e.querySelectorAll(n));D(r,(e=>{const t=e.innerHTML.replace(/\n/g,'<span data-mce-newline-placeholder="1">&nbsp;</span>\n');((e,t)=>{const n=Kt(e),r=n.createDocumentFragment();((e,t)=>{D(t,(t=>{e.appendChild(t)}))})(r,tn(t,n)),e.textContent="",e.appendChild(r)})(e,t)}))},Hn=(e,t,n)=>((e,t)=>(D([Un],(n=>{n(e,t)})),e))(((e,t,n)=>((e,t)=>{const{rootOutputNode:n,combinedMap:r,formattingMap:o}=e;return r.forEach(((e,n)=>{switch(e){case"remove":Sn(n,"del",t.removedClass);break;case"insert":Sn(n,"ins",t.addedClass);break;case"modify":t.skipModified||Sn(n,"ins",t.modifiedClass)}})),o.forEach(((e,t)=>{e.forEach((e=>{Xt(t).filter((t=>pn(t,e))).fold((()=>{const n=sn(e);rn(t,n)}),(e=>e.appendChild(t)))}))})),n})(jn(e,t,n),n))(e,t,(({addedClass:e="vdd-added",modifiedClass:t="vdd-modified",removedClass:n="vdd-removed",skipModified:r=!1,skipChildren:o,skipSelf:i,diffText:s=xn,normaliseNbsp:a=!1,atomicSelectors:l,ignoreAttributes:c,trackComment:u}={})=>({addedClass:e,diffText:s,modifiedClass:t,removedClass:n,skipModified:r,skipChildren:e=>{var t;return!Ft(e)&&!zt(e)&&!qt(e)&&!Bt(e)||(null!==(t=null==o?void 0:o(e))&&void 0!==t?t:An.has(e.nodeName.toLowerCase()))||!(!Ft(e)||!p(l))&&R(l,(t=>e.matches(t)))},skipSelf:e=>{var t;return!Vt(e)&&!Ft(e)&&!Bt(e)||(null!==(t=null==i?void 0:i(e))&&void 0!==t?t:Nn.has(e.nodeName.toLowerCase())&&!en(e))},normaliseNbsp:a,trackComment:e=>m(u)&&u(e),atomicSelectors:null!=l?l:[],ignoreAttributes:null!=c?c:{}}))(n)),n),Bn=(e,t,n)=>je(((e,t,n)=>{const r={addedClass:n.addition,removedClass:n.removal,modifiedClass:n.modification},o=nn(tn(e)),i=nn(tn(t));return Hn(o,i,r)})(e,t,n));var Fn;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(Fn||(Fn={}));const Vn=(e,t,n)=>e.stype===Fn.Error?t(e.serror):n(e.svalue),qn=e=>({stype:Fn.Value,svalue:e}),zn=e=>({stype:Fn.Error,serror:e}),Kn=Vn,Wn=e=>h(e)&&z(e).length>100?" removed due to size":JSON.stringify(e,null,2),Gn=(e,t)=>zn([{path:e,getErrorInfo:t}]),Qn=(Jn=u,(e=>({extract:(t,n)=>((e,t)=>e.stype===Fn.Error?t(e.serror):e)(e(n),(e=>((e,t)=>Gn(e,b(t)))(t,e))),toString:b("val")}))((e=>{const t=typeof e;return Jn(e)?qn(e):zn(`Expected type: string but got: ${t}`)})));var Jn;const Xn=(e,t,n)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return n(e.newKey,e.instantiator)}},Yn=(e,t,n,r)=>r(X(e,t).getOrThunk((()=>n(e)))),Zn=(e,t,n,r,o)=>{const i=e=>o.extract(t.concat([r]),e),s=e=>e.fold((()=>qn(M.none())),(e=>((e,t)=>e.stype===Fn.Value?{stype:Fn.Value,svalue:t(e.svalue)}:e)(o.extract(t.concat([r]),e),M.some)));switch(e.tag){case"required":return((e,t,n,r)=>X(t,n).fold((()=>((e,t,n)=>Gn(e,(()=>'Could not find valid *required* value for "'+t+'" in '+Wn(n))))(e,n,t)),r))(t,n,r,i);case"defaultedThunk":return Yn(n,r,e.process,i);case"option":return((e,t,n)=>n(X(e,t)))(n,r,s);case"defaultedOptionThunk":return((e,t,n,r)=>r(X(e,t).map((t=>!0===t?n(e):t))))(n,r,e.process,s);case"mergeWithThunk":return Yn(n,r,b({}),(t=>{const r=ie(e.process(n),t);return i(r)}))}},er=(e,t,n)=>{return r=((e,t,n)=>((e,t)=>e.stype===Fn.Error?{stype:Fn.Error,serror:t(e.serror)}:e)(t.extract([e],n),(e=>({input:n,errors:e}))))(e,t,n),Vn(r,ne.error,ne.value);var r},tr=(e,t,n,r)=>({tag:"field",key:e,newKey:t,presence:n,prop:r}),nr=e=>((e,t)=>tr(e,e,{tag:"option",process:{}},t))(e,Qn),rr=["#E41B60","#AD1457","#1939EC","#001CB5","#648000","#465B00","#006CE7","#0054B4","#00838F","#006064","#00866F","#004D40","#51742F","#385021","#CF4900","#A84600","#CC0000","#6A1B9A","#9C27B0","#6A00AB","#3041BA","#0A1877","#774433","#452B24","#607D8B","#455A64"],or=(e,t={size:36})=>{return n=(e=>{if(Intl.Segmenter){const t=(new Intl.Segmenter).segment(e)[Symbol.iterator]();return`${t.next().value?.segment}`}return e.trim()[0]})(e.name),r=(e=>{const t=((e,t)=>{let n=5381;for(let t=0;t<e.length;t++)n=(n<<5)+n+e.charCodeAt(t);return(n>>>0)%(t+1)})(e??"",rr.length-1);return rr[t]})(e.id),o=t.size,"data:image/svg+xml,"+encodeURIComponent(((e,t,n)=>{const r=n/2;return`<svg height="${n}" width="${n}" xmlns="http://www.w3.org/2000/svg"><circle cx="${r}" cy="${r}" r="${r}" fill="${t}"/><text x="50%" y="50%" text-anchor="middle" dominant-baseline="central" fill="#FFF" font-family="sans-serif" font-size="${r}">`+e+"</text></svg>"})(n,r,o));var n,r,o},ir=(ar=[(sr=Qn,tr("id","id",{tag:"required",process:{}},sr)),nr("name"),nr("avatar")],{extract:(e,t)=>((e,t,n)=>{const r={},o=[];for(const i of n)Xn(i,((n,i,s,a)=>{const l=Zn(s,e,t,n,a);Kn(l,(e=>{o.push(...e)}),(e=>{r[i]=e}))}),((e,n)=>{r[e]=n(t)}));return o.length>0?zn(o):qn(r)})(e,t,ar),toString:()=>{const e=T(ar,(e=>Xn(e,((e,t,n,r)=>e+" -> "+r.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+e.join("\n")+"}"}});var sr,ar;const lr=()=>({id:"anonymous",name:"Anonymous",avatar:or({id:"anonymous",name:"Anonymous"})}),cr=e=>er("revisionhistory_author",ir,e).fold((e=>{return{valid:!1,message:(t=e,"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:b("... (only showing first ten failures)")}]):e;return T(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(t.errors).join("\n")+"\n\nInput object: "+Wn(t.input))};var t}),(e=>({valid:!0,value:e}))),ur=e=>{const t=e.id,n=e.name.filter(ue).getOr("Anonymous"),r=e.avatar.filter(ue).getOrThunk((()=>or({id:t,name:n})));return{id:t,name:n,avatar:r}},hr=e=>{if(!("author"in e)||_(e.author)){const{revisionId:t,content:n,createdAt:r}=e;return{revisionId:t,content:n,createdAt:r,author:lr()}}const t=cr(e.author),n=t.valid?ur(t.value):lr();return{...e,author:n}},fr={addition:"tox-revisionhistory__annotation--added",removal:"tox-revisionhistory__annotation--removed",modification:"tox-revisionhistory__annotation--modified"},dr=e=>t=>t.options.get(e),gr=e=>t=>M.from(dr(e)(t)).filter(m),_r=(pr="revisionhistory_fetch",e=>gr(pr)(e).getOrDie(pr+" has not been implemented."));var pr;const mr=gr("revisionhistory_fetch_revision"),vr=dr("revisionhistory_css_url"),yr=e=>{const t=M.from(e.options.get("revisionhistory_diff_classes")).getOr({});return G(fr,((e,n)=>X(t,n).getOr(e)))},br=dr("revisionhistory_display_author"),wr=dr("body_class"),xr=dr("content_style"),Cr=dr("content_css_cors"),Sr=dr("revisionhistory_allow_restore"),kr=(e,t)=>tinymce.html.Serializer({validate:!0},e.schema).serialize(e.parser.parse(t)),Mr=async(e,t)=>{const n=(e=>kr(e,e.getContent()))(e),r=await(async e=>{if(e.options.isSet("revisionhistory_author")){const t=e.options.get("revisionhistory_author");return ur(t)}return(async e=>{try{const t=e.userLookup.userId;return e.userLookup.fetchUsers([t])[t]}catch(e){return console.warn("Failed to generate fallback user:",e),lr()}})(e)})(e);return{content:n,createdAt:(new Date).toISOString(),revisionId:oe("tinymce"),internalType:t,author:r}};var Er,Ar,Nr,Rr,Tr,Dr,Or,Pr,Ir,Lr,$r,jr={},Ur=[],Hr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Br=Array.isArray;function Fr(e,t){for(var n in t)e[n]=t[n];return e}function Vr(e){var t=e.parentNode;t&&t.removeChild(e)}function qr(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==o?++Nr:o,__i:-1,__u:0};return null==o&&null!=Ar.vnode&&Ar.vnode(i),i}function zr(e){return e.children}function Kr(e,t){this.props=e,this.context=t}function Wr(e,t){if(null==t)return e.__?Wr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Wr(e):null}function Gr(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Gr(e)}}function Qr(e){(!e.__d&&(e.__d=!0)&&Rr.push(e)&&!Jr.__r++||Tr!==Ar.debounceRendering)&&((Tr=Ar.debounceRendering)||Dr)(Jr)}function Jr(){var e,t,n,r,o,i,s,a;for(Rr.sort(Or);e=Rr.shift();)e.__d&&(t=Rr.length,r=void 0,i=(o=(n=e).__v).__e,s=[],a=[],n.__P&&((r=Fr({},o)).__v=o.__v+1,Ar.vnode&&Ar.vnode(r),oo(n.__P,r,o,n.__n,void 0!==n.__P.ownerSVGElement,32&o.__u?[i]:null,s,null==i?Wr(o):i,!!(32&o.__u),a),r.__v=o.__v,r.__.__k[r.__i]=r,io(s,r,a),r.__e!=i&&Gr(r)),Rr.length>t&&Rr.sort(Or));Jr.__r=0}function Xr(e,t,n,r,o,i,s,a,l,c,u){var h,f,d,g,_,p=r&&r.__k||Ur,m=t.length;for(n.__d=l,Yr(n,t,p),l=n.__d,h=0;h<m;h++)null!=(d=n.__k[h])&&"boolean"!=typeof d&&"function"!=typeof d&&(f=-1===d.__i?jr:p[d.__i]||jr,d.__i=h,oo(e,d,f,o,i,s,a,l,c,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&ao(f.ref,null,d),u.push(d.ref,d.__c||g,d)),null==_&&null!=g&&(_=g),65536&d.__u||f.__k===d.__k?(l&&!l.isConnected&&(l=Wr(f)),l=Zr(d,l,e)):"function"==typeof d.type&&void 0!==d.__d?l=d.__d:g&&(l=g.nextSibling),d.__d=void 0,d.__u&=-196609);n.__d=l,n.__e=_}function Yr(e,t,n){var r,o,i,s,a,l=t.length,c=n.length,u=c,h=0;for(e.__k=[],r=0;r<l;r++)s=r+h,null!=(o=e.__k[r]=null==(o=t[r])||"boolean"==typeof o||"function"==typeof o?null:"string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?qr(null,o,null,null,null):Br(o)?qr(zr,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?qr(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)?(o.__=e,o.__b=e.__b+1,a=eo(o,n,s,u),o.__i=a,i=null,-1!==a&&(u--,(i=n[a])&&(i.__u|=131072)),null==i||null===i.__v?(-1==a&&h--,"function"!=typeof o.type&&(o.__u|=65536)):a!==s&&(a===s+1?h++:a>s?u>l-s?h+=a-s:h--:a<s?a==s-1&&(h=a-s):h=0,a!==r+h&&(o.__u|=65536))):(i=n[s])&&null==i.key&&i.__e&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=Wr(i)),lo(i,i,!1),n[s]=null,u--);if(u)for(r=0;r<c;r++)null!=(i=n[r])&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=Wr(i)),lo(i,i))}function Zr(e,t,n){var r,o;if("function"==typeof e.type){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=Zr(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function eo(e,t,n,r){var o=e.key,i=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&o==l.key&&i===l.type&&!(131072&l.__u))return n;if(r>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&i===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&o==l.key&&i===l.type)return a;a++}}return-1}function to(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Hr.test(t)?n:n+"px"}function no(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||to(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||to(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=Pr,e.addEventListener(t,i?Lr:Ir,i)):e.removeEventListener(t,i?Lr:Ir,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function ro(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=Pr++;else if(t.t<n.u)return;return n(Ar.event?Ar.event(t):t)}}}function oo(e,t,n,r,o,i,s,a,l,c){var u,h,f,d,g,_,p,m,v,y,b,w,x,C,S,k=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=t.__e=n.__e]),(u=Ar.__b)&&u(t);e:if("function"==typeof k)try{if(m=t.props,v=(u=k.contextType)&&r[u.__c],y=u?v?v.props.value:u.__:r,n.__c?p=(h=t.__c=n.__c).__=h.__E:("prototype"in k&&k.prototype.render?t.__c=h=new k(m,y):(t.__c=h=new Kr(m,y),h.constructor=k,h.render=co),v&&v.sub(h),h.props=m,h.state||(h.state={}),h.context=y,h.__n=r,f=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=k.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Fr({},h.__s)),Fr(h.__s,k.getDerivedStateFromProps(m,h.__s))),d=h.props,g=h.state,h.__v=t,f)null==k.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==k.getDerivedStateFromProps&&m!==d&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,y),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,y)||t.__v===n.__v)){for(t.__v!==n.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),b=0;b<h._sb.length;b++)h.__h.push(h._sb[b]);h._sb=[],h.__h.length&&s.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,y),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(d,g,_)}))}if(h.context=y,h.props=m,h.__P=e,h.__e=!1,w=Ar.__r,x=0,"prototype"in k&&k.prototype.render){for(h.state=h.__s,h.__d=!1,w&&w(t),u=h.render(h.props,h.state,h.context),C=0;C<h._sb.length;C++)h.__h.push(h._sb[C]);h._sb=[]}else do{h.__d=!1,w&&w(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++x<25);h.state=h.__s,null!=h.getChildContext&&(r=Fr(Fr({},r),h.getChildContext())),f||null==h.getSnapshotBeforeUpdate||(_=h.getSnapshotBeforeUpdate(d,g)),Xr(e,Br(S=null!=u&&u.type===zr&&null==u.key?u.props.children:u)?S:[S],t,n,r,o,i,s,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&s.push(h),p&&(h.__E=h.__=null)}catch(e){t.__v=null,l||null!=i?(t.__e=a,t.__u|=l?160:32,i[i.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),Ar.__e(e,t,n)}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=so(n.__e,t,n,r,o,i,s,l,c);(u=Ar.diffed)&&u(t)}function io(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)ao(n[r],n[++r],n[++r]);Ar.__c&&Ar.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Ar.__e(e,t.__v)}}))}function so(e,t,n,r,o,i,s,a,l){var c,u,h,f,d,g,_,p=n.props,m=t.props,v=t.type;if("svg"===v&&(o=!0),null!=i)for(c=0;c<i.length;c++)if((d=i[c])&&"setAttribute"in d==!!v&&(v?d.localName===v:3===d.nodeType)){e=d,i[c]=null;break}if(null==e){if(null===v)return document.createTextNode(m);e=o?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,m.is&&m),i=null,a=!1}if(null===v)p===m||a&&e.data===m||(e.data=m);else{if(i=i&&Er.call(e.childNodes),p=n.props||jr,!a&&null!=i)for(p={},c=0;c<e.attributes.length;c++)p[(d=e.attributes[c]).name]=d.value;for(c in p)d=p[c],"children"==c||("dangerouslySetInnerHTML"==c?h=d:"key"===c||c in m||no(e,c,null,d,o));for(c in m)d=m[c],"children"==c?f=d:"dangerouslySetInnerHTML"==c?u=d:"value"==c?g=d:"checked"==c?_=d:"key"===c||a&&"function"!=typeof d||p[c]===d||no(e,c,d,p[c],o);if(u)a||h&&(u.__html===h.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(h&&(e.innerHTML=""),Xr(e,Br(f)?f:[f],t,n,r,o&&"foreignObject"!==v,i,s,i?i[0]:n.__k&&Wr(n,0),a,l),null!=i)for(c=i.length;c--;)null!=i[c]&&Vr(i[c]);a||(c="value",void 0!==g&&(g!==e[c]||"progress"===v&&!g||"option"===v&&g!==p[c])&&no(e,c,g,p[c],!1),c="checked",void 0!==_&&_!==e[c]&&no(e,c,_,p[c],!1))}return e}function ao(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Ar.__e(e,n)}}function lo(e,t,n){var r,o;if(Ar.unmount&&Ar.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ao(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Ar.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&lo(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||Vr(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function co(e,t,n){return this.constructor(e,n)}function uo(e,t,n){var r,o,i;Ar.__&&Ar.__(e,t),r=t.__k,o=[],i=[],oo(t,e=t.__k=function(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?Er.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return qr(e,s,r,o,null)}(zr,null,[e]),r||jr,jr,void 0!==t.ownerSVGElement,r?null:t.firstChild?Er.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1,i),io(o,e,i)}Er=Ur.slice,Ar={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},Nr=0,Kr.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=Fr({},this.state),"function"==typeof e&&(e=e(Fr({},n),this.props)),e&&Fr(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),Qr(this))},Kr.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Qr(this))},Kr.prototype.render=zr,Rr=[],Dr="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Or=function(e,t){return e.__v.__b-t.__v.__b},Jr.__r=0,Pr=0,Ir=ro(!1),Lr=ro(!0),$r=0;var ho=0;function fo(e,t,n,r,o,i){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--ho,__i:-1,__u:0,__source:o,__self:i};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Ar.vnode&&Ar.vnode(c),c}var go,_o,po,mo,vo=0,yo=[],bo=[],wo=Ar,xo=wo.__b,Co=wo.__r,So=wo.diffed,ko=wo.__c,Mo=wo.unmount,Eo=wo.__;function Ao(e,t){wo.__h&&wo.__h(_o,e,vo||t),vo=0;var n=_o.__H||(_o.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:bo}),n.__[e]}function No(e){return vo=1,function(e,t){var n=Ao(go++,2);if(n.t=e,!n.__c&&(n.__=[Ho(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);t!==r&&(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=_o,!_o.u)){var r=function(e,t,r){if(!n.__c.__H)return!0;var i=n.__c.__H.__.filter((function(e){return!!e.__c}));if(i.every((function(e){return!e.__N})))return!o||o.call(this,e,t,r);var s=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&n.__c.props===e)&&(!o||o.call(this,e,t,r))};_o.u=!0;var o=_o.shouldComponentUpdate,i=_o.componentWillUpdate;_o.componentWillUpdate=function(e,t,n){if(this.__e){var s=o;o=void 0,r(e,t,n),o=s}i&&i.call(this,e,t,n)},_o.shouldComponentUpdate=r}return n.__N||n.__}(Ho,e)}function Ro(e,t){var n=Ao(go++,3);!wo.__s&&Uo(n.__H,t)&&(n.__=e,n.i=t,_o.__H.__h.push(n))}function To(e){return vo=5,Do((function(){return{current:e}}),[])}function Do(e,t){var n=Ao(go++,7);return Uo(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Oo(e){var t=_o.context[e.__c],n=Ao(go++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(_o)),t.props.value):e.__}function Po(){for(var e;e=yo.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach($o),e.__H.__h.forEach(jo),e.__H.__h=[]}catch(t){e.__H.__h=[],wo.__e(t,e.__v)}}wo.__b=function(e){_o=null,xo&&xo(e)},wo.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Eo&&Eo(e,t)},wo.__r=function(e){Co&&Co(e),go=0;var t=(_o=e.__c).__H;t&&(po===_o?(t.__h=[],_o.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=bo,e.__N=e.i=void 0}))):(t.__h.forEach($o),t.__h.forEach(jo),t.__h=[],go=0)),po=_o},wo.diffed=function(e){So&&So(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==yo.push(t)&&mo===wo.requestAnimationFrame||((mo=wo.requestAnimationFrame)||Lo)(Po)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==bo&&(e.__=e.__V),e.i=void 0,e.__V=bo}))),po=_o=null},wo.__c=function(e,t){t.some((function(e){try{e.__h.forEach($o),e.__h=e.__h.filter((function(e){return!e.__||jo(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],wo.__e(n,e.__v)}})),ko&&ko(e,t)},wo.unmount=function(e){Mo&&Mo(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{$o(e)}catch(e){t=e}})),n.__H=void 0,t&&wo.__e(t,n.__v))};var Io="function"==typeof requestAnimationFrame;function Lo(e){var t,n=function(){clearTimeout(r),Io&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Io&&(t=requestAnimationFrame(n))}function $o(e){var t=_o,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),_o=t}function jo(e){var t=_o;e.__c=e.__(),_o=t}function Uo(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Ho(e,t){return"function"==typeof t?t(e):t}const Bo=e=>{const t=new Date(e),n=t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),r=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0});return`${n.replace(",","")}, ${r}`},Fo=e=>p(e.content)?e.content:"",Vo=({children:e,politenessSetting:t="polite",className:n})=>fo("div",{style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px"},"aria-live":t,className:n,children:e});var qo=function(e,t){var n={__c:t="__cC"+$r++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,Qr(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}(M.none());const zo=e=>(t,n,r)=>{const o=e(t);return Go(o,t,n,r)},Ko=(e,t)=>{const n=Ct(e,t);return zo(n)},Wo=(e,t)=>{const n=Ct(t,e);return zo(n)},Go=(e,t,n,r)=>r.focusManager.get(t).bind((n=>e(t,n,r))).map((e=>(r.focusManager.set(t,e),!0))),Qo=(e,t,n)=>{const r=Tt(e,n);return(e=>$(e,(e=>Be(e,t))).map((t=>({index:t,candidates:e}))))(P(r,xt))},Jo=(e,t,n,r,o)=>{const i=(e,t,n)=>o(e,t,r,0,n.length-1,n[t],(t=>{return"button"===(r=n[t]).dom.nodeName.toLowerCase()&&"disabled"===gt(r,"disabled")?i(e,t,n):M.from(n[t]);var r}));return Qo(e,n,t).bind((e=>{const t=e.index,n=e.candidates;return i(t,t,n)}))},Xo=(e,t,n,r)=>Jo(e,t,n,r,((e,t,n,r,o,i,s)=>{const a=((e,t,n)=>Math.min(Math.max(e,t),n))(t+n,r,o);return a===e?M.from(i):s(a)})),Yo=(e,t,n,r)=>Jo(e,t,n,r,((e,t,n,r,o,i,s)=>{const a=((e,t,n,r)=>{const o=e+t;return o>r?n:o<n?r:o})(t,n,r,o);return a===e?M.none():s(a)})),Zo=()=>({get:e=>{return((e=(()=>je(document))())=>M.from(e.dom.activeElement).map(je))(ht(t=e)).filter((e=>t.dom.contains(e.dom)));var t},set:(e,t)=>{t.dom.focus(),t.dom.dispatchEvent(new window.Event("Focus"))}});var ei;!function(e){e.OnFocusMode="onFocus"}(ei||(ei={}));const ti=(e,t)=>({matches:e,classification:t}),ni=(e,t,n,r)=>{const o={...e,focusManager:Zo(),focusInside:ei.OnFocusMode,focusIn:r},i=(e,t,n)=>((e,t)=>{const n=L(e,(e=>e.matches(t)));return n.map((e=>e.classification))})(n(e,t,o),t).bind((n=>n(e,t,o)));return{handleKeydown:(e,n)=>i(e,n,t).each((e=>{n.preventDefault(),n.stopPropagation()})),handleKeyup:(e,t)=>i(e,t,n).each((()=>{t.preventDefault(),t.stopPropagation()})),handleFocus:(e,t)=>{r(o).each((n=>{n(e,o),t.preventDefault(),t.stopPropagation()}))}}},ri=e=>t=>N(e,t.which),oi=[9],ii=[13],si=[37],ai=[38],li=[39],ci=[40],ui=[32],hi=(e,t)=>{const n=(e,t,n)=>((e,t)=>t.focusManager.get(e).bind((e=>Et(e,t.selector))))(e,n).bind((e=>n.execute(e))),r=(e,t)=>{((e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return He(n)?M.none():M.from(n.querySelector(e)).map(je)})(t,e))(e,t.selector).each((n=>{t.focusManager.set(e,n)}))},o=(e,t,n)=>(n.cycles?Yo:Xo)(e,n.selector,t,-1),i=(e,t,n)=>(n.cycles?Yo:Xo)(e,n.selector,t,1),s=e=>(t,n,r)=>e(t,n,r),a=b([]),l=ni({selector:t,execute:e=>(e.dom.dispatchEvent(new window.Event("click")),M.some(!0)),allowVertical:!0,allowHorizontal:!0,cycles:!0},((e,t,r)=>{const a=[...r.allowHorizontal?si:[]].concat(r.allowVertical?ai:[]),l=[...r.allowHorizontal?li:[]].concat(r.allowVertical?ci:[]);return[ti(ri(a),s(Ko(o,i))),ti(ri(l),s(Wo(o,i))),ti(ri(ii),n),ti(ri(ui),n)]}),a,(()=>M.some(r)));return{keydown:t=>l.handleKeydown(e,t),keyup:t=>l.handleKeyup(e,t),focus:t=>l.handleFocus(e,t)}},fi=(e,t,n)=>{const r=H(e.slice(0,t)),o=H(e.slice(t+1));return L(r.concat(o),n)},di=(e,t,n)=>{const r=H(e.slice(0,t));return L(r,n)},gi=(e,t,n)=>{const r=e.slice(0,t),o=e.slice(t+1);return L(o.concat(r),n)},_i=(e,t,n)=>{const r=e.slice(t+1);return L(r,n)},pi=(e,t)=>t.focusManager.get(e).bind((e=>Et(e,t.selector))),mi=(e,t)=>{((e,t)=>{const n=Tt(e,t.selector),r=P(n,(e=>(e=>wt.get(e))(e)>0));return M.from(r[t.firstTabstop])})(e,t).each((n=>t.focusManager.set(e,n)))},vi=(e,t,n,r)=>{const o=Tt(e,n.selector);return pi(e,n).bind((t=>$(o,function(e,...t){return(...n)=>{const r=t.concat(n);return e.apply(null,r)}}(Be,t)).bind((t=>((e,t,n,r,o)=>o(t,n,(e=>((e,t)=>e.useTabstopAt(t))(r,e))).fold((()=>r.cyclic?M.some(!0):M.none()),(t=>(r.focusManager.set(e,t),M.some(!0)))))(e,o,t,n,r)))))},yi=(e,t,n)=>{const r=n.cyclic?fi:di;return vi(e,0,n,r)},bi=(e,t,n)=>{const r=n.cyclic?gi:_i;return vi(e,0,n,r)},wi=b([ti((xi=[e=>!0===e.shiftKey,ri(oi)],e=>j(xi,(t=>t(e)))),yi),ti(ri(oi),bi)]);var xi;const Ci=b([ti(ri(oi),((e,t,n)=>pi(e,n).filter((e=>!n.useTabstopAt(e))).bind((r=>((e=>{return(t=e,(e=>M.from(e.dom.parentNode).map(je))(t)).bind(ut).exists((t=>Be(t,e)));var t})(r)?yi:bi)(e,t,n)))))]),Si=(e,t)=>{const n=ni({selector:t,firstTabstop:0,useTabstopAt:k,cyclic:!0},wi,Ci,(()=>M.some(mi)));return{keydown:t=>n.handleKeydown(e,t),keyup:t=>n.handleKeyup(e,t),focus:t=>n.handleFocus(e,t)}},ki=(e,t,n)=>Do((()=>{if(e.current){const r=("tab"===n?Si:hi)(je(e.current),t);return{onKeyUp:r.keyup,onKeyDown:r.keydown,onFocus:r.focus}}return{onKeyDown:y,onKeyUp:y,onFocus:y}}),[e.current]),Mi=({items:e})=>{const t=To(null);return fo("div",{ref:t,className:"tox-view__toolbar",tabIndex:-1,...ki(t,".tox-button:not([disabled])","flow"),children:T(e,((e,t)=>{var n,r;return"title"===e.type?fo("div",{className:"tox-view__label tox-view__label--large",tabindex:-1,children:e.label},t):e.hide?null:fo("button",{className:(r=null!==(n=e.primary)&&void 0!==n&&n,"tox-button "+(r?"tox-button--primary tox-view__align-right":"tox-button--secondary")),onClick:e.onAction,type:"button",disabled:e.disabled,children:e.label},t)}))})},Ei=({id:e,avatar:t,name:n})=>{const[r,o]=No(t);return Ro((()=>{o(t)}),[t]),fo("img",{className:"tox-revisionhistory__avatar",src:r,onError:()=>{o(or({id:e,name:n}))}})},Ai=()=>{const e=Oo(qo);return fo("img",{className:"tox-revisionhistory__card-check-icon",src:Do((()=>e.map((e=>{return t=e.editor,M.from(t.ui.registry.getAll().icons.checkmark).fold(b(""),(e=>{let t=e;return ce(e,"xmlns")||(t=e.replace("svg",'svg xmlns="http://www.w3.org/2000/svg"')),`data:image/svg+xml, ${encodeURIComponent(t)}`}));var t})).getOr("")),[e])})},Ni=({revision:e,isSelected:t,onSelect:n,showAuthor:r})=>{const o=Bo(e.createdAt),i=tinymce.i18n.translate(["Revision on {0}",o]),s=Do((()=>e.author),[e]);return fo("div",{role:"listitem",children:fo("div",{"aria-pressed":t,className:"tox-revisionhistory__card "+(t?"tox-revisionhistory__card--selected":""),tabIndex:-1,onClick:n,"aria-label":i,role:"button",children:[fo("div",{children:e.internalType&&fo("span",{className:"tox-revisionhistory__card-label",children:tinymce.i18n.translate(e.internalType.toUpperCase())})}),fo("div",{className:"tox-revisionhistory__card-content",children:[r&&fo(Ei,{...s}),fo("div",{className:"tox-revisionhistory__card-info",children:[fo("span",{className:"tox-revisionhistory__card-date-label",children:o}),r&&fo("span",{className:"tox-revisionhistory__card-author-name","aria-label":s.name,children:tinymce.i18n.translate(s.name)})]}),t&&fo(Ai,{})]})]})})},Ri=({revisions:e,onRevisionSelected:t})=>{const[n,r]=No(""),o=[".tox-revisionhistory__card",".tox-revisionhistory__norevision"].join(", "),i=To(null),s=ki(i,o,"flow"),a=tinymce.i18n.translate("No revisions"),l=tinymce.i18n.translate("Revision History"),c=Oo(qo).map((e=>br(e.editor))).getOr(!1),u=e=>{r(e),t(e)};return Ro((()=>{p(e)&&!n&&B(e,0).each((e=>u(e.revisionId)))}),[e]),fo("div",{className:"tox-revisionhistory__sidebar",tabIndex:-1,children:[fo("h1",{className:"tox-revisionhistory__sidebar-title",children:l}),fo("div",{role:"list",ref:i,className:"tox-revisionhistory__revisions",tabIndex:-1,...s,children:p(e)?0===e.length?fo("div",{role:"listitem",className:"tox-revisionhistory__norevision",children:a}):T(e,((e,t)=>fo(Ni,{showAuthor:c,isSelected:e.revisionId===n,revision:e,onSelect:()=>u(e.revisionId)},t))):null})]})},Ti=({restore:e,goBack:t,getRevisions:n,getRevision:r,editor:o})=>{const i=To(null),s=[".tox-view__toolbar",".tox-revisionhistory__revisions"].join(", "),[a,l]=No(M.none()),c=ki(i,s,"tab"),[u,h]=No(""),[f,d]=No(""),[g,v]=No(!1),y=tinymce.i18n.translate("Restore this version"),x=tinymce.i18n.translate("Revision History"),C=tinymce.i18n.translate("Close"),S=a.fold(b(x),(({createdAt:e})=>Bo(e))),[k,E]=No(),A=async e=>{if(p(k)){o.setProgressState(!0);const t=await(async(e,t,n)=>{const r=[];return $(t,(t=>t.revisionId===e)).each((e=>{r.push(t[e]),e<=t.length-2&&r.push(t[e+1])})),await Promise.all(T(r,n))})(e,k,r);if(o.removed||o.setProgressState(!1),t.length>0&&!o.removed){let e="";const[n,r]=t,i=Fo(n);e=p(r)?pt(Bn(Fo(r),i,yr(o))):i,(e=>{if(k&&e.length>0){const t=((e,t)=>{const n=[...e];return D(t,(e=>{e&&$(n,(t=>((e,t)=>e.revisionId===t.revisionId)(e,t))).each((t=>{n[t]=e}))})),n})(k,e);E(t)}})(t),l(M.some(n)),h(((e,t)=>{const n=vr(t),r=((e,t)=>{return o=t,n=e.parser.parse(o,{insert:!0}),r=e.schema,tinymce.html.Serializer({validate:!0},r).serialize(n);var n,r,o})(t,e),o=M.from(xr(t)).map((e=>`<style type="text/css">${e}</style>`)).getOr(""),i=ae(Cr(t),' crossorigin="anonymous"').getOr(""),s=`<link type="text/css" rel="stylesheet" href="${n}"/>`,a=I(t.contentCSS,((e,n)=>`${e}<link type="text/css" rel="stylesheet" href="${t.documentBaseURI.toAbsolute(n)}"${i}>`),""),l=t.dom.encode,c=M.from(wr(t)).map((e=>` class="${l(e)}"`)).getOr(""),u=M.from(t.getBody()).map((e=>l(e.dir))).bind((e=>ae(""!==e,` dir="${e}"`))).getOr(""),h=(e=>{const t=((e,t)=>{const n=[],r=m(t)?e=>R(n,(n=>t(n,e))):e=>N(n,e);for(let t=0,o=e.length;t<o;t++){const o=e[t];r(o)||n.push(o)}return n})((n=e.schema.getComponentUrls(),J(n,w)));var n;return T(t,(t=>{const n=J(tinymce.ScriptLoader.getScriptAttributes(t),((t,n)=>` ${e.dom.encode(n)}="${e.dom.encode(t)}"`));return`<script src="${e.dom.encode(t)}"${n.join("")}><\/script>`})).join("")})(t);return`<!DOCTYPE html><html><head><base href="${l(t.documentBaseURI.getURI())}">`+a+o+"<style>table, table td, table th, table caption { border: 1px dashed #bbb }</style>"+s+h+(()=>{const e=st().os.isMacOS()||st().os.isiOS();return`<script>(${(e=>{document.addEventListener("click",(t=>{for(let n=t.target;n;n=n.parentNode)if("A"===n.nodeName){const r=n.getAttribute("href");if(r&&r.startsWith("#")){t.preventDefault();const e=document.getElementById(r.substring(1));return void(e&&e.scrollIntoView({behavior:"smooth"}))}(e?t.metaKey:t.ctrlKey&&!t.altKey)||t.preventDefault()}}),!1)}).toString()})(${e})<\/script>`})()+"</head>"+`<body${c}${u}>`+r+"</body></html>"})(e,o));const s=_(r)?tinymce.i18n.translate(["Showing the initial version on {0}",Bo(n.createdAt)]):tinymce.i18n.translate(["Comparing revision on {0} to the previous version",Bo(n.createdAt)]);d(s)}}},O=a.forall((e=>"draft"===e.internalType||"initial"===e.internalType));return Ro((()=>{(async()=>{o.setProgressState(!0);const e=await n().finally((()=>o.setProgressState(!1)));E(e)})()}),[]),Ro((()=>{!g&&p(i.current)&&p(k)&&(k.length>0&&a.isSome()||0===k.length)&&(i.current.dispatchEvent(new window.Event("focus")),v(!0))}),[i.current,a,k]),fo("div",{ref:i,...c,className:"tox-revisionhistory__container",children:fo(qo.Provider,{value:M.some({editor:o}),children:[fo(Mi,{items:[{type:"title",label:S},{type:"button",label:y,disabled:O,hide:!Sr(o),primary:!0,onAction:()=>a.each((({content:t,revisionId:n})=>{e(t),((e,t)=>{e.dispatch("VersionRestored",{revisionId:t})})(o,n)}))},{type:"button",label:C,onAction:t}]}),fo("div",{className:"tox-revisionhistory",children:[fo("iframe",{className:"tox-revisionhistory__iframe",srcDoc:u}),fo(Ri,{onRevisionSelected:e=>{A(e)},revisions:k})]}),fo(Vo,{children:f})]})})};((e,t)=>{const{i18n:n=!0}=t;n&&tinymce.PluginManager.requireLangPack(e,"ar,bg-BG,ca,cs,da,de,el,es,eu,fa,fi,fr-FR,he-IL,hi,hr,hu-HU,id,it,ja,kk,ko-KR,ms,nb-NO,nl,pl,pt-BR,pt-PT,ro,ru,sk,sl-SI,sv-SE,th-TH,tr,uk,vi,zh-CN,zh-TW"),tinymce.PluginManager.add(e,Ie(e,t))})("revisionhistory",{setup:(e,t)=>{((e,t)=>{const n=e.options.register;n("revisionhistory_fetch",{processor:"function"}),n("revisionhistory_fetch_revision",{processor:"function"}),n("revisionhistory_css_url",{processor:"string",default:t+"/css/revisionhistory.css"}),n("revisionhistory_diff_classes",{processor:"object"}),n("revisionhistory_author",{processor:e=>h(e)?cr(e):{valid:!1,message:"Must be an object."}}),n("revisionhistory_display_author",{processor:"boolean"}),n("revisionhistory_allow_restore",{processor:"boolean",default:!0})})(e,t);const{getRevision:n,getRevisions:r}=(e=>{const t=(()=>{const e=le(y);return{...e,on:t=>e.get().each(t)}})(),n=_r(e);return e.on("LoadContent",(()=>{t.set(Mr(e,"initial"))})),{getRevisions:async()=>{const r=[],o=(e,t=!0)=>{const n=t?V:F;p(e.content)&&ue(e.content)&&n(r).forall((t=>t.content!==e.content))&&(t?r.push(e):r.unshift(e))},i=await Mr(e,"draft");try{const s=await n();if(0===s.length)o(i),t.get().each((e=>{e.then((e=>{o(e)})).catch((e=>{console.warn("Failed to fetch initial revision:",e)}))}));else{const t=await Promise.all(T(s,(async t=>{const n=p(t.content)?{content:kr(e,t.content)}:{};return{...hr(t),...n}})));r.push(...t),o(i,!1)}}catch(t){e.notificationManager.open({text:"An error occurred fetching revisions.",type:"error"}),console.error(t)}return r},getRevision:async t=>new Promise((n=>mr(e).fold((()=>{n(t)}),(r=>{_(t.content)?r(e,t).then((t=>{const r=p(t.content)&&ue(t.content)?kr(e,t.content):t.content,o={...t,content:r},i=hr(o);n(i)})).catch((r=>{e.removed||(e.notificationManager.open({text:"An error occurred fetching the updated revision.",type:"error"}),console.error(r)),n(t)})):n(t)}))))}})(e);(e=>{e.addCommand("revisionHistory",(()=>{e.inline||("revision"===e.mode.get()?e.mode.set("design"):(e.mode.set("revision"),(e=>{e.dispatch("RevisionHistoryOpen")})(e)))}))})(e),(e=>{const t="revision-history",n="Revision history",r=()=>e.execCommand("revisionHistory");e.ui.registry.addButton("revisionhistory",{icon:t,tooltip:n,onAction:r}),e.ui.registry.addMenuItem("revisionhistory",{icon:t,text:n,onAction:r})})(e),(e=>{e.mode.register("revision",{activate:()=>{"revision"!==e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"revision")},deactivate:()=>{"revision"===e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"revision")},editorReadOnly:!1})})(e),((e,t)=>{const n=le((e=>e.destroy()));e.ui.registry.addView("revision",{onShow:r=>{const o=()=>{return e=r.getContainer(),Rt(je(e),["tox-revisionhistory__pane"]),void uo(null,e);var e};var i,s;e.on("remove",o),n.set({destroy:()=>{o(),e.off("remove",o)}}),i=r.getContainer(),s={restore:t=>{p(t)&&e.setContent(t),e.execCommand("ToggleView",!1,"revision")},goBack:()=>{e.execCommand("ToggleView",!1,"revision")},...t,editor:e},Nt(je(i),["tox-revisionhistory__pane"]),uo(fo(Ti,{...s}),i)},onHide:()=>{e.mode.set("design"),n.clear()}})})(e,{getRevisions:r,getRevision:n});const o=(e=>({diff:(t,n)=>{const r=yr(e);return pt(Bn(t,n,r))}}))(e);return o}})}();