@lesjoursfr/edith 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/edith.js +1 -1
- package/package.json +4 -4
package/build/edith.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("CodeMirror"),require("Popper")):"function"==typeof define&&define.amd?define(["CodeMirror","Popper"],t):"object"==typeof exports?exports.Edith=t(require("CodeMirror"),require("Popper")):e.Edith=t(e.CodeMirror,e.Popper)}(self,(function(e,t){return function(){"use strict";var n={690:function(t){t.exports=e},74:function(e){e.exports=t}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,o),r.exports}o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};function a(e,t){return l(e)&&e.tagName===t.toUpperCase()}function s(e){return e.nodeType===Node.TEXT_NODE}function l(e){return e.nodeType===Node.ELEMENT_NODE}function c(e,t){return e.getAttribute(t)}function d(e,t){return"string"==typeof t?e.tagName===t.toUpperCase():t.some((t=>e.tagName===t.toUpperCase()))}function u(e,t){return e.classList.contains(t)}function p(e,{innerHTML:t,textContent:n,attributes:i}={}){const o=document.createElement(e);if(i)for(const e in i)Object.hasOwnProperty.call(i,e)&&o.setAttribute(e,i[e]);return"string"==typeof t?o.innerHTML=t:"string"==typeof n&&(o.textContent=n),o}function h(e,t){return e.replaceWith(t),t}function f(e){const t=[...e.childNodes];return e.replaceWith(...t),t}function m(e){const t=document.createTextNode(e.textContent??"");return e.replaceWith(t),t}function g(e){return["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e)}function b(e,t){for(const n of[...e.childNodes])t(n)&&n.remove()}function y(e,t){if(t(e))e.remove();else for(const n of[...e.childNodes])y(n,t)}function E(e){b(e,(e=>function(e){return e.nodeType===Node.COMMENT_NODE}(e)))}function T(e,t){for(const n of e.getAttributeNames())void 0===t[n]&&e.removeAttribute(n);for(const n of Object.keys(t))e.setAttribute(n,t[n])}function v(e){const t=e.getAttribute("style")||"";return(d(e,"b")&&t.match(/font-weight\s*:\s*(normal|400);/)||d(e,"i")&&t.match(/font-style\s*:\s*normal;/)||d(e,["u","s"])&&t.match(/text-decoration\s*:\s*none;/))&&(e=h(e,p("span",{attributes:{style:t},innerHTML:e.innerHTML}))),t.match(/font-weight\s*:\s*(bold|700|800|900);/)?e=h(e,p("b",{innerHTML:`<span style="${t.replace(/font-weight\s*:\s*(bold|700|800|900);/,"")}">${e.innerHTML}</span>`})):t.match(/font-style\s*:\s*italic;/)?e=h(e,p("i",{innerHTML:`<span style="${t.replace(/font-style\s*:\s*italic;/,"")}">${e.innerHTML}</span>`})):t.match(/text-decoration\s*:\s*underline;/)?e=h(e,p("u",{innerHTML:`<span style="${t.replace(/text-decoration\s*:\s*underline;/,"")}">${e.innerHTML}</span>`})):t.match(/text-decoration\s*:\s*line-through;/)&&(e=h(e,p("s",{innerHTML:`<span style="${t.replace(/text-decoration\s*:\s*line-through;/,"")}">${e.innerHTML}</span>`}))),e}function A(e,t){const n=e.childNodes;for(;n.length>0&&a(n[0],t);)n[0].remove();for(;n.length>0&&a(n[n.length-1],t);)n[n.length-1].remove()}o.d(r,{default:function(){return at}});let N=0;function w(e){const[t,...n]=e.split(".");return{type:t,ns:n??null}}function C(e,t,n){void 0===e.ljbtEvents&&(e.ljbtEvents={});for(const i of t.split(" ")){const{type:t,ns:o}=w(i),r=(++N).toString(10);e.addEventListener(t,n),e.ljbtEvents[r]={type:t,ns:o,handler:n}}}function S(e,t,n){void 0===e.ljbtEvents&&(e.ljbtEvents={});for(const i of t.split(" ")){const{type:t,ns:o}=w(i);for(const[i,r]of Object.entries(e.ljbtEvents))r.type!==t&&"*"!==t||null!==o&&!r.ns?.includes(o[0])||void 0!==n&&("function"!=typeof n||n!==r.handler)||(delete e.ljbtEvents[i],e.removeEventListener(r.type,r.handler))}}function x(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var k;(function e(t,n){function i(e,i,o){if("undefined"!=typeof document){"number"==typeof(o=x({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var a in o)o[a]&&(r+="; "+a,!0!==o[a]&&(r+="="+o[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+r}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},o=0;o<n.length;o++){var r=n[o].split("="),a=r.slice(1).join("=");try{var s=decodeURIComponent(r[0]);if(i[s]=t.read(a,s),e===s)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",x({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,x({},this.attributes,t))},withConverter:function(t){return e(x({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})})({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});!function(e){e[e.localStorage=1]="localStorage",e[e.cookies=2]="cookies"}(k||(k={}));function _(e,t,n={}){let i,o,r,a,s,l=0;const c=!!n.leading,d="maxWait"in n,u=d?Math.max(n.maxWait||0,t):void 0,p=!("trailing"in n)||!!n.trailing;function h(t){const n=i,a=o;return i=o=void 0,l=t,r=e.apply(a,n),r}function f(e,t){return setTimeout(e,t)}function m(e){const n=e-s;return void 0===s||n>=t||n<0||d&&e-l>=u}function g(){const e=Date.now();if(m(e))return function(e){if(a=void 0,p&&i)return h(e);return i=o=void 0,r}(e);a=f(g,function(e){const n=e-l,i=t-(e-s);return d?Math.min(i,u-n):i}(e))}return function(...e){const n=Date.now(),u=m(n);if(i=e,o=this,s=n,u){if(void 0===a)return function(e){return l=e,a=f(g,t),c?h(e):r}(s);if(d)return a=f(g,t),h(s)}return void 0===a&&(a=f(g,t)),r}}const L=/[&<>"']/g;RegExp(L.source),Object.freeze({"&":"&","<":"<",">":">",'"':""","'":"'"});const{entries:M,setPrototypeOf:R,isFrozen:O,getPrototypeOf:D,getOwnPropertyDescriptor:I}=Object;let{freeze:H,seal:z,create:U}=Object,{apply:P,construct:F}="undefined"!=typeof Reflect&&Reflect;H||(H=function(e){return e}),z||(z=function(e){return e}),P||(P=function(e,t,n){return e.apply(t,n)}),F||(F=function(e,t){return new e(...t)});const B=ee(Array.prototype.forEach),j=ee(Array.prototype.pop),W=ee(Array.prototype.push),G=ee(String.prototype.toLowerCase),V=ee(String.prototype.toString),q=ee(String.prototype.match),Y=ee(String.prototype.replace),$=ee(String.prototype.indexOf),K=ee(String.prototype.trim),X=ee(Object.prototype.hasOwnProperty),J=ee(RegExp.prototype.test),Q=(Z=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return F(Z,t)});var Z;function ee(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return P(e,t,i)}}function te(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:G;R&&R(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(O(t)||(t[i]=e),o=e)}e[o]=!0}return e}function ne(e){for(let t=0;t<e.length;t++){X(e,t)||(e[t]=null)}return e}function ie(e){const t=U(null);for(const[n,i]of M(e)){X(e,n)&&(Array.isArray(i)?t[n]=ne(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=ie(i):t[n]=i)}return t}function oe(e,t){for(;null!==e;){const n=I(e,t);if(n){if(n.get)return ee(n.get);if("function"==typeof n.value)return ee(n.value)}e=D(e)}return function(){return null}}const re=H(["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"]),ae=H(["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"]),se=H(["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"]),le=H(["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"]),ce=H(["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"]),de=H(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ue=H(["#text"]),pe=H(["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"]),he=H(["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"]),fe=H(["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"]),me=H(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ge=z(/\{\{[\w\W]*|[\w\W]*\}\}/gm),be=z(/<%[\w\W]*|[\w\W]*%>/gm),ye=z(/\${[\w\W]*}/gm),Ee=z(/^data-[\-\w.\u00B7-\uFFFF]/),Te=z(/^aria-[\-\w]+$/),ve=z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ae=z(/^(?:\w+script|data):/i),Ne=z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),we=z(/^html$/i),Ce=z(/^[a-z][.\w]*(-[.\w]+)+$/i);var Se=Object.freeze({__proto__:null,ARIA_ATTR:Te,ATTR_WHITESPACE:Ne,CUSTOM_ELEMENT:Ce,DATA_ATTR:Ee,DOCTYPE_NAME:we,ERB_EXPR:be,IS_ALLOWED_URI:ve,IS_SCRIPT_OR_DATA:Ae,MUSTACHE_EXPR:ge,TMPLIT_EXPR:ye});const xe=1,ke=3,_e=7,Le=8,Me=9,Re=function(){return"undefined"==typeof window?null:window};var Oe,De,Ie=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Re();const n=t=>e(t);if(n.version="3.2.2",n.removed=[],!t||!t.document||t.document.nodeType!==Me)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:f}=t,m=c.prototype,g=oe(m,"cloneNode"),b=oe(m,"remove"),y=oe(m,"nextSibling"),E=oe(m,"childNodes"),T=oe(m,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let v,A="";const{implementation:N,createNodeIterator:w,createDocumentFragment:C,getElementsByTagName:S}=i,{importNode:x}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof M&&"function"==typeof T&&N&&void 0!==N.createHTMLDocument;const{MUSTACHE_EXPR:_,ERB_EXPR:L,TMPLIT_EXPR:R,DATA_ATTR:O,ARIA_ATTR:D,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:z,CUSTOM_ELEMENT:P}=Se;let{IS_ALLOWED_URI:F}=Se,Z=null;const ee=te({},[...re,...ae,...se,...ce,...ue]);let ne=null;const ge=te({},[...pe,...he,...fe,...me]);let be=Object.seal(U(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}})),ye=null,Ee=null,Te=!0,Ae=!0,Ne=!1,Ce=!0,Oe=!1,De=!0,Ie=!1,He=!1,ze=!1,Ue=!1,Pe=!1,Fe=!1,Be=!0,je=!1,We=!0,Ge=!1,Ve={},qe=null;const Ye=te({},["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 $e=null;const Ke=te({},["audio","video","img","source","image","track"]);let Xe=null;const Je=te({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qe="http://www.w3.org/1998/Math/MathML",Ze="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml";let tt=et,nt=!1,it=null;const ot=te({},[Qe,Ze,et],V);let rt=te({},["mi","mo","mn","ms","mtext"]),at=te({},["annotation-xml"]);const st=te({},["title","style","font","a","script"]);let lt=null;const ct=["application/xhtml+xml","text/html"];let dt=null,ut=null;const pt=i.createElement("form"),ht=function(e){return e instanceof RegExp||e instanceof Function},ft=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ut||ut!==e){if(e&&"object"==typeof e||(e={}),e=ie(e),lt=-1===ct.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,dt="application/xhtml+xml"===lt?V:G,Z=X(e,"ALLOWED_TAGS")?te({},e.ALLOWED_TAGS,dt):ee,ne=X(e,"ALLOWED_ATTR")?te({},e.ALLOWED_ATTR,dt):ge,it=X(e,"ALLOWED_NAMESPACES")?te({},e.ALLOWED_NAMESPACES,V):ot,Xe=X(e,"ADD_URI_SAFE_ATTR")?te(ie(Je),e.ADD_URI_SAFE_ATTR,dt):Je,$e=X(e,"ADD_DATA_URI_TAGS")?te(ie(Ke),e.ADD_DATA_URI_TAGS,dt):Ke,qe=X(e,"FORBID_CONTENTS")?te({},e.FORBID_CONTENTS,dt):Ye,ye=X(e,"FORBID_TAGS")?te({},e.FORBID_TAGS,dt):{},Ee=X(e,"FORBID_ATTR")?te({},e.FORBID_ATTR,dt):{},Ve=!!X(e,"USE_PROFILES")&&e.USE_PROFILES,Te=!1!==e.ALLOW_ARIA_ATTR,Ae=!1!==e.ALLOW_DATA_ATTR,Ne=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ce=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Oe=e.SAFE_FOR_TEMPLATES||!1,De=!1!==e.SAFE_FOR_XML,Ie=e.WHOLE_DOCUMENT||!1,Ue=e.RETURN_DOM||!1,Pe=e.RETURN_DOM_FRAGMENT||!1,Fe=e.RETURN_TRUSTED_TYPE||!1,ze=e.FORCE_BODY||!1,Be=!1!==e.SANITIZE_DOM,je=e.SANITIZE_NAMED_PROPS||!1,We=!1!==e.KEEP_CONTENT,Ge=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||ve,tt=e.NAMESPACE||et,rt=e.MATHML_TEXT_INTEGRATION_POINTS||rt,at=e.HTML_INTEGRATION_POINTS||at,be=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ht(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(be.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ht(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(be.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(be.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Oe&&(Ae=!1),Pe&&(Ue=!0),Ve&&(Z=te({},ue),ne=[],!0===Ve.html&&(te(Z,re),te(ne,pe)),!0===Ve.svg&&(te(Z,ae),te(ne,he),te(ne,me)),!0===Ve.svgFilters&&(te(Z,se),te(ne,he),te(ne,me)),!0===Ve.mathMl&&(te(Z,ce),te(ne,fe),te(ne,me))),e.ADD_TAGS&&(Z===ee&&(Z=ie(Z)),te(Z,e.ADD_TAGS,dt)),e.ADD_ATTR&&(ne===ge&&(ne=ie(ne)),te(ne,e.ADD_ATTR,dt)),e.ADD_URI_SAFE_ATTR&&te(Xe,e.ADD_URI_SAFE_ATTR,dt),e.FORBID_CONTENTS&&(qe===Ye&&(qe=ie(qe)),te(qe,e.FORBID_CONTENTS,dt)),We&&(Z["#text"]=!0),Ie&&te(Z,["html","head","body"]),Z.table&&(te(Z,["tbody"]),delete ye.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(f,r)),null!==v&&"string"==typeof A&&(A=v.createHTML(""));H&&H(e),ut=e}},mt=te({},[...ae,...se,...le]),gt=te({},[...ce,...de]),bt=function(e){W(n.removed,{element:e});try{T(e).removeChild(e)}catch(t){b(e)}},yt=function(e,t){try{W(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){W(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Ue||Pe)try{bt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Et=function(e){let t=null,n=null;if(ze)e="<remove></remove>"+e;else{const t=q(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===lt&&tt===et&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(tt===et)try{t=(new h).parseFromString(o,lt)}catch(e){}if(!t||!t.documentElement){t=N.createDocument(tt,"template",null);try{t.documentElement.innerHTML=nt?A:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),tt===et?S.call(t,Ie?"html":"body")[0]:Ie?t.documentElement:r},Tt=function(e){return w.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},vt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},At=function(e){return"function"==typeof l&&e instanceof l};function Nt(e,t,i){B(e,(e=>{e.call(n,t,i,ut)}))}const wt=function(e){let t=null;if(Nt(k.beforeSanitizeElements,e,null),vt(e))return bt(e),!0;const i=dt(e.nodeName);if(Nt(k.uponSanitizeElement,e,{tagName:i,allowedTags:Z}),e.hasChildNodes()&&!At(e.firstElementChild)&&J(/<[/\w]/g,e.innerHTML)&&J(/<[/\w]/g,e.textContent))return bt(e),!0;if(e.nodeType===_e)return bt(e),!0;if(De&&e.nodeType===Le&&J(/<[/\w]/g,e.data))return bt(e),!0;if(!Z[i]||ye[i]){if(!ye[i]&&St(i)){if(be.tagNameCheck instanceof RegExp&&J(be.tagNameCheck,i))return!1;if(be.tagNameCheck instanceof Function&&be.tagNameCheck(i))return!1}if(We&&!qe[i]){const t=T(e)||e.parentNode,n=E(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=g(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return bt(e),!0}return e instanceof c&&!function(e){let t=T(e);t&&t.tagName||(t={namespaceURI:tt,tagName:"template"});const n=G(e.tagName),i=G(t.tagName);return!!it[e.namespaceURI]&&(e.namespaceURI===Ze?t.namespaceURI===et?"svg"===n:t.namespaceURI===Qe?"svg"===n&&("annotation-xml"===i||rt[i]):Boolean(mt[n]):e.namespaceURI===Qe?t.namespaceURI===et?"math"===n:t.namespaceURI===Ze?"math"===n&&at[i]:Boolean(gt[n]):e.namespaceURI===et?!(t.namespaceURI===Ze&&!at[i])&&!(t.namespaceURI===Qe&&!rt[i])&&!gt[n]&&(st[n]||!mt[n]):!("application/xhtml+xml"!==lt||!it[e.namespaceURI]))}(e)?(bt(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!J(/<\/no(script|embed|frames)/i,e.innerHTML)?(Oe&&e.nodeType===ke&&(t=e.textContent,B([_,L,R],(e=>{t=Y(t,e," ")})),e.textContent!==t&&(W(n.removed,{element:e.cloneNode()}),e.textContent=t)),Nt(k.afterSanitizeElements,e,null),!1):(bt(e),!0)},Ct=function(e,t,n){if(Be&&("id"===t||"name"===t)&&(n in i||n in pt))return!1;if(Ae&&!Ee[t]&&J(O,t));else if(Te&&J(D,t));else if(!ne[t]||Ee[t]){if(!(St(e)&&(be.tagNameCheck instanceof RegExp&&J(be.tagNameCheck,e)||be.tagNameCheck instanceof Function&&be.tagNameCheck(e))&&(be.attributeNameCheck instanceof RegExp&&J(be.attributeNameCheck,t)||be.attributeNameCheck instanceof Function&&be.attributeNameCheck(t))||"is"===t&&be.allowCustomizedBuiltInElements&&(be.tagNameCheck instanceof RegExp&&J(be.tagNameCheck,n)||be.tagNameCheck instanceof Function&&be.tagNameCheck(n))))return!1}else if(Xe[t]);else if(J(F,Y(n,z,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==$(n,"data:")||!$e[e]){if(Ne&&!J(I,Y(n,z,"")));else if(n)return!1}else;return!0},St=function(e){return"annotation-xml"!==e&&q(e,P)},xt=function(e){Nt(k.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t)return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ne,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:s,value:l}=r,c=dt(a);let d="value"===a?l:K(l);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,Nt(k.uponSanitizeAttribute,e,i),d=i.attrValue,!je||"id"!==c&&"name"!==c||(yt(a,e),d="user-content-"+d),De&&J(/((--!?|])>)|<\/(style|title)/i,d)){yt(a,e);continue}if(i.forceKeepAttr)continue;if(yt(a,e),!i.keepAttr)continue;if(!Ce&&J(/\/>/i,d)){yt(a,e);continue}Oe&&B([_,L,R],(e=>{d=Y(d,e," ")}));const u=dt(e.nodeName);if(Ct(u,c,d)){if(v&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(u,c)){case"TrustedHTML":d=v.createHTML(d);break;case"TrustedScriptURL":d=v.createScriptURL(d)}try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),vt(e)?bt(e):j(n.removed)}catch(e){}}}Nt(k.afterSanitizeAttributes,e,null)},kt=function e(t){let n=null;const i=Tt(t);for(Nt(k.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)Nt(k.uponSanitizeShadowNode,n,null),wt(n)||(n.content instanceof a&&e(n.content),xt(n));Nt(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,s=null,c=null;if(nt=!e,nt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!At(e)){if("function"!=typeof e.toString)throw Q("toString is not a function");if("string"!=typeof(e=e.toString()))throw Q("dirty is not a string, aborting")}if(!n.isSupported)return e;if(He||ft(t),n.removed=[],"string"==typeof e&&(Ge=!1),Ge){if(e.nodeName){const t=dt(e.nodeName);if(!Z[t]||ye[t])throw Q("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=Et("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===xe&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!Ue&&!Oe&&!Ie&&-1===e.indexOf("<"))return v&&Fe?v.createHTML(e):e;if(i=Et(e),!i)return Ue?null:Fe?A:""}i&&ze&&bt(i.firstChild);const d=Tt(Ge?e:i);for(;s=d.nextNode();)wt(s)||(s.content instanceof a&&kt(s.content),xt(s));if(Ge)return e;if(Ue){if(Pe)for(c=C.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(ne.shadowroot||ne.shadowrootmode)&&(c=x.call(o,c,!0)),c}let u=Ie?i.outerHTML:i.innerHTML;return Ie&&Z["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&J(we,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),Oe&&B([_,L,R],(e=>{u=Y(u,e," ")})),v&&Fe?v.createHTML(u):u},n.setConfig=function(){ft(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),He=!0},n.clearConfig=function(){ut=null,He=!1},n.isValidAttribute=function(e,t,n){ut||ft({});const i=dt(e),o=dt(t);return Ct(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&W(k[e],t)},n.removeHook=function(e){return j(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function He(){const e=window.getSelection();return{sel:e,range:e.rangeCount?e.getRangeAt(0):void 0}}function ze(e){const t=document.createRange(),n=window.getSelection();t.setStart(e,1),t.collapse(!0),n.removeAllRanges(),n.addRange(t)}function Ue(e){const t=document.createRange(),n=window.getSelection();t.setStartAfter(e),t.collapse(!0),n.removeAllRanges(),n.addRange(t)}function Pe(e){if(1===e.length&&l(e[0])&&g(e[0].tagName))return void Ue(e[0]);const t=document.createRange(),n=window.getSelection();t.setStartBefore(e[0]),t.setEndAfter(e[e.length-1]),n.removeAllRanges(),n.addRange(t)}function Fe(e){const{range:t}=He();return void 0!==t&&(e.contains(t.startContainer)&&e.contains(t.endContainer))}function Be(e,t){const n=t.parentNode,i=e.cloneRange();i.setStart(n,0);const o=i.extractContents(),r=document.createTextNode("");return o.append(r),n.prepend(o),ze(r),r}function je(e,t){const n=t.parentNode,i=new Range;i.selectNodeContents(n),i.setEnd(e.startContainer,e.startOffset);const o=new Range;o.selectNodeContents(n),o.setStart(e.endContainer,e.endOffset);const r=i.extractContents(),a=o.extractContents();n.prepend(r),n.append(a);let s=l(e.commonAncestorContainer)?e.commonAncestorContainer:e.commonAncestorContainer.parentNode;for(;s.tagName!==t.tagName;)s=s.parentNode;const c=f(s);return Pe(c),c[0].parentNode}function We(e,t={}){const{sel:n,range:i}=He();if(void 0===i)return;if(i.collapsed){let o=n.anchorNode.parentNode;for(;!u(o,"edith-visual");){if(d(o,e))return Be(i,o);o=o.parentNode}return function(e,t,n={}){const i=document.createElement(t);return"a"===t?i.textContent=n.textContent||"lien":i.innerHTML="",e.insertNode(i),"a"===t&&i.insertAdjacentText("afterend"," "),ze(i),i}(i,e,t)}let o=i.commonAncestorContainer;for(;!l(o)||!u(o,"edith-visual");){if(l(o)&&d(o,e))return je(i,o);o=o.parentNode}for(const t of[...o.getElementsByTagName(e)])if(n.containsNode(t,!0)){return Pe(f(t)),o.normalize(),o}const r=document.createElement(e);return r.appendChild(i.extractContents()),i.insertNode(r),b(o,(e=>l(e)&&!g(e.tagName)&&(null===e.textContent||0===e.textContent.length))),function(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n.removeAllRanges(),n.addRange(t)}(r),r}function Ge(e,t){for(let n of[...e.children]){if(d(n,"span")&&u(n,"edith-nbsp")){T(n,{class:"edith-nbsp",contenteditable:"false"}),n.innerHTML="¶";continue}n.hasAttribute("style")&&(n=v(n)),t[n.tagName]&&(n=h(n,p("span",{attributes:{style:n.getAttribute("style")||""},innerHTML:n.innerHTML})));const e={...t};if(d(n,["b","i","q","u","s"])&&(e[n.tagName]=!0),Ge(n,e),d(n,"a")){const e={};n.hasAttribute("href")&&(e.href=n.getAttribute("href")),n.hasAttribute("target")&&(e.target=n.getAttribute("target")),T(n,e)}else if(d(n,["b","i","q","u","s","br","sup"]))T(n,{});else if(d(n,["style","meta","link"]))n.remove();else if(d(n,"p")){if(null===n.textContent||0===n.textContent.trim().length){n.remove();continue}T(n,{}),A(n,"br")}else f(n)}}function Ve(e,t){const n=document.createElement("div");return n.innerHTML=Ie.sanitize(e,{USE_PROFILES:{html:!0}}),Ge(n,t),n.normalize(),b(n,(e=>s(e)&&(null===e.textContent||0===e.textContent.trim().length))),n.innerHTML=n.innerHTML.replace(/\s* \s*/g," ").replace(/\s+/g," ").replace(/(<\/b>[\n\r\s]*<b>|<\/i>[\n\r\s]*<i>|<\/u>[\n\r\s]*<u>|<\/s>[\n\r\s]*<s>)/g," "),E(n),n}!function(e){e.modeChanged="edith-mode-changed",e.initialized="edith-initialized"}(Oe||(Oe={}));class qe{buffer=[];constructor(){}push(e){this.buffer.push(e),this.buffer.length>20&&this.buffer.shift()}pop(){return 0===this.buffer.length?null:this.buffer.pop()}}!function(e){e[e.Visual=1]="Visual",e[e.Code=2]="Code"}(De||(De={}));const Ye={height:80,resizable:!1,toolbar:[["style",["bold","italic","underline","strikethrough"]]],buttons:{},initialContent:""};var $e=o(74);class Ke{el;ctx;icon;title;onclick;showOnCodeView;popperEl;popper;constructor(e,t){this.ctx=e,this.icon=t.icon,this.title=t.title,this.onclick=t.onclick,this.showOnCodeView=!0===t.showOnCodeView}click(e){e.preventDefault(),this.onclick(this.ctx,e)}showTooltip(){if(void 0!==this.popper)return;this.popperEl=p("div",{textContent:this.title,attributes:{class:"edith-tooltip"}});const e=p("div",{attributes:{class:"arrow","data-popper-arrow":""}});this.popperEl.append(e),this.ctx.toolbar.append(this.popperEl),this.popper=(0,$e.createPopper)(this.el,this.popperEl,{placement:"bottom",modifiers:[{name:"arrow",options:{padding:5}},{name:"offset",options:{offset:[0,8]}}]})}hideTooltip(){void 0!==this.popper&&(this.popper.destroy(),this.popper=void 0,this.popperEl?.remove())}onEditorModeChange(e){e.detail.mode===De.Code?this.el.setAttribute("disabled","disabled"):this.el.removeAttribute("disabled")}render(){return this.el=p("button",{attributes:{class:`edith-btn ${this.icon}`,type:"button"}}),this.el.onclick=this.click.bind(this),this.el.onmouseenter=this.showTooltip.bind(this),this.el.onmouseleave=this.hideTooltip.bind(this),!0!==this.showOnCodeView&&this.ctx.on(Oe.modeChanged,this.onEditorModeChange.bind(this)),this.el}}const Xe=Object.freeze({bold:e=>new Ke(e,{icon:"fa-solid fa-bold",title:"Gras",onclick:e=>{e.editor.wrapInsideTag("b")}}),italic:e=>new Ke(e,{icon:"fa-solid fa-italic",title:"Italique",onclick:e=>{e.editor.wrapInsideTag("i")}}),underline:e=>new Ke(e,{icon:"fa-solid fa-underline",title:"Souligner",onclick:e=>{e.editor.wrapInsideTag("u")}}),strikethrough:e=>new Ke(e,{icon:"fa-solid fa-strikethrough",title:"Barrer",onclick:e=>{e.editor.wrapInsideTag("s")}}),subscript:e=>new Ke(e,{icon:"fa-solid fa-subscript",title:"Indice",onclick:e=>{e.editor.wrapInsideTag("sub")}}),superscript:e=>new Ke(e,{icon:"fa-solid fa-superscript",title:"Exposant",onclick:e=>{e.editor.wrapInsideTag("sup")}}),nbsp:e=>new Ke(e,{icon:"edith-btn-nbsp",title:"Ajouter une espace insécable",onclick:e=>{e.editor.replaceByHtml('<span class="edith-nbsp" contenteditable="false">¶</span>')}}),clear:e=>new Ke(e,{icon:"fa-solid fa-eraser",title:"Effacer la mise en forme",onclick:e=>{e.editor.clearStyle()}}),link:e=>new Ke(e,{icon:"fa-solid fa-link",title:"Lien",onclick:e=>{e.editor.insertLink()}}),codeview:e=>new Ke(e,{icon:"fa-solid fa-code",title:"Afficher le code HTML",onclick:e=>{e.editor.toggleCodeView()},showOnCodeView:!0})});var Je,Qe=o(690);function Ze(e){const t=document.createElement("div");t.setAttribute("class","edith-modal-input");const n=document.createElement("label");n.textContent=e.label;const i=document.createElement("input");return i.setAttribute("name",e.name),i.setAttribute("type","text"),null!==e.initialState&&(i.value=e.initialState.toString()),t.append(n),t.append(i),t}function et(e){const t=document.createElement("div");t.setAttribute("class","edith-modal-checkbox");const n=document.createElement("label");n.textContent=e.label;const i=document.createElement("input");return i.setAttribute("name",e.name),i.setAttribute("type","checkbox"),e.initialState&&(i.checked=!0),n.prepend(i),t.append(n),t}function tt(e,t,n=null){return{fieldType:Je.input,label:e,name:t,initialState:n}}function nt(e,t,n=!1){return{fieldType:Je.checkbox,label:e,name:t,initialState:n}}!function(e){e[e.input=1]="input",e[e.checkbox=2]="checkbox"}(Je||(Je={}));class it{el;ctx;title;fields;callback;constructor(e,t){this.ctx=e,this.title=t.title,this.fields=t.fields||[],this.callback=t.callback}cancel(e){e.preventDefault(),this.callback(null),this.close()}submit(e){e.preventDefault();const t={};for(const e of this.el.querySelectorAll("input"))n="name",e.hasAttribute(n)&&(t[c(e,"name")]="checkbox"===c(e,"type")?e.checked:e.value);var n;this.callback(t),this.close()}close(){this.el.remove()}show(){this.el=p("div",{attributes:{class:"edith-modal"}});const e=p("div",{attributes:{class:"edith-modal-header"}}),t=p("span",{textContent:this.title,attributes:{class:"edith-modal-title"}});e.append(t);const n=p("div",{attributes:{class:"edith-modal-content"}});for(const e of this.fields)switch(e.fieldType){case Je.input:n.append(Ze(e));break;case Je.checkbox:n.append(et(e));break;default:throw new Error(`Unknown fieldType ${e.fieldType}`)}const i=p("div",{attributes:{class:"edith-modal-footer"}}),o=p("button",{textContent:"Annuler",attributes:{class:"edith-modal-cancel",type:"button"}});i.append(o);const r=p("button",{textContent:"Valider",attributes:{class:"edith-modal-submit",type:"button"}});return i.append(r),this.el.append(e),this.el.append(n),this.el.append(i),this.ctx.modals.append(this.el),o.onclick=this.cancel.bind(this),r.onclick=this.submit.bind(this),this.el}}class ot{el;ctx;content;height;resizable;mode;visualEditor;codeEditor;codeMirror;history;throttledSnapshots;constructor(e,t){this.ctx=e,this.content=t.initialContent,this.height=t.height,this.resizable=t.resizable,this.mode=De.Visual,this.history=new qe,this.throttledSnapshots=function(e,t,n={}){return _(e,t,{leading:!("leading"in n)||!!n.leading,trailing:!("trailing"in n)||!!n.trailing,maxWait:t})}((()=>this.takeSnapshot()),3e3,{leading:!1,trailing:!0}),this.content=this.content.replace(/ /g,'<span class="edith-nbsp" contenteditable="false">¶</span>')}render(){this.el=p("div",{attributes:{class:"edith-editing-area",style:this.resizable?`min-height: ${this.height}px; resize: vertical`:`height: ${this.height}px`}}),this.visualEditor=p("div",{innerHTML:this.content,attributes:{class:"edith-visual",contenteditable:"true",style:this.resizable?`min-height: ${this.height-10}px`:`height: ${this.height-10}px`}}),this.el.append(this.visualEditor),this.codeEditor=p("div",{attributes:{class:"edith-code edith-hidden"}}),this.el.append(this.codeEditor);const e=this.onKeyEvent.bind(this);this.visualEditor.addEventListener("keydown",e),this.visualEditor.addEventListener("keyup",e);const t=this.onPasteEvent.bind(this);return this.visualEditor.addEventListener("paste",t),this.el}getVisualEditorElement(){return this.visualEditor}getCodeEditorElement(){return this.codeEditor}setContent(e){e=e.replace(/ /g,'<span class="edith-nbsp" contenteditable="false">¶</span>'),this.mode===De.Visual?this.visualEditor.innerHTML=e:this.codeMirror.dispatch({changes:{from:0,to:this.codeMirror.state.doc.length,insert:e}})}getContent(){const e=this.mode===De.Visual?this.visualEditor.innerHTML:this.codeMirror.state.doc.toJSON().map((e=>e.trim())).join("\n");if("<p><br></p>"===e)return"";const t=p("div",{innerHTML:e});y(t,(e=>l(e)&&!g(e.tagName)&&(null===e.textContent||0===e.textContent.length)));for(const e of t.querySelectorAll("[style]"))e.removeAttribute("style");for(const e of t.querySelectorAll("span"))0===e.attributes.length&&f(e);return t.innerHTML.replace(/\u200B/gi,"").replace(/<\/p>\s*<p>/gi,"<br>").replace(/(<p>|<\/p>)/gi,"").replace(/<span[^>]+class="edith-nbsp"[^>]*>[^<]*<\/span>/gi," ").replace(/(?:<br\s?\/?>)+$/gi,"")}takeSnapshot(){this.history.push(this.visualEditor.innerHTML)}restoreSnapshot(){this.visualEditor.innerHTML=this.history.pop()??""}wrapInsideTag(e){Fe(this.visualEditor)&&(We(e),this.takeSnapshot())}replaceByHtml(e){Fe(this.visualEditor)&&(!function(e){const{sel:t,range:n}=He();if(void 0===n)return;const i=document.createDocumentFragment(),o=p("div",{innerHTML:e});i.append(...o.childNodes);const r=i.childNodes[i.childNodes.length-1];t.deleteFromDocument(),n.insertNode(i),Ue(r)}(e),this.takeSnapshot())}clearStyle(){!function(){const{sel:e,range:t}=He();if(void 0!==t&&l(t.commonAncestorContainer))for(const n of[...t.commonAncestorContainer.children])e.containsNode(n,!0)&&m(n)}(),this.takeSnapshot()}insertLink(){const{sel:e,range:t}=He();if(void 0===t)return;const n=new it(this.ctx,{title:"Insérer un lien",fields:[tt("Texte à afficher","text",t.toString()),tt("URL du lien","href"),nt("Ouvrir dans une nouvelle fenêtre","openInNewTab",!0)],callback:n=>{null!==n&&(function(e){const t=window.getSelection();t.removeAllRanges(),void 0!==e.range&&t.addRange(e.range)}({sel:e,range:t}),function(e,t,n){const i=We("a",{textContent:e});if(void 0!==i)l(i)&&(i.setAttribute("href",t),!0===n&&i.setAttribute("target","_blank"))}(n.text,n.href,n.openInNewTab))}});n.show()}toggleCodeView(){if(this.mode===De.Visual){this.mode=De.Code,this.visualEditor.classList.add("edith-hidden"),this.codeEditor.classList.remove("edith-hidden");const e=document.createElement("div");this.codeEditor.append(e),this.codeMirror=new Qe.EditorView({doc:this.visualEditor.innerHTML,extensions:[Qe.basicSetup,Qe.EditorView.lineWrapping,(0,Qe.html)({matchClosingTags:!0,autoCloseTags:!0})],parent:e})}else this.mode=De.Visual,this.codeEditor.classList.add("edith-hidden"),this.visualEditor.classList.remove("edith-hidden"),this.visualEditor.innerHTML=this.codeMirror.state.doc.toJSON().map((e=>e.trim())).join("\n"),this.codeMirror.destroy(),this.codeMirror=void 0,this.codeEditor.innerHTML="";this.ctx.trigger(Oe.modeChanged,{mode:this.mode})}onKeyEvent(e){(e.metaKey||e.ctrlKey?this._processKeyEventWithMeta(e):this._processKeyEvent(e))&&(e.preventDefault(),e.stopPropagation())}_processKeyEvent(e){return"Enter"===e.key?("keydown"===e.type&&this.replaceByHtml("<br />"),!0):(this.throttledSnapshots(),!1)}_processKeyEventWithMeta(e){switch(e.key){case"Enter":return"keydown"===e.type&&this.replaceByHtml("<br />"),!0;case" ":return"keydown"===e.type&&this.replaceByHtml('<span class="edith-nbsp" contenteditable="false">¶</span>'),!0;case"b":return"keydown"===e.type&&this.wrapInsideTag("b"),!0;case"i":return"keydown"===e.type&&this.wrapInsideTag("i"),!0;case"k":return"keydown"===e.type&&this.insertLink(),!0;case"u":return"keydown"===e.type&&this.wrapInsideTag("u"),!0;case"s":return"keydown"===e.type&&this.wrapInsideTag("s"),!0;case"z":return"keydown"===e.type&&this.restoreSnapshot(),!0}return!1}onPasteEvent(e){e.preventDefault(),e.stopPropagation();const{sel:t,range:n}=He();if(void 0===n||null===e.clipboardData)return;const i=document.createDocumentFragment();if(e.clipboardData.types.includes("text/html")){let n=s(t.anchorNode)?t.anchorNode.parentNode:t.anchorNode;const o={B:!1,I:!1,U:!1,S:!1,Q:!1};for(;null!==n&&!u(n,"edith-visual");)d(n,["b","i","u","s","q"])&&(o[(n.tagName,"Q")]=!0),n=n.parentNode;let r=e.clipboardData.getData("text/html").replace(/[\r\n]+/g," ");/^<html>\s*<body>/.test(r)||(r="<html><body>"+r+"</body></html>");const a=Ve(r,o);i.append(...a.childNodes)}else{const t=e.clipboardData.getData("text/plain").split(/[\r\n]+/g);for(let e=0;e<t.length;e++)0!==e&&i.append(document.createElement("br")),i.append(document.createTextNode(t[e]))}t.deleteFromDocument(),n.insertNode(i)}destroy(){this.codeMirror?.destroy(),this.codeMirror=void 0,this.el.remove()}}class rt{element;toolbar;editor;modals;constructor(e,t){var n,i;this.element=e,n=this.element,"string"==typeof(i="edith")?n.classList.add(i):n.classList.add(...i),this.toolbar=p("div",{attributes:{class:"edith-toolbar"}}),this.element.append(this.toolbar);const o=t.buttons??Ye.buttons,r=t.toolbar??Ye.toolbar;for(const{0:e,1:t}of r){const n=document.createElement("div");n.setAttribute("id",e),n.setAttribute("class","edith-btn-group"),this.toolbar.append(n);for(const e of t){const t=o[e]??Xe[e];n.append(t(this).render())}}this.editor=new ot(this,{initialContent:t.initialContent??Ye.initialContent,height:t.height??Ye.height,resizable:t.resizable??Ye.resizable}),this.element.append(this.editor.render()),this.modals=p("div",{attributes:{class:"edith-modals"}}),this.element.append(this.modals),this.element.edith=this,this.trigger(Oe.initialized)}on(e,t){!function(e,t,n){if(e instanceof NodeList)for(const i of e)C(i,t,n);else C(e,t,n)}(this.element,e,t)}off(e,t){!function(e,t,n){if(e instanceof NodeList)for(const i of e)S(i,t,n);else S(e,t,n)}(this.element,e,t)}trigger(e,t){!function(e,t,n){e.dispatchEvent("string"==typeof t?new CustomEvent(t,{detail:n}):t)}(this.element,e,t)}setContent(e){this.editor.setContent(e)}getContent(){return this.editor.getContent()}destroy(){var e,t;e=this.element,"string"==typeof(t="edith")?e.classList.remove(t):e.classList.remove(...t),this.modals.remove(),this.editor.destroy(),this.toolbar.remove(),this.element.remove()}}rt.EdithButton=Ke;var at=rt;return r=r.default}()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("CodeMirror"),require("Popper")):"function"==typeof define&&define.amd?define(["CodeMirror","Popper"],t):"object"==typeof exports?exports.Edith=t(require("CodeMirror"),require("Popper")):e.Edith=t(e.CodeMirror,e.Popper)}(self,(function(e,t){return function(){"use strict";var n={690:function(t){t.exports=e},74:function(e){e.exports=t}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,o),r.exports}o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};function a(e,t){return l(e)&&e.tagName===t.toUpperCase()}function s(e){return e.nodeType===Node.TEXT_NODE}function l(e){return e.nodeType===Node.ELEMENT_NODE}function c(e,t){return e.getAttribute(t)}function d(e,t){return"string"==typeof t?e.tagName===t.toUpperCase():t.some((t=>e.tagName===t.toUpperCase()))}function u(e,t){return e.classList.contains(t)}function p(e,{innerHTML:t,textContent:n,attributes:i}={}){const o=document.createElement(e);if(i)for(const e in i)Object.hasOwnProperty.call(i,e)&&o.setAttribute(e,i[e]);return"string"==typeof t?o.innerHTML=t:"string"==typeof n&&(o.textContent=n),o}function h(e,t){return e.replaceWith(t),t}function f(e){const t=[...e.childNodes];return e.replaceWith(...t),t}function m(e){const t=document.createTextNode(e.textContent??"");return e.replaceWith(t),t}function g(e){return["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e)}function b(e,t){for(const n of[...e.childNodes])t(n)&&n.remove()}function y(e,t){if(t(e))e.remove();else for(const n of[...e.childNodes])y(n,t)}function E(e){b(e,(e=>function(e){return e.nodeType===Node.COMMENT_NODE}(e)))}function T(e,t){for(const n of e.getAttributeNames())void 0===t[n]&&e.removeAttribute(n);for(const n of Object.keys(t))e.setAttribute(n,t[n])}function v(e){const t=e.getAttribute("style")||"";return(d(e,"b")&&t.match(/font-weight\s*:\s*(normal|400);/)||d(e,"i")&&t.match(/font-style\s*:\s*normal;/)||d(e,["u","s"])&&t.match(/text-decoration\s*:\s*none;/))&&(e=h(e,p("span",{attributes:{style:t},innerHTML:e.innerHTML}))),t.match(/font-weight\s*:\s*(bold|700|800|900);/)?e=h(e,p("b",{innerHTML:`<span style="${t.replace(/font-weight\s*:\s*(bold|700|800|900);/,"")}">${e.innerHTML}</span>`})):t.match(/font-style\s*:\s*italic;/)?e=h(e,p("i",{innerHTML:`<span style="${t.replace(/font-style\s*:\s*italic;/,"")}">${e.innerHTML}</span>`})):t.match(/text-decoration\s*:\s*underline;/)?e=h(e,p("u",{innerHTML:`<span style="${t.replace(/text-decoration\s*:\s*underline;/,"")}">${e.innerHTML}</span>`})):t.match(/text-decoration\s*:\s*line-through;/)&&(e=h(e,p("s",{innerHTML:`<span style="${t.replace(/text-decoration\s*:\s*line-through;/,"")}">${e.innerHTML}</span>`}))),e}function A(e,t){const n=e.childNodes;for(;n.length>0&&a(n[0],t);)n[0].remove();for(;n.length>0&&a(n[n.length-1],t);)n[n.length-1].remove()}o.d(r,{default:function(){return at}});let N=0;function w(e){const[t,...n]=e.split(".");return{type:t,ns:n??null}}function C(e,t,n){void 0===e.ljbtEvents&&(e.ljbtEvents={});for(const i of t.split(" ")){const{type:t,ns:o}=w(i),r=(++N).toString(10);e.addEventListener(t,n),e.ljbtEvents[r]={type:t,ns:o,handler:n}}}function S(e,t,n){void 0===e.ljbtEvents&&(e.ljbtEvents={});for(const i of t.split(" ")){const{type:t,ns:o}=w(i);for(const[i,r]of Object.entries(e.ljbtEvents))r.type!==t&&"*"!==t||null!==o&&!r.ns?.includes(o[0])||void 0!==n&&("function"!=typeof n||n!==r.handler)||(delete e.ljbtEvents[i],e.removeEventListener(r.type,r.handler))}}function x(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var k;(function e(t,n){function i(e,i,o){if("undefined"!=typeof document){"number"==typeof(o=x({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var a in o)o[a]&&(r+="; "+a,!0!==o[a]&&(r+="="+o[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+r}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},o=0;o<n.length;o++){var r=n[o].split("="),a=r.slice(1).join("=");try{var s=decodeURIComponent(r[0]);if(i[s]=t.read(a,s),e===s)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",x({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,x({},this.attributes,t))},withConverter:function(t){return e(x({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})})({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});!function(e){e[e.localStorage=1]="localStorage",e[e.cookies=2]="cookies"}(k||(k={}));function _(e,t,n={}){let i,o,r,a,s,l=0;const c=!!n.leading,d="maxWait"in n,u=d?Math.max(n.maxWait||0,t):void 0,p=!("trailing"in n)||!!n.trailing;function h(t){const n=i,a=o;return i=o=void 0,l=t,r=e.apply(a,n),r}function f(e,t){return setTimeout(e,t)}function m(e){const n=e-s;return void 0===s||n>=t||n<0||d&&e-l>=u}function g(){const e=Date.now();if(m(e))return function(e){if(a=void 0,p&&i)return h(e);return i=o=void 0,r}(e);a=f(g,function(e){const n=e-l,i=t-(e-s);return d?Math.min(i,u-n):i}(e))}return function(...e){const n=Date.now(),u=m(n);if(i=e,o=this,s=n,u){if(void 0===a)return function(e){return l=e,a=f(g,t),c?h(e):r}(s);if(d)return a=f(g,t),h(s)}return void 0===a&&(a=f(g,t)),r}}const L=/[&<>"']/g;RegExp(L.source),Object.freeze({"&":"&","<":"<",">":">",'"':""","'":"'"});const{entries:M,setPrototypeOf:R,isFrozen:O,getPrototypeOf:D,getOwnPropertyDescriptor:I}=Object;let{freeze:H,seal:z,create:U}=Object,{apply:P,construct:F}="undefined"!=typeof Reflect&&Reflect;H||(H=function(e){return e}),z||(z=function(e){return e}),P||(P=function(e,t,n){return e.apply(t,n)}),F||(F=function(e,t){return new e(...t)});const B=ee(Array.prototype.forEach),j=ee(Array.prototype.pop),W=ee(Array.prototype.push),G=ee(String.prototype.toLowerCase),V=ee(String.prototype.toString),$=ee(String.prototype.match),q=ee(String.prototype.replace),Y=ee(String.prototype.indexOf),K=ee(String.prototype.trim),X=ee(Object.prototype.hasOwnProperty),J=ee(RegExp.prototype.test),Q=(Z=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return F(Z,t)});var Z;function ee(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return P(e,t,i)}}function te(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:G;R&&R(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(O(t)||(t[i]=e),o=e)}e[o]=!0}return e}function ne(e){for(let t=0;t<e.length;t++){X(e,t)||(e[t]=null)}return e}function ie(e){const t=U(null);for(const[n,i]of M(e)){X(e,n)&&(Array.isArray(i)?t[n]=ne(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=ie(i):t[n]=i)}return t}function oe(e,t){for(;null!==e;){const n=I(e,t);if(n){if(n.get)return ee(n.get);if("function"==typeof n.value)return ee(n.value)}e=D(e)}return function(){return null}}const re=H(["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"]),ae=H(["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"]),se=H(["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"]),le=H(["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"]),ce=H(["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"]),de=H(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ue=H(["#text"]),pe=H(["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"]),he=H(["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"]),fe=H(["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"]),me=H(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ge=z(/\{\{[\w\W]*|[\w\W]*\}\}/gm),be=z(/<%[\w\W]*|[\w\W]*%>/gm),ye=z(/\$\{[\w\W]*}/gm),Ee=z(/^data-[\-\w.\u00B7-\uFFFF]+$/),Te=z(/^aria-[\-\w]+$/),ve=z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ae=z(/^(?:\w+script|data):/i),Ne=z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),we=z(/^html$/i),Ce=z(/^[a-z][.\w]*(-[.\w]+)+$/i);var Se=Object.freeze({__proto__:null,ARIA_ATTR:Te,ATTR_WHITESPACE:Ne,CUSTOM_ELEMENT:Ce,DATA_ATTR:Ee,DOCTYPE_NAME:we,ERB_EXPR:be,IS_ALLOWED_URI:ve,IS_SCRIPT_OR_DATA:Ae,MUSTACHE_EXPR:ge,TMPLIT_EXPR:ye});const xe=1,ke=3,_e=7,Le=8,Me=9,Re=function(){return"undefined"==typeof window?null:window};var Oe,De,Ie=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Re();const n=t=>e(t);if(n.version="3.2.3",n.removed=[],!t||!t.document||t.document.nodeType!==Me)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:f}=t,m=c.prototype,g=oe(m,"cloneNode"),b=oe(m,"remove"),y=oe(m,"nextSibling"),E=oe(m,"childNodes"),T=oe(m,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let v,A="";const{implementation:N,createNodeIterator:w,createDocumentFragment:C,getElementsByTagName:S}=i,{importNode:x}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof M&&"function"==typeof T&&N&&void 0!==N.createHTMLDocument;const{MUSTACHE_EXPR:_,ERB_EXPR:L,TMPLIT_EXPR:R,DATA_ATTR:O,ARIA_ATTR:D,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:z,CUSTOM_ELEMENT:P}=Se;let{IS_ALLOWED_URI:F}=Se,Z=null;const ee=te({},[...re,...ae,...se,...ce,...ue]);let ne=null;const ge=te({},[...pe,...he,...fe,...me]);let be=Object.seal(U(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}})),ye=null,Ee=null,Te=!0,Ae=!0,Ne=!1,Ce=!0,Oe=!1,De=!0,Ie=!1,He=!1,ze=!1,Ue=!1,Pe=!1,Fe=!1,Be=!0,je=!1,We=!0,Ge=!1,Ve={},$e=null;const qe=te({},["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 Ye=null;const Ke=te({},["audio","video","img","source","image","track"]);let Xe=null;const Je=te({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qe="http://www.w3.org/1998/Math/MathML",Ze="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml";let tt=et,nt=!1,it=null;const ot=te({},[Qe,Ze,et],V);let rt=te({},["mi","mo","mn","ms","mtext"]),at=te({},["annotation-xml"]);const st=te({},["title","style","font","a","script"]);let lt=null;const ct=["application/xhtml+xml","text/html"];let dt=null,ut=null;const pt=i.createElement("form"),ht=function(e){return e instanceof RegExp||e instanceof Function},ft=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ut||ut!==e){if(e&&"object"==typeof e||(e={}),e=ie(e),lt=-1===ct.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,dt="application/xhtml+xml"===lt?V:G,Z=X(e,"ALLOWED_TAGS")?te({},e.ALLOWED_TAGS,dt):ee,ne=X(e,"ALLOWED_ATTR")?te({},e.ALLOWED_ATTR,dt):ge,it=X(e,"ALLOWED_NAMESPACES")?te({},e.ALLOWED_NAMESPACES,V):ot,Xe=X(e,"ADD_URI_SAFE_ATTR")?te(ie(Je),e.ADD_URI_SAFE_ATTR,dt):Je,Ye=X(e,"ADD_DATA_URI_TAGS")?te(ie(Ke),e.ADD_DATA_URI_TAGS,dt):Ke,$e=X(e,"FORBID_CONTENTS")?te({},e.FORBID_CONTENTS,dt):qe,ye=X(e,"FORBID_TAGS")?te({},e.FORBID_TAGS,dt):{},Ee=X(e,"FORBID_ATTR")?te({},e.FORBID_ATTR,dt):{},Ve=!!X(e,"USE_PROFILES")&&e.USE_PROFILES,Te=!1!==e.ALLOW_ARIA_ATTR,Ae=!1!==e.ALLOW_DATA_ATTR,Ne=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ce=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Oe=e.SAFE_FOR_TEMPLATES||!1,De=!1!==e.SAFE_FOR_XML,Ie=e.WHOLE_DOCUMENT||!1,Ue=e.RETURN_DOM||!1,Pe=e.RETURN_DOM_FRAGMENT||!1,Fe=e.RETURN_TRUSTED_TYPE||!1,ze=e.FORCE_BODY||!1,Be=!1!==e.SANITIZE_DOM,je=e.SANITIZE_NAMED_PROPS||!1,We=!1!==e.KEEP_CONTENT,Ge=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||ve,tt=e.NAMESPACE||et,rt=e.MATHML_TEXT_INTEGRATION_POINTS||rt,at=e.HTML_INTEGRATION_POINTS||at,be=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ht(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(be.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ht(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(be.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(be.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Oe&&(Ae=!1),Pe&&(Ue=!0),Ve&&(Z=te({},ue),ne=[],!0===Ve.html&&(te(Z,re),te(ne,pe)),!0===Ve.svg&&(te(Z,ae),te(ne,he),te(ne,me)),!0===Ve.svgFilters&&(te(Z,se),te(ne,he),te(ne,me)),!0===Ve.mathMl&&(te(Z,ce),te(ne,fe),te(ne,me))),e.ADD_TAGS&&(Z===ee&&(Z=ie(Z)),te(Z,e.ADD_TAGS,dt)),e.ADD_ATTR&&(ne===ge&&(ne=ie(ne)),te(ne,e.ADD_ATTR,dt)),e.ADD_URI_SAFE_ATTR&&te(Xe,e.ADD_URI_SAFE_ATTR,dt),e.FORBID_CONTENTS&&($e===qe&&($e=ie($e)),te($e,e.FORBID_CONTENTS,dt)),We&&(Z["#text"]=!0),Ie&&te(Z,["html","head","body"]),Z.table&&(te(Z,["tbody"]),delete ye.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(f,r)),null!==v&&"string"==typeof A&&(A=v.createHTML(""));H&&H(e),ut=e}},mt=te({},[...ae,...se,...le]),gt=te({},[...ce,...de]),bt=function(e){W(n.removed,{element:e});try{T(e).removeChild(e)}catch(t){b(e)}},yt=function(e,t){try{W(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){W(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Ue||Pe)try{bt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Et=function(e){let t=null,n=null;if(ze)e="<remove></remove>"+e;else{const t=$(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===lt&&tt===et&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(tt===et)try{t=(new h).parseFromString(o,lt)}catch(e){}if(!t||!t.documentElement){t=N.createDocument(tt,"template",null);try{t.documentElement.innerHTML=nt?A:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),tt===et?S.call(t,Ie?"html":"body")[0]:Ie?t.documentElement:r},Tt=function(e){return w.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},vt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},At=function(e){return"function"==typeof l&&e instanceof l};function Nt(e,t,i){B(e,(e=>{e.call(n,t,i,ut)}))}const wt=function(e){let t=null;if(Nt(k.beforeSanitizeElements,e,null),vt(e))return bt(e),!0;const i=dt(e.nodeName);if(Nt(k.uponSanitizeElement,e,{tagName:i,allowedTags:Z}),e.hasChildNodes()&&!At(e.firstElementChild)&&J(/<[/\w]/g,e.innerHTML)&&J(/<[/\w]/g,e.textContent))return bt(e),!0;if(e.nodeType===_e)return bt(e),!0;if(De&&e.nodeType===Le&&J(/<[/\w]/g,e.data))return bt(e),!0;if(!Z[i]||ye[i]){if(!ye[i]&&St(i)){if(be.tagNameCheck instanceof RegExp&&J(be.tagNameCheck,i))return!1;if(be.tagNameCheck instanceof Function&&be.tagNameCheck(i))return!1}if(We&&!$e[i]){const t=T(e)||e.parentNode,n=E(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=g(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return bt(e),!0}return e instanceof c&&!function(e){let t=T(e);t&&t.tagName||(t={namespaceURI:tt,tagName:"template"});const n=G(e.tagName),i=G(t.tagName);return!!it[e.namespaceURI]&&(e.namespaceURI===Ze?t.namespaceURI===et?"svg"===n:t.namespaceURI===Qe?"svg"===n&&("annotation-xml"===i||rt[i]):Boolean(mt[n]):e.namespaceURI===Qe?t.namespaceURI===et?"math"===n:t.namespaceURI===Ze?"math"===n&&at[i]:Boolean(gt[n]):e.namespaceURI===et?!(t.namespaceURI===Ze&&!at[i])&&!(t.namespaceURI===Qe&&!rt[i])&&!gt[n]&&(st[n]||!mt[n]):!("application/xhtml+xml"!==lt||!it[e.namespaceURI]))}(e)?(bt(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!J(/<\/no(script|embed|frames)/i,e.innerHTML)?(Oe&&e.nodeType===ke&&(t=e.textContent,B([_,L,R],(e=>{t=q(t,e," ")})),e.textContent!==t&&(W(n.removed,{element:e.cloneNode()}),e.textContent=t)),Nt(k.afterSanitizeElements,e,null),!1):(bt(e),!0)},Ct=function(e,t,n){if(Be&&("id"===t||"name"===t)&&(n in i||n in pt))return!1;if(Ae&&!Ee[t]&&J(O,t));else if(Te&&J(D,t));else if(!ne[t]||Ee[t]){if(!(St(e)&&(be.tagNameCheck instanceof RegExp&&J(be.tagNameCheck,e)||be.tagNameCheck instanceof Function&&be.tagNameCheck(e))&&(be.attributeNameCheck instanceof RegExp&&J(be.attributeNameCheck,t)||be.attributeNameCheck instanceof Function&&be.attributeNameCheck(t))||"is"===t&&be.allowCustomizedBuiltInElements&&(be.tagNameCheck instanceof RegExp&&J(be.tagNameCheck,n)||be.tagNameCheck instanceof Function&&be.tagNameCheck(n))))return!1}else if(Xe[t]);else if(J(F,q(n,z,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Y(n,"data:")||!Ye[e]){if(Ne&&!J(I,q(n,z,"")));else if(n)return!1}else;return!0},St=function(e){return"annotation-xml"!==e&&$(e,P)},xt=function(e){Nt(k.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||vt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ne,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:s,value:l}=r,c=dt(a);let d="value"===a?l:K(l);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,Nt(k.uponSanitizeAttribute,e,i),d=i.attrValue,!je||"id"!==c&&"name"!==c||(yt(a,e),d="user-content-"+d),De&&J(/((--!?|])>)|<\/(style|title)/i,d)){yt(a,e);continue}if(i.forceKeepAttr)continue;if(yt(a,e),!i.keepAttr)continue;if(!Ce&&J(/\/>/i,d)){yt(a,e);continue}Oe&&B([_,L,R],(e=>{d=q(d,e," ")}));const u=dt(e.nodeName);if(Ct(u,c,d)){if(v&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(u,c)){case"TrustedHTML":d=v.createHTML(d);break;case"TrustedScriptURL":d=v.createScriptURL(d)}try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),vt(e)?bt(e):j(n.removed)}catch(e){}}}Nt(k.afterSanitizeAttributes,e,null)},kt=function e(t){let n=null;const i=Tt(t);for(Nt(k.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)Nt(k.uponSanitizeShadowNode,n,null),wt(n),xt(n),n.content instanceof a&&e(n.content);Nt(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,s=null,c=null;if(nt=!e,nt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!At(e)){if("function"!=typeof e.toString)throw Q("toString is not a function");if("string"!=typeof(e=e.toString()))throw Q("dirty is not a string, aborting")}if(!n.isSupported)return e;if(He||ft(t),n.removed=[],"string"==typeof e&&(Ge=!1),Ge){if(e.nodeName){const t=dt(e.nodeName);if(!Z[t]||ye[t])throw Q("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=Et("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===xe&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!Ue&&!Oe&&!Ie&&-1===e.indexOf("<"))return v&&Fe?v.createHTML(e):e;if(i=Et(e),!i)return Ue?null:Fe?A:""}i&&ze&&bt(i.firstChild);const d=Tt(Ge?e:i);for(;s=d.nextNode();)wt(s),xt(s),s.content instanceof a&&kt(s.content);if(Ge)return e;if(Ue){if(Pe)for(c=C.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(ne.shadowroot||ne.shadowrootmode)&&(c=x.call(o,c,!0)),c}let u=Ie?i.outerHTML:i.innerHTML;return Ie&&Z["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&J(we,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),Oe&&B([_,L,R],(e=>{u=q(u,e," ")})),v&&Fe?v.createHTML(u):u},n.setConfig=function(){ft(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),He=!0},n.clearConfig=function(){ut=null,He=!1},n.isValidAttribute=function(e,t,n){ut||ft({});const i=dt(e),o=dt(t);return Ct(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&W(k[e],t)},n.removeHook=function(e){return j(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function He(){const e=window.getSelection();return{sel:e,range:e.rangeCount?e.getRangeAt(0):void 0}}function ze(e){const t=document.createRange(),n=window.getSelection();t.setStart(e,1),t.collapse(!0),n.removeAllRanges(),n.addRange(t)}function Ue(e){const t=document.createRange(),n=window.getSelection();t.setStartAfter(e),t.collapse(!0),n.removeAllRanges(),n.addRange(t)}function Pe(e){if(1===e.length&&l(e[0])&&g(e[0].tagName))return void Ue(e[0]);const t=document.createRange(),n=window.getSelection();t.setStartBefore(e[0]),t.setEndAfter(e[e.length-1]),n.removeAllRanges(),n.addRange(t)}function Fe(e){const{range:t}=He();return void 0!==t&&(e.contains(t.startContainer)&&e.contains(t.endContainer))}function Be(e,t){const n=t.parentNode,i=e.cloneRange();i.setStart(n,0);const o=i.extractContents(),r=document.createTextNode("");return o.append(r),n.prepend(o),ze(r),r}function je(e,t){const n=t.parentNode,i=new Range;i.selectNodeContents(n),i.setEnd(e.startContainer,e.startOffset);const o=new Range;o.selectNodeContents(n),o.setStart(e.endContainer,e.endOffset);const r=i.extractContents(),a=o.extractContents();n.prepend(r),n.append(a);let s=l(e.commonAncestorContainer)?e.commonAncestorContainer:e.commonAncestorContainer.parentNode;for(;s.tagName!==t.tagName;)s=s.parentNode;const c=f(s);return Pe(c),c[0].parentNode}function We(e,t={}){const{sel:n,range:i}=He();if(void 0===i)return;if(i.collapsed){let o=n.anchorNode.parentNode;for(;!u(o,"edith-visual");){if(d(o,e))return Be(i,o);o=o.parentNode}return function(e,t,n={}){const i=document.createElement(t);return"a"===t?i.textContent=n.textContent||"lien":i.innerHTML="",e.insertNode(i),"a"===t&&i.insertAdjacentText("afterend"," "),ze(i),i}(i,e,t)}let o=i.commonAncestorContainer;for(;!l(o)||!u(o,"edith-visual");){if(l(o)&&d(o,e))return je(i,o);o=o.parentNode}for(const t of[...o.getElementsByTagName(e)])if(n.containsNode(t,!0)){return Pe(f(t)),o.normalize(),o}const r=document.createElement(e);return r.appendChild(i.extractContents()),i.insertNode(r),b(o,(e=>l(e)&&!g(e.tagName)&&(null===e.textContent||0===e.textContent.length))),function(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n.removeAllRanges(),n.addRange(t)}(r),r}function Ge(e,t){for(let n of[...e.children]){if(d(n,"span")&&u(n,"edith-nbsp")){T(n,{class:"edith-nbsp",contenteditable:"false"}),n.innerHTML="¶";continue}n.hasAttribute("style")&&(n=v(n)),t[n.tagName]&&(n=h(n,p("span",{attributes:{style:n.getAttribute("style")||""},innerHTML:n.innerHTML})));const e={...t};if(d(n,["b","i","q","u","s"])&&(e[n.tagName]=!0),Ge(n,e),d(n,"a")){const e={};n.hasAttribute("href")&&(e.href=n.getAttribute("href")),n.hasAttribute("target")&&(e.target=n.getAttribute("target")),T(n,e)}else if(d(n,["b","i","q","u","s","br","sup"]))T(n,{});else if(d(n,["style","meta","link"]))n.remove();else if(d(n,"p")){if(null===n.textContent||0===n.textContent.trim().length){n.remove();continue}T(n,{}),A(n,"br")}else f(n)}}function Ve(e,t){const n=document.createElement("div");return n.innerHTML=Ie.sanitize(e,{USE_PROFILES:{html:!0}}),Ge(n,t),n.normalize(),b(n,(e=>s(e)&&(null===e.textContent||0===e.textContent.trim().length))),n.innerHTML=n.innerHTML.replace(/\s* \s*/g," ").replace(/\s+/g," ").replace(/(<\/b>[\n\r\s]*<b>|<\/i>[\n\r\s]*<i>|<\/u>[\n\r\s]*<u>|<\/s>[\n\r\s]*<s>)/g," "),E(n),n}!function(e){e.modeChanged="edith-mode-changed",e.initialized="edith-initialized"}(Oe||(Oe={}));class $e{buffer=[];constructor(){}push(e){this.buffer.push(e),this.buffer.length>20&&this.buffer.shift()}pop(){return 0===this.buffer.length?null:this.buffer.pop()}}!function(e){e[e.Visual=1]="Visual",e[e.Code=2]="Code"}(De||(De={}));const qe={height:80,resizable:!1,toolbar:[["style",["bold","italic","underline","strikethrough"]]],buttons:{},initialContent:""};var Ye=o(74);class Ke{el;ctx;icon;title;onclick;showOnCodeView;popperEl;popper;constructor(e,t){this.ctx=e,this.icon=t.icon,this.title=t.title,this.onclick=t.onclick,this.showOnCodeView=!0===t.showOnCodeView}click(e){e.preventDefault(),this.onclick(this.ctx,e)}showTooltip(){if(void 0!==this.popper)return;this.popperEl=p("div",{textContent:this.title,attributes:{class:"edith-tooltip"}});const e=p("div",{attributes:{class:"arrow","data-popper-arrow":""}});this.popperEl.append(e),this.ctx.toolbar.append(this.popperEl),this.popper=(0,Ye.createPopper)(this.el,this.popperEl,{placement:"bottom",modifiers:[{name:"arrow",options:{padding:5}},{name:"offset",options:{offset:[0,8]}}]})}hideTooltip(){void 0!==this.popper&&(this.popper.destroy(),this.popper=void 0,this.popperEl?.remove())}onEditorModeChange(e){e.detail.mode===De.Code?this.el.setAttribute("disabled","disabled"):this.el.removeAttribute("disabled")}render(){return this.el=p("button",{attributes:{class:`edith-btn ${this.icon}`,type:"button"}}),this.el.onclick=this.click.bind(this),this.el.onmouseenter=this.showTooltip.bind(this),this.el.onmouseleave=this.hideTooltip.bind(this),!0!==this.showOnCodeView&&this.ctx.on(Oe.modeChanged,this.onEditorModeChange.bind(this)),this.el}}const Xe=Object.freeze({bold:e=>new Ke(e,{icon:"fa-solid fa-bold",title:"Gras",onclick:e=>{e.editor.wrapInsideTag("b")}}),italic:e=>new Ke(e,{icon:"fa-solid fa-italic",title:"Italique",onclick:e=>{e.editor.wrapInsideTag("i")}}),underline:e=>new Ke(e,{icon:"fa-solid fa-underline",title:"Souligner",onclick:e=>{e.editor.wrapInsideTag("u")}}),strikethrough:e=>new Ke(e,{icon:"fa-solid fa-strikethrough",title:"Barrer",onclick:e=>{e.editor.wrapInsideTag("s")}}),subscript:e=>new Ke(e,{icon:"fa-solid fa-subscript",title:"Indice",onclick:e=>{e.editor.wrapInsideTag("sub")}}),superscript:e=>new Ke(e,{icon:"fa-solid fa-superscript",title:"Exposant",onclick:e=>{e.editor.wrapInsideTag("sup")}}),nbsp:e=>new Ke(e,{icon:"edith-btn-nbsp",title:"Ajouter une espace insécable",onclick:e=>{e.editor.replaceByHtml('<span class="edith-nbsp" contenteditable="false">¶</span>')}}),clear:e=>new Ke(e,{icon:"fa-solid fa-eraser",title:"Effacer la mise en forme",onclick:e=>{e.editor.clearStyle()}}),link:e=>new Ke(e,{icon:"fa-solid fa-link",title:"Lien",onclick:e=>{e.editor.insertLink()}}),codeview:e=>new Ke(e,{icon:"fa-solid fa-code",title:"Afficher le code HTML",onclick:e=>{e.editor.toggleCodeView()},showOnCodeView:!0})});var Je,Qe=o(690);function Ze(e){const t=document.createElement("div");t.setAttribute("class","edith-modal-input");const n=document.createElement("label");n.textContent=e.label;const i=document.createElement("input");return i.setAttribute("name",e.name),i.setAttribute("type","text"),null!==e.initialState&&(i.value=e.initialState.toString()),t.append(n),t.append(i),t}function et(e){const t=document.createElement("div");t.setAttribute("class","edith-modal-checkbox");const n=document.createElement("label");n.textContent=e.label;const i=document.createElement("input");return i.setAttribute("name",e.name),i.setAttribute("type","checkbox"),e.initialState&&(i.checked=!0),n.prepend(i),t.append(n),t}function tt(e,t,n=null){return{fieldType:Je.input,label:e,name:t,initialState:n}}function nt(e,t,n=!1){return{fieldType:Je.checkbox,label:e,name:t,initialState:n}}!function(e){e[e.input=1]="input",e[e.checkbox=2]="checkbox"}(Je||(Je={}));class it{el;ctx;title;fields;callback;constructor(e,t){this.ctx=e,this.title=t.title,this.fields=t.fields||[],this.callback=t.callback}cancel(e){e.preventDefault(),this.callback(null),this.close()}submit(e){e.preventDefault();const t={};for(const e of this.el.querySelectorAll("input"))n="name",e.hasAttribute(n)&&(t[c(e,"name")]="checkbox"===c(e,"type")?e.checked:e.value);var n;this.callback(t),this.close()}close(){this.el.remove()}show(){this.el=p("div",{attributes:{class:"edith-modal"}});const e=p("div",{attributes:{class:"edith-modal-header"}}),t=p("span",{textContent:this.title,attributes:{class:"edith-modal-title"}});e.append(t);const n=p("div",{attributes:{class:"edith-modal-content"}});for(const e of this.fields)switch(e.fieldType){case Je.input:n.append(Ze(e));break;case Je.checkbox:n.append(et(e));break;default:throw new Error(`Unknown fieldType ${e.fieldType}`)}const i=p("div",{attributes:{class:"edith-modal-footer"}}),o=p("button",{textContent:"Annuler",attributes:{class:"edith-modal-cancel",type:"button"}});i.append(o);const r=p("button",{textContent:"Valider",attributes:{class:"edith-modal-submit",type:"button"}});return i.append(r),this.el.append(e),this.el.append(n),this.el.append(i),this.ctx.modals.append(this.el),o.onclick=this.cancel.bind(this),r.onclick=this.submit.bind(this),this.el}}class ot{el;ctx;content;height;resizable;mode;visualEditor;codeEditor;codeMirror;history;throttledSnapshots;constructor(e,t){this.ctx=e,this.content=t.initialContent,this.height=t.height,this.resizable=t.resizable,this.mode=De.Visual,this.history=new $e,this.throttledSnapshots=function(e,t,n={}){return _(e,t,{leading:!("leading"in n)||!!n.leading,trailing:!("trailing"in n)||!!n.trailing,maxWait:t})}((()=>this.takeSnapshot()),3e3,{leading:!1,trailing:!0}),this.content=this.content.replace(/ /g,'<span class="edith-nbsp" contenteditable="false">¶</span>')}render(){this.el=p("div",{attributes:{class:"edith-editing-area",style:this.resizable?`min-height: ${this.height}px; resize: vertical`:`height: ${this.height}px`}}),this.visualEditor=p("div",{innerHTML:this.content,attributes:{class:"edith-visual",contenteditable:"true",style:this.resizable?`min-height: ${this.height-10}px`:`height: ${this.height-10}px`}}),this.el.append(this.visualEditor),this.codeEditor=p("div",{attributes:{class:"edith-code edith-hidden"}}),this.el.append(this.codeEditor);const e=this.onKeyEvent.bind(this);this.visualEditor.addEventListener("keydown",e),this.visualEditor.addEventListener("keyup",e);const t=this.onPasteEvent.bind(this);return this.visualEditor.addEventListener("paste",t),this.el}getVisualEditorElement(){return this.visualEditor}getCodeEditorElement(){return this.codeEditor}setContent(e){e=e.replace(/ /g,'<span class="edith-nbsp" contenteditable="false">¶</span>'),this.mode===De.Visual?this.visualEditor.innerHTML=e:this.codeMirror.dispatch({changes:{from:0,to:this.codeMirror.state.doc.length,insert:e}})}getContent(){const e=this.mode===De.Visual?this.visualEditor.innerHTML:this.codeMirror.state.doc.toJSON().map((e=>e.trim())).join("\n");if("<p><br></p>"===e)return"";const t=p("div",{innerHTML:e});y(t,(e=>l(e)&&!g(e.tagName)&&(null===e.textContent||0===e.textContent.length)));for(const e of t.querySelectorAll("[style]"))e.removeAttribute("style");for(const e of t.querySelectorAll("span"))0===e.attributes.length&&f(e);return t.innerHTML.replace(/\u200B/gi,"").replace(/<\/p>\s*<p>/gi,"<br>").replace(/(<p>|<\/p>)/gi,"").replace(/<span[^>]+class="edith-nbsp"[^>]*>[^<]*<\/span>/gi," ").replace(/(?:<br\s?\/?>)+$/gi,"")}takeSnapshot(){this.history.push(this.visualEditor.innerHTML)}restoreSnapshot(){this.visualEditor.innerHTML=this.history.pop()??""}wrapInsideTag(e){Fe(this.visualEditor)&&(We(e),this.takeSnapshot())}replaceByHtml(e){Fe(this.visualEditor)&&(!function(e){const{sel:t,range:n}=He();if(void 0===n)return;const i=document.createDocumentFragment(),o=p("div",{innerHTML:e});i.append(...o.childNodes);const r=i.childNodes[i.childNodes.length-1];t.deleteFromDocument(),n.insertNode(i),Ue(r)}(e),this.takeSnapshot())}clearStyle(){!function(){const{sel:e,range:t}=He();if(void 0!==t&&l(t.commonAncestorContainer))for(const n of[...t.commonAncestorContainer.children])e.containsNode(n,!0)&&m(n)}(),this.takeSnapshot()}insertLink(){const{sel:e,range:t}=He();if(void 0===t)return;const n=new it(this.ctx,{title:"Insérer un lien",fields:[tt("Texte à afficher","text",t.toString()),tt("URL du lien","href"),nt("Ouvrir dans une nouvelle fenêtre","openInNewTab",!0)],callback:n=>{null!==n&&(function(e){const t=window.getSelection();t.removeAllRanges(),void 0!==e.range&&t.addRange(e.range)}({sel:e,range:t}),function(e,t,n){const i=We("a",{textContent:e});if(void 0!==i)l(i)&&(i.setAttribute("href",t),!0===n&&i.setAttribute("target","_blank"))}(n.text,n.href,n.openInNewTab))}});n.show()}toggleCodeView(){if(this.mode===De.Visual){this.mode=De.Code,this.visualEditor.classList.add("edith-hidden"),this.codeEditor.classList.remove("edith-hidden");const e=document.createElement("div");this.codeEditor.append(e),this.codeMirror=new Qe.EditorView({doc:this.visualEditor.innerHTML,extensions:[Qe.basicSetup,Qe.EditorView.lineWrapping,(0,Qe.html)({matchClosingTags:!0,autoCloseTags:!0})],parent:e})}else this.mode=De.Visual,this.codeEditor.classList.add("edith-hidden"),this.visualEditor.classList.remove("edith-hidden"),this.visualEditor.innerHTML=this.codeMirror.state.doc.toJSON().map((e=>e.trim())).join("\n"),this.codeMirror.destroy(),this.codeMirror=void 0,this.codeEditor.innerHTML="";this.ctx.trigger(Oe.modeChanged,{mode:this.mode})}onKeyEvent(e){(e.metaKey||e.ctrlKey?this._processKeyEventWithMeta(e):this._processKeyEvent(e))&&(e.preventDefault(),e.stopPropagation())}_processKeyEvent(e){return"Enter"===e.key?("keydown"===e.type&&this.replaceByHtml("<br />"),!0):(this.throttledSnapshots(),!1)}_processKeyEventWithMeta(e){switch(e.key){case"Enter":return"keydown"===e.type&&this.replaceByHtml("<br />"),!0;case" ":return"keydown"===e.type&&this.replaceByHtml('<span class="edith-nbsp" contenteditable="false">¶</span>'),!0;case"b":return"keydown"===e.type&&this.wrapInsideTag("b"),!0;case"i":return"keydown"===e.type&&this.wrapInsideTag("i"),!0;case"k":return"keydown"===e.type&&this.insertLink(),!0;case"u":return"keydown"===e.type&&this.wrapInsideTag("u"),!0;case"s":return"keydown"===e.type&&this.wrapInsideTag("s"),!0;case"z":return"keydown"===e.type&&this.restoreSnapshot(),!0}return!1}onPasteEvent(e){e.preventDefault(),e.stopPropagation();const{sel:t,range:n}=He();if(void 0===n||null===e.clipboardData)return;const i=document.createDocumentFragment();if(e.clipboardData.types.includes("text/html")){let n=s(t.anchorNode)?t.anchorNode.parentNode:t.anchorNode;const o={B:!1,I:!1,U:!1,S:!1,Q:!1};for(;null!==n&&!u(n,"edith-visual");)d(n,["b","i","u","s","q"])&&(o[(n.tagName,"Q")]=!0),n=n.parentNode;let r=e.clipboardData.getData("text/html").replace(/[\r\n]+/g," ");/^<html>\s*<body>/.test(r)||(r="<html><body>"+r+"</body></html>");const a=Ve(r,o);i.append(...a.childNodes)}else{const t=e.clipboardData.getData("text/plain").split(/[\r\n]+/g);for(let e=0;e<t.length;e++)0!==e&&i.append(document.createElement("br")),i.append(document.createTextNode(t[e]))}t.deleteFromDocument(),n.insertNode(i)}destroy(){this.codeMirror?.destroy(),this.codeMirror=void 0,this.el.remove()}}class rt{element;toolbar;editor;modals;constructor(e,t){var n,i;this.element=e,n=this.element,"string"==typeof(i="edith")?n.classList.add(i):n.classList.add(...i),this.toolbar=p("div",{attributes:{class:"edith-toolbar"}}),this.element.append(this.toolbar);const o=t.buttons??qe.buttons,r=t.toolbar??qe.toolbar;for(const{0:e,1:t}of r){const n=document.createElement("div");n.setAttribute("id",e),n.setAttribute("class","edith-btn-group"),this.toolbar.append(n);for(const e of t){const t=o[e]??Xe[e];n.append(t(this).render())}}this.editor=new ot(this,{initialContent:t.initialContent??qe.initialContent,height:t.height??qe.height,resizable:t.resizable??qe.resizable}),this.element.append(this.editor.render()),this.modals=p("div",{attributes:{class:"edith-modals"}}),this.element.append(this.modals),this.element.edith=this,this.trigger(Oe.initialized)}on(e,t){!function(e,t,n){if(e instanceof NodeList)for(const i of e)C(i,t,n);else C(e,t,n)}(this.element,e,t)}off(e,t){!function(e,t,n){if(e instanceof NodeList)for(const i of e)S(i,t,n);else S(e,t,n)}(this.element,e,t)}trigger(e,t){!function(e,t,n){e.dispatchEvent("string"==typeof t?new CustomEvent(t,{detail:n}):t)}(this.element,e,t)}setContent(e){this.editor.setContent(e)}getContent(){return this.editor.getContent()}destroy(){var e,t;e=this.element,"string"==typeof(t="edith")?e.classList.remove(t):e.classList.remove(...t),this.modals.remove(),this.editor.destroy(),this.toolbar.remove(),this.element.remove()}}rt.EdithButton=Ke;var at=rt;return r=r.default}()}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lesjoursfr/edith",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"description": "Simple WYSIWYG editor.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "lesjoursfr/edith",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@lesjoursfr/browser-tools": "^1.1.6",
|
|
51
|
-
"dompurify": "^3.2.
|
|
51
|
+
"dompurify": "^3.2.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@babel/core": "^7.26.0",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"ts-loader": "^9.5.1",
|
|
86
86
|
"ts-node": "^10.9.2",
|
|
87
87
|
"typescript": "^5.7.2",
|
|
88
|
-
"typescript-eslint": "^8.
|
|
89
|
-
"webpack": "^5.97.
|
|
88
|
+
"typescript-eslint": "^8.18.0",
|
|
89
|
+
"webpack": "^5.97.1",
|
|
90
90
|
"webpack-cli": "^5.1.4",
|
|
91
91
|
"webpack-dev-server": "^5.1.0"
|
|
92
92
|
},
|