@umbraco-cms/backoffice 14.0.0--preview004-d64318b7 → 14.0.0--preview004-3f36df26

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.
@@ -0,0 +1,2 @@
1
+ import DOMPurify from 'dompurify';
2
+ export { DOMPurify };
@@ -1,2 +1,2 @@
1
- var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function on(O){return O&&O.__esModule&&Object.prototype.hasOwnProperty.call(O,"default")?O.default:O}var Tt={exports:{}};/*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE */(function(O,sn){(function(re,q){O.exports=q()})(nn,function(){const{entries:re,setPrototypeOf:q,isFrozen:gt,getPrototypeOf:_t,getOwnPropertyDescriptor:we}=Object;let{freeze:g,seal:L,create:xe}=Object,{apply:le,construct:se}=typeof Reflect<"u"&&Reflect;g||(g=function(i){return i}),L||(L=function(i){return i}),le||(le=function(i,s,r){return i.apply(s,r)}),se||(se=function(i,s){return new i(...s)});const $=R(Array.prototype.forEach),Pe=R(Array.prototype.pop),G=R(Array.prototype.push),K=R(String.prototype.toLowerCase),ce=R(String.prototype.toString),Et=R(String.prototype.match),W=R(String.prototype.replace),ht=R(String.prototype.indexOf),At=R(String.prototype.trim),S=R(RegExp.prototype.test),B=St(TypeError);function R(l){return function(i){for(var s=arguments.length,r=new Array(s>1?s-1:0),_=1;_<s;_++)r[_-1]=arguments[_];return le(l,i,r)}}function St(l){return function(){for(var i=arguments.length,s=new Array(i),r=0;r<i;r++)s[r]=arguments[r];return se(l,s)}}function a(l,i){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:K;q&&q(l,null);let r=i.length;for(;r--;){let _=i[r];if(typeof _=="string"){const N=s(_);N!==_&&(gt(i)||(i[r]=N),_=N)}l[_]=!0}return l}function x(l){const i=xe(null);for(const[s,r]of re(l))we(l,s)!==void 0&&(i[s]=r);return i}function Z(l,i){for(;l!==null;){const r=we(l,i);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}l=_t(l)}function s(r){return console.warn("fallback value for",r),null}return s}const ke=g(["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"]),fe=g(["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"]),ue=g(["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"]),Rt=g(["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"]),me=g(["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"]),Lt=g(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ve=g(["#text"]),Ue=g(["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","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","xmlns","slot"]),pe=g(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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=g(["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"]),J=g(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yt=L(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Nt=L(/<%[\w\W]*|[\w\W]*%>/gm),Dt=L(/\${[\w\W]*}/gm),bt=L(/^data-[\-\w.\u00B7-\uFFFF]/),Ot=L(/^aria-[\-\w]+$/),He=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),It=L(/^(?:\w+script|data):/i),Ct=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ze=L(/^html$/i);var Ge=Object.freeze({__proto__:null,MUSTACHE_EXPR:yt,ERB_EXPR:Nt,TMPLIT_EXPR:Dt,DATA_ATTR:bt,ARIA_ATTR:Ot,IS_ALLOWED_URI:He,IS_SCRIPT_OR_DATA:It,ATTR_WHITESPACE:Ct,DOCTYPE_NAME:ze});const Mt=function(){return typeof window>"u"?null:window},wt=function(i,s){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let r=null;const _="data-tt-policy-suffix";s&&s.hasAttribute(_)&&(r=s.getAttribute(_));const N="dompurify"+(r?"#"+r:"");try{return i.createPolicy(N,{createHTML(P){return P},createScriptURL(P){return P}})}catch{return console.warn("TrustedTypes policy "+N+" could not be created."),null}};function We(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Mt();const i=o=>We(o);if(i.version="3.0.6",i.removed=[],!l||!l.document||l.document.nodeType!==9)return i.isSupported=!1,i;let{document:s}=l;const r=s,_=r.currentScript,{DocumentFragment:N,HTMLTemplateElement:P,Node:de,Element:Be,NodeFilter:Te,NamedNodeMap:Pt=l.NamedNodeMap||l.MozNamedAttrMap,HTMLFormElement:kt,DOMParser:vt,trustedTypes:Q}=l,ee=Be.prototype,Ut=Z(ee,"cloneNode"),Ft=Z(ee,"nextSibling"),Ht=Z(ee,"childNodes"),ge=Z(ee,"parentNode");if(typeof P=="function"){const o=s.createElement("template");o.content&&o.content.ownerDocument&&(s=o.content.ownerDocument)}let E,Y="";const{implementation:_e,createNodeIterator:zt,createDocumentFragment:Gt,getElementsByTagName:Wt}=s,{importNode:Bt}=r;let y={};i.isSupported=typeof re=="function"&&typeof ge=="function"&&_e&&_e.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ee,ERB_EXPR:he,TMPLIT_EXPR:Ae,DATA_ATTR:Yt,ARIA_ATTR:Xt,IS_SCRIPT_OR_DATA:jt,ATTR_WHITESPACE:Ye}=Ge;let{IS_ALLOWED_URI:Xe}=Ge,u=null;const je=a({},[...ke,...fe,...ue,...me,...ve]);let m=null;const Ve=a({},[...Ue,...pe,...Fe,...J]);let f=Object.seal(xe(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}})),X=null,Se=null,qe=!0,Re=!0,$e=!1,Ke=!0,k=!1,I=!1,Le=!1,ye=!1,v=!1,te=!1,ne=!1,Ze=!0,Je=!1;const Vt="user-content-";let Ne=!0,j=!1,U={},F=null;const Qe=a({},["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 et=null;const tt=a({},["audio","video","img","source","image","track"]);let De=null;const nt=a({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),oe="http://www.w3.org/1998/Math/MathML",ie="http://www.w3.org/2000/svg",D="http://www.w3.org/1999/xhtml";let H=D,be=!1,Oe=null;const qt=a({},[oe,ie,D],ce);let C=null;const $t=["application/xhtml+xml","text/html"],Kt="text/html";let p=null,z=null;const Zt=s.createElement("form"),ot=function(e){return e instanceof RegExp||e instanceof Function},Ie=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(z&&z===e)){if((!e||typeof e!="object")&&(e={}),e=x(e),C=$t.indexOf(e.PARSER_MEDIA_TYPE)===-1?C=Kt:C=e.PARSER_MEDIA_TYPE,p=C==="application/xhtml+xml"?ce:K,u="ALLOWED_TAGS"in e?a({},e.ALLOWED_TAGS,p):je,m="ALLOWED_ATTR"in e?a({},e.ALLOWED_ATTR,p):Ve,Oe="ALLOWED_NAMESPACES"in e?a({},e.ALLOWED_NAMESPACES,ce):qt,De="ADD_URI_SAFE_ATTR"in e?a(x(nt),e.ADD_URI_SAFE_ATTR,p):nt,et="ADD_DATA_URI_TAGS"in e?a(x(tt),e.ADD_DATA_URI_TAGS,p):tt,F="FORBID_CONTENTS"in e?a({},e.FORBID_CONTENTS,p):Qe,X="FORBID_TAGS"in e?a({},e.FORBID_TAGS,p):{},Se="FORBID_ATTR"in e?a({},e.FORBID_ATTR,p):{},U="USE_PROFILES"in e?e.USE_PROFILES:!1,qe=e.ALLOW_ARIA_ATTR!==!1,Re=e.ALLOW_DATA_ATTR!==!1,$e=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ke=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=e.SAFE_FOR_TEMPLATES||!1,I=e.WHOLE_DOCUMENT||!1,v=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,ye=e.FORCE_BODY||!1,Ze=e.SANITIZE_DOM!==!1,Je=e.SANITIZE_NAMED_PROPS||!1,Ne=e.KEEP_CONTENT!==!1,j=e.IN_PLACE||!1,Xe=e.ALLOWED_URI_REGEXP||He,H=e.NAMESPACE||D,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ot(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ot(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),k&&(Re=!1),te&&(v=!0),U&&(u=a({},[...ve]),m=[],U.html===!0&&(a(u,ke),a(m,Ue)),U.svg===!0&&(a(u,fe),a(m,pe),a(m,J)),U.svgFilters===!0&&(a(u,ue),a(m,pe),a(m,J)),U.mathMl===!0&&(a(u,me),a(m,Fe),a(m,J))),e.ADD_TAGS&&(u===je&&(u=x(u)),a(u,e.ADD_TAGS,p)),e.ADD_ATTR&&(m===Ve&&(m=x(m)),a(m,e.ADD_ATTR,p)),e.ADD_URI_SAFE_ATTR&&a(De,e.ADD_URI_SAFE_ATTR,p),e.FORBID_CONTENTS&&(F===Qe&&(F=x(F)),a(F,e.FORBID_CONTENTS,p)),Ne&&(u["#text"]=!0),I&&a(u,["html","head","body"]),u.table&&(a(u,["tbody"]),delete X.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=e.TRUSTED_TYPES_POLICY,Y=E.createHTML("")}else E===void 0&&(E=wt(Q,_)),E!==null&&typeof Y=="string"&&(Y=E.createHTML(""));g&&g(e),z=e}},it=a({},["mi","mo","mn","ms","mtext"]),at=a({},["foreignobject","desc","title","annotation-xml"]),Jt=a({},["title","style","font","a","script"]),ae=a({},fe);a(ae,ue),a(ae,Rt);const Ce=a({},me);a(Ce,Lt);const Qt=function(e){let t=ge(e);(!t||!t.tagName)&&(t={namespaceURI:H,tagName:"template"});const n=K(e.tagName),c=K(t.tagName);return Oe[e.namespaceURI]?e.namespaceURI===ie?t.namespaceURI===D?n==="svg":t.namespaceURI===oe?n==="svg"&&(c==="annotation-xml"||it[c]):!!ae[n]:e.namespaceURI===oe?t.namespaceURI===D?n==="math":t.namespaceURI===ie?n==="math"&&at[c]:!!Ce[n]:e.namespaceURI===D?t.namespaceURI===ie&&!at[c]||t.namespaceURI===oe&&!it[c]?!1:!Ce[n]&&(Jt[n]||!ae[n]):!!(C==="application/xhtml+xml"&&Oe[e.namespaceURI]):!1},M=function(e){G(i.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},Me=function(e,t){try{G(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch{G(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is"&&!m[e])if(v||te)try{M(t)}catch{}else try{t.setAttribute(e,"")}catch{}},rt=function(e){let t=null,n=null;if(ye)e="<remove></remove>"+e;else{const T=Et(e,/^[\r\n\t ]+/);n=T&&T[0]}C==="application/xhtml+xml"&&H===D&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const c=E?E.createHTML(e):e;if(H===D)try{t=new vt().parseFromString(c,C)}catch{}if(!t||!t.documentElement){t=_e.createDocument(H,"template",null);try{t.documentElement.innerHTML=be?Y:c}catch{}}const d=t.body||t.documentElement;return e&&n&&d.insertBefore(s.createTextNode(n),d.childNodes[0]||null),H===D?Wt.call(t,I?"html":"body")[0]:I?t.documentElement:d},lt=function(e){return zt.call(e.ownerDocument||e,e,Te.SHOW_ELEMENT|Te.SHOW_COMMENT|Te.SHOW_TEXT,null)},en=function(e){return e instanceof kt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Pt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},st=function(e){return typeof de=="function"&&e instanceof de},b=function(e,t,n){y[e]&&$(y[e],c=>{c.call(i,t,n,z)})},ct=function(e){let t=null;if(b("beforeSanitizeElements",e,null),en(e))return M(e),!0;const n=p(e.nodeName);if(b("uponSanitizeElement",e,{tagName:n,allowedTags:u}),e.hasChildNodes()&&!st(e.firstElementChild)&&S(/<[/\w]/g,e.innerHTML)&&S(/<[/\w]/g,e.textContent))return M(e),!0;if(!u[n]||X[n]){if(!X[n]&&ut(n)&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n)))return!1;if(Ne&&!F[n]){const c=ge(e)||e.parentNode,d=Ht(e)||e.childNodes;if(d&&c){const T=d.length;for(let h=T-1;h>=0;--h)c.insertBefore(Ut(d[h],!0),Ft(e))}}return M(e),!0}return e instanceof Be&&!Qt(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&S(/<\/no(script|embed|frames)/i,e.innerHTML)?(M(e),!0):(k&&e.nodeType===3&&(t=e.textContent,$([Ee,he,Ae],c=>{t=W(t,c," ")}),e.textContent!==t&&(G(i.removed,{element:e.cloneNode()}),e.textContent=t)),b("afterSanitizeElements",e,null),!1)},ft=function(e,t,n){if(Ze&&(t==="id"||t==="name")&&(n in s||n in Zt))return!1;if(!(Re&&!Se[t]&&S(Yt,t))){if(!(qe&&S(Xt,t))){if(!m[t]||Se[t]){if(!(ut(e)&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&S(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n))))return!1}else if(!De[t]){if(!S(Xe,W(n,Ye,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&ht(n,"data:")===0&&et[e])){if(!($e&&!S(jt,W(n,Ye,"")))){if(n)return!1}}}}}}return!0},ut=function(e){return e.indexOf("-")>0},mt=function(e){b("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:m};let c=t.length;for(;c--;){const d=t[c],{name:T,namespaceURI:h,value:w}=d,V=p(T);let A=T==="value"?w:At(w);if(n.attrName=V,n.attrValue=A,n.keepAttr=!0,n.forceKeepAttr=void 0,b("uponSanitizeAttribute",e,n),A=n.attrValue,n.forceKeepAttr||(Me(T,e),!n.keepAttr))continue;if(!Ke&&S(/\/>/i,A)){Me(T,e);continue}k&&$([Ee,he,Ae],dt=>{A=W(A,dt," ")});const pt=p(e.nodeName);if(ft(pt,V,A)){if(Je&&(V==="id"||V==="name")&&(Me(T,e),A=Vt+A),E&&typeof Q=="object"&&typeof Q.getAttributeType=="function"&&!h)switch(Q.getAttributeType(pt,V)){case"TrustedHTML":{A=E.createHTML(A);break}case"TrustedScriptURL":{A=E.createScriptURL(A);break}}try{h?e.setAttributeNS(h,T,A):e.setAttribute(T,A),Pe(i.removed)}catch{}}}b("afterSanitizeAttributes",e,null)},tn=function o(e){let t=null;const n=lt(e);for(b("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)b("uponSanitizeShadowNode",t,null),!ct(t)&&(t.content instanceof N&&o(t.content),mt(t));b("afterSanitizeShadowDOM",e,null)};return i.sanitize=function(o){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,c=null,d=null;if(be=!o,be&&(o="<!-->"),typeof o!="string"&&!st(o))if(typeof o.toString=="function"){if(o=o.toString(),typeof o!="string")throw B("dirty is not a string, aborting")}else throw B("toString is not a function");if(!i.isSupported)return o;if(Le||Ie(e),i.removed=[],typeof o=="string"&&(j=!1),j){if(o.nodeName){const w=p(o.nodeName);if(!u[w]||X[w])throw B("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof de)t=rt("<!---->"),n=t.ownerDocument.importNode(o,!0),n.nodeType===1&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!v&&!k&&!I&&o.indexOf("<")===-1)return E&&ne?E.createHTML(o):o;if(t=rt(o),!t)return v?null:ne?Y:""}t&&ye&&M(t.firstChild);const T=lt(j?o:t);for(;c=T.nextNode();)ct(c)||(c.content instanceof N&&tn(c.content),mt(c));if(j)return o;if(v){if(te)for(d=Gt.call(t.ownerDocument);t.firstChild;)d.appendChild(t.firstChild);else d=t;return(m.shadowroot||m.shadowrootmode)&&(d=Bt.call(r,d,!0)),d}let h=I?t.outerHTML:t.innerHTML;return I&&u["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&S(ze,t.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
2
- `+h),k&&$([Ee,he,Ae],w=>{h=W(h,w," ")}),E&&ne?E.createHTML(h):h},i.setConfig=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ie(o),Le=!0},i.clearConfig=function(){z=null,Le=!1},i.isValidAttribute=function(o,e,t){z||Ie({});const n=p(o),c=p(e);return ft(n,c,t)},i.addHook=function(o,e){typeof e=="function"&&(y[o]=y[o]||[],G(y[o],e))},i.removeHook=function(o){if(y[o])return Pe(y[o])},i.removeHooks=function(o){y[o]&&(y[o]=[])},i.removeAllHooks=function(){y={}},i}var xt=We();return xt})})(Tt);var an=Tt.exports,rn=on(an);const ln=rn.sanitize;export{ln as sanitizeHtml};
1
+ var nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function on(O){return O&&O.__esModule&&Object.prototype.hasOwnProperty.call(O,"default")?O.default:O}var Tt={exports:{}};/*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE */(function(O,ln){(function(re,$){O.exports=$()})(nn,function(){const{entries:re,setPrototypeOf:$,isFrozen:gt,getPrototypeOf:_t,getOwnPropertyDescriptor:we}=Object;let{freeze:g,seal:L,create:xe}=Object,{apply:le,construct:se}=typeof Reflect<"u"&&Reflect;g||(g=function(i){return i}),L||(L=function(i){return i}),le||(le=function(i,s,r){return i.apply(s,r)}),se||(se=function(i,s){return new i(...s)});const q=R(Array.prototype.forEach),Pe=R(Array.prototype.pop),G=R(Array.prototype.push),K=R(String.prototype.toLowerCase),ce=R(String.prototype.toString),Et=R(String.prototype.match),W=R(String.prototype.replace),ht=R(String.prototype.indexOf),At=R(String.prototype.trim),S=R(RegExp.prototype.test),B=St(TypeError);function R(l){return function(i){for(var s=arguments.length,r=new Array(s>1?s-1:0),_=1;_<s;_++)r[_-1]=arguments[_];return le(l,i,r)}}function St(l){return function(){for(var i=arguments.length,s=new Array(i),r=0;r<i;r++)s[r]=arguments[r];return se(l,s)}}function a(l,i){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:K;$&&$(l,null);let r=i.length;for(;r--;){let _=i[r];if(typeof _=="string"){const D=s(_);D!==_&&(gt(i)||(i[r]=D),_=D)}l[_]=!0}return l}function x(l){const i=xe(null);for(const[s,r]of re(l))we(l,s)!==void 0&&(i[s]=r);return i}function Z(l,i){for(;l!==null;){const r=we(l,i);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}l=_t(l)}function s(r){return console.warn("fallback value for",r),null}return s}const ke=g(["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"]),fe=g(["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"]),ue=g(["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"]),Rt=g(["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"]),me=g(["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"]),Lt=g(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ve=g(["#text"]),Ue=g(["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","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","xmlns","slot"]),pe=g(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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=g(["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"]),J=g(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yt=L(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Dt=L(/<%[\w\W]*|[\w\W]*%>/gm),Nt=L(/\${[\w\W]*}/gm),bt=L(/^data-[\-\w.\u00B7-\uFFFF]/),Ot=L(/^aria-[\-\w]+$/),He=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),It=L(/^(?:\w+script|data):/i),Ct=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ze=L(/^html$/i);var Ge=Object.freeze({__proto__:null,MUSTACHE_EXPR:yt,ERB_EXPR:Dt,TMPLIT_EXPR:Nt,DATA_ATTR:bt,ARIA_ATTR:Ot,IS_ALLOWED_URI:He,IS_SCRIPT_OR_DATA:It,ATTR_WHITESPACE:Ct,DOCTYPE_NAME:ze});const Mt=function(){return typeof window>"u"?null:window},wt=function(i,s){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let r=null;const _="data-tt-policy-suffix";s&&s.hasAttribute(_)&&(r=s.getAttribute(_));const D="dompurify"+(r?"#"+r:"");try{return i.createPolicy(D,{createHTML(P){return P},createScriptURL(P){return P}})}catch{return console.warn("TrustedTypes policy "+D+" could not be created."),null}};function We(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Mt();const i=o=>We(o);if(i.version="3.0.6",i.removed=[],!l||!l.document||l.document.nodeType!==9)return i.isSupported=!1,i;let{document:s}=l;const r=s,_=r.currentScript,{DocumentFragment:D,HTMLTemplateElement:P,Node:de,Element:Be,NodeFilter:Te,NamedNodeMap:Pt=l.NamedNodeMap||l.MozNamedAttrMap,HTMLFormElement:kt,DOMParser:vt,trustedTypes:Q}=l,ee=Be.prototype,Ut=Z(ee,"cloneNode"),Ft=Z(ee,"nextSibling"),Ht=Z(ee,"childNodes"),ge=Z(ee,"parentNode");if(typeof P=="function"){const o=s.createElement("template");o.content&&o.content.ownerDocument&&(s=o.content.ownerDocument)}let E,Y="";const{implementation:_e,createNodeIterator:zt,createDocumentFragment:Gt,getElementsByTagName:Wt}=s,{importNode:Bt}=r;let y={};i.isSupported=typeof re=="function"&&typeof ge=="function"&&_e&&_e.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ee,ERB_EXPR:he,TMPLIT_EXPR:Ae,DATA_ATTR:Yt,ARIA_ATTR:Xt,IS_SCRIPT_OR_DATA:jt,ATTR_WHITESPACE:Ye}=Ge;let{IS_ALLOWED_URI:Xe}=Ge,u=null;const je=a({},[...ke,...fe,...ue,...me,...ve]);let m=null;const Ve=a({},[...Ue,...pe,...Fe,...J]);let f=Object.seal(xe(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}})),X=null,Se=null,$e=!0,Re=!0,qe=!1,Ke=!0,k=!1,I=!1,Le=!1,ye=!1,v=!1,te=!1,ne=!1,Ze=!0,Je=!1;const Vt="user-content-";let De=!0,j=!1,U={},F=null;const Qe=a({},["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 et=null;const tt=a({},["audio","video","img","source","image","track"]);let Ne=null;const nt=a({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),oe="http://www.w3.org/1998/Math/MathML",ie="http://www.w3.org/2000/svg",N="http://www.w3.org/1999/xhtml";let H=N,be=!1,Oe=null;const $t=a({},[oe,ie,N],ce);let C=null;const qt=["application/xhtml+xml","text/html"],Kt="text/html";let p=null,z=null;const Zt=s.createElement("form"),ot=function(e){return e instanceof RegExp||e instanceof Function},Ie=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(z&&z===e)){if((!e||typeof e!="object")&&(e={}),e=x(e),C=qt.indexOf(e.PARSER_MEDIA_TYPE)===-1?C=Kt:C=e.PARSER_MEDIA_TYPE,p=C==="application/xhtml+xml"?ce:K,u="ALLOWED_TAGS"in e?a({},e.ALLOWED_TAGS,p):je,m="ALLOWED_ATTR"in e?a({},e.ALLOWED_ATTR,p):Ve,Oe="ALLOWED_NAMESPACES"in e?a({},e.ALLOWED_NAMESPACES,ce):$t,Ne="ADD_URI_SAFE_ATTR"in e?a(x(nt),e.ADD_URI_SAFE_ATTR,p):nt,et="ADD_DATA_URI_TAGS"in e?a(x(tt),e.ADD_DATA_URI_TAGS,p):tt,F="FORBID_CONTENTS"in e?a({},e.FORBID_CONTENTS,p):Qe,X="FORBID_TAGS"in e?a({},e.FORBID_TAGS,p):{},Se="FORBID_ATTR"in e?a({},e.FORBID_ATTR,p):{},U="USE_PROFILES"in e?e.USE_PROFILES:!1,$e=e.ALLOW_ARIA_ATTR!==!1,Re=e.ALLOW_DATA_ATTR!==!1,qe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ke=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=e.SAFE_FOR_TEMPLATES||!1,I=e.WHOLE_DOCUMENT||!1,v=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,ye=e.FORCE_BODY||!1,Ze=e.SANITIZE_DOM!==!1,Je=e.SANITIZE_NAMED_PROPS||!1,De=e.KEEP_CONTENT!==!1,j=e.IN_PLACE||!1,Xe=e.ALLOWED_URI_REGEXP||He,H=e.NAMESPACE||N,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ot(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ot(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),k&&(Re=!1),te&&(v=!0),U&&(u=a({},[...ve]),m=[],U.html===!0&&(a(u,ke),a(m,Ue)),U.svg===!0&&(a(u,fe),a(m,pe),a(m,J)),U.svgFilters===!0&&(a(u,ue),a(m,pe),a(m,J)),U.mathMl===!0&&(a(u,me),a(m,Fe),a(m,J))),e.ADD_TAGS&&(u===je&&(u=x(u)),a(u,e.ADD_TAGS,p)),e.ADD_ATTR&&(m===Ve&&(m=x(m)),a(m,e.ADD_ATTR,p)),e.ADD_URI_SAFE_ATTR&&a(Ne,e.ADD_URI_SAFE_ATTR,p),e.FORBID_CONTENTS&&(F===Qe&&(F=x(F)),a(F,e.FORBID_CONTENTS,p)),De&&(u["#text"]=!0),I&&a(u,["html","head","body"]),u.table&&(a(u,["tbody"]),delete X.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=e.TRUSTED_TYPES_POLICY,Y=E.createHTML("")}else E===void 0&&(E=wt(Q,_)),E!==null&&typeof Y=="string"&&(Y=E.createHTML(""));g&&g(e),z=e}},it=a({},["mi","mo","mn","ms","mtext"]),at=a({},["foreignobject","desc","title","annotation-xml"]),Jt=a({},["title","style","font","a","script"]),ae=a({},fe);a(ae,ue),a(ae,Rt);const Ce=a({},me);a(Ce,Lt);const Qt=function(e){let t=ge(e);(!t||!t.tagName)&&(t={namespaceURI:H,tagName:"template"});const n=K(e.tagName),c=K(t.tagName);return Oe[e.namespaceURI]?e.namespaceURI===ie?t.namespaceURI===N?n==="svg":t.namespaceURI===oe?n==="svg"&&(c==="annotation-xml"||it[c]):!!ae[n]:e.namespaceURI===oe?t.namespaceURI===N?n==="math":t.namespaceURI===ie?n==="math"&&at[c]:!!Ce[n]:e.namespaceURI===N?t.namespaceURI===ie&&!at[c]||t.namespaceURI===oe&&!it[c]?!1:!Ce[n]&&(Jt[n]||!ae[n]):!!(C==="application/xhtml+xml"&&Oe[e.namespaceURI]):!1},M=function(e){G(i.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},Me=function(e,t){try{G(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch{G(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is"&&!m[e])if(v||te)try{M(t)}catch{}else try{t.setAttribute(e,"")}catch{}},rt=function(e){let t=null,n=null;if(ye)e="<remove></remove>"+e;else{const T=Et(e,/^[\r\n\t ]+/);n=T&&T[0]}C==="application/xhtml+xml"&&H===N&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const c=E?E.createHTML(e):e;if(H===N)try{t=new vt().parseFromString(c,C)}catch{}if(!t||!t.documentElement){t=_e.createDocument(H,"template",null);try{t.documentElement.innerHTML=be?Y:c}catch{}}const d=t.body||t.documentElement;return e&&n&&d.insertBefore(s.createTextNode(n),d.childNodes[0]||null),H===N?Wt.call(t,I?"html":"body")[0]:I?t.documentElement:d},lt=function(e){return zt.call(e.ownerDocument||e,e,Te.SHOW_ELEMENT|Te.SHOW_COMMENT|Te.SHOW_TEXT,null)},en=function(e){return e instanceof kt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Pt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},st=function(e){return typeof de=="function"&&e instanceof de},b=function(e,t,n){y[e]&&q(y[e],c=>{c.call(i,t,n,z)})},ct=function(e){let t=null;if(b("beforeSanitizeElements",e,null),en(e))return M(e),!0;const n=p(e.nodeName);if(b("uponSanitizeElement",e,{tagName:n,allowedTags:u}),e.hasChildNodes()&&!st(e.firstElementChild)&&S(/<[/\w]/g,e.innerHTML)&&S(/<[/\w]/g,e.textContent))return M(e),!0;if(!u[n]||X[n]){if(!X[n]&&ut(n)&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n)))return!1;if(De&&!F[n]){const c=ge(e)||e.parentNode,d=Ht(e)||e.childNodes;if(d&&c){const T=d.length;for(let h=T-1;h>=0;--h)c.insertBefore(Ut(d[h],!0),Ft(e))}}return M(e),!0}return e instanceof Be&&!Qt(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&S(/<\/no(script|embed|frames)/i,e.innerHTML)?(M(e),!0):(k&&e.nodeType===3&&(t=e.textContent,q([Ee,he,Ae],c=>{t=W(t,c," ")}),e.textContent!==t&&(G(i.removed,{element:e.cloneNode()}),e.textContent=t)),b("afterSanitizeElements",e,null),!1)},ft=function(e,t,n){if(Ze&&(t==="id"||t==="name")&&(n in s||n in Zt))return!1;if(!(Re&&!Se[t]&&S(Yt,t))){if(!($e&&S(Xt,t))){if(!m[t]||Se[t]){if(!(ut(e)&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&S(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&S(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n))))return!1}else if(!Ne[t]){if(!S(Xe,W(n,Ye,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&ht(n,"data:")===0&&et[e])){if(!(qe&&!S(jt,W(n,Ye,"")))){if(n)return!1}}}}}}return!0},ut=function(e){return e.indexOf("-")>0},mt=function(e){b("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:m};let c=t.length;for(;c--;){const d=t[c],{name:T,namespaceURI:h,value:w}=d,V=p(T);let A=T==="value"?w:At(w);if(n.attrName=V,n.attrValue=A,n.keepAttr=!0,n.forceKeepAttr=void 0,b("uponSanitizeAttribute",e,n),A=n.attrValue,n.forceKeepAttr||(Me(T,e),!n.keepAttr))continue;if(!Ke&&S(/\/>/i,A)){Me(T,e);continue}k&&q([Ee,he,Ae],dt=>{A=W(A,dt," ")});const pt=p(e.nodeName);if(ft(pt,V,A)){if(Je&&(V==="id"||V==="name")&&(Me(T,e),A=Vt+A),E&&typeof Q=="object"&&typeof Q.getAttributeType=="function"&&!h)switch(Q.getAttributeType(pt,V)){case"TrustedHTML":{A=E.createHTML(A);break}case"TrustedScriptURL":{A=E.createScriptURL(A);break}}try{h?e.setAttributeNS(h,T,A):e.setAttribute(T,A),Pe(i.removed)}catch{}}}b("afterSanitizeAttributes",e,null)},tn=function o(e){let t=null;const n=lt(e);for(b("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)b("uponSanitizeShadowNode",t,null),!ct(t)&&(t.content instanceof D&&o(t.content),mt(t));b("afterSanitizeShadowDOM",e,null)};return i.sanitize=function(o){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,c=null,d=null;if(be=!o,be&&(o="<!-->"),typeof o!="string"&&!st(o))if(typeof o.toString=="function"){if(o=o.toString(),typeof o!="string")throw B("dirty is not a string, aborting")}else throw B("toString is not a function");if(!i.isSupported)return o;if(Le||Ie(e),i.removed=[],typeof o=="string"&&(j=!1),j){if(o.nodeName){const w=p(o.nodeName);if(!u[w]||X[w])throw B("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof de)t=rt("<!---->"),n=t.ownerDocument.importNode(o,!0),n.nodeType===1&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!v&&!k&&!I&&o.indexOf("<")===-1)return E&&ne?E.createHTML(o):o;if(t=rt(o),!t)return v?null:ne?Y:""}t&&ye&&M(t.firstChild);const T=lt(j?o:t);for(;c=T.nextNode();)ct(c)||(c.content instanceof D&&tn(c.content),mt(c));if(j)return o;if(v){if(te)for(d=Gt.call(t.ownerDocument);t.firstChild;)d.appendChild(t.firstChild);else d=t;return(m.shadowroot||m.shadowrootmode)&&(d=Bt.call(r,d,!0)),d}let h=I?t.outerHTML:t.innerHTML;return I&&u["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&S(ze,t.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
2
+ `+h),k&&q([Ee,he,Ae],w=>{h=W(h,w," ")}),E&&ne?E.createHTML(h):h},i.setConfig=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ie(o),Le=!0},i.clearConfig=function(){z=null,Le=!1},i.isValidAttribute=function(o,e,t){z||Ie({});const n=p(o),c=p(e);return ft(n,c,t)},i.addHook=function(o,e){typeof e=="function"&&(y[o]=y[o]||[],G(y[o],e))},i.removeHook=function(o){if(y[o])return Pe(y[o])},i.removeHooks=function(o){y[o]&&(y[o]=[])},i.removeAllHooks=function(){y={}},i}var xt=We();return xt})})(Tt);var an=Tt.exports,rn=on(an);export{rn as DOMPurify};
@@ -13,6 +13,7 @@ export declare class UmbInputMarkdownElement extends UmbInputMarkdownElement_bas
13
13
  overlaySize?: UUIModalSidebarSize;
14
14
  _codeEditor?: UmbCodeEditorElement;
15
15
  private _modalContext?;
16
+ private serverUrl?;
16
17
  constructor();
17
18
  private _focusEditor;
18
19
  private _insertLink;
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { sanitizeHtml } from '../../../../external/sanitize-html/index.js';
7
+ import { DOMPurify } from '../../../../external/dompurify/index.js';
8
8
  import { marked } from '../../../../external/marked/index.js';
9
9
  import { monaco } from '../../../../external/monaco-editor/index.js';
10
10
  import { loadCodeEditor } from '../../../templating/code-editor/index.js';
@@ -13,6 +13,7 @@ import { FormControlMixin, UUITextStyles } from '../../../../external/uui/index.
13
13
  import { UmbBooleanState } from '../../../../libs/observable-api/index.js';
14
14
  import { UmbLitElement } from '../../../../shared/lit-element/index.js';
15
15
  import { UMB_LINK_PICKER_MODAL, UMB_MEDIA_TREE_PICKER_MODAL, UMB_MODAL_MANAGER_CONTEXT_TOKEN, } from '../../modal/index.js';
16
+ import { UMB_APP } from '../../../../apps/app/index.js';
16
17
  /**
17
18
  * @element umb-input-markdown
18
19
  * @fires change - when the value of the input changes
@@ -32,6 +33,9 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
32
33
  this.consumeContext(UMB_MODAL_MANAGER_CONTEXT_TOKEN, (instance) => {
33
34
  this._modalContext = instance;
34
35
  });
36
+ this.consumeContext(UMB_APP, (instance) => {
37
+ this.serverUrl = instance.getServerUrl();
38
+ });
35
39
  }
36
40
  async #loadCodeEditor() {
37
41
  try {
@@ -50,42 +54,41 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
50
54
  }
51
55
  }
52
56
  async #loadActions() {
53
- // TODO: Find a way to have "double" keybindings (ctrl+m+ctrl+c for `code`, rather than simple ctrl+c as its taken by OS to copy things)
54
- // Going with the keybindings of a Markdown Shortcut plugin https://marketplace.visualstudio.com/items?itemName=robole.markdown-shortcuts#shortcuts or perhaps there are keybindings that would make more sense.
57
+ //Note: UI Buttons have the keybindings hardcoded in its title. If you change the keybindings here, please update the render as well.
55
58
  this.#editor?.monacoEditor?.addAction({
56
59
  label: 'Add Heading H1',
57
60
  id: 'h1',
58
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Digit1],
61
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Digit1],
59
62
  run: () => this._insertAtCurrentLine('# '),
60
63
  });
61
64
  this.#editor?.monacoEditor?.addAction({
62
65
  label: 'Add Heading H2',
63
66
  id: 'h2',
64
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Digit2],
67
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Digit2],
65
68
  run: () => this._insertAtCurrentLine('## '),
66
69
  });
67
70
  this.#editor?.monacoEditor?.addAction({
68
71
  label: 'Add Heading H3',
69
72
  id: 'h3',
70
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Digit3],
73
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Digit3],
71
74
  run: () => this._insertAtCurrentLine('### '),
72
75
  });
73
76
  this.#editor?.monacoEditor?.addAction({
74
77
  label: 'Add Heading H4',
75
78
  id: 'h4',
76
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Digit4],
79
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Digit4],
77
80
  run: () => this._insertAtCurrentLine('#### '),
78
81
  });
79
82
  this.#editor?.monacoEditor?.addAction({
80
83
  label: 'Add Heading H5',
81
84
  id: 'h5',
82
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Digit5],
85
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Digit5],
83
86
  run: () => this._insertAtCurrentLine('##### '),
84
87
  });
85
88
  this.#editor?.monacoEditor?.addAction({
86
89
  label: 'Add Heading H6',
87
90
  id: 'h6',
88
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.Digit6],
91
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Digit6],
89
92
  run: () => this._insertAtCurrentLine('###### '),
90
93
  });
91
94
  this.#editor?.monacoEditor?.addAction({
@@ -103,52 +106,49 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
103
106
  this.#editor?.monacoEditor?.addAction({
104
107
  label: 'Add Quote',
105
108
  id: 'q',
106
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyQ],
109
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Period],
107
110
  run: () => this._insertQuote(),
108
111
  });
109
112
  this.#editor?.monacoEditor?.addAction({
110
113
  label: 'Add Ordered List',
111
114
  id: 'ol',
112
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyO],
115
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Digit7],
113
116
  run: () => this._insertAtCurrentLine('1. '),
114
117
  });
115
118
  this.#editor?.monacoEditor?.addAction({
116
119
  label: 'Add Unordered List',
117
120
  id: 'ul',
118
- keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyU],
121
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Digit8],
119
122
  run: () => this._insertAtCurrentLine('- '),
120
123
  });
121
124
  this.#editor?.monacoEditor?.addAction({
122
125
  label: 'Add Code',
123
126
  id: 'code',
124
- //keybindings: [KeyMod.CtrlCmd | KeyCode.KeyM | KeyMod.CtrlCmd | KeyCode.KeyC],
127
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyE],
125
128
  run: () => this._insertBetweenSelection('`', '`', 'Code'),
126
129
  });
127
130
  this.#editor?.monacoEditor?.addAction({
128
131
  label: 'Add Fenced Code',
129
132
  id: 'fenced-code',
130
- //keybindings: [KeyMod.CtrlCmd | KeyCode.KeyM | KeyMod.CtrlCmd | KeyCode.KeyF],
131
133
  run: () => this._insertBetweenSelection('```', '```', 'Code'),
132
134
  });
133
135
  this.#editor?.monacoEditor?.addAction({
134
136
  label: 'Add Line',
135
137
  id: 'line',
136
- //keybindings: [KeyMod.CtrlCmd | KeyCode.KeyM | KeyMod.CtrlCmd | KeyCode.KeyC],
137
138
  run: () => this._insertLine(),
138
139
  });
139
140
  this.#editor?.monacoEditor?.addAction({
140
141
  label: 'Add Link',
141
142
  id: 'link',
142
- //keybindings: [KeyMod.CtrlCmd | KeyCode.KeyM | KeyMod.CtrlCmd | KeyCode.KeyC],
143
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK],
143
144
  run: () => this._insertLink(),
144
- // TODO: Open in modal
145
145
  });
146
146
  this.#editor?.monacoEditor?.addAction({
147
147
  label: 'Add Image',
148
148
  id: 'image',
149
- //keybindings: [KeyMod.CtrlCmd | KeyCode.KeyM | KeyMod.CtrlCmd | KeyCode.KeyC],
149
+ //keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyJ], // What keybinding would be good for image?
150
150
  run: () => this._insertMedia(),
151
- // TODO: Open in modal
151
+ // TODO: Update when media picker is complete.
152
152
  });
153
153
  }
154
154
  _focusEditor() {
@@ -198,7 +198,7 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
198
198
  const selection = this.#editor?.getSelections()[0];
199
199
  if (!selection)
200
200
  return;
201
- const alt = this.#editor?.getValueInRange(selection);
201
+ const alt = this.#editor?.getValueInRange(selection) || 'alt text';
202
202
  this._focusEditor(); // Focus before opening modal, otherwise cannot regain focus back after modal
203
203
  const modalContext = this._modalContext?.open(UMB_MEDIA_TREE_PICKER_MODAL, {});
204
204
  modalContext
@@ -206,17 +206,18 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
206
206
  .then((data) => {
207
207
  const imgUrl = data.selection[0];
208
208
  this.#editor?.monacoEditor?.executeEdits('', [
209
- //TODO: media url
210
- { range: selection, text: `[${alt || 'alt text'}](TODO: id-${imgUrl || this.localize.term('general_url')})` },
209
+ //TODO: Get the correct media URL
210
+ {
211
+ range: selection,
212
+ text: `![${alt}](${imgUrl ? `${this.serverUrl}'/media/'${imgUrl}` : 'URL'})`,
213
+ },
211
214
  ]);
212
- if (!alt?.length) {
213
- this.#editor?.select({
214
- startColumn: selection.startColumn + 1,
215
- endColumn: selection.startColumn + 9,
216
- endLineNumber: selection.startLineNumber,
217
- startLineNumber: selection.startLineNumber,
218
- });
219
- }
215
+ this.#editor?.select({
216
+ startColumn: selection.startColumn + 2,
217
+ endColumn: selection.startColumn + alt.length + 2,
218
+ endLineNumber: selection.startLineNumber,
219
+ startLineNumber: selection.startLineNumber,
220
+ });
220
221
  })
221
222
  .catch(() => undefined)
222
223
  .finally(() => this._focusEditor());
@@ -378,7 +379,7 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
378
379
  compact
379
380
  look="secondary"
380
381
  label="Heading"
381
- title="Heading"
382
+ title="Heading, &lt;Ctrl+Shift+1&gt;"
382
383
  @click=${() => this.#editor?.monacoEditor?.getAction('h1')?.run()}>
383
384
  H
384
385
  </uui-button>
@@ -386,7 +387,7 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
386
387
  compact
387
388
  look="secondary"
388
389
  label="Bold"
389
- title="Bold"
390
+ title="Bold, &lt;Ctrl+B&gt;"
390
391
  @click=${() => this.#editor?.monacoEditor?.getAction('b')?.run()}>
391
392
  B
392
393
  </uui-button>
@@ -394,7 +395,7 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
394
395
  compact
395
396
  look="secondary"
396
397
  label="Italic"
397
- title="Italic"
398
+ title="Italic, &lt;Ctrl+I&gt;"
398
399
  @click=${() => this.#editor?.monacoEditor?.getAction('i')?.run()}>
399
400
  I
400
401
  </uui-button>
@@ -404,7 +405,7 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
404
405
  compact
405
406
  look="secondary"
406
407
  label="Quote"
407
- title="Quote"
408
+ title="Quote, &lt;Ctrl+Shift+.&gt;"
408
409
  @click=${() => this.#editor?.monacoEditor?.getAction('q')?.run()}>
409
410
  <uui-icon name="icon-quote"></uui-icon>
410
411
  </uui-button>
@@ -412,7 +413,7 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
412
413
  compact
413
414
  look="secondary"
414
415
  label="Ordered List"
415
- title="Ordered List"
416
+ title="Ordered List, &lt;Ctrl+Shift+7&gt;"
416
417
  @click=${() => this.#editor?.monacoEditor?.getAction('ol')?.run()}>
417
418
  <uui-icon name="icon-ordered-list"></uui-icon>
418
419
  </uui-button>
@@ -420,7 +421,7 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
420
421
  compact
421
422
  look="secondary"
422
423
  label="Unordered List"
423
- title="Unordered List"
424
+ title="Unordered List, &lt;Ctrl+Shift+8&gt;"
424
425
  @click=${() => this.#editor?.monacoEditor?.getAction('ul')?.run()}>
425
426
  <uui-icon name="icon-bulleted-list"></uui-icon>
426
427
  </uui-button>
@@ -429,9 +430,9 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
429
430
  <uui-button
430
431
  compact
431
432
  look="secondary"
432
- label="Fenced Code"
433
- title="Fenced Code"
434
- @click=${() => this.#editor?.monacoEditor?.getAction('fenced-code')?.run()}>
433
+ label="Code"
434
+ title="Code, &lt;Ctrl+E&gt;"
435
+ @click=${() => this.#editor?.monacoEditor?.getAction('code')?.run()}>
435
436
  <uui-icon name="icon-code"></uui-icon>
436
437
  </uui-button>
437
438
  <uui-button
@@ -446,7 +447,7 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
446
447
  compact
447
448
  look="secondary"
448
449
  label="Link"
449
- title="Link"
450
+ title="Link, &lt;Ctrl+K&gt;"
450
451
  @click=${() => this.#editor?.monacoEditor?.getAction('link')?.run()}>
451
452
  <uui-icon name="icon-link"></uui-icon>
452
453
  </uui-button>
@@ -496,7 +497,6 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
496
497
  this.dispatchEvent(new CustomEvent('change'));
497
498
  }
498
499
  render() {
499
- //TODO: Why is the theme dark in Backoffice, but light in Storybook?
500
500
  return html ` <div id="actions">${this._renderBasicActions()}</div>
501
501
  <umb-code-editor
502
502
  language="markdown"
@@ -508,10 +508,8 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
508
508
  }
509
509
  renderPreview(markdown) {
510
510
  const markdownAsHtml = marked.parse(markdown);
511
- const sanitizedHtml = markdownAsHtml ? sanitizeHtml(markdownAsHtml) : '';
512
- return html `<uui-scroll-container id="preview">
513
- ${unsafeHTML(sanitizedHtml)}
514
- </uui-scroll-container>`;
511
+ const sanitizedHtml = markdownAsHtml ? DOMPurify.sanitize(markdownAsHtml) : '';
512
+ return html `<uui-scroll-container id="preview"> ${unsafeHTML(sanitizedHtml)} </uui-scroll-container>`;
515
513
  }
516
514
  static { this.styles = [
517
515
  UUITextStyles,
@@ -554,6 +552,19 @@ export let UmbInputMarkdownElement = class UmbInputMarkdownElement extends FormC
554
552
  margin-inline: 0;
555
553
  padding-inline: var(--uui-size-3);
556
554
  }
555
+
556
+ p > code,
557
+ pre {
558
+ border: 1px solid var(--uui-color-divider-emphasis);
559
+ border-radius: var(--uui-border-radius);
560
+ padding: 0 var(--uui-size-1);
561
+ background-color: var(--uui-color-background);
562
+ }
563
+
564
+ hr {
565
+ border: none;
566
+ border-bottom: 1px solid var(--uui-palette-cocoa-black);
567
+ }
557
568
  `,
558
569
  ]; }
559
570
  };
@@ -9,6 +9,7 @@ import { UmbDictionaryWorkspaceEditorElement } from './dictionary-workspace-edit
9
9
  import { UmbTextStyles } from '../../../../shared/style/index.js';
10
10
  import { html, customElement, state } from '../../../../external/lit/index.js';
11
11
  import { UmbLitElement } from '../../../../shared/lit-element/index.js';
12
+ import { UmbWorkspaceIsNewRedirectController } from '../../../core/workspace/index.js';
12
13
  export let UmbWorkspaceDictionaryElement = class UmbWorkspaceDictionaryElement extends UmbLitElement {
13
14
  constructor() {
14
15
  super(...arguments);
@@ -26,9 +27,10 @@ export let UmbWorkspaceDictionaryElement = class UmbWorkspaceDictionaryElement e
26
27
  {
27
28
  path: 'create/:parentId',
28
29
  component: () => this.#element,
29
- setup: (_component, info) => {
30
+ setup: async (_component, info) => {
30
31
  const parentId = info.match.params.parentId === 'null' ? null : info.match.params.parentId;
31
- this.#workspaceContext.create(parentId);
32
+ await this.#workspaceContext.create(parentId);
33
+ new UmbWorkspaceIsNewRedirectController(this, this.#workspaceContext, this.shadowRoot.querySelector('umb-router-slot'));
32
34
  },
33
35
  },
34
36
  ];
@@ -1,4 +1,3 @@
1
- import { PropertyValueMap } from '../../../../external/lit/index.js';
2
1
  import { UmbLitElement } from '../../../../shared/lit-element/index.js';
3
2
  export declare class UmbScriptsWorkspaceEditElement extends UmbLitElement {
4
3
  #private;
@@ -12,7 +11,6 @@ export declare class UmbScriptsWorkspaceEditElement extends UmbLitElement {
12
11
  private _modalContext?;
13
12
  private inputQuery$;
14
13
  constructor();
15
- protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
16
14
  render(): import("lit-html").TemplateResult<1>;
17
15
  static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
18
16
  }
@@ -43,6 +43,7 @@ export let UmbScriptsWorkspaceEditElement = class UmbScriptsWorkspaceEditElement
43
43
  });
44
44
  this.observe(this.#scriptsWorkspaceContext.path, (path) => {
45
45
  this._path = path;
46
+ this._dirName = this._path?.substring(0, this._path?.lastIndexOf('\\'))?.replace(/\\/g, '/');
46
47
  });
47
48
  this.observe(this.#scriptsWorkspaceContext.isNew, (isNew) => {
48
49
  this.#isNew = !!isNew;
@@ -55,11 +56,6 @@ export let UmbScriptsWorkspaceEditElement = class UmbScriptsWorkspaceEditElement
55
56
  });
56
57
  });
57
58
  }
58
- willUpdate(_changedProperties) {
59
- if (_changedProperties.has('_path')) {
60
- this._dirName = this._path?.substring(0, this._path?.lastIndexOf('/'));
61
- }
62
- }
63
59
  #onNameInput(event) {
64
60
  const target = event.target;
65
61
  const value = target.value;
@@ -4,6 +4,7 @@ export declare class UmbStylesheetWorkspaceEditorElement extends UmbLitElement {
4
4
  private get _name();
5
5
  private set _name(value);
6
6
  private _path?;
7
+ private _dirName?;
7
8
  private inputQuery$;
8
9
  constructor();
9
10
  render(): import("lit-html").TemplateResult<1>;
@@ -34,8 +34,11 @@ export let UmbStylesheetWorkspaceEditorElement = class UmbStylesheetWorkspaceEdi
34
34
  #observeNameAndPath() {
35
35
  if (!this.#workspaceContext)
36
36
  return;
37
- this.observe(this.#workspaceContext.name, (name) => (this._name = name ?? ''), '_observeName');
38
- this.observe(this.#workspaceContext.path, (path) => (this._path = path ?? ''), '_observePath');
37
+ this.observe(this.#workspaceContext.path, (path) => {
38
+ this._path = path;
39
+ this._dirName = this._path?.substring(0, this._path?.lastIndexOf('\\') + 1)?.replace(/\\/g, '/');
40
+ }, '_observeStylesheetPath');
41
+ this.observe(this.#workspaceContext.name, (name) => (this._name = name), '_observeStylesheetName');
39
42
  }
40
43
  #onNameChange(event) {
41
44
  const target = event.target;
@@ -53,7 +56,7 @@ export let UmbStylesheetWorkspaceEditorElement = class UmbStylesheetWorkspaceEdi
53
56
  .value=${this._name}
54
57
  @input="${this.#onNameChange}">
55
58
  </uui-input>
56
- <small>/css/${this._path}</small>
59
+ <small>/css/${this._dirName}${this._name}.css</small>
57
60
  </div>
58
61
 
59
62
  <div slot="footer-info">
@@ -101,6 +104,9 @@ __decorate([
101
104
  __decorate([
102
105
  state()
103
106
  ], UmbStylesheetWorkspaceEditorElement.prototype, "_path", void 0);
107
+ __decorate([
108
+ state()
109
+ ], UmbStylesheetWorkspaceEditorElement.prototype, "_dirName", void 0);
104
110
  UmbStylesheetWorkspaceEditorElement = __decorate([
105
111
  customElement('umb-stylesheet-workspace-editor')
106
112
  ], UmbStylesheetWorkspaceEditorElement);
@@ -7,7 +7,7 @@ import { UmbContextToken } from '../../../../libs/context-api/index.js';
7
7
  export type RichTextRuleModelSortable = RichTextRuleModel & {
8
8
  sortOrder?: number;
9
9
  };
10
- export declare class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext<UmbStylesheetRepository, StylesheetDetails> implements UmbSaveableWorkspaceContextInterface {
10
+ export declare class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext<UmbStylesheetRepository, StylesheetDetails> implements UmbSaveableWorkspaceContextInterface<StylesheetDetails | undefined> {
11
11
  #private;
12
12
  data: import("rxjs").Observable<import("../../../../external/backend-api/index.js").TextFileResponseModelBaseModel | undefined>;
13
13
  rules: import("rxjs").Observable<RichTextRuleModelSortable[]>;
@@ -34,7 +34,10 @@ export class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext {
34
34
  return 'stylesheet';
35
35
  }
36
36
  getEntityId() {
37
- return this.getData()?.path || '';
37
+ const path = this.getData()?.path;
38
+ const name = this.getData()?.name;
39
+ // TODO: %2F is a slash (/). Should we make it an actual slash in the URL? (%2F for now so that the server can find the correct stylesheet via URL)
40
+ return path && name ? `${path}%2F${name}` : name || '';
38
41
  }
39
42
  getData() {
40
43
  return this.#data.getValue();
@@ -115,18 +118,23 @@ export class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext {
115
118
  content: stylesheet.content,
116
119
  parentPath: stylesheet.path ?? '',
117
120
  };
118
- this.repository.create(createRequestBody);
121
+ const { error } = await this.repository.create(createRequestBody);
122
+ if (!error) {
123
+ this.setIsNew(false);
124
+ }
125
+ return Promise.resolve();
126
+ }
127
+ else {
128
+ if (!stylesheet.path)
129
+ return Promise.reject('There is no path');
130
+ const updateRequestBody = {
131
+ name: stylesheet.name,
132
+ existingPath: stylesheet.path,
133
+ content: stylesheet.content,
134
+ };
135
+ this.repository.save(stylesheet.path, updateRequestBody);
119
136
  return Promise.resolve();
120
137
  }
121
- if (!stylesheet.path)
122
- return Promise.reject('There is no path');
123
- const updateRequestBody = {
124
- name: stylesheet.name,
125
- existingPath: stylesheet.path,
126
- content: stylesheet.content,
127
- };
128
- this.repository.save(stylesheet.path, updateRequestBody);
129
- return Promise.resolve();
130
138
  }
131
139
  async create(parentKey) {
132
140
  const newStylesheet = {