UNPKG

trix

Version:

A rich text editor for everyday writing

6 lines 203 kB
/* Trix 2.1.15 Copyright © 2025 37signals, LLC */ var t="2.1.15";const e="[data-trix-attachment]",i={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}},n={default:{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},heading1:{tagName:"h1",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:"pre",terminal:!0,htmlAttributes:["language"],text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",group:!1,nestable:!0,test(t){return r(t.parentNode)===n[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test(t){return r(t.parentNode)===n[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}},r=t=>{var e;return null==t||null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()},o=navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i),s=o&&parseInt(o[1]);var a={composesExistingText:/Android.*Chrome/.test(navigator.userAgent),recentAndroid:s&&s>12,samsungAndroid:s&&navigator.userAgent.match(/Android.*SM-/),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:"undefined"!=typeof InputEvent&&["data","getTargetRanges","inputType"].every((t=>t in InputEvent.prototype))},l={ADD_ATTR:["language"],SAFE_FOR_XML:!1,RETURN_DOM:!0},c={attachFiles:"Attach Files",bold:"Bold",bullets:"Bullets",byte:"Byte",bytes:"Bytes",captionPlaceholder:"Add a caption…",code:"Code",heading1:"Heading",indent:"Increase Level",italic:"Italic",link:"Link",numbers:"Numbers",outdent:"Decrease Level",quote:"Quote",redo:"Redo",remove:"Remove",strike:"Strikethrough",undo:"Undo",unlink:"Unlink",url:"URL",urlPlaceholder:"Enter a URL…",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"};const u=[c.bytes,c.KB,c.MB,c.GB,c.TB,c.PB];var h={prefix:"IEC",precision:2,formatter(t){switch(t){case 0:return"0 ".concat(c.bytes);case 1:return"1 ".concat(c.byte);default:let e;"SI"===this.prefix?e=1e3:"IEC"===this.prefix&&(e=1024);const i=Math.floor(Math.log(t)/Math.log(e)),n=(t/Math.pow(e,i)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"");return"".concat(n," ").concat(u[i])}}};const d="\ufeff",g=" ",m=function(t){for(const e in t){const i=t[e];this[e]=i}return this},p=document.documentElement,f=p.matches,b=function(t){let{onElement:e,matchingSelector:i,withCallback:n,inPhase:r,preventDefault:o,times:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=e||p,l=i,c="capturing"===r,u=function(t){null!=s&&0==--s&&u.destroy();const e=y(t.target,{matchingSelector:l});null!=e&&(null==n||n.call(e,t,e),o&&t.preventDefault())};return u.destroy=()=>a.removeEventListener(t,u,c),a.addEventListener(t,u,c),u},v=function(t){let{onElement:e,bubbles:i,cancelable:n,attributes:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=null!=e?e:p;i=!1!==i,n=!1!==n;const s=document.createEvent("Events");return s.initEvent(t,i,n),null!=r&&m.call(s,r),o.dispatchEvent(s)},A=function(t,e){if(1===(null==t?void 0:t.nodeType))return f.call(t,e)},y=function(t){let{matchingSelector:e,untilNode:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(;t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;if(null!=t){if(null==e)return t;if(t.closest&&null==i)return t.closest(e);for(;t&&t!==i;){if(A(t,e))return t;t=t.parentNode}}},x=t=>document.activeElement!==t&&C(t,document.activeElement),C=function(t,e){if(t&&e)for(;e;){if(e===t)return!0;e=e.parentNode}},E=function(t){var e;if(null===(e=t)||void 0===e||!e.parentNode)return;let i=0;for(t=t.previousSibling;t;)i++,t=t.previousSibling;return i},S=t=>{var e;return null==t||null===(e=t.parentNode)||void 0===e?void 0:e.removeChild(t)},R=function(t){let{onlyNodesOfType:e,usingFilter:i,expandEntityReferences:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=(()=>{switch(e){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}})();return document.createTreeWalker(t,r,null!=i?i:null,!0===n)},k=t=>{var e;return null==t||null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()},T=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"==typeof t?(n=t,t=n.tagName):n={attributes:n};const r=document.createElement(t);if(null!=n.editable&&(null==n.attributes&&(n.attributes={}),n.attributes.contenteditable=n.editable),n.attributes)for(e in n.attributes)i=n.attributes[e],r.setAttribute(e,i);if(n.style)for(e in n.style)i=n.style[e],r.style[e]=i;if(n.data)for(e in n.data)i=n.data[e],r.dataset[e]=i;return n.className&&n.className.split(" ").forEach((t=>{r.classList.add(t)})),n.textContent&&(r.textContent=n.textContent),n.childNodes&&[].concat(n.childNodes).forEach((t=>{r.appendChild(t)})),r};let w;const L=function(){if(null!=w)return w;w=[];for(const t in n){const e=n[t];e.tagName&&w.push(e.tagName)}return w},D=t=>I(null==t?void 0:t.firstChild),N=function(t){let{strict:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{strict:!0};return e?I(t):I(t)||!I(t.firstChild)&&function(t){return L().includes(k(t))&&!L().includes(k(t.firstChild))}(t)},I=t=>O(t)&&"block"===(null==t?void 0:t.data),O=t=>(null==t?void 0:t.nodeType)===Node.COMMENT_NODE,F=function(t){let{name:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t)return B(t)?t.data===d?!e||t.parentNode.dataset.trixCursorTarget===e:void 0:F(t.firstChild)},P=t=>A(t,e),M=t=>B(t)&&""===(null==t?void 0:t.data),B=t=>(null==t?void 0:t.nodeType)===Node.TEXT_NODE,_={level2Enabled:!0,getLevel(){return this.level2Enabled&&a.supportsInputEvents?2:0},pickFiles(t){const e=T("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId});e.addEventListener("change",(()=>{t(e.files),S(e)})),S(document.getElementById(this.fileInputId)),document.body.appendChild(e),e.click()}};var j={removeBlankTableCells:!1,tableCellSeparator:" | ",tableRowSeparator:"\n"},W={bold:{tagName:"strong",inheritable:!0,parser(t){const e=window.getComputedStyle(t);return"bold"===e.fontWeight||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:t=>"italic"===window.getComputedStyle(t).fontStyle},href:{groupTagName:"a",parser(t){const i="a:not(".concat(e,")"),n=t.closest(i);if(n)return n.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},U={getDefaultHTML:()=>'<div class="trix-button-row">\n <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="'.concat(c.bold,'" tabindex="-1">').concat(c.bold,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="').concat(c.italic,'" tabindex="-1">').concat(c.italic,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="').concat(c.strike,'" tabindex="-1">').concat(c.strike,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="').concat(c.link,'" tabindex="-1">').concat(c.link,'</button>\n </span>\n\n <span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="').concat(c.heading1,'" tabindex="-1">').concat(c.heading1,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="').concat(c.quote,'" tabindex="-1">').concat(c.quote,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="').concat(c.code,'" tabindex="-1">').concat(c.code,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="').concat(c.bullets,'" tabindex="-1">').concat(c.bullets,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="').concat(c.numbers,'" tabindex="-1">').concat(c.numbers,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="').concat(c.outdent,'" tabindex="-1">').concat(c.outdent,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="').concat(c.indent,'" tabindex="-1">').concat(c.indent,'</button>\n </span>\n\n <span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="').concat(c.attachFiles,'" tabindex="-1">').concat(c.attachFiles,'</button>\n </span>\n\n <span class="trix-button-group-spacer"></span>\n\n <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="').concat(c.undo,'" tabindex="-1">').concat(c.undo,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="').concat(c.redo,'" tabindex="-1">').concat(c.redo,'</button>\n </span>\n </div>\n\n <div class="trix-dialogs" data-trix-dialogs>\n <div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">\n <div class="trix-dialog__link-fields">\n <input type="url" name="href" class="trix-input trix-input--dialog" placeholder="').concat(c.urlPlaceholder,'" aria-label="').concat(c.url,'" data-trix-validate-href required data-trix-input>\n <div class="trix-button-group">\n <input type="button" class="trix-button trix-button--dialog" value="').concat(c.link,'" data-trix-method="setAttribute">\n <input type="button" class="trix-button trix-button--dialog" value="').concat(c.unlink,'" data-trix-method="removeAttribute">\n </div>\n </div>\n </div>\n </div>')};const V={interval:5e3};var z=Object.freeze({__proto__:null,attachments:i,blockAttributes:n,browser:a,css:{attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},dompurify:l,fileSize:h,input:_,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:c,parser:j,textAttributes:W,toolbar:U,undo:V});class q{static proxyMethod(t){const{name:e,toMethod:i,toProperty:n,optional:r}=H(t);this.prototype[e]=function(){let t,o;var s,a;i?o=r?null===(s=this[i])||void 0===s?void 0:s.call(this):this[i]():n&&(o=this[n]);return r?(t=null===(a=o)||void 0===a?void 0:a[e],t?J.call(t,o,arguments):void 0):(t=o[e],J.call(t,o,arguments))}}}const H=function(t){const e=t.match(K);if(!e)throw new Error("can't parse @proxyMethod expression: ".concat(t));const i={name:e[4]};return null!=e[2]?i.toMethod=e[1]:i.toProperty=e[1],null!=e[3]&&(i.optional=!0),i},{apply:J}=Function.prototype,K=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var G,Y,X;class $ extends q{static box(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t instanceof this?t:this.fromUCS2String(null==t?void 0:t.toString())}static fromUCS2String(t){return new this(t,et(t))}static fromCodepoints(t){return new this(it(t),t)}constructor(t,e){super(...arguments),this.ucs2String=t,this.codepoints=e,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(t){return it(this.codepoints.slice(0,Math.max(0,t))).length}offsetFromUCS2Offset(t){return et(this.ucs2String.slice(0,Math.max(0,t))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(t){return this.slice(t,t+1)}isEqualTo(t){return this.constructor.box(t).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}const Z=1===(null===(G=Array.from)||void 0===G?void 0:G.call(Array,"👼").length),Q=null!=(null===(Y=" ".codePointAt)||void 0===Y?void 0:Y.call(" ",0)),tt=" 👼"===(null===(X=String.fromCodePoint)||void 0===X?void 0:X.call(String,32,128124));let et,it;et=Z&&Q?t=>Array.from(t).map((t=>t.codePointAt(0))):function(t){const e=[];let i=0;const{length:n}=t;for(;i<n;){let r=t.charCodeAt(i++);if(55296<=r&&r<=56319&&i<n){const e=t.charCodeAt(i++);56320==(64512&e)?r=((1023&r)<<10)+(1023&e)+65536:i--}e.push(r)}return e},it=tt?t=>String.fromCodePoint(...Array.from(t||[])):function(t){return(()=>{const e=[];return Array.from(t).forEach((t=>{let i="";t>65535&&(t-=65536,i+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e.push(i+String.fromCharCode(t))})),e})().join("")};let nt=0;class rt extends q{static fromJSONString(t){return this.fromJSON(JSON.parse(t))}constructor(){super(...arguments),this.id=++nt}hasSameConstructorAs(t){return this.constructor===(null==t?void 0:t.constructor)}isEqualTo(t){return this===t}inspect(){const t=[],e=this.contentsForInspection()||{};for(const i in e){const n=e[i];t.push("".concat(i,"=").concat(n))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(t.length?" ".concat(t.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return $.box(this)}getCacheKey(){return this.id.toString()}}const ot=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++){if(t[i]!==e[i])return!1}return!0},st=function(t){const e=t.slice(0);for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return e.splice(...n),e},at=/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,lt=function(){const t=T("input",{dir:"auto",name:"x",dirName:"x.dir"}),e=T("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),i=T("form");i.appendChild(t),i.appendChild(e);const n=function(){try{return new FormData(i).has(e.dirName)}catch(t){return!1}}(),r=function(){try{return t.matches(":dir(ltr),:dir(rtl)")}catch(t){return!1}}();return n?function(t){return e.value=t,new FormData(i).get(e.dirName)}:r?function(e){return t.value=e,t.matches(":dir(rtl)")?"rtl":"ltr"}:function(t){const e=t.trim().charAt(0);return at.test(e)?"rtl":"ltr"}}();let ct=null,ut=null,ht=null,dt=null;const gt=()=>(ct||(ct=bt().concat(pt())),ct),mt=t=>n[t],pt=()=>(ut||(ut=Object.keys(n)),ut),ft=t=>W[t],bt=()=>(ht||(ht=Object.keys(W)),ht),vt=function(t,e){At(t).textContent=e.replace(/%t/g,t)},At=function(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.setAttribute("data-tag-name",t.toLowerCase());const i=yt();return i&&e.setAttribute("nonce",i),document.head.insertBefore(e,document.head.firstChild),e},yt=function(){const t=xt("trix-csp-nonce")||xt("csp-nonce");if(t){const{nonce:e,content:i}=t;return""==e?i:e}},xt=t=>document.head.querySelector("meta[name=".concat(t,"]")),Ct={"application/x-trix-feature-detection":"test"},Et=function(t){const e=t.getData("text/plain"),i=t.getData("text/html");if(!e||!i)return null==e?void 0:e.length;{const{body:t}=(new DOMParser).parseFromString(i,"text/html");if(t.textContent===e)return!t.querySelector("*")}},St=/Mac|^iP/.test(navigator.platform)?t=>t.metaKey:t=>t.ctrlKey;const Rt=t=>setTimeout(t,1),kt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={};for(const i in t){const n=t[i];e[i]=n}return e},Tt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t){if(t[i]!==e[i])return!1}return!0},wt=function(t){if(null!=t)return Array.isArray(t)||(t=[t,t]),[Nt(t[0]),Nt(null!=t[1]?t[1]:t[0])]},Lt=function(t){if(null==t)return;const[e,i]=wt(t);return It(e,i)},Dt=function(t,e){if(null==t||null==e)return;const[i,n]=wt(t),[r,o]=wt(e);return It(i,r)&&It(n,o)},Nt=function(t){return"number"==typeof t?t:kt(t)},It=function(t,e){return"number"==typeof t?t===e:Tt(t,e)};class Ot extends q{constructor(){super(...arguments),this.update=this.update.bind(this),this.selectionManagers=[]}start(){this.started||(this.started=!0,document.addEventListener("selectionchange",this.update,!0))}stop(){if(this.started)return this.started=!1,document.removeEventListener("selectionchange",this.update,!0)}registerSelectionManager(t){if(!this.selectionManagers.includes(t))return this.selectionManagers.push(t),this.start()}unregisterSelectionManager(t){if(this.selectionManagers=this.selectionManagers.filter((e=>e!==t)),0===this.selectionManagers.length)return this.stop()}notifySelectionManagersOfSelectionChange(){return this.selectionManagers.map((t=>t.selectionDidChange()))}update(){this.notifySelectionManagersOfSelectionChange()}reset(){this.update()}}const Ft=new Ot,Pt=function(){const t=window.getSelection();if(t.rangeCount>0)return t},Mt=function(){var t;const e=null===(t=Pt())||void 0===t?void 0:t.getRangeAt(0);if(e&&!_t(e))return e},Bt=function(t){const e=window.getSelection();return e.removeAllRanges(),e.addRange(t),Ft.update()},_t=t=>jt(t.startContainer)||jt(t.endContainer),jt=t=>!Object.getPrototypeOf(t),Wt=t=>t.replace(new RegExp("".concat(d),"g"),"").replace(new RegExp("".concat(g),"g")," "),Ut=new RegExp("[^\\S".concat(g,"]")),Vt=t=>t.replace(new RegExp("".concat(Ut.source),"g")," ").replace(/\ {2,}/g," "),zt=function(t,e){if(t.isEqualTo(e))return["",""];const i=qt(t,e),{length:n}=i.utf16String;let r;if(n){const{offset:o}=i,s=t.codepoints.slice(0,o).concat(t.codepoints.slice(o+n));r=qt(e,$.fromCodepoints(s))}else r=qt(e,t);return[i.utf16String.toString(),r.utf16String.toString()]},qt=function(t,e){let i=0,n=t.length,r=e.length;for(;i<n&&t.charAt(i).isEqualTo(e.charAt(i));)i++;for(;n>i+1&&t.charAt(n-1).isEqualTo(e.charAt(r-1));)n--,r--;return{utf16String:t.slice(i,n),offset:i}};class Ht extends rt{static fromCommonAttributesOfObjects(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!t.length)return new this;let e=Yt(t[0]),i=e.getKeys();return t.slice(1).forEach((t=>{i=e.getKeysCommonToHash(Yt(t)),e=e.slice(i)})),e}static box(t){return Yt(t)}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(...arguments),this.values=Gt(t)}add(t,e){return this.merge(Jt(t,e))}remove(t){return new Ht(Gt(this.values,t))}get(t){return this.values[t]}has(t){return t in this.values}merge(t){return new Ht(Kt(this.values,Xt(t)))}slice(t){const e={};return Array.from(t).forEach((t=>{this.has(t)&&(e[t]=this.values[t])})),new Ht(e)}getKeys(){return Object.keys(this.values)}getKeysCommonToHash(t){return t=Yt(t),this.getKeys().filter((e=>this.values[e]===t.values[e]))}isEqualTo(t){return ot(this.toArray(),Yt(t).toArray())}isEmpty(){return 0===this.getKeys().length}toArray(){if(!this.array){const t=[];for(const e in this.values){const i=this.values[e];t.push(t.push(e,i))}this.array=t.slice(0)}return this.array}toObject(){return Gt(this.values)}toJSON(){return this.toObject()}contentsForInspection(){return{values:JSON.stringify(this.values)}}}const Jt=function(t,e){const i={};return i[t]=e,i},Kt=function(t,e){const i=Gt(t);for(const t in e){const n=e[t];i[t]=n}return i},Gt=function(t,e){const i={};return Object.keys(t).sort().forEach((n=>{n!==e&&(i[n]=t[n])})),i},Yt=function(t){return t instanceof Ht?t:new Ht(t)},Xt=function(t){return t instanceof Ht?t.values:t};class $t{static groupObjects(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{depth:i,asTree:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n&&null==i&&(i=0);const r=[];return Array.from(e).forEach((e=>{var o;if(t){var s,a,l;if(null!==(s=e.canBeGrouped)&&void 0!==s&&s.call(e,i)&&null!==(a=(l=t[t.length-1]).canBeGroupedWith)&&void 0!==a&&a.call(l,e,i))return void t.push(e);r.push(new this(t,{depth:i,asTree:n})),t=null}null!==(o=e.canBeGrouped)&&void 0!==o&&o.call(e,i)?t=[e]:r.push(e)})),t&&r.push(new this(t,{depth:i,asTree:n})),r}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{depth:e,asTree:i}=arguments.length>1?arguments[1]:void 0;this.objects=t,i&&(this.depth=e,this.objects=this.constructor.groupObjects(this.objects,{asTree:i,depth:this.depth+1}))}getObjects(){return this.objects}getDepth(){return this.depth}getCacheKey(){const t=["objectGroup"];return Array.from(this.getObjects()).forEach((e=>{t.push(e.getCacheKey())})),t.join("/")}}class Zt extends q{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),this.objects={},Array.from(t).forEach((t=>{const e=JSON.stringify(t);null==this.objects[e]&&(this.objects[e]=t)}))}find(t){const e=JSON.stringify(t);return this.objects[e]}}class Qt{constructor(t){this.reset(t)}add(t){const e=te(t);this.elements[e]=t}remove(t){const e=te(t),i=this.elements[e];if(i)return delete this.elements[e],i}reset(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.elements={},Array.from(t).forEach((t=>{this.add(t)})),t}}const te=t=>t.dataset.trixStoreKey;class ee extends q{isPerforming(){return!0===this.performing}hasPerformed(){return!0===this.performed}hasSucceeded(){return this.performed&&this.succeeded}hasFailed(){return this.performed&&!this.succeeded}getPromise(){return this.promise||(this.promise=new Promise(((t,e)=>(this.performing=!0,this.perform(((i,n)=>{this.succeeded=i,this.performing=!1,this.performed=!0,this.succeeded?t(n):e(n)})))))),this.promise}perform(t){return t(!1)}release(){var t,e;null===(t=this.promise)||void 0===t||null===(e=t.cancel)||void 0===e||e.call(t),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null}}ee.proxyMethod("getPromise().then"),ee.proxyMethod("getPromise().catch");class ie extends q{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.object=t,this.options=e,this.childViews=[],this.rootView=this}getNodes(){return this.nodes||(this.nodes=this.createNodes()),this.nodes.map((t=>t.cloneNode(!0)))}invalidate(){var t;return this.nodes=null,this.childViews=[],null===(t=this.parentView)||void 0===t?void 0:t.invalidate()}invalidateViewForObject(t){var e;return null===(e=this.findViewForObject(t))||void 0===e?void 0:e.invalidate()}findOrCreateCachedChildView(t,e,i){let n=this.getCachedViewForObject(e);return n?this.recordChildView(n):(n=this.createChildView(...arguments),this.cacheViewForObject(n,e)),n}createChildView(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e instanceof $t&&(i.viewClass=t,t=ne);const n=new t(e,i);return this.recordChildView(n)}recordChildView(t){return t.parentView=this,t.rootView=this.rootView,this.childViews.push(t),t}getAllChildViews(){let t=[];return this.childViews.forEach((e=>{t.push(e),t=t.concat(e.getAllChildViews())})),t}findElement(){return this.findElementForObject(this.object)}findElementForObject(t){const e=null==t?void 0:t.id;if(e)return this.rootView.element.querySelector("[data-trix-id='".concat(e,"']"))}findViewForObject(t){for(const e of this.getAllChildViews())if(e.object===t)return e}getViewCache(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?(this.viewCache||(this.viewCache={}),this.viewCache):void 0}isViewCachingEnabled(){return!1!==this.shouldCacheViews}enableViewCaching(){this.shouldCacheViews=!0}disableViewCaching(){this.shouldCacheViews=!1}getCachedViewForObject(t){var e;return null===(e=this.getViewCache())||void 0===e?void 0:e[t.getCacheKey()]}cacheViewForObject(t,e){const i=this.getViewCache();i&&(i[e.getCacheKey()]=t)}garbageCollectCachedViews(){const t=this.getViewCache();if(t){const e=this.getAllChildViews().concat(this).map((t=>t.object.getCacheKey()));for(const i in t)e.includes(i)||delete t[i]}}}class ne extends ie{constructor(){super(...arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}getChildViews(){return this.childViews.length||Array.from(this.objectGroup.getObjects()).forEach((t=>{this.findOrCreateCachedChildView(this.viewClass,t,this.options)})),this.childViews}createNodes(){const t=this.createContainerElement();return this.getChildViews().forEach((e=>{Array.from(e.getNodes()).forEach((e=>{t.appendChild(e)}))})),[t]}createContainerElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.objectGroup.getDepth();return this.getChildViews()[0].createContainerElement(t)}} /*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */const{entries:re,setPrototypeOf:oe,isFrozen:se,getPrototypeOf:ae,getOwnPropertyDescriptor:le}=Object;let{freeze:ce,seal:ue,create:he}=Object,{apply:de,construct:ge}="undefined"!=typeof Reflect&&Reflect;ce||(ce=function(t){return t}),ue||(ue=function(t){return t}),de||(de=function(t,e,i){return t.apply(e,i)}),ge||(ge=function(t,e){return new t(...e)});const me=Le(Array.prototype.forEach),pe=Le(Array.prototype.lastIndexOf),fe=Le(Array.prototype.pop),be=Le(Array.prototype.push),ve=Le(Array.prototype.splice),Ae=Le(String.prototype.toLowerCase),ye=Le(String.prototype.toString),xe=Le(String.prototype.match),Ce=Le(String.prototype.replace),Ee=Le(String.prototype.indexOf),Se=Le(String.prototype.trim),Re=Le(Object.prototype.hasOwnProperty),ke=Le(RegExp.prototype.test),Te=(we=TypeError,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return ge(we,e)});var we;function Le(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return de(t,e,n)}}function De(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae;oe&&oe(t,null);let n=e.length;for(;n--;){let r=e[n];if("string"==typeof r){const t=i(r);t!==r&&(se(e)||(e[n]=t),r=t)}t[r]=!0}return t}function Ne(t){for(let e=0;e<t.length;e++){Re(t,e)||(t[e]=null)}return t}function Ie(t){const e=he(null);for(const[i,n]of re(t)){Re(t,i)&&(Array.isArray(n)?e[i]=Ne(n):n&&"object"==typeof n&&n.constructor===Object?e[i]=Ie(n):e[i]=n)}return e}function Oe(t,e){for(;null!==t;){const i=le(t,e);if(i){if(i.get)return Le(i.get);if("function"==typeof i.value)return Le(i.value)}t=ae(t)}return function(){return null}}const Fe=ce(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Pe=ce(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Me=ce(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Be=ce(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),_e=ce(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),je=ce(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),We=ce(["#text"]),Ue=ce(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ve=ce(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ze=ce(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),qe=ce(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),He=ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Je=ue(/<%[\w\W]*|[\w\W]*%>/gm),Ke=ue(/\$\{[\w\W]*/gm),Ge=ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ye=ue(/^aria-[\-\w]+$/),Xe=ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$e=ue(/^(?:\w+script|data):/i),Ze=ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Qe=ue(/^html$/i),ti=ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var ei=Object.freeze({__proto__:null,ARIA_ATTR:Ye,ATTR_WHITESPACE:Ze,CUSTOM_ELEMENT:ti,DATA_ATTR:Ge,DOCTYPE_NAME:Qe,ERB_EXPR:Je,IS_ALLOWED_URI:Xe,IS_SCRIPT_OR_DATA:$e,MUSTACHE_EXPR:He,TMPLIT_EXPR:Ke});const ii=1,ni=3,ri=7,oi=8,si=9,ai=function(){return"undefined"==typeof window?null:window};var li=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ai();const i=e=>t(e);if(i.version="3.2.5",i.removed=[],!e||!e.document||e.document.nodeType!==si||!e.Element)return i.isSupported=!1,i;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:g,trustedTypes:m}=e,p=c.prototype,f=Oe(p,"cloneNode"),b=Oe(p,"remove"),v=Oe(p,"nextSibling"),A=Oe(p,"childNodes"),y=Oe(p,"parentNode");if("function"==typeof a){const t=n.createElement("template");t.content&&t.content.ownerDocument&&(n=t.content.ownerDocument)}let x,C="";const{implementation:E,createNodeIterator:S,createDocumentFragment:R,getElementsByTagName:k}=n,{importNode:T}=r;let w={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof re&&"function"==typeof y&&E&&void 0!==E.createHTMLDocument;const{MUSTACHE_EXPR:L,ERB_EXPR:D,TMPLIT_EXPR:N,DATA_ATTR:I,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:M}=ei;let{IS_ALLOWED_URI:B}=ei,_=null;const j=De({},[...Fe,...Pe,...Me,..._e,...We]);let W=null;const U=De({},[...Ue,...Ve,...ze,...qe]);let V=Object.seal(he(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),z=null,q=null,H=!0,J=!0,K=!1,G=!0,Y=!1,X=!0,$=!1,Z=!1,Q=!1,tt=!1,et=!1,it=!1,nt=!0,rt=!1,ot=!0,st=!1,at={},lt=null;const ct=De({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ut=null;const ht=De({},["audio","video","img","source","image","track"]);let dt=null;const gt=De({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),mt="http://www.w3.org/1998/Math/MathML",pt="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let bt=ft,vt=!1,At=null;const yt=De({},[mt,pt,ft],ye);let xt=De({},["mi","mo","mn","ms","mtext"]),Ct=De({},["annotation-xml"]);const Et=De({},["title","style","font","a","script"]);let St=null;const Rt=["application/xhtml+xml","text/html"];let kt=null,Tt=null;const wt=n.createElement("form"),Lt=function(t){return t instanceof RegExp||t instanceof Function},Dt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Tt||Tt!==t){if(t&&"object"==typeof t||(t={}),t=Ie(t),St=-1===Rt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,kt="application/xhtml+xml"===St?ye:Ae,_=Re(t,"ALLOWED_TAGS")?De({},t.ALLOWED_TAGS,kt):j,W=Re(t,"ALLOWED_ATTR")?De({},t.ALLOWED_ATTR,kt):U,At=Re(t,"ALLOWED_NAMESPACES")?De({},t.ALLOWED_NAMESPACES,ye):yt,dt=Re(t,"ADD_URI_SAFE_ATTR")?De(Ie(gt),t.ADD_URI_SAFE_ATTR,kt):gt,ut=Re(t,"ADD_DATA_URI_TAGS")?De(Ie(ht),t.ADD_DATA_URI_TAGS,kt):ht,lt=Re(t,"FORBID_CONTENTS")?De({},t.FORBID_CONTENTS,kt):ct,z=Re(t,"FORBID_TAGS")?De({},t.FORBID_TAGS,kt):{},q=Re(t,"FORBID_ATTR")?De({},t.FORBID_ATTR,kt):{},at=!!Re(t,"USE_PROFILES")&&t.USE_PROFILES,H=!1!==t.ALLOW_ARIA_ATTR,J=!1!==t.ALLOW_DATA_ATTR,K=t.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Y=t.SAFE_FOR_TEMPLATES||!1,X=!1!==t.SAFE_FOR_XML,$=t.WHOLE_DOCUMENT||!1,tt=t.RETURN_DOM||!1,et=t.RETURN_DOM_FRAGMENT||!1,it=t.RETURN_TRUSTED_TYPE||!1,Q=t.FORCE_BODY||!1,nt=!1!==t.SANITIZE_DOM,rt=t.SANITIZE_NAMED_PROPS||!1,ot=!1!==t.KEEP_CONTENT,st=t.IN_PLACE||!1,B=t.ALLOWED_URI_REGEXP||Xe,bt=t.NAMESPACE||ft,xt=t.MATHML_TEXT_INTEGRATION_POINTS||xt,Ct=t.HTML_INTEGRATION_POINTS||Ct,V=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&Lt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&Lt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(V.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(J=!1),et&&(tt=!0),at&&(_=De({},We),W=[],!0===at.html&&(De(_,Fe),De(W,Ue)),!0===at.svg&&(De(_,Pe),De(W,Ve),De(W,qe)),!0===at.svgFilters&&(De(_,Me),De(W,Ve),De(W,qe)),!0===at.mathMl&&(De(_,_e),De(W,ze),De(W,qe))),t.ADD_TAGS&&(_===j&&(_=Ie(_)),De(_,t.ADD_TAGS,kt)),t.ADD_ATTR&&(W===U&&(W=Ie(W)),De(W,t.ADD_ATTR,kt)),t.ADD_URI_SAFE_ATTR&&De(dt,t.ADD_URI_SAFE_ATTR,kt),t.FORBID_CONTENTS&&(lt===ct&&(lt=Ie(lt)),De(lt,t.FORBID_CONTENTS,kt)),ot&&(_["#text"]=!0),$&&De(_,["html","head","body"]),_.table&&(De(_,["tbody"]),delete z.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw Te('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw Te('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=t.TRUSTED_TYPES_POLICY,C=x.createHTML("")}else void 0===x&&(x=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let i=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(i=e.getAttribute(n));const r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(m,o)),null!==x&&"string"==typeof C&&(C=x.createHTML(""));ce&&ce(t),Tt=t}},Nt=De({},[...Pe,...Me,...Be]),It=De({},[..._e,...je]),Ot=function(t){be(i.removed,{element:t});try{y(t).removeChild(t)}catch(e){b(t)}},Ft=function(t,e){try{be(i.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){be(i.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(tt||et)try{Ot(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Pt=function(t){let e=null,i=null;if(Q)t="<remove></remove>"+t;else{const e=xe(t,/^[\r\n\t ]+/);i=e&&e[0]}"application/xhtml+xml"===St&&bt===ft&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const r=x?x.createHTML(t):t;if(bt===ft)try{e=(new g).parseFromString(r,St)}catch(t){}if(!e||!e.documentElement){e=E.createDocument(bt,"template",null);try{e.documentElement.innerHTML=vt?C:r}catch(t){}}const o=e.body||e.documentElement;return t&&i&&o.insertBefore(n.createTextNode(i),o.childNodes[0]||null),bt===ft?k.call(e,$?"html":"body")[0]:$?e.documentElement:o},Mt=function(t){return S.call(t.ownerDocument||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Bt=function(t){return t instanceof d&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof h)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},_t=function(t){return"function"==typeof l&&t instanceof l};function jt(t,e,n){me(t,(t=>{t.call(i,e,n,Tt)}))}const Wt=function(t){let e=null;if(jt(w.beforeSanitizeElements,t,null),Bt(t))return Ot(t),!0;const n=kt(t.nodeName);if(jt(w.uponSanitizeElement,t,{tagName:n,allowedTags:_}),t.hasChildNodes()&&!_t(t.firstElementChild)&&ke(/<[/\w!]/g,t.innerHTML)&&ke(/<[/\w!]/g,t.textContent))return Ot(t),!0;if(t.nodeType===ri)return Ot(t),!0;if(X&&t.nodeType===oi&&ke(/<[/\w]/g,t.data))return Ot(t),!0;if(!_[n]||z[n]){if(!z[n]&&Vt(n)){if(V.tagNameCheck instanceof RegExp&&ke(V.tagNameCheck,n))return!1;if(V.tagNameCheck instanceof Function&&V.tagNameCheck(n))return!1}if(ot&&!lt[n]){const e=y(t)||t.parentNode,i=A(t)||t.childNodes;if(i&&e){for(let n=i.length-1;n>=0;--n){const r=f(i[n],!0);r.__removalCount=(t.__removalCount||0)+1,e.insertBefore(r,v(t))}}}return Ot(t),!0}return t instanceof c&&!function(t){let e=y(t);e&&e.tagName||(e={namespaceURI:bt,tagName:"template"});const i=Ae(t.tagName),n=Ae(e.tagName);return!!At[t.namespaceURI]&&(t.namespaceURI===pt?e.namespaceURI===ft?"svg"===i:e.namespaceURI===mt?"svg"===i&&("annotation-xml"===n||xt[n]):Boolean(Nt[i]):t.namespaceURI===mt?e.namespaceURI===ft?"math"===i:e.namespaceURI===pt?"math"===i&&Ct[n]:Boolean(It[i]):t.namespaceURI===ft?!(e.namespaceURI===pt&&!Ct[n])&&!(e.namespaceURI===mt&&!xt[n])&&!It[i]&&(Et[i]||!Nt[i]):!("application/xhtml+xml"!==St||!At[t.namespaceURI]))}(t)?(Ot(t),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!ke(/<\/no(script|embed|frames)/i,t.innerHTML)?(Y&&t.nodeType===ni&&(e=t.textContent,me([L,D,N],(t=>{e=Ce(e,t," ")})),t.textContent!==e&&(be(i.removed,{element:t.cloneNode()}),t.textContent=e)),jt(w.afterSanitizeElements,t,null),!1):(Ot(t),!0)},Ut=function(t,e,i){if(nt&&("id"===e||"name"===e)&&(i in n||i in wt))return!1;if(J&&!q[e]&&ke(I,e));else if(H&&ke(O,e));else if(!W[e]||q[e]){if(!(Vt(t)&&(V.tagNameCheck instanceof RegExp&&ke(V.tagNameCheck,t)||V.tagNameCheck instanceof Function&&V.tagNameCheck(t))&&(V.attributeNameCheck instanceof RegExp&&ke(V.attributeNameCheck,e)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(e))||"is"===e&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&ke(V.tagNameCheck,i)||V.tagNameCheck instanceof Function&&V.tagNameCheck(i))))return!1}else if(dt[e]);else if(ke(B,Ce(i,P,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Ee(i,"data:")||!ut[t]){if(K&&!ke(F,Ce(i,P,"")));else if(i)return!1}else;return!0},Vt=function(t){return"annotation-xml"!==t&&xe(t,M)},zt=function(t){jt(w.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||Bt(t))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let r=e.length;for(;r--;){const o=e[r],{name:s,namespaceURI:a,value:l}=o,c=kt(s);let u="value"===s?l:Se(l);if(n.attrName=c,n.attrValue=u,n.keepAttr=!0,n.forceKeepAttr=void 0,jt(w.uponSanitizeAttribute,t,n),u=n.attrValue,!rt||"id"!==c&&"name"!==c||(Ft(s,t),u="user-content-"+u),X&&ke(/((--!?|])>)|<\/(style|title)/i,u)){Ft(s,t);continue}if(n.forceKeepAttr)continue;if(Ft(s,t),!n.keepAttr)continue;if(!G&&ke(/\/>/i,u)){Ft(s,t);continue}Y&&me([L,D,N],(t=>{u=Ce(u,t," ")}));const h=kt(t.nodeName);if(Ut(h,c,u)){if(x&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(a);else switch(m.getAttributeType(h,c)){case"TrustedHTML":u=x.createHTML(u);break;case"TrustedScriptURL":u=x.createScriptURL(u)}try{a?t.setAttributeNS(a,s,u):t.setAttribute(s,u),Bt(t)?Ot(t):fe(i.removed)}catch(t){}}}jt(w.afterSanitizeAttributes,t,null)},qt=function t(e){let i=null;const n=Mt(e);for(jt(w.beforeSanitizeShadowDOM,e,null);i=n.nextNode();)jt(w.uponSanitizeShadowNode,i,null),Wt(i),zt(i),i.content instanceof s&&t(i.content);jt(w.afterSanitizeShadowDOM,e,null)};return i.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,o=null,a=null,c=null;if(vt=!t,vt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!_t(t)){if("function"!=typeof t.toString)throw Te("toString is not a function");if("string"!=typeof(t=t.toString()))throw Te("dirty is not a string, aborting")}if(!i.isSupported)return t;if(Z||Dt(e),i.removed=[],"string"==typeof t&&(st=!1),st){if(t.nodeName){const e=kt(t.nodeName);if(!_[e]||z[e])throw Te("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof l)n=Pt("\x3c!----\x3e"),o=n.ownerDocument.importNode(t,!0),o.nodeType===ii&&"BODY"===o.nodeName||"HTML"===o.nodeName?n=o:n.appendChild(o);else{if(!tt&&!Y&&!$&&-1===t.indexOf("<"))return x&&it?x.createHTML(t):t;if(n=Pt(t),!n)return tt?null:it?C:""}n&&Q&&Ot(n.firstChild);const u=Mt(st?t:n);for(;a=u.nextNode();)Wt(a),zt(a),a.content instanceof s&&qt(a.content);if(st)return t;if(tt){if(et)for(c=R.call(n.ownerDocument);n.firstChild;)c.appendChild(n.firstChild);else c=n;return(W.shadowroot||W.shadowrootmode)&&(c=T.call(r,c,!0)),c}let h=$?n.outerHTML:n.innerHTML;return $&&_["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&ke(Qe,n.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+h),Y&&me([L,D,N],(t=>{h=Ce(h,t," ")})),x&&it?x.createHTML(h):h},i.setConfig=function(){Dt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},i.clearConfig=function(){Tt=null,Z=!1},i.isValidAttribute=function(t,e,i){Tt||Dt({});const n=kt(t),r=kt(e);return Ut(n,r,i)},i.addHook=function(t,e){"function"==typeof e&&be(w[t],e)},i.removeHook=function(t,e){if(void 0!==e){const i=pe(w[t],e);return-1===i?void 0:ve(w[t],i,1)[0]}return fe(w[t])},i.removeHooks=function(t){w[t]=[]},i.removeAllHooks=function(){w={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();li.addHook("uponSanitizeAttribute",(function(t,e){/^data-trix-/.test(e.attrName)&&(e.forceKeepAttr=!0)}));const ci="style href src width height language class".split(" "),ui="javascript:".split(" "),hi="script iframe form noscript".split(" ");class di extends q{static setHTML(t,e,i){const n=new this(e,i).sanitize(),r=n.getHTML?n.getHTML():n.outerHTML;t.innerHTML=r}static sanitize(t,e){const i=new this(t,e);return i.sanitize(),i}constructor(t){let{allowedAttributes:e,forbiddenProtocols:i,forbiddenElements:n,purifyOptions:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.allowedAttributes=e||ci,this.forbiddenProtocols=i||ui,this.forbiddenElements=n||hi,this.purifyOptions=r||{},this.body=gi(t)}sanitize(){this.sanitizeElements(),this.normalizeListElementNesting();const t=Object.assign({},l,this.purifyOptions);return li.setConfig(t),this.body=li.sanitize(this.body),this.body}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){const t=R(this.body),e=[];for(;t.nextNode();){const i=t.currentNode;switch(i.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(i)?e.push(i):this.sanitizeElement(i);break;case Node.COMMENT_NODE:e.push(i)}}return e.forEach((t=>S(t))),this.body}sanitizeElement(t){return t.hasAttribute("href")&&this.forbiddenProtocols.includes(t.protocol)&&t.removeAttribute("href"),Array.from(t.attributes).forEach((e=>{let{name:i}=e;this.allowedAttributes.includes(i)||0===i.indexOf("data-trix")||t.removeAttribute(i)})),t}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach((t=>{const e=t.previousElementSibling;e&&"li"===k(e)&&e.appendChild(t)})),this.body}elementIsRemovable(t){if((null==t?void 0:t.nodeType)===Node.ELEMENT_NODE)return this.elementIsForbidden(t)||this.elementIsntSerializable(t)}elementIsForbidden(t){return this.forbiddenElements.includes(k(t))}elementIsntSerializable(t){return"false"===t.getAttribute("data-trix-serialize")&&!P(t)}}const gi=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t=t.replace(/<\/html[^>]*>[^]*$/i,"</html>");const e=document.implementation.createHTMLDocument("");return e.documentE