import{j as t,I as Oe,B as se,k as Dn,v as d,az as On,r as Re,F as Ge,b6 as Rn,aK as lt,aL as ct,aM as mt,aN as ut,t as dt}from"./index-7T7TTikv.js";import{C as ft,a as pt,b as gt,d as ht}from"./card-_ldW-koX.js";import{T as wn,a as In,b as Vt,c as Tt,d as Cn,e as xt}from"./table-D_B7hhqb.js";import{u as Ln,C as Xt}from"./index.esm-BRNlF2G3.js";import{T as jn,u as Mn}from"./useTemplate-YHjX1fxO.js";import{S as kn,a as vn,b as Pn,c as Fn,d as Kt}from"./select--i8koVXg.js";import{S as Un}from"./skeleton-BCpLdfqO.js";import{A as zn,a as Hn,b as Bn,c as Gn,d as Wn,e as Yn,f as qn,g as $n}from"./alert-dialog-DwppaTz4.js";import{P as Vn}from"./plus-CC3ol2sL.js";import{E as Xn}from"./eye-DYwZYJcQ.js";import{S as Kn}from"./square-pen-Dh1zj83N.js";import"./Utils-BP0IYDrC.js";import"./Skeleton-BOu0YqbY.js";/*! @license DOMPurify 3.4.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.8/LICENSE */function Zt(a,r){(r==null||r>a.length)&&(r=a.length);for(var i=0,l=Array(r);i2?l-2:0),g=2;g1?i-1:0),c=1;c"u"?null:N(BigInt.prototype.toString),an=typeof Symbol>"u"?null:N(Symbol.prototype.toString),y=N(Object.prototype.hasOwnProperty),we=N(Object.prototype.toString),I=N(RegExp.prototype.test),xe=ma(TypeError);function N(a){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var i=arguments.length,l=new Array(i>1?i-1:0),c=1;c2&&arguments[2]!==void 0?arguments[2]:Ie;if(Jt&&Jt(a,null),!j(r))return a;let l=r.length;for(;l--;){let c=r[l];if(typeof c=="string"){const g=i(c);g!==c&&(na(r)||(r[l]=g),c=g)}a[c]=!0}return a}function ua(a){for(let r=0;r/g),xa=U(/\${[\w\W]*/g),ya=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ea=U(/^aria-[\-\w]+$/),cn=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Aa=U(/^(?:\w+script|data):/i),_a=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ba=U(/^html$/i),Sa=U(/^[a-z][.\w]*(-[.\w]+)+$/i),q={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Na=function(){return typeof window>"u"?null:window},Da=function(r,i){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let l=null;const c="data-tt-policy-suffix";i&&i.hasAttribute(c)&&(l=i.getAttribute(c));const g="dompurify"+(l?"#"+l:"");try{return r.createPolicy(g,{createHTML(b){return b},createScriptURL(b){return b}})}catch{return null}},mn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function pn(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Na();const r=s=>pn(s);if(r.version="3.4.8",r.removed=[],!a||!a.document||a.document.nodeType!==q.document||!a.Element)return r.isSupported=!1,r;let i=a.document;const l=i,c=l.currentScript;a.DocumentFragment;const g=a.HTMLTemplateElement,b=a.Node,B=a.Element,T=a.NodeFilter,V=a.NamedNodeMap;V===void 0&&(a.NamedNodeMap||a.MozNamedAttrMap),a.HTMLFormElement;const X=a.DOMParser,G=a.trustedTypes,k=B.prototype,ie=$(k,"cloneNode"),v=$(k,"remove"),Ee=$(k,"nextSibling"),K=$(k,"childNodes"),le=$(k,"parentNode"),J=$(k,"shadowRoot"),Ye=$(k,"attributes"),L=b&&b.prototype?$(b.prototype,"nodeType"):null,x=b&&b.prototype?$(b.prototype,"nodeName"):null;if(typeof g=="function"){const s=i.createElement("template");s.content&&s.content.ownerDocument&&(i=s.content.ownerDocument)}let D,Q="",Ae=0;const ee=function(e){if(Ae>0)throw xe('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');Ae++;try{return D.createHTML(e)}finally{Ae--}},ce=i,_e=ce.implementation,Ce=ce.createNodeIterator,qe=ce.createDocumentFragment,p=ce.getElementsByTagName,P=l.importNode;let R=mn();r.isSupported=typeof dn=="function"&&typeof le=="function"&&_e&&_e.createHTMLDocument!==void 0;const Le=ha,je=Ta,Me=xa,gn=ya,hn=Ea,Tn=Aa,Dt=_a,xn=Sa;let Ot=cn,E=null;const $e=m({},[...rn,...Et,...At,..._t,...on]);let S=null;const Ve=m({},[...sn,...bt,...ln,...We]);let A=Object.seal(ye(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}})),be=null,ke=null;const te=Object.seal(ye(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Rt=!0,Xe=!0,wt=!1,It=!0,ne=!1,Se=!0,ae=!1,Ke=!1,Ze=!1,me=!1,ve=!1,Pe=!1,Ct=!0,Lt=!1;const jt="user-content-";let Je=!0,Ne=!1,ue={},W=null;const Qe=m({},["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 Mt=null;const kt=m({},["audio","video","img","source","image","track"]);let et=null;const vt=m({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fe="http://www.w3.org/1998/Math/MathML",Ue="http://www.w3.org/2000/svg",Y="http://www.w3.org/1999/xhtml";let de=Y,tt=!1,nt=null;const yn=m({},[Fe,Ue,Y],yt);let at=m({},["mi","mo","mn","ms","mtext"]),rt=m({},["annotation-xml"]);const En=m({},["title","style","font","a","script"]);let De=null;const An=["application/xhtml+xml","text/html"],_n="text/html";let _=null,fe=null;const bn=i.createElement("form"),Pt=function(e){return e instanceof RegExp||e instanceof Function},ot=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(fe&&fe===e)return;(!e||typeof e!="object")&&(e={}),e=C(e),De=An.indexOf(e.PARSER_MEDIA_TYPE)===-1?_n:e.PARSER_MEDIA_TYPE,_=De==="application/xhtml+xml"?yt:Ie,E=y(e,"ALLOWED_TAGS")&&j(e.ALLOWED_TAGS)?m({},e.ALLOWED_TAGS,_):$e,S=y(e,"ALLOWED_ATTR")&&j(e.ALLOWED_ATTR)?m({},e.ALLOWED_ATTR,_):Ve,nt=y(e,"ALLOWED_NAMESPACES")&&j(e.ALLOWED_NAMESPACES)?m({},e.ALLOWED_NAMESPACES,yt):yn,et=y(e,"ADD_URI_SAFE_ATTR")&&j(e.ADD_URI_SAFE_ATTR)?m(C(vt),e.ADD_URI_SAFE_ATTR,_):vt,Mt=y(e,"ADD_DATA_URI_TAGS")&&j(e.ADD_DATA_URI_TAGS)?m(C(kt),e.ADD_DATA_URI_TAGS,_):kt,W=y(e,"FORBID_CONTENTS")&&j(e.FORBID_CONTENTS)?m({},e.FORBID_CONTENTS,_):Qe,be=y(e,"FORBID_TAGS")&&j(e.FORBID_TAGS)?m({},e.FORBID_TAGS,_):C({}),ke=y(e,"FORBID_ATTR")&&j(e.FORBID_ATTR)?m({},e.FORBID_ATTR,_):C({}),ue=y(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?C(e.USE_PROFILES):e.USE_PROFILES:!1,Rt=e.ALLOW_ARIA_ATTR!==!1,Xe=e.ALLOW_DATA_ATTR!==!1,wt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,It=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ne=e.SAFE_FOR_TEMPLATES||!1,Se=e.SAFE_FOR_XML!==!1,ae=e.WHOLE_DOCUMENT||!1,me=e.RETURN_DOM||!1,ve=e.RETURN_DOM_FRAGMENT||!1,Pe=e.RETURN_TRUSTED_TYPE||!1,Ze=e.FORCE_BODY||!1,Ct=e.SANITIZE_DOM!==!1,Lt=e.SANITIZE_NAMED_PROPS||!1,Je=e.KEEP_CONTENT!==!1,Ne=e.IN_PLACE||!1,Ot=fa(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:cn,de=typeof e.NAMESPACE=="string"?e.NAMESPACE:Y,at=y(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?C(e.MATHML_TEXT_INTEGRATION_POINTS):m({},["mi","mo","mn","ms","mtext"]),rt=y(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?C(e.HTML_INTEGRATION_POINTS):m({},["annotation-xml"]);const n=y(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?C(e.CUSTOM_ELEMENT_HANDLING):ye(null);if(A=ye(null),y(n,"tagNameCheck")&&Pt(n.tagNameCheck)&&(A.tagNameCheck=n.tagNameCheck),y(n,"attributeNameCheck")&&Pt(n.attributeNameCheck)&&(A.attributeNameCheck=n.attributeNameCheck),y(n,"allowCustomizedBuiltInElements")&&typeof n.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=n.allowCustomizedBuiltInElements),ne&&(Xe=!1),ve&&(me=!0),ue&&(E=m({},on),S=ye(null),ue.html===!0&&(m(E,rn),m(S,sn)),ue.svg===!0&&(m(E,Et),m(S,bt),m(S,We)),ue.svgFilters===!0&&(m(E,At),m(S,bt),m(S,We)),ue.mathMl===!0&&(m(E,_t),m(S,ln),m(S,We))),te.tagCheck=null,te.attributeCheck=null,y(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?te.tagCheck=e.ADD_TAGS:j(e.ADD_TAGS)&&(E===$e&&(E=C(E)),m(E,e.ADD_TAGS,_))),y(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?te.attributeCheck=e.ADD_ATTR:j(e.ADD_ATTR)&&(S===Ve&&(S=C(S)),m(S,e.ADD_ATTR,_))),y(e,"ADD_URI_SAFE_ATTR")&&j(e.ADD_URI_SAFE_ATTR)&&m(et,e.ADD_URI_SAFE_ATTR,_),y(e,"FORBID_CONTENTS")&&j(e.FORBID_CONTENTS)&&(W===Qe&&(W=C(W)),m(W,e.FORBID_CONTENTS,_)),y(e,"ADD_FORBID_CONTENTS")&&j(e.ADD_FORBID_CONTENTS)&&(W===Qe&&(W=C(W)),m(W,e.ADD_FORBID_CONTENTS,_)),Je&&(E["#text"]=!0),ae&&m(E,["html","head","body"]),E.table&&(m(E,["tbody"]),delete be.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw xe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const o=D;D=e.TRUSTED_TYPES_POLICY;try{Q=ee("")}catch(f){throw D=o,f}}else D===void 0&&e.TRUSTED_TYPES_POLICY!==null&&(D=Da(G,c)),D&&typeof Q=="string"&&(Q=ee(""));(R.uponSanitizeElement.length>0||R.uponSanitizeAttribute.length>0)&&E===$e&&(E=C(E)),R.uponSanitizeAttribute.length>0&&S===Ve&&(S=C(S)),M&&M(e),fe=e},Ft=m({},[...Et,...At,...pa]),Ut=m({},[..._t,...ga]),Sn=function(e){let n=le(e);(!n||!n.tagName)&&(n={namespaceURI:de,tagName:"template"});const o=Ie(e.tagName),f=Ie(n.tagName);return nt[e.namespaceURI]?e.namespaceURI===Ue?n.namespaceURI===Y?o==="svg":n.namespaceURI===Fe?o==="svg"&&(f==="annotation-xml"||at[f]):!!Ft[o]:e.namespaceURI===Fe?n.namespaceURI===Y?o==="math":n.namespaceURI===Ue?o==="math"&&rt[f]:!!Ut[o]:e.namespaceURI===Y?n.namespaceURI===Ue&&!rt[f]||n.namespaceURI===Fe&&!at[f]?!1:!Ut[o]&&(En[o]||!Ft[o]):!!(De==="application/xhtml+xml"&&nt[e.namespaceURI]):!1},z=function(e){he(r.removed,{element:e});try{le(e).removeChild(e)}catch{v(e)}},re=function(e,n){try{he(r.removed,{attribute:n.getAttributeNode(e),from:n})}catch{he(r.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e==="is")if(me||ve)try{z(n)}catch{}else try{n.setAttribute(e,"")}catch{}},zt=function(e){let n=null,o=null;if(Ze)e=""+e;else{const h=en(e,/^[\r\n\t ]+/);o=h&&h[0]}De==="application/xhtml+xml"&&de===Y&&(e=''+e+"");const f=D?ee(e):e;if(de===Y)try{n=new X().parseFromString(f,De)}catch{}if(!n||!n.documentElement){n=_e.createDocument(de,"template",null);try{n.documentElement.innerHTML=tt?Q:f}catch{}}const u=n.body||n.documentElement;return e&&o&&u.insertBefore(i.createTextNode(o),u.childNodes[0]||null),de===Y?p.call(n,ae?"html":"body")[0]:ae?n.documentElement:u},Ht=function(e){return Ce.call(e.ownerDocument||e,e,T.SHOW_ELEMENT|T.SHOW_COMMENT|T.SHOW_TEXT|T.SHOW_PROCESSING_INSTRUCTION|T.SHOW_CDATA_SECTION,null)},st=function(e){var n,o;e.normalize();const f=Ce.call(e.ownerDocument||e,e,T.SHOW_TEXT|T.SHOW_COMMENT|T.SHOW_CDATA_SECTION|T.SHOW_PROCESSING_INSTRUCTION,null);let u=f.nextNode();for(;u;){let O=u.data;oe([Le,je,Me],F=>{O=Te(O,F," ")}),u.data=O,u=f.nextNode()}const h=(n=(o=e.querySelectorAll)===null||o===void 0?void 0:o.call(e,"template"))!==null&&n!==void 0?n:[];oe(Array.from(h),O=>{pe(O.content)&&st(O.content)})},ze=function(e){const n=x?x(e):null;return typeof n!="string"||_(n)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==Ye(e)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==L(e)||e.childNodes!==K(e)},pe=function(e){if(!L||typeof e!="object"||e===null)return!1;try{return L(e)===q.documentFragment}catch{return!1}},He=function(e){if(!L||typeof e!="object"||e===null)return!1;try{return typeof L(e)=="number"}catch{return!1}};function Z(s,e,n){oe(s,o=>{o.call(r,e,n,fe)})}const Bt=function(e){let n=null;if(Z(R.beforeSanitizeElements,e,null),ze(e))return z(e),!0;const o=_(x?x(e):e.nodeName);if(Z(R.uponSanitizeElement,e,{tagName:o,allowedTags:E}),Se&&e.hasChildNodes()&&!He(e.firstElementChild)&&I(/<[/\w!]/g,e.innerHTML)&&I(/<[/\w!]/g,e.textContent)||Se&&e.namespaceURI===Y&&o==="style"&&He(e.firstElementChild)||e.nodeType===q.progressingInstruction||Se&&e.nodeType===q.comment&&I(/<[/\w]/g,e.data))return z(e),!0;if(be[o]||!(te.tagCheck instanceof Function&&te.tagCheck(o))&&!E[o]){if(!be[o]&&Wt(o)&&(A.tagNameCheck instanceof RegExp&&I(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o)))return!1;if(Je&&!W[o]){const u=le(e),h=K(e);if(h&&u){const O=h.length;for(let F=O-1;F>=0;--F){const H=ie(h[F],!0);u.insertBefore(H,Ee(e))}}}return z(e),!0}return(L?L(e):e.nodeType)===q.element&&!Sn(e)||(o==="noscript"||o==="noembed"||o==="noframes")&&I(/<\/no(script|embed|frames)/i,e.innerHTML)?(z(e),!0):(ne&&e.nodeType===q.text&&(n=e.textContent,oe([Le,je,Me],u=>{n=Te(n,u," ")}),e.textContent!==n&&(he(r.removed,{element:e.cloneNode()}),e.textContent=n)),Z(R.afterSanitizeElements,e,null),!1)},Gt=function(e,n,o){if(ke[n]||Ct&&(n==="id"||n==="name")&&(o in i||o in bn))return!1;const f=S[n]||te.attributeCheck instanceof Function&&te.attributeCheck(n,e);if(!(Xe&&!ke[n]&&I(gn,n))){if(!(Rt&&I(hn,n))){if(!f||ke[n]){if(!(Wt(e)&&(A.tagNameCheck instanceof RegExp&&I(A.tagNameCheck,e)||A.tagNameCheck instanceof Function&&A.tagNameCheck(e))&&(A.attributeNameCheck instanceof RegExp&&I(A.attributeNameCheck,n)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(n,e))||n==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&I(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))))return!1}else if(!et[n]){if(!I(Ot,Te(o,Dt,""))){if(!((n==="src"||n==="xlink:href"||n==="href")&&e!=="script"&&tn(o,"data:")===0&&Mt[e])){if(!(wt&&!I(Tn,Te(o,Dt,"")))){if(o)return!1}}}}}}return!0},Nn=m({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Wt=function(e){return!Nn[Ie(e)]&&I(xn,e)},Yt=function(e){Z(R.beforeSanitizeAttributes,e,null);const n=e.attributes;if(!n||ze(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:S,forceKeepAttr:void 0};let f=n.length;for(;f--;){const u=n[f],h=u.name,O=u.namespaceURI,F=u.value,H=_(h),it=F;let w=h==="value"?it:ia(it);if(o.attrName=H,o.attrValue=w,o.keepAttr=!0,o.forceKeepAttr=void 0,Z(R.uponSanitizeAttribute,e,o),w=o.attrValue,Lt&&(H==="id"||H==="name")&&tn(w,jt)!==0&&(re(h,e),w=jt+w),Se&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,w)){re(h,e);continue}if(H==="attributename"&&en(w,"href")){re(h,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){re(h,e);continue}if(!It&&I(/\/>/i,w)){re(h,e);continue}ne&&oe([Le,je,Me],$t=>{w=Te(w,$t," ")});const qt=_(e.nodeName);if(!Gt(qt,H,w)){re(h,e);continue}if(D&&typeof G=="object"&&typeof G.getAttributeType=="function"&&!O)switch(G.getAttributeType(qt,H)){case"TrustedHTML":{w=ee(w);break}case"TrustedScriptURL":{w=D.createScriptURL(w);break}}if(w!==it)try{O?e.setAttributeNS(O,h,w):e.setAttribute(h,w),ze(e)?z(e):Qt(r.removed)}catch{re(h,e)}}Z(R.afterSanitizeAttributes,e,null)},Be=function(e){let n=null;const o=Ht(e);for(Z(R.beforeSanitizeShadowDOM,e,null);n=o.nextNode();)if(Z(R.uponSanitizeShadowNode,n,null),Bt(n),Yt(n),pe(n.content)&&Be(n.content),(L?L(n):n.nodeType)===q.element){const u=J?J(n):n.shadowRoot;pe(u)&&(ge(u),Be(u))}Z(R.afterSanitizeShadowDOM,e,null)},ge=function(e){const n=L?L(e):e.nodeType;if(n===q.element){const u=J?J(e):e.shadowRoot;pe(u)&&(ge(u),Be(u))}const o=K?K(e):e.childNodes;if(!o)return;const f=[];oe(o,u=>{he(f,u)});for(const u of f)ge(u);if(n===q.element){const u=x?x(e):null;if(typeof u=="string"&&_(u)==="template"){const h=e.content;pe(h)&&ge(h)}}};return r.sanitize=function(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=null,o=null,f=null,u=null;if(tt=!s,tt&&(s=""),typeof s!="string"&&!He(s)&&(s=da(s),typeof s!="string"))throw xe("dirty is not a string, aborting");if(!r.isSupported)return s;if(Ke||ot(e),r.removed=[],typeof s=="string"&&(Ne=!1),Ne){const F=x?x(s):s.nodeName;if(typeof F=="string"){const H=_(F);if(!E[H]||be[H])throw xe("root node is forbidden and cannot be sanitized in-place")}if(ze(s))throw xe("root node is clobbered and cannot be sanitized in-place");ge(s)}else if(He(s))n=zt(""),o=n.ownerDocument.importNode(s,!0),o.nodeType===q.element&&o.nodeName==="BODY"||o.nodeName==="HTML"?n=o:n.appendChild(o),ge(o);else{if(!me&&!ne&&!ae&&s.indexOf("<")===-1)return D&&Pe?ee(s):s;if(n=zt(s),!n)return me?null:Pe?Q:""}n&&Ze&&z(n.firstChild);const h=Ht(Ne?s:n);for(;f=h.nextNode();)Bt(f),Yt(f),pe(f.content)&&Be(f.content);if(Ne)return ne&&st(s),s;if(me){if(ne&&st(n),ve)for(u=qe.call(n.ownerDocument);n.firstChild;)u.appendChild(n.firstChild);else u=n;return(S.shadowroot||S.shadowrootmode)&&(u=P.call(l,u,!0)),u}let O=ae?n.outerHTML:n.innerHTML;return ae&&E["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&I(ba,n.ownerDocument.doctype.name)&&(O=" `+O),ne&&oe([Le,je,Me],F=>{O=Te(O,F," ")}),D&&Pe?ee(O):O},r.setConfig=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ot(s),Ke=!0},r.clearConfig=function(){fe=null,Ke=!1},r.isValidAttribute=function(s,e,n){fe||ot({});const o=_(s),f=_(e);return Gt(o,f,n)},r.addHook=function(s,e){typeof e=="function"&&he(R[s],e)},r.removeHook=function(s,e){if(e!==void 0){const n=oa(R[s],e);return n===-1?void 0:sa(R[s],n,1)[0]}return Qt(R[s])},r.removeHooks=function(s){R[s]=[]},r.removeAllHooks=function(){R=mn()},r}var Oa=pn();function Ra(a){return a?Oa.sanitize(a,{USE_PROFILES:{html:!0},FORBID_TAGS:["script","style","iframe","object","embed","form"],FORBID_ATTR:["onerror","onload","onclick","onmouseover"]}):""}const wa="",un=({template:a,isSubmitting:r,onCancel:i,onSubmitCreate:l})=>{var X,G,k,ie;const{register:c,handleSubmit:g,reset:b,control:B,formState:{errors:T}}=Ln({defaultValues:{name:{en:((X=a==null?void 0:a.name)==null?void 0:X.en)??"",am:((G=a==null?void 0:a.name)==null?void 0:G.am)??""},key:(a==null?void 0:a.key)??"",subject:(a==null?void 0:a.subject)??"",body:(a==null?void 0:a.body)??"",sincerelyText:(a==null?void 0:a.sincerelyText)??"",locale:(a==null?void 0:a.locale)??"en"}}),V=v=>{l(v),a||b()};return t.jsxs("form",{onSubmit:g(V),className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-8 shadow-sm dark:shadow-gray-900/50 space-y-8",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Template Key"}),t.jsx(Oe,{placeholder:"Template Key",...c("key",{required:"Template key is required"})}),T.key&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:T.key.message})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Subject"}),t.jsx(Oe,{placeholder:"Subject",...c("subject",{required:"Subject is required"})}),T.subject&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:T.subject.message})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"English Name"}),t.jsx(Oe,{placeholder:"English Name",...c("name.en",{required:"English name is required"})}),((k=T.name)==null?void 0:k.en)&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:T.name.en.message})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Amharic Name"}),t.jsx(Oe,{placeholder:"Amharic Name",...c("name.am",{required:"Amharic name is required"})}),((ie=T.name)==null?void 0:ie.am)&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:T.name.am.message})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Language"}),t.jsx(Xt,{name:"locale",control:B,rules:{required:"Language is required"},render:({field:v})=>t.jsxs(kn,{value:v.value,onValueChange:v.onChange,children:[t.jsx(vn,{children:t.jsx(Pn,{placeholder:"Select Language"})}),t.jsxs(Fn,{children:[t.jsx(Kt,{value:"en",children:"English"}),t.jsx(Kt,{value:"am",children:"Amharic"})]})]})}),T.locale&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:T.locale.message})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Body"}),t.jsx(Xt,{name:"body",control:B,rules:{required:!0},render:({field:v,fieldState:Ee})=>t.jsxs(t.Fragment,{children:[t.jsx(jn,{value:v.value,onEditorChange:v.onChange,apiKey:wa,placeholders:[{key:"delegatorName",label:"Delegator Name"},{key:"delegatorDepartment",label:"Delegator Department"},{key:"delegateeName",label:"Delegatee Name"},{key:"delegateeDepartment",label:"Delegatee Department"},{key:"startDate",label:"Start Date"},{key:"endDate",label:"End Date"},{key:"startDateTime",label:"Start Date & Time"},{key:"endDateTime",label:"End Date & Time"}]}),Ee.invalid&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:"Body is required"})]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sincerely Text"}),t.jsx(Oe,{placeholder:"Sincerely Text",...c("sincerelyText")})]}),t.jsxs("div",{className:"flex gap-2 pt-4 justify-end",children:[t.jsx(se,{type:"submit",disabled:r,children:r?"Saving...":a?"Update":"Save"}),t.jsx(se,{type:"button",variant:"outline",onClick:i,children:"Cancel"})]})]})},Ia=()=>{const{handleError:a}=Dn(d),{templates:r,isLoading:i,isError:l,refetch:c,createTemplate:g,updateTemplate:b,deleteTemplate:B,isCreatingTemplate:T,isUpdatingTemplate:V,isDeletingTemplate:X}=Mn(),G=Array.isArray(r)?r:(r==null?void 0:r.items)||[],k=On(),[ie,v]=Re.useState(!1),[Ee,K]=Re.useState(!1),[le,J]=Re.useState(!1),[Ye,L]=Re.useState(!1),[x,D]=Re.useState(null),Q=p=>{const P=p.target;P!=null&&P.closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root")&&p.preventDefault()},Ae=p=>{g(p,{onSuccess:P=>{dt.success(d("contentManagement.templateSuccessMsg")),c(),v(!1)},onError:P=>{a(P)}})},ee=p=>{x!=null&&x.id&&b({id:x.id,template:p},{onSuccess:()=>{dt.success(d("contentManagement.updateTemplate")),c(),K(!1),D(null)},onError:P=>{a(P)}})},ce=()=>{x!=null&&x.id&&B(x.id,{onSuccess:()=>{dt.success(d("contentManagement.deleteTemplate")),c(),L(!1),D(null)},onError:p=>{a(p)}})},_e=p=>{D(p),K(!0)},Ce=p=>{D(p),J(!0)},qe=p=>{D(p),L(!0)};return i?t.jsxs(ft,{children:[t.jsx(pt,{children:t.jsxs(gt,{className:"flex items-center",children:[t.jsx(Ge,{className:"h-5 w-5 mr-2"}),d("contentManagement.letterTemplate")]})}),t.jsx(ht,{children:t.jsx("div",{className:"space-y-3",children:Array(3).fill(0).map((p,P)=>t.jsx(Un,{className:"h-12 w-full"},P))})})]}):l?t.jsxs(ft,{children:[t.jsx(pt,{children:t.jsxs(gt,{className:"flex items-center",children:[t.jsx(Ge,{className:"h-5 w-5 mr-2"}),d("contentManagement.letterTemplate")]})}),t.jsx(ht,{children:t.jsx("p",{className:"text-sm text-red-600",children:d("contentManagement.failedToLoadTemplates")})})]}):t.jsxs(t.Fragment,{children:[t.jsxs(ft,{children:[t.jsx(pt,{children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[t.jsxs("div",{children:[t.jsxs(gt,{className:"flex items-center",children:[t.jsx(Ge,{className:"h-5 w-5 mr-2"}),d("contentManagement.letterTemplate")]}),t.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:d("contentManagement.createMsg")})]}),t.jsxs(se,{onClick:()=>v(!0),size:"sm",className:"shrink-0",children:[t.jsx(Vn,{className:"h-4 w-4 mr-1"}),d("contentManagement.addTemplate")]})]})}),t.jsx(ht,{children:G.length===0?t.jsxs("div",{className:"text-center py-8",children:[t.jsx(Ge,{className:"h-12 w-12 text-gray-400 dark:text-gray-500 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:d("contentManagement.noTemplates")})]}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs(wn,{children:[t.jsx(In,{children:t.jsxs(Vt,{children:[t.jsx(Tt,{className:"min-w-[150px]",children:d("common.name")}),t.jsx(Tt,{className:"min-w-[200px] hidden md:table-cell",children:d("contentManagement.sincerelyText")}),t.jsx(Tt,{className:"text-right min-w-[120px]",children:d("common.actions")})]})}),t.jsx(Cn,{children:G.map(p=>t.jsxs(Vt,{children:[t.jsx(xt,{className:"font-medium",children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:k(p.name)}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 md:hidden",children:p.sincerelyText&&p.sincerelyText.length>30?`${p.sincerelyText.substring(0,30)}...`:p.sincerelyText||d("common.notAvailable")})]})}),t.jsx(xt,{className:"max-w-xs truncate hidden md:table-cell",children:p.sincerelyText||d("common.notAvailable")}),t.jsx(xt,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(se,{variant:"ghost",size:"sm",onClick:()=>Ce(p),title:d("contentManagement.viewTemplate"),children:t.jsx(Xn,{className:"h-4 w-4"})}),t.jsx(se,{variant:"ghost",size:"sm",onClick:()=>_e(p),title:d("contentManagement.editTemplate"),children:t.jsx(Kn,{className:"h-4 w-4"})}),t.jsx(se,{variant:"ghost",size:"sm",onClick:()=>qe(p),className:"text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300",title:d("contentManagement.deleteTemplate"),children:t.jsx(Rn,{className:"h-4 w-4"})})]})})]},p.id))})]})})})]}),t.jsx(lt,{open:ie,onOpenChange:v,children:t.jsxs(ct,{className:"max-w-[95vw] lg:max-w-[1200px] max-h-[90vh] overflow-y-auto w-full",onInteractOutside:Q,children:[t.jsx(mt,{children:t.jsx(ut,{children:d("contentManagement.createTemplate")})}),t.jsx(un,{isSubmitting:T,onCancel:()=>v(!1),onSubmitCreate:Ae})]})}),t.jsx(lt,{open:Ee,onOpenChange:K,children:t.jsxs(ct,{className:"max-w-[95vw] lg:max-w-[1200px] max-h-[90vh] overflow-y-auto w-full",onInteractOutside:Q,children:[t.jsx(mt,{children:t.jsx(ut,{children:d("contentManagement.editTemplate")})}),t.jsx(un,{template:x,isSubmitting:V,onCancel:()=>{K(!1),D(null)},onSubmitCreate:ee})]})}),t.jsx(lt,{open:le,onOpenChange:J,children:t.jsxs(ct,{className:"max-w-[95vw] lg:max-w-[1200px] max-h-[90vh] overflow-y-auto w-full",children:[t.jsx(mt,{children:t.jsx(ut,{children:d("contentManagement.viewTemplate")})}),x&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:d("common.name")}),t.jsx("p",{className:"text-sm text-gray-900 dark:text-gray-100 mt-1",children:k(x.name)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:d("contentManagement.sincerelyText")}),t.jsx("p",{className:"text-sm text-gray-900 dark:text-gray-100 mt-1",children:x.sincerelyText||d("common.notAvailable")})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:d("contentManagement.body")}),t.jsx("div",{className:"text-sm text-gray-900 dark:text-gray-100 mt-1 p-3 border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-700 max-h-60 overflow-y-auto",dangerouslySetInnerHTML:{__html:Ra(x.body)}})]}),t.jsx("div",{className:"flex justify-end",children:t.jsx(se,{onClick:()=>J(!1),children:d("common.close")})})]})]})}),t.jsx(zn,{open:Ye,onOpenChange:L,children:t.jsxs(Hn,{children:[t.jsxs(Bn,{children:[t.jsx(Gn,{children:d("contentManagement.deleteTemplate")}),t.jsx(Wn,{children:d("contentManagement.deleteTemplateConfirm",{name:x?k(x.name):""})})]}),t.jsxs(Yn,{children:[t.jsx(qn,{children:d("common.cancel")}),t.jsx($n,{onClick:ce,disabled:X,className:"bg-red-600 hover:bg-red-700",children:X?d("common.deleting"):d("common.delete")})]})]})})]})},Wa=()=>t.jsxs("div",{className:"p-6",children:[t.jsxs("div",{className:"mb-6",children:[t.jsx("h1",{className:"text-2xl font-bold bg-gradient-to-r from-primary to-primary-400 bg-clip-text text-transparent",children:"Manage Delegation Templates"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mt-1",children:"Create, edit, and view delegation global templates."})]}),t.jsx("div",{className:"space-y-6",children:t.jsx(Ia,{})})]});export{Wa as default};