n8n-nodes-adeu 1.18.0 → 1.18.1
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.
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
'use strict';var n8nWorkflow=require('n8n-workflow');var _o=Object.create;var Jr=Object.defineProperty;var wo=Object.getOwnPropertyDescriptor;var vo=Object.getOwnPropertyNames;var yo=Object.getPrototypeOf,Eo=Object.prototype.hasOwnProperty;var h=(e,t)=>Jr(e,"name",{value:t,configurable:true});var Oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var bo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of vo(t))!Eo.call(e,a)&&a!==r&&Jr(e,a,{get:()=>t[a],enumerable:!(n=wo(t,a))||n.enumerable});return e};var Zr=(e,t,r)=>(r=e!=null?_o(yo(e)):{},bo(Jr(r,"default",{value:e,enumerable:true}),e));var Yn=Oe((Nc,Gn)=>{Gn.exports={createRequire:h(function(){return function(){return {}}},"createRequire")};});var ot=Oe(ce=>{function Yo(e,t,r){if(r===void 0&&(r=Array.prototype),e&&typeof r.find=="function")return r.find.call(e,t);for(var n=0;n<e.length;n++)if(at(e,n)){var a=e[n];if(t.call(void 0,a,n,e))return a}}h(Yo,"find");function _t(e,t){return t===void 0&&(t=Object),t&&typeof t.getOwnPropertyDescriptors=="function"&&(e=t.create(null,t.getOwnPropertyDescriptors(e))),t&&typeof t.freeze=="function"?t.freeze(e):e}h(_t,"freeze");function at(e,t){return Object.prototype.hasOwnProperty.call(e,t)}h(at,"hasOwn");function Xo(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var r in t)at(t,r)&&(e[r]=t[r]);return e}h(Xo,"assign");var ci=_t({allowfullscreen:true,async:true,autofocus:true,autoplay:true,checked:true,controls:true,default:true,defer:true,disabled:true,formnovalidate:true,hidden:true,ismap:true,itemscope:true,loop:true,multiple:true,muted:true,nomodule:true,novalidate:true,open:true,playsinline:true,readonly:true,required:true,reversed:true,selected:true});function Qo(e){return at(ci,e.toLowerCase())}h(Qo,"isHTMLBooleanAttribute");var fi=_t({area:true,base:true,br:true,col:true,embed:true,hr:true,img:true,input:true,link:true,meta:true,param:true,source:true,track:true,wbr:true});function Jo(e){return at(fi,e.toLowerCase())}h(Jo,"isHTMLVoidElement");var Vt=_t({script:false,style:false,textarea:true,title:true});function Zo(e){var t=e.toLowerCase();return at(Vt,t)&&!Vt[t]}h(Zo,"isHTMLRawTextElement");function Ko(e){var t=e.toLowerCase();return at(Vt,t)&&Vt[t]}h(Ko,"isHTMLEscapableRawTextElement");function hi(e){return e===Gt.HTML}h(hi,"isHTMLMimeType");function es(e){return hi(e)||e===Gt.XML_XHTML_APPLICATION}h(es,"hasDefaultHTMLNamespace");var Gt=_t({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),ts=Object.keys(Gt).map(function(e){return Gt[e]});function rs(e){return ts.indexOf(e)>-1}h(rs,"isValidMimeType");var ns=_t({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});ce.assign=Xo;ce.find=Yo;ce.freeze=_t;ce.HTML_BOOLEAN_ATTRIBUTES=ci;ce.HTML_RAW_TEXT_ELEMENTS=Vt;ce.HTML_VOID_ELEMENTS=fi;ce.hasDefaultHTMLNamespace=es;ce.hasOwn=at;ce.isHTMLBooleanAttribute=Qo;ce.isHTMLRawTextElement=Zo;ce.isHTMLEscapableRawTextElement=Ko;ce.isHTMLMimeType=hi;ce.isHTMLVoidElement=Jo;ce.isValidMimeType=rs;ce.MIME_TYPE=Gt;ce.NAMESPACE=ns;});var Zt=Oe(Jt=>{var is=ot();function pi(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:true,writable:t}});}h(pi,"extendError");var Xt=is.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),mi=Object.keys(Xt);function gi(e){return typeof e=="number"&&e>=1&&e<=25}h(gi,"isValidDomExceptionCode");function as(e){return typeof e=="string"&&e.substring(e.length-Xt.Error.length)===Xt.Error}h(as,"endsWithError");function Qt(e,t){gi(e)?(this.name=mi[e],this.message=t||""):(this.message=e,this.name=as(t)?t:Xt.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Qt);}h(Qt,"DOMException");pi(Qt,true);Object.defineProperties(Qt.prototype,{code:{enumerable:true,get:h(function(){var e=mi.indexOf(this.name);return gi(e)?e:0},"get")}});var _i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},dn=Object.entries(_i);for(Yt=0;Yt<dn.length;Yt++)di=dn[Yt][0],Qt[di]=dn[Yt][1];var di,Yt;function pn(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,pn);}h(pn,"ParseError");pi(pn);Jt.DOMException=Qt;Jt.DOMExceptionName=Xt;Jt.ExceptionCode=_i;Jt.ParseError=pn;});var En=Oe(q=>{function Ai(e){try{typeof e!="function"&&(e=RegExp);var t=new e("\u{1D306}","u").exec("\u{1D306}");return !!t&&t[0].length===2}catch{}return false}h(Ai,"detectUnicodeSupport");var yt=Ai();function Ge(e){if(e.source[0]!=="[")throw new Error(e+" can not be used with chars");return e.source.slice(1,e.source.lastIndexOf("]"))}h(Ge,"chars");function wt(e,t){if(e.source[0]!=="[")throw new Error("/"+e.source+"/ can not be used with chars_without");if(!t||typeof t!="string")throw new Error(JSON.stringify(t)+" is not a valid search");if(e.source.indexOf(t)===-1)throw new Error('"'+t+'" is not is /'+e.source+"/");if(t==="-"&&e.source.indexOf(t)!==1)throw new Error('"'+t+'" is not at the first postion of /'+e.source+"/");return new RegExp(e.source.replace(t,""),yt?"u":"")}h(wt,"chars_without");function H(e){var t=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(r){var n=typeof r=="string";if(n&&t===void 0&&r==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return n?r:r.source}).join(""),yt?"mu":"m")}h(H,"reg");function $(e){if(arguments.length===0)throw new Error("no parameters provided");return H.apply($,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}h($,"regg");var os="\uFFFD",Ye=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;yt&&(Ye=H("[",Ge(Ye),"\\u{10000}-\\u{10FFFF}","]"));var ss=new RegExp("[^"+Ge(Ye)+"]",yt?"u":""),gn=/[\x20\x09\x0D\x0A]/,us=Ge(gn),J=H(gn,"+"),te=H(gn,"*"),Kt=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;yt&&(Kt=H("[",Ge(Kt),"\\u{10000}-\\u{10FFFF}","]"));var ls=Ge(Kt),_n=H("[",ls,Ge(/[-.0-9\xB7]/),Ge(/[\u0300-\u036F\u203F-\u2040]/),"]"),Ae=H(Kt,_n,"*"),wi=H(_n,"+"),cs=H("&",Ae,";"),fs=$(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),er=$(cs,"|",fs),tr=H("%",Ae,";"),wn=$(H('"',$(/[^%&"]/,"|",tr,"|",er),"*",'"'),"|",H("'",$(/[^%&']/,"|",tr,"|",er),"*","'")),hs=$('"',$(/[^<&"]/,"|",er),"*",'"',"|","'",$(/[^<&']/,"|",er),"*","'"),ds=wt(Kt,":"),ps=wt(_n,":"),vi=H(ds,ps,"*"),rr=H(vi,$(":",vi),"?"),ms=H("^",rr,"$"),gs=H("(",rr,")"),vt=$(/"[^"]*"|'[^']*'/),_s=H(/^<\?/,"(",Ae,")",$(J,"(",Ye,"*?)"),"?",/\?>/),yi=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,nr=$('"',yi,'*"',"|","'",wt(yi,"'"),"*'"),Ni="<!--",Ci="-->",ws=H(Ni,$(wt(Ye,"-"),"|",H("-",wt(Ye,"-"))),"*",Ci),Ei="#PCDATA",vs=$(H(/\(/,te,Ei,$(te,/\|/,te,rr),"*",te,/\)\*/),"|",H(/\(/,te,Ei,te,/\)/)),ys=/[?*+]?/,Es=H(/\([^>]+\)/,ys),bs=$("EMPTY","|","ANY","|",vs,"|",Es),Ds="<!ELEMENT",As=H(Ds,J,$(rr,"|",tr),J,$(bs,"|",tr),te,">"),Ns=H("NOTATION",J,/\(/,te,Ae,$(te,/\|/,te,Ae),"*",te,/\)/),Cs=H(/\(/,te,wi,$(te,/\|/,te,wi),"*",te,/\)/),xs=$(Ns,"|",Cs),Ts=$(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",xs),Ss=$(/#REQUIRED|#IMPLIED/,"|",$($("#FIXED",J),"?",hs)),Is=$(J,Ae,J,Ts,J,Ss),ks="<!ATTLIST",Os=H(ks,J,Ae,Is,"*",te,">"),mn="about:legacy-compat",Ps=$('"'+mn+'"',"|","'"+mn+"'"),vn="SYSTEM",br="PUBLIC",Dr=$($(vn,J,vt),"|",$(br,J,nr,J,vt)),Ms=H("^",$($(vn,J,"(?<SystemLiteralOnly>",vt,")"),"|",$(br,J,"(?<PubidLiteral>",nr,")",J,"(?<SystemLiteral>",vt,")"))),Rs=H("^",nr,"$"),Bs=H("^",vt,"$"),Fs=$(J,"NDATA",J,Ae),Ls=$(wn,"|",$(Dr,Fs,"?")),xi="<!ENTITY",$s=H(xi,J,Ae,J,Ls,te,">"),Us=$(wn,"|",Dr),qs=H(xi,J,"%",J,Ae,J,Us,te,">"),zs=$($s,"|",qs),js=H(br,J,nr),Ws=H("<!NOTATION",J,Ae,J,$(Dr,"|",js),te,">"),yn=H(te,"=",te),bi=/1[.]\d+/,Hs=H(J,"version",yn,$("'",bi,"'","|",'"',bi,'"')),Di=/[A-Za-z][-A-Za-z0-9._]*/,Vs=$(J,"encoding",yn,$('"',Di,'"',"|","'",Di,"'")),Gs=$(J,"standalone",yn,$("'",$("yes","|","no"),"'","|",'"',$("yes","|","no"),'"')),Ys=H(/^<\?xml/,Hs,Vs,"?",Gs,"?",te,/\?>/),Xs="<!DOCTYPE",Qs="<![CDATA[",Js="]]>",Zs=/<!\[CDATA\[/,Ks=/\]\]>/,eu=H(Ye,"*?",Ks),tu=H(Zs,eu);q.chars=Ge;q.chars_without=wt;q.detectUnicodeSupport=Ai;q.reg=H;q.regg=$;q.ABOUT_LEGACY_COMPAT=mn;q.ABOUT_LEGACY_COMPAT_SystemLiteral=Ps;q.AttlistDecl=Os;q.CDATA_START=Qs;q.CDATA_END=Js;q.CDSect=tu;q.Char=Ye;q.Comment=ws;q.COMMENT_START=Ni;q.COMMENT_END=Ci;q.DOCTYPE_DECL_START=Xs;q.elementdecl=As;q.EntityDecl=zs;q.EntityValue=wn;q.ExternalID=Dr;q.ExternalID_match=Ms;q.Name=Ae;q.NotationDecl=Ws;q.Reference=er;q.PEReference=tr;q.PI=_s;q.PUBLIC=br;q.PubidLiteral=nr;q.PubidLiteral_match=Rs;q.QName=rr;q.QName_exact=ms;q.QName_group=gs;q.S=J;q.SChar_s=us;q.S_OPT=te;q.SYSTEM=vn;q.SystemLiteral=vt;q.SystemLiteral_match=Bs;q.InvalidChar=ss;q.UNICODE_REPLACEMENT_CHARACTER=os;q.UNICODE_SUPPORT=yt;q.XMLDecl=Ys;});var Sn=Oe(ae=>{var xe=ot(),Be=xe.find,ru=xe.hasDefaultHTMLNamespace,bt=xe.hasOwn,nu=xe.isHTMLMimeType,iu=xe.isHTMLRawTextElement,au=xe.isHTMLVoidElement,ir=xe.MIME_TYPE,Fe=xe.NAMESPACE,pe=Symbol(),Mi=Zt(),O=Mi.DOMException,Ne=Mi.DOMExceptionName,fe=En();function _e(e){if(e!==pe)throw new TypeError("Illegal constructor")}h(_e,"checkSymbol");function ou(e){return e!==""}h(ou,"notEmptyString");function su(e){return e?e.split(/[\t\n\f\r ]+/).filter(ou):[]}h(su,"splitOnASCIIWhitespace");function uu(e,t){return bt(e,t)||(e[t]=true),e}h(uu,"orderedSetReducer");function Ti(e){if(!e)return [];var t=su(e);return Object.keys(t.reduce(uu,{}))}h(Ti,"toOrderedSet");function lu(e){return function(t){return e&&e.indexOf(t)!==-1}}h(lu,"arrayIncludes");function Ri(e){if(!fe.QName_exact.test(e))throw new O(O.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}h(Ri,"validateQualifiedName");function Dn(e,t){Ri(t),e=e||null;var r=null,n=t;if(t.indexOf(":")>=0){var a=t.split(":");r=a[0],n=a[1];}if(r!==null&&e===null)throw new O(O.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(r==="xml"&&e!==xe.NAMESPACE.XML)throw new O(O.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((r==="xmlns"||t==="xmlns")&&e!==xe.NAMESPACE.XMLNS)throw new O(O.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(e===xe.NAMESPACE.XMLNS&&r!=="xmlns"&&t!=="xmlns")throw new O(O.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return [e,r,n]}h(Dn,"validateAndExtract");function Nt(e,t){for(var r in e)bt(e,r)&&(t[r]=e[r]);}h(Nt,"copy");function we(e,t){var r=e.prototype;if(!(r instanceof t)){let n=function(){};h(n,"t"),n.prototype=t.prototype,n=new n,Nt(r,n),e.prototype=r=n;}r.constructor!=e&&(r.constructor=e);}h(we,"_extends");var ve={},Ce=ve.ELEMENT_NODE=1,Dt=ve.ATTRIBUTE_NODE=2,Cr=ve.TEXT_NODE=3,Bi=ve.CDATA_SECTION_NODE=4,Fi=ve.ENTITY_REFERENCE_NODE=5,cu=ve.ENTITY_NODE=6,An=ve.PROCESSING_INSTRUCTION_NODE=7,Nn=ve.COMMENT_NODE=8,Et=ve.DOCUMENT_NODE=9,Li=ve.DOCUMENT_TYPE_NODE=10,Xe=ve.DOCUMENT_FRAGMENT_NODE=11,fu=ve.NOTATION_NODE=12,ie=xe.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function $i(e,t){if(t.length<e.length)return $i(t,e);var r=null;for(var n in e){if(e[n]!==t[n])return r;r=e[n];}return r}h($i,"commonAncestor");function Si(e){return e.guid||(e.guid=Math.random()),e.guid}h(Si,"docGUID");function se(){}h(se,"NodeList");se.prototype={length:0,item:h(function(e){return e>=0&&e<this.length?this[e]:null},"item"),toString:h(function(e){var t;typeof e=="function"?t={requireWellFormed:false,splitCDATASections:true,nodeFilter:e}:e?t={requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==false,nodeFilter:e.nodeFilter||null}:t={requireWellFormed:false,splitCDATASections:true,nodeFilter:null};for(var r=[],n=0;n<this.length;n++)Tn(this[n],r,null,t);return r.join("")},"toString"),filter:h(function(e){return Array.prototype.filter.call(this,e)},"filter"),indexOf:h(function(e){return Array.prototype.indexOf.call(this,e)},"indexOf")};se.prototype[Symbol.iterator]=function(){var e=this,t=0;return {next:h(function(){return t<e.length?{value:e[t++],done:false}:{done:true}},"next"),return:h(function(){return {done:true}},"return")}};function Re(e,t){this._node=e,this._refresh=t,Tr(this);}h(Re,"LiveNodeList");function Tr(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(Ji(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)bt(e,n)&&delete e[n];Nt(r,e),e._inc=t;}}h(Tr,"_updateLiveList");Re.prototype.item=function(e){return Tr(this),this[e]||null};we(Re,se);function At(){}h(At,"NamedNodeMap");function Ui(e,t){for(var r=0;r<e.length;){if(e[r]===t)return r;r++;}}h(Ui,"_findNodeIndex");function hu(e,t,r,n){if(n?t[Ui(t,n)]=r:(t[t.length]=r,t.length++),e){r.ownerElement=e;var a=e.ownerDocument;a&&(n&&ji(a,e,n),du(a,e,r));}}h(hu,"_addNamedNode");function Ii(e,t,r){var n=Ui(t,r);if(n>=0){for(var a=t.length-1;n<=a;)t[n]=t[++n];if(t.length=a,e){var i=e.ownerDocument;i&&ji(i,e,r),r.ownerElement=null;}}}h(Ii,"_removeNamedNode");At.prototype={length:0,item:se.prototype.item,getNamedItem:h(function(e){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());for(var t=0;t<this.length;){var r=this[t];if(r.nodeName===e)return r;t++;}return null},"getNamedItem"),setNamedItem:h(function(e){var t=e.ownerElement;if(t&&t!==this._ownerElement)throw new O(O.INUSE_ATTRIBUTE_ERR);var r=this.getNamedItemNS(e.namespaceURI,e.localName);return r===e?e:(hu(this._ownerElement,this,e,r),r)},"setNamedItem"),setNamedItemNS:h(function(e){return this.setNamedItem(e)},"setNamedItemNS"),removeNamedItem:h(function(e){var t=this.getNamedItem(e);if(!t)throw new O(O.NOT_FOUND_ERR,e);return Ii(this._ownerElement,this,t),t},"removeNamedItem"),removeNamedItemNS:h(function(e,t){var r=this.getNamedItemNS(e,t);if(!r)throw new O(O.NOT_FOUND_ERR,e?e+" : "+t:t);return Ii(this._ownerElement,this,r),r},"removeNamedItemNS"),getNamedItemNS:h(function(e,t){e||(e=null);for(var r=0;r<this.length;){var n=this[r];if(n.localName===t&&n.namespaceURI===e)return n;r++;}return null},"getNamedItemNS")};At.prototype[Symbol.iterator]=function(){var e=this,t=0;return {next:h(function(){return t<e.length?{value:e[t++],done:false}:{done:true}},"next"),return:h(function(){return {done:true}},"return")}};function qi(){}h(qi,"DOMImplementation");qi.prototype={hasFeature:h(function(e,t){return true},"hasFeature"),createDocument:h(function(e,t,r){var n=ir.XML_APPLICATION;e===Fe.HTML?n=ir.XML_XHTML_APPLICATION:e===Fe.SVG&&(n=ir.XML_SVG_IMAGE);var a=new je(pe,{contentType:n});if(a.implementation=this,a.childNodes=new se,a.doctype=r||null,r&&a.appendChild(r),t){var i=a.createElementNS(e,t);a.appendChild(i);}return a},"createDocument"),createDocumentType:h(function(e,t,r,n){Ri(e);var a=new kr(pe);return a.name=e,a.nodeName=e,a.publicId=t||"",a.systemId=r||"",a.internalSubset=n||"",a.childNodes=new se,a},"createDocumentType"),createHTMLDocument:h(function(e){var t=new je(pe,{contentType:ir.HTML});if(t.implementation=this,t.childNodes=new se,e!==false){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var r=t.createElement("html");t.appendChild(r);var n=t.createElement("head");if(r.appendChild(n),typeof e=="string"){var a=t.createElement("title");a.appendChild(t.createTextNode(e)),n.appendChild(a);}r.appendChild(t.createElement("body"));}return t},"createHTMLDocument")};function G(e){_e(e);}h(G,"Node");G.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var e=this.getRootNode();return e&&e.nodeType===e.DOCUMENT_NODE},contains:h(function(e){if(!e)return false;var t=e;do{if(this===t)return true;t=t.parentNode;}while(t);return false},"contains"),getRootNode:h(function(e){var t=this;do{if(!t.parentNode)return t;t=t.parentNode;}while(t)},"getRootNode"),isEqualNode:h(function(e){if(!e)return false;for(var t=[{node:this,other:e}];t.length>0;){var r=t.pop(),n=r.node,a=r.other;if(n.nodeType!==a.nodeType)return false;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==a.name||n.publicId!==a.publicId||n.systemId!==a.systemId)return false;break;case n.ELEMENT_NODE:if(n.namespaceURI!==a.namespaceURI||n.prefix!==a.prefix||n.localName!==a.localName||n.attributes.length!==a.attributes.length)return false;for(var i=0;i<n.attributes.length;i++){var o=n.attributes.item(i),s=a.getAttributeNodeNS(o.namespaceURI,o.localName);if(!s)return false;t.push({node:o,other:s});}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==a.namespaceURI||n.localName!==a.localName||n.value!==a.value)return false;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==a.target||n.data!==a.data)return false;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==a.data)return false;break}if(n.childNodes.length!==a.childNodes.length)return false;for(var i=n.childNodes.length-1;i>=0;i--)t.push({node:n.childNodes[i],other:a.childNodes[i]});}return true},"isEqualNode"),isSameNode:h(function(e){return this===e},"isSameNode"),insertBefore:h(function(e,t){return xr(this,e,t)},"insertBefore"),replaceChild:h(function(e,t){xr(this,e,t,Gi),t&&this.removeChild(t);},"replaceChild"),removeChild:h(function(e){return Hi(this,e)},"removeChild"),appendChild:h(function(e){return this.insertBefore(e,null)},"appendChild"),hasChildNodes:h(function(){return this.firstChild!=null},"hasChildNodes"),cloneNode:h(function(e){return Qi(this.ownerDocument||this,this,e)},"cloneNode"),normalize:h(function(){he(this,null,{enter:h(function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===Cr&&t.nodeType===Cr?(e.removeChild(r),t.appendData(r.data)):t=r;}return true},"enter")});},"normalize"),isSupported:h(function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},"isSupported"),lookupPrefix:h(function(e){for(var t=this;t;){var r=t._nsMap;if(r){for(var n in r)if(bt(r,n)&&r[n]===e)return n}t=t.nodeType==Dt?t.ownerDocument:t.parentNode;}return null},"lookupPrefix"),lookupNamespaceURI:h(function(e){for(var t=this;t;){var r=t._nsMap;if(r&&bt(r,e))return r[e];t=t.nodeType==Dt?t.ownerDocument:t.parentNode;}return null},"lookupNamespaceURI"),isDefaultNamespace:h(function(e){var t=this.lookupPrefix(e);return t==null},"isDefaultNamespace"),compareDocumentPosition:h(function(e){if(this===e)return 0;var t=e,r=this,n=null,a=null;if(t instanceof st&&(n=t,t=n.ownerElement),r instanceof st&&(a=r,r=a.ownerElement,n&&t&&r===t))for(var i=0,o;o=r.attributes[i];i++){if(o===n)return ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ie.DOCUMENT_POSITION_PRECEDING;if(o===a)return ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ie.DOCUMENT_POSITION_FOLLOWING}if(!t||!r||r.ownerDocument!==t.ownerDocument)return ie.DOCUMENT_POSITION_DISCONNECTED+ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Si(r.ownerDocument)>Si(t.ownerDocument)?ie.DOCUMENT_POSITION_FOLLOWING:ie.DOCUMENT_POSITION_PRECEDING);if(a&&t===r)return ie.DOCUMENT_POSITION_CONTAINS+ie.DOCUMENT_POSITION_PRECEDING;if(n&&t===r)return ie.DOCUMENT_POSITION_CONTAINED_BY+ie.DOCUMENT_POSITION_FOLLOWING;for(var s=[],l=t.parentNode;l;){if(!a&&l===r)return ie.DOCUMENT_POSITION_CONTAINED_BY+ie.DOCUMENT_POSITION_FOLLOWING;s.push(l),l=l.parentNode;}s.reverse();for(var u=[],c=r.parentNode;c;){if(!n&&c===t)return ie.DOCUMENT_POSITION_CONTAINS+ie.DOCUMENT_POSITION_PRECEDING;u.push(c),c=c.parentNode;}u.reverse();var f=$i(s,u);for(var d in f.childNodes){var p=f.childNodes[d];if(p===r)return ie.DOCUMENT_POSITION_FOLLOWING;if(p===t)return ie.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(p)>=0)return ie.DOCUMENT_POSITION_FOLLOWING;if(s.indexOf(p)>=0)return ie.DOCUMENT_POSITION_PRECEDING}return 0},"compareDocumentPosition")};function zi(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}h(zi,"_xmlEncoder");Nt(ve,G);Nt(ve,G.prototype);Nt(ie,G);Nt(ie,G.prototype);function Nr(e,t){he(e,null,{enter:h(function(r){return t(r)?he.STOP:true},"enter")});}h(Nr,"_visitNode");function he(e,t,r){for(var n=[{node:e,context:t,phase:he.ENTER}];n.length>0;){var a=n.pop();if(a.phase===he.ENTER){var i=r.enter(a.node,a.context);if(i===he.STOP)return he.STOP;if(n.push({node:a.node,context:i,phase:he.EXIT}),i==null)continue;for(var o=a.node.lastChild;o;)n.push({node:o,context:i,phase:he.ENTER}),o=o.previousSibling;}else r.exit&&r.exit(a.node,a.context);}}h(he,"walkDOM");he.STOP=Symbol("walkDOM.STOP");he.ENTER=0;he.EXIT=1;function je(e,t){_e(e);var r=t||{};this.ownerDocument=this,this.contentType=r.contentType||ir.XML_APPLICATION,this.type=nu(this.contentType)?"html":"xml";}h(je,"Document");function du(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Fe.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value);}h(du,"_onAddAttribute");function ji(e,t,r,n){e&&e._inc++;var a=r.namespaceURI;a===Fe.XMLNS&&delete t._nsMap[r.prefix?r.localName:""];}h(ji,"_onRemoveAttribute");function Wi(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r&&!r.nextSibling)n[n.length++]=r;else {for(var a=t.firstChild,i=0;a;)n[i++]=a,a=a.nextSibling;n.length=i,delete n[n.length];}}}h(Wi,"_onUpdateChild");function Hi(e,t){if(e!==t.parentNode)throw new O(O.NOT_FOUND_ERR,"child's parent is not parent");var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,Wi(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}h(Hi,"_removeChild");function pu(e){return e&&(e.nodeType===G.DOCUMENT_NODE||e.nodeType===G.DOCUMENT_FRAGMENT_NODE||e.nodeType===G.ELEMENT_NODE)}h(pu,"hasValidParentNodeType");function mu(e){return e&&(e.nodeType===G.CDATA_SECTION_NODE||e.nodeType===G.COMMENT_NODE||e.nodeType===G.DOCUMENT_FRAGMENT_NODE||e.nodeType===G.DOCUMENT_TYPE_NODE||e.nodeType===G.ELEMENT_NODE||e.nodeType===G.PROCESSING_INSTRUCTION_NODE||e.nodeType===G.TEXT_NODE)}h(mu,"hasInsertableNodeType");function Qe(e){return e&&e.nodeType===G.DOCUMENT_TYPE_NODE}h(Qe,"isDocTypeNode");function ze(e){return e&&e.nodeType===G.ELEMENT_NODE}h(ze,"isElementNode");function Vi(e){return e&&e.nodeType===G.TEXT_NODE}h(Vi,"isTextNode");function ki(e,t){var r=e.childNodes||[];if(Be(r,ze)||Qe(t))return false;var n=Be(r,Qe);return !(t&&n&&r.indexOf(n)>r.indexOf(t))}h(ki,"isElementInsertionPossible");function Oi(e,t){var r=e.childNodes||[];function n(i){return ze(i)&&i!==t}if(h(n,"hasElementChildThatIsNotChild"),Be(r,n))return false;var a=Be(r,Qe);return !(t&&a&&r.indexOf(a)>r.indexOf(t))}h(Oi,"isElementReplacementPossible");function gu(e,t,r){if(!pu(e))throw new O(O.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new O(O.NOT_FOUND_ERR,"child not in parent");if(!mu(t)||Qe(t)&&e.nodeType!==G.DOCUMENT_NODE)throw new O(O.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}h(gu,"assertPreInsertionValidity1to5");function _u(e,t,r){var n=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===G.DOCUMENT_FRAGMENT_NODE){var i=a.filter(ze);if(i.length>1||Be(a,Vi))throw new O(O.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!ki(e,r))throw new O(O.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ze(t)&&!ki(e,r))throw new O(O.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Qe(t)){if(Be(n,Qe))throw new O(O.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Be(n,ze);if(r&&n.indexOf(o)<n.indexOf(r))throw new O(O.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!r&&o)throw new O(O.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}h(_u,"assertPreInsertionValidityInDocument");function Gi(e,t,r){var n=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===G.DOCUMENT_FRAGMENT_NODE){var i=a.filter(ze);if(i.length>1||Be(a,Vi))throw new O(O.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!Oi(e,r))throw new O(O.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ze(t)&&!Oi(e,r))throw new O(O.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Qe(t)){let s=function(l){return Qe(l)&&l!==r};if(h(s,"hasDoctypeChildThatIsNotChild"),Be(n,s))throw new O(O.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Be(n,ze);if(r&&n.indexOf(o)<n.indexOf(r))throw new O(O.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}h(Gi,"assertPreReplacementValidityInDocument");function xr(e,t,r,n){gu(e,t,r),e.nodeType===G.DOCUMENT_NODE&&(n||_u)(e,t,r);var a=t.parentNode;if(a&&a.removeChild(t),t.nodeType===Xe){var i=t.firstChild;if(i==null)return t;var o=t.lastChild;}else i=o=t;var s=r?r.previousSibling:e.lastChild;i.previousSibling=s,o.nextSibling=r,s?s.nextSibling=i:e.firstChild=i,r==null?e.lastChild=o:r.previousSibling=o;do i.parentNode=e;while(i!==o&&(i=i.nextSibling));return Wi(e.ownerDocument||e,e,t),t.nodeType==Xe&&(t.firstChild=t.lastChild=null),t}h(xr,"_insertBefore");je.prototype={implementation:null,nodeName:"#document",nodeType:Et,doctype:null,documentElement:null,_inc:1,insertBefore:h(function(e,t){if(e.nodeType===Xe){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n;}return e}return xr(this,e,t),e.ownerDocument=this,this.documentElement===null&&e.nodeType===Ce&&(this.documentElement=e),e},"insertBefore"),removeChild:h(function(e){var t=Hi(this,e);return t===this.documentElement&&(this.documentElement=null),t},"removeChild"),replaceChild:h(function(e,t){xr(this,e,t,Gi),e.ownerDocument=this,t&&this.removeChild(t),ze(e)&&(this.documentElement=e);},"replaceChild"),importNode:h(function(e,t){return wu(this,e,t)},"importNode"),getElementById:h(function(e){var t=null;return Nr(this.documentElement,function(r){if(r.nodeType==Ce&&r.getAttribute("id")==e)return t=r,true}),t},"getElementById"),createElement:h(function(e){var t=new We(pe);t.ownerDocument=this,this.type==="html"&&(e=e.toLowerCase()),ru(this.contentType)&&(t.namespaceURI=Fe.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new se;var r=t.attributes=new At;return r._ownerElement=t,t},"createElement"),createDocumentFragment:h(function(){var e=new xt(pe);return e.ownerDocument=this,e.childNodes=new se,e},"createDocumentFragment"),createTextNode:h(function(e){var t=new ar(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createTextNode"),createComment:h(function(e){var t=new Sr(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createComment"),createCDATASection:h(function(e){if(e.indexOf("]]>")!==-1)throw new O(O.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new Ir(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createCDATASection"),createProcessingInstruction:h(function(e,t){var r=new Pr(pe);return r.ownerDocument=this,r.childNodes=new se,r.nodeName=r.target=e,r.nodeValue=r.data=t,r},"createProcessingInstruction"),createAttribute:h(function(e){if(!fe.QName_exact.test(e))throw new O(O.INVALID_CHARACTER_ERR,'invalid character in name "'+e+'"');return this.type==="html"&&(e=e.toLowerCase()),this._createAttribute(e)},"createAttribute"),_createAttribute:h(function(e){var t=new st(pe);return t.ownerDocument=this,t.childNodes=new se,t.name=e,t.nodeName=e,t.localName=e,t.specified=true,t},"_createAttribute"),createEntityReference:h(function(e){if(!fe.Name.test(e))throw new O(O.INVALID_CHARACTER_ERR,'not a valid xml name "'+e+'"');if(this.type==="html")throw new O("document is an html document",Ne.NotSupportedError);var t=new Or(pe);return t.ownerDocument=this,t.childNodes=new se,t.nodeName=e,t},"createEntityReference"),createElementNS:h(function(e,t){var r=Dn(e,t),n=new We(pe),a=n.attributes=new At;return n.childNodes=new se,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=r[0],n.prefix=r[1],n.localName=r[2],a._ownerElement=n,n},"createElementNS"),createAttributeNS:h(function(e,t){var r=Dn(e,t),n=new st(pe);return n.ownerDocument=this,n.childNodes=new se,n.nodeName=t,n.name=t,n.specified=true,n.namespaceURI=r[0],n.prefix=r[1],n.localName=r[2],n},"createAttributeNS")};we(je,G);function We(e){_e(e),this._nsMap=Object.create(null);}h(We,"Element");We.prototype={nodeType:Ce,attributes:null,getQualifiedName:h(function(){return this.prefix?this.prefix+":"+this.localName:this.localName},"getQualifiedName"),_isInHTMLDocumentAndNamespace:h(function(){return this.ownerDocument.type==="html"&&this.namespaceURI===Fe.HTML},"_isInHTMLDocumentAndNamespace"),hasAttributes:h(function(){return !!(this.attributes&&this.attributes.length)},"hasAttributes"),hasAttribute:h(function(e){return !!this.getAttributeNode(e)},"hasAttribute"),getAttribute:h(function(e){var t=this.getAttributeNode(e);return t?t.value:null},"getAttribute"),getAttributeNode:h(function(e){return this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase()),this.attributes.getNamedItem(e)},"getAttributeNode"),setAttribute:h(function(e,t){this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());var r=this.getAttributeNode(e);r?r.value=r.nodeValue=""+t:(r=this.ownerDocument._createAttribute(e),r.value=r.nodeValue=""+t,this.setAttributeNode(r));},"setAttribute"),removeAttribute:h(function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t);},"removeAttribute"),setAttributeNode:h(function(e){return this.attributes.setNamedItem(e)},"setAttributeNode"),setAttributeNodeNS:h(function(e){return this.attributes.setNamedItemNS(e)},"setAttributeNodeNS"),removeAttributeNode:h(function(e){return this.attributes.removeNamedItem(e.nodeName)},"removeAttributeNode"),removeAttributeNS:h(function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r);},"removeAttributeNS"),hasAttributeNS:h(function(e,t){return this.getAttributeNodeNS(e,t)!=null},"hasAttributeNS"),getAttributeNS:h(function(e,t){var r=this.getAttributeNodeNS(e,t);return r?r.value:null},"getAttributeNS"),setAttributeNS:h(function(e,t,r){var n=Dn(e,t),a=n[2],i=this.getAttributeNodeNS(e,a);i?i.value=i.nodeValue=""+r:(i=this.ownerDocument.createAttributeNS(e,t),i.value=i.nodeValue=""+r,this.setAttributeNode(i));},"setAttributeNS"),getAttributeNodeNS:h(function(e,t){return this.attributes.getNamedItemNS(e,t)},"getAttributeNodeNS"),getElementsByClassName:h(function(e){var t=Ti(e);return new Re(this,function(r){var n=[];return t.length>0&&Nr(r,function(a){if(a!==r&&a.nodeType===Ce){var i=a.getAttribute("class");if(i){var o=e===i;if(!o){var s=Ti(i);o=t.every(lu(s));}o&&n.push(a);}}}),n})},"getElementsByClassName"),getElementsByTagName:h(function(e){var t=(this.nodeType===Et?this:this.ownerDocument).type==="html",r=e.toLowerCase();return new Re(this,function(n){var a=[];return Nr(n,function(i){if(!(i===n||i.nodeType!==Ce))if(e==="*")a.push(i);else {var o=i.getQualifiedName(),s=t&&i.namespaceURI===Fe.HTML?r:e;o===s&&a.push(i);}}),a})},"getElementsByTagName"),getElementsByTagNameNS:h(function(e,t){return new Re(this,function(r){var n=[];return Nr(r,function(a){a!==r&&a.nodeType===Ce&&(e==="*"||a.namespaceURI===e)&&(t==="*"||a.localName==t)&&n.push(a);}),n})},"getElementsByTagNameNS")};je.prototype.getElementsByClassName=We.prototype.getElementsByClassName;je.prototype.getElementsByTagName=We.prototype.getElementsByTagName;je.prototype.getElementsByTagNameNS=We.prototype.getElementsByTagNameNS;we(We,G);function st(e){_e(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null;}h(st,"Attr");st.prototype.nodeType=Dt;we(st,G);function Ct(e){_e(e);}h(Ct,"CharacterData");Ct.prototype={data:"",substringData:h(function(e,t){return this.data.substring(e,e+t)},"substringData"),appendData:h(function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length;},"appendData"),insertData:h(function(e,t){this.replaceData(e,0,t);},"insertData"),deleteData:h(function(e,t){this.replaceData(e,t,"");},"deleteData"),replaceData:h(function(e,t,r){var n=this.data.substring(0,e),a=this.data.substring(e+t);r=n+r+a,this.nodeValue=this.data=r,this.length=r.length;},"replaceData")};we(Ct,G);function ar(e){_e(e);}h(ar,"Text");ar.prototype={nodeName:"#text",nodeType:Cr,splitText:h(function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n},"splitText")};we(ar,Ct);function Sr(e){_e(e);}h(Sr,"Comment");Sr.prototype={nodeName:"#comment",nodeType:Nn};we(Sr,Ct);function Ir(e){_e(e);}h(Ir,"CDATASection");Ir.prototype={nodeName:"#cdata-section",nodeType:Bi};we(Ir,ar);function kr(e){_e(e);}h(kr,"DocumentType");kr.prototype.nodeType=Li;we(kr,G);function Cn(e){_e(e);}h(Cn,"Notation");Cn.prototype.nodeType=fu;we(Cn,G);function xn(e){_e(e);}h(xn,"Entity");xn.prototype.nodeType=cu;we(xn,G);function Or(e){_e(e);}h(Or,"EntityReference");Or.prototype.nodeType=Fi;we(Or,G);function xt(e){_e(e);}h(xt,"DocumentFragment");xt.prototype.nodeName="#document-fragment";xt.prototype.nodeType=Xe;we(xt,G);function Pr(e){_e(e);}h(Pr,"ProcessingInstruction");Pr.prototype.nodeType=An;we(Pr,Ct);function Yi(){}h(Yi,"XMLSerializer");Yi.prototype.serializeToString=function(e,t){return Xi.call(e,t)};G.prototype.toString=Xi;function Xi(e){var t;typeof e=="function"?t={requireWellFormed:false,splitCDATASections:true,nodeFilter:e}:e!=null?t={requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==false,nodeFilter:e.nodeFilter||null}:t={requireWellFormed:false,splitCDATASections:true,nodeFilter:null};var r=[],n=this.nodeType===Et&&this.documentElement||this,a=n.prefix,i=n.namespaceURI;if(i&&a==null){var a=n.lookupPrefix(i);if(a==null)var o=[{namespace:i,prefix:null}];}return Tn(this,r,o,t),r.join("")}h(Xi,"nodeSerializeToString");function Pi(e,t,r){var n=e.prefix||"",a=e.namespaceURI;if(!a||n==="xml"&&a===Fe.XML||a===Fe.XMLNS)return false;for(var i=r.length;i--;){var o=r[i];if(o.prefix===n)return o.namespace!==a}return true}h(Pi,"needNamespaceDefine");function Ar(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,zi),'"');}h(Ar,"addSerializedAttribute");function Tn(e,t,r,n){r||(r=[]);var a=n.nodeFilter,i=n.requireWellFormed,o=n.splitCDATASections,s=e.nodeType===Et?e:e.ownerDocument,l=s.type==="html";he(e,{ns:r},{enter:h(function(u,c){var f=c.ns;if(a)if(u=a(u),u){if(typeof u=="string")return t.push(u),null}else return null;switch(u.nodeType){case Ce:var d=u.attributes,p=d.length,m=u.tagName,g=m;if(!l&&!u.prefix&&u.namespaceURI){for(var b,v=0;v<d.length;v++)if(d.item(v).name==="xmlns"){b=d.item(v).value;break}if(!b)for(var w=f.length-1;w>=0;w--){var E=f[w];if(E.prefix===""&&E.namespace===u.namespaceURI){b=E.namespace;break}}if(b!==u.namespaceURI)for(var w=f.length-1;w>=0;w--){var E=f[w];if(E.namespace===u.namespaceURI){E.prefix&&(g=E.prefix+":"+m);break}}}t.push("<",g);for(var _=f.slice(),D=0;D<p;D++){var y=d.item(D);y.prefix=="xmlns"?_.push({prefix:y.localName,namespace:y.value}):y.nodeName=="xmlns"&&_.push({prefix:"",namespace:y.value});}for(var D=0;D<p;D++){var y=d.item(D);if(Pi(y,l,_)){var A=y.prefix||"",N=y.namespaceURI;Ar(t,A?"xmlns:"+A:"xmlns",N),_.push({prefix:A,namespace:N});}var C=a?a(y):y;C&&(typeof C=="string"?t.push(C):Ar(t,C.name,C.value));}if(m===g&&Pi(u,l,_)){var M=u.prefix||"",N=u.namespaceURI;Ar(t,M?"xmlns:"+M:"xmlns",N),_.push({prefix:M,namespace:N});}var T=!u.firstChild;if(T&&(l||u.namespaceURI===Fe.HTML)&&(T=au(m)),T)return t.push("/>"),null;if(t.push(">"),l&&iu(m)){for(var R=u.firstChild;R;)R.data?t.push(R.data):Tn(R,t,_.slice(),n),R=R.nextSibling;return t.push("</",g,">"),null}return {ns:_,tag:g};case Et:case Xe:if(i&&u.nodeType===Et&&u.documentElement==null)throw new O("The Document has no documentElement",Ne.InvalidStateError);return {ns:f};case Dt:return Ar(t,u.name,u.value),null;case Cr:if(i&&fe.InvalidChar.test(u.data))throw new O("The Text node data contains characters outside the XML Char production",Ne.InvalidStateError);return t.push(u.data.replace(/[<&>]/g,zi)),null;case Bi:if(i&&u.data.indexOf("]]>")!==-1)throw new O('The CDATASection data contains "]]>"',Ne.InvalidStateError);return o?t.push(fe.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),fe.CDATA_END):t.push(fe.CDATA_START,u.data,fe.CDATA_END),null;case Nn:if(i){if(fe.InvalidChar.test(u.data))throw new O("The comment node data contains characters outside the XML Char production",Ne.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new O('The comment node data contains "--" or ends with "-"',Ne.InvalidStateError)}return t.push(fe.COMMENT_START,u.data,fe.COMMENT_END),null;case Li:var F=u.publicId,I=u.systemId;if(i){if(F&&!fe.PubidLiteral_match.test(F))throw new O("DocumentType publicId is not a valid PubidLiteral",Ne.InvalidStateError);if(I&&I!=="."&&!fe.SystemLiteral_match.test(I))throw new O("DocumentType systemId is not a valid SystemLiteral",Ne.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new O('DocumentType internalSubset contains "]>"',Ne.InvalidStateError)}return t.push(fe.DOCTYPE_DECL_START," ",u.name),F?(t.push(" ",fe.PUBLIC," ",F),I&&I!=="."&&t.push(" ",I)):I&&I!=="."&&t.push(" ",fe.SYSTEM," ",I),u.internalSubset&&t.push(" [",u.internalSubset,"]"),t.push(">"),null;case An:if(i){if(u.target.indexOf(":")!==-1||u.target.toLowerCase()==="xml")throw new O("The ProcessingInstruction target is not well-formed",Ne.InvalidStateError);if(fe.InvalidChar.test(u.data))throw new O("The ProcessingInstruction data contains characters outside the XML Char production",Ne.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new O('The ProcessingInstruction data contains "?>"',Ne.InvalidStateError)}return t.push("<?",u.target," ",u.data,"?>"),null;case Fi:return t.push("&",u.nodeName,";"),null;default:return t.push("??",u.nodeName),null}},"enter"),exit:h(function(u,c){c&&c.tag&&t.push("</",c.tag,">");},"exit")});}h(Tn,"serializeToString");function wu(e,t,r){var n;return he(t,null,{enter:h(function(a,i){var o=a.cloneNode(false);o.ownerDocument=e,o.parentNode=null,i===null?n=o:i.appendChild(o);var s=a.nodeType===Dt||r;return s?o:null},"enter")}),n}h(wu,"importNode");function Qi(e,t,r){var n;return he(t,null,{enter:h(function(a,i){var o=new a.constructor(pe);for(var s in a)if(bt(a,s)){var l=a[s];typeof l!="object"&&l!=o[s]&&(o[s]=l);}a.childNodes&&(o.childNodes=new se),o.ownerDocument=e;var u=r;switch(o.nodeType){case Ce:var c=a.attributes,f=o.attributes=new At,d=c.length;f._ownerElement=o;for(var p=0;p<d;p++)o.setAttributeNode(Qi(e,c.item(p),true));break;case Dt:u=true;}return i!==null?i.appendChild(o):n=o,u?o:null},"enter")}),n}h(Qi,"cloneNode");function Ji(e,t,r){e[t]=r;}h(Ji,"__set__");function bn(e){for(var t=[],r=e.firstChild;r;)r.nodeType===Ce&&t.push(r),r=r.nextSibling;return t}h(bn,"childrenRefresh");try{Object.defineProperty&&(Object.defineProperty(Re.prototype,"length",{get:h(function(){return Tr(this),this.$$length},"get")}),Object.defineProperty(G.prototype,"textContent",{get:h(function(){if(this.nodeType===Ce||this.nodeType===Xe){var e=[];return he(this,null,{enter:h(function(t){if(t.nodeType===Ce||t.nodeType===Xe)return !0;if(t.nodeType===An||t.nodeType===Nn)return null;e.push(t.nodeValue);},"enter")}),e.join("")}return this.nodeValue},"get"),set:h(function(e){switch(this.nodeType){case Ce:case Xe:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e;}},"set")}),Object.defineProperty(We.prototype,"children",{get:h(function(){return new Re(this,bn)},"get")}),Object.defineProperty(je.prototype,"children",{get:h(function(){return new Re(this,bn)},"get")}),Object.defineProperty(xt.prototype,"children",{get:h(function(){return new Re(this,bn)},"get")}),Ji=h(function(e,t,r){e["$$"+t]=r;},"__set__"));}catch{}ae._updateLiveList=Tr;ae.Attr=st;ae.CDATASection=Ir;ae.CharacterData=Ct;ae.Comment=Sr;ae.Document=je;ae.DocumentFragment=xt;ae.DocumentType=kr;ae.DOMImplementation=qi;ae.Element=We;ae.Entity=xn;ae.EntityReference=Or;ae.LiveNodeList=Re;ae.NamedNodeMap=At;ae.Node=G;ae.NodeList=se;ae.Notation=Cn;ae.Text=ar;ae.ProcessingInstruction=Pr;ae.walkDOM=he;ae.XMLSerializer=Yi;});var Ki=Oe(or=>{var Zi=ot().freeze;or.XML_ENTITIES=Zi({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});or.HTML_ENTITIES=Zi({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
2
|
-
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});or.entityMap=or.HTML_ENTITIES;});var ca=Oe(Rr=>{var kt=ot(),z=En(),ia=Zt(),vu=kt.isHTMLEscapableRawTextElement,yu=kt.isHTMLMimeType,Eu=kt.isHTMLRawTextElement,cr=kt.hasOwn,ea=kt.NAMESPACE,ta=ia.ParseError,bu=ia.DOMException,sr=0,Je=1,Tt=2,ur=3,St=4,It=5,lr=6,Mr=7;function aa(){}h(aa,"XMLReader");aa.prototype={parse:h(function(e,t,r){var n=this.domBuilder;n.startDocument(),oa(t,t=Object.create(null)),Du(e,t,r,n,this.errorHandler),n.endDocument();},"parse")};var In=/&#?\w+;?/g;function Du(e,t,r,n,a){var i=yu(n.mimeType);e.indexOf(z.UNICODE_REPLACEMENT_CHARACTER)>=0&&a.warning("Unicode replacement character detected, source encoding issues?");function o(k){if(k>65535){k-=65536;var W=55296+(k>>10),Q=56320+(k&1023);return String.fromCharCode(W,Q)}else return String.fromCharCode(k)}h(o,"fixedFromCharCode");function s(k){var W=k[k.length-1]===";"?k:k+";";if(!i&&W!==k)return a.error("EntityRef: expecting ;"),k;var Q=z.Reference.exec(W);if(!Q||Q[0].length!==W.length)return a.error("entity not matching Reference production: "+k),k;var oe=W.slice(1,-1);return cr(r,oe)?r[oe]:oe.charAt(0)==="#"?o(parseInt(oe.substring(1).replace("x","0x"))):(a.error("entity not found:"+k),k)}h(s,"entityReplacer");function l(k){if(k>b){var W=e.substring(b,k).replace(In,s);d&&p(b),n.characters(W,0,k-b),b=k;}}h(l,"appendText");var u=0,c=0,f=/\r\n?|\n|$/g,d=n.locator;function p(k,W){for(;k>=c&&(W=f.exec(e));)u=c,c=W.index+W[0].length,d.lineNumber++;d.columnNumber=k-u+1;}h(p,"position");for(var m=[{currentNSMap:t}],g=[],b=0;;){try{var v=e.indexOf("<",b);if(v<0){if(!i&&g.length>0)return a.fatalError("unclosed xml tag(s): "+g.join(", "));if(!e.substring(b).match(/^\s*$/)){var w=n.doc,E=w.createTextNode(e.substring(b));if(w.documentElement)return a.error("Extra content at the end of the document");w.appendChild(E),n.currentElement=E;}return}if(v>b){var _=e.substring(b,v);!i&&g.length===0&&(_=_.replace(new RegExp(z.S_OPT.source,"g"),""),_&&a.error("Unexpected content outside root element: '"+_+"'")),l(v);}switch(e.charAt(v+1)){case "/":var I=e.indexOf(">",v+2),D=e.substring(v+2,I>0?I:void 0);if(!D)return a.fatalError("end tag name missing");var y=I>0&&z.reg("^",z.QName_group,z.S_OPT,"$").exec(D);if(!y)return a.fatalError('end tag name contains invalid characters: "'+D+'"');if(!n.currentElement&&!n.doc.documentElement)return;var A=g[g.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(A!==y[1]){var N=y[1].toLowerCase();if(!i||A.toLowerCase()!==N)return a.fatalError('Opening and ending tag mismatch: "'+A+'" != "'+D+'"')}var C=m.pop();g.pop();var M=C.localNSMap;if(n.endElement(C.uri,C.localName,A),M)for(var T in M)cr(M,T)&&n.endPrefixMapping(T);I++;break;case "?":d&&p(v),I=xu(e,v,n,a);break;case "!":d&&p(v),I=ua(e,v,n,a,i);break;default:d&&p(v);var R=new la,F=m[m.length-1].currentNSMap,I=Au(e,v,R,F,s,a,i),V=R.length;if(R.closed||(i&&kt.isHTMLVoidElement(R.tagName)?R.closed=!0:g.push(R.tagName)),d&&V){for(var U=ra(d,{}),B=0;B<V;B++){var L=R[B];p(L.offset),L.locator=ra(d,{});}n.locator=U,na(R,n,F)&&m.push(R),n.locator=d;}else na(R,n,F)&&m.push(R);i&&!R.closed?I=Nu(e,I,R.tagName,s,n):I++;}}catch(k){if(k instanceof ta)throw k;if(k instanceof bu)throw new ta(k.name+": "+k.message,n.locator,k);a.error("element parse error: "+k),I=-1;}I>b?b=I:l(Math.max(v,b)+1);}}h(Du,"parse");function ra(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}h(ra,"copyLocator");function Au(e,t,r,n,a,i,o){function s(p,m,g){if(cr(r.attributeNames,p))return i.fatalError("Attribute "+p+" redefined");if(!o&&m.indexOf("<")>=0)return i.fatalError("Unescaped '<' not allowed in attributes values");r.addValue(p,m.replace(/[\t\n\r]/g," ").replace(In,a),g);}h(s,"addAttribute");for(var l,u,c=++t,f=sr;;){var d=e.charAt(c);switch(d){case "=":if(f===Je)l=e.slice(t,c),f=ur;else if(f===Tt)f=ur;else throw new Error("attribute equal must after attrName");break;case "'":case '"':if(f===ur||f===Je)if(f===Je&&(i.warning('attribute value must after "="'),l=e.slice(t,c)),t=c+1,c=e.indexOf(d,t),c>0)u=e.slice(t,c),s(l,u,t-1),f=It;else throw new Error("attribute value no end '"+d+"' match");else if(f==St)u=e.slice(t,c),s(l,u,t),i.warning('attribute "'+l+'" missed start quot('+d+")!!"),t=c+1,f=It;else throw new Error('attribute value must after "="');break;case "/":switch(f){case sr:r.setTagName(e.slice(t,c));case It:case lr:case Mr:f=Mr,r.closed=true;case St:case Je:break;case Tt:r.closed=true;break;default:throw new Error("attribute invalid close char('/')")}break;case "":return i.error("unexpected end of input"),f==sr&&r.setTagName(e.slice(t,c)),c;case ">":switch(f){case sr:r.setTagName(e.slice(t,c));case It:case lr:case Mr:break;case St:case Je:u=e.slice(t,c),u.slice(-1)==="/"&&(r.closed=true,u=u.slice(0,-1));case Tt:f===Tt&&(u=l),f==St?(i.warning('attribute "'+u+'" missed quot(")!'),s(l,u,t)):(o||i.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),s(u,u,t));break;case ur:if(!o)return i.fatalError(`AttValue: ' or " expected`)}return c;case "\x80":d=" ";default:if(d<=" ")switch(f){case sr:r.setTagName(e.slice(t,c)),f=lr;break;case Je:l=e.slice(t,c),f=Tt;break;case St:var u=e.slice(t,c);i.warning('attribute "'+u+'" missed quot(")!!'),s(l,u,t);case It:f=lr;break}else switch(f){case Tt:o||i.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),s(l,l,t),t=c,f=Je;break;case It:i.warning('attribute space is required"'+l+'"!!');case lr:f=Je,t=c;break;case ur:f=St,t=c;break;case Mr:throw new Error("elements closed character '/' and '>' must be connected to")}}c++;}}h(Au,"parseElementStartPart");function na(e,t,r){for(var n=e.tagName,a=null,f=e.length;f--;){var i=e[f],o=i.qName,s=i.value,d=o.indexOf(":");if(d>0)var l=i.prefix=o.slice(0,d),u=o.slice(d+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";i.localName=u,c!==false&&(a==null&&(a=Object.create(null),oa(r,r=Object.create(null))),r[c]=a[c]=s,i.uri=ea.XMLNS,t.startPrefixMapping(c,s));}for(var f=e.length;f--;)i=e[f],i.prefix&&(i.prefix==="xml"&&(i.uri=ea.XML),i.prefix!=="xmlns"&&(i.uri=r[i.prefix]));var d=n.indexOf(":");d>0?(l=e.prefix=n.slice(0,d),u=e.localName=n.slice(d+1)):(l=null,u=e.localName=n);var p=e.uri=r[l||""];if(t.startElement(p,u,n,e),e.closed){if(t.endElement(p,u,n),a)for(l in a)cr(a,l)&&t.endPrefixMapping(l);}else return e.currentNSMap=r,e.localNSMap=a,true}h(na,"appendElement");function Nu(e,t,r,n,a){var i=vu(r);if(i||Eu(r)){var o=e.indexOf("</"+r+">",t),s=e.substring(t+1,o);return i&&(s=s.replace(In,n)),a.characters(s,0,s.length),o}return t+1}h(Nu,"parseHtmlSpecialContent");function oa(e,t){for(var r in e)cr(e,r)&&(t[r]=e[r]);}h(oa,"_copy");function sa(e,t){var r=t;function n(c){return c=c||0,e.charAt(r+c)}h(n,"char");function a(c){c=c||1,r+=c;}h(a,"skip");function i(){for(var c=0;r<e.length;){var f=n();if(f!==" "&&f!==`
|
|
1
|
+
'use strict';var n8nWorkflow=require('n8n-workflow');var _o=Object.create;var Jr=Object.defineProperty;var wo=Object.getOwnPropertyDescriptor;var vo=Object.getOwnPropertyNames;var yo=Object.getPrototypeOf,Eo=Object.prototype.hasOwnProperty;var h=(e,t)=>Jr(e,"name",{value:t,configurable:true});var Oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var bo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of vo(t))!Eo.call(e,a)&&a!==r&&Jr(e,a,{get:()=>t[a],enumerable:!(n=wo(t,a))||n.enumerable});return e};var Zr=(e,t,r)=>(r=e!=null?_o(yo(e)):{},bo(Jr(r,"default",{value:e,enumerable:true}),e));var Yn=Oe((Nc,Gn)=>{Gn.exports={createRequire:h(function(){return function(){return {}}},"createRequire")};});var ot=Oe(ce=>{function Yo(e,t,r){if(r===void 0&&(r=Array.prototype),e&&typeof r.find=="function")return r.find.call(e,t);for(var n=0;n<e.length;n++)if(at(e,n)){var a=e[n];if(t.call(void 0,a,n,e))return a}}h(Yo,"find");function _t(e,t){return t===void 0&&(t=Object),t&&typeof t.getOwnPropertyDescriptors=="function"&&(e=t.create(null,t.getOwnPropertyDescriptors(e))),t&&typeof t.freeze=="function"?t.freeze(e):e}h(_t,"freeze");function at(e,t){return Object.prototype.hasOwnProperty.call(e,t)}h(at,"hasOwn");function Xo(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var r in t)at(t,r)&&(e[r]=t[r]);return e}h(Xo,"assign");var ci=_t({allowfullscreen:true,async:true,autofocus:true,autoplay:true,checked:true,controls:true,default:true,defer:true,disabled:true,formnovalidate:true,hidden:true,ismap:true,itemscope:true,loop:true,multiple:true,muted:true,nomodule:true,novalidate:true,open:true,playsinline:true,readonly:true,required:true,reversed:true,selected:true});function Qo(e){return at(ci,e.toLowerCase())}h(Qo,"isHTMLBooleanAttribute");var fi=_t({area:true,base:true,br:true,col:true,embed:true,hr:true,img:true,input:true,link:true,meta:true,param:true,source:true,track:true,wbr:true});function Jo(e){return at(fi,e.toLowerCase())}h(Jo,"isHTMLVoidElement");var Vt=_t({script:false,style:false,textarea:true,title:true});function Zo(e){var t=e.toLowerCase();return at(Vt,t)&&!Vt[t]}h(Zo,"isHTMLRawTextElement");function Ko(e){var t=e.toLowerCase();return at(Vt,t)&&Vt[t]}h(Ko,"isHTMLEscapableRawTextElement");function hi(e){return e===Gt.HTML}h(hi,"isHTMLMimeType");function es(e){return hi(e)||e===Gt.XML_XHTML_APPLICATION}h(es,"hasDefaultHTMLNamespace");var Gt=_t({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),ts=Object.keys(Gt).map(function(e){return Gt[e]});function rs(e){return ts.indexOf(e)>-1}h(rs,"isValidMimeType");var ns=_t({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});ce.assign=Xo;ce.find=Yo;ce.freeze=_t;ce.HTML_BOOLEAN_ATTRIBUTES=ci;ce.HTML_RAW_TEXT_ELEMENTS=Vt;ce.HTML_VOID_ELEMENTS=fi;ce.hasDefaultHTMLNamespace=es;ce.hasOwn=at;ce.isHTMLBooleanAttribute=Qo;ce.isHTMLRawTextElement=Zo;ce.isHTMLEscapableRawTextElement=Ko;ce.isHTMLMimeType=hi;ce.isHTMLVoidElement=Jo;ce.isValidMimeType=rs;ce.MIME_TYPE=Gt;ce.NAMESPACE=ns;});var Zt=Oe(Jt=>{var is=ot();function pi(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:true,writable:t}});}h(pi,"extendError");var Xt=is.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),mi=Object.keys(Xt);function gi(e){return typeof e=="number"&&e>=1&&e<=25}h(gi,"isValidDomExceptionCode");function as(e){return typeof e=="string"&&e.substring(e.length-Xt.Error.length)===Xt.Error}h(as,"endsWithError");function Qt(e,t){gi(e)?(this.name=mi[e],this.message=t||""):(this.message=e,this.name=as(t)?t:Xt.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Qt);}h(Qt,"DOMException");pi(Qt,true);Object.defineProperties(Qt.prototype,{code:{enumerable:true,get:h(function(){var e=mi.indexOf(this.name);return gi(e)?e:0},"get")}});var _i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},dn=Object.entries(_i);for(Yt=0;Yt<dn.length;Yt++)di=dn[Yt][0],Qt[di]=dn[Yt][1];var di,Yt;function pn(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,pn);}h(pn,"ParseError");pi(pn);Jt.DOMException=Qt;Jt.DOMExceptionName=Xt;Jt.ExceptionCode=_i;Jt.ParseError=pn;});var En=Oe(q=>{function Ai(e){try{typeof e!="function"&&(e=RegExp);var t=new e("\u{1D306}","u").exec("\u{1D306}");return !!t&&t[0].length===2}catch{}return false}h(Ai,"detectUnicodeSupport");var yt=Ai();function Ge(e){if(e.source[0]!=="[")throw new Error(e+" can not be used with chars");return e.source.slice(1,e.source.lastIndexOf("]"))}h(Ge,"chars");function wt(e,t){if(e.source[0]!=="[")throw new Error("/"+e.source+"/ can not be used with chars_without");if(!t||typeof t!="string")throw new Error(JSON.stringify(t)+" is not a valid search");if(e.source.indexOf(t)===-1)throw new Error('"'+t+'" is not is /'+e.source+"/");if(t==="-"&&e.source.indexOf(t)!==1)throw new Error('"'+t+'" is not at the first postion of /'+e.source+"/");return new RegExp(e.source.replace(t,""),yt?"u":"")}h(wt,"chars_without");function H(e){var t=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(r){var n=typeof r=="string";if(n&&t===void 0&&r==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return n?r:r.source}).join(""),yt?"mu":"m")}h(H,"reg");function $(e){if(arguments.length===0)throw new Error("no parameters provided");return H.apply($,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}h($,"regg");var os="\uFFFD",Ye=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;yt&&(Ye=H("[",Ge(Ye),"\\u{10000}-\\u{10FFFF}","]"));var ss=new RegExp("[^"+Ge(Ye)+"]",yt?"u":""),gn=/[\x20\x09\x0D\x0A]/,us=Ge(gn),J=H(gn,"+"),te=H(gn,"*"),Kt=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;yt&&(Kt=H("[",Ge(Kt),"\\u{10000}-\\u{10FFFF}","]"));var ls=Ge(Kt),_n=H("[",ls,Ge(/[-.0-9\xB7]/),Ge(/[\u0300-\u036F\u203F-\u2040]/),"]"),Ae=H(Kt,_n,"*"),wi=H(_n,"+"),cs=H("&",Ae,";"),fs=$(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),er=$(cs,"|",fs),tr=H("%",Ae,";"),wn=$(H('"',$(/[^%&"]/,"|",tr,"|",er),"*",'"'),"|",H("'",$(/[^%&']/,"|",tr,"|",er),"*","'")),hs=$('"',$(/[^<&"]/,"|",er),"*",'"',"|","'",$(/[^<&']/,"|",er),"*","'"),ds=wt(Kt,":"),ps=wt(_n,":"),vi=H(ds,ps,"*"),rr=H(vi,$(":",vi),"?"),ms=H("^",rr,"$"),gs=H("(",rr,")"),vt=$(/"[^"]*"|'[^']*'/),_s=H(/^<\?/,"(",Ae,")",$(J,"(",Ye,"*?)"),"?",/\?>/),yi=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,nr=$('"',yi,'*"',"|","'",wt(yi,"'"),"*'"),Ni="<!--",Ci="-->",ws=H(Ni,$(wt(Ye,"-"),"|",H("-",wt(Ye,"-"))),"*",Ci),Ei="#PCDATA",vs=$(H(/\(/,te,Ei,$(te,/\|/,te,rr),"*",te,/\)\*/),"|",H(/\(/,te,Ei,te,/\)/)),ys=/[?*+]?/,Es=H(/\([^>]+\)/,ys),bs=$("EMPTY","|","ANY","|",vs,"|",Es),Ds="<!ELEMENT",As=H(Ds,J,$(rr,"|",tr),J,$(bs,"|",tr),te,">"),Ns=H("NOTATION",J,/\(/,te,Ae,$(te,/\|/,te,Ae),"*",te,/\)/),Cs=H(/\(/,te,wi,$(te,/\|/,te,wi),"*",te,/\)/),xs=$(Ns,"|",Cs),Ts=$(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",xs),Ss=$(/#REQUIRED|#IMPLIED/,"|",$($("#FIXED",J),"?",hs)),Is=$(J,Ae,J,Ts,J,Ss),ks="<!ATTLIST",Os=H(ks,J,Ae,Is,"*",te,">"),mn="about:legacy-compat",Ps=$('"'+mn+'"',"|","'"+mn+"'"),vn="SYSTEM",br="PUBLIC",Dr=$($(vn,J,vt),"|",$(br,J,nr,J,vt)),Ms=H("^",$($(vn,J,"(?<SystemLiteralOnly>",vt,")"),"|",$(br,J,"(?<PubidLiteral>",nr,")",J,"(?<SystemLiteral>",vt,")"))),Rs=H("^",nr,"$"),Bs=H("^",vt,"$"),Fs=$(J,"NDATA",J,Ae),Ls=$(wn,"|",$(Dr,Fs,"?")),xi="<!ENTITY",$s=H(xi,J,Ae,J,Ls,te,">"),Us=$(wn,"|",Dr),qs=H(xi,J,"%",J,Ae,J,Us,te,">"),zs=$($s,"|",qs),js=H(br,J,nr),Ws=H("<!NOTATION",J,Ae,J,$(Dr,"|",js),te,">"),yn=H(te,"=",te),bi=/1[.]\d+/,Hs=H(J,"version",yn,$("'",bi,"'","|",'"',bi,'"')),Di=/[A-Za-z][-A-Za-z0-9._]*/,Vs=$(J,"encoding",yn,$('"',Di,'"',"|","'",Di,"'")),Gs=$(J,"standalone",yn,$("'",$("yes","|","no"),"'","|",'"',$("yes","|","no"),'"')),Ys=H(/^<\?xml/,Hs,Vs,"?",Gs,"?",te,/\?>/),Xs="<!DOCTYPE",Qs="<![CDATA[",Js="]]>",Zs=/<!\[CDATA\[/,Ks=/\]\]>/,eu=H(Ye,"*?",Ks),tu=H(Zs,eu);q.chars=Ge;q.chars_without=wt;q.detectUnicodeSupport=Ai;q.reg=H;q.regg=$;q.ABOUT_LEGACY_COMPAT=mn;q.ABOUT_LEGACY_COMPAT_SystemLiteral=Ps;q.AttlistDecl=Os;q.CDATA_START=Qs;q.CDATA_END=Js;q.CDSect=tu;q.Char=Ye;q.Comment=ws;q.COMMENT_START=Ni;q.COMMENT_END=Ci;q.DOCTYPE_DECL_START=Xs;q.elementdecl=As;q.EntityDecl=zs;q.EntityValue=wn;q.ExternalID=Dr;q.ExternalID_match=Ms;q.Name=Ae;q.NotationDecl=Ws;q.Reference=er;q.PEReference=tr;q.PI=_s;q.PUBLIC=br;q.PubidLiteral=nr;q.PubidLiteral_match=Rs;q.QName=rr;q.QName_exact=ms;q.QName_group=gs;q.S=J;q.SChar_s=us;q.S_OPT=te;q.SYSTEM=vn;q.SystemLiteral=vt;q.SystemLiteral_match=Bs;q.InvalidChar=ss;q.UNICODE_REPLACEMENT_CHARACTER=os;q.UNICODE_SUPPORT=yt;q.XMLDecl=Ys;});var Sn=Oe(ae=>{var xe=ot(),Be=xe.find,ru=xe.hasDefaultHTMLNamespace,bt=xe.hasOwn,nu=xe.isHTMLMimeType,iu=xe.isHTMLRawTextElement,au=xe.isHTMLVoidElement,ir=xe.MIME_TYPE,Fe=xe.NAMESPACE,pe=Symbol(),Mi=Zt(),O=Mi.DOMException,Ne=Mi.DOMExceptionName,fe=En();function _e(e){if(e!==pe)throw new TypeError("Illegal constructor")}h(_e,"checkSymbol");function ou(e){return e!==""}h(ou,"notEmptyString");function su(e){return e?e.split(/[\t\n\f\r ]+/).filter(ou):[]}h(su,"splitOnASCIIWhitespace");function uu(e,t){return bt(e,t)||(e[t]=true),e}h(uu,"orderedSetReducer");function Ti(e){if(!e)return [];var t=su(e);return Object.keys(t.reduce(uu,{}))}h(Ti,"toOrderedSet");function lu(e){return function(t){return e&&e.indexOf(t)!==-1}}h(lu,"arrayIncludes");function Ri(e){if(!fe.QName_exact.test(e))throw new O(O.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}h(Ri,"validateQualifiedName");function Dn(e,t){Ri(t),e=e||null;var r=null,n=t;if(t.indexOf(":")>=0){var a=t.split(":");r=a[0],n=a[1];}if(r!==null&&e===null)throw new O(O.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(r==="xml"&&e!==xe.NAMESPACE.XML)throw new O(O.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((r==="xmlns"||t==="xmlns")&&e!==xe.NAMESPACE.XMLNS)throw new O(O.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(e===xe.NAMESPACE.XMLNS&&r!=="xmlns"&&t!=="xmlns")throw new O(O.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return [e,r,n]}h(Dn,"validateAndExtract");function Nt(e,t){for(var r in e)bt(e,r)&&(t[r]=e[r]);}h(Nt,"copy");function we(e,t){var r=e.prototype;if(!(r instanceof t)){let n=function(){};h(n,"t"),n.prototype=t.prototype,n=new n,Nt(r,n),e.prototype=r=n;}r.constructor!=e&&(r.constructor=e);}h(we,"_extends");var ve={},Ce=ve.ELEMENT_NODE=1,Dt=ve.ATTRIBUTE_NODE=2,Cr=ve.TEXT_NODE=3,Bi=ve.CDATA_SECTION_NODE=4,Fi=ve.ENTITY_REFERENCE_NODE=5,cu=ve.ENTITY_NODE=6,An=ve.PROCESSING_INSTRUCTION_NODE=7,Nn=ve.COMMENT_NODE=8,Et=ve.DOCUMENT_NODE=9,Li=ve.DOCUMENT_TYPE_NODE=10,Xe=ve.DOCUMENT_FRAGMENT_NODE=11,fu=ve.NOTATION_NODE=12,ie=xe.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function $i(e,t){if(t.length<e.length)return $i(t,e);var r=null;for(var n in e){if(e[n]!==t[n])return r;r=e[n];}return r}h($i,"commonAncestor");function Si(e){return e.guid||(e.guid=Math.random()),e.guid}h(Si,"docGUID");function se(){}h(se,"NodeList");se.prototype={length:0,item:h(function(e){return e>=0&&e<this.length?this[e]:null},"item"),toString:h(function(e){var t;typeof e=="function"?t={requireWellFormed:false,splitCDATASections:true,nodeFilter:e}:e?t={requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==false,nodeFilter:e.nodeFilter||null}:t={requireWellFormed:false,splitCDATASections:true,nodeFilter:null};for(var r=[],n=0;n<this.length;n++)Tn(this[n],r,null,t);return r.join("")},"toString"),filter:h(function(e){return Array.prototype.filter.call(this,e)},"filter"),indexOf:h(function(e){return Array.prototype.indexOf.call(this,e)},"indexOf")};se.prototype[Symbol.iterator]=function(){var e=this,t=0;return {next:h(function(){return t<e.length?{value:e[t++],done:false}:{done:true}},"next"),return:h(function(){return {done:true}},"return")}};function Re(e,t){this._node=e,this._refresh=t,Tr(this);}h(Re,"LiveNodeList");function Tr(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(Ji(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)bt(e,n)&&delete e[n];Nt(r,e),e._inc=t;}}h(Tr,"_updateLiveList");Re.prototype.item=function(e){return Tr(this),this[e]||null};we(Re,se);function At(){}h(At,"NamedNodeMap");function Ui(e,t){for(var r=0;r<e.length;){if(e[r]===t)return r;r++;}}h(Ui,"_findNodeIndex");function hu(e,t,r,n){if(n?t[Ui(t,n)]=r:(t[t.length]=r,t.length++),e){r.ownerElement=e;var a=e.ownerDocument;a&&(n&&ji(a,e,n),du(a,e,r));}}h(hu,"_addNamedNode");function Ii(e,t,r){var n=Ui(t,r);if(n>=0){for(var a=t.length-1;n<=a;)t[n]=t[++n];if(t.length=a,e){var i=e.ownerDocument;i&&ji(i,e,r),r.ownerElement=null;}}}h(Ii,"_removeNamedNode");At.prototype={length:0,item:se.prototype.item,getNamedItem:h(function(e){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());for(var t=0;t<this.length;){var r=this[t];if(r.nodeName===e)return r;t++;}return null},"getNamedItem"),setNamedItem:h(function(e){var t=e.ownerElement;if(t&&t!==this._ownerElement)throw new O(O.INUSE_ATTRIBUTE_ERR);var r=this.getNamedItemNS(e.namespaceURI,e.localName);return r===e?e:(hu(this._ownerElement,this,e,r),r)},"setNamedItem"),setNamedItemNS:h(function(e){return this.setNamedItem(e)},"setNamedItemNS"),removeNamedItem:h(function(e){var t=this.getNamedItem(e);if(!t)throw new O(O.NOT_FOUND_ERR,e);return Ii(this._ownerElement,this,t),t},"removeNamedItem"),removeNamedItemNS:h(function(e,t){var r=this.getNamedItemNS(e,t);if(!r)throw new O(O.NOT_FOUND_ERR,e?e+" : "+t:t);return Ii(this._ownerElement,this,r),r},"removeNamedItemNS"),getNamedItemNS:h(function(e,t){e||(e=null);for(var r=0;r<this.length;){var n=this[r];if(n.localName===t&&n.namespaceURI===e)return n;r++;}return null},"getNamedItemNS")};At.prototype[Symbol.iterator]=function(){var e=this,t=0;return {next:h(function(){return t<e.length?{value:e[t++],done:false}:{done:true}},"next"),return:h(function(){return {done:true}},"return")}};function qi(){}h(qi,"DOMImplementation");qi.prototype={hasFeature:h(function(e,t){return true},"hasFeature"),createDocument:h(function(e,t,r){var n=ir.XML_APPLICATION;e===Fe.HTML?n=ir.XML_XHTML_APPLICATION:e===Fe.SVG&&(n=ir.XML_SVG_IMAGE);var a=new je(pe,{contentType:n});if(a.implementation=this,a.childNodes=new se,a.doctype=r||null,r&&a.appendChild(r),t){var i=a.createElementNS(e,t);a.appendChild(i);}return a},"createDocument"),createDocumentType:h(function(e,t,r,n){Ri(e);var a=new kr(pe);return a.name=e,a.nodeName=e,a.publicId=t||"",a.systemId=r||"",a.internalSubset=n||"",a.childNodes=new se,a},"createDocumentType"),createHTMLDocument:h(function(e){var t=new je(pe,{contentType:ir.HTML});if(t.implementation=this,t.childNodes=new se,e!==false){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var r=t.createElement("html");t.appendChild(r);var n=t.createElement("head");if(r.appendChild(n),typeof e=="string"){var a=t.createElement("title");a.appendChild(t.createTextNode(e)),n.appendChild(a);}r.appendChild(t.createElement("body"));}return t},"createHTMLDocument")};function G(e){_e(e);}h(G,"Node");G.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var e=this.getRootNode();return e&&e.nodeType===e.DOCUMENT_NODE},contains:h(function(e){if(!e)return false;var t=e;do{if(this===t)return true;t=t.parentNode;}while(t);return false},"contains"),getRootNode:h(function(e){var t=this;do{if(!t.parentNode)return t;t=t.parentNode;}while(t)},"getRootNode"),isEqualNode:h(function(e){if(!e)return false;for(var t=[{node:this,other:e}];t.length>0;){var r=t.pop(),n=r.node,a=r.other;if(n.nodeType!==a.nodeType)return false;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==a.name||n.publicId!==a.publicId||n.systemId!==a.systemId)return false;break;case n.ELEMENT_NODE:if(n.namespaceURI!==a.namespaceURI||n.prefix!==a.prefix||n.localName!==a.localName||n.attributes.length!==a.attributes.length)return false;for(var i=0;i<n.attributes.length;i++){var o=n.attributes.item(i),s=a.getAttributeNodeNS(o.namespaceURI,o.localName);if(!s)return false;t.push({node:o,other:s});}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==a.namespaceURI||n.localName!==a.localName||n.value!==a.value)return false;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==a.target||n.data!==a.data)return false;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==a.data)return false;break}if(n.childNodes.length!==a.childNodes.length)return false;for(var i=n.childNodes.length-1;i>=0;i--)t.push({node:n.childNodes[i],other:a.childNodes[i]});}return true},"isEqualNode"),isSameNode:h(function(e){return this===e},"isSameNode"),insertBefore:h(function(e,t){return xr(this,e,t)},"insertBefore"),replaceChild:h(function(e,t){xr(this,e,t,Gi),t&&this.removeChild(t);},"replaceChild"),removeChild:h(function(e){return Hi(this,e)},"removeChild"),appendChild:h(function(e){return this.insertBefore(e,null)},"appendChild"),hasChildNodes:h(function(){return this.firstChild!=null},"hasChildNodes"),cloneNode:h(function(e){return Qi(this.ownerDocument||this,this,e)},"cloneNode"),normalize:h(function(){he(this,null,{enter:h(function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===Cr&&t.nodeType===Cr?(e.removeChild(r),t.appendData(r.data)):t=r;}return true},"enter")});},"normalize"),isSupported:h(function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},"isSupported"),lookupPrefix:h(function(e){for(var t=this;t;){var r=t._nsMap;if(r){for(var n in r)if(bt(r,n)&&r[n]===e)return n}t=t.nodeType==Dt?t.ownerDocument:t.parentNode;}return null},"lookupPrefix"),lookupNamespaceURI:h(function(e){for(var t=this;t;){var r=t._nsMap;if(r&&bt(r,e))return r[e];t=t.nodeType==Dt?t.ownerDocument:t.parentNode;}return null},"lookupNamespaceURI"),isDefaultNamespace:h(function(e){var t=this.lookupPrefix(e);return t==null},"isDefaultNamespace"),compareDocumentPosition:h(function(e){if(this===e)return 0;var t=e,r=this,n=null,a=null;if(t instanceof st&&(n=t,t=n.ownerElement),r instanceof st&&(a=r,r=a.ownerElement,n&&t&&r===t))for(var i=0,o;o=r.attributes[i];i++){if(o===n)return ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ie.DOCUMENT_POSITION_PRECEDING;if(o===a)return ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ie.DOCUMENT_POSITION_FOLLOWING}if(!t||!r||r.ownerDocument!==t.ownerDocument)return ie.DOCUMENT_POSITION_DISCONNECTED+ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Si(r.ownerDocument)>Si(t.ownerDocument)?ie.DOCUMENT_POSITION_FOLLOWING:ie.DOCUMENT_POSITION_PRECEDING);if(a&&t===r)return ie.DOCUMENT_POSITION_CONTAINS+ie.DOCUMENT_POSITION_PRECEDING;if(n&&t===r)return ie.DOCUMENT_POSITION_CONTAINED_BY+ie.DOCUMENT_POSITION_FOLLOWING;for(var s=[],l=t.parentNode;l;){if(!a&&l===r)return ie.DOCUMENT_POSITION_CONTAINED_BY+ie.DOCUMENT_POSITION_FOLLOWING;s.push(l),l=l.parentNode;}s.reverse();for(var u=[],c=r.parentNode;c;){if(!n&&c===t)return ie.DOCUMENT_POSITION_CONTAINS+ie.DOCUMENT_POSITION_PRECEDING;u.push(c),c=c.parentNode;}u.reverse();var f=$i(s,u);for(var d in f.childNodes){var p=f.childNodes[d];if(p===r)return ie.DOCUMENT_POSITION_FOLLOWING;if(p===t)return ie.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(p)>=0)return ie.DOCUMENT_POSITION_FOLLOWING;if(s.indexOf(p)>=0)return ie.DOCUMENT_POSITION_PRECEDING}return 0},"compareDocumentPosition")};function zi(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}h(zi,"_xmlEncoder");Nt(ve,G);Nt(ve,G.prototype);Nt(ie,G);Nt(ie,G.prototype);function Nr(e,t){he(e,null,{enter:h(function(r){return t(r)?he.STOP:true},"enter")});}h(Nr,"_visitNode");function he(e,t,r){for(var n=[{node:e,context:t,phase:he.ENTER}];n.length>0;){var a=n.pop();if(a.phase===he.ENTER){var i=r.enter(a.node,a.context);if(i===he.STOP)return he.STOP;if(n.push({node:a.node,context:i,phase:he.EXIT}),i==null)continue;for(var o=a.node.lastChild;o;)n.push({node:o,context:i,phase:he.ENTER}),o=o.previousSibling;}else r.exit&&r.exit(a.node,a.context);}}h(he,"walkDOM");he.STOP=Symbol("walkDOM.STOP");he.ENTER=0;he.EXIT=1;function je(e,t){_e(e);var r=t||{};this.ownerDocument=this,this.contentType=r.contentType||ir.XML_APPLICATION,this.type=nu(this.contentType)?"html":"xml";}h(je,"Document");function du(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Fe.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value);}h(du,"_onAddAttribute");function ji(e,t,r,n){e&&e._inc++;var a=r.namespaceURI;a===Fe.XMLNS&&delete t._nsMap[r.prefix?r.localName:""];}h(ji,"_onRemoveAttribute");function Wi(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r&&!r.nextSibling)n[n.length++]=r;else {for(var a=t.firstChild,i=0;a;)n[i++]=a,a=a.nextSibling;n.length=i,delete n[n.length];}}}h(Wi,"_onUpdateChild");function Hi(e,t){if(e!==t.parentNode)throw new O(O.NOT_FOUND_ERR,"child's parent is not parent");var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,Wi(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}h(Hi,"_removeChild");function pu(e){return e&&(e.nodeType===G.DOCUMENT_NODE||e.nodeType===G.DOCUMENT_FRAGMENT_NODE||e.nodeType===G.ELEMENT_NODE)}h(pu,"hasValidParentNodeType");function mu(e){return e&&(e.nodeType===G.CDATA_SECTION_NODE||e.nodeType===G.COMMENT_NODE||e.nodeType===G.DOCUMENT_FRAGMENT_NODE||e.nodeType===G.DOCUMENT_TYPE_NODE||e.nodeType===G.ELEMENT_NODE||e.nodeType===G.PROCESSING_INSTRUCTION_NODE||e.nodeType===G.TEXT_NODE)}h(mu,"hasInsertableNodeType");function Qe(e){return e&&e.nodeType===G.DOCUMENT_TYPE_NODE}h(Qe,"isDocTypeNode");function ze(e){return e&&e.nodeType===G.ELEMENT_NODE}h(ze,"isElementNode");function Vi(e){return e&&e.nodeType===G.TEXT_NODE}h(Vi,"isTextNode");function ki(e,t){var r=e.childNodes||[];if(Be(r,ze)||Qe(t))return false;var n=Be(r,Qe);return !(t&&n&&r.indexOf(n)>r.indexOf(t))}h(ki,"isElementInsertionPossible");function Oi(e,t){var r=e.childNodes||[];function n(i){return ze(i)&&i!==t}if(h(n,"hasElementChildThatIsNotChild"),Be(r,n))return false;var a=Be(r,Qe);return !(t&&a&&r.indexOf(a)>r.indexOf(t))}h(Oi,"isElementReplacementPossible");function gu(e,t,r){if(!pu(e))throw new O(O.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new O(O.NOT_FOUND_ERR,"child not in parent");if(!mu(t)||Qe(t)&&e.nodeType!==G.DOCUMENT_NODE)throw new O(O.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}h(gu,"assertPreInsertionValidity1to5");function _u(e,t,r){var n=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===G.DOCUMENT_FRAGMENT_NODE){var i=a.filter(ze);if(i.length>1||Be(a,Vi))throw new O(O.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!ki(e,r))throw new O(O.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ze(t)&&!ki(e,r))throw new O(O.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Qe(t)){if(Be(n,Qe))throw new O(O.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Be(n,ze);if(r&&n.indexOf(o)<n.indexOf(r))throw new O(O.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!r&&o)throw new O(O.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}h(_u,"assertPreInsertionValidityInDocument");function Gi(e,t,r){var n=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===G.DOCUMENT_FRAGMENT_NODE){var i=a.filter(ze);if(i.length>1||Be(a,Vi))throw new O(O.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!Oi(e,r))throw new O(O.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ze(t)&&!Oi(e,r))throw new O(O.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Qe(t)){let s=function(l){return Qe(l)&&l!==r};if(h(s,"hasDoctypeChildThatIsNotChild"),Be(n,s))throw new O(O.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Be(n,ze);if(r&&n.indexOf(o)<n.indexOf(r))throw new O(O.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}h(Gi,"assertPreReplacementValidityInDocument");function xr(e,t,r,n){gu(e,t,r),e.nodeType===G.DOCUMENT_NODE&&(n||_u)(e,t,r);var a=t.parentNode;if(a&&a.removeChild(t),t.nodeType===Xe){var i=t.firstChild;if(i==null)return t;var o=t.lastChild;}else i=o=t;var s=r?r.previousSibling:e.lastChild;i.previousSibling=s,o.nextSibling=r,s?s.nextSibling=i:e.firstChild=i,r==null?e.lastChild=o:r.previousSibling=o;do i.parentNode=e;while(i!==o&&(i=i.nextSibling));return Wi(e.ownerDocument||e,e,t),t.nodeType==Xe&&(t.firstChild=t.lastChild=null),t}h(xr,"_insertBefore");je.prototype={implementation:null,nodeName:"#document",nodeType:Et,doctype:null,documentElement:null,_inc:1,insertBefore:h(function(e,t){if(e.nodeType===Xe){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n;}return e}return xr(this,e,t),e.ownerDocument=this,this.documentElement===null&&e.nodeType===Ce&&(this.documentElement=e),e},"insertBefore"),removeChild:h(function(e){var t=Hi(this,e);return t===this.documentElement&&(this.documentElement=null),t},"removeChild"),replaceChild:h(function(e,t){xr(this,e,t,Gi),e.ownerDocument=this,t&&this.removeChild(t),ze(e)&&(this.documentElement=e);},"replaceChild"),importNode:h(function(e,t){return wu(this,e,t)},"importNode"),getElementById:h(function(e){var t=null;return Nr(this.documentElement,function(r){if(r.nodeType==Ce&&r.getAttribute("id")==e)return t=r,true}),t},"getElementById"),createElement:h(function(e){var t=new We(pe);t.ownerDocument=this,this.type==="html"&&(e=e.toLowerCase()),ru(this.contentType)&&(t.namespaceURI=Fe.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new se;var r=t.attributes=new At;return r._ownerElement=t,t},"createElement"),createDocumentFragment:h(function(){var e=new xt(pe);return e.ownerDocument=this,e.childNodes=new se,e},"createDocumentFragment"),createTextNode:h(function(e){var t=new ar(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createTextNode"),createComment:h(function(e){var t=new Sr(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createComment"),createCDATASection:h(function(e){if(e.indexOf("]]>")!==-1)throw new O(O.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new Ir(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createCDATASection"),createProcessingInstruction:h(function(e,t){var r=new Pr(pe);return r.ownerDocument=this,r.childNodes=new se,r.nodeName=r.target=e,r.nodeValue=r.data=t,r},"createProcessingInstruction"),createAttribute:h(function(e){if(!fe.QName_exact.test(e))throw new O(O.INVALID_CHARACTER_ERR,'invalid character in name "'+e+'"');return this.type==="html"&&(e=e.toLowerCase()),this._createAttribute(e)},"createAttribute"),_createAttribute:h(function(e){var t=new st(pe);return t.ownerDocument=this,t.childNodes=new se,t.name=e,t.nodeName=e,t.localName=e,t.specified=true,t},"_createAttribute"),createEntityReference:h(function(e){if(!fe.Name.test(e))throw new O(O.INVALID_CHARACTER_ERR,'not a valid xml name "'+e+'"');if(this.type==="html")throw new O("document is an html document",Ne.NotSupportedError);var t=new Or(pe);return t.ownerDocument=this,t.childNodes=new se,t.nodeName=e,t},"createEntityReference"),createElementNS:h(function(e,t){var r=Dn(e,t),n=new We(pe),a=n.attributes=new At;return n.childNodes=new se,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=r[0],n.prefix=r[1],n.localName=r[2],a._ownerElement=n,n},"createElementNS"),createAttributeNS:h(function(e,t){var r=Dn(e,t),n=new st(pe);return n.ownerDocument=this,n.childNodes=new se,n.nodeName=t,n.name=t,n.specified=true,n.namespaceURI=r[0],n.prefix=r[1],n.localName=r[2],n},"createAttributeNS")};we(je,G);function We(e){_e(e),this._nsMap=Object.create(null);}h(We,"Element");We.prototype={nodeType:Ce,attributes:null,getQualifiedName:h(function(){return this.prefix?this.prefix+":"+this.localName:this.localName},"getQualifiedName"),_isInHTMLDocumentAndNamespace:h(function(){return this.ownerDocument.type==="html"&&this.namespaceURI===Fe.HTML},"_isInHTMLDocumentAndNamespace"),hasAttributes:h(function(){return !!(this.attributes&&this.attributes.length)},"hasAttributes"),hasAttribute:h(function(e){return !!this.getAttributeNode(e)},"hasAttribute"),getAttribute:h(function(e){var t=this.getAttributeNode(e);return t?t.value:null},"getAttribute"),getAttributeNode:h(function(e){return this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase()),this.attributes.getNamedItem(e)},"getAttributeNode"),setAttribute:h(function(e,t){this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());var r=this.getAttributeNode(e);r?r.value=r.nodeValue=""+t:(r=this.ownerDocument._createAttribute(e),r.value=r.nodeValue=""+t,this.setAttributeNode(r));},"setAttribute"),removeAttribute:h(function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t);},"removeAttribute"),setAttributeNode:h(function(e){return this.attributes.setNamedItem(e)},"setAttributeNode"),setAttributeNodeNS:h(function(e){return this.attributes.setNamedItemNS(e)},"setAttributeNodeNS"),removeAttributeNode:h(function(e){return this.attributes.removeNamedItem(e.nodeName)},"removeAttributeNode"),removeAttributeNS:h(function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r);},"removeAttributeNS"),hasAttributeNS:h(function(e,t){return this.getAttributeNodeNS(e,t)!=null},"hasAttributeNS"),getAttributeNS:h(function(e,t){var r=this.getAttributeNodeNS(e,t);return r?r.value:null},"getAttributeNS"),setAttributeNS:h(function(e,t,r){var n=Dn(e,t),a=n[2],i=this.getAttributeNodeNS(e,a);i?i.value=i.nodeValue=""+r:(i=this.ownerDocument.createAttributeNS(e,t),i.value=i.nodeValue=""+r,this.setAttributeNode(i));},"setAttributeNS"),getAttributeNodeNS:h(function(e,t){return this.attributes.getNamedItemNS(e,t)},"getAttributeNodeNS"),getElementsByClassName:h(function(e){var t=Ti(e);return new Re(this,function(r){var n=[];return t.length>0&&Nr(r,function(a){if(a!==r&&a.nodeType===Ce){var i=a.getAttribute("class");if(i){var o=e===i;if(!o){var s=Ti(i);o=t.every(lu(s));}o&&n.push(a);}}}),n})},"getElementsByClassName"),getElementsByTagName:h(function(e){var t=(this.nodeType===Et?this:this.ownerDocument).type==="html",r=e.toLowerCase();return new Re(this,function(n){var a=[];return Nr(n,function(i){if(!(i===n||i.nodeType!==Ce))if(e==="*")a.push(i);else {var o=i.getQualifiedName(),s=t&&i.namespaceURI===Fe.HTML?r:e;o===s&&a.push(i);}}),a})},"getElementsByTagName"),getElementsByTagNameNS:h(function(e,t){return new Re(this,function(r){var n=[];return Nr(r,function(a){a!==r&&a.nodeType===Ce&&(e==="*"||a.namespaceURI===e)&&(t==="*"||a.localName==t)&&n.push(a);}),n})},"getElementsByTagNameNS")};je.prototype.getElementsByClassName=We.prototype.getElementsByClassName;je.prototype.getElementsByTagName=We.prototype.getElementsByTagName;je.prototype.getElementsByTagNameNS=We.prototype.getElementsByTagNameNS;we(We,G);function st(e){_e(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null;}h(st,"Attr");st.prototype.nodeType=Dt;we(st,G);function Ct(e){_e(e);}h(Ct,"CharacterData");Ct.prototype={data:"",substringData:h(function(e,t){return this.data.substring(e,e+t)},"substringData"),appendData:h(function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length;},"appendData"),insertData:h(function(e,t){this.replaceData(e,0,t);},"insertData"),deleteData:h(function(e,t){this.replaceData(e,t,"");},"deleteData"),replaceData:h(function(e,t,r){var n=this.data.substring(0,e),a=this.data.substring(e+t);r=n+r+a,this.nodeValue=this.data=r,this.length=r.length;},"replaceData")};we(Ct,G);function ar(e){_e(e);}h(ar,"Text");ar.prototype={nodeName:"#text",nodeType:Cr,splitText:h(function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n},"splitText")};we(ar,Ct);function Sr(e){_e(e);}h(Sr,"Comment");Sr.prototype={nodeName:"#comment",nodeType:Nn};we(Sr,Ct);function Ir(e){_e(e);}h(Ir,"CDATASection");Ir.prototype={nodeName:"#cdata-section",nodeType:Bi};we(Ir,ar);function kr(e){_e(e);}h(kr,"DocumentType");kr.prototype.nodeType=Li;we(kr,G);function Cn(e){_e(e);}h(Cn,"Notation");Cn.prototype.nodeType=fu;we(Cn,G);function xn(e){_e(e);}h(xn,"Entity");xn.prototype.nodeType=cu;we(xn,G);function Or(e){_e(e);}h(Or,"EntityReference");Or.prototype.nodeType=Fi;we(Or,G);function xt(e){_e(e);}h(xt,"DocumentFragment");xt.prototype.nodeName="#document-fragment";xt.prototype.nodeType=Xe;we(xt,G);function Pr(e){_e(e);}h(Pr,"ProcessingInstruction");Pr.prototype.nodeType=An;we(Pr,Ct);function Yi(){}h(Yi,"XMLSerializer");Yi.prototype.serializeToString=function(e,t){return Xi.call(e,t)};G.prototype.toString=Xi;function Xi(e){var t;typeof e=="function"?t={requireWellFormed:false,splitCDATASections:true,nodeFilter:e}:e!=null?t={requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==false,nodeFilter:e.nodeFilter||null}:t={requireWellFormed:false,splitCDATASections:true,nodeFilter:null};var r=[],n=this.nodeType===Et&&this.documentElement||this,a=n.prefix,i=n.namespaceURI;if(i&&a==null){var a=n.lookupPrefix(i);if(a==null)var o=[{namespace:i,prefix:null}];}return Tn(this,r,o,t),r.join("")}h(Xi,"nodeSerializeToString");function Pi(e,t,r){var n=e.prefix||"",a=e.namespaceURI;if(!a||n==="xml"&&a===Fe.XML||a===Fe.XMLNS)return false;for(var i=r.length;i--;){var o=r[i];if(o.prefix===n)return o.namespace!==a}return true}h(Pi,"needNamespaceDefine");function Ar(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,zi),'"');}h(Ar,"addSerializedAttribute");function Tn(e,t,r,n){r||(r=[]);var a=n.nodeFilter,i=n.requireWellFormed,o=n.splitCDATASections,s=e.nodeType===Et?e:e.ownerDocument,l=s.type==="html";he(e,{ns:r},{enter:h(function(u,c){var f=c.ns;if(a)if(u=a(u),u){if(typeof u=="string")return t.push(u),null}else return null;switch(u.nodeType){case Ce:var d=u.attributes,p=d.length,m=u.tagName,g=m;if(!l&&!u.prefix&&u.namespaceURI){for(var E,v=0;v<d.length;v++)if(d.item(v).name==="xmlns"){E=d.item(v).value;break}if(!E)for(var w=f.length-1;w>=0;w--){var b=f[w];if(b.prefix===""&&b.namespace===u.namespaceURI){E=b.namespace;break}}if(E!==u.namespaceURI)for(var w=f.length-1;w>=0;w--){var b=f[w];if(b.namespace===u.namespaceURI){b.prefix&&(g=b.prefix+":"+m);break}}}t.push("<",g);for(var _=f.slice(),D=0;D<p;D++){var y=d.item(D);y.prefix=="xmlns"?_.push({prefix:y.localName,namespace:y.value}):y.nodeName=="xmlns"&&_.push({prefix:"",namespace:y.value});}for(var D=0;D<p;D++){var y=d.item(D);if(Pi(y,l,_)){var A=y.prefix||"",N=y.namespaceURI;Ar(t,A?"xmlns:"+A:"xmlns",N),_.push({prefix:A,namespace:N});}var C=a?a(y):y;C&&(typeof C=="string"?t.push(C):Ar(t,C.name,C.value));}if(m===g&&Pi(u,l,_)){var M=u.prefix||"",N=u.namespaceURI;Ar(t,M?"xmlns:"+M:"xmlns",N),_.push({prefix:M,namespace:N});}var T=!u.firstChild;if(T&&(l||u.namespaceURI===Fe.HTML)&&(T=au(m)),T)return t.push("/>"),null;if(t.push(">"),l&&iu(m)){for(var R=u.firstChild;R;)R.data?t.push(R.data):Tn(R,t,_.slice(),n),R=R.nextSibling;return t.push("</",g,">"),null}return {ns:_,tag:g};case Et:case Xe:if(i&&u.nodeType===Et&&u.documentElement==null)throw new O("The Document has no documentElement",Ne.InvalidStateError);return {ns:f};case Dt:return Ar(t,u.name,u.value),null;case Cr:if(i&&fe.InvalidChar.test(u.data))throw new O("The Text node data contains characters outside the XML Char production",Ne.InvalidStateError);return t.push(u.data.replace(/[<&>]/g,zi)),null;case Bi:if(i&&u.data.indexOf("]]>")!==-1)throw new O('The CDATASection data contains "]]>"',Ne.InvalidStateError);return o?t.push(fe.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),fe.CDATA_END):t.push(fe.CDATA_START,u.data,fe.CDATA_END),null;case Nn:if(i){if(fe.InvalidChar.test(u.data))throw new O("The comment node data contains characters outside the XML Char production",Ne.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new O('The comment node data contains "--" or ends with "-"',Ne.InvalidStateError)}return t.push(fe.COMMENT_START,u.data,fe.COMMENT_END),null;case Li:var F=u.publicId,I=u.systemId;if(i){if(F&&!fe.PubidLiteral_match.test(F))throw new O("DocumentType publicId is not a valid PubidLiteral",Ne.InvalidStateError);if(I&&I!=="."&&!fe.SystemLiteral_match.test(I))throw new O("DocumentType systemId is not a valid SystemLiteral",Ne.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new O('DocumentType internalSubset contains "]>"',Ne.InvalidStateError)}return t.push(fe.DOCTYPE_DECL_START," ",u.name),F?(t.push(" ",fe.PUBLIC," ",F),I&&I!=="."&&t.push(" ",I)):I&&I!=="."&&t.push(" ",fe.SYSTEM," ",I),u.internalSubset&&t.push(" [",u.internalSubset,"]"),t.push(">"),null;case An:if(i){if(u.target.indexOf(":")!==-1||u.target.toLowerCase()==="xml")throw new O("The ProcessingInstruction target is not well-formed",Ne.InvalidStateError);if(fe.InvalidChar.test(u.data))throw new O("The ProcessingInstruction data contains characters outside the XML Char production",Ne.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new O('The ProcessingInstruction data contains "?>"',Ne.InvalidStateError)}return t.push("<?",u.target," ",u.data,"?>"),null;case Fi:return t.push("&",u.nodeName,";"),null;default:return t.push("??",u.nodeName),null}},"enter"),exit:h(function(u,c){c&&c.tag&&t.push("</",c.tag,">");},"exit")});}h(Tn,"serializeToString");function wu(e,t,r){var n;return he(t,null,{enter:h(function(a,i){var o=a.cloneNode(false);o.ownerDocument=e,o.parentNode=null,i===null?n=o:i.appendChild(o);var s=a.nodeType===Dt||r;return s?o:null},"enter")}),n}h(wu,"importNode");function Qi(e,t,r){var n;return he(t,null,{enter:h(function(a,i){var o=new a.constructor(pe);for(var s in a)if(bt(a,s)){var l=a[s];typeof l!="object"&&l!=o[s]&&(o[s]=l);}a.childNodes&&(o.childNodes=new se),o.ownerDocument=e;var u=r;switch(o.nodeType){case Ce:var c=a.attributes,f=o.attributes=new At,d=c.length;f._ownerElement=o;for(var p=0;p<d;p++)o.setAttributeNode(Qi(e,c.item(p),true));break;case Dt:u=true;}return i!==null?i.appendChild(o):n=o,u?o:null},"enter")}),n}h(Qi,"cloneNode");function Ji(e,t,r){e[t]=r;}h(Ji,"__set__");function bn(e){for(var t=[],r=e.firstChild;r;)r.nodeType===Ce&&t.push(r),r=r.nextSibling;return t}h(bn,"childrenRefresh");try{Object.defineProperty&&(Object.defineProperty(Re.prototype,"length",{get:h(function(){return Tr(this),this.$$length},"get")}),Object.defineProperty(G.prototype,"textContent",{get:h(function(){if(this.nodeType===Ce||this.nodeType===Xe){var e=[];return he(this,null,{enter:h(function(t){if(t.nodeType===Ce||t.nodeType===Xe)return !0;if(t.nodeType===An||t.nodeType===Nn)return null;e.push(t.nodeValue);},"enter")}),e.join("")}return this.nodeValue},"get"),set:h(function(e){switch(this.nodeType){case Ce:case Xe:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e;}},"set")}),Object.defineProperty(We.prototype,"children",{get:h(function(){return new Re(this,bn)},"get")}),Object.defineProperty(je.prototype,"children",{get:h(function(){return new Re(this,bn)},"get")}),Object.defineProperty(xt.prototype,"children",{get:h(function(){return new Re(this,bn)},"get")}),Ji=h(function(e,t,r){e["$$"+t]=r;},"__set__"));}catch{}ae._updateLiveList=Tr;ae.Attr=st;ae.CDATASection=Ir;ae.CharacterData=Ct;ae.Comment=Sr;ae.Document=je;ae.DocumentFragment=xt;ae.DocumentType=kr;ae.DOMImplementation=qi;ae.Element=We;ae.Entity=xn;ae.EntityReference=Or;ae.LiveNodeList=Re;ae.NamedNodeMap=At;ae.Node=G;ae.NodeList=se;ae.Notation=Cn;ae.Text=ar;ae.ProcessingInstruction=Pr;ae.walkDOM=he;ae.XMLSerializer=Yi;});var Ki=Oe(or=>{var Zi=ot().freeze;or.XML_ENTITIES=Zi({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});or.HTML_ENTITIES=Zi({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
2
|
+
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});or.entityMap=or.HTML_ENTITIES;});var ca=Oe(Rr=>{var kt=ot(),z=En(),ia=Zt(),vu=kt.isHTMLEscapableRawTextElement,yu=kt.isHTMLMimeType,Eu=kt.isHTMLRawTextElement,cr=kt.hasOwn,ea=kt.NAMESPACE,ta=ia.ParseError,bu=ia.DOMException,sr=0,Je=1,Tt=2,ur=3,St=4,It=5,lr=6,Mr=7;function aa(){}h(aa,"XMLReader");aa.prototype={parse:h(function(e,t,r){var n=this.domBuilder;n.startDocument(),oa(t,t=Object.create(null)),Du(e,t,r,n,this.errorHandler),n.endDocument();},"parse")};var In=/&#?\w+;?/g;function Du(e,t,r,n,a){var i=yu(n.mimeType);e.indexOf(z.UNICODE_REPLACEMENT_CHARACTER)>=0&&a.warning("Unicode replacement character detected, source encoding issues?");function o(k){if(k>65535){k-=65536;var W=55296+(k>>10),Q=56320+(k&1023);return String.fromCharCode(W,Q)}else return String.fromCharCode(k)}h(o,"fixedFromCharCode");function s(k){var W=k[k.length-1]===";"?k:k+";";if(!i&&W!==k)return a.error("EntityRef: expecting ;"),k;var Q=z.Reference.exec(W);if(!Q||Q[0].length!==W.length)return a.error("entity not matching Reference production: "+k),k;var oe=W.slice(1,-1);return cr(r,oe)?r[oe]:oe.charAt(0)==="#"?o(parseInt(oe.substring(1).replace("x","0x"))):(a.error("entity not found:"+k),k)}h(s,"entityReplacer");function l(k){if(k>E){var W=e.substring(E,k).replace(In,s);d&&p(E),n.characters(W,0,k-E),E=k;}}h(l,"appendText");var u=0,c=0,f=/\r\n?|\n|$/g,d=n.locator;function p(k,W){for(;k>=c&&(W=f.exec(e));)u=c,c=W.index+W[0].length,d.lineNumber++;d.columnNumber=k-u+1;}h(p,"position");for(var m=[{currentNSMap:t}],g=[],E=0;;){try{var v=e.indexOf("<",E);if(v<0){if(!i&&g.length>0)return a.fatalError("unclosed xml tag(s): "+g.join(", "));if(!e.substring(E).match(/^\s*$/)){var w=n.doc,b=w.createTextNode(e.substring(E));if(w.documentElement)return a.error("Extra content at the end of the document");w.appendChild(b),n.currentElement=b;}return}if(v>E){var _=e.substring(E,v);!i&&g.length===0&&(_=_.replace(new RegExp(z.S_OPT.source,"g"),""),_&&a.error("Unexpected content outside root element: '"+_+"'")),l(v);}switch(e.charAt(v+1)){case "/":var I=e.indexOf(">",v+2),D=e.substring(v+2,I>0?I:void 0);if(!D)return a.fatalError("end tag name missing");var y=I>0&&z.reg("^",z.QName_group,z.S_OPT,"$").exec(D);if(!y)return a.fatalError('end tag name contains invalid characters: "'+D+'"');if(!n.currentElement&&!n.doc.documentElement)return;var A=g[g.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(A!==y[1]){var N=y[1].toLowerCase();if(!i||A.toLowerCase()!==N)return a.fatalError('Opening and ending tag mismatch: "'+A+'" != "'+D+'"')}var C=m.pop();g.pop();var M=C.localNSMap;if(n.endElement(C.uri,C.localName,A),M)for(var T in M)cr(M,T)&&n.endPrefixMapping(T);I++;break;case "?":d&&p(v),I=xu(e,v,n,a);break;case "!":d&&p(v),I=ua(e,v,n,a,i);break;default:d&&p(v);var R=new la,F=m[m.length-1].currentNSMap,I=Au(e,v,R,F,s,a,i),V=R.length;if(R.closed||(i&&kt.isHTMLVoidElement(R.tagName)?R.closed=!0:g.push(R.tagName)),d&&V){for(var U=ra(d,{}),B=0;B<V;B++){var L=R[B];p(L.offset),L.locator=ra(d,{});}n.locator=U,na(R,n,F)&&m.push(R),n.locator=d;}else na(R,n,F)&&m.push(R);i&&!R.closed?I=Nu(e,I,R.tagName,s,n):I++;}}catch(k){if(k instanceof ta)throw k;if(k instanceof bu)throw new ta(k.name+": "+k.message,n.locator,k);a.error("element parse error: "+k),I=-1;}I>E?E=I:l(Math.max(v,E)+1);}}h(Du,"parse");function ra(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}h(ra,"copyLocator");function Au(e,t,r,n,a,i,o){function s(p,m,g){if(cr(r.attributeNames,p))return i.fatalError("Attribute "+p+" redefined");if(!o&&m.indexOf("<")>=0)return i.fatalError("Unescaped '<' not allowed in attributes values");r.addValue(p,m.replace(/[\t\n\r]/g," ").replace(In,a),g);}h(s,"addAttribute");for(var l,u,c=++t,f=sr;;){var d=e.charAt(c);switch(d){case "=":if(f===Je)l=e.slice(t,c),f=ur;else if(f===Tt)f=ur;else throw new Error("attribute equal must after attrName");break;case "'":case '"':if(f===ur||f===Je)if(f===Je&&(i.warning('attribute value must after "="'),l=e.slice(t,c)),t=c+1,c=e.indexOf(d,t),c>0)u=e.slice(t,c),s(l,u,t-1),f=It;else throw new Error("attribute value no end '"+d+"' match");else if(f==St)u=e.slice(t,c),s(l,u,t),i.warning('attribute "'+l+'" missed start quot('+d+")!!"),t=c+1,f=It;else throw new Error('attribute value must after "="');break;case "/":switch(f){case sr:r.setTagName(e.slice(t,c));case It:case lr:case Mr:f=Mr,r.closed=true;case St:case Je:break;case Tt:r.closed=true;break;default:throw new Error("attribute invalid close char('/')")}break;case "":return i.error("unexpected end of input"),f==sr&&r.setTagName(e.slice(t,c)),c;case ">":switch(f){case sr:r.setTagName(e.slice(t,c));case It:case lr:case Mr:break;case St:case Je:u=e.slice(t,c),u.slice(-1)==="/"&&(r.closed=true,u=u.slice(0,-1));case Tt:f===Tt&&(u=l),f==St?(i.warning('attribute "'+u+'" missed quot(")!'),s(l,u,t)):(o||i.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),s(u,u,t));break;case ur:if(!o)return i.fatalError(`AttValue: ' or " expected`)}return c;case "\x80":d=" ";default:if(d<=" ")switch(f){case sr:r.setTagName(e.slice(t,c)),f=lr;break;case Je:l=e.slice(t,c),f=Tt;break;case St:var u=e.slice(t,c);i.warning('attribute "'+u+'" missed quot(")!!'),s(l,u,t);case It:f=lr;break}else switch(f){case Tt:o||i.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),s(l,l,t),t=c,f=Je;break;case It:i.warning('attribute space is required"'+l+'"!!');case lr:f=Je,t=c;break;case ur:f=St,t=c;break;case Mr:throw new Error("elements closed character '/' and '>' must be connected to")}}c++;}}h(Au,"parseElementStartPart");function na(e,t,r){for(var n=e.tagName,a=null,f=e.length;f--;){var i=e[f],o=i.qName,s=i.value,d=o.indexOf(":");if(d>0)var l=i.prefix=o.slice(0,d),u=o.slice(d+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";i.localName=u,c!==false&&(a==null&&(a=Object.create(null),oa(r,r=Object.create(null))),r[c]=a[c]=s,i.uri=ea.XMLNS,t.startPrefixMapping(c,s));}for(var f=e.length;f--;)i=e[f],i.prefix&&(i.prefix==="xml"&&(i.uri=ea.XML),i.prefix!=="xmlns"&&(i.uri=r[i.prefix]));var d=n.indexOf(":");d>0?(l=e.prefix=n.slice(0,d),u=e.localName=n.slice(d+1)):(l=null,u=e.localName=n);var p=e.uri=r[l||""];if(t.startElement(p,u,n,e),e.closed){if(t.endElement(p,u,n),a)for(l in a)cr(a,l)&&t.endPrefixMapping(l);}else return e.currentNSMap=r,e.localNSMap=a,true}h(na,"appendElement");function Nu(e,t,r,n,a){var i=vu(r);if(i||Eu(r)){var o=e.indexOf("</"+r+">",t),s=e.substring(t+1,o);return i&&(s=s.replace(In,n)),a.characters(s,0,s.length),o}return t+1}h(Nu,"parseHtmlSpecialContent");function oa(e,t){for(var r in e)cr(e,r)&&(t[r]=e[r]);}h(oa,"_copy");function sa(e,t){var r=t;function n(c){return c=c||0,e.charAt(r+c)}h(n,"char");function a(c){c=c||1,r+=c;}h(a,"skip");function i(){for(var c=0;r<e.length;){var f=n();if(f!==" "&&f!==`
|
|
3
3
|
`&&f!==" "&&f!=="\r")return c;c++,a();}return -1}h(i,"skipBlanks");function o(){return e.substring(r)}h(o,"substringFromIndex");function s(c){return e.substring(r,r+c.length)===c}h(s,"substringStartsWith");function l(c){return e.substring(r,r+c.length).toUpperCase()===c.toUpperCase()}h(l,"substringStartsWithCaseInsensitive");function u(c){var f=z.reg("^",c),d=f.exec(o());return d?(a(d[0].length),d[0]):null}return h(u,"getMatch"),{char:n,getIndex:h(function(){return r},"getIndex"),getMatch:u,getSource:h(function(){return e},"getSource"),skip:a,skipBlanks:i,substringFromIndex:o,substringStartsWith:s,substringStartsWithCaseInsensitive:l}}h(sa,"parseUtils");function Cu(e,t){function r(s,l){var u=z.PI.exec(s.substringFromIndex());return u?u[1].toLowerCase()==="xml"?l.fatalError("xml declaration is only allowed at the start of the document, but found at position "+s.getIndex()):(s.skip(u[0].length),u[0]):l.fatalError("processing instruction is not well-formed at position "+s.getIndex())}h(r,"parsePI");var n=e.getSource();if(e.char()==="["){e.skip(1);for(var a=e.getIndex();e.getIndex()<n.length;){if(e.skipBlanks(),e.char()==="]"){var i=n.substring(a,e.getIndex());return e.skip(1),i}var o=null;if(e.char()==="<"&&e.char(1)==="!")switch(e.char(2)){case "E":e.char(3)==="L"?o=e.getMatch(z.elementdecl):e.char(3)==="N"&&(o=e.getMatch(z.EntityDecl));break;case "A":o=e.getMatch(z.AttlistDecl);break;case "N":o=e.getMatch(z.NotationDecl);break;case "-":o=e.getMatch(z.Comment);break}else if(e.char()==="<"&&e.char(1)==="?")o=r(e,t);else if(e.char()==="%")o=e.getMatch(z.PEReference);else return t.fatalError("Error detected in Markup declaration");if(!o)return t.fatalError("Error in internal subset at position "+e.getIndex())}return t.fatalError("doctype internal subset is not well-formed, missing ]")}}h(Cu,"parseDoctypeInternalSubset");function ua(e,t,r,n,a){var i=sa(e,t);switch(a?i.char(2).toUpperCase():i.char(2)){case "-":var o=i.getMatch(z.Comment);return o?(r.comment(o,z.COMMENT_START.length,o.length-z.COMMENT_START.length-z.COMMENT_END.length),i.getIndex()):n.fatalError("comment is not well-formed at position "+i.getIndex());case "[":var s=i.getMatch(z.CDSect);return s?!a&&!r.currentElement?n.fatalError("CDATA outside of element"):(r.startCDATA(),r.characters(s,z.CDATA_START.length,s.length-z.CDATA_START.length-z.CDATA_END.length),r.endCDATA(),i.getIndex()):n.fatalError("Invalid CDATA starting at position "+t);case "D":{if(r.doc&&r.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+i.getIndex());if(a?!i.substringStartsWithCaseInsensitive(z.DOCTYPE_DECL_START):!i.substringStartsWith(z.DOCTYPE_DECL_START))return n.fatalError("Expected "+z.DOCTYPE_DECL_START+" at position "+i.getIndex());if(i.skip(z.DOCTYPE_DECL_START.length),i.skipBlanks()<1)return n.fatalError("Expected whitespace after "+z.DOCTYPE_DECL_START+" at position "+i.getIndex());var l={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(l.name=i.getMatch(z.Name),!l.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+i.getIndex());if(a&&l.name.toLowerCase()!=="html"&&n.warning("Unexpected DOCTYPE in HTML document at position "+i.getIndex()),i.skipBlanks(),i.substringStartsWith(z.PUBLIC)||i.substringStartsWith(z.SYSTEM)){var u=z.ExternalID_match.exec(i.substringFromIndex());if(!u)return n.fatalError("doctype external id is not well-formed at position "+i.getIndex());u.groups.SystemLiteralOnly!==void 0?l.systemId=u.groups.SystemLiteralOnly:(l.systemId=u.groups.SystemLiteral,l.publicId=u.groups.PubidLiteral),i.skip(u[0].length);}else if(a&&i.substringStartsWithCaseInsensitive(z.SYSTEM)){if(i.skip(z.SYSTEM.length),i.skipBlanks()<1)return n.fatalError("Expected whitespace after "+z.SYSTEM+" at position "+i.getIndex());if(l.systemId=i.getMatch(z.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return n.fatalError("Expected "+z.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+z.SYSTEM+" at position "+i.getIndex())}return a&&l.systemId&&!z.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+i.getIndex()),a||(i.skipBlanks(),l.internalSubset=Cu(i,n)),i.skipBlanks(),i.char()!==">"?n.fatalError("doctype not terminated with > at position "+i.getIndex()):(i.skip(1),r.startDTD(l.name,l.publicId,l.systemId,l.internalSubset),r.endDTD(),i.getIndex())}default:return n.fatalError('Not well-formed XML starting with "<!" at position '+t)}}h(ua,"parseDoctypeCommentOrCData");function xu(e,t,r,n){var a=e.substring(t).match(z.PI);if(!a)return n.fatalError("Invalid processing instruction starting at position "+t);if(a[1].toLowerCase()==="xml"){if(t>0)return n.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!z.XMLDecl.test(e.substring(t)))return n.fatalError("xml declaration is not well-formed")}return r.processingInstruction(a[1],a[2]),t+a[0].length}h(xu,"parseProcessingInstruction");function la(){this.attributeNames=Object.create(null);}h(la,"ElementAttributes");la.prototype={setTagName:h(function(e){if(!z.QName_exact.test(e))throw new Error("invalid tagName:"+e);this.tagName=e;},"setTagName"),addValue:h(function(e,t,r){if(!z.QName_exact.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r};},"addValue"),length:0,getLocalName:h(function(e){return this[e].localName},"getLocalName"),getLocator:h(function(e){return this[e].locator},"getLocator"),getQName:h(function(e){return this[e].qName},"getQName"),getURI:h(function(e){return this[e].uri},"getURI"),getValue:h(function(e){return this[e].value},"getValue")};Rr.XMLReader=aa;Rr.parseUtils=sa;Rr.parseDoctypeCommentOrCData=ua;});var _a=Oe(Pt=>{var ut=ot(),Tu=Sn(),Su=Zt(),fa=Ki(),Iu=ca(),ku=Tu.DOMImplementation,Ou=ut.hasDefaultHTMLNamespace,Pu=ut.isHTMLMimeType,Mu=ut.isValidMimeType,pa=ut.MIME_TYPE,kn=ut.NAMESPACE,ha=Su.ParseError,Ru=Iu.XMLReader;function ma(e){return e.replace(/\r[\n\u0085]/g,`
|
|
4
4
|
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
5
|
-
`)}h(ma,"normalizeLineEndings");function ga(e){if(e=e||{},e.locator===void 0&&(e.locator=true),this.assign=e.assign||ut.assign,this.domHandler=e.domHandler||Fr,this.onError=e.onError||e.errorHandler,e.errorHandler&&typeof e.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");e.errorHandler&&e.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=e.normalizeLineEndings||ma,this.locator=!!e.locator,this.xmlns=this.assign(Object.create(null),e.xmlns);}h(ga,"DOMParser");ga.prototype.parseFromString=function(e,t){if(!Mu(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var r=this.assign(Object.create(null),this.xmlns),n=fa.XML_ENTITIES,a=r[""]||null;Ou(t)?(n=fa.HTML_ENTITIES,a=kn.HTML):t===pa.XML_SVG_IMAGE&&(a=kn.SVG),r[""]=a,r.xml=r.xml||kn.XML;var i=new this.domHandler({mimeType:t,defaultNamespace:a,onError:this.onError}),o=this.locator?{}:void 0;this.locator&&i.setDocumentLocator(o);var s=new Ru;s.errorHandler=i,s.domBuilder=i;var l=!ut.isHTMLMimeType(t);return l&&typeof e!="string"&&s.errorHandler.fatalError("source is not a string"),s.parse(this.normalizeLineEndings(String(e)),r,n),i.doc.documentElement||s.errorHandler.fatalError("missing root element"),i.doc};function Fr(e){var t=e||{};this.mimeType=t.mimeType||pa.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=false,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError;}h(Fr,"DOMHandler");function Ot(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber;}h(Ot,"position");Fr.prototype={startDocument:h(function(){var e=new ku;this.doc=Pu(this.mimeType)?e.createHTMLDocument(false):e.createDocument(this.defaultNamespace,"");},"startDocument"),startElement:h(function(e,t,r,n){var a=this.doc,i=a.createElementNS(e,r||t),o=n.length;Br(this,i),this.currentElement=i,this.locator&&Ot(this.locator,i);for(var s=0;s<o;s++){var e=n.getURI(s),l=n.getValue(s),r=n.getQName(s),u=a.createAttributeNS(e,r);this.locator&&Ot(n.getLocator(s),u),u.value=u.nodeValue=l,i.setAttributeNode(u);}},"startElement"),endElement:h(function(e,t,r){this.currentElement=this.currentElement.parentNode;},"endElement"),startPrefixMapping:h(function(e,t){},"startPrefixMapping"),endPrefixMapping:h(function(e){},"endPrefixMapping"),processingInstruction:h(function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&Ot(this.locator,r),Br(this,r);},"processingInstruction"),ignorableWhitespace:h(function(e,t,r){},"ignorableWhitespace"),characters:h(function(e,t,r){if(e=da.apply(this,arguments),e){if(this.cdata)var n=this.doc.createCDATASection(e);else var n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&Ot(this.locator,n);}},"characters"),skippedEntity:h(function(e){},"skippedEntity"),endDocument:h(function(){this.doc.normalize();},"endDocument"),setDocumentLocator:h(function(e){e&&(e.lineNumber=0),this.locator=e;},"setDocumentLocator"),comment:h(function(e,t,r){e=da.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Ot(this.locator,n),Br(this,n);},"comment"),startCDATA:h(function(){this.cdata=true;},"startCDATA"),endCDATA:h(function(){this.cdata=false;},"endCDATA"),startDTD:h(function(e,t,r,n){var a=this.doc.implementation;if(a&&a.createDocumentType){var i=a.createDocumentType(e,t,r,n);this.locator&&Ot(this.locator,i),Br(this,i),this.doc.doctype=i;}},"startDTD"),reportError:h(function(e,t){if(typeof this.onError=="function")try{this.onError(e,t,this);}catch(r){throw new ha("Reporting "+e+' "'+t+'" caused '+r,this.locator)}},"reportError"),warning:h(function(e){this.reportError("warning",e);},"warning"),error:h(function(e){this.reportError("error",e);},"error"),fatalError:h(function(e){throw this.reportError("fatalError",e),new ha(e,this.locator)},"fatalError")};function da(e,t,r){return typeof e=="string"?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}h(da,"_toString");"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){Fr.prototype[e]=function(){return null};});function Br(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t);}h(Br,"appendElement");function Bu(e){if(e==="error")throw "onErrorStopParsing"}h(Bu,"onErrorStopParsing");function Fu(){throw "onWarningStopParsing"}h(Fu,"onWarningStopParsing");Pt.__DOMHandler=Fr;Pt.DOMParser=ga;Pt.normalizeLineEndings=ma;Pt.onErrorStopParsing=Bu;Pt.onWarningStopParsing=Fu;});var wa=Oe(Y=>{var Mt=ot();Y.assign=Mt.assign;Y.hasDefaultHTMLNamespace=Mt.hasDefaultHTMLNamespace;Y.isHTMLMimeType=Mt.isHTMLMimeType;Y.isValidMimeType=Mt.isValidMimeType;Y.MIME_TYPE=Mt.MIME_TYPE;Y.NAMESPACE=Mt.NAMESPACE;var Lr=Zt();Y.DOMException=Lr.DOMException;Y.DOMExceptionName=Lr.DOMExceptionName;Y.ExceptionCode=Lr.ExceptionCode;Y.ParseError=Lr.ParseError;var ue=Sn();Y.Attr=ue.Attr;Y.CDATASection=ue.CDATASection;Y.CharacterData=ue.CharacterData;Y.Comment=ue.Comment;Y.Document=ue.Document;Y.DocumentFragment=ue.DocumentFragment;Y.DocumentType=ue.DocumentType;Y.DOMImplementation=ue.DOMImplementation;Y.Element=ue.Element;Y.Entity=ue.Entity;Y.EntityReference=ue.EntityReference;Y.LiveNodeList=ue.LiveNodeList;Y.NamedNodeMap=ue.NamedNodeMap;Y.Node=ue.Node;Y.NodeList=ue.NodeList;Y.Notation=ue.Notation;Y.ProcessingInstruction=ue.ProcessingInstruction;Y.Text=ue.Text;Y.XMLSerializer=ue.XMLSerializer;var $r=_a();Y.DOMParser=$r.DOMParser;Y.normalizeLineEndings=$r.normalizeLineEndings;Y.onErrorStopParsing=$r.onErrorStopParsing;Y.onWarningStopParsing=$r.onWarningStopParsing;});var va=Oe((jc,Rt)=>{var x=h(function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32;},"diff_match_patch"),Z=-1,K=1,j=0;x.Diff=function(e,t){return [e,t]};x.prototype.diff_main=function(e,t,r,n){typeof n>"u"&&(this.Diff_Timeout<=0?n=Number.MAX_VALUE:n=new Date().getTime()+this.Diff_Timeout*1e3);var a=n;if(e==null||t==null)throw new Error("Null input. (diff_main)");if(e==t)return e?[new x.Diff(j,e)]:[];typeof r>"u"&&(r=true);var i=r,o=this.diff_commonPrefix(e,t),s=e.substring(0,o);e=e.substring(o),t=t.substring(o),o=this.diff_commonSuffix(e,t);var l=e.substring(e.length-o);e=e.substring(0,e.length-o),t=t.substring(0,t.length-o);var u=this.diff_compute_(e,t,i,a);return s&&u.unshift(new x.Diff(j,s)),l&&u.push(new x.Diff(j,l)),this.diff_cleanupMerge(u),u};x.prototype.diff_compute_=function(e,t,r,n){var a;if(!e)return [new x.Diff(K,t)];if(!t)return [new x.Diff(Z,e)];var i=e.length>t.length?e:t,o=e.length>t.length?t:e,s=i.indexOf(o);if(s!=-1)return a=[new x.Diff(K,i.substring(0,s)),new x.Diff(j,o),new x.Diff(K,i.substring(s+o.length))],e.length>t.length&&(a[0][0]=a[2][0]=Z),a;if(o.length==1)return [new x.Diff(Z,e),new x.Diff(K,t)];var l=this.diff_halfMatch_(e,t);if(l){var u=l[0],c=l[1],f=l[2],d=l[3],p=l[4],m=this.diff_main(u,f,r,n),g=this.diff_main(c,d,r,n);return m.concat([new x.Diff(j,p)],g)}return r&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,n):this.diff_bisect_(e,t,n)};x.prototype.diff_lineMode_=function(e,t,r){var n=this.diff_linesToChars_(e,t);e=n.chars1,t=n.chars2;var a=n.lineArray,i=this.diff_main(e,t,false,r);this.diff_charsToLines_(i,a),this.diff_cleanupSemantic(i),i.push(new x.Diff(j,""));for(var o=0,s=0,l=0,u="",c="";o<i.length;){switch(i[o][0]){case K:l++,c+=i[o][1];break;case Z:s++,u+=i[o][1];break;case j:if(s>=1&&l>=1){i.splice(o-s-l,s+l),o=o-s-l;for(var f=this.diff_main(u,c,false,r),d=f.length-1;d>=0;d--)i.splice(o,0,f[d]);o=o+f.length;}l=0,s=0,u="",c="";break}o++;}return i.pop(),i};x.prototype.diff_bisect_=function(e,t,r){for(var n=e.length,a=t.length,i=Math.ceil((n+a)/2),o=i,s=2*i,l=new Array(s),u=new Array(s),c=0;c<s;c++)l[c]=-1,u[c]=-1;l[o+1]=0,u[o+1]=0;for(var f=n-a,d=f%2!=0,p=0,m=0,g=0,
|
|
6
|
-
`,c),f==-1&&(f=l.length-1);var p=l.substring(c,f+1);(n.hasOwnProperty?n.hasOwnProperty(p):n[p]!==void 0)?u+=String.fromCharCode(n[p]):(d==i&&(p=l.substring(c),f=l.length),u+=String.fromCharCode(d),n[p]=d,r[d++]=p),c=f+1;}return u}h(a,"diff_linesToCharsMunge_");var i=4e4,o=a(e);i=65535;var s=a(t);return {chars1:o,chars2:s,lineArray:r}};x.prototype.diff_charsToLines_=function(e,t){for(var r=0;r<e.length;r++){for(var n=e[r][1],a=[],i=0;i<n.length;i++)a[i]=t[n.charCodeAt(i)];e[r][1]=a.join("");}};x.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var r=0,n=Math.min(e.length,t.length),a=n,i=0;r<a;)e.substring(i,a)==t.substring(i,a)?(r=a,i=r):n=a,a=Math.floor((n-r)/2+r);return a};x.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var r=0,n=Math.min(e.length,t.length),a=n,i=0;r<a;)e.substring(e.length-a,e.length-i)==t.substring(t.length-a,t.length-i)?(r=a,i=r):n=a,a=Math.floor((n-r)/2+r);return a};x.prototype.diff_commonOverlap_=function(e,t){var r=e.length,n=t.length;if(r==0||n==0)return 0;r>n?e=e.substring(r-n):r<n&&(t=t.substring(0,r));var a=Math.min(r,n);if(e==t)return a;for(var i=0,o=1;;){var s=e.substring(a-o),l=t.indexOf(s);if(l==-1)return i;o+=l,(l==0||e.substring(a-o)==t.substring(0,o))&&(i=o,o++);}};x.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var r=e.length>t.length?e:t,n=e.length>t.length?t:e;if(r.length<4||n.length*2<r.length)return null;var a=this;function i(m,g,b){for(var v=m.substring(b,b+Math.floor(m.length/4)),w=-1,E="",_,D,y,A;(w=g.indexOf(v,w+1))!=-1;){var N=a.diff_commonPrefix(m.substring(b),g.substring(w)),C=a.diff_commonSuffix(m.substring(0,b),g.substring(0,w));E.length<C+N&&(E=g.substring(w-C,w)+g.substring(w,w+N),_=m.substring(0,b-C),D=m.substring(b+N),y=g.substring(0,w-C),A=g.substring(w+N));}return E.length*2>=m.length?[_,D,y,A,E]:null}h(i,"diff_halfMatchI_");var o=i(r,n,Math.ceil(r.length/4)),s=i(r,n,Math.ceil(r.length/2)),l;if(!o&&!s)return null;s?o?l=o[4].length>s[4].length?o:s:l=s:l=o;var u,c,f,d;e.length>t.length?(u=l[0],c=l[1],f=l[2],d=l[3]):(f=l[0],d=l[1],u=l[2],c=l[3]);var p=l[4];return [u,c,f,d,p]};x.prototype.diff_cleanupSemantic=function(e){for(var t=false,r=[],n=0,a=null,i=0,o=0,s=0,l=0,u=0;i<e.length;)e[i][0]==j?(r[n++]=i,o=l,s=u,l=0,u=0,a=e[i][1]):(e[i][0]==K?l+=e[i][1].length:u+=e[i][1].length,a&&a.length<=Math.max(o,s)&&a.length<=Math.max(l,u)&&(e.splice(r[n-1],0,new x.Diff(Z,a)),e[r[n-1]+1][0]=K,n--,n--,i=n>0?r[n-1]:-1,o=0,s=0,l=0,u=0,a=null,t=true)),i++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),i=1;i<e.length;){if(e[i-1][0]==Z&&e[i][0]==K){var c=e[i-1][1],f=e[i][1],d=this.diff_commonOverlap_(c,f),p=this.diff_commonOverlap_(f,c);d>=p?(d>=c.length/2||d>=f.length/2)&&(e.splice(i,0,new x.Diff(j,f.substring(0,d))),e[i-1][1]=c.substring(0,c.length-d),e[i+1][1]=f.substring(d),i++):(p>=c.length/2||p>=f.length/2)&&(e.splice(i,0,new x.Diff(j,c.substring(0,p))),e[i-1][0]=K,e[i-1][1]=f.substring(0,f.length-p),e[i+1][0]=Z,e[i+1][1]=c.substring(p),i++),i++;}i++;}};x.prototype.diff_cleanupSemanticLossless=function(e){function t(p,m){if(!p||!m)return 6;var g=p.charAt(p.length-1),b=m.charAt(0),v=g.match(x.nonAlphaNumericRegex_),w=b.match(x.nonAlphaNumericRegex_),E=v&&g.match(x.whitespaceRegex_),_=w&&b.match(x.whitespaceRegex_),D=E&&g.match(x.linebreakRegex_),y=_&&b.match(x.linebreakRegex_),A=D&&p.match(x.blanklineEndRegex_),N=y&&m.match(x.blanklineStartRegex_);return A||N?5:D||y?4:v&&!E&&_?3:E||_?2:v||w?1:0}h(t,"diff_cleanupSemanticScore_");for(var r=1;r<e.length-1;){if(e[r-1][0]==j&&e[r+1][0]==j){var n=e[r-1][1],a=e[r][1],i=e[r+1][1],o=this.diff_commonSuffix(n,a);if(o){var s=a.substring(a.length-o);n=n.substring(0,n.length-o),a=s+a.substring(0,a.length-o),i=s+i;}for(var l=n,u=a,c=i,f=t(n,a)+t(a,i);a.charAt(0)===i.charAt(0);){n+=a.charAt(0),a=a.substring(1)+i.charAt(0),i=i.substring(1);var d=t(n,a)+t(a,i);d>=f&&(f=d,l=n,u=a,c=i);}e[r-1][1]!=l&&(l?e[r-1][1]=l:(e.splice(r-1,1),r--),e[r][1]=u,c?e[r+1][1]=c:(e.splice(r+1,1),r--));}r++;}};x.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;x.whitespaceRegex_=/\s/;x.linebreakRegex_=/[\r\n]/;x.blanklineEndRegex_=/\n\r?\n$/;x.blanklineStartRegex_=/^\r?\n\r?\n/;x.prototype.diff_cleanupEfficiency=function(e){for(var t=false,r=[],n=0,a=null,i=0,o=false,s=false,l=false,u=false;i<e.length;)e[i][0]==j?(e[i][1].length<this.Diff_EditCost&&(l||u)?(r[n++]=i,o=l,s=u,a=e[i][1]):(n=0,a=null),l=u=false):(e[i][0]==Z?u=true:l=true,a&&(o&&s&&l&&u||a.length<this.Diff_EditCost/2&&o+s+l+u==3)&&(e.splice(r[n-1],0,new x.Diff(Z,a)),e[r[n-1]+1][0]=K,n--,a=null,o&&s?(l=u=true,n=0):(n--,i=n>0?r[n-1]:-1,l=u=false),t=true)),i++;t&&this.diff_cleanupMerge(e);};x.prototype.diff_cleanupMerge=function(e){e.push(new x.Diff(j,""));for(var t=0,r=0,n=0,a="",i="",o;t<e.length;)switch(e[t][0]){case K:n++,i+=e[t][1],t++;break;case Z:r++,a+=e[t][1],t++;break;case j:r+n>1?(r!==0&&n!==0&&(o=this.diff_commonPrefix(i,a),o!==0&&(t-r-n>0&&e[t-r-n-1][0]==j?e[t-r-n-1][1]+=i.substring(0,o):(e.splice(0,0,new x.Diff(j,i.substring(0,o))),t++),i=i.substring(o),a=a.substring(o)),o=this.diff_commonSuffix(i,a),o!==0&&(e[t][1]=i.substring(i.length-o)+e[t][1],i=i.substring(0,i.length-o),a=a.substring(0,a.length-o))),t-=r+n,e.splice(t,r+n),a.length&&(e.splice(t,0,new x.Diff(Z,a)),t++),i.length&&(e.splice(t,0,new x.Diff(K,i)),t++),t++):t!==0&&e[t-1][0]==j?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,n=0,r=0,a="",i="";break}e[e.length-1][1]===""&&e.pop();var s=false;for(t=1;t<e.length-1;)e[t-1][0]==j&&e[t+1][0]==j&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),s=true):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),s=true)),t++;s&&this.diff_cleanupMerge(e);};x.prototype.diff_xIndex=function(e,t){var r=0,n=0,a=0,i=0,o;for(o=0;o<e.length&&(e[o][0]!==K&&(r+=e[o][1].length),e[o][0]!==Z&&(n+=e[o][1].length),!(r>t));o++)a=r,i=n;return e.length!=o&&e[o][0]===Z?i:i+(t-a)};x.prototype.diff_prettyHtml=function(e){for(var t=[],r=/&/g,n=/</g,a=/>/g,i=/\n/g,o=0;o<e.length;o++){var s=e[o][0],l=e[o][1],u=l.replace(r,"&").replace(n,"<").replace(a,">").replace(i,"¶<br>");switch(s){case K:t[o]='<ins style="background:#e6ffe6;">'+u+"</ins>";break;case Z:t[o]='<del style="background:#ffe6e6;">'+u+"</del>";break;case j:t[o]="<span>"+u+"</span>";break}}return t.join("")};x.prototype.diff_text1=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==K&&(t[r]=e[r][1]);return t.join("")};x.prototype.diff_text2=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==Z&&(t[r]=e[r][1]);return t.join("")};x.prototype.diff_levenshtein=function(e){for(var t=0,r=0,n=0,a=0;a<e.length;a++){var i=e[a][0],o=e[a][1];switch(i){case K:r+=o.length;break;case Z:n+=o.length;break;case j:t+=Math.max(r,n),r=0,n=0;break}}return t+=Math.max(r,n),t};x.prototype.diff_toDelta=function(e){for(var t=[],r=0;r<e.length;r++)switch(e[r][0]){case K:t[r]="+"+encodeURI(e[r][1]);break;case Z:t[r]="-"+e[r][1].length;break;case j:t[r]="="+e[r][1].length;break}return t.join(" ").replace(/%20/g," ")};x.prototype.diff_fromDelta=function(e,t){for(var r=[],n=0,a=0,i=t.split(/\t/g),o=0;o<i.length;o++){var s=i[o].substring(1);switch(i[o].charAt(0)){case "+":try{r[n++]=new x.Diff(K,decodeURI(s));}catch{throw new Error("Illegal escape in diff_fromDelta: "+s)}break;case "-":case "=":var l=parseInt(s,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+s);var u=e.substring(a,a+=l);i[o].charAt(0)=="="?r[n++]=new x.Diff(j,u):r[n++]=new x.Diff(Z,u);break;default:if(i[o])throw new Error("Invalid diff operation in diff_fromDelta: "+i[o])}}if(a!=e.length)throw new Error("Delta length ("+a+") does not equal source text length ("+e.length+").");return r};x.prototype.match_main=function(e,t,r){if(e==null||t==null||r==null)throw new Error("Null input. (match_main)");return r=Math.max(0,Math.min(r,e.length)),e==t?0:e.length?e.substring(r,r+t.length)==t?r:this.match_bitap_(e,t,r):-1};x.prototype.match_bitap_=function(e,t,r){if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var n=this.match_alphabet_(t),a=this;function i(_,D){var y=_/t.length,A=Math.abs(r-D);return a.Match_Distance?y+A/a.Match_Distance:A?1:y}h(i,"match_bitapScore_");var o=this.Match_Threshold,s=e.indexOf(t,r);s!=-1&&(o=Math.min(i(0,s),o),s=e.lastIndexOf(t,r+t.length),s!=-1&&(o=Math.min(i(0,s),o)));var l=1<<t.length-1;s=-1;for(var u,c,f=t.length+e.length,d,p=0;p<t.length;p++){for(u=0,c=f;u<c;)i(p,r+c)<=o?u=c:f=c,c=Math.floor((f-u)/2+u);f=c;var m=Math.max(1,r-c+1),g=Math.min(r+c,e.length)+t.length,b=Array(g+2);b[g+1]=(1<<p)-1;for(var v=g;v>=m;v--){var w=n[e.charAt(v-1)];if(p===0?b[v]=(b[v+1]<<1|1)&w:b[v]=(b[v+1]<<1|1)&w|((d[v+1]|d[v])<<1|1)|d[v+1],b[v]&l){var E=i(p,v-1);if(E<=o)if(o=E,s=v-1,s>r)m=Math.max(1,2*r-s);else break}}if(i(p+1,r)>o)break;d=b;}return s};x.prototype.match_alphabet_=function(e){for(var t={},r=0;r<e.length;r++)t[e.charAt(r)]=0;for(var r=0;r<e.length;r++)t[e.charAt(r)]|=1<<e.length-r-1;return t};x.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error("patch not initialized");for(var r=t.substring(e.start2,e.start2+e.length1),n=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)n+=this.Patch_Margin,r=t.substring(e.start2-n,e.start2+e.length1+n);n+=this.Patch_Margin;var a=t.substring(e.start2-n,e.start2);a&&e.diffs.unshift(new x.Diff(j,a));var i=t.substring(e.start2+e.length1,e.start2+e.length1+n);i&&e.diffs.push(new x.Diff(j,i)),e.start1-=a.length,e.start2-=a.length,e.length1+=a.length+i.length,e.length2+=a.length+i.length;}};x.prototype.patch_make=function(e,t,r){var n,a;if(typeof e=="string"&&typeof t=="string"&&typeof r>"u")n=e,a=this.diff_main(n,t,true),a.length>2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(e&&typeof e=="object"&&typeof t>"u"&&typeof r>"u")a=e,n=this.diff_text1(a);else if(typeof e=="string"&&t&&typeof t=="object"&&typeof r>"u")n=e,a=t;else if(typeof e=="string"&&typeof t=="string"&&r&&typeof r=="object")n=e,a=r;else throw new Error("Unknown call format to patch_make.");if(a.length===0)return [];for(var i=[],o=new x.patch_obj,s=0,l=0,u=0,c=n,f=n,d=0;d<a.length;d++){var p=a[d][0],m=a[d][1];switch(!s&&p!==j&&(o.start1=l,o.start2=u),p){case K:o.diffs[s++]=a[d],o.length2+=m.length,f=f.substring(0,u)+m+f.substring(u);break;case Z:o.length1+=m.length,o.diffs[s++]=a[d],f=f.substring(0,u)+f.substring(u+m.length);break;case j:m.length<=2*this.Patch_Margin&&s&&a.length!=d+1?(o.diffs[s++]=a[d],o.length1+=m.length,o.length2+=m.length):m.length>=2*this.Patch_Margin&&s&&(this.patch_addContext_(o,c),i.push(o),o=new x.patch_obj,s=0,c=f,l=u);break}p!==K&&(l+=m.length),p!==Z&&(u+=m.length);}return s&&(this.patch_addContext_(o,c),i.push(o)),i};x.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],a=new x.patch_obj;a.diffs=[];for(var i=0;i<n.diffs.length;i++)a.diffs[i]=new x.Diff(n.diffs[i][0],n.diffs[i][1]);a.start1=n.start1,a.start2=n.start2,a.length1=n.length1,a.length2=n.length2,t[r]=a;}return t};x.prototype.patch_apply=function(e,t){if(e.length==0)return [t,[]];e=this.patch_deepCopy(e);var r=this.patch_addPadding(e);t=r+t+r,this.patch_splitMax(e);for(var n=0,a=[],i=0;i<e.length;i++){var o=e[i].start2+n,s=this.diff_text1(e[i].diffs),l,u=-1;if(s.length>this.Match_MaxBits?(l=this.match_main(t,s.substring(0,this.Match_MaxBits),o),l!=-1&&(u=this.match_main(t,s.substring(s.length-this.Match_MaxBits),o+s.length-this.Match_MaxBits),(u==-1||l>=u)&&(l=-1))):l=this.match_main(t,s,o),l==-1)a[i]=false,n-=e[i].length2-e[i].length1;else {a[i]=true,n=l-o;var c;if(u==-1?c=t.substring(l,l+s.length):c=t.substring(l,u+this.Match_MaxBits),s==c)t=t.substring(0,l)+this.diff_text2(e[i].diffs)+t.substring(l+s.length);else {var f=this.diff_main(s,c,false);if(s.length>this.Match_MaxBits&&this.diff_levenshtein(f)/s.length>this.Patch_DeleteThreshold)a[i]=false;else {this.diff_cleanupSemanticLossless(f);for(var d=0,p,m=0;m<e[i].diffs.length;m++){var g=e[i].diffs[m];g[0]!==j&&(p=this.diff_xIndex(f,d)),g[0]===K?t=t.substring(0,l+p)+g[1]+t.substring(l+p):g[0]===Z&&(t=t.substring(0,l+p)+t.substring(l+this.diff_xIndex(f,d+g[1].length))),g[0]!==Z&&(d+=g[1].length);}}}}}return t=t.substring(r.length,t.length-r.length),[t,a]};x.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r="",n=1;n<=t;n++)r+=String.fromCharCode(n);for(var n=0;n<e.length;n++)e[n].start1+=t,e[n].start2+=t;var a=e[0],i=a.diffs;if(i.length==0||i[0][0]!=j)i.unshift(new x.Diff(j,r)),a.start1-=t,a.start2-=t,a.length1+=t,a.length2+=t;else if(t>i[0][1].length){var o=t-i[0][1].length;i[0][1]=r.substring(i[0][1].length)+i[0][1],a.start1-=o,a.start2-=o,a.length1+=o,a.length2+=o;}if(a=e[e.length-1],i=a.diffs,i.length==0||i[i.length-1][0]!=j)i.push(new x.Diff(j,r)),a.length1+=t,a.length2+=t;else if(t>i[i.length-1][1].length){var o=t-i[i.length-1][1].length;i[i.length-1][1]+=r.substring(0,o),a.length1+=o,a.length2+=o;}return r};x.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,r=0;r<e.length;r++)if(!(e[r].length1<=t)){var n=e[r];e.splice(r--,1);for(var a=n.start1,i=n.start2,o="";n.diffs.length!==0;){var s=new x.patch_obj,l=true;for(s.start1=a-o.length,s.start2=i-o.length,o!==""&&(s.length1=s.length2=o.length,s.diffs.push(new x.Diff(j,o)));n.diffs.length!==0&&s.length1<t-this.Patch_Margin;){var u=n.diffs[0][0],c=n.diffs[0][1];u===K?(s.length2+=c.length,i+=c.length,s.diffs.push(n.diffs.shift()),l=false):u===Z&&s.diffs.length==1&&s.diffs[0][0]==j&&c.length>2*t?(s.length1+=c.length,a+=c.length,l=false,s.diffs.push(new x.Diff(u,c)),n.diffs.shift()):(c=c.substring(0,t-s.length1-this.Patch_Margin),s.length1+=c.length,a+=c.length,u===j?(s.length2+=c.length,i+=c.length):l=false,s.diffs.push(new x.Diff(u,c)),c==n.diffs[0][1]?n.diffs.shift():n.diffs[0][1]=n.diffs[0][1].substring(c.length));}o=this.diff_text2(s.diffs),o=o.substring(o.length-this.Patch_Margin);var f=this.diff_text1(n.diffs).substring(0,this.Patch_Margin);f!==""&&(s.length1+=f.length,s.length2+=f.length,s.diffs.length!==0&&s.diffs[s.diffs.length-1][0]===j?s.diffs[s.diffs.length-1][1]+=f:s.diffs.push(new x.Diff(j,f))),l||e.splice(++r,0,s);}}};x.prototype.patch_toText=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=e[r];return t.join("")};x.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var r=e.split(`
|
|
5
|
+
`)}h(ma,"normalizeLineEndings");function ga(e){if(e=e||{},e.locator===void 0&&(e.locator=true),this.assign=e.assign||ut.assign,this.domHandler=e.domHandler||Fr,this.onError=e.onError||e.errorHandler,e.errorHandler&&typeof e.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");e.errorHandler&&e.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=e.normalizeLineEndings||ma,this.locator=!!e.locator,this.xmlns=this.assign(Object.create(null),e.xmlns);}h(ga,"DOMParser");ga.prototype.parseFromString=function(e,t){if(!Mu(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var r=this.assign(Object.create(null),this.xmlns),n=fa.XML_ENTITIES,a=r[""]||null;Ou(t)?(n=fa.HTML_ENTITIES,a=kn.HTML):t===pa.XML_SVG_IMAGE&&(a=kn.SVG),r[""]=a,r.xml=r.xml||kn.XML;var i=new this.domHandler({mimeType:t,defaultNamespace:a,onError:this.onError}),o=this.locator?{}:void 0;this.locator&&i.setDocumentLocator(o);var s=new Ru;s.errorHandler=i,s.domBuilder=i;var l=!ut.isHTMLMimeType(t);return l&&typeof e!="string"&&s.errorHandler.fatalError("source is not a string"),s.parse(this.normalizeLineEndings(String(e)),r,n),i.doc.documentElement||s.errorHandler.fatalError("missing root element"),i.doc};function Fr(e){var t=e||{};this.mimeType=t.mimeType||pa.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=false,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError;}h(Fr,"DOMHandler");function Ot(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber;}h(Ot,"position");Fr.prototype={startDocument:h(function(){var e=new ku;this.doc=Pu(this.mimeType)?e.createHTMLDocument(false):e.createDocument(this.defaultNamespace,"");},"startDocument"),startElement:h(function(e,t,r,n){var a=this.doc,i=a.createElementNS(e,r||t),o=n.length;Br(this,i),this.currentElement=i,this.locator&&Ot(this.locator,i);for(var s=0;s<o;s++){var e=n.getURI(s),l=n.getValue(s),r=n.getQName(s),u=a.createAttributeNS(e,r);this.locator&&Ot(n.getLocator(s),u),u.value=u.nodeValue=l,i.setAttributeNode(u);}},"startElement"),endElement:h(function(e,t,r){this.currentElement=this.currentElement.parentNode;},"endElement"),startPrefixMapping:h(function(e,t){},"startPrefixMapping"),endPrefixMapping:h(function(e){},"endPrefixMapping"),processingInstruction:h(function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&Ot(this.locator,r),Br(this,r);},"processingInstruction"),ignorableWhitespace:h(function(e,t,r){},"ignorableWhitespace"),characters:h(function(e,t,r){if(e=da.apply(this,arguments),e){if(this.cdata)var n=this.doc.createCDATASection(e);else var n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&Ot(this.locator,n);}},"characters"),skippedEntity:h(function(e){},"skippedEntity"),endDocument:h(function(){this.doc.normalize();},"endDocument"),setDocumentLocator:h(function(e){e&&(e.lineNumber=0),this.locator=e;},"setDocumentLocator"),comment:h(function(e,t,r){e=da.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Ot(this.locator,n),Br(this,n);},"comment"),startCDATA:h(function(){this.cdata=true;},"startCDATA"),endCDATA:h(function(){this.cdata=false;},"endCDATA"),startDTD:h(function(e,t,r,n){var a=this.doc.implementation;if(a&&a.createDocumentType){var i=a.createDocumentType(e,t,r,n);this.locator&&Ot(this.locator,i),Br(this,i),this.doc.doctype=i;}},"startDTD"),reportError:h(function(e,t){if(typeof this.onError=="function")try{this.onError(e,t,this);}catch(r){throw new ha("Reporting "+e+' "'+t+'" caused '+r,this.locator)}},"reportError"),warning:h(function(e){this.reportError("warning",e);},"warning"),error:h(function(e){this.reportError("error",e);},"error"),fatalError:h(function(e){throw this.reportError("fatalError",e),new ha(e,this.locator)},"fatalError")};function da(e,t,r){return typeof e=="string"?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}h(da,"_toString");"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){Fr.prototype[e]=function(){return null};});function Br(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t);}h(Br,"appendElement");function Bu(e){if(e==="error")throw "onErrorStopParsing"}h(Bu,"onErrorStopParsing");function Fu(){throw "onWarningStopParsing"}h(Fu,"onWarningStopParsing");Pt.__DOMHandler=Fr;Pt.DOMParser=ga;Pt.normalizeLineEndings=ma;Pt.onErrorStopParsing=Bu;Pt.onWarningStopParsing=Fu;});var wa=Oe(Y=>{var Mt=ot();Y.assign=Mt.assign;Y.hasDefaultHTMLNamespace=Mt.hasDefaultHTMLNamespace;Y.isHTMLMimeType=Mt.isHTMLMimeType;Y.isValidMimeType=Mt.isValidMimeType;Y.MIME_TYPE=Mt.MIME_TYPE;Y.NAMESPACE=Mt.NAMESPACE;var Lr=Zt();Y.DOMException=Lr.DOMException;Y.DOMExceptionName=Lr.DOMExceptionName;Y.ExceptionCode=Lr.ExceptionCode;Y.ParseError=Lr.ParseError;var ue=Sn();Y.Attr=ue.Attr;Y.CDATASection=ue.CDATASection;Y.CharacterData=ue.CharacterData;Y.Comment=ue.Comment;Y.Document=ue.Document;Y.DocumentFragment=ue.DocumentFragment;Y.DocumentType=ue.DocumentType;Y.DOMImplementation=ue.DOMImplementation;Y.Element=ue.Element;Y.Entity=ue.Entity;Y.EntityReference=ue.EntityReference;Y.LiveNodeList=ue.LiveNodeList;Y.NamedNodeMap=ue.NamedNodeMap;Y.Node=ue.Node;Y.NodeList=ue.NodeList;Y.Notation=ue.Notation;Y.ProcessingInstruction=ue.ProcessingInstruction;Y.Text=ue.Text;Y.XMLSerializer=ue.XMLSerializer;var $r=_a();Y.DOMParser=$r.DOMParser;Y.normalizeLineEndings=$r.normalizeLineEndings;Y.onErrorStopParsing=$r.onErrorStopParsing;Y.onWarningStopParsing=$r.onWarningStopParsing;});var va=Oe((jc,Rt)=>{var x=h(function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32;},"diff_match_patch"),Z=-1,K=1,j=0;x.Diff=function(e,t){return [e,t]};x.prototype.diff_main=function(e,t,r,n){typeof n>"u"&&(this.Diff_Timeout<=0?n=Number.MAX_VALUE:n=new Date().getTime()+this.Diff_Timeout*1e3);var a=n;if(e==null||t==null)throw new Error("Null input. (diff_main)");if(e==t)return e?[new x.Diff(j,e)]:[];typeof r>"u"&&(r=true);var i=r,o=this.diff_commonPrefix(e,t),s=e.substring(0,o);e=e.substring(o),t=t.substring(o),o=this.diff_commonSuffix(e,t);var l=e.substring(e.length-o);e=e.substring(0,e.length-o),t=t.substring(0,t.length-o);var u=this.diff_compute_(e,t,i,a);return s&&u.unshift(new x.Diff(j,s)),l&&u.push(new x.Diff(j,l)),this.diff_cleanupMerge(u),u};x.prototype.diff_compute_=function(e,t,r,n){var a;if(!e)return [new x.Diff(K,t)];if(!t)return [new x.Diff(Z,e)];var i=e.length>t.length?e:t,o=e.length>t.length?t:e,s=i.indexOf(o);if(s!=-1)return a=[new x.Diff(K,i.substring(0,s)),new x.Diff(j,o),new x.Diff(K,i.substring(s+o.length))],e.length>t.length&&(a[0][0]=a[2][0]=Z),a;if(o.length==1)return [new x.Diff(Z,e),new x.Diff(K,t)];var l=this.diff_halfMatch_(e,t);if(l){var u=l[0],c=l[1],f=l[2],d=l[3],p=l[4],m=this.diff_main(u,f,r,n),g=this.diff_main(c,d,r,n);return m.concat([new x.Diff(j,p)],g)}return r&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,n):this.diff_bisect_(e,t,n)};x.prototype.diff_lineMode_=function(e,t,r){var n=this.diff_linesToChars_(e,t);e=n.chars1,t=n.chars2;var a=n.lineArray,i=this.diff_main(e,t,false,r);this.diff_charsToLines_(i,a),this.diff_cleanupSemantic(i),i.push(new x.Diff(j,""));for(var o=0,s=0,l=0,u="",c="";o<i.length;){switch(i[o][0]){case K:l++,c+=i[o][1];break;case Z:s++,u+=i[o][1];break;case j:if(s>=1&&l>=1){i.splice(o-s-l,s+l),o=o-s-l;for(var f=this.diff_main(u,c,false,r),d=f.length-1;d>=0;d--)i.splice(o,0,f[d]);o=o+f.length;}l=0,s=0,u="",c="";break}o++;}return i.pop(),i};x.prototype.diff_bisect_=function(e,t,r){for(var n=e.length,a=t.length,i=Math.ceil((n+a)/2),o=i,s=2*i,l=new Array(s),u=new Array(s),c=0;c<s;c++)l[c]=-1,u[c]=-1;l[o+1]=0,u[o+1]=0;for(var f=n-a,d=f%2!=0,p=0,m=0,g=0,E=0,v=0;v<i&&!(new Date().getTime()>r);v++){for(var w=-v+p;w<=v-m;w+=2){var b=o+w,_;w==-v||w!=v&&l[b-1]<l[b+1]?_=l[b+1]:_=l[b-1]+1;for(var D=_-w;_<n&&D<a&&e.charAt(_)==t.charAt(D);)_++,D++;if(l[b]=_,_>n)m+=2;else if(D>a)p+=2;else if(d){var y=o+f-w;if(y>=0&&y<s&&u[y]!=-1){var A=n-u[y];if(_>=A)return this.diff_bisectSplit_(e,t,_,D,r)}}}for(var N=-v+g;N<=v-E;N+=2){var y=o+N,A;N==-v||N!=v&&u[y-1]<u[y+1]?A=u[y+1]:A=u[y-1]+1;for(var C=A-N;A<n&&C<a&&e.charAt(n-A-1)==t.charAt(a-C-1);)A++,C++;if(u[y]=A,A>n)E+=2;else if(C>a)g+=2;else if(!d){var b=o+f-N;if(b>=0&&b<s&&l[b]!=-1){var _=l[b],D=o+_-b;if(A=n-A,_>=A)return this.diff_bisectSplit_(e,t,_,D,r)}}}}return [new x.Diff(Z,e),new x.Diff(K,t)]};x.prototype.diff_bisectSplit_=function(e,t,r,n,a){var i=e.substring(0,r),o=t.substring(0,n),s=e.substring(r),l=t.substring(n),u=this.diff_main(i,o,false,a),c=this.diff_main(s,l,false,a);return u.concat(c)};x.prototype.diff_linesToChars_=function(e,t){var r=[],n={};r[0]="";function a(l){for(var u="",c=0,f=-1,d=r.length;f<l.length-1;){f=l.indexOf(`
|
|
6
|
+
`,c),f==-1&&(f=l.length-1);var p=l.substring(c,f+1);(n.hasOwnProperty?n.hasOwnProperty(p):n[p]!==void 0)?u+=String.fromCharCode(n[p]):(d==i&&(p=l.substring(c),f=l.length),u+=String.fromCharCode(d),n[p]=d,r[d++]=p),c=f+1;}return u}h(a,"diff_linesToCharsMunge_");var i=4e4,o=a(e);i=65535;var s=a(t);return {chars1:o,chars2:s,lineArray:r}};x.prototype.diff_charsToLines_=function(e,t){for(var r=0;r<e.length;r++){for(var n=e[r][1],a=[],i=0;i<n.length;i++)a[i]=t[n.charCodeAt(i)];e[r][1]=a.join("");}};x.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var r=0,n=Math.min(e.length,t.length),a=n,i=0;r<a;)e.substring(i,a)==t.substring(i,a)?(r=a,i=r):n=a,a=Math.floor((n-r)/2+r);return a};x.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var r=0,n=Math.min(e.length,t.length),a=n,i=0;r<a;)e.substring(e.length-a,e.length-i)==t.substring(t.length-a,t.length-i)?(r=a,i=r):n=a,a=Math.floor((n-r)/2+r);return a};x.prototype.diff_commonOverlap_=function(e,t){var r=e.length,n=t.length;if(r==0||n==0)return 0;r>n?e=e.substring(r-n):r<n&&(t=t.substring(0,r));var a=Math.min(r,n);if(e==t)return a;for(var i=0,o=1;;){var s=e.substring(a-o),l=t.indexOf(s);if(l==-1)return i;o+=l,(l==0||e.substring(a-o)==t.substring(0,o))&&(i=o,o++);}};x.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var r=e.length>t.length?e:t,n=e.length>t.length?t:e;if(r.length<4||n.length*2<r.length)return null;var a=this;function i(m,g,E){for(var v=m.substring(E,E+Math.floor(m.length/4)),w=-1,b="",_,D,y,A;(w=g.indexOf(v,w+1))!=-1;){var N=a.diff_commonPrefix(m.substring(E),g.substring(w)),C=a.diff_commonSuffix(m.substring(0,E),g.substring(0,w));b.length<C+N&&(b=g.substring(w-C,w)+g.substring(w,w+N),_=m.substring(0,E-C),D=m.substring(E+N),y=g.substring(0,w-C),A=g.substring(w+N));}return b.length*2>=m.length?[_,D,y,A,b]:null}h(i,"diff_halfMatchI_");var o=i(r,n,Math.ceil(r.length/4)),s=i(r,n,Math.ceil(r.length/2)),l;if(!o&&!s)return null;s?o?l=o[4].length>s[4].length?o:s:l=s:l=o;var u,c,f,d;e.length>t.length?(u=l[0],c=l[1],f=l[2],d=l[3]):(f=l[0],d=l[1],u=l[2],c=l[3]);var p=l[4];return [u,c,f,d,p]};x.prototype.diff_cleanupSemantic=function(e){for(var t=false,r=[],n=0,a=null,i=0,o=0,s=0,l=0,u=0;i<e.length;)e[i][0]==j?(r[n++]=i,o=l,s=u,l=0,u=0,a=e[i][1]):(e[i][0]==K?l+=e[i][1].length:u+=e[i][1].length,a&&a.length<=Math.max(o,s)&&a.length<=Math.max(l,u)&&(e.splice(r[n-1],0,new x.Diff(Z,a)),e[r[n-1]+1][0]=K,n--,n--,i=n>0?r[n-1]:-1,o=0,s=0,l=0,u=0,a=null,t=true)),i++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),i=1;i<e.length;){if(e[i-1][0]==Z&&e[i][0]==K){var c=e[i-1][1],f=e[i][1],d=this.diff_commonOverlap_(c,f),p=this.diff_commonOverlap_(f,c);d>=p?(d>=c.length/2||d>=f.length/2)&&(e.splice(i,0,new x.Diff(j,f.substring(0,d))),e[i-1][1]=c.substring(0,c.length-d),e[i+1][1]=f.substring(d),i++):(p>=c.length/2||p>=f.length/2)&&(e.splice(i,0,new x.Diff(j,c.substring(0,p))),e[i-1][0]=K,e[i-1][1]=f.substring(0,f.length-p),e[i+1][0]=Z,e[i+1][1]=c.substring(p),i++),i++;}i++;}};x.prototype.diff_cleanupSemanticLossless=function(e){function t(p,m){if(!p||!m)return 6;var g=p.charAt(p.length-1),E=m.charAt(0),v=g.match(x.nonAlphaNumericRegex_),w=E.match(x.nonAlphaNumericRegex_),b=v&&g.match(x.whitespaceRegex_),_=w&&E.match(x.whitespaceRegex_),D=b&&g.match(x.linebreakRegex_),y=_&&E.match(x.linebreakRegex_),A=D&&p.match(x.blanklineEndRegex_),N=y&&m.match(x.blanklineStartRegex_);return A||N?5:D||y?4:v&&!b&&_?3:b||_?2:v||w?1:0}h(t,"diff_cleanupSemanticScore_");for(var r=1;r<e.length-1;){if(e[r-1][0]==j&&e[r+1][0]==j){var n=e[r-1][1],a=e[r][1],i=e[r+1][1],o=this.diff_commonSuffix(n,a);if(o){var s=a.substring(a.length-o);n=n.substring(0,n.length-o),a=s+a.substring(0,a.length-o),i=s+i;}for(var l=n,u=a,c=i,f=t(n,a)+t(a,i);a.charAt(0)===i.charAt(0);){n+=a.charAt(0),a=a.substring(1)+i.charAt(0),i=i.substring(1);var d=t(n,a)+t(a,i);d>=f&&(f=d,l=n,u=a,c=i);}e[r-1][1]!=l&&(l?e[r-1][1]=l:(e.splice(r-1,1),r--),e[r][1]=u,c?e[r+1][1]=c:(e.splice(r+1,1),r--));}r++;}};x.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;x.whitespaceRegex_=/\s/;x.linebreakRegex_=/[\r\n]/;x.blanklineEndRegex_=/\n\r?\n$/;x.blanklineStartRegex_=/^\r?\n\r?\n/;x.prototype.diff_cleanupEfficiency=function(e){for(var t=false,r=[],n=0,a=null,i=0,o=false,s=false,l=false,u=false;i<e.length;)e[i][0]==j?(e[i][1].length<this.Diff_EditCost&&(l||u)?(r[n++]=i,o=l,s=u,a=e[i][1]):(n=0,a=null),l=u=false):(e[i][0]==Z?u=true:l=true,a&&(o&&s&&l&&u||a.length<this.Diff_EditCost/2&&o+s+l+u==3)&&(e.splice(r[n-1],0,new x.Diff(Z,a)),e[r[n-1]+1][0]=K,n--,a=null,o&&s?(l=u=true,n=0):(n--,i=n>0?r[n-1]:-1,l=u=false),t=true)),i++;t&&this.diff_cleanupMerge(e);};x.prototype.diff_cleanupMerge=function(e){e.push(new x.Diff(j,""));for(var t=0,r=0,n=0,a="",i="",o;t<e.length;)switch(e[t][0]){case K:n++,i+=e[t][1],t++;break;case Z:r++,a+=e[t][1],t++;break;case j:r+n>1?(r!==0&&n!==0&&(o=this.diff_commonPrefix(i,a),o!==0&&(t-r-n>0&&e[t-r-n-1][0]==j?e[t-r-n-1][1]+=i.substring(0,o):(e.splice(0,0,new x.Diff(j,i.substring(0,o))),t++),i=i.substring(o),a=a.substring(o)),o=this.diff_commonSuffix(i,a),o!==0&&(e[t][1]=i.substring(i.length-o)+e[t][1],i=i.substring(0,i.length-o),a=a.substring(0,a.length-o))),t-=r+n,e.splice(t,r+n),a.length&&(e.splice(t,0,new x.Diff(Z,a)),t++),i.length&&(e.splice(t,0,new x.Diff(K,i)),t++),t++):t!==0&&e[t-1][0]==j?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,n=0,r=0,a="",i="";break}e[e.length-1][1]===""&&e.pop();var s=false;for(t=1;t<e.length-1;)e[t-1][0]==j&&e[t+1][0]==j&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),s=true):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),s=true)),t++;s&&this.diff_cleanupMerge(e);};x.prototype.diff_xIndex=function(e,t){var r=0,n=0,a=0,i=0,o;for(o=0;o<e.length&&(e[o][0]!==K&&(r+=e[o][1].length),e[o][0]!==Z&&(n+=e[o][1].length),!(r>t));o++)a=r,i=n;return e.length!=o&&e[o][0]===Z?i:i+(t-a)};x.prototype.diff_prettyHtml=function(e){for(var t=[],r=/&/g,n=/</g,a=/>/g,i=/\n/g,o=0;o<e.length;o++){var s=e[o][0],l=e[o][1],u=l.replace(r,"&").replace(n,"<").replace(a,">").replace(i,"¶<br>");switch(s){case K:t[o]='<ins style="background:#e6ffe6;">'+u+"</ins>";break;case Z:t[o]='<del style="background:#ffe6e6;">'+u+"</del>";break;case j:t[o]="<span>"+u+"</span>";break}}return t.join("")};x.prototype.diff_text1=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==K&&(t[r]=e[r][1]);return t.join("")};x.prototype.diff_text2=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==Z&&(t[r]=e[r][1]);return t.join("")};x.prototype.diff_levenshtein=function(e){for(var t=0,r=0,n=0,a=0;a<e.length;a++){var i=e[a][0],o=e[a][1];switch(i){case K:r+=o.length;break;case Z:n+=o.length;break;case j:t+=Math.max(r,n),r=0,n=0;break}}return t+=Math.max(r,n),t};x.prototype.diff_toDelta=function(e){for(var t=[],r=0;r<e.length;r++)switch(e[r][0]){case K:t[r]="+"+encodeURI(e[r][1]);break;case Z:t[r]="-"+e[r][1].length;break;case j:t[r]="="+e[r][1].length;break}return t.join(" ").replace(/%20/g," ")};x.prototype.diff_fromDelta=function(e,t){for(var r=[],n=0,a=0,i=t.split(/\t/g),o=0;o<i.length;o++){var s=i[o].substring(1);switch(i[o].charAt(0)){case "+":try{r[n++]=new x.Diff(K,decodeURI(s));}catch{throw new Error("Illegal escape in diff_fromDelta: "+s)}break;case "-":case "=":var l=parseInt(s,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+s);var u=e.substring(a,a+=l);i[o].charAt(0)=="="?r[n++]=new x.Diff(j,u):r[n++]=new x.Diff(Z,u);break;default:if(i[o])throw new Error("Invalid diff operation in diff_fromDelta: "+i[o])}}if(a!=e.length)throw new Error("Delta length ("+a+") does not equal source text length ("+e.length+").");return r};x.prototype.match_main=function(e,t,r){if(e==null||t==null||r==null)throw new Error("Null input. (match_main)");return r=Math.max(0,Math.min(r,e.length)),e==t?0:e.length?e.substring(r,r+t.length)==t?r:this.match_bitap_(e,t,r):-1};x.prototype.match_bitap_=function(e,t,r){if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var n=this.match_alphabet_(t),a=this;function i(_,D){var y=_/t.length,A=Math.abs(r-D);return a.Match_Distance?y+A/a.Match_Distance:A?1:y}h(i,"match_bitapScore_");var o=this.Match_Threshold,s=e.indexOf(t,r);s!=-1&&(o=Math.min(i(0,s),o),s=e.lastIndexOf(t,r+t.length),s!=-1&&(o=Math.min(i(0,s),o)));var l=1<<t.length-1;s=-1;for(var u,c,f=t.length+e.length,d,p=0;p<t.length;p++){for(u=0,c=f;u<c;)i(p,r+c)<=o?u=c:f=c,c=Math.floor((f-u)/2+u);f=c;var m=Math.max(1,r-c+1),g=Math.min(r+c,e.length)+t.length,E=Array(g+2);E[g+1]=(1<<p)-1;for(var v=g;v>=m;v--){var w=n[e.charAt(v-1)];if(p===0?E[v]=(E[v+1]<<1|1)&w:E[v]=(E[v+1]<<1|1)&w|((d[v+1]|d[v])<<1|1)|d[v+1],E[v]&l){var b=i(p,v-1);if(b<=o)if(o=b,s=v-1,s>r)m=Math.max(1,2*r-s);else break}}if(i(p+1,r)>o)break;d=E;}return s};x.prototype.match_alphabet_=function(e){for(var t={},r=0;r<e.length;r++)t[e.charAt(r)]=0;for(var r=0;r<e.length;r++)t[e.charAt(r)]|=1<<e.length-r-1;return t};x.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error("patch not initialized");for(var r=t.substring(e.start2,e.start2+e.length1),n=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)n+=this.Patch_Margin,r=t.substring(e.start2-n,e.start2+e.length1+n);n+=this.Patch_Margin;var a=t.substring(e.start2-n,e.start2);a&&e.diffs.unshift(new x.Diff(j,a));var i=t.substring(e.start2+e.length1,e.start2+e.length1+n);i&&e.diffs.push(new x.Diff(j,i)),e.start1-=a.length,e.start2-=a.length,e.length1+=a.length+i.length,e.length2+=a.length+i.length;}};x.prototype.patch_make=function(e,t,r){var n,a;if(typeof e=="string"&&typeof t=="string"&&typeof r>"u")n=e,a=this.diff_main(n,t,true),a.length>2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(e&&typeof e=="object"&&typeof t>"u"&&typeof r>"u")a=e,n=this.diff_text1(a);else if(typeof e=="string"&&t&&typeof t=="object"&&typeof r>"u")n=e,a=t;else if(typeof e=="string"&&typeof t=="string"&&r&&typeof r=="object")n=e,a=r;else throw new Error("Unknown call format to patch_make.");if(a.length===0)return [];for(var i=[],o=new x.patch_obj,s=0,l=0,u=0,c=n,f=n,d=0;d<a.length;d++){var p=a[d][0],m=a[d][1];switch(!s&&p!==j&&(o.start1=l,o.start2=u),p){case K:o.diffs[s++]=a[d],o.length2+=m.length,f=f.substring(0,u)+m+f.substring(u);break;case Z:o.length1+=m.length,o.diffs[s++]=a[d],f=f.substring(0,u)+f.substring(u+m.length);break;case j:m.length<=2*this.Patch_Margin&&s&&a.length!=d+1?(o.diffs[s++]=a[d],o.length1+=m.length,o.length2+=m.length):m.length>=2*this.Patch_Margin&&s&&(this.patch_addContext_(o,c),i.push(o),o=new x.patch_obj,s=0,c=f,l=u);break}p!==K&&(l+=m.length),p!==Z&&(u+=m.length);}return s&&(this.patch_addContext_(o,c),i.push(o)),i};x.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],a=new x.patch_obj;a.diffs=[];for(var i=0;i<n.diffs.length;i++)a.diffs[i]=new x.Diff(n.diffs[i][0],n.diffs[i][1]);a.start1=n.start1,a.start2=n.start2,a.length1=n.length1,a.length2=n.length2,t[r]=a;}return t};x.prototype.patch_apply=function(e,t){if(e.length==0)return [t,[]];e=this.patch_deepCopy(e);var r=this.patch_addPadding(e);t=r+t+r,this.patch_splitMax(e);for(var n=0,a=[],i=0;i<e.length;i++){var o=e[i].start2+n,s=this.diff_text1(e[i].diffs),l,u=-1;if(s.length>this.Match_MaxBits?(l=this.match_main(t,s.substring(0,this.Match_MaxBits),o),l!=-1&&(u=this.match_main(t,s.substring(s.length-this.Match_MaxBits),o+s.length-this.Match_MaxBits),(u==-1||l>=u)&&(l=-1))):l=this.match_main(t,s,o),l==-1)a[i]=false,n-=e[i].length2-e[i].length1;else {a[i]=true,n=l-o;var c;if(u==-1?c=t.substring(l,l+s.length):c=t.substring(l,u+this.Match_MaxBits),s==c)t=t.substring(0,l)+this.diff_text2(e[i].diffs)+t.substring(l+s.length);else {var f=this.diff_main(s,c,false);if(s.length>this.Match_MaxBits&&this.diff_levenshtein(f)/s.length>this.Patch_DeleteThreshold)a[i]=false;else {this.diff_cleanupSemanticLossless(f);for(var d=0,p,m=0;m<e[i].diffs.length;m++){var g=e[i].diffs[m];g[0]!==j&&(p=this.diff_xIndex(f,d)),g[0]===K?t=t.substring(0,l+p)+g[1]+t.substring(l+p):g[0]===Z&&(t=t.substring(0,l+p)+t.substring(l+this.diff_xIndex(f,d+g[1].length))),g[0]!==Z&&(d+=g[1].length);}}}}}return t=t.substring(r.length,t.length-r.length),[t,a]};x.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r="",n=1;n<=t;n++)r+=String.fromCharCode(n);for(var n=0;n<e.length;n++)e[n].start1+=t,e[n].start2+=t;var a=e[0],i=a.diffs;if(i.length==0||i[0][0]!=j)i.unshift(new x.Diff(j,r)),a.start1-=t,a.start2-=t,a.length1+=t,a.length2+=t;else if(t>i[0][1].length){var o=t-i[0][1].length;i[0][1]=r.substring(i[0][1].length)+i[0][1],a.start1-=o,a.start2-=o,a.length1+=o,a.length2+=o;}if(a=e[e.length-1],i=a.diffs,i.length==0||i[i.length-1][0]!=j)i.push(new x.Diff(j,r)),a.length1+=t,a.length2+=t;else if(t>i[i.length-1][1].length){var o=t-i[i.length-1][1].length;i[i.length-1][1]+=r.substring(0,o),a.length1+=o,a.length2+=o;}return r};x.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,r=0;r<e.length;r++)if(!(e[r].length1<=t)){var n=e[r];e.splice(r--,1);for(var a=n.start1,i=n.start2,o="";n.diffs.length!==0;){var s=new x.patch_obj,l=true;for(s.start1=a-o.length,s.start2=i-o.length,o!==""&&(s.length1=s.length2=o.length,s.diffs.push(new x.Diff(j,o)));n.diffs.length!==0&&s.length1<t-this.Patch_Margin;){var u=n.diffs[0][0],c=n.diffs[0][1];u===K?(s.length2+=c.length,i+=c.length,s.diffs.push(n.diffs.shift()),l=false):u===Z&&s.diffs.length==1&&s.diffs[0][0]==j&&c.length>2*t?(s.length1+=c.length,a+=c.length,l=false,s.diffs.push(new x.Diff(u,c)),n.diffs.shift()):(c=c.substring(0,t-s.length1-this.Patch_Margin),s.length1+=c.length,a+=c.length,u===j?(s.length2+=c.length,i+=c.length):l=false,s.diffs.push(new x.Diff(u,c)),c==n.diffs[0][1]?n.diffs.shift():n.diffs[0][1]=n.diffs[0][1].substring(c.length));}o=this.diff_text2(s.diffs),o=o.substring(o.length-this.Patch_Margin);var f=this.diff_text1(n.diffs).substring(0,this.Patch_Margin);f!==""&&(s.length1+=f.length,s.length2+=f.length,s.diffs.length!==0&&s.diffs[s.diffs.length-1][0]===j?s.diffs[s.diffs.length-1][1]+=f:s.diffs.push(new x.Diff(j,f))),l||e.splice(++r,0,s);}}};x.prototype.patch_toText=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=e[r];return t.join("")};x.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var r=e.split(`
|
|
7
7
|
`),n=0,a=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;n<r.length;){var i=r[n].match(a);if(!i)throw new Error("Invalid patch string: "+r[n]);var o=new x.patch_obj;for(t.push(o),o.start1=parseInt(i[1],10),i[2]===""?(o.start1--,o.length1=1):i[2]=="0"?o.length1=0:(o.start1--,o.length1=parseInt(i[2],10)),o.start2=parseInt(i[3],10),i[4]===""?(o.start2--,o.length2=1):i[4]=="0"?o.length2=0:(o.start2--,o.length2=parseInt(i[4],10)),n++;n<r.length;){var s=r[n].charAt(0);try{var l=decodeURI(r[n].substring(1));}catch{throw new Error("Illegal escape in patch_fromText: "+l)}if(s=="-")o.diffs.push(new x.Diff(Z,l));else if(s=="+")o.diffs.push(new x.Diff(K,l));else if(s==" ")o.diffs.push(new x.Diff(j,l));else {if(s=="@")break;if(s!=="")throw new Error('Invalid patch mode "'+s+'" in: '+l)}n++;}}return t};x.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0;};x.patch_obj.prototype.toString=function(){var e,t;this.length1===0?e=this.start1+",0":this.length1==1?e=this.start1+1:e=this.start1+1+","+this.length1,this.length2===0?t=this.start2+",0":this.length2==1?t=this.start2+1:t=this.start2+1+","+this.length2;for(var r=["@@ -"+e+" +"+t+` @@
|
|
8
8
|
`],n,a=0;a<this.diffs.length;a++){switch(this.diffs[a][0]){case K:n="+";break;case Z:n="-";break;case j:n=" ";break}r[a+1]=n+encodeURI(this.diffs[a][1])+`
|
|
9
9
|
`;}return r.join("").replace(/%20/g," ")};Rt.exports=x;Rt.exports.diff_match_patch=x;Rt.exports.DIFF_DELETE=Z;Rt.exports.DIFF_INSERT=K;Rt.exports.DIFF_EQUAL=j;});var it="application/vnd.openxmlformats-officedocument.wordprocessingml.document";function qn(e,t){return t.split(".").reduce((r,n)=>{if(r&&typeof r=="object")return r[n]},e)}h(qn,"getNestedProperty");async function Do(e,t){let r=this.getInputData()[e];if(!r.binary||!r.binary[t])throw new n8nWorkflow.NodeOperationError(this.getNode(),`No binary data found on property "${t}"`,{description:"Verify that the upstream node produced binary data and that the property name matches.",itemIndex:e});let n=r.binary[t],a=await this.helpers.getBinaryDataBuffer(e,t),i=n.fileName??"document.docx";return {buffer:a,fileName:i}}h(Do,"getDocxBuffer");async function Se(e,t){if(t.mode==="fromInput")return Do.call(this,e,t.binaryPropertyName);let{sourceNodeName:r,binaryPropertyName:n}=t,a="sourceBinaryId"in t?t.sourceBinaryId:void 0;if(a&&a.trim()!=="")try{let f=await this.helpers.getBinaryStream(a);return {buffer:await this.helpers.binaryToBuffer(f),fileName:"document.docx"}}catch(f){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:f.message},{message:`Failed to load document from Binary ID '${a}'.`,description:`The binary with ID '${a}' could not be loaded. This usually means the binary has expired, been garbage-collected, or the ID is incorrect.`,itemIndex:e})}if(!r||r.trim()==="")throw new n8nWorkflow.NodeApiError(this.getNode(),{message:"Source Node Name is empty"},{message:"Source Node Name is required when Document Source is 'From Another Node'.",description:"Set 'Source Node Name' to the exact name of the node in this workflow whose output holds the .docx binary (e.g. the trigger node). Node names are case-sensitive and must match the node label in the canvas exactly.",itemIndex:e});let i=r.replace(/'/g,"\\'"),o=`{{ $('${i}').first().binary.${n} }}`,s;try{s=this.evaluateExpression(o,e);}catch(f){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:f.message},{message:`Failed to resolve binary from source node '${r}'.`,description:`Could not evaluate '${o}'. Verify the source node name is exactly correct (case-sensitive, including spaces and punctuation). Underlying error: ${f.message}`,itemIndex:e})}if(s==null||typeof s!="object"){let f=`{{ $('${i}').first().json }}`,d;try{d=this.evaluateExpression(f,e);}catch{d=void 0;}if(d==null)throw new n8nWorkflow.NodeApiError(this.getNode(),{message:"Source node produced no output"},{message:`Source node '${r}' has no output.`,description:`The expression '${o}' resolved to undefined and the node appears not to have executed in this run. Verify that '${r}' is upstream of this Adeu node, that its name matches exactly (case-sensitive), and that it has run successfully.`,itemIndex:e});let p="";try{let m=this.evaluateExpression(`{{ Object.keys($('${i}').first().binary || {}) }}`,e);Array.isArray(m)&&m.length>0?p=` Available binary properties on '${r}': `+m.map(g=>`'${g}'`).join(", ")+".":Array.isArray(m)&&m.length===0&&(p=` Source node '${r}' has no binary properties at all.`);}catch{}throw new n8nWorkflow.NodeApiError(this.getNode(),{message:"Binary property not found"},{message:`Source node '${r}' has no binary on property '${n}'.`,description:`The expression '${o}' resolved to undefined.${p} Update 'Binary Property Name' to match an existing property, or change the source node so it outputs the .docx on the expected property.`,itemIndex:e})}let l=s,u;try{if(l.id){let f=await this.helpers.getBinaryStream(l.id);u=await this.helpers.binaryToBuffer(f);}else if(l.data)u=Buffer.from(l.data,"base64");else throw new Error("Resolved binary metadata has neither an 'id' nor 'data' field.")}catch(f){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:f.message},{message:`Failed to read binary content from source node '${r}'.`,description:`The binary metadata was found on property '${n}', but its contents could not be loaded. Underlying error: ${f.message}`,itemIndex:e})}let c=l.fileName??"document.docx";return {buffer:u,fileName:c}}h(Se,"getDocxBufferFromSource");function _r(e,t){let r=e.lastIndexOf(".");return `${r===-1?e:e.substring(0,r)}_${t}.docx`}h(_r,"buildOutputFileName");function zn(e,t,r){if(e==null||e==="")throw new n8nWorkflow.NodeOperationError(this.getNode(),`Parameter "${r}" is empty`,{description:`Provide a JSON value for "${r}".`,itemIndex:t});if(typeof e=="object")return e;let n=e.trim();n.startsWith("```")&&(n=n.replace(/^```[a-zA-Z]*\n?/,""),n=n.replace(/\n?```$/,"")),n=n.trim();try{return JSON.parse(n)}catch(a){throw new n8nWorkflow.NodeOperationError(this.getNode(),`Parameter "${r}" is not valid JSON`,{description:a.message,itemIndex:t})}}h(zn,"parseJsonParameter");function jn(e,t){let r=e.message??"Unknown error",n=e.name??"",a=e.errors,i=Array.isArray(a)?a.join(`
|
|
10
10
|
`):r,o=i.toLowerCase();if(n==="BatchValidationError"){let s="Batch validation failed.",l=`Review the listed failures:
|
|
11
11
|
`+i;return o.includes("target text not found")?(s="An edit could not be applied: target text not found.",l="Verify the exact `target_text` string \u2014 including punctuation and whitespace \u2014 against the document. Check the individual failures:\n"+i):o.includes("ambiguous match")?(s="An edit matched multiple locations in the document.",l="Provide more surrounding context in `target_text` to uniquely identify the location:\n"+i):o.includes("read-only")||o.includes("readonly")?(s="An edit targeted a read-only structural element.",l=`Cross-references, footnotes, hyperlinks, and the Structural Appendix cannot be modified via text replacement:
|
|
12
12
|
`+i):(o.includes("another author")||o.includes("nested"))&&(s="An edit overlaps with a pending tracked change by another author.",l=`Accept or reject the conflicting change first, or scope your edit outside of it:
|
|
13
|
-
`+i),new n8nWorkflow.NodeApiError(this.getNode(),{message:i,errors:a},{message:s,description:l,itemIndex:t})}return o.includes("invalid docx")||o.includes("missing word/document.xml")?new n8nWorkflow.NodeApiError(this.getNode(),{message:r},{message:"The document could not be opened.",description:"Verify the input binary is a valid .docx file (not .doc, .pdf, or another format).",itemIndex:t}):new n8nWorkflow.NodeApiError(this.getNode(),{message:r},{message:"Adeu engine error.",description:r,itemIndex:t})}h(jn,"mapAdeuErrorToNodeApiError");function Ao(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.id=="string"&&typeof t.fileName=="string"&&typeof t.mimeType=="string"}h(Ao,"isStashedBinaryEntry");var Hn=[{displayName:"Static Data Key",name:"staticDataKey",type:"string",default:"adeu_last_redlined",required:true,placeholder:"e.g. adeu_last_redlined",description:"Key in workflow global static data to read the stashed binary metadata from (string). When the Apply Edits operation runs as an AI Agent tool, n8n's tool wrapper strips the binary from its output before any downstream node can see it. To work around that, Apply Edits writes the binary's storage id into workflow static data under 'adeu_last_redlined'. This operation reads that entry back, fetches the original buffer via getBinaryStream, and attaches a fresh IBinaryData onto the outgoing item. Leave the default unless you've customized the stash key on the Apply Edits side.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the hydrated .docx (string, e.g. 'data'). Downstream nodes (e.g. Write Binary File, Gmail send) should be configured to read from this property name.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"On Missing",name:"onMissing",type:"options",default:"emit_empty",description:"What to do when no stashed binary entry is found under the configured key. 'Emit Empty' is the typical AI Agent path: emits an item with json.hydrated=false and no binary, so a downstream If node can gate any write step on whether the LLM actually called Apply Edits this turn. 'Throw' is for deterministic pipelines where the stash MUST be present and a missing entry indicates a workflow bug.",options:[{name:"Emit Empty",value:"emit_empty",description:"Emit a single item with json.hydrated=false and no binary. Downstream If on json.hydrated gates the write."},{name:"Throw",value:"throw",description:"Throw a NodeOperationError. Use when a missing stash indicates a workflow bug."}],displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Clear After Read",name:"clearAfterRead",type:"boolean",default:true,description:"Whether to delete the static data entry after a successful hydration so it does not leak across workflow runs. Set false if you want to inspect or re-read the entry from a later node in the same run.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Output Path Template",name:"outputPathTemplate",type:"string",default:"",placeholder:"e.g. C:\\Users\\Uzair\\.n8n-files\\{baseName}_{timestamp}.docx",description:"Optional template to compute the final write path on disk, returned on the output JSON as 'outputPath'. If set, you can configure downstream Write nodes to simply read '{{ $json.outputPath }}' with zero escaping risks. Supports these placeholders: '{baseName}' (filename with extension stripped), '{timestamp}' (current ISO 8601 timestamp with colons and dots replaced by dashes for Windows file compatibility), '{fileName}' (the stashed filename including extension), and '{ext}' (e.g., '.docx').",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}}];async function Vn(e){let t=this.getNodeParameter("staticDataKey",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("onMissing",e),a=this.getNodeParameter("clearAfterRead",e),i=this.getWorkflowStaticData("global"),o=i[t];if(!Ao(o)){if(n==="throw")throw new n8nWorkflow.NodeOperationError(this.getNode(),`No stashed binary found under static data key "${t}".`,{description:"The Apply Edits operation writes a stash entry into workflow static data only when it runs as an AI Agent tool and produces a binary. Verify that Apply Edits was actually called by the agent this turn, that it ran successfully, and that the key matches the one used on the writing side.",itemIndex:e});return [{json:{hydrated:false},pairedItem:{item:e}}]}let{id:s,fileName:l,mimeType:u}=o,c;try{let g=await this.helpers.getBinaryStream(s);c=await this.helpers.binaryToBuffer(g);}catch(g){throw new n8nWorkflow.NodeOperationError(this.getNode(),`Failed to load stashed binary (id=${s}) from external storage.`,{description:`The stash entry under "${t}" points at binary id "${s}", but the underlying data could not be loaded. This usually means the binary has been garbage-collected (n8n's execution data retention may be too short) or external storage is unavailable. Underlying error: ${g.message}`,itemIndex:e})}let f=u||it,d=await this.helpers.prepareBinaryData(c,l,f);a&&delete i[t];let p=this.getNodeParameter("outputPathTemplate",e,""),m;if(p.trim()!==""){let g=l.replace(/\.docx$/i,""),b=l.match(/\.docx$/i)?.[0]??".docx",v=new Date().toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");m=p.replaceAll("{baseName}",g).replaceAll("{timestamp}",v).replaceAll("{fileName}",l).replaceAll("{ext}",b);}return [{json:{hydrated:true,fileName:l,sourceBinaryId:s,mimeType:f,...m!==void 0?{outputPath:m}:{}},binary:{[r]:d},pairedItem:{item:e}}]}h(Vn,"executeHydrateToolOutput");var ei=Zr(Yn());var No=(0, ei.createRequire)("/"),gt,Co,xo;try{gt=No("worker_threads"),Co=gt.Worker,xo=gt.isMarkedAsUntransferable;}catch{}var ne=Uint8Array,Ee=Uint16Array,fn=Int32Array,vr=new ne([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yr=new ne([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),an=new ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ti=h(function(e,t){for(var r=new Ee(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var a=new fn(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return {b:r,r:a}},"freb"),gt=ti(vr,2),ri=gt.b,on=gt.r;ri[28]=258,on[258]=28;var ni=ti(yr,0),To=ni.b,Xn=ni.r,sn=new Ee(32768);for(X=0;X<32768;++X)Ue=(X&43690)>>1|(X&21845)<<1,Ue=(Ue&52428)>>2|(Ue&13107)<<2,Ue=(Ue&61680)>>4|(Ue&3855)<<4,sn[X]=((Ue&65280)>>8|(Ue&255)<<8)>>1;var Ue,X,Me=h((function(e,t,r){for(var n=e.length,a=0,i=new Ee(t);a<n;++a)e[a]&&++i[e[a]-1];var o=new Ee(t);for(a=1;a<t;++a)o[a]=o[a-1]+i[a-1]<<1;var s;if(r){s=new Ee(1<<t);var l=15-t;for(a=0;a<n;++a)if(e[a])for(var u=a<<4|e[a],c=t-e[a],f=o[e[a]-1]++<<c,d=f|(1<<c)-1;f<=d;++f)s[sn[f]>>l]=u;}else for(s=new Ee(n),a=0;a<n;++a)e[a]&&(s[a]=sn[o[e[a]-1]++]>>15-e[a]);return s}),"hMap"),Ve=new ne(288);for(X=0;X<144;++X)Ve[X]=8;var X;for(X=144;X<256;++X)Ve[X]=9;var X;for(X=256;X<280;++X)Ve[X]=7;var X;for(X=280;X<288;++X)Ve[X]=8;var X,Wt=new ne(32);for(X=0;X<32;++X)Wt[X]=5;var X,So=Me(Ve,9,0),Io=Me(Ve,9,1),ko=Me(Wt,5,0),Oo=Me(Wt,5,1),en=h(function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},"max"),Ie=h(function(e,t,r){var n=t/8|0;return (e[n]|e[n+1]<<8)>>(t&7)&r},"bits"),tn=h(function(e,t){var r=t/8|0;return (e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},"bits16"),hn=h(function(e){return (e+7)/8|0},"shft"),Ht=h(function(e,t,r){return (t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new ne(e.subarray(t,r))},"slc");var Po=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],de=h(function(e,t,r){var n=new Error(t||Po[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,de),!r)throw n;return n},"err"),Mo=h(function(e,t,r,n){var a=e.length,i=n?n.length:0;if(!a||t.f&&!t.l)return r||new ne(0);var o=!r,s=o||t.i!=2,l=t.i;o&&(r=new ne(a*3));var u=h(function(Ut){var qt=r.length;if(Ut>qt){var mt=new ne(Math.max(qt*2,Ut));mt.set(r),r=mt;}},"cbuf"),c=t.f||0,f=t.p||0,d=t.b||0,p=t.l,m=t.d,g=t.m,b=t.n,v=a*8;do{if(!p){c=Ie(e,f,1);var w=Ie(e,f+1,3);if(f+=3,w)if(w==1)p=Io,m=Oo,g=9,b=5;else if(w==2){var y=Ie(e,f,31)+257,A=Ie(e,f+10,15)+4,N=y+Ie(e,f+5,31)+1;f+=14;for(var C=new ne(N),M=new ne(19),T=0;T<A;++T)M[an[T]]=Ie(e,f+T*3,7);f+=A*3;for(var R=en(M),F=(1<<R)-1,I=Me(M,R,1),T=0;T<N;){var V=I[Ie(e,f,F)];f+=V&15;var E=V>>4;if(E<16)C[T++]=E;else {var U=0,B=0;for(E==16?(B=3+Ie(e,f,3),f+=2,U=C[T-1]):E==17?(B=3+Ie(e,f,7),f+=3):E==18&&(B=11+Ie(e,f,127),f+=7);B--;)C[T++]=U;}}var L=C.subarray(0,y),k=C.subarray(y);g=en(L),b=en(k),p=Me(L,g,1),m=Me(k,b,1);}else de(1);else {var E=hn(f)+4,_=e[E-4]|e[E-3]<<8,D=E+_;if(D>a){l&&de(0);break}s&&u(d+_),r.set(e.subarray(E,D),d),t.b=d+=_,t.p=f=D*8,t.f=c;continue}if(f>v){l&&de(0);break}}s&&u(d+131072);for(var W=(1<<g)-1,Q=(1<<b)-1,oe=f;;oe=f){var U=p[tn(e,f)&W],ee=U>>4;if(f+=U&15,f>v){l&&de(0);break}if(U||de(2),ee<256)r[d++]=ee;else if(ee==256){oe=f,p=null;break}else {var ye=ee-254;if(ee>264){var T=ee-257,re=vr[T];ye=Ie(e,f,(1<<re)-1)+ri[T],f+=re;}var ke=m[tn(e,f)&Q],dt=ke>>4;ke||de(3),f+=ke&15;var k=To[dt];if(dt>3){var re=yr[dt];k+=tn(e,f)&(1<<re)-1,f+=re;}if(f>v){l&&de(0);break}s&&u(d+131072);var pt=d+ye;if(d<k){var mr=i-k,gr=Math.min(k,pt);for(mr+d<0&&de(3);d<gr;++d)r[d]=n[mr+d];}for(;d<pt;++d)r[d]=r[d-k];}}t.l=p,t.p=oe,t.b=d,t.f=c,p&&(c=1,t.m=g,t.d=m,t.n=b);}while(!c);return d!=r.length&&o?Ht(r,0,d):r.subarray(0,d)},"inflt"),qe=h(function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8;},"wbits"),zt=h(function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16;},"wbits16"),rn=h(function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var a=r.length,i=r.slice();if(!a)return {t:ai,l:0};if(a==1){var o=new ne(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(D,y){return D.f-y.f}),r.push({s:-1,f:25001});var s=r[0],l=r[1],u=0,c=1,f=2;for(r[0]={s:-1,f:s.f+l.f,l:s,r:l};c!=a-1;)s=r[r[u].f<r[f].f?u++:f++],l=r[u!=c&&r[u].f<r[f].f?u++:f++],r[c++]={s:-1,f:s.f+l.f,l:s,r:l};for(var d=i[0].s,n=1;n<a;++n)i[n].s>d&&(d=i[n].s);var p=new Ee(d+1),m=un(r[c-1],p,0);if(m>t){var n=0,g=0,b=m-t,v=1<<b;for(i.sort(function(y,A){return p[A.s]-p[y.s]||y.f-A.f});n<a;++n){var w=i[n].s;if(p[w]>t)g+=v-(1<<m-p[w]),p[w]=t;else break}for(g>>=b;g>0;){var E=i[n].s;p[E]<t?g-=1<<t-p[E]++-1:++n;}for(;n>=0&&g;--n){var _=i[n].s;p[_]==t&&(--p[_],++g);}m=t;}return {t:new ne(p),l:m}},"hTree"),un=h(function(e,t,r){return e.s==-1?Math.max(un(e.l,t,r+1),un(e.r,t,r+1)):t[e.s]=r},"ln"),Qn=h(function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Ee(++t),n=0,a=e[0],i=1,o=h(function(l){r[n++]=l;},"w"),s=1;s<=t;++s)if(e[s]==a&&s!=t)++i;else {if(!a&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0);}else if(i>3){for(o(a),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0);}for(;i--;)o(a);i=1,a=e[s];}return {c:r.subarray(0,n),n:t}},"lc"),jt=h(function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},"clen"),ii=h(function(e,t,r){var n=r.length,a=hn(t+2);e[a]=n&255,e[a+1]=n>>8,e[a+2]=e[a]^255,e[a+3]=e[a+1]^255;for(var i=0;i<n;++i)e[a+i+4]=r[i];return (a+4+n)*8},"wfblk"),Jn=h(function(e,t,r,n,a,i,o,s,l,u,c){qe(t,c++,r),++a[256];for(var f=rn(a,15),d=f.t,p=f.l,m=rn(i,15),g=m.t,b=m.l,v=Qn(d),w=v.c,E=v.n,_=Qn(g),D=_.c,y=_.n,A=new Ee(19),N=0;N<w.length;++N)++A[w[N]&31];for(var N=0;N<D.length;++N)++A[D[N]&31];for(var C=rn(A,7),M=C.t,T=C.l,R=19;R>4&&!M[an[R-1]];--R);var F=u+5<<3,I=jt(a,Ve)+jt(i,Wt)+o,V=jt(a,d)+jt(i,g)+o+14+3*R+jt(A,M)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&F<=I&&F<=V)return ii(t,c,e.subarray(l,l+u));var U,B,L,k;if(qe(t,c,1+(V<I)),c+=2,V<I){U=Me(d,p,0),B=d,L=Me(g,b,0),k=g;var W=Me(M,T,0);qe(t,c,E-257),qe(t,c+5,y-1),qe(t,c+10,R-4),c+=14;for(var N=0;N<R;++N)qe(t,c+3*N,M[an[N]]);c+=3*R;for(var Q=[w,D],oe=0;oe<2;++oe)for(var ee=Q[oe],N=0;N<ee.length;++N){var ye=ee[N]&31;qe(t,c,W[ye]),c+=M[ye],ye>15&&(qe(t,c,ee[N]>>5&127),c+=ee[N]>>12);}}else U=So,B=Ve,L=ko,k=Wt;for(var N=0;N<s;++N){var re=n[N];if(re>255){var ye=re>>18&31;zt(t,c,U[ye+257]),c+=B[ye+257],ye>7&&(qe(t,c,re>>23&31),c+=vr[ye]);var ke=re&31;zt(t,c,L[ke]),c+=k[ke],ke>3&&(zt(t,c,re>>5&8191),c+=yr[ke]);}else zt(t,c,U[re]),c+=B[re];}return zt(t,c,U[256]),c+B[256]},"wblk"),Ro=new fn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ai=new ne(0),Bo=h(function(e,t,r,n,a,i){var o=i.z||e.length,s=new ne(n+o+5*(1+Math.ceil(o/7e3))+a),l=s.subarray(n,s.length-a),u=i.l,c=(i.r||0)&7;if(t){c&&(l[0]=i.r>>3);for(var f=Ro[t-1],d=f>>13,p=f&8191,m=(1<<r)-1,g=i.p||new Ee(32768),b=i.h||new Ee(m+1),v=Math.ceil(r/3),w=2*v,E=h(function(Qr){return (e[Qr]^e[Qr+1]<<v^e[Qr+2]<<w)&m},"hsh"),_=new fn(25e3),D=new Ee(288),y=new Ee(32),A=0,N=0,C=i.i||0,M=0,T=i.w||0,R=0;C+2<o;++C){var F=E(C),I=C&32767,V=b[F];if(g[I]=V,b[F]=I,T<=C){var U=o-C;if((A>7e3||M>24576)&&(U>423||!u)){c=Jn(e,l,0,_,D,y,N,M,R,C-R,c),M=A=N=0,R=C;for(var B=0;B<286;++B)D[B]=0;for(var B=0;B<30;++B)y[B]=0;}var L=2,k=0,W=p,Q=I-V&32767;if(U>2&&F==E(C-Q))for(var oe=Math.min(d,U)-1,ee=Math.min(32767,C),ye=Math.min(258,U);Q<=ee&&--W&&I!=V;){if(e[C+L]==e[C+L-Q]){for(var re=0;re<ye&&e[C+re]==e[C+re-Q];++re);if(re>L){if(L=re,k=Q,re>oe)break;for(var ke=Math.min(Q,re-2),dt=0,B=0;B<ke;++B){var pt=C-Q+B&32767,mr=g[pt],gr=pt-mr&32767;gr>dt&&(dt=gr,V=pt);}}}I=V,V=g[I],Q+=I-V&32767;}if(k){_[M++]=268435456|on[L]<<18|Xn[k];var Ut=on[L]&31,qt=Xn[k]&31;N+=vr[Ut]+yr[qt],++D[257+Ut],++y[qt],T=C+L,++A;}else _[M++]=e[C],++D[e[C]];}}for(C=Math.max(C,T);C<o;++C)_[M++]=e[C],++D[e[C]];c=Jn(e,l,u,_,D,y,N,M,R,C-R,c),u||(i.r=c&7|l[c/8|0]<<3,c-=7,i.h=b,i.p=g,i.i=C,i.w=T);}else {for(var C=i.w||0;C<o+u;C+=65535){var mt=C+65535;mt>=o&&(l[c/8|0]=u,mt=o),c=ii(l,c+1,e.subarray(C,mt));}i.i=o;}return Ht(s,0,n+hn(c)+a)},"dflt"),Fo=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r;}return e})(),Lo=h(function(){var e=-1;return {p:h(function(t){for(var r=e,n=0;n<t.length;++n)r=Fo[r&255^t[n]]^r>>>8;e=r;},"p"),d:h(function(){return ~e},"d")}},"crc");var $o=h(function(e,t,r,n,a){if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ne(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length;}return Bo(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,a)},"dopt"),oi=h(function(e,t){var r={};for(var n in e)r[n]=e[n];for(var n in t)r[n]=t[n];return r},"mrg");var Pe=h(function(e,t){return e[t]|e[t+1]<<8},"b2"),De=h(function(e,t){return (e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},"b4"),nn=h(function(e,t){return De(e,t)+De(e,t+4)*4294967296},"b8"),le=h(function(e,t,r){for(;r;++t)e[t]=r,r>>>=8;},"wbytes");function Uo(e,t){return $o(e,t||{},0,0)}h(Uo,"deflateSync");function qo(e,t){return Mo(e,{i:2},t&&t.out,t&&t.dictionary)}h(qo,"inflateSync");var si=h(function(e,t,r,n){for(var a in e){var i=e[a],o=t+a,s=n;Array.isArray(i)&&(s=oi(n,i[1]),i=i[0]),ArrayBuffer.isView(i)?r[o]=[i,s]:(r[o+="/"]=[new ne(0),s],si(i,o,r,n));}},"fltn"),Zn=typeof TextEncoder<"u"&&new TextEncoder,ln=typeof TextDecoder<"u"&&new TextDecoder,zo=0;try{ln.decode(ai,{stream:!0}),zo=1;}catch{}var jo=h(function(e){for(var t="",r=0;;){var n=e[r++],a=(n>127)+(n>223)+(n>239);if(r+a>e.length)return {s:t,r:Ht(e,r-1)};a?a==3?(n=((n&15)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023)):a&1?t+=String.fromCharCode((n&31)<<6|e[r++]&63):t+=String.fromCharCode((n&15)<<12|(e[r++]&63)<<6|e[r++]&63):t+=String.fromCharCode(n);}},"dutf8");function wr(e,t){if(t){for(var r=new ne(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(Zn)return Zn.encode(e);for(var a=e.length,i=new ne(e.length+(e.length>>1)),o=0,s=h(function(c){i[o++]=c;},"w"),n=0;n<a;++n){if(o+5>i.length){var l=new ne(o+8+(a-n<<1));l.set(i),i=l;}var u=e.charCodeAt(n);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++n)&1023,s(240|u>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|u&63)):(s(224|u>>12),s(128|u>>6&63),s(128|u&63));}return Ht(i,0,o)}h(wr,"strToU8");function Er(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}else {if(ln)return ln.decode(e);var a=jo(e),i=a.s,r=a.r;return r.length&&de(8),i}}h(Er,"strFromU8");var Wo=h(function(e,t){return t+30+Pe(e,t+26)+Pe(e,t+28)},"slzh"),Ho=h(function(e,t,r){var n=Pe(e,t+28),a=Pe(e,t+30),i=Er(e.subarray(t+46,t+46+n),!(Pe(e,t+8)&2048)),o=t+46+n,s=Vo(e,o,a,r,De(e,t+20),De(e,t+24),De(e,t+42)),l=s[0],u=s[1],c=s[2];return [Pe(e,t+10),l,u,i,o+a+Pe(e,t+32),c]},"zh"),Vo=h(function(e,t,r,n,a,i,o){var s=a==4294967295,l=i==4294967295,u=o==4294967295,c=t+r,f=s+l+u;if(n&&f){for(;t+4<c;t+=4+Pe(e,t+2))if(Pe(e,t)==1)return [s?nn(e,t+4+8*l):a,l?nn(e,t+4):i,u?nn(e,t+4+8*(l+s)):o,1];n<2&&de(13);}return [a,i,o,0]},"z64hs"),cn=h(function(e){var t=0;if(e)for(var r in e){var n=e[r].length;n>65535&&de(9),t+=n+4;}return t},"exfl"),Kn=h(function(e,t,r,n,a,i,o,s){var l=n.length,u=r.extra,c=s&&s.length,f=cn(u);le(e,t,o!=null?33639248:67324752),t+=4,o!=null&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(i<0&&8),e[t++]=a&&8,e[t++]=r.compression&255,e[t++]=r.compression>>8;var d=new Date(r.mtime==null?Date.now():r.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&de(10),le(e,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,i!=-1&&(le(e,t,r.crc),le(e,t+4,i<0?-i-2:i),le(e,t+8,r.size)),le(e,t+12,l),le(e,t+14,f),t+=16,o!=null&&(le(e,t,c),le(e,t+6,r.attrs),le(e,t+10,o),t+=14),e.set(n,t),t+=l,f)for(var m in u){var g=u[m],b=g.length;le(e,t,+m),le(e,t+2,b),e.set(g,t+4),t+=4+b;}return c&&(e.set(s,t),t+=c),t},"wzh"),Go=h(function(e,t,r,n,a){le(e,t,101010256),le(e,t+8,r),le(e,t+10,r),le(e,t+12,n),le(e,t+16,a);},"wzf");function ui(e,t){t||(t={});var r={},n=[];si(e,"",r,t);var a=0,i=0;for(var o in r){var s=r[o],l=s[0],u=s[1],c=u.level==0?0:8,f=wr(o),d=f.length,p=u.comment,m=p&&wr(p),g=m&&m.length,b=cn(u.extra);d>65535&&de(11);var v=c?Uo(l,u):l,w=v.length,E=Lo();E.p(l),n.push(oi(u,{size:l.length,crc:E.d(),c:v,f,m,u:d!=o.length||m&&p.length!=g,o:a,compression:c})),a+=30+d+b+w,i+=76+2*(d+b)+(g||0)+w;}for(var _=new ne(i+22),D=a,y=i-a,A=0;A<n.length;++A){var f=n[A];Kn(_,f.o,f,f.f,f.u,f.c.length);var N=30+f.f.length+cn(f.extra);_.set(f.c,f.o+N),Kn(_,a,f,f.f,f.u,f.c.length,f.o,f.m),a+=16+N+(f.m?f.m.length:0);}return Go(_,a,n.length,y,D),_}h(ui,"zipSync");function li(e,t){for(var r={},n=e.length-22;De(e,n)!=101010256;--n)(!n||e.length-n>65558)&&de(13);var a=Pe(e,n+8);if(!a)return {};var i=De(e,n+16),o=De(e,n-20)==117853008;if(o){var s=De(e,n-12);o=De(e,s)==101075792,o&&(a=De(e,s+32),i=De(e,s+48));}for(var l=t&&t.filter,u=0;u<a;++u){var c=Ho(e,i,o),f=c[0],d=c[1],p=c[2],m=c[3],g=c[4],b=c[5],v=Wo(e,b);i=g,(!l||l({name:m,size:d,originalSize:p,compression:f}))&&(f?f==8?r[m]=qo(e.subarray(v,v+d),{out:new ne(p)}):de(14,"unknown compression type "+f):r[m]=Ht(e,v,v+d));}return r}h(li,"unzipSync");var Vr=Zr(wa()),ja=Zr(va());function P(e,t){for(let r=0;r<e.childNodes.length;r++){let n=e.childNodes[r];if(n.nodeType===1&&n.tagName===t)return n}return null}h(P,"findChild");function Lu(e,t){let r=[];for(let n=0;n<e.childNodes.length;n++){let a=e.childNodes[n];a.nodeType===1&&a.tagName===t&&r.push(a);}return r}h(Lu,"findChildren");function S(e,t){return Array.from(e.getElementsByTagName(t))}h(S,"findAllDescendants");function Mn(e){return e.startsWith("\uFEFF")&&(e=e.slice(1)),new Vr.DOMParser().parseFromString(e,"text/xml")}h(Mn,"parseXml");function $u(e){let t=new Vr.XMLSerializer().serializeToString(e),n=/<([a-zA-Z0-9_:]+)(\s+[^>]+?)(>|\/>)/.exec(t);if(n&&!n[1].startsWith("?")){let a=n.index,i=t.substring(0,a);if(!i.includes("<")||i.trim().startsWith("<?xml")&&(i.match(/</g)||[]).length===1){let s=n[0],l=`<${n[1]}`,u=n[2],c=n[3],f=/([a-zA-Z0-9_:]+)\s*=\s*(["'])(.*?)\2/g,d=[],p;for(;(p=f.exec(u))!==null;)d.push(p[0].trim());d.sort((g,b)=>{let v=g.split("=")[0].trim(),w=b.split("=")[0].trim(),E=v.startsWith("xmlns"),_=w.startsWith("xmlns");return E&&!_?-1:!E&&_?1:v<w?-1:v>w?1:0});let m=d.length>0?`${l} ${d.join(" ")}${c}`:`${l}${c}`;t=t.substring(0,a)+m+t.substring(a+s.length);}}return t}h($u,"serializeXml");var zr=class{static{h(this,"Relationship");}constructor(e,t,r,n){this.id=e,this.type=t,this.target=r,this.isExternal=n;}id;type;target;isExternal},ka=class{static{h(this,"Part");}constructor(e,t,r,n){this.partname=e,this.blob=t,this.contentType=n,this._element=r;}partname;blob;contentType;rels=new Map;_element;package;addRelationship(e,t,r,n=false){if(this.rels.set(e,new zr(e,t,r,n)),this.partname.endsWith(".rels")){let a=this._element.ownerDocument;if(a){let i=a.createElementNS("http://schemas.openxmlformats.org/package/2006/relationships","Relationship");i.setAttribute("Id",e),i.setAttribute("Type",t),i.setAttribute("Target",r),n&&i.setAttribute("TargetMode","External"),this._element.appendChild(i);}}}},Uu=class{static{h(this,"DocxPackage");}constructor(e){this.unzipped=e;}unzipped;parts=[];mainDocumentPart;getPartByPath(e){let t=e.startsWith("/")?e.substring(1):e;return this.parts.find(r=>r.partname===t||r.partname==="/"+t)}nextPartname(e){let t=1;for(;;){let r=e.replace("%d",t===1?"":t.toString());if(!this.getPartByPath(r))return r;t++;}}addPart(e,t,r){let n=Mn(r),a=new ka(e,r,n.documentElement,t);a.package=this,this.parts.push(a);let i=this.getPartByPath("[Content_Types].xml");if(i){let o=i._element.ownerDocument;if(o){let s=o.createElement("Override");s.setAttribute("PartName",e),s.setAttribute("ContentType",t),i._element.appendChild(s);}}return a}getOrCreateRelsPart(e){let t=e.split("/"),r=t.pop(),n=t.join("/")+"/_rels/"+r+".rels",a=this.getPartByPath(n);return a||(a=this.addPart(n,"application/vnd.openxmlformats-package.relationships+xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
13
|
+
`+i),new n8nWorkflow.NodeApiError(this.getNode(),{message:i,errors:a},{message:s,description:l,itemIndex:t})}return o.includes("invalid docx")||o.includes("missing word/document.xml")?new n8nWorkflow.NodeApiError(this.getNode(),{message:r},{message:"The document could not be opened.",description:"Verify the input binary is a valid .docx file (not .doc, .pdf, or another format).",itemIndex:t}):new n8nWorkflow.NodeApiError(this.getNode(),{message:r},{message:"Adeu engine error.",description:r,itemIndex:t})}h(jn,"mapAdeuErrorToNodeApiError");function Ao(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.id=="string"&&typeof t.fileName=="string"&&typeof t.mimeType=="string"}h(Ao,"isStashedBinaryEntry");var Hn=[{displayName:"Static Data Key",name:"staticDataKey",type:"string",default:"adeu_last_redlined",required:true,placeholder:"e.g. adeu_last_redlined",description:"Key in workflow global static data to read the stashed binary metadata from (string). When the Apply Edits operation runs as an AI Agent tool, n8n's tool wrapper strips the binary from its output before any downstream node can see it. To work around that, Apply Edits writes the binary's storage id into workflow static data under 'adeu_last_redlined'. This operation reads that entry back, fetches the original buffer via getBinaryStream, and attaches a fresh IBinaryData onto the outgoing item. Leave the default unless you've customized the stash key on the Apply Edits side.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the hydrated .docx (string, e.g. 'data'). Downstream nodes (e.g. Write Binary File, Gmail send) should be configured to read from this property name.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"On Missing",name:"onMissing",type:"options",default:"emit_empty",description:"What to do when no stashed binary entry is found under the configured key. 'Emit Empty' is the typical AI Agent path: emits an item with json.hydrated=false and no binary, so a downstream If node can gate any write step on whether the LLM actually called Apply Edits this turn. 'Throw' is for deterministic pipelines where the stash MUST be present and a missing entry indicates a workflow bug.",options:[{name:"Emit Empty",value:"emit_empty",description:"Emit a single item with json.hydrated=false and no binary. Downstream If on json.hydrated gates the write."},{name:"Throw",value:"throw",description:"Throw a NodeOperationError. Use when a missing stash indicates a workflow bug."}],displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Clear After Read",name:"clearAfterRead",type:"boolean",default:true,description:"Whether to delete the static data entry after a successful hydration so it does not leak across workflow runs. Set false if you want to inspect or re-read the entry from a later node in the same run.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Output Path Template",name:"outputPathTemplate",type:"string",default:"",placeholder:"e.g. C:\\Users\\Uzair\\.n8n-files\\{baseName}_{timestamp}.docx",description:"Optional template to compute the final write path on disk, returned on the output JSON as 'outputPath'. If set, you can configure downstream Write nodes to simply read '{{ $json.outputPath }}' with zero escaping risks. Supports these placeholders: '{baseName}' (filename with extension stripped), '{timestamp}' (current ISO 8601 timestamp with colons and dots replaced by dashes for Windows file compatibility), '{fileName}' (the stashed filename including extension), and '{ext}' (e.g., '.docx').",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}}];async function Vn(e){let t=this.getNodeParameter("staticDataKey",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("onMissing",e),a=this.getNodeParameter("clearAfterRead",e),i=this.getWorkflowStaticData("global"),o=i[t];if(!Ao(o)){if(n==="throw")throw new n8nWorkflow.NodeOperationError(this.getNode(),`No stashed binary found under static data key "${t}".`,{description:"The Apply Edits operation writes a stash entry into workflow static data only when it runs as an AI Agent tool and produces a binary. Verify that Apply Edits was actually called by the agent this turn, that it ran successfully, and that the key matches the one used on the writing side.",itemIndex:e});return [{json:{hydrated:false},pairedItem:{item:e}}]}let{id:s,fileName:l,mimeType:u}=o,c;try{let g=await this.helpers.getBinaryStream(s);c=await this.helpers.binaryToBuffer(g);}catch(g){throw new n8nWorkflow.NodeOperationError(this.getNode(),`Failed to load stashed binary (id=${s}) from external storage.`,{description:`The stash entry under "${t}" points at binary id "${s}", but the underlying data could not be loaded. This usually means the binary has been garbage-collected (n8n's execution data retention may be too short) or external storage is unavailable. Underlying error: ${g.message}`,itemIndex:e})}let f=u||it,d=await this.helpers.prepareBinaryData(c,l,f);a&&delete i[t];let p=this.getNodeParameter("outputPathTemplate",e,""),m;if(p.trim()!==""){let g=l.replace(/\.docx$/i,""),E=l.match(/\.docx$/i)?.[0]??".docx",v=new Date().toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");m=p.replaceAll("{baseName}",g).replaceAll("{timestamp}",v).replaceAll("{fileName}",l).replaceAll("{ext}",E);}return [{json:{hydrated:true,fileName:l,sourceBinaryId:s,mimeType:f,...m!==void 0?{outputPath:m}:{}},binary:{[r]:d},pairedItem:{item:e}}]}h(Vn,"executeHydrateToolOutput");var ei=Zr(Yn());var No=(0, ei.createRequire)("/"),gt,Co,xo;try{gt=No("worker_threads"),Co=gt.Worker,xo=gt.isMarkedAsUntransferable;}catch{}var ne=Uint8Array,Ee=Uint16Array,fn=Int32Array,vr=new ne([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yr=new ne([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),an=new ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ti=h(function(e,t){for(var r=new Ee(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var a=new fn(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return {b:r,r:a}},"freb"),gt=ti(vr,2),ri=gt.b,on=gt.r;ri[28]=258,on[258]=28;var ni=ti(yr,0),To=ni.b,Xn=ni.r,sn=new Ee(32768);for(X=0;X<32768;++X)Ue=(X&43690)>>1|(X&21845)<<1,Ue=(Ue&52428)>>2|(Ue&13107)<<2,Ue=(Ue&61680)>>4|(Ue&3855)<<4,sn[X]=((Ue&65280)>>8|(Ue&255)<<8)>>1;var Ue,X,Me=h((function(e,t,r){for(var n=e.length,a=0,i=new Ee(t);a<n;++a)e[a]&&++i[e[a]-1];var o=new Ee(t);for(a=1;a<t;++a)o[a]=o[a-1]+i[a-1]<<1;var s;if(r){s=new Ee(1<<t);var l=15-t;for(a=0;a<n;++a)if(e[a])for(var u=a<<4|e[a],c=t-e[a],f=o[e[a]-1]++<<c,d=f|(1<<c)-1;f<=d;++f)s[sn[f]>>l]=u;}else for(s=new Ee(n),a=0;a<n;++a)e[a]&&(s[a]=sn[o[e[a]-1]++]>>15-e[a]);return s}),"hMap"),Ve=new ne(288);for(X=0;X<144;++X)Ve[X]=8;var X;for(X=144;X<256;++X)Ve[X]=9;var X;for(X=256;X<280;++X)Ve[X]=7;var X;for(X=280;X<288;++X)Ve[X]=8;var X,Wt=new ne(32);for(X=0;X<32;++X)Wt[X]=5;var X,So=Me(Ve,9,0),Io=Me(Ve,9,1),ko=Me(Wt,5,0),Oo=Me(Wt,5,1),en=h(function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},"max"),Ie=h(function(e,t,r){var n=t/8|0;return (e[n]|e[n+1]<<8)>>(t&7)&r},"bits"),tn=h(function(e,t){var r=t/8|0;return (e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},"bits16"),hn=h(function(e){return (e+7)/8|0},"shft"),Ht=h(function(e,t,r){return (t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new ne(e.subarray(t,r))},"slc");var Po=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],de=h(function(e,t,r){var n=new Error(t||Po[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,de),!r)throw n;return n},"err"),Mo=h(function(e,t,r,n){var a=e.length,i=n?n.length:0;if(!a||t.f&&!t.l)return r||new ne(0);var o=!r,s=o||t.i!=2,l=t.i;o&&(r=new ne(a*3));var u=h(function(Ut){var qt=r.length;if(Ut>qt){var mt=new ne(Math.max(qt*2,Ut));mt.set(r),r=mt;}},"cbuf"),c=t.f||0,f=t.p||0,d=t.b||0,p=t.l,m=t.d,g=t.m,E=t.n,v=a*8;do{if(!p){c=Ie(e,f,1);var w=Ie(e,f+1,3);if(f+=3,w)if(w==1)p=Io,m=Oo,g=9,E=5;else if(w==2){var y=Ie(e,f,31)+257,A=Ie(e,f+10,15)+4,N=y+Ie(e,f+5,31)+1;f+=14;for(var C=new ne(N),M=new ne(19),T=0;T<A;++T)M[an[T]]=Ie(e,f+T*3,7);f+=A*3;for(var R=en(M),F=(1<<R)-1,I=Me(M,R,1),T=0;T<N;){var V=I[Ie(e,f,F)];f+=V&15;var b=V>>4;if(b<16)C[T++]=b;else {var U=0,B=0;for(b==16?(B=3+Ie(e,f,3),f+=2,U=C[T-1]):b==17?(B=3+Ie(e,f,7),f+=3):b==18&&(B=11+Ie(e,f,127),f+=7);B--;)C[T++]=U;}}var L=C.subarray(0,y),k=C.subarray(y);g=en(L),E=en(k),p=Me(L,g,1),m=Me(k,E,1);}else de(1);else {var b=hn(f)+4,_=e[b-4]|e[b-3]<<8,D=b+_;if(D>a){l&&de(0);break}s&&u(d+_),r.set(e.subarray(b,D),d),t.b=d+=_,t.p=f=D*8,t.f=c;continue}if(f>v){l&&de(0);break}}s&&u(d+131072);for(var W=(1<<g)-1,Q=(1<<E)-1,oe=f;;oe=f){var U=p[tn(e,f)&W],ee=U>>4;if(f+=U&15,f>v){l&&de(0);break}if(U||de(2),ee<256)r[d++]=ee;else if(ee==256){oe=f,p=null;break}else {var ye=ee-254;if(ee>264){var T=ee-257,re=vr[T];ye=Ie(e,f,(1<<re)-1)+ri[T],f+=re;}var ke=m[tn(e,f)&Q],dt=ke>>4;ke||de(3),f+=ke&15;var k=To[dt];if(dt>3){var re=yr[dt];k+=tn(e,f)&(1<<re)-1,f+=re;}if(f>v){l&&de(0);break}s&&u(d+131072);var pt=d+ye;if(d<k){var mr=i-k,gr=Math.min(k,pt);for(mr+d<0&&de(3);d<gr;++d)r[d]=n[mr+d];}for(;d<pt;++d)r[d]=r[d-k];}}t.l=p,t.p=oe,t.b=d,t.f=c,p&&(c=1,t.m=g,t.d=m,t.n=E);}while(!c);return d!=r.length&&o?Ht(r,0,d):r.subarray(0,d)},"inflt"),qe=h(function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8;},"wbits"),zt=h(function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16;},"wbits16"),rn=h(function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var a=r.length,i=r.slice();if(!a)return {t:ai,l:0};if(a==1){var o=new ne(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(D,y){return D.f-y.f}),r.push({s:-1,f:25001});var s=r[0],l=r[1],u=0,c=1,f=2;for(r[0]={s:-1,f:s.f+l.f,l:s,r:l};c!=a-1;)s=r[r[u].f<r[f].f?u++:f++],l=r[u!=c&&r[u].f<r[f].f?u++:f++],r[c++]={s:-1,f:s.f+l.f,l:s,r:l};for(var d=i[0].s,n=1;n<a;++n)i[n].s>d&&(d=i[n].s);var p=new Ee(d+1),m=un(r[c-1],p,0);if(m>t){var n=0,g=0,E=m-t,v=1<<E;for(i.sort(function(y,A){return p[A.s]-p[y.s]||y.f-A.f});n<a;++n){var w=i[n].s;if(p[w]>t)g+=v-(1<<m-p[w]),p[w]=t;else break}for(g>>=E;g>0;){var b=i[n].s;p[b]<t?g-=1<<t-p[b]++-1:++n;}for(;n>=0&&g;--n){var _=i[n].s;p[_]==t&&(--p[_],++g);}m=t;}return {t:new ne(p),l:m}},"hTree"),un=h(function(e,t,r){return e.s==-1?Math.max(un(e.l,t,r+1),un(e.r,t,r+1)):t[e.s]=r},"ln"),Qn=h(function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Ee(++t),n=0,a=e[0],i=1,o=h(function(l){r[n++]=l;},"w"),s=1;s<=t;++s)if(e[s]==a&&s!=t)++i;else {if(!a&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0);}else if(i>3){for(o(a),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0);}for(;i--;)o(a);i=1,a=e[s];}return {c:r.subarray(0,n),n:t}},"lc"),jt=h(function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},"clen"),ii=h(function(e,t,r){var n=r.length,a=hn(t+2);e[a]=n&255,e[a+1]=n>>8,e[a+2]=e[a]^255,e[a+3]=e[a+1]^255;for(var i=0;i<n;++i)e[a+i+4]=r[i];return (a+4+n)*8},"wfblk"),Jn=h(function(e,t,r,n,a,i,o,s,l,u,c){qe(t,c++,r),++a[256];for(var f=rn(a,15),d=f.t,p=f.l,m=rn(i,15),g=m.t,E=m.l,v=Qn(d),w=v.c,b=v.n,_=Qn(g),D=_.c,y=_.n,A=new Ee(19),N=0;N<w.length;++N)++A[w[N]&31];for(var N=0;N<D.length;++N)++A[D[N]&31];for(var C=rn(A,7),M=C.t,T=C.l,R=19;R>4&&!M[an[R-1]];--R);var F=u+5<<3,I=jt(a,Ve)+jt(i,Wt)+o,V=jt(a,d)+jt(i,g)+o+14+3*R+jt(A,M)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&F<=I&&F<=V)return ii(t,c,e.subarray(l,l+u));var U,B,L,k;if(qe(t,c,1+(V<I)),c+=2,V<I){U=Me(d,p,0),B=d,L=Me(g,E,0),k=g;var W=Me(M,T,0);qe(t,c,b-257),qe(t,c+5,y-1),qe(t,c+10,R-4),c+=14;for(var N=0;N<R;++N)qe(t,c+3*N,M[an[N]]);c+=3*R;for(var Q=[w,D],oe=0;oe<2;++oe)for(var ee=Q[oe],N=0;N<ee.length;++N){var ye=ee[N]&31;qe(t,c,W[ye]),c+=M[ye],ye>15&&(qe(t,c,ee[N]>>5&127),c+=ee[N]>>12);}}else U=So,B=Ve,L=ko,k=Wt;for(var N=0;N<s;++N){var re=n[N];if(re>255){var ye=re>>18&31;zt(t,c,U[ye+257]),c+=B[ye+257],ye>7&&(qe(t,c,re>>23&31),c+=vr[ye]);var ke=re&31;zt(t,c,L[ke]),c+=k[ke],ke>3&&(zt(t,c,re>>5&8191),c+=yr[ke]);}else zt(t,c,U[re]),c+=B[re];}return zt(t,c,U[256]),c+B[256]},"wblk"),Ro=new fn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ai=new ne(0),Bo=h(function(e,t,r,n,a,i){var o=i.z||e.length,s=new ne(n+o+5*(1+Math.ceil(o/7e3))+a),l=s.subarray(n,s.length-a),u=i.l,c=(i.r||0)&7;if(t){c&&(l[0]=i.r>>3);for(var f=Ro[t-1],d=f>>13,p=f&8191,m=(1<<r)-1,g=i.p||new Ee(32768),E=i.h||new Ee(m+1),v=Math.ceil(r/3),w=2*v,b=h(function(Qr){return (e[Qr]^e[Qr+1]<<v^e[Qr+2]<<w)&m},"hsh"),_=new fn(25e3),D=new Ee(288),y=new Ee(32),A=0,N=0,C=i.i||0,M=0,T=i.w||0,R=0;C+2<o;++C){var F=b(C),I=C&32767,V=E[F];if(g[I]=V,E[F]=I,T<=C){var U=o-C;if((A>7e3||M>24576)&&(U>423||!u)){c=Jn(e,l,0,_,D,y,N,M,R,C-R,c),M=A=N=0,R=C;for(var B=0;B<286;++B)D[B]=0;for(var B=0;B<30;++B)y[B]=0;}var L=2,k=0,W=p,Q=I-V&32767;if(U>2&&F==b(C-Q))for(var oe=Math.min(d,U)-1,ee=Math.min(32767,C),ye=Math.min(258,U);Q<=ee&&--W&&I!=V;){if(e[C+L]==e[C+L-Q]){for(var re=0;re<ye&&e[C+re]==e[C+re-Q];++re);if(re>L){if(L=re,k=Q,re>oe)break;for(var ke=Math.min(Q,re-2),dt=0,B=0;B<ke;++B){var pt=C-Q+B&32767,mr=g[pt],gr=pt-mr&32767;gr>dt&&(dt=gr,V=pt);}}}I=V,V=g[I],Q+=I-V&32767;}if(k){_[M++]=268435456|on[L]<<18|Xn[k];var Ut=on[L]&31,qt=Xn[k]&31;N+=vr[Ut]+yr[qt],++D[257+Ut],++y[qt],T=C+L,++A;}else _[M++]=e[C],++D[e[C]];}}for(C=Math.max(C,T);C<o;++C)_[M++]=e[C],++D[e[C]];c=Jn(e,l,u,_,D,y,N,M,R,C-R,c),u||(i.r=c&7|l[c/8|0]<<3,c-=7,i.h=E,i.p=g,i.i=C,i.w=T);}else {for(var C=i.w||0;C<o+u;C+=65535){var mt=C+65535;mt>=o&&(l[c/8|0]=u,mt=o),c=ii(l,c+1,e.subarray(C,mt));}i.i=o;}return Ht(s,0,n+hn(c)+a)},"dflt"),Fo=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r;}return e})(),Lo=h(function(){var e=-1;return {p:h(function(t){for(var r=e,n=0;n<t.length;++n)r=Fo[r&255^t[n]]^r>>>8;e=r;},"p"),d:h(function(){return ~e},"d")}},"crc");var $o=h(function(e,t,r,n,a){if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ne(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length;}return Bo(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,a)},"dopt"),oi=h(function(e,t){var r={};for(var n in e)r[n]=e[n];for(var n in t)r[n]=t[n];return r},"mrg");var Pe=h(function(e,t){return e[t]|e[t+1]<<8},"b2"),De=h(function(e,t){return (e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},"b4"),nn=h(function(e,t){return De(e,t)+De(e,t+4)*4294967296},"b8"),le=h(function(e,t,r){for(;r;++t)e[t]=r,r>>>=8;},"wbytes");function Uo(e,t){return $o(e,t||{},0,0)}h(Uo,"deflateSync");function qo(e,t){return Mo(e,{i:2},t&&t.out,t&&t.dictionary)}h(qo,"inflateSync");var si=h(function(e,t,r,n){for(var a in e){var i=e[a],o=t+a,s=n;Array.isArray(i)&&(s=oi(n,i[1]),i=i[0]),ArrayBuffer.isView(i)?r[o]=[i,s]:(r[o+="/"]=[new ne(0),s],si(i,o,r,n));}},"fltn"),Zn=typeof TextEncoder<"u"&&new TextEncoder,ln=typeof TextDecoder<"u"&&new TextDecoder,zo=0;try{ln.decode(ai,{stream:!0}),zo=1;}catch{}var jo=h(function(e){for(var t="",r=0;;){var n=e[r++],a=(n>127)+(n>223)+(n>239);if(r+a>e.length)return {s:t,r:Ht(e,r-1)};a?a==3?(n=((n&15)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023)):a&1?t+=String.fromCharCode((n&31)<<6|e[r++]&63):t+=String.fromCharCode((n&15)<<12|(e[r++]&63)<<6|e[r++]&63):t+=String.fromCharCode(n);}},"dutf8");function wr(e,t){if(t){for(var r=new ne(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(Zn)return Zn.encode(e);for(var a=e.length,i=new ne(e.length+(e.length>>1)),o=0,s=h(function(c){i[o++]=c;},"w"),n=0;n<a;++n){if(o+5>i.length){var l=new ne(o+8+(a-n<<1));l.set(i),i=l;}var u=e.charCodeAt(n);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++n)&1023,s(240|u>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|u&63)):(s(224|u>>12),s(128|u>>6&63),s(128|u&63));}return Ht(i,0,o)}h(wr,"strToU8");function Er(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}else {if(ln)return ln.decode(e);var a=jo(e),i=a.s,r=a.r;return r.length&&de(8),i}}h(Er,"strFromU8");var Wo=h(function(e,t){return t+30+Pe(e,t+26)+Pe(e,t+28)},"slzh"),Ho=h(function(e,t,r){var n=Pe(e,t+28),a=Pe(e,t+30),i=Er(e.subarray(t+46,t+46+n),!(Pe(e,t+8)&2048)),o=t+46+n,s=Vo(e,o,a,r,De(e,t+20),De(e,t+24),De(e,t+42)),l=s[0],u=s[1],c=s[2];return [Pe(e,t+10),l,u,i,o+a+Pe(e,t+32),c]},"zh"),Vo=h(function(e,t,r,n,a,i,o){var s=a==4294967295,l=i==4294967295,u=o==4294967295,c=t+r,f=s+l+u;if(n&&f){for(;t+4<c;t+=4+Pe(e,t+2))if(Pe(e,t)==1)return [s?nn(e,t+4+8*l):a,l?nn(e,t+4):i,u?nn(e,t+4+8*(l+s)):o,1];n<2&&de(13);}return [a,i,o,0]},"z64hs"),cn=h(function(e){var t=0;if(e)for(var r in e){var n=e[r].length;n>65535&&de(9),t+=n+4;}return t},"exfl"),Kn=h(function(e,t,r,n,a,i,o,s){var l=n.length,u=r.extra,c=s&&s.length,f=cn(u);le(e,t,o!=null?33639248:67324752),t+=4,o!=null&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(i<0&&8),e[t++]=a&&8,e[t++]=r.compression&255,e[t++]=r.compression>>8;var d=new Date(r.mtime==null?Date.now():r.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&de(10),le(e,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,i!=-1&&(le(e,t,r.crc),le(e,t+4,i<0?-i-2:i),le(e,t+8,r.size)),le(e,t+12,l),le(e,t+14,f),t+=16,o!=null&&(le(e,t,c),le(e,t+6,r.attrs),le(e,t+10,o),t+=14),e.set(n,t),t+=l,f)for(var m in u){var g=u[m],E=g.length;le(e,t,+m),le(e,t+2,E),e.set(g,t+4),t+=4+E;}return c&&(e.set(s,t),t+=c),t},"wzh"),Go=h(function(e,t,r,n,a){le(e,t,101010256),le(e,t+8,r),le(e,t+10,r),le(e,t+12,n),le(e,t+16,a);},"wzf");function ui(e,t){t||(t={});var r={},n=[];si(e,"",r,t);var a=0,i=0;for(var o in r){var s=r[o],l=s[0],u=s[1],c=u.level==0?0:8,f=wr(o),d=f.length,p=u.comment,m=p&&wr(p),g=m&&m.length,E=cn(u.extra);d>65535&&de(11);var v=c?Uo(l,u):l,w=v.length,b=Lo();b.p(l),n.push(oi(u,{size:l.length,crc:b.d(),c:v,f,m,u:d!=o.length||m&&p.length!=g,o:a,compression:c})),a+=30+d+E+w,i+=76+2*(d+E)+(g||0)+w;}for(var _=new ne(i+22),D=a,y=i-a,A=0;A<n.length;++A){var f=n[A];Kn(_,f.o,f,f.f,f.u,f.c.length);var N=30+f.f.length+cn(f.extra);_.set(f.c,f.o+N),Kn(_,a,f,f.f,f.u,f.c.length,f.o,f.m),a+=16+N+(f.m?f.m.length:0);}return Go(_,a,n.length,y,D),_}h(ui,"zipSync");function li(e,t){for(var r={},n=e.length-22;De(e,n)!=101010256;--n)(!n||e.length-n>65558)&&de(13);var a=Pe(e,n+8);if(!a)return {};var i=De(e,n+16),o=De(e,n-20)==117853008;if(o){var s=De(e,n-12);o=De(e,s)==101075792,o&&(a=De(e,s+32),i=De(e,s+48));}for(var l=t&&t.filter,u=0;u<a;++u){var c=Ho(e,i,o),f=c[0],d=c[1],p=c[2],m=c[3],g=c[4],E=c[5],v=Wo(e,E);i=g,(!l||l({name:m,size:d,originalSize:p,compression:f}))&&(f?f==8?r[m]=qo(e.subarray(v,v+d),{out:new ne(p)}):de(14,"unknown compression type "+f):r[m]=Ht(e,v,v+d));}return r}h(li,"unzipSync");var Vr=Zr(wa()),ja=Zr(va());function P(e,t){for(let r=0;r<e.childNodes.length;r++){let n=e.childNodes[r];if(n.nodeType===1&&n.tagName===t)return n}return null}h(P,"findChild");function Lu(e,t){let r=[];for(let n=0;n<e.childNodes.length;n++){let a=e.childNodes[n];a.nodeType===1&&a.tagName===t&&r.push(a);}return r}h(Lu,"findChildren");function S(e,t){return Array.from(e.getElementsByTagName(t))}h(S,"findAllDescendants");function Mn(e){return e.startsWith("\uFEFF")&&(e=e.slice(1)),new Vr.DOMParser().parseFromString(e,"text/xml")}h(Mn,"parseXml");function $u(e){let t=new Vr.XMLSerializer().serializeToString(e),n=/<([a-zA-Z0-9_:]+)(\s+[^>]+?)(>|\/>)/.exec(t);if(n&&!n[1].startsWith("?")){let a=n.index,i=t.substring(0,a);if(!i.includes("<")||i.trim().startsWith("<?xml")&&(i.match(/</g)||[]).length===1){let s=n[0],l=`<${n[1]}`,u=n[2],c=n[3],f=/([a-zA-Z0-9_:]+)\s*=\s*(["'])(.*?)\2/g,d=[],p;for(;(p=f.exec(u))!==null;)d.push(p[0].trim());d.sort((g,E)=>{let v=g.split("=")[0].trim(),w=E.split("=")[0].trim(),b=v.startsWith("xmlns"),_=w.startsWith("xmlns");return b&&!_?-1:!b&&_?1:v<w?-1:v>w?1:0});let m=d.length>0?`${l} ${d.join(" ")}${c}`:`${l}${c}`;t=t.substring(0,a)+m+t.substring(a+s.length);}}return t}h($u,"serializeXml");var zr=class{static{h(this,"Relationship");}constructor(e,t,r,n){this.id=e,this.type=t,this.target=r,this.isExternal=n;}id;type;target;isExternal},ka=class{static{h(this,"Part");}constructor(e,t,r,n){this.partname=e,this.blob=t,this.contentType=n,this._element=r;}partname;blob;contentType;rels=new Map;_element;package;addRelationship(e,t,r,n=false){if(this.rels.set(e,new zr(e,t,r,n)),this.partname.endsWith(".rels")){let a=this._element.ownerDocument;if(a){let i=a.createElementNS("http://schemas.openxmlformats.org/package/2006/relationships","Relationship");i.setAttribute("Id",e),i.setAttribute("Type",t),i.setAttribute("Target",r),n&&i.setAttribute("TargetMode","External"),this._element.appendChild(i);}}}},Uu=class{static{h(this,"DocxPackage");}constructor(e){this.unzipped=e;}unzipped;parts=[];mainDocumentPart;getPartByPath(e){let t=e.startsWith("/")?e.substring(1):e;return this.parts.find(r=>r.partname===t||r.partname==="/"+t)}nextPartname(e){let t=1;for(;;){let r=e.replace("%d",t===1?"":t.toString());if(!this.getPartByPath(r))return r;t++;}}addPart(e,t,r){let n=Mn(r),a=new ka(e,r,n.documentElement,t);a.package=this,this.parts.push(a);let i=this.getPartByPath("[Content_Types].xml");if(i){let o=i._element.ownerDocument;if(o){let s=o.createElement("Override");s.setAttribute("PartName",e),s.setAttribute("ContentType",t),i._element.appendChild(s);}}return a}getOrCreateRelsPart(e){let t=e.split("/"),r=t.pop(),n=t.join("/")+"/_rels/"+r+".rels",a=this.getPartByPath(n);return a||(a=this.addPart(n,"application/vnd.openxmlformats-package.relationships+xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
14
14
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`)),a}},ft=class Oa{static{h(this,"_DocumentObject");}constructor(t,r){this.pkg=t,this.part=r;}pkg;part;settings={oddAndEvenPagesHeaderFooter:false};sections=[];get element(){return P(this.part._element,"w:body")||this.part._element}static async load(t){let r=t instanceof Uint8Array?t:new Uint8Array(t),n=li(r),a=new Uu(n),i=n["[Content_Types].xml"],o={};if(i){let u=Mn(Er(i)),c=S(u.documentElement,"Override");for(let f of c)o[f.getAttribute("PartName")||""]=f.getAttribute("ContentType")||"";}for(let[u,c]of Object.entries(n))if(u.endsWith(".xml")||u.endsWith(".rels")){let f=Er(c),d=Mn(f),p=o["/"+u]||"application/xml",m=new ka("/"+u,f,d.documentElement,p);m.package=a,a.parts.push(m);}let s=a.getPartByPath("word/document.xml");if(!s)throw new Error("Invalid DOCX: Missing word/document.xml");a.mainDocumentPart=s;let l=a.getPartByPath("word/_rels/document.xml.rels");if(l){let u=S(l._element,"Relationship");for(let c of u){let f=c.getAttribute("Id"),d=c.getAttribute("Target"),p=c.getAttribute("Type"),m=c.getAttribute("TargetMode");f&&d&&p&&s.rels.set(f,new zr(f,p,d,m==="External"));}}return new Oa(a,s)}relateTo(t,r){let n=1;for(;this.part.rels.has(`rId${n}`);)n++;let a=`rId${n}`,i=t.partname.split("/").pop();this.part.rels.set(a,new zr(a,r,i,false)),this.pkg.getOrCreateRelsPart(this.part.partname).addRelationship(a,r,i,false);}relateToExternal(t,r){let n=1;for(;this.part.rels.has(`rId${n}`);)n++;let a=`rId${n}`;return this.part.rels.set(a,new zr(a,r,t,true)),this.pkg.getOrCreateRelsPart(this.part.partname).addRelationship(a,r,t,true),a}async save(){for(let t of this.pkg.parts){let r=$u(t._element.ownerDocument||t._element);r.startsWith("<?xml")||(r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
15
|
-
`+r),this.pkg.unzipped[t.partname.substring(1)]=wr(r);}return Buffer.from(ui(this.pkg.unzipped))}},ge=class{static{h(this,"Paragraph");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent;get text(){let e="",t=this._element.getElementsByTagName("w:t");for(let r=0;r<t.length;r++)e+=t[r].textContent||"";return e}},et=class{static{h(this,"Run");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},qu=class{static{h(this,"Cell");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},zu=class{static{h(this,"Row");}constructor(e,t){this._element=e,this._parent=t;let r=this._element.getElementsByTagName("w:tc");for(let n=0;n<r.length;n++)this.cells.push(new qu(r[n],this));}_element;_parent;cells=[]},tt=class{static{h(this,"Table");}constructor(e,t){this._element=e,this._parent=t;let r=this._element.getElementsByTagName("w:tr");for(let n=0;n<r.length;n++)this.rows.push(new zu(r[n],this));}_element;_parent;rows=[]},ya=class{static{h(this,"NotesPart");}constructor(e,t){this.part=e,this.note_type=t,this._element=e._element;}part;note_type;_element},ju=class{static{h(this,"FootnoteItem");}constructor(e,t,r){this._element=e,this._parent=t,this.note_type=r,this.id=e.getAttribute("w:id")||"",this.part=t.part;}_element;_parent;note_type;id;part},me={w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006"},be={COMMENTS:"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",EXTENDED:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",IDS:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",EXTENSIBLE:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml"},Ze={COMMENTS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",EXTENDED:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",IDS:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",EXTENSIBLE:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"},Ft=class{static{h(this,"CommentsManager");}constructor(e){this.doc=e;}doc;_commentsPart=null;_extendedPart=null;_idsPart=null;_extensiblePart=null;_nextId=null;get commentsPart(){return this._commentsPart||(this._commentsPart=this._getOrCreateCommentsPart(),this._ensureNamespaces()),this._commentsPart}get extendedPart(){return this._extendedPart||(this._extendedPart=this._getOrCreateExtendedPart()),this._extendedPart}get idsPart(){return this._idsPart||(this._idsPart=this._getOrCreateIdsPart()),this._idsPart}get extensiblePart(){return this._extensiblePart||(this._extensiblePart=this._getOrCreateExtensiblePart()),this._extensiblePart}get nextId(){return this._nextId===null&&(this._nextId=this._getNextCommentId()),this._nextId}set nextId(e){this._nextId=e;}_getExistingPartByType(e){return this.doc.pkg.parts.find(t=>t.contentType===e)||null}_linkPart(e,t){for(let r of this.doc.part.rels.values())if(!r.isExternal&&r.target===e.partname.split("/").pop())return e;return this.doc.relateTo(e,t),e}_getOrCreateCommentsPart(){let e=this._getExistingPartByType(be.COMMENTS);if(e)return this._linkPart(e,Ze.COMMENTS);let t=this.doc.pkg.nextPartname("/word/comments%d.xml"),r=`<w:comments xmlns:w="${me.w}" xmlns:w14="${me.w14}" xmlns:w15="${me.w15}" xmlns:w16cid="${me.w16cid}" xmlns:w16cex="${me.w16cex}" xmlns:mc="${me.mc}" mc:Ignorable="w14 w15 w16cid w16cex"></w:comments>`;return e=this.doc.pkg.addPart(t,be.COMMENTS,r),this.doc.relateTo(e,Ze.COMMENTS),e}_getOrCreateExtendedPart(){let e=this._getExistingPartByType(be.EXTENDED);if(e)return this._linkPart(e,Ze.EXTENDED);let t=this.doc.pkg.nextPartname("/word/commentsExtended%d.xml"),r=`<w15:commentsEx xmlns:w15="${me.w15}"></w15:commentsEx>`;return e=this.doc.pkg.addPart(t,be.EXTENDED,r),this.doc.relateTo(e,Ze.EXTENDED),e}_getOrCreateIdsPart(){let e=this._getExistingPartByType(be.IDS);if(e)return this._linkPart(e,Ze.IDS);let t=this.doc.pkg.nextPartname("/word/commentsIds%d.xml"),r=`<w16cid:commentsIds xmlns:w16cid="${me.w16cid}"></w16cid:commentsIds>`;return e=this.doc.pkg.addPart(t,be.IDS,r),this.doc.relateTo(e,Ze.IDS),e}_getOrCreateExtensiblePart(){let e=this._getExistingPartByType(be.EXTENSIBLE);if(e)return this._linkPart(e,Ze.EXTENSIBLE);let t=this.doc.pkg.nextPartname("/word/commentsExtensible%d.xml"),r=`<w16cex:commentsExtensible xmlns:w16cex="${me.w16cex}"></w16cex:commentsExtensible>`;return e=this.doc.pkg.addPart(t,be.EXTENSIBLE,r),this.doc.relateTo(e,Ze.EXTENSIBLE),e}_ensureNamespaces(){let e=this._commentsPart?._element;if(!e)return;let t=[["xmlns:w",me.w],["xmlns:w14",me.w14],["xmlns:w15",me.w15],["xmlns:w16cid",me.w16cid],["xmlns:w16cex",me.w16cex],["xmlns:mc",me.mc]];for(let[r,n]of t)e.getAttribute(r)||e.setAttribute(r,n);}_getNextCommentId(){let e=[0],t=this._getExistingPartByType(be.COMMENTS);if(t){let r=S(t._element,"w:comment");for(let n of r){let a=n.getAttribute("w:id");a&&e.push(parseInt(a,10)||0);}}return Math.max(...e)+1}_generateHexId(){return Math.floor(Math.random()*4294967295).toString(16).toUpperCase().padStart(8,"0")}_getInitials(e){return e?e.split(" ").filter(Boolean).map(t=>t[0]).join("").toUpperCase():""}_findParaIdForComment(e){if(!this._commentsPart)return null;for(let t of S(this._commentsPart._element,"w:comment"))if(t.getAttribute("w:id")===e)for(let r of S(t,"w:p")){let n=r.getAttribute("w14:paraId");if(n)return n}return null}_findThreadRootParaId(e){let t=this._findParaIdForComment(e),r=this._getExistingPartByType(be.EXTENDED);if(!t||!r)return t;for(let n=0;n<r._element.childNodes.length;n++){let a=r._element.childNodes[n];if(a.nodeType===1&&a.getAttribute("w15:paraId")===t){let i=a.getAttribute("w15:paraIdParent");if(i)return i}}return t}addComment(e,t,r=null){let n=this.nextId.toString();this.nextId++;let a=new Date().toISOString().replace(/\.\d{3}Z$/,"Z"),i=this.commentsPart._element.ownerDocument,o=i.createElement("w:comment");o.setAttribute("w:id",n),o.setAttribute("w:author",e),o.setAttribute("w:date",a);let s=this._getInitials(e);s&&o.setAttribute("w:initials",s);let l=this._getExistingPartByType(be.EXTENDED);r&&!l&&o.setAttribute("w15:p",r);let u=this._generateHexId(),c=this._generateHexId(),f=i.createElement("w:p");f.setAttribute("w14:paraId",u),f.setAttribute("w14:textId","77777777"),f.setAttribute("w:rsidR",c),f.setAttribute("w:rsidRDefault",c),f.setAttribute("w:rsidP",c);let d=i.createElement("w:pPr"),p=i.createElement("w:pStyle");p.setAttribute("w:val","CommentText"),d.appendChild(p),f.appendChild(d);let m=i.createElement("w:r"),g=i.createElement("w:rPr"),b=i.createElement("w:rStyle");b.setAttribute("w:val","CommentReference"),g.appendChild(b),m.appendChild(g),m.appendChild(i.createElement("w:annotationRef")),f.appendChild(m);let v=i.createElement("w:r"),w=i.createElement("w:t");if(w.textContent=t,v.appendChild(w),f.appendChild(v),o.appendChild(f),this.commentsPart._element.appendChild(o),this.extendedPart){let E=r?this._findThreadRootParaId(r):null,D=this.extendedPart._element.ownerDocument.createElement("w15:commentEx");D.setAttribute("w15:paraId",u),E&&D.setAttribute("w15:paraIdParent",E),D.setAttribute("w15:done","0"),this.extendedPart._element.appendChild(D);}if(this.idsPart){let _=this.idsPart._element.ownerDocument.createElement("w16cid:commentId");_.setAttribute("w16cid:paraId",u),_.setAttribute("w16cid:durableId",this._generateHexId()),this.idsPart._element.appendChild(_);}if(this.extensiblePart){let E=null;for(let _=0;_<this.idsPart._element.childNodes.length;_++){let D=this.idsPart._element.childNodes[_];if(D.nodeType===1&&D.getAttribute("w16cid:paraId")===u){E=D.getAttribute("w16cid:durableId");break}}if(E){let D=this.extensiblePart._element.ownerDocument.createElement("w16cex:commentExtensible");D.setAttribute("w16cex:durableId",E),D.setAttribute("w16cex:dateUtc",a),this.extensiblePart._element.appendChild(D);}}return n}deleteComment(e){if(!this.commentsPart)return;let t=null;for(let n of S(this.commentsPart._element,"w:comment"))if(n.getAttribute("w:id")===e){t=n;break}if(!t)return;let r=null;for(let n of S(t,"w:p")){let a=n.getAttribute("w14:paraId");if(a){r=a;break}}if(r){let n=[];if(this.extendedPart)for(let i=0;i<this.extendedPart._element.childNodes.length;i++){let o=this.extendedPart._element.childNodes[i];if(o.nodeType===1&&o.getAttribute("w15:paraIdParent")===r){let s=o.getAttribute("w15:paraId");if(s){for(let l of S(this.commentsPart._element,"w:comment"))for(let u of S(l,"w:p"))if(u.getAttribute("w14:paraId")===s){let c=l.getAttribute("w:id");c&&n.push(c);break}}}}for(let i of n)this.deleteComment(i);let a=null;if(this.idsPart){let i=[];for(let o=0;o<this.idsPart._element.childNodes.length;o++){let s=this.idsPart._element.childNodes[o];s.nodeType===1&&s.getAttribute("w16cid:paraId")===r&&(a=s.getAttribute("w16cid:durableId"),i.push(s));}i.forEach(o=>this.idsPart._element.removeChild(o));}if(this.extendedPart){let i=[];for(let o=0;o<this.extendedPart._element.childNodes.length;o++){let s=this.extendedPart._element.childNodes[o];s.nodeType===1&&s.getAttribute("w15:paraId")===r&&i.push(s);}i.forEach(o=>this.extendedPart._element.removeChild(o));}if(a&&this.extensiblePart){let i=[];for(let o=0;o<this.extensiblePart._element.childNodes.length;o++){let s=this.extensiblePart._element.childNodes[o];s.nodeType===1&&s.getAttribute("w16cex:durableId")===a&&i.push(s);}i.forEach(o=>this.extensiblePart._element.removeChild(o));}}t.parentNode&&t.parentNode.removeChild(t);}};function hr(e){({part:e.mainDocumentPart,relateTo:h(()=>{},"relateTo")});let n={},a=e.parts.find(l=>l.contentType===be.COMMENTS);if(!a)return n;let i={},o=S(a._element,"w:comment");for(let l of o){let u=l.getAttribute("w:id");if(!u)continue;let c=l.getAttribute("w:author")||"Unknown",f=l.getAttribute("w:date")||"",d=false,p=l.getAttribute("w15:done");(p==="1"||p==="true"||p==="on")&&(d=true);let m=l.getAttribute("w15:p")||null,g=S(l,"w:p");for(let w of g){let E=w.getAttribute("w14:paraId");E&&(i[E]=u);}let b=[];for(let w of g){let E=S(w,"w:t");for(let _ of E)_.textContent&&b.push(_.textContent);b.push(`
|
|
16
|
-
`);}let v=
|
|
15
|
+
`+r),this.pkg.unzipped[t.partname.substring(1)]=wr(r);}return Buffer.from(ui(this.pkg.unzipped))}},ge=class{static{h(this,"Paragraph");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent;get text(){let e="",t=this._element.getElementsByTagName("w:t");for(let r=0;r<t.length;r++)e+=t[r].textContent||"";return e}},et=class{static{h(this,"Run");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},qu=class{static{h(this,"Cell");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},zu=class{static{h(this,"Row");}constructor(e,t){this._element=e,this._parent=t;let r=this._element.getElementsByTagName("w:tc");for(let n=0;n<r.length;n++)this.cells.push(new qu(r[n],this));}_element;_parent;cells=[]},tt=class{static{h(this,"Table");}constructor(e,t){this._element=e,this._parent=t;let r=this._element.getElementsByTagName("w:tr");for(let n=0;n<r.length;n++)this.rows.push(new zu(r[n],this));}_element;_parent;rows=[]},ya=class{static{h(this,"NotesPart");}constructor(e,t){this.part=e,this.note_type=t,this._element=e._element;}part;note_type;_element},ju=class{static{h(this,"FootnoteItem");}constructor(e,t,r){this._element=e,this._parent=t,this.note_type=r,this.id=e.getAttribute("w:id")||"",this.part=t.part;}_element;_parent;note_type;id;part},me={w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006"},be={COMMENTS:"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",EXTENDED:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",IDS:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",EXTENSIBLE:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml"},Ze={COMMENTS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",EXTENDED:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",IDS:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",EXTENSIBLE:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"},Ft=class{static{h(this,"CommentsManager");}constructor(e){this.doc=e;}doc;_commentsPart=null;_extendedPart=null;_idsPart=null;_extensiblePart=null;_nextId=null;get commentsPart(){return this._commentsPart||(this._commentsPart=this._getOrCreateCommentsPart(),this._ensureNamespaces()),this._commentsPart}get extendedPart(){return this._extendedPart||(this._extendedPart=this._getOrCreateExtendedPart()),this._extendedPart}get idsPart(){return this._idsPart||(this._idsPart=this._getOrCreateIdsPart()),this._idsPart}get extensiblePart(){return this._extensiblePart||(this._extensiblePart=this._getOrCreateExtensiblePart()),this._extensiblePart}get nextId(){return this._nextId===null&&(this._nextId=this._getNextCommentId()),this._nextId}set nextId(e){this._nextId=e;}_getExistingPartByType(e){return this.doc.pkg.parts.find(t=>t.contentType===e)||null}_linkPart(e,t){for(let r of this.doc.part.rels.values())if(!r.isExternal&&r.target===e.partname.split("/").pop())return e;return this.doc.relateTo(e,t),e}_getOrCreateCommentsPart(){let e=this._getExistingPartByType(be.COMMENTS);if(e)return this._linkPart(e,Ze.COMMENTS);let t=this.doc.pkg.nextPartname("/word/comments%d.xml"),r=`<w:comments xmlns:w="${me.w}" xmlns:w14="${me.w14}" xmlns:w15="${me.w15}" xmlns:w16cid="${me.w16cid}" xmlns:w16cex="${me.w16cex}" xmlns:mc="${me.mc}" mc:Ignorable="w14 w15 w16cid w16cex"></w:comments>`;return e=this.doc.pkg.addPart(t,be.COMMENTS,r),this.doc.relateTo(e,Ze.COMMENTS),e}_getOrCreateExtendedPart(){let e=this._getExistingPartByType(be.EXTENDED);if(e)return this._linkPart(e,Ze.EXTENDED);let t=this.doc.pkg.nextPartname("/word/commentsExtended%d.xml"),r=`<w15:commentsEx xmlns:w15="${me.w15}"></w15:commentsEx>`;return e=this.doc.pkg.addPart(t,be.EXTENDED,r),this.doc.relateTo(e,Ze.EXTENDED),e}_getOrCreateIdsPart(){let e=this._getExistingPartByType(be.IDS);if(e)return this._linkPart(e,Ze.IDS);let t=this.doc.pkg.nextPartname("/word/commentsIds%d.xml"),r=`<w16cid:commentsIds xmlns:w16cid="${me.w16cid}"></w16cid:commentsIds>`;return e=this.doc.pkg.addPart(t,be.IDS,r),this.doc.relateTo(e,Ze.IDS),e}_getOrCreateExtensiblePart(){let e=this._getExistingPartByType(be.EXTENSIBLE);if(e)return this._linkPart(e,Ze.EXTENSIBLE);let t=this.doc.pkg.nextPartname("/word/commentsExtensible%d.xml"),r=`<w16cex:commentsExtensible xmlns:w16cex="${me.w16cex}"></w16cex:commentsExtensible>`;return e=this.doc.pkg.addPart(t,be.EXTENSIBLE,r),this.doc.relateTo(e,Ze.EXTENSIBLE),e}_ensureNamespaces(){let e=this._commentsPart?._element;if(!e)return;let t=[["xmlns:w",me.w],["xmlns:w14",me.w14],["xmlns:w15",me.w15],["xmlns:w16cid",me.w16cid],["xmlns:w16cex",me.w16cex],["xmlns:mc",me.mc]];for(let[r,n]of t)e.getAttribute(r)||e.setAttribute(r,n);}_getNextCommentId(){let e=[0],t=this._getExistingPartByType(be.COMMENTS);if(t){let r=S(t._element,"w:comment");for(let n of r){let a=n.getAttribute("w:id");a&&e.push(parseInt(a,10)||0);}}return Math.max(...e)+1}_generateHexId(){return Math.floor(Math.random()*4294967295).toString(16).toUpperCase().padStart(8,"0")}_getInitials(e){return e?e.split(" ").filter(Boolean).map(t=>t[0]).join("").toUpperCase():""}_findParaIdForComment(e){if(!this._commentsPart)return null;for(let t of S(this._commentsPart._element,"w:comment"))if(t.getAttribute("w:id")===e)for(let r of S(t,"w:p")){let n=r.getAttribute("w14:paraId");if(n)return n}return null}_findThreadRootParaId(e){let t=this._findParaIdForComment(e),r=this._getExistingPartByType(be.EXTENDED);if(!t||!r)return t;for(let n=0;n<r._element.childNodes.length;n++){let a=r._element.childNodes[n];if(a.nodeType===1&&a.getAttribute("w15:paraId")===t){let i=a.getAttribute("w15:paraIdParent");if(i)return i}}return t}addComment(e,t,r=null){let n=this.nextId.toString();this.nextId++;let a=new Date().toISOString().replace(/\.\d{3}Z$/,"Z"),i=this.commentsPart._element.ownerDocument,o=i.createElement("w:comment");o.setAttribute("w:id",n),o.setAttribute("w:author",e),o.setAttribute("w:date",a);let s=this._getInitials(e);s&&o.setAttribute("w:initials",s);let l=this._getExistingPartByType(be.EXTENDED);r&&!l&&o.setAttribute("w15:p",r);let u=this._generateHexId(),c=this._generateHexId(),f=i.createElement("w:p");f.setAttribute("w14:paraId",u),f.setAttribute("w14:textId","77777777"),f.setAttribute("w:rsidR",c),f.setAttribute("w:rsidRDefault",c),f.setAttribute("w:rsidP",c);let d=i.createElement("w:pPr"),p=i.createElement("w:pStyle");p.setAttribute("w:val","CommentText"),d.appendChild(p),f.appendChild(d);let m=i.createElement("w:r"),g=i.createElement("w:rPr"),E=i.createElement("w:rStyle");E.setAttribute("w:val","CommentReference"),g.appendChild(E),m.appendChild(g),m.appendChild(i.createElement("w:annotationRef")),f.appendChild(m);let v=i.createElement("w:r"),w=i.createElement("w:t");if(w.textContent=t,v.appendChild(w),f.appendChild(v),o.appendChild(f),this.commentsPart._element.appendChild(o),this.extendedPart){let b=r?this._findThreadRootParaId(r):null,D=this.extendedPart._element.ownerDocument.createElement("w15:commentEx");D.setAttribute("w15:paraId",u),b&&D.setAttribute("w15:paraIdParent",b),D.setAttribute("w15:done","0"),this.extendedPart._element.appendChild(D);}if(this.idsPart){let _=this.idsPart._element.ownerDocument.createElement("w16cid:commentId");_.setAttribute("w16cid:paraId",u),_.setAttribute("w16cid:durableId",this._generateHexId()),this.idsPart._element.appendChild(_);}if(this.extensiblePart){let b=null;for(let _=0;_<this.idsPart._element.childNodes.length;_++){let D=this.idsPart._element.childNodes[_];if(D.nodeType===1&&D.getAttribute("w16cid:paraId")===u){b=D.getAttribute("w16cid:durableId");break}}if(b){let D=this.extensiblePart._element.ownerDocument.createElement("w16cex:commentExtensible");D.setAttribute("w16cex:durableId",b),D.setAttribute("w16cex:dateUtc",a),this.extensiblePart._element.appendChild(D);}}return n}deleteComment(e){if(!this.commentsPart)return;let t=null;for(let n of S(this.commentsPart._element,"w:comment"))if(n.getAttribute("w:id")===e){t=n;break}if(!t)return;let r=null;for(let n of S(t,"w:p")){let a=n.getAttribute("w14:paraId");if(a){r=a;break}}if(r){let n=[];if(this.extendedPart)for(let i=0;i<this.extendedPart._element.childNodes.length;i++){let o=this.extendedPart._element.childNodes[i];if(o.nodeType===1&&o.getAttribute("w15:paraIdParent")===r){let s=o.getAttribute("w15:paraId");if(s){for(let l of S(this.commentsPart._element,"w:comment"))for(let u of S(l,"w:p"))if(u.getAttribute("w14:paraId")===s){let c=l.getAttribute("w:id");c&&n.push(c);break}}}}for(let i of n)this.deleteComment(i);let a=null;if(this.idsPart){let i=[];for(let o=0;o<this.idsPart._element.childNodes.length;o++){let s=this.idsPart._element.childNodes[o];s.nodeType===1&&s.getAttribute("w16cid:paraId")===r&&(a=s.getAttribute("w16cid:durableId"),i.push(s));}i.forEach(o=>this.idsPart._element.removeChild(o));}if(this.extendedPart){let i=[];for(let o=0;o<this.extendedPart._element.childNodes.length;o++){let s=this.extendedPart._element.childNodes[o];s.nodeType===1&&s.getAttribute("w15:paraId")===r&&i.push(s);}i.forEach(o=>this.extendedPart._element.removeChild(o));}if(a&&this.extensiblePart){let i=[];for(let o=0;o<this.extensiblePart._element.childNodes.length;o++){let s=this.extensiblePart._element.childNodes[o];s.nodeType===1&&s.getAttribute("w16cex:durableId")===a&&i.push(s);}i.forEach(o=>this.extensiblePart._element.removeChild(o));}}t.parentNode&&t.parentNode.removeChild(t);}};function hr(e){({part:e.mainDocumentPart,relateTo:h(()=>{},"relateTo")});let n={},a=e.parts.find(l=>l.contentType===be.COMMENTS);if(!a)return n;let i={},o=S(a._element,"w:comment");for(let l of o){let u=l.getAttribute("w:id");if(!u)continue;let c=l.getAttribute("w:author")||"Unknown",f=l.getAttribute("w:date")||"",d=false,p=l.getAttribute("w15:done");(p==="1"||p==="true"||p==="on")&&(d=true);let m=l.getAttribute("w15:p")||null,g=S(l,"w:p");for(let w of g){let b=w.getAttribute("w14:paraId");b&&(i[b]=u);}let E=[];for(let w of g){let b=S(w,"w:t");for(let _ of b)_.textContent&&E.push(_.textContent);E.push(`
|
|
16
|
+
`);}let v=E.join("").trim();n[u]={author:c,text:v,date:f,resolved:d,parent_id:m};}let s=e.parts.find(l=>l.contentType===be.EXTENDED);if(s){let l=s._element.childNodes;for(let u=0;u<l.length;u++){let c=l[u];if(c.nodeType!==1)continue;let f=c.getAttribute("w15:paraId"),d=c.getAttribute("w15:paraIdParent"),p=c.getAttribute("w15:done");if(f){let m=i[f];if(m&&n[m]){if(d){let g=i[d];g&&(n[m].parent_id=g);}(p==="1"||p==="true"||p==="on")&&(n[m].resolved=true);}}}}return n}h(hr,"extract_comments_data");var Wu="w:p",Pa="w:r",Ma="w:t",Hu="w:delText",Vu="w:tab",Gu="w:br",Yu="w:cr",Rn="w:rPr",Xu="w:rPrChange",Qu="w:commentReference",Ju="w:footnoteReference",Zu="w:endnoteReference",Ku="w:fldChar",el="w:fldCharType",tl="w:instrText",rl="w:ins",nl="w:del",Ke="w:id",On="w:author",Pn="w:date",il="w:commentRangeStart",al="w:commentRangeEnd",ol="w:hyperlink",sl="r:id",ul="w:fldSimple",ll="w:instr",cl="w:bookmarkStart",fl="w:name",hl="w:sdt",dl="w:smartTag",pl="w:sdtContent",Ra="w:b",ml="w:i",Te="w:val",Ba="w:pPr",Fa="w:pStyle",La="w:outlineLvl",gl="w:numPr",_l="w:numId",wl="w:ilvl",vl=/Heading[ ]?([1-6])(?![0-9])/;function dr(e){let t=e.package||e.pkg||(e.part?e.part.pkg:null);if(t&&t._adeu_style_cache)return t._adeu_style_cache;let r={},n=null,a={},i=t?.getPartByPath("word/styles.xml");if(!i){let u=[r,null];return t&&(t._adeu_style_cache=u),u}let o=S(i._element,"w:style");for(let u of o){let c=u.getAttribute("w:styleId");if(!c)continue;let f=u.getAttribute("w:type"),d=u.getAttribute("w:default")==="1"||u.getAttribute("w:default")==="true";f==="paragraph"&&d&&(n=c);let p=P(u,"w:name"),m=p?p.getAttribute("w:val"):c;m&&typeof m=="string"&&(m.toLowerCase().startsWith("heading")?m=m.replace(/^heading/i,"Heading"):m.toLowerCase()==="title"&&(m="Title"));let g=P(u,"w:basedOn"),E=g?g.getAttribute("w:val"):null,v=null,w=P(u,"w:pPr");if(w){let D=P(w,"w:outlineLvl");if(D){let y=D.getAttribute("w:val");y&&/^\d+$/.test(y)&&(v=parseInt(y,10));}}let b=null,_=P(u,"w:rPr");if(_){let D=P(_,"w:b");if(D){let y=D.getAttribute("w:val");b=y!=="0"&&y!=="false"&&y!=="off";}}a[c]={name:m,based_on:E,outline_level:v,bold:b};}let s=h((u,c)=>{if(r[u])return r[u];if(c.has(u)||!a[u])return {name:u,outline_level:null,bold:false};c.add(u);let f=a[u],d=f.based_on,p=f.outline_level,m=f.bold!==null?f.bold:false;if(d){let E=s(d,c);p===null&&(p=E.outline_level),f.bold===null&&(m=E.bold);}let g={name:f.name,outline_level:p,bold:m};return r[u]=g,g},"resolve_style");for(let u in a)s(u,new Set);let l=[r,n];return t&&(t._adeu_style_cache=l),l}h(dr,"_get_style_cache");function $a(e){if(!e)return null;let t=e.match(vl);return t?parseInt(t[1],10):null}h($a,"_detect_heading_level_from_name");function Bn(e,t,r){t||([t,r]=dr(e._parent.part||e._parent));let n=P(e._element,Ba);if(n){let s=P(n,La);if(s){let l=s.getAttribute(Te);if(l&&/^\d+$/.test(l)){let u=parseInt(l,10);if(u>=0&&u<=8)return true}}}let a=r;if(n){let s=P(n,Fa);s&&(a=s.getAttribute(Te)||r);}let i=a&&t?t[a]:null;if(i&&i.outline_level!==null&&i.outline_level>=0&&i.outline_level<=8)return true;let o=i?i.name:a;return o&&typeof o=="string"&&o.toLowerCase().startsWith("heading")&&(o=o.replace(/^heading/i,"Heading")),!!(o?.startsWith("Heading")||o==="Title"||o&&o!=="Normal"&&$a(o)!==null)}h(Bn,"is_native_heading");function rt(e,t,r){t||([t,r]=dr(e._parent.part||e._parent));let n=P(e._element,Ba);if(n){let s=P(n,La);if(s){let l=s.getAttribute(Te);if(l&&/^\d+$/.test(l)){let u=parseInt(l,10);if(u>=0&&u<=8)return "#".repeat(u+1)+" "}}}let a=r;if(n){let s=P(n,Fa);s&&(a=s.getAttribute(Te)||r);}let i=a&&t?t[a]:null;if(i&&i.outline_level!==null&&i.outline_level>=0&&i.outline_level<=8)return "#".repeat(i.outline_level+1)+" ";let o=i?i.name:a;if(o&&typeof o=="string"&&o.toLowerCase().startsWith("heading")&&(o=o.replace(/^heading/i,"Heading")),o?.startsWith("Heading")){let s=o.replace("Heading","").trim();if(/^\d+$/.test(s))return "#".repeat(parseInt(s,10))+" "}if(o==="Title")return "# ";if(n){let s=P(n,gl);if(s){let l=P(s,_l);if(l&&l.getAttribute(Te)!=="0"){let u=0,c=P(s,wl);if(c){let f=c.getAttribute(Te);f&&(u=parseInt(f,10)||0);}return " ".repeat(u)+"* "}}}if(o&&o!=="Normal"){let s=$a(o);if(s!==null)return "#".repeat(s)+" "}if(!o||o==="Normal"){let s=e.text.trim();if(s&&s.length<100&&s===s.toUpperCase()){let l=false;if(i?.bold)l=true;else {let u=S(e._element,Pa);for(let c of u)if(S(c,Ma).map(p=>p.textContent||"").join("").trim()){let p=P(c,Rn);if(p){let m=P(p,Ra);m&&m.getAttribute(Te)!=="0"&&m.getAttribute(Te)!=="false"&&(l=true);}break}}if(l)return "## "}}return ""}h(rt,"get_paragraph_prefix");function Ua(e,t,r){let n=rt(e,t,r);if(!n)return false;let a=n.trimEnd();return a.length>0&&a==="#".repeat(a.length)}h(Ua,"is_heading_paragraph");function qa(e,t=null){let r="",n="",a=P(e._element,Rn),i=false,o=false;if(a){let s=P(a,Ra);s&&s.getAttribute(Te)!=="0"&&s.getAttribute(Te)!=="false"&&(i=true);let l=P(a,ml);l&&l.getAttribute(Te)!=="0"&&l.getAttribute(Te)!=="false"&&(o=true);}if(t===null){let s=e._parent;t=s instanceof ge?Bn(s):false;}return i&&!t&&(r+="**",n="**"+n),o&&(r+="_",n="_"+n),[r,n]}h(qa,"get_run_style_markers");function yl(e,t,r){return !t&&!r?e:e?e.includes(`
|
|
17
17
|
`)?e.split(`
|
|
18
18
|
`).map(a=>a?`${t}${a}${r}`:"").join(`
|
|
19
19
|
`):`${t}${e}${r}`:""}h(yl,"apply_formatting_to_segments");function ct(e){let t="";for(let r=0;r<e._element.childNodes.length;r++){let n=e._element.childNodes[r];if(n.nodeType===1)if(n.tagName===Ma||n.tagName===Hu){let a=n.textContent||"";t+=a.replace(/\t/g," ");}else n.tagName===Vu?t+=" ":(n.tagName===Gu||n.tagName===Yu)&&(t+=`
|
|
@@ -31,15 +31,15 @@ ${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;this._add_virtual_text(c,r,n
|
|
|
31
31
|
`,r,d),r+=2;}let f=rt(u,i,o);s&&n==="FootnoteItem"&&(f=`[^${e.note_type}-${e.id}]: `+f),f&&(this._add_virtual_text(f,r,u),r+=f.length),r=this._map_paragraph_content(u,r,i,o),s=false,l=u;}else if(u instanceof tt){if(!s){let f=l instanceof ge?l:null;this._add_virtual_text(`
|
|
32
32
|
|
|
33
33
|
`,r,f),r+=2;}r=this._map_table(u,r),s=false,l=u;}return r}_map_table(e,t){let r=t,n=0;for(let a of e.rows){let i=a._element,o=P(i,"w:trPr"),s=o?P(o,"w:ins"):null,l=o?P(o,"w:del"):null;if(this.clean_view&&l||this.original_view&&s)continue;n>0&&(this._add_virtual_text(`
|
|
34
|
-
`,r,null),r+=1),s&&!this.clean_view&&!this.original_view?(this._add_virtual_text("{++ ",r,null),r+=4):l&&!this.clean_view&&!this.original_view&&(this._add_virtual_text("{-- ",r,null),r+=4);let u=new Set,c=0;for(let f of a.cells){if(u.has(f))continue;u.add(f),c>0&&(this._add_virtual_text(" | ",r,null),r+=3);if(r=this._map_blocks(f,r),!this.clean_view&&!this.original_view){let p=f._element.getElementsByTagName("w:p")[0],m=p?p.getAttribute("w14:paraId"):null;if(m&&p){let g=new ge(p,f);this._add_virtual_text("",r,g);let
|
|
34
|
+
`,r,null),r+=1),s&&!this.clean_view&&!this.original_view?(this._add_virtual_text("{++ ",r,null),r+=4):l&&!this.clean_view&&!this.original_view&&(this._add_virtual_text("{-- ",r,null),r+=4);let u=new Set,c=0;for(let f of a.cells){if(u.has(f))continue;u.add(f),c>0&&(this._add_virtual_text(" | ",r,null),r+=3);if(r=this._map_blocks(f,r),!this.clean_view&&!this.original_view){let p=f._element.getElementsByTagName("w:p")[0],m=p?p.getAttribute("w14:paraId"):null;if(m&&p){let g=new ge(p,f);this._add_virtual_text("",r,g);let E=`{#cell:${m}}`;this._add_virtual_text(E,r,g),r+=E.length;}}c+=1;}if(s&&!this.clean_view&&!this.original_view){let f=` |Chg:${s.getAttribute("w:id")}++}`;this._add_virtual_text(f,r,null),r+=f.length;}else if(l&&!this.clean_view&&!this.original_view){let f=` |Chg:${l.getAttribute("w:id")}--}`;this._add_virtual_text(f,r,null),r+=f.length;}n+=1;}return r}_strip_markdown_formatting(e){let t=e;return t=t.replace(/^#+\s*/gm,""),t=t.replace(/\*\*(\w[\w\s]*\w|\w{2,})\*\*/g,"$1"),t=t.replace(/__(\w[\w\s]*\w|\w{2,})__/g,"$1"),t=t.replace(/(?<!\w)_(\w[\w\s]*\w|\w{2,})_(?!\w)/g,"$1"),t=t.replace(/(?<!\w)\*(\w[\w\s]*\w|\w{2,})\*(?!\w)/g,"$1"),t}_map_paragraph_content(e,t,r,n){let a=t,i={start:a,end:a,text:"",run:null,paragraph:e};this.spans.push(i);let o=new Set,s={},l={},u={},c=[],f=["",""],d=["",""],p=null,m=[],g=h(()=>{if(m.length===0)return;let[_,D]=f;_&&(this._add_virtual_text(_,a,e),a+=_.length);for(let[y,A,N,C,M,T]of m){if(y==="virtual")this._add_virtual_text(A,a,e,p);else {let R={start:a,end:a+A.length,text:A,run:N,paragraph:e,ins_id:C||void 0,del_id:M||void 0,hyperlink_id:p||void 0,comment_ids:T.length>0?T:void 0};this.spans.push(R),this._text_chunks.push(A);}a+=A.length;}D&&(this._add_virtual_text(D,a,e),a+=D.length),m=[];},"flush_pending_runs"),E=Array.from(Gr(e)),v=Ua(e,r,n),w=Bn(e,r,n),b=v;for(let _=0;_<E.length;_++){let D=E[_];if(D instanceof et){let[y,A]=qa(D,w),N=[],C=ct(D);if(b){if(C===""||/^\s*$/.test(C))continue;b=false;}if(C.includes(`
|
|
35
35
|
`)&&(y||A)){let F=C.split(`
|
|
36
36
|
`);for(let I=0;I<F.length;I++)I>0&&N.push(["real",`
|
|
37
|
-
`,D]),F[I]&&(y&&N.push(["virtual",y,null]),N.push(["real",F[I],D]),A&&N.push(["virtual",A,null]));}else y&&N.push(["virtual",y,null]),C&&N.push(["real",C,D]),A&&N.push(["virtual",A,null]);this.clean_view&&Object.keys(l).length>0,this.original_view&&Object.keys(s).length>0;let M=N.map(F=>F[1]).join(""),T=Object.keys(s).pop()||null,R=Object.keys(l).pop()||null;if(M&&!(this.clean_view&&R)&&!(this.original_view&&T)){let F=this.clean_view||this.original_view?["",""]:this._get_wrappers(T,R,o,u),I=[y,A];if(m.length>0&&F[0]===f[0]&&F[1]===f[1]){let V=false;I[0]===d[0]&&I[1]===d[1]&&d[0]!==""&&m[m.length-1][0]==="virtual"&&m[m.length-1][1]===d[1]&&(m.pop(),V=true);let U=Array.from(o);for(let[B,L,k]of N){if(V&&B==="virtual"&&L===I[0]){V=false;continue}m.push([B,L,k,T,R,U]);}d=I;}else {g(),f=F,d=I;let V=Array.from(o);for(let[U,B,L]of N)m.push([U,B,L,T,R,V]);}}if(!this.clean_view&&!this.original_view){(Object.keys(s).length>0||Object.keys(l).length>0||o.size>0||Object.keys(u).length>0)&&c.push([{...s},{...l},new Set(o),{...u}]);let I=false;if(T!==null||R!==null||Object.keys(u).length>0||o.size>0){let U=_+1,B=false,L=Object.keys(s).length,k=Object.keys(l).length,W=Object.keys(u).length,Q=new Set(o);for(;U<
|
|
37
|
+
`,D]),F[I]&&(y&&N.push(["virtual",y,null]),N.push(["real",F[I],D]),A&&N.push(["virtual",A,null]));}else y&&N.push(["virtual",y,null]),C&&N.push(["real",C,D]),A&&N.push(["virtual",A,null]);this.clean_view&&Object.keys(l).length>0,this.original_view&&Object.keys(s).length>0;let M=N.map(F=>F[1]).join(""),T=Object.keys(s).pop()||null,R=Object.keys(l).pop()||null;if(M&&!(this.clean_view&&R)&&!(this.original_view&&T)){let F=this.clean_view||this.original_view?["",""]:this._get_wrappers(T,R,o,u),I=[y,A];if(m.length>0&&F[0]===f[0]&&F[1]===f[1]){let V=false;I[0]===d[0]&&I[1]===d[1]&&d[0]!==""&&m[m.length-1][0]==="virtual"&&m[m.length-1][1]===d[1]&&(m.pop(),V=true);let U=Array.from(o);for(let[B,L,k]of N){if(V&&B==="virtual"&&L===I[0]){V=false;continue}m.push([B,L,k,T,R,U]);}d=I;}else {g(),f=F,d=I;let V=Array.from(o);for(let[U,B,L]of N)m.push([U,B,L,T,R,V]);}}if(!this.clean_view&&!this.original_view){(Object.keys(s).length>0||Object.keys(l).length>0||o.size>0||Object.keys(u).length>0)&&c.push([{...s},{...l},new Set(o),{...u}]);let I=false;if(T!==null||R!==null||Object.keys(u).length>0||o.size>0){let U=_+1,B=false,L=Object.keys(s).length,k=Object.keys(l).length,W=Object.keys(u).length,Q=new Set(o);for(;U<E.length;){let oe=E[U];if(oe instanceof et){if(!ct(oe)){U++;continue}(L>0||k>0||W>0||Q.size>0)&&(B=true);break}else {let ee=oe;ee.type==="ins_start"?L++:ee.type==="ins_end"?L=Math.max(0,L-1):ee.type==="del_start"?k++:ee.type==="del_end"?k=Math.max(0,k-1):ee.type==="fmt_start"?W++:ee.type==="fmt_end"?W=Math.max(0,W-1):ee.type==="start"?Q.add(ee.id):ee.type==="end"&&Q.delete(ee.id);}U++;}B&&(I=true);}if(!I&&c.length>0){let U=this._build_merged_meta_block(c);if(U){g(),f=["",""],d=["",""];let B=`{>>${U}<<}`;this._add_virtual_text(B,a,e),a+=B.length;}c=[];}}}else {let y=D;if(b=false,g(),f=["",""],d=["",""],y.type==="start")o.add(y.id);else if(y.type==="end")o.delete(y.id);else if(y.type==="ins_start")s[y.id]=y;else if(y.type==="ins_end")delete s[y.id];else if(y.type==="del_start")l[y.id]=y;else if(y.type==="del_end")delete l[y.id];else if(y.type==="fmt_start")u[y.id]=y;else if(y.type==="fmt_end")delete u[y.id];else if(y.type==="footnote"||y.type==="endnote"){g(),f=["",""],d=["",""];let N=`[^${y.type==="footnote"?"fn":"en"}-${y.id}]`;this._add_virtual_text(N,a,e),a+=N.length;}else if(y.type==="hyperlink_start")g(),f=["",""],d=["",""],this._add_virtual_text("[",a,e,y.id),a+=1,p=y.id;else if(y.type==="hyperlink_end"){g(),f=["",""],d=["",""];let A=`](${y.date})`;this._add_virtual_text(A,a,e,y.id),a+=A.length,p=null;}else if(y.type==="xref_start")g(),f=["",""],d=["",""],this._add_virtual_text("[~",a,e),a+=2;else if(y.type==="xref_end"){g(),f=["",""],d=["",""];let A=`~](#${y.id})`;this._add_virtual_text(A,a,e),a+=A.length;}else if(y.type==="bookmark"){g(),f=["",""],d=["",""];let A=`{#${y.id}}`;this._add_virtual_text(A,a,e),a+=A.length;}}}if(g(),c.length>0){let _=this._build_merged_meta_block(c);if(_){let D=`{>>${_}<<}`;this._add_virtual_text(D,a,e),a+=D.length;}}return a}_get_wrappers(e,t,r,n){return t?["{--","--}"]:e?["{++","++}"]:r.size>0||Object.keys(n).length>0?["{==","==}"]:["",""]}_build_merged_meta_block(e){let t=[],r=[],n=new Set;for(let[a,i,o,s]of e){for(let[u,c]of Object.entries(a)){let f=`Chg:${u}`;if(!n.has(f)){let d=c.author||"Unknown";t.push(`[${f} insert] ${d}`),n.add(f);}}for(let[u,c]of Object.entries(i)){let f=`Chg:${u}`;if(!n.has(f)){let d=c.author||"Unknown";t.push(`[${f} delete] ${d}`),n.add(f);}}for(let[u,c]of Object.entries(s)){let f=`Chg:${u}`;if(!n.has(f)){let d=c.author||"Unknown";t.push(`[${f} format] ${d}`),n.add(f);}}let l=Array.from(o).sort();for(let u of l){if(!this.comments_map[u])continue;let c=`Com:${u}`;if(!n.has(c)){let f=this.comments_map[u],d=`[${c}] ${f.author}`;f.date&&(d+=` @ ${f.date}`),f.resolved&&(d+="(RESOLVED)"),r.push(`${d}: ${f.text}`),n.add(c);}}}return [...t,...r].join(`
|
|
38
38
|
`)}_add_virtual_text(e,t,r,n=null){let a={start:t,end:t+e.length,text:e,run:null,paragraph:r,hyperlink_id:n||void 0};this.spans.push(a),this._text_chunks.push(e);}_replace_smart_quotes(e){return e.replace(/“/g,'"').replace(/”/g,'"').replace(/‘/g,"'").replace(/’/g,"'")}_make_fuzzy_regex(e){e=this._strip_markdown_formatting(e),e=this._replace_smart_quotes(e);let t=[],r=/(\[_+\])|(\s+)|(['"])|([.,;:\/\-\[\](){}+=$?*!|#^<>\\%&@~`_])/g,n=0,a,i=h(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp");for(;(a=r.exec(e))!==null;){let s=e.substring(n,a.index);s&&t.push(i(s));let l=a[1],u=a[2],c=a[3],f=a[4];l?t.push("\\[_+\\]"):u?(t.push("(?:\\*\\*|__|\\*|_)?"),t.push("\\s+"),t.push("(?:\\*\\*|__|\\*|_)?")):c?c==="'"?t.push("[\u2018\u2019']"):t.push('["\u201C\u201D]'):f&&(t.push("(?:\\*\\*|__|\\*|_)?"),t.push(i(f)),t.push("(?:\\*\\*|__|\\*|_)?")),n=r.lastIndex;}let o=e.substring(n);return o&&t.push(i(o)),t.join("")}find_match_index(e,t=false){if(t){try{let s=new RegExp(e).exec(this.full_text);if(s)return [s.index,s[0].length]}catch{}return [-1,0]}let r=this.full_text.indexOf(e);if(r!==-1)return [r,e.length];let n=this._replace_smart_quotes(this.full_text),a=this._replace_smart_quotes(e);if(r=n.indexOf(a),r!==-1)return [r,e.length];let i=this._strip_markdown_formatting(e);if(this.full_text.includes(i))return r=this.full_text.indexOf(i),[r,i.length];try{let s=new RegExp(this._make_fuzzy_regex(e)).exec(this.full_text);if(s)return [s.index,s[0].length]}catch{}return [-1,0]}find_all_match_indices(e,t=false){if(!e)return [];if(t){try{let s=new RegExp(e,"g"),l=[...this.full_text.matchAll(s)];if(l.length>0)return l.map(u=>[u.index,u[0].length])}catch{}return []}let r=h(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),n=[...this.full_text.matchAll(new RegExp(r(e),"g"))];if(n.length>0)return n.map(s=>[s.index,s[0].length]);let a=this._replace_smart_quotes(this.full_text),i=this._replace_smart_quotes(e);if(n=[...a.matchAll(new RegExp(r(i),"g"))],n.length>0)return n.map(s=>[s.index,s[0].length]);let o=this._strip_markdown_formatting(e);if(n=[...this.full_text.matchAll(new RegExp(r(o),"g"))],n.length>0)return n.map(s=>[s.index,s[0].length]);try{let s=new RegExp(this._make_fuzzy_regex(e),"g");if(n=[...this.full_text.matchAll(s)],n.length>0)return n.map(l=>[l.index,l[0].length])}catch{}return []}find_target_runs(e){let[t,r]=this.find_match_index(e);return t===-1?[]:this._resolve_runs_at_range(t,t+r)}find_target_runs_by_index(e,t,r=true){return this._resolve_runs_at_range(e,e+t,r)}get_virtual_spans_in_range(e,t){let r=e+t;return this.spans.filter(n=>n.run===null&&n.text===`
|
|
39
39
|
|
|
40
|
-
`&&n.start>=e&&n.end<=r)}_resolve_runs_at_range(e,t,r=true){let n=this.spans.filter(u=>u.end>e&&u.start<t);if(n.length===0)return [];let a=n.filter(u=>u.run!==null).map(u=>u.run);if(a.length===0)return [];let i=false,o=n.find(u=>u.run!==null),s=0;if(o){let u=e-o.start;if(u>0){let[,f]=this._split_run_at_index(a[0],u);a[0]=f,i=true,s=u;}}let l=[...n].reverse().find(u=>u.run!==null);if(l){let u=o===l,c=a[a.length-1],d=Math.min(l.end,t)-l.start;u&&s>0&&(d-=s);let p=ct(c);if(d>0&&d<p.length){let[m]=this._split_run_at_index(c,d);a[a.length-1]=m,i=true;}}return i&&r&&this._build_map(),a}get_insertion_anchor(e,t=true){let r=this.spans.filter(i=>i.end===e);if(r.length>0){for(let i=r.length-1;i>=0;i--)if(r[i].run)return [r[i].run,r[i].paragraph];for(let i=r.length-1;i>=0;i--)if(r[i].paragraph)return [null,r[i].paragraph]}let n=this.spans.filter(i=>i.start<e&&e<i.end);if(n.length>0){let i=n[0];if(i.run===null)return i.paragraph===null?this.get_insertion_anchor(i.end,t):[null,i.paragraph];{let o=e-i.start,[s]=this._split_run_at_index(i.run,o);return t&&this._build_map(),[s,i.paragraph]}}if(e===0&&this.spans.length>0){for(let i of this.spans)if(i.run)return [i.run,i.paragraph];for(let i of this.spans)if(i.paragraph)return [null,i.paragraph];return [null,null]}let a=this.spans.filter(i=>i.end<e);if(a.length>0){for(let i=a.length-1;i>=0;i--)if(a[i].run)return [a[i].run,a[i].paragraph];for(let i=a.length-1;i>=0;i--)if(a[i].paragraph)return [null,a[i].paragraph]}return [null,null]}_split_run_at_index(e,t){let r=ct(e),n=r.substring(0,t),a=r.substring(t);this._set_run_text_elements(e._element,n);let i=e._element.cloneNode(true);this._set_run_text_elements(i,a),e._element.parentNode&&e._element.parentNode.insertBefore(i,e._element.nextSibling);let o=new et(i,e._parent);return [e,o]}_set_run_text_elements(e,t){let r=[];for(let a=0;a<e.childNodes.length;a++){let i=e.childNodes[a];i.nodeType===1&&["w:t","w:delText","w:br","w:cr","w:tab"].includes(i.tagName)&&r.push(i);}for(let a of r)e.removeChild(a);let n=e.ownerDocument;if(n){let a=n.createElement("w:t");a.textContent=t,t.trim()!==t&&a.setAttribute("xml:space","preserve"),e.appendChild(a);}}get_context_at_range(e,t){let r=this.spans.filter(n=>n.run&&n.end>e&&n.start<t);return r.length>0?r[0]:null}};function Ea(e){let t=0,r=0,n=e.length,a=h(i=>/[a-zA-Z0-9]/.test(i),"isAlnum");for(;r<n;){if(e[r]==="_"){let i=false;(r>0&&e[r-1]==="_"||r<n-1&&e[r+1]==="_")&&(i=true);let o=false;r>0&&a(e[r-1])&&r<n-1&&a(e[r+1])&&(o=true),!i&&!o&&t++;}r++;}return t}h(Ea,"_count_standalone_underscores");function jr(e,t){if(!e||!t)return [0,0];let r=h(u=>/\s/.test(u),"isSpace"),n=0,a=Math.min(e.length,t.length);for(;n<a&&e[n]===t[n];)n++;if(n<e.length&&n<t.length)for(;n>0;){let u=!r(e[n-1])&&!r(e[n]),c=!r(t[n-1])&&!r(t[n]);if(u||c)n--;else break}for(;n>0;){if(n<e.length){let g=e.substring(n-1,n+1);if(g==="**"||g==="__"){n--;continue}}let u=e.substring(0,n),c=(u.match(/\*\*/g)||[]).length,f=(u.match(/__/g)||[]).length,d=Ea(u);if(c%2!==0){n=u.lastIndexOf("**");continue}if(f%2!==0){n=u.lastIndexOf("__");continue}if(d%2!==0){let g=u.length-1,
|
|
40
|
+
`&&n.start>=e&&n.end<=r)}_resolve_runs_at_range(e,t,r=true){let n=this.spans.filter(u=>u.end>e&&u.start<t);if(n.length===0)return [];let a=n.filter(u=>u.run!==null).map(u=>u.run);if(a.length===0)return [];let i=false,o=n.find(u=>u.run!==null),s=0;if(o){let u=e-o.start;if(u>0){let[,f]=this._split_run_at_index(a[0],u);a[0]=f,i=true,s=u;}}let l=[...n].reverse().find(u=>u.run!==null);if(l){let u=o===l,c=a[a.length-1],d=Math.min(l.end,t)-l.start;u&&s>0&&(d-=s);let p=ct(c);if(d>0&&d<p.length){let[m]=this._split_run_at_index(c,d);a[a.length-1]=m,i=true;}}return i&&r&&this._build_map(),a}get_insertion_anchor(e,t=true){let r=this.spans.filter(i=>i.end===e);if(r.length>0){for(let i=r.length-1;i>=0;i--)if(r[i].run)return [r[i].run,r[i].paragraph];for(let i=r.length-1;i>=0;i--)if(r[i].paragraph)return [null,r[i].paragraph]}let n=this.spans.filter(i=>i.start<e&&e<i.end);if(n.length>0){let i=n[0];if(i.run===null)return i.paragraph===null?this.get_insertion_anchor(i.end,t):[null,i.paragraph];{let o=e-i.start,[s]=this._split_run_at_index(i.run,o);return t&&this._build_map(),[s,i.paragraph]}}if(e===0&&this.spans.length>0){for(let i of this.spans)if(i.run)return [i.run,i.paragraph];for(let i of this.spans)if(i.paragraph)return [null,i.paragraph];return [null,null]}let a=this.spans.filter(i=>i.end<e);if(a.length>0){for(let i=a.length-1;i>=0;i--)if(a[i].run)return [a[i].run,a[i].paragraph];for(let i=a.length-1;i>=0;i--)if(a[i].paragraph)return [null,a[i].paragraph]}return [null,null]}_split_run_at_index(e,t){let r=ct(e),n=r.substring(0,t),a=r.substring(t);this._set_run_text_elements(e._element,n);let i=e._element.cloneNode(true);this._set_run_text_elements(i,a),e._element.parentNode&&e._element.parentNode.insertBefore(i,e._element.nextSibling);let o=new et(i,e._parent);return [e,o]}_set_run_text_elements(e,t){let r=[];for(let a=0;a<e.childNodes.length;a++){let i=e.childNodes[a];i.nodeType===1&&["w:t","w:delText","w:br","w:cr","w:tab"].includes(i.tagName)&&r.push(i);}for(let a of r)e.removeChild(a);let n=e.ownerDocument;if(n){let a=n.createElement("w:t");a.textContent=t,t.trim()!==t&&a.setAttribute("xml:space","preserve"),e.appendChild(a);}}get_context_at_range(e,t){let r=this.spans.filter(n=>n.run&&n.end>e&&n.start<t);return r.length>0?r[0]:null}};function Ea(e){let t=0,r=0,n=e.length,a=h(i=>/[a-zA-Z0-9]/.test(i),"isAlnum");for(;r<n;){if(e[r]==="_"){let i=false;(r>0&&e[r-1]==="_"||r<n-1&&e[r+1]==="_")&&(i=true);let o=false;r>0&&a(e[r-1])&&r<n-1&&a(e[r+1])&&(o=true),!i&&!o&&t++;}r++;}return t}h(Ea,"_count_standalone_underscores");function jr(e,t){if(!e||!t)return [0,0];let r=h(u=>/\s/.test(u),"isSpace"),n=0,a=Math.min(e.length,t.length);for(;n<a&&e[n]===t[n];)n++;if(n<e.length&&n<t.length)for(;n>0;){let u=!r(e[n-1])&&!r(e[n]),c=!r(t[n-1])&&!r(t[n]);if(u||c)n--;else break}for(;n>0;){if(n<e.length){let g=e.substring(n-1,n+1);if(g==="**"||g==="__"){n--;continue}}let u=e.substring(0,n),c=(u.match(/\*\*/g)||[]).length,f=(u.match(/__/g)||[]).length,d=Ea(u);if(c%2!==0){n=u.lastIndexOf("**");continue}if(f%2!==0){n=u.lastIndexOf("__");continue}if(d%2!==0){let g=u.length-1,E=h(v=>/[a-zA-Z0-9]/.test(v),"isAlnum");for(;g>=0;){if(u[g]==="_"&&(g===0||u[g-1]!=="_")&&(g===u.length-1||u[g+1]!=="_")&&!(g>0&&E(u[g-1])&&g<u.length-1&&E(u[g+1]))){n=g;break}g--;}continue}let p=n,m=false;for(;p>0;){let g=e[p-1];if(g==="#"){for(n=p-1;n>0&&e[n-1]!==`
|
|
41
41
|
`;)n--;m=true;break}if(g===`
|
|
42
|
-
`)break;p--;}if(!m)break}let i=0,o=e.length-n,s=t.length-n,l=Math.min(o,s);for(;i<l&&e[e.length-1-i]===t[t.length-1-i];)i++;if(i>0)for(;i>0;){let u=false;i<e.length&&(u=!r(e[e.length-1-i])&&!r(e[e.length-i]));let c=false;if(i<t.length&&(c=!r(t[t.length-1-i])&&!r(t[t.length-i])),u||c)i--;else break}for(;i>0;){let u=e.length-i;if(u>0){let m=e.substring(u-1,u+1);if(m==="**"||m==="__"){i--;continue}}let c=e.substring(e.length-i),f=(c.match(/\*\*/g)||[]).length,d=(c.match(/__/g)||[]).length,p=Ea(c);if(f%2!==0){i-=c.indexOf("**")+2;continue}if(d%2!==0){i-=c.indexOf("__")+2;continue}if(p%2!==0){let m=0,g=h(
|
|
42
|
+
`)break;p--;}if(!m)break}let i=0,o=e.length-n,s=t.length-n,l=Math.min(o,s);for(;i<l&&e[e.length-1-i]===t[t.length-1-i];)i++;if(i>0)for(;i>0;){let u=false;i<e.length&&(u=!r(e[e.length-1-i])&&!r(e[e.length-i]));let c=false;if(i<t.length&&(c=!r(t[t.length-1-i])&&!r(t[t.length-i])),u||c)i--;else break}for(;i>0;){let u=e.length-i;if(u>0){let m=e.substring(u-1,u+1);if(m==="**"||m==="__"){i--;continue}}let c=e.substring(e.length-i),f=(c.match(/\*\*/g)||[]).length,d=(c.match(/__/g)||[]).length,p=Ea(c);if(f%2!==0){i-=c.indexOf("**")+2;continue}if(d%2!==0){i-=c.indexOf("__")+2;continue}if(p%2!==0){let m=0,g=h(E=>/[a-zA-Z0-9]/.test(E),"isAlnum");for(;m<c.length;){if(c[m]==="_"&&(m===0||c[m-1]!=="_")&&(m===c.length-1||c[m+1]!=="_")&&!(m>0&&g(c[m-1])&&m<c.length-1&&g(c[m+1]))){i-=m+1;break}m++;}continue}break}i>0&&/^\s+$/.test(e.substring(e.length-i))&&(i=0);for(let u of ["**","__","_"]){let c=u.length,f=e.substring(n,e.length-i),d=t.substring(n,t.length-i);f.startsWith(u)&&d.startsWith(u)&&f.endsWith(u)&&d.endsWith(u)&&f.length>=2*c&&d.length>=2*c&&(n+=c,i+=c);}return [n,i]}h(jr,"trim_common_context");function bl(e,t){let r=[],n={},a=/(\s+|[\p{L}\p{N}_]+|[^\p{L}\p{N}_\s])/gu,i=h(o=>{let s=o.split(a).filter(Boolean),l="";for(let u of s)if(u in n)l+=String.fromCharCode(n[u]);else {let c=r.length;n[u]=c,r.push(u),l+=String.fromCharCode(c);}return l},"encode_text");return [i(e),i(t),r]}h(bl,"_words_to_chars");function Dl(e,t){let r=new ja.default.diff_match_patch;r.Diff_Timeout=2;let[n,a,i]=bl(e,t),o=r.diff_main(n,a,false);r.diff_cleanupSemantic(o);for(let c=0;c<o.length;c++){let f=o[c][1],d="";for(let p=0;p<f.length;p++)d+=i[f.charCodeAt(p)];o[c][1]=d;}let s=[],l=0,u=null;for(let[c,f]of o)if(c===0){if(u){let[d,p]=u;s.push({type:"modify",target_text:p,new_text:"",comment:"Diff: Text deleted",_match_start_index:d}),u=null;}l+=f.length;}else if(c===-1)u=[l,f],l+=f.length;else if(c===1)if(u){let[d,p]=u;s.push({type:"modify",target_text:p,new_text:f,comment:"Diff: Replacement",_match_start_index:d}),u=null;}else s.push({type:"modify",target_text:"",new_text:f,comment:"Diff: Text inserted",_match_start_index:l});if(u){let[c,f]=u;s.push({type:"modify",target_text:f,new_text:"",comment:"Diff: Text deleted",_match_start_index:c});}return s}h(Dl,"generate_edits_from_text");function Wa(e,t,r="Original",n="Modified"){let a=Dl(e,t),i=[`--- ${r}`,`+++ ${n}`,""],o=40;for(let s of a){let l=s._match_start_index||0,u=s.target_text||"",c=s.new_text||"",[f,d]=jr(u,c),p=u.length-d,m=c.length-d,g=u.substring(f,p),E=c.substring(f,m),v=l+f,w=v+g.length,b=Math.max(0,v-o),_=e.substring(b,v);b>0&&(_="..."+_);let D=Math.min(e.length,w+o),y=e.substring(w,D);D<e.length&&(y=y+"..."),_=_.replace(/\n/g," ").replace(/\r/g,""),y=y.replace(/\n/g," ").replace(/\r/g,""),i.push("@@ Word Patch @@"),i.push(` ${_}`),g&&i.push(`- ${g}`),E&&i.push(`+ ${E}`),i.push(` ${y}`),i.push("");}return i.join(`
|
|
43
43
|
`)}h(Wa,"create_word_patch_diff");var ba=19e3,Al="<!-- READONLY_BOUNDARY_START -->",Da={"{++":"++}","{--":"--}","{==":"==}","{>>":"<<}"},Nl=/\bChg:(\d+)\b/g;function Lt(e){if(!e)return ["",""];let t=e.indexOf(Al);if(t===-1)return [e,""];let r=e.lastIndexOf(`
|
|
44
44
|
`,t)+1,n=e.substring(0,r).trimEnd(),a=e.substring(r);return [n,a]}h(Lt,"split_structural_appendix");function $t(e,t=""){if(!e){let u=t?t.trim():"";return {pages:[{page:1,total_pages:1,has_next:false,has_prev:false,tracked_change_count:Aa(u),page_content:u}],total_pages:1,body_pages:[""],body_page_offsets:[0]}}let r=Cl(e),[n,a]=Sl(r),i;if(t&&t.trim()){let l=t.trim();i=n.map(u=>u?`${u}
|
|
45
45
|
|
|
@@ -50,31 +50,31 @@ ${l}`:l);}else i=[...n];let o=i.length;return {pages:i.map((l,u)=>({page:u+1,tot
|
|
|
50
50
|
|
|
51
51
|
${u}`,l++;else break}t.push([s,a]),r=l;}return t}h(Tl,"_merge_footnote_sections");function Sl(e){if(!e.length)return [[""],[0]];let t=[],r=[],n=[],a=0,i=-1,o=h(()=>{n.length>0&&(t.push(n.join(`
|
|
52
52
|
|
|
53
|
-
`)),r.push(i)),n=[],a=0,i=-1;},"flush_current");for(let[s,l]of e){let u=s.length,c=u+(n.length>0?2:0);if(n.length>0&&a+c>ba&&o(),n.length===0&&u>ba){t.push(s),r.push(l);continue}n.length===0&&(i=l),n.push(s),a+=a>0?c:u;}return o(),t.length?[t,r]:[[""],[0]]}h(Sl,"_assemble_pages");function Aa(e){let t=[...e.matchAll(Nl)];return new Set(t.map(n=>n[1])).size}h(Aa,"_count_tracked_changes");var Il=5,Na=50;function kl(e,t,r,n){let a=n.length;if(a<2)throw new Error(`format_ambiguity_error requires at least 2 matches, got ${a}`);let i=n.slice(0,Il),o=a-i.length,s=[`- Edit ${e} Failed: Ambiguous match. Target text appears ${a} times. First ${i.length} occurrences:`];for(let l=0;l<i.length;l++){let[u,c]=i[l],f=Math.max(0,u-Na),d=Math.min(r.length,c+Na),p=r.substring(f,u).replace(/\n/g," "),m=r.substring(c,d).replace(/\n/g," "),g=r.substring(u,c).replace(/\n/g," ");g.length>50&&(g=g.substring(0,25)+"..."+g.substring(g.length-20));let
|
|
53
|
+
`)),r.push(i)),n=[],a=0,i=-1;},"flush_current");for(let[s,l]of e){let u=s.length,c=u+(n.length>0?2:0);if(n.length>0&&a+c>ba&&o(),n.length===0&&u>ba){t.push(s),r.push(l);continue}n.length===0&&(i=l),n.push(s),a+=a>0?c:u;}return o(),t.length?[t,r]:[[""],[0]]}h(Sl,"_assemble_pages");function Aa(e){let t=[...e.matchAll(Nl)];return new Set(t.map(n=>n[1])).size}h(Aa,"_count_tracked_changes");var Il=5,Na=50;function kl(e,t,r,n){let a=n.length;if(a<2)throw new Error(`format_ambiguity_error requires at least 2 matches, got ${a}`);let i=n.slice(0,Il),o=a-i.length,s=[`- Edit ${e} Failed: Ambiguous match. Target text appears ${a} times. First ${i.length} occurrences:`];for(let l=0;l<i.length;l++){let[u,c]=i[l],f=Math.max(0,u-Na),d=Math.min(r.length,c+Na),p=r.substring(f,u).replace(/\n/g," "),m=r.substring(c,d).replace(/\n/g," "),g=r.substring(u,c).replace(/\n/g," ");g.length>50&&(g=g.substring(0,25)+"..."+g.substring(g.length-20));let E=f>0?"...":"",v=d<r.length?"...":"";s.push(` ${l+1}. "${E}${p}[${g}]${m}${v}"`);}return o>0&&s.push(` ... and ${o} more occurrence(s) not shown.`),s.push(" To resolve, re-send this edit using ONE of these strategies:"),s.push(` 1. Set "match_mode": "all" to modify ALL ${a} occurrences (same target_text).`),s.push(' 2. Set "match_mode": "first" to modify only the FIRST occurrence (same target_text).'),s.push(' 3. Please provide more surrounding context in your target_text to uniquely identify a single location (keep the default "match_mode": "strict").'),s.join(`
|
|
54
54
|
`)}h(kl,"format_ambiguity_error");function lt(e){let t=e.nextSibling;for(;t;){if(t.nodeType===1)return t;t=t.nextSibling;}return null}h(lt,"getNextElement");function Ur(e){let t=e.previousSibling;for(;t;){if(t.nodeType===1)return t;t=t.previousSibling;}return null}h(Ur,"getPreviousElement");function Bt(e,t){t.parentNode&&t.parentNode.insertBefore(e,t.nextSibling);}h(Bt,"insertAfter");function Ca(e){let t=[...e.pkg.parts],r={...e.pkg.unzipped},n=new Map,a=new Map;for(let i of t)n.set(i,new Map(i.rels)),i._element&&a.set(i,i._element.cloneNode(true));return {parts:t,unzipped:r,rels:n,elements:a}}h(Ca,"takeSnapshot");function xa(e,t){e.pkg.parts=[...t.parts];for(let r of Object.keys(e.pkg.unzipped))delete e.pkg.unzipped[r];for(let[r,n]of Object.entries(t.unzipped))e.pkg.unzipped[r]=n;for(let r of t.parts){r.rels=new Map(t.rels.get(r));let n=t.elements.get(r);if(n&&r._element){let a=r._element.ownerDocument;a&&a.documentElement&&a.replaceChild(n,a.documentElement),r._element=n;}}}h(xa,"restoreSnapshot");function Ol(e,t){if(!e||!t)return [e,t];let r=e.match(/^(#+)\s+/),n=t.match(/^(#+)\s+/);if(r&&n&&r[1]===n[1]){let a=r[1],i=e.substring(a.length).trimStart(),o=t.substring(a.length).trimStart();return [i,o]}return [e,t]}h(Ol,"stripMatchingHeadingHashes");var qr=class extends Error{static{h(this,"BatchValidationError");}errors;constructor(e){super(`Batch validation failed:
|
|
55
55
|
`+e.join(`
|
|
56
|
-
`)),this.name="BatchValidationError",this.errors=e;}};function Pl(e,t=0){let r=[];for(let n=0;n<e.length;n++){let a=e[n],i=a.target_text||"",o=a.new_text||"";if((o.includes("{++")||o.includes("{--")||o.includes("{>>")||o.includes("{=="))&&r.push(`- Edit ${n+1+t} Failed: Do not manually write CriticMarkup tags ({++, {--, {>>, {==) in \`new_text\`. The engine handles redlining automatically. To add a comment, use the \`comment\` parameter.`),i.includes("[^")||o.includes("[^")){let s=(i.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort(),l=(o.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort();JSON.stringify(s)!==JSON.stringify(l)&&(l.length>s.length||l.some(u=>l.filter(c=>c===u).length>s.filter(c=>c===u).length)?r.push(`- Edit ${n+1+t} Failed: Cannot insert footnote/endnote markers via text replace. Markers like \`[^fn-N]\` are read-only projections. Use Word's References menu.`):r.push(`- Edit ${n+1+t} Failed: Cannot delete footnote/endnote references via text replace. The marker corresponds to a structural XML element.`));}if(i.includes("](")||o.includes("](")){let s=(i.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort(),l=(o.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort();s.length!==l.length?l.length>s.length?r.push(`- Edit ${n+1+t} Failed: Cannot insert hyperlinks via text replace. Use a dedicated structural operation.`):r.push(`- Edit ${n+1+t} Failed: Cannot delete hyperlinks via text replace. The marker corresponds to a structural XML element.`):s.length>1&&JSON.stringify(s)!==JSON.stringify(l)&&r.push(`- Edit ${n+1+t} Failed: Can only edit or retarget one hyperlink per text replacement. Please split into multiple edits.`);}if(i.includes("[~")||o.includes("[~")){let s=i.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[],l=o.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[];s.length!==l.length?l.length>s.length?r.push(`- Edit ${n+1+t} Failed: Cannot insert cross-references via text replace. Markers are read-only projections.`):r.push(`- Edit ${n+1+t} Failed: Cannot delete cross-references via text replace. The marker corresponds to a structural XML element.`):JSON.stringify(s)!==JSON.stringify(l)&&r.push(`- Edit ${n+1+t} Failed: Modifying or retargeting cross-reference markers is disallowed to prevent dependency corruption.`);}if(i.includes("{#")||o.includes("{#")){let s=i.match(/\{#[^\}]+\}/g)||[],l=o.match(/\{#[^\}]+\}/g)||[];for(let u of l)if(l.filter(c=>c===u).length>s.filter(c=>c===u).length){r.push(`- Edit ${n+1+t} Failed: Cannot modify or insert internal anchor markers (\`{#...}\`). These represent structural XML bookmarks.`);break}}if(a.type==="modify"&&o){let s=o.split(/[\r\n]+/);for(let l of s){let u=l.trimStart();if(u.startsWith("#######")){let c=u.length-u.replace(/^#+/,"").length;if(u.substring(c).startsWith(" ")||u.substring(c)===""){r.push(`- Edit ${n+1+t} Failed: Heading level ${c} is not supported (maximum is 6).`);break}}}}(i.includes("READONLY_BOUNDARY_START")||o.includes("READONLY_BOUNDARY_START")||i.includes("# Document Structure (Read-Only)")||o.includes("# Document Structure (Read-Only)")||i.includes("Document Structure (Read-Only)")||o.includes("Document Structure (Read-Only)"))&&r.push(`- Edit ${n+1+t} Failed: Modification targets the read-only boundary (Structural Appendix). This section cannot be edited.`);}return r}h(Pl,"validate_edit_strings");var Ln=class{static{h(this,"RedlineEngine");}doc;author;timestamp;current_id;mapper;comments_manager;clean_mapper=null;original_mapper=null;skipped_details=[];constructor(e,t="Adeu AI (TS)"){this.doc=e,this.author=t,this.timestamp=new Date().toISOString().replace(/\.\d{3}Z$/,"Z");let r="http://schemas.microsoft.com/office/word/2023/wordml/word16du";for(let n of this.doc.pkg.parts)n===this.doc.part&&(n._element.hasAttribute("xmlns:w16du")||n._element.setAttribute("xmlns:w16du",r));this.current_id=this._scan_existing_ids(),this.mapper=new He(this.doc),this.comments_manager=new Ft(this.doc);}_check_punctuation_warning(e){return e
|
|
57
|
-
Did you mean the literal "${r}"? It appears in the document (\u2026${o}\u2026). If you used a regex, drop the ^/$ anchors \u2014 they match the start/end of the entire document, not a line.`}return ""}_build_edit_context_previews(e){if(e.type!=="modify")return [null,null];e._resolved_proxy_edit&&(e=e._resolved_proxy_edit);let t=e._resolved_start_idx;if(t==null)return [null,null];let r=e.target_text||"",n=e.new_text||"",[a,i]=this._parse_markdown_style(r);if(i&&i.startsWith("Heading")){let v=r.length-a.length;t+=v,r=a;}let[o,s]=this._parse_markdown_style(n);s&&s.startsWith("Heading")&&(n=o);let l=r.length,c=(e._active_mapper_ref||this.mapper).full_text;if(!c)return [null,null];let f=Math.max(0,t-30),d=c.substring(f,t),p=c.substring(t+l,t+l+30),m=n?`{++${n}++}`:"",g=`${d}{--${r}--}${m}${p}`,
|
|
58
|
-
`),o=[],s=999;for(let l=i.length-1;l>=0;l--){let c=i[l].match(/^(#{1,6})\s+(.*)/);if(c){let f=c[1].length;if(f<s){let d=c[2].replace(/\*\*|__|[*_]/g,"").replace(/\{#[^}]+\}/g,"").trim();if(d.length>80&&(d=d.substring(0,80)+"..."),o.unshift(d),s=f,f===1)break}}}return [o.join(" > "),n]}accept_all_revisions(){let e=[this.doc.element];for(let n of this.doc.pkg.parts)n!==this.doc.part&&n.contentType.includes("wordprocessingml")&&n.contentType.endsWith("+xml")&&e.push(n._element);for(let n of e){let a=S(n,"w:ins");for(let s of a){this._clean_wrapping_comments(s);let l=s.parentNode;if(l){if(l.tagName==="w:trPr"){l.removeChild(s);continue}for(;s.firstChild;)l.insertBefore(s.firstChild,s);l.removeChild(s);}}let i=S(n,"w:p");for(let s of i){let l=P(s,"w:pPr");if(l){let u=P(l,"w:rPr"),c=u?P(u,"w:del"):null;if(u&&c){let f=false;for(let d of ["w:t","w:tab","w:br"]){for(let p of S(s,d)){if(d==="w:t"&&!p.textContent)continue;let m=false,g=p.parentNode;for(;g&&g!==s;){if(g.tagName==="w:del"){m=true;break}g=g.parentNode;}if(!m){f=true;break}}if(f)break}f?u.removeChild(c):(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),s.parentNode&&s.parentNode.removeChild(s));}}}let o=S(n,"w:del");for(let s of o){this._clean_wrapping_comments(s),this._delete_comments_in_element(s);let l=s.parentNode;if(l)if(l.tagName==="w:trPr"){let u=l.parentNode;u&&u.parentNode&&u.parentNode.removeChild(u);}else l.removeChild(s);}}for(let n of e){for(let i of ["w:commentRangeStart","w:commentRangeEnd"])for(let o of S(n,i))o.parentNode?.removeChild(o);let a=S(n,"w:commentReference");for(let i of a){let o=i.parentNode;o&&((o.tagName==="w:r"||o.tagName.endsWith(":r"))&&Array.from(o.childNodes).filter(l=>l.nodeType===1&&l.tagName!=="w:rPr"&&l.tagName!=="rPr").length<=1?o.parentNode?.removeChild(o):o.removeChild(i));}}let t=this.doc.pkg,r=new Set;for(let n of t.parts)if(n.partname.toLowerCase().includes("comments")){r.add(n.partname);let a=n.partname.startsWith("/")?n.partname:"/"+n.partname,i=n.partname.startsWith("/")?n.partname.substring(1):n.partname;r.add(a),r.add(i);}if(r.size>0){for(let a of t.parts)if(a.partname.endsWith(".rels")){let i=S(a._element,"Relationship"),o=[];for(let s of i)if((s.getAttribute("Target")||"").toLowerCase().includes("comments")){o.push(s);let u=a.partname.replace("/_rels/","/").replace(".rels",""),c=t.getPartByPath(u);if(c){let f=s.getAttribute("Id");f&&c.rels.delete(f);}}for(let s of o)s.parentNode?.removeChild(s);}let n=t.getPartByPath("[Content_Types].xml");if(n){let a=S(n._element,"Override"),i=[];for(let o of a){let s=o.getAttribute("PartName")||"";(r.has(s)||s.toLowerCase().includes("comments"))&&i.push(o);}for(let o of i)o.parentNode?.removeChild(o);}t.parts=t.parts.filter(a=>!a.partname.toLowerCase().includes("comments"));for(let a of Object.keys(t.unzipped))a.toLowerCase().includes("comments")&&delete t.unzipped[a];}}reject_all_revisions(){let e=[this.doc.element];for(let t of this.doc.pkg.parts)t!==this.doc.part&&t.contentType.includes("wordprocessingml")&&t.contentType.endsWith("+xml")&&e.push(t._element);for(let t of e){let r=S(t,"w:ins");for(let i of r){let o=i.parentNode;if(o)if(this._clean_wrapping_comments(i),this._delete_comments_in_element(i),o.tagName==="w:trPr"){let s=o.parentNode;s&&s.parentNode&&s.parentNode.removeChild(s);}else o.removeChild(i);}let n=S(t,"w:p");for(let i of n){let o=P(i,"w:pPr");if(o){let s=P(o,"w:rPr"),l=s?P(s,"w:del"):null;s&&l&&s.removeChild(l);}}let a=S(t,"w:del");for(let i of a){let o=i.parentNode;if(!o)continue;if(this._clean_wrapping_comments(i),o.tagName==="w:trPr"){o.removeChild(i);continue}let s=Array.from(i.getElementsByTagName("w:delText"));for(let l of s){let u=i.ownerDocument.createElement("w:t");u.textContent=l.textContent,l.hasAttribute("xml:space")&&u.setAttribute("xml:space","preserve"),l.parentNode?.replaceChild(u,l);}for(;i.firstChild;)o.insertBefore(i.firstChild,i);o.removeChild(i);}}}_getNextId(){return this.current_id++,this.current_id.toString()}_create_track_change_tag(e,t="",r=null){let a=this.doc.part._element.ownerDocument.createElement(e),i=r!==null?r:this._getNextId();return a.setAttribute("w:id",i),a.setAttribute("w:author",t||this.author),a.setAttribute("w:date",this.timestamp),a.setAttribute("w16du:dateUtc",this.timestamp),a}_set_text_content(e,t){e.textContent=t,t.trim()!==t&&e.setAttribute("xml:space","preserve");}_attach_comment(e,t,r,n){if(!n)return;let a=this.comments_manager.addComment(this.author,n),i=e.ownerDocument,o=i.createElement("w:commentRangeStart");o.setAttribute("w:id",a);let s=i.createElement("w:commentRangeEnd");s.setAttribute("w:id",a);let l=i.createElement("w:r"),u=i.createElement("w:rPr"),c=i.createElement("w:rStyle");c.setAttribute("w:val","CommentReference"),u.appendChild(c),l.appendChild(u);let f=i.createElement("w:commentReference");f.setAttribute("w:id",a),l.appendChild(f),e.insertBefore(o,t);let d=r.nextSibling;d?(e.insertBefore(s,d),e.insertBefore(l,s.nextSibling)):(e.appendChild(s),e.appendChild(l));}_attach_comment_spanning(e,t,r,n,a){if(!a)return;let i=this.comments_manager.addComment(this.author,a),o=e.ownerDocument,s=r.ownerDocument,l=o.createElement("w:commentRangeStart");l.setAttribute("w:id",i);let u=s.createElement("w:commentRangeEnd");u.setAttribute("w:id",i);let c=s.createElement("w:r"),f=s.createElement("w:rPr"),d=s.createElement("w:rStyle");d.setAttribute("w:val","CommentReference"),f.appendChild(d),c.appendChild(f);let p=s.createElement("w:commentReference");p.setAttribute("w:id",i),c.appendChild(p),e.insertBefore(l,t);let m=n.nextSibling;m?(r.insertBefore(u,m),r.insertBefore(c,u.nextSibling)):(r.appendChild(u),r.appendChild(c));}_track_insert_multiline(e,t,r,n){if(!e)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let a=this.doc.part._element.ownerDocument,i=e.split(/[\r\n]+/),o=null;if(r!==null)o=r._element;else if(t!==null){let E=t._element;for(;E&&E.tagName!=="w:p";)E=E.parentNode;o=E;}for(;i.length>1&&i[i.length-1]==="";)i.pop();if(i.length===0)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let[s,l]=this._parse_markdown_style(i[0]),c=l!==null&&o!==null,f=null,d=null;c||(d=this._build_tracked_ins_for_line((s===i[0],i[0]),t,n,a),f=d);let p=c?i:i.slice(1);if(p.length===0)return {first_node:f,last_p:null,last_ins:d,used_block_mode:false};if(!o)return {first_node:f,last_p:null,last_ins:d,used_block_mode:false};let m=o.parentNode;if(!m)return {first_node:f,last_p:null,last_ins:d,used_block_mode:false};let g=h((E,_)=>{m.insertBefore(E,_.nextSibling);},"insertAfterEl"),b=null,v=null,w=o;for(let E=0;E<p.length;E++){let _=p[E],[D,y]=this._parse_markdown_style(_),A=a.createElement("w:p");if(y)this._set_paragraph_style(A,y);else {let R=P(o,"w:pPr");R&&A.appendChild(R.cloneNode(true));}let N=P(A,"w:pPr");N||(N=a.createElement("w:pPr"),A.insertBefore(N,A.firstChild));let C=P(N,"w:rPr");C||(C=a.createElement("w:rPr"),N.appendChild(C));let M=this._create_track_change_tag("w:ins","",n);C.appendChild(M);let T=this._build_tracked_ins_for_line(D,t,n,a);T&&A.appendChild(T),g(A,w),w=A,b=A,v=T,f||(f=A);}return {first_node:f,last_p:b,last_ins:v,used_block_mode:c}}_build_tracked_ins_for_line(e,t,r,n){if(!e&&e!=="")return null;let a=this._create_track_change_tag("w:ins","",r),i=this._parse_inline_markdown(e);if(i.length===0)return null;for(let[o,s]of i){let l=n.createElement("w:r");if(t&&t._element){let c=P(t._element,"w:rPr");if(c){let f=c.cloneNode(true);for(let d of ["w:vanish","w:strike","w:dstrike","w:i","w:iCs","w:b","w:bCs"]){let p=P(f,d);p&&f.removeChild(p);}l.appendChild(f);}}this._apply_run_props(l,s,false);let u=n.createElement("w:t");this._set_text_content(u,o),l.appendChild(u),a.appendChild(l);}return a}_parse_markdown_style(e){let t=e.trimStart();if(t.startsWith("#")){let n=0,a=t;for(;a.startsWith("#");)n++,a=a.substring(1);if(a.startsWith(" "))return [a.trim(),`Heading ${n}`]}if(t.startsWith("* ")||t.startsWith("- "))return [t.substring(2).trim(),"List Paragraph"];let r=t.match(/^\d+\.\s+/);return r?[t.substring(r[0].length).trim(),"List Number"]:[e,null]}_parse_inline_markdown(e,t={}){if(!e)return [];let r=/(\*\*.*?\*\*)|(_.*?_)/,n=e.match(r);if(!n)return [[e,t]];let a=n.index,i=n[0],o=a+i.length,s=i.startsWith("**"),l=s?i.substring(2,i.length-2):i.substring(1,i.length-1),u=e.substring(0,a),c=e.substring(o),f=[];u&&f.push([u,t]);let d={...t};return s?d.bold=true:d.italic=true,f.push(...this._parse_inline_markdown(l,d)),f.push(...this._parse_inline_markdown(c,t)),f}_apply_run_props(e,t,r=false){if(!t){if(!r)return;t={};}let n=P(e,"w:rPr");if(!n&&(t.bold||t.italic||r)&&(n=e.ownerDocument.createElement("w:rPr"),e.appendChild(n)),n){let a=e.ownerDocument;if(t.bold){let i=P(n,"w:b");i||(i=a.createElement("w:b"),n.appendChild(i)),i.setAttribute("w:val","1");}else if(r){let i=P(n,"w:b");i&&n.removeChild(i);}if(t.italic){let i=P(n,"w:i");i||(i=a.createElement("w:i"),n.appendChild(i)),i.setAttribute("w:val","1");}else if(r){let i=P(n,"w:i");i&&n.removeChild(i);}}}_set_paragraph_style(e,t){let r=e.ownerDocument,n=P(e,"w:pPr");n&&e.removeChild(n);let a=r.createElement("w:pPr"),i=r.createElement("w:pStyle"),o=t.replace(/\s+/g,"");i.setAttribute("w:val",o),a.appendChild(i),e.insertBefore(a,e.firstChild);}_anchor_reply_comment(e,t){let r=this.doc.part._element.ownerDocument,n=S(this.doc.element,"w:commentRangeStart").filter(g=>g.getAttribute("w:id")===e);if(n.length===0)return;let a=n[0],i=r.createElement("w:commentRangeStart");i.setAttribute("w:id",t),Bt(i,a);let o=S(this.doc.element,"w:commentRangeEnd").filter(g=>g.getAttribute("w:id")===e);if(o.length===0)return;let s=o[0],l=S(this.doc.element,"w:commentReference").filter(g=>g.getAttribute("w:id")===e),u=s;if(l.length>0){let g=l[0];g.parentNode&&g.parentNode.tagName==="w:r"&&(u=g.parentNode);}let c=r.createElement("w:commentRangeEnd");c.setAttribute("w:id",t),Bt(c,u);let f=r.createElement("w:r"),d=r.createElement("w:rPr"),p=r.createElement("w:rStyle");p.setAttribute("w:val","CommentReference"),d.appendChild(p),f.appendChild(d);let m=r.createElement("w:commentReference");m.setAttribute("w:id",t),f.appendChild(m),Bt(f,c);}_clean_wrapping_comments(e){let t=e;for(;;){let l=Ur(t);if(l&&(l.tagName==="w:ins"||l.tagName==="w:del"))t=l;else break}let r=e;for(;;){let l=lt(r);if(l&&(l.tagName==="w:ins"||l.tagName==="w:del"))r=l;else break}let n=[],a=Ur(t);for(;a;)if(a.tagName==="w:commentRangeStart")n.push(a),a=Ur(a);else if(a.tagName==="w:rPr"||a.tagName==="w:pPr")a=Ur(a);else break;let i=[],o=lt(r);for(;o;)if(o.tagName==="w:commentRangeEnd")i.push(o),o=lt(o);else if(o.tagName==="w:r"&&S(o,"w:commentReference").length>0)i.push(o),o=lt(o);else if(o.tagName==="w:commentReference")i.push(o),o=lt(o);else break;let s=new Set;for(let l of i)if(l.tagName==="w:commentRangeEnd"){let u=l.getAttribute("w:id");u&&s.add(u);}else {let u=S(l,"w:commentReference")[0];if(!u&&l.tagName==="w:commentReference"&&(u=l),u){let c=u.getAttribute("w:id");c&&s.add(c);}}for(let l of n){let u=l.getAttribute("w:id");if(u&&s.has(u)){this.comments_manager.deleteComment(u),l.parentNode&&l.parentNode.removeChild(l);for(let c of i){let f=null;if(c.tagName==="w:commentRangeEnd")f=c.getAttribute("w:id");else {let d=S(c,"w:commentReference")[0];!d&&c.tagName==="w:commentReference"&&(d=c),d&&(f=d.getAttribute("w:id"));}f===u&&c.parentNode&&c.parentNode.removeChild(c);}}}}_delete_comments_in_element(e){let t=S(e,"w:commentReference");for(let r of t){let n=r.getAttribute("w:id");if(n){this.comments_manager.deleteComment(n);for(let a of ["w:commentRangeStart","w:commentRangeEnd"]){let i=S(this.doc.element,a);for(let o of i)o.getAttribute("w:id")===n&&o.parentNode&&o.parentNode.removeChild(o);}}}}validate_edits(e,t=0){let r=[];this.mapper.full_text||this.mapper._build_map(),r.push(...Pl(e,t));for(let n=0;n<e.length;n++){let a=e[n];if(typeof a!="object"||a===null){r.push(`- Edit ${n+1+t} Failed: Invalid change format. Expected a JSON object, but received a primitive ${typeof a}. Do not pass raw strings.`);continue}if(!a.target_text)continue;let i=a.regex||false,o=a.match_mode||"strict",s=this.mapper.find_all_match_indices(a.target_text,i),l=this.mapper.full_text,u=this.mapper;s.length===0&&(this.clean_mapper||(this.clean_mapper=new He(this.doc,true)),s=this.clean_mapper.find_all_match_indices(a.target_text,i),s.length>0&&(l=this.clean_mapper.full_text,u=this.clean_mapper)),l===this.mapper.full_text&&s.length>0&&(s=s.filter(([p,m])=>{let g=this.mapper.spans.filter(b=>b.run!==null&&b.end>p&&b.start<p+m);return g.length===0?true:g.some(b=>!b.del_id)}));let c=false,f=new Set;if(s.length===0){this.original_mapper||(this.original_mapper=new He(this.doc,false,true));let d=this.original_mapper.find_all_match_indices(a.target_text,i);if(d.length>0){c=true;for(let[p,m]of d){let g=this.original_mapper.spans.filter(b=>b.end>p&&b.start<p+m);for(let b of g)if(b.run!==null){let v=b.run._element;for(;v;){if(v.nodeType===1&&v.tagName==="w:del"){let w=v.getAttribute("w:author");w&&f.add(w);break}v=v.parentNode;}}}}}if(s.length===0)if(c){let d=f.size>0?`by ${Array.from(f).sort().join(", ")}`:"by an existing revision";r.push(`- Edit ${n+1+t} Failed: Target text matches text inside a tracked deletion ${d}. Reject/accept that change first or target the active replacement text instead.`);}else {let d=this._nearest_match_hint(a.target_text,i);r.push(`- Edit ${n+1+t} Failed: Target text not found in document:
|
|
59
|
-
"${a.target_text}"${d}`);}else if(s.length>1&&o==="strict")if(a.target_text.includes("|"))s=s.slice(0,1);else {let d=s.map(([p,m])=>[p,p+m]);r.push(kl(n+1+t,a.target_text,l,d));}if(s.length===1){let[d,p]=s[0],m=l.substring(d,d+p),[g,
|
|
56
|
+
`)),this.name="BatchValidationError",this.errors=e;}};function Pl(e,t=0){let r=[];for(let n=0;n<e.length;n++){let a=e[n],i=a.target_text||"",o=a.new_text||"";if((o.includes("{++")||o.includes("{--")||o.includes("{>>")||o.includes("{=="))&&r.push(`- Edit ${n+1+t} Failed: Do not manually write CriticMarkup tags ({++, {--, {>>, {==) in \`new_text\`. The engine handles redlining automatically. To add a comment, use the \`comment\` parameter.`),i.includes("[^")||o.includes("[^")){let s=(i.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort(),l=(o.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort();JSON.stringify(s)!==JSON.stringify(l)&&(l.length>s.length||l.some(u=>l.filter(c=>c===u).length>s.filter(c=>c===u).length)?r.push(`- Edit ${n+1+t} Failed: Cannot insert footnote/endnote markers via text replace. Markers like \`[^fn-N]\` are read-only projections. Use Word's References menu.`):r.push(`- Edit ${n+1+t} Failed: Cannot delete footnote/endnote references via text replace. The marker corresponds to a structural XML element.`));}if(i.includes("](")||o.includes("](")){let s=(i.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort(),l=(o.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort();s.length!==l.length?l.length>s.length?r.push(`- Edit ${n+1+t} Failed: Cannot insert hyperlinks via text replace. Use a dedicated structural operation.`):r.push(`- Edit ${n+1+t} Failed: Cannot delete hyperlinks via text replace. The marker corresponds to a structural XML element.`):s.length>1&&JSON.stringify(s)!==JSON.stringify(l)&&r.push(`- Edit ${n+1+t} Failed: Can only edit or retarget one hyperlink per text replacement. Please split into multiple edits.`);}if(i.includes("[~")||o.includes("[~")){let s=i.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[],l=o.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[];s.length!==l.length?l.length>s.length?r.push(`- Edit ${n+1+t} Failed: Cannot insert cross-references via text replace. Markers are read-only projections.`):r.push(`- Edit ${n+1+t} Failed: Cannot delete cross-references via text replace. The marker corresponds to a structural XML element.`):JSON.stringify(s)!==JSON.stringify(l)&&r.push(`- Edit ${n+1+t} Failed: Modifying or retargeting cross-reference markers is disallowed to prevent dependency corruption.`);}if(i.includes("{#")||o.includes("{#")){let s=i.match(/\{#[^\}]+\}/g)||[],l=o.match(/\{#[^\}]+\}/g)||[];for(let u of l)if(l.filter(c=>c===u).length>s.filter(c=>c===u).length){r.push(`- Edit ${n+1+t} Failed: Cannot modify or insert internal anchor markers (\`{#...}\`). These represent structural XML bookmarks.`);break}}if(a.type==="modify"&&o){let s=o.split(/[\r\n]+/);for(let l of s){let u=l.trimStart();if(u.startsWith("#######")){let c=u.length-u.replace(/^#+/,"").length;if(u.substring(c).startsWith(" ")||u.substring(c)===""){r.push(`- Edit ${n+1+t} Failed: Heading level ${c} is not supported (maximum is 6).`);break}}}}(i.includes("READONLY_BOUNDARY_START")||o.includes("READONLY_BOUNDARY_START")||i.includes("# Document Structure (Read-Only)")||o.includes("# Document Structure (Read-Only)")||i.includes("Document Structure (Read-Only)")||o.includes("Document Structure (Read-Only)"))&&r.push(`- Edit ${n+1+t} Failed: Modification targets the read-only boundary (Structural Appendix). This section cannot be edited.`);}return r}h(Pl,"validate_edit_strings");var Ln=class{static{h(this,"RedlineEngine");}doc;author;timestamp;current_id;mapper;comments_manager;clean_mapper=null;original_mapper=null;skipped_details=[];constructor(e,t="Adeu AI (TS)"){this.doc=e,this.author=t,this.timestamp=new Date().toISOString().replace(/\.\d{3}Z$/,"Z");let r="http://schemas.microsoft.com/office/word/2023/wordml/word16du";for(let n of this.doc.pkg.parts)n===this.doc.part&&(n._element.hasAttribute("xmlns:w16du")||n._element.setAttribute("xmlns:w16du",r));this.current_id=this._scan_existing_ids(),this.mapper=new He(this.doc),this.comments_manager=new Ft(this.doc);}_check_punctuation_warning(e){return !e||e.length>20||e.includes(" ")?null:e.includes("_")||e.includes("-")?`Warning: target_text '${e}' contains tokenization-splitting punctuation ('_' or '-'). This can trigger mid-word splits in the diff engine. Consider using a longer plain-prose anchor.`:null}_nearest_match_hint(e,t){if(!e)return "";let r=e;if(t&&(r=r.replace(/^\^/,"").replace(/\$$/,""),r=r.replace(/^\\s\*/,"").replace(/\\s\*$/,""),r=r.replace(/\\([.^$*+?()[\]{}|\\/])/g,"$1")),r=r.trim(),(!r||r===e)&&!t)return "";let n=this.mapper.full_text.indexOf(r);if(n!==-1){let a=Math.max(0,n-15),i=Math.min(this.mapper.full_text.length,n+r.length+15),o=this.mapper.full_text.substring(a,i).replace(/\n/g," ");return `
|
|
57
|
+
Did you mean the literal "${r}"? It appears in the document (\u2026${o}\u2026). If you used a regex, drop the ^/$ anchors \u2014 they match the start/end of the entire document, not a line.`}return ""}_build_edit_context_previews(e){if(e.type!=="modify")return [null,null];e._resolved_proxy_edit&&(e=e._resolved_proxy_edit);let t=e._resolved_start_idx;if(t==null)return [null,null];let r=e.target_text||"",n=e.new_text||"",[a,i]=this._parse_markdown_style(r);if(i&&i.startsWith("Heading")){let v=r.length-a.length;t+=v,r=a;}let[o,s]=this._parse_markdown_style(n);s&&s.startsWith("Heading")&&(n=o);let l=r.length,c=(e._active_mapper_ref||this.mapper).full_text;if(!c)return [null,null];let f=Math.max(0,t-30),d=c.substring(f,t),p=c.substring(t+l,t+l+30),m=n?`{++${n}++}`:"",g=`${d}{--${r}--}${m}${p}`,E=g;return E=E.replace(/\{>>.*?<<\}/gs,""),E=E.replace(/\{--.*?--\}/gs,""),E=E.replace(/\{\+\+(.*?)\+\+\}/gs,"$1"),[g,E]}_scan_existing_ids(){let e=0;for(let t of ["w:ins","w:del"]){let r=S(this.doc.element,t);for(let n of r){let a=parseInt(n.getAttribute("w:id")||"0",10);!isNaN(a)&&a>e&&(e=a);}}return e}_get_heading_path_and_page(e,t,r){let n=1;for(let l=0;l<r.length&&e>=r[l];l++)n=l+1;let i=t.substring(0,e).split(`
|
|
58
|
+
`),o=[],s=999;for(let l=i.length-1;l>=0;l--){let c=i[l].match(/^(#{1,6})\s+(.*)/);if(c){let f=c[1].length;if(f<s){let d=c[2].replace(/\*\*|__|[*_]/g,"").replace(/\{#[^}]+\}/g,"").trim();if(d.length>80&&(d=d.substring(0,80)+"..."),o.unshift(d),s=f,f===1)break}}}return [o.join(" > "),n]}accept_all_revisions(){let e=[this.doc.element];for(let n of this.doc.pkg.parts)n!==this.doc.part&&n.contentType.includes("wordprocessingml")&&n.contentType.endsWith("+xml")&&e.push(n._element);for(let n of e){let a=S(n,"w:ins");for(let s of a){this._clean_wrapping_comments(s);let l=s.parentNode;if(l){if(l.tagName==="w:trPr"){l.removeChild(s);continue}for(;s.firstChild;)l.insertBefore(s.firstChild,s);l.removeChild(s);}}let i=S(n,"w:p");for(let s of i){let l=P(s,"w:pPr");if(l){let u=P(l,"w:rPr"),c=u?P(u,"w:del"):null;if(u&&c){let f=false;for(let d of ["w:t","w:tab","w:br"]){for(let p of S(s,d)){if(d==="w:t"&&!p.textContent)continue;let m=false,g=p.parentNode;for(;g&&g!==s;){if(g.tagName==="w:del"){m=true;break}g=g.parentNode;}if(!m){f=true;break}}if(f)break}f?u.removeChild(c):(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),s.parentNode&&s.parentNode.removeChild(s));}}}let o=S(n,"w:del");for(let s of o){this._clean_wrapping_comments(s),this._delete_comments_in_element(s);let l=s.parentNode;if(l)if(l.tagName==="w:trPr"){let u=l.parentNode;u&&u.parentNode&&u.parentNode.removeChild(u);}else l.removeChild(s);}}for(let n of e){for(let i of ["w:commentRangeStart","w:commentRangeEnd"])for(let o of S(n,i))o.parentNode?.removeChild(o);let a=S(n,"w:commentReference");for(let i of a){let o=i.parentNode;o&&((o.tagName==="w:r"||o.tagName.endsWith(":r"))&&Array.from(o.childNodes).filter(l=>l.nodeType===1&&l.tagName!=="w:rPr"&&l.tagName!=="rPr").length<=1?o.parentNode?.removeChild(o):o.removeChild(i));}}let t=this.doc.pkg,r=new Set;for(let n of t.parts)if(n.partname.toLowerCase().includes("comments")){r.add(n.partname);let a=n.partname.startsWith("/")?n.partname:"/"+n.partname,i=n.partname.startsWith("/")?n.partname.substring(1):n.partname;r.add(a),r.add(i);}if(r.size>0){for(let a of t.parts)if(a.partname.endsWith(".rels")){let i=S(a._element,"Relationship"),o=[];for(let s of i)if((s.getAttribute("Target")||"").toLowerCase().includes("comments")){o.push(s);let u=a.partname.replace("/_rels/","/").replace(".rels",""),c=t.getPartByPath(u);if(c){let f=s.getAttribute("Id");f&&c.rels.delete(f);}}for(let s of o)s.parentNode?.removeChild(s);}let n=t.getPartByPath("[Content_Types].xml");if(n){let a=S(n._element,"Override"),i=[];for(let o of a){let s=o.getAttribute("PartName")||"";(r.has(s)||s.toLowerCase().includes("comments"))&&i.push(o);}for(let o of i)o.parentNode?.removeChild(o);}t.parts=t.parts.filter(a=>!a.partname.toLowerCase().includes("comments"));for(let a of Object.keys(t.unzipped))a.toLowerCase().includes("comments")&&delete t.unzipped[a];}}reject_all_revisions(){let e=[this.doc.element];for(let t of this.doc.pkg.parts)t!==this.doc.part&&t.contentType.includes("wordprocessingml")&&t.contentType.endsWith("+xml")&&e.push(t._element);for(let t of e){let r=S(t,"w:ins");for(let i of r){let o=i.parentNode;if(o)if(this._clean_wrapping_comments(i),this._delete_comments_in_element(i),o.tagName==="w:trPr"){let s=o.parentNode;s&&s.parentNode&&s.parentNode.removeChild(s);}else o.removeChild(i);}let n=S(t,"w:p");for(let i of n){let o=P(i,"w:pPr");if(o){let s=P(o,"w:rPr"),l=s?P(s,"w:del"):null;s&&l&&s.removeChild(l);}}let a=S(t,"w:del");for(let i of a){let o=i.parentNode;if(!o)continue;if(this._clean_wrapping_comments(i),o.tagName==="w:trPr"){o.removeChild(i);continue}let s=Array.from(i.getElementsByTagName("w:delText"));for(let l of s){let u=i.ownerDocument.createElement("w:t");u.textContent=l.textContent,l.hasAttribute("xml:space")&&u.setAttribute("xml:space","preserve"),l.parentNode?.replaceChild(u,l);}for(;i.firstChild;)o.insertBefore(i.firstChild,i);o.removeChild(i);}}}_getNextId(){return this.current_id++,this.current_id.toString()}_create_track_change_tag(e,t="",r=null){let a=this.doc.part._element.ownerDocument.createElement(e),i=r!==null?r:this._getNextId();return a.setAttribute("w:id",i),a.setAttribute("w:author",t||this.author),a.setAttribute("w:date",this.timestamp),a.setAttribute("w16du:dateUtc",this.timestamp),a}_set_text_content(e,t){e.textContent=t,t.trim()!==t&&e.setAttribute("xml:space","preserve");}_attach_comment(e,t,r,n){if(!n)return;let a=this.comments_manager.addComment(this.author,n),i=e.ownerDocument,o=i.createElement("w:commentRangeStart");o.setAttribute("w:id",a);let s=i.createElement("w:commentRangeEnd");s.setAttribute("w:id",a);let l=i.createElement("w:r"),u=i.createElement("w:rPr"),c=i.createElement("w:rStyle");c.setAttribute("w:val","CommentReference"),u.appendChild(c),l.appendChild(u);let f=i.createElement("w:commentReference");f.setAttribute("w:id",a),l.appendChild(f),e.insertBefore(o,t);let d=r.nextSibling;d?(e.insertBefore(s,d),e.insertBefore(l,s.nextSibling)):(e.appendChild(s),e.appendChild(l));}_attach_comment_spanning(e,t,r,n,a){if(!a)return;let i=this.comments_manager.addComment(this.author,a),o=e.ownerDocument,s=r.ownerDocument,l=o.createElement("w:commentRangeStart");l.setAttribute("w:id",i);let u=s.createElement("w:commentRangeEnd");u.setAttribute("w:id",i);let c=s.createElement("w:r"),f=s.createElement("w:rPr"),d=s.createElement("w:rStyle");d.setAttribute("w:val","CommentReference"),f.appendChild(d),c.appendChild(f);let p=s.createElement("w:commentReference");p.setAttribute("w:id",i),c.appendChild(p),e.insertBefore(l,t);let m=n.nextSibling;m?(r.insertBefore(u,m),r.insertBefore(c,u.nextSibling)):(r.appendChild(u),r.appendChild(c));}_track_insert_multiline(e,t,r,n){if(!e)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let a=this.doc.part._element.ownerDocument,i=e.split(/[\r\n]+/),o=null;if(r!==null)o=r._element;else if(t!==null){let b=t._element;for(;b&&b.tagName!=="w:p";)b=b.parentNode;o=b;}for(;i.length>1&&i[i.length-1]==="";)i.pop();if(i.length===0)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let[s,l]=this._parse_markdown_style(i[0]),c=l!==null&&o!==null,f=null,d=null;c||(d=this._build_tracked_ins_for_line((s===i[0],i[0]),t,n,a),f=d);let p=c?i:i.slice(1);if(p.length===0)return {first_node:f,last_p:null,last_ins:d,used_block_mode:false};if(!o)return {first_node:f,last_p:null,last_ins:d,used_block_mode:false};let m=o.parentNode;if(!m)return {first_node:f,last_p:null,last_ins:d,used_block_mode:false};let g=h((b,_)=>{m.insertBefore(b,_.nextSibling);},"insertAfterEl"),E=null,v=null,w=o;for(let b=0;b<p.length;b++){let _=p[b],[D,y]=this._parse_markdown_style(_),A=a.createElement("w:p");if(y)this._set_paragraph_style(A,y);else {let R=P(o,"w:pPr");R&&A.appendChild(R.cloneNode(true));}let N=P(A,"w:pPr");N||(N=a.createElement("w:pPr"),A.insertBefore(N,A.firstChild));let C=P(N,"w:rPr");C||(C=a.createElement("w:rPr"),N.appendChild(C));let M=this._create_track_change_tag("w:ins","",n);C.appendChild(M);let T=this._build_tracked_ins_for_line(D,t,n,a);T&&A.appendChild(T),g(A,w),w=A,E=A,v=T,f||(f=A);}return {first_node:f,last_p:E,last_ins:v,used_block_mode:c}}_build_tracked_ins_for_line(e,t,r,n){if(!e&&e!=="")return null;let a=this._create_track_change_tag("w:ins","",r),i=this._parse_inline_markdown(e);if(i.length===0)return null;for(let[o,s]of i){let l=n.createElement("w:r");if(t&&t._element){let c=P(t._element,"w:rPr");if(c){let f=c.cloneNode(true);for(let d of ["w:vanish","w:strike","w:dstrike","w:i","w:iCs","w:b","w:bCs"]){let p=P(f,d);p&&f.removeChild(p);}l.appendChild(f);}}this._apply_run_props(l,s,false);let u=n.createElement("w:t");this._set_text_content(u,o),l.appendChild(u),a.appendChild(l);}return a}_parse_markdown_style(e){let t=e.trimStart();if(t.startsWith("#")){let n=0,a=t;for(;a.startsWith("#");)n++,a=a.substring(1);if(a.startsWith(" "))return [a.trim(),`Heading ${n}`]}if(t.startsWith("* ")||t.startsWith("- "))return [t.substring(2).trim(),"List Paragraph"];let r=t.match(/^\d+\.\s+/);return r?[t.substring(r[0].length).trim(),"List Number"]:[e,null]}_parse_inline_markdown(e,t={}){if(!e)return [];let r=/(\*\*.*?\*\*)|(_.*?_)/,n=e.match(r);if(!n)return [[e,t]];let a=n.index,i=n[0],o=a+i.length,s=i.startsWith("**"),l=s?i.substring(2,i.length-2):i.substring(1,i.length-1),u=e.substring(0,a),c=e.substring(o),f=[];u&&f.push([u,t]);let d={...t};return s?d.bold=true:d.italic=true,f.push(...this._parse_inline_markdown(l,d)),f.push(...this._parse_inline_markdown(c,t)),f}_apply_run_props(e,t,r=false){if(!t){if(!r)return;t={};}let n=P(e,"w:rPr");if(!n&&(t.bold||t.italic||r)&&(n=e.ownerDocument.createElement("w:rPr"),e.appendChild(n)),n){let a=e.ownerDocument;if(t.bold){let i=P(n,"w:b");i||(i=a.createElement("w:b"),n.appendChild(i)),i.setAttribute("w:val","1");}else if(r){let i=P(n,"w:b");i&&n.removeChild(i);}if(t.italic){let i=P(n,"w:i");i||(i=a.createElement("w:i"),n.appendChild(i)),i.setAttribute("w:val","1");}else if(r){let i=P(n,"w:i");i&&n.removeChild(i);}}}_set_paragraph_style(e,t){let r=e.ownerDocument,n=P(e,"w:pPr");n&&e.removeChild(n);let a=r.createElement("w:pPr"),i=r.createElement("w:pStyle"),o=t.replace(/\s+/g,"");i.setAttribute("w:val",o),a.appendChild(i),e.insertBefore(a,e.firstChild);}_anchor_reply_comment(e,t){let r=this.doc.part._element.ownerDocument,n=S(this.doc.element,"w:commentRangeStart").filter(g=>g.getAttribute("w:id")===e);if(n.length===0)return;let a=n[0],i=r.createElement("w:commentRangeStart");i.setAttribute("w:id",t),Bt(i,a);let o=S(this.doc.element,"w:commentRangeEnd").filter(g=>g.getAttribute("w:id")===e);if(o.length===0)return;let s=o[0],l=S(this.doc.element,"w:commentReference").filter(g=>g.getAttribute("w:id")===e),u=s;if(l.length>0){let g=l[0];g.parentNode&&g.parentNode.tagName==="w:r"&&(u=g.parentNode);}let c=r.createElement("w:commentRangeEnd");c.setAttribute("w:id",t),Bt(c,u);let f=r.createElement("w:r"),d=r.createElement("w:rPr"),p=r.createElement("w:rStyle");p.setAttribute("w:val","CommentReference"),d.appendChild(p),f.appendChild(d);let m=r.createElement("w:commentReference");m.setAttribute("w:id",t),f.appendChild(m),Bt(f,c);}_clean_wrapping_comments(e){let t=e;for(;;){let l=Ur(t);if(l&&(l.tagName==="w:ins"||l.tagName==="w:del"))t=l;else break}let r=e;for(;;){let l=lt(r);if(l&&(l.tagName==="w:ins"||l.tagName==="w:del"))r=l;else break}let n=[],a=Ur(t);for(;a;)if(a.tagName==="w:commentRangeStart")n.push(a),a=Ur(a);else if(a.tagName==="w:rPr"||a.tagName==="w:pPr")a=Ur(a);else break;let i=[],o=lt(r);for(;o;)if(o.tagName==="w:commentRangeEnd")i.push(o),o=lt(o);else if(o.tagName==="w:r"&&S(o,"w:commentReference").length>0)i.push(o),o=lt(o);else if(o.tagName==="w:commentReference")i.push(o),o=lt(o);else break;let s=new Set;for(let l of i)if(l.tagName==="w:commentRangeEnd"){let u=l.getAttribute("w:id");u&&s.add(u);}else {let u=S(l,"w:commentReference")[0];if(!u&&l.tagName==="w:commentReference"&&(u=l),u){let c=u.getAttribute("w:id");c&&s.add(c);}}for(let l of n){let u=l.getAttribute("w:id");if(u&&s.has(u)){this.comments_manager.deleteComment(u),l.parentNode&&l.parentNode.removeChild(l);for(let c of i){let f=null;if(c.tagName==="w:commentRangeEnd")f=c.getAttribute("w:id");else {let d=S(c,"w:commentReference")[0];!d&&c.tagName==="w:commentReference"&&(d=c),d&&(f=d.getAttribute("w:id"));}f===u&&c.parentNode&&c.parentNode.removeChild(c);}}}}_delete_comments_in_element(e){let t=S(e,"w:commentReference");for(let r of t){let n=r.getAttribute("w:id");if(n){this.comments_manager.deleteComment(n);for(let a of ["w:commentRangeStart","w:commentRangeEnd"]){let i=S(this.doc.element,a);for(let o of i)o.getAttribute("w:id")===n&&o.parentNode&&o.parentNode.removeChild(o);}}}}validate_edits(e,t=0){let r=[];this.mapper.full_text||this.mapper._build_map(),r.push(...Pl(e,t));for(let n=0;n<e.length;n++){let a=e[n];if(typeof a!="object"||a===null){r.push(`- Edit ${n+1+t} Failed: Invalid change format. Expected a JSON object, but received a primitive ${typeof a}. Do not pass raw strings.`);continue}if(!a.target_text)continue;let i=a.regex||false,o=a.match_mode||"strict",s=this.mapper.find_all_match_indices(a.target_text,i),l=this.mapper.full_text,u=this.mapper;s.length===0&&(this.clean_mapper||(this.clean_mapper=new He(this.doc,true)),s=this.clean_mapper.find_all_match_indices(a.target_text,i),s.length>0&&(l=this.clean_mapper.full_text,u=this.clean_mapper)),l===this.mapper.full_text&&s.length>0&&(s=s.filter(([p,m])=>{let g=this.mapper.spans.filter(E=>E.run!==null&&E.end>p&&E.start<p+m);return g.length===0?true:g.some(E=>!E.del_id)}));let c=false,f=new Set;if(s.length===0){this.original_mapper||(this.original_mapper=new He(this.doc,false,true));let d=this.original_mapper.find_all_match_indices(a.target_text,i);if(d.length>0){c=true;for(let[p,m]of d){let g=this.original_mapper.spans.filter(E=>E.end>p&&E.start<p+m);for(let E of g)if(E.run!==null){let v=E.run._element;for(;v;){if(v.nodeType===1&&v.tagName==="w:del"){let w=v.getAttribute("w:author");w&&f.add(w);break}v=v.parentNode;}}}}}if(s.length===0)if(c){let d=f.size>0?`by ${Array.from(f).sort().join(", ")}`:"by an existing revision";r.push(`- Edit ${n+1+t} Failed: Target text matches text inside a tracked deletion ${d}. Reject/accept that change first or target the active replacement text instead.`);}else {let d=this._nearest_match_hint(a.target_text,i);r.push(`- Edit ${n+1+t} Failed: Target text not found in document:
|
|
59
|
+
"${a.target_text}"${d}`);}else if(s.length>1&&o==="strict")if(a.target_text.includes("|"))s=s.slice(0,1);else {let d=s.map(([p,m])=>[p,p+m]);r.push(kl(n+1+t,a.target_text,l,d));}if(s.length===1){let[d,p]=s[0],m=l.substring(d,d+p),[g,E]=jr(m,a.new_text||""),v=m.length-E,w=m.substring(g,v),b=(a.new_text||"").substring(g,(a.new_text||"").length-E);if(w.includes(`
|
|
60
60
|
|
|
61
61
|
`)&&!(m.split(`
|
|
62
62
|
|
|
63
63
|
`).length===(a.new_text||"").split(`
|
|
64
64
|
|
|
65
|
-
`).length))if(
|
|
65
|
+
`).length))if(b.includes(`
|
|
66
66
|
|
|
67
67
|
`)){let D=m.split(`
|
|
68
68
|
|
|
69
69
|
`);D.length>=2&&D[0].trim()!==""&&D[D.length-1].trim()!==""&&r.push(`- Edit ${n+1+t} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}else {let D=w.split(`
|
|
70
70
|
|
|
71
|
-
`);D.length>=2&&D[0].trim()!==""&&D[D.length-1].trim()!==""&&r.push(`- Edit ${n+1+t} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}}for(let[d,p]of s){let m=u.spans.filter(w=>w.end>d&&w.start<d+p),g=new Set,b=new Set,v=false;for(let w of m){if(w.run===null)continue;let E=false;if(w.ins_id){let _=S(this.doc.element,"w:ins").filter(D=>D.getAttribute("w:id")===w.ins_id);if(_.length>0){let D=_[0].getAttribute("w:author");D&&D!==this.author&&(g.add(D),E=true);}}E||(v=true);}for(let w of m)if(w.comment_ids)for(let E of w.comment_ids){let _=this.mapper.comments_map[E];_&&_.author&&_.author!==this.author&&b.add(_.author);}if(g.size>0||b.size>0){let w=g.size>0&&!v&&b.size===0;if((o==="strict"||o==="first")&&w)continue;let E=new Set([...g,...b]);r.push(`- Edit ${n+1+t} Failed: Modification targets an active insertion from another author (${Array.from(E).join(", ")}). Accept that change first or scope your edit outside of it.`);}}}return r}validate_review_actions(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],a=n.type;if(a==="reply"){let i=n.target_id.replace("Com:",""),o=false,s=this.doc.pkg.parts.find(l=>l.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");s&&(o=S(s._element,"w:comment").some(u=>u.getAttribute("w:id")===i)),o||t.push(`- Action ${r+1} Failed: Target comment ID ${n.target_id} not found.`);}else if(a==="accept"||a==="reject"){let i=n.target_id.replace("Chg:",""),o=S(this.doc.element,"w:ins").filter(l=>l.getAttribute("w:id")===i),s=S(this.doc.element,"w:del").filter(l=>l.getAttribute("w:id")===i);o.length===0&&s.length===0&&t.push(`- Action ${r+1} Failed: Target ID ${n.target_id} not found.`);}}return t}process_batch(e,t=false){if(Array.isArray(e)&&(e=e.map(r=>{if(typeof r=="string")try{let n=JSON.parse(r);return n!==null&&typeof n=="object"?n:r}catch{return r}return r})),t){let r=Ca(this.doc),n=this.current_id;try{return this._process_batch_internal(e,!0)}finally{xa(this.doc,r),this.current_id=n,this.mapper=new He(this.doc),this.comments_manager=new Ft(this.doc),this.clean_mapper=null;}}else return this._process_batch_internal(e,false)}_process_batch_internal(e,t=false){for(let d of e)if(d&&typeof d=="object"&&d.type==="modify"&&d.target_text&&d.new_text){let[p,m]=Ol(d.target_text,d.new_text);d.target_text=p,d.new_text=m;}this.skipped_details=[];let r=e.filter(d=>d!==null&&typeof d=="object"&&["accept","reject","reply"].includes(d.type)),n=e.filter(d=>d===null||typeof d!="object"||!["accept","reject","reply"].includes(d.type));if(t){if(r.length>0){let d=this.validate_review_actions(r);if(d.length>0)throw new qr(d)}}else {let d=r.length>0?this.validate_review_actions(r):[],m=n.length>0&&d.length>0?this.validate_edits(n):[],g=[...d,...m];if(g.length>0)throw new qr(g)}let a=0,i=0;if(r.length>0){let d=this.apply_review_actions(r);if(a=d[0],i=d[1],i>0)throw new qr(this.skipped_details);a>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let[o]=Lt(this.mapper.full_text),l=$t(o,"").body_page_offsets,u=[],c=0,f=0;if(n.length>0)if(t)for(let d=0;d<n.length;d++){let p=n[d],m=this.validate_edits([p],d),g=this._check_punctuation_warning(p.target_text||"");if(m.length>0){f++,u.push({status:"failed",target_text:p.target_text||"",new_text:p.new_text||"",warning:g,error:m[0],critic_markup:null,clean_text:null});continue}this.apply_edits([p],l);if(p._applied_status){c++;let v=this._build_edit_context_previews(p);u.push({status:"applied",target_text:p.target_text||"",new_text:p.new_text||"",warning:g,error:null,critic_markup:v[0],clean_text:v[1],pages:p._pages||[],heading_path:p._heading_path||"",occurrences_modified:p._occurrences_modified||0,match_mode:p.match_mode||"strict"}),this.mapper=new He(this.doc),this.clean_mapper=null;}else {f++;let v=this.skipped_details.length>0?this.skipped_details[this.skipped_details.length-1]:"Failed to apply edit";u.push({status:"failed",target_text:p.target_text||"",new_text:p.new_text||"",warning:g,error:v,critic_markup:null,clean_text:null});}}else {let d=Ca(this.doc),p=this.current_id;try{let m=[];for(let g=0;g<n.length;g++){let b=n[g],v=this.validate_edits([b],g);v.length>0?m.push(...v):(this.apply_edits([b],l),this.mapper=new He(this.doc),this.clean_mapper=null);}if(m.length>0)throw new qr(m)}catch(m){throw xa(this.doc,d),this.current_id=p,this.mapper=new He(this.doc),this.comments_manager=new Ft(this.doc),this.clean_mapper=null,m}c=n.filter(m=>m._applied_status).length,f=n.length-c;for(let m of n){let g=m._applied_status||false,b=m._error_msg||null,v=this._check_punctuation_warning(m.target_text||""),w=null,E=null;if(g){let _=this._build_edit_context_previews(m);w=_[0],E=_[1];}u.push({status:g?"applied":"failed",target_text:m.target_text||"",new_text:m.new_text||"",warning:v,error:b,critic_markup:w,clean_text:E,pages:m._pages||[],heading_path:m._heading_path||"",occurrences_modified:m._occurrences_modified||0,match_mode:m.match_mode||"strict"});}}return {actions_applied:a,actions_skipped:i,edits_applied:c,edits_skipped:f,skipped_details:this.skipped_details,edits:u,engine:"node",version:"1.10.0"}}apply_edits(e,t=[]){let r=0,n=0;if(!t||t.length===0){let[s]=Lt(this.mapper.full_text);t=$t(s,"").body_page_offsets;}let a=[];for(let s of e){if(typeof s!="object"||s===null){n++;continue}s._applied_status=false,s._error_msg=null;}for(let s of e)if(!(typeof s!="object"||s===null))if(s._resolved_start_idx!==void 0&&s._resolved_start_idx!==null)a.push([s,s.new_text||null]);else if(s._match_start_index!==void 0&&s._match_start_index!==null)s._resolved_start_idx=s._match_start_index,a.push([s,s.new_text||null]);else if(s.type==="insert_row"||s.type==="delete_row"){let l=this.mapper.find_all_match_indices(s.target_text);if(l.length===0&&(this.clean_mapper||(this.clean_mapper=new He(this.doc,true)),l=this.clean_mapper.find_all_match_indices(s.target_text)),l.length>0)s._resolved_start_idx=l[0][0],a.push([s,null]);else {n++,s._applied_status=false;let c=`- Failed to locate row target: '${(s.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(c),s._error_msg=c;}}else {let l=this._pre_resolve_heuristic_edit(s);if(l)if(Array.isArray(l))for(let u of l)u._resolved_start_idx=u._match_start_index,u._parent_edit_ref=s,(s._resolved_start_idx===void 0||s._resolved_start_idx===null)&&(s._resolved_start_idx=u._resolved_start_idx),s._resolved_proxy_edit||(s._resolved_proxy_edit=u),a.push([u,u.new_text]);else l._resolved_start_idx=l._match_start_index,l._parent_edit_ref=s,s._resolved_start_idx=l._resolved_start_idx,s._resolved_proxy_edit=l,a.push([l,l.new_text]);else {n++,s._applied_status=false;let f=`- Failed to apply edit targeting: '${(s.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(f),s._error_msg=f;}}a.sort((s,l)=>(l[0]._resolved_start_idx||0)-(s[0]._resolved_start_idx||0));let i=[],o=new Set;for(let[s,l]of a){let u=s._resolved_start_idx||0,c=u+(s.target_text?s.target_text.length:0);if(i.some(([p,m])=>u<m&&c>p)){n++;let g=`- Skipped overlapping edit targeting: '${(s.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(g),s._applied_status=false,s._error_msg=g;let b=s._parent_edit_ref;b&&(b._applied_status=false,b._error_msg=g);continue}let d=false;if(s.type==="modify"?d=this._apply_single_edit_indexed(s,l,false):(s.type==="insert_row"||s.type==="delete_row")&&(d=this._apply_table_edit(s,false)),d){let p=s._split_group_id,m=p==null||!o.has(p);m&&p!==void 0&&p!==null&&o.add(p),m&&r++,i.push([u,c]),s._applied_status=true;let g=s._parent_edit_ref;if(g){g._applied_status=true,m&&(g._occurrences_modified=(g._occurrences_modified||0)+1);let[b,v]=this._get_heading_path_and_page(u,this.mapper.full_text,t),w=g._pages||[];w.includes(v)||w.unshift(v),g._pages=w,g._heading_path=b;}else {m&&(s._occurrences_modified=(s._occurrences_modified||0)+1);let[b,v]=this._get_heading_path_and_page(u,this.mapper.full_text,t),w=s._pages||[];w.includes(v)||w.unshift(v),s._pages=w,s._heading_path=b;}}else {n++;let g=`- Failed to apply edit targeting: '${(s.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(g),s._applied_status=false,s._error_msg=g;let b=s._parent_edit_ref;b&&(b._applied_status||(b._applied_status=false,b._error_msg=g));}}return [r,n]}apply_review_actions(e){let t=0,r=0;for(let n of e){let a=n.type;if(a==="reply"){let u=n.target_id.replace("Com:",""),c=this.comments_manager.addComment(this.author,n.text,u);this._anchor_reply_comment(u,c),t++;continue}let i=n.target_id.replace("Chg:",""),o=S(this.doc.element,"w:ins").filter(u=>u.getAttribute("w:id")===i),s=S(this.doc.element,"w:del").filter(u=>u.getAttribute("w:id")===i),l=[...o,...s];if(l.length===0){r++,this.skipped_details.push(`- Failed to apply action: Target ID ${n.target_id} not found.`);continue}for(let u of l){let c=u.tagName==="w:ins",d=(u.parentNode?u.parentNode.tagName:"")==="w:trPr";if(a==="accept")if(c)if(this._clean_wrapping_comments(u),d)u.parentNode?.removeChild(u);else {for(;u.firstChild;)u.parentNode?.insertBefore(u.firstChild,u);u.parentNode?.removeChild(u);}else if(this._clean_wrapping_comments(u),this._delete_comments_in_element(u),d){let p=u.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else u.parentNode?.removeChild(u);else if(a==="reject")if(c)if(this._clean_wrapping_comments(u),this._delete_comments_in_element(u),d){let p=u.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else u.parentNode?.removeChild(u);else if(this._clean_wrapping_comments(u),d)u.parentNode?.removeChild(u);else {let p=Array.from(u.getElementsByTagName("w:delText"));for(let m of p){let g=m.ownerDocument.createElement("w:t");g.textContent=m.textContent,m.hasAttribute("xml:space")&&g.setAttribute("xml:space","preserve"),m.parentNode?.replaceChild(g,m);}for(;u.firstChild;)u.parentNode?.insertBefore(u.firstChild,u);u.parentNode?.removeChild(u);}}t++;}return [t,r]}_apply_table_edit(e,t){let r=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,[n,a]=this.mapper.get_insertion_anchor(r,t),i=null;if(n?i=n._element:a&&(i=a._element),!i)return false;let o=i;for(;o&&o.tagName!=="w:tr";)o=o.parentNode;if(!o)return false;if(e.type==="delete_row"){let s=P(o,"w:trPr");return s||(s=o.ownerDocument.createElement("w:trPr"),o.insertBefore(s,o.firstChild)),s.appendChild(this._create_track_change_tag("w:del")),true}else if(e.type==="insert_row"){let s=o.ownerDocument.createElement("w:tr"),l=o.ownerDocument.createElement("w:trPr");s.appendChild(l),l.appendChild(this._create_track_change_tag("w:ins"));for(let u of e.cells){let c=o.ownerDocument.createElement("w:tc"),f=o.ownerDocument.createElement("w:p"),d=o.ownerDocument.createElement("w:r"),p=o.ownerDocument.createElement("w:t");p.textContent=u,u.trim()!==u&&p.setAttribute("xml:space","preserve"),d.appendChild(p),f.appendChild(d),c.appendChild(f),s.appendChild(c);}return e.position==="above"?o.parentNode?.insertBefore(s,o):Bt(s,o),true}return false}_pre_resolve_heuristic_edit(e){if(!e.target_text)return null;let t=e.regex||false,r=e.match_mode||"strict",n=this.mapper.find_all_match_indices(e.target_text,t),a=false;if(n.length===0)if(this.clean_mapper||(this.clean_mapper=new He(this.doc,true)),n=this.clean_mapper.find_all_match_indices(e.target_text,t),n.length>0)a=true;else return null;let i=a?this.clean_mapper:this.mapper,o=[];for(let[l,u]of n){let c=i.spans.filter(f=>f.run!==null&&f.end>l&&f.start<l+u);(c.length===0||c.some(f=>!f.del_id))&&o.push([l,u]);}if(o.length===0)return null;(r==="strict"||r==="first")&&(o=o.slice(0,1));let s=[];for(let[l,u]of o){let c=i.full_text.substring(l,l+u),f=e.new_text||"";if(/^\{#cell:[^}]+\}$/.test(c.trim())){let _=f;_=_.split(c.trim()).join(""),_?s.push({type:"modify",target_text:"",new_text:_,comment:e.comment,_match_start_index:l,_internal_op:"INSERTION",_active_mapper_ref:i}):e.comment&&s.push({type:"modify",target_text:"",new_text:"",comment:e.comment,_match_start_index:l,_internal_op:"COMMENT_ONLY",_active_mapper_ref:i});continue}if(t&&f)try{f=c.replace(new RegExp(e.target_text),f);}catch{}let[d,p]=this._parse_markdown_style(e.target_text),[m,g]=this._parse_markdown_style(f);if(p!==g){let[_]=this._parse_markdown_style(c),D=_,y=m,A=D===y?"STYLE_ONLY":"STYLE_AND_TEXT",N=c.indexOf(_),C=l+(N!==-1?N:0),M=g!==null?g:"Normal";s.push({type:"modify",target_text:D,new_text:y,comment:e.comment,_match_start_index:C,_internal_op:A,_new_style:M,_active_mapper_ref:i});continue}if(c===f||e.target_text===f){s.push({type:"modify",target_text:c,new_text:c,comment:e.comment,_match_start_index:l,_internal_op:"COMMENT_ONLY",_active_mapper_ref:i});continue}let b="",v="",w="",E=l;if(f.startsWith(c))b="INSERTION",w=f.substring(c.length),E=l+u;else {let[_,D]=jr(c,f),y=c.length-D,A=f.length-D;v=c.substring(_,y),w=f.substring(_,A),E=l+_;let N=c.split(`
|
|
71
|
+
`);D.length>=2&&D[0].trim()!==""&&D[D.length-1].trim()!==""&&r.push(`- Edit ${n+1+t} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}}for(let[d,p]of s){let m=u.spans.filter(w=>w.end>d&&w.start<d+p),g=new Set,E=new Set,v=false;for(let w of m){if(w.run===null)continue;let b=false;if(w.ins_id){let _=S(this.doc.element,"w:ins").filter(D=>D.getAttribute("w:id")===w.ins_id);if(_.length>0){let D=_[0].getAttribute("w:author");D&&D!==this.author&&(g.add(D),b=true);}}b||(v=true);}for(let w of m)if(w.comment_ids)for(let b of w.comment_ids){let _=this.mapper.comments_map[b];_&&_.author&&_.author!==this.author&&E.add(_.author);}if(g.size>0||E.size>0){let w=g.size>0&&!v&&E.size===0;if((o==="strict"||o==="first")&&w)continue;let b=new Set([...g,...E]);r.push(`- Edit ${n+1+t} Failed: Modification targets an active insertion from another author (${Array.from(b).join(", ")}). Accept that change first or scope your edit outside of it.`);}}}return r}validate_review_actions(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],a=n.type;if(a==="reply"){let i=n.target_id.replace("Com:",""),o=false,s=this.doc.pkg.parts.find(l=>l.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");s&&(o=S(s._element,"w:comment").some(u=>u.getAttribute("w:id")===i)),o||t.push(`- Action ${r+1} Failed: Target comment ID ${n.target_id} not found.`);}else if(a==="accept"||a==="reject"){let i=n.target_id.replace("Chg:",""),o=S(this.doc.element,"w:ins").filter(l=>l.getAttribute("w:id")===i),s=S(this.doc.element,"w:del").filter(l=>l.getAttribute("w:id")===i);o.length===0&&s.length===0&&t.push(`- Action ${r+1} Failed: Target ID ${n.target_id} not found.`);}}return t}process_batch(e,t=false){if(Array.isArray(e)&&(e=e.map(r=>{if(typeof r=="string")try{let n=JSON.parse(r);return n!==null&&typeof n=="object"?n:r}catch{return r}return r})),t){let r=Ca(this.doc),n=this.current_id;try{return this._process_batch_internal(e,!0)}finally{xa(this.doc,r),this.current_id=n,this.mapper=new He(this.doc),this.comments_manager=new Ft(this.doc),this.clean_mapper=null;}}else return this._process_batch_internal(e,false)}_process_batch_internal(e,t=false){for(let d of e)if(d&&typeof d=="object"&&d.type==="modify"&&d.target_text&&d.new_text){let[p,m]=Ol(d.target_text,d.new_text);d.target_text=p,d.new_text=m;}this.skipped_details=[];let r=e.filter(d=>d!==null&&typeof d=="object"&&["accept","reject","reply"].includes(d.type)),n=e.filter(d=>d===null||typeof d!="object"||!["accept","reject","reply"].includes(d.type));if(t){if(r.length>0){let d=this.validate_review_actions(r);if(d.length>0)throw new qr(d)}}else {let d=r.length>0?this.validate_review_actions(r):[],m=n.length>0&&d.length>0?this.validate_edits(n):[],g=[...d,...m];if(g.length>0)throw new qr(g)}let a=0,i=0;if(r.length>0){let d=this.apply_review_actions(r);if(a=d[0],i=d[1],i>0)throw new qr(this.skipped_details);a>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let[o]=Lt(this.mapper.full_text),l=$t(o,"").body_page_offsets,u=[],c=0,f=0;if(n.length>0)if(t)for(let d=0;d<n.length;d++){let p=n[d],m=this.validate_edits([p],d);if(m.length>0){f++;let E=this._check_punctuation_warning(p.target_text||"");u.push({status:"failed",target_text:p.target_text||"",new_text:p.new_text||"",warning:E,error:m[0],critic_markup:null,clean_text:null});continue}this.apply_edits([p],l);if(p._applied_status){c++;let E=this._build_edit_context_previews(p);u.push({status:"applied",target_text:p.target_text||"",new_text:p.new_text||"",warning:null,error:null,critic_markup:E[0],clean_text:E[1],pages:p._pages||[],heading_path:p._heading_path||"",occurrences_modified:p._occurrences_modified||0,match_mode:p.match_mode||"strict"}),this.mapper=new He(this.doc),this.clean_mapper=null;}else {f++;let E=this.skipped_details.length>0?this.skipped_details[this.skipped_details.length-1]:"Failed to apply edit",v=this._check_punctuation_warning(p.target_text||"");u.push({status:"failed",target_text:p.target_text||"",new_text:p.new_text||"",warning:v,error:E,critic_markup:null,clean_text:null});}}else {let d=Ca(this.doc),p=this.current_id;try{let m=[];for(let g=0;g<n.length;g++){let E=n[g],v=this.validate_edits([E],g);v.length>0?m.push(...v):(this.apply_edits([E],l),this.mapper=new He(this.doc),this.clean_mapper=null);}if(m.length>0)throw new qr(m)}catch(m){throw xa(this.doc,d),this.current_id=p,this.mapper=new He(this.doc),this.comments_manager=new Ft(this.doc),this.clean_mapper=null,m}c=n.filter(m=>m._applied_status).length,f=n.length-c;for(let m of n){let g=m._applied_status||false,E=m._error_msg||null,v=null,w=null,b=null;if(g){let _=this._build_edit_context_previews(m);v=_[0],w=_[1];}else b=this._check_punctuation_warning(m.target_text||"");u.push({status:g?"applied":"failed",target_text:m.target_text||"",new_text:m.new_text||"",warning:b,error:E,critic_markup:v,clean_text:w,pages:m._pages||[],heading_path:m._heading_path||"",occurrences_modified:m._occurrences_modified||0,match_mode:m.match_mode||"strict"});}}return {actions_applied:a,actions_skipped:i,edits_applied:c,edits_skipped:f,skipped_details:this.skipped_details,edits:u,engine:"node",version:"1.10.0"}}apply_edits(e,t=[]){let r=0,n=0;if(!t||t.length===0){let[s]=Lt(this.mapper.full_text);t=$t(s,"").body_page_offsets;}let a=[];for(let s of e){if(typeof s!="object"||s===null){n++;continue}s._applied_status=false,s._error_msg=null;}for(let s of e)if(!(typeof s!="object"||s===null))if(s._resolved_start_idx!==void 0&&s._resolved_start_idx!==null)a.push([s,s.new_text||null]);else if(s._match_start_index!==void 0&&s._match_start_index!==null)s._resolved_start_idx=s._match_start_index,a.push([s,s.new_text||null]);else if(s.type==="insert_row"||s.type==="delete_row"){let l=this.mapper.find_all_match_indices(s.target_text);if(l.length===0&&(this.clean_mapper||(this.clean_mapper=new He(this.doc,true)),l=this.clean_mapper.find_all_match_indices(s.target_text)),l.length>0)s._resolved_start_idx=l[0][0],a.push([s,null]);else {n++,s._applied_status=false;let c=`- Failed to locate row target: '${(s.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(c),s._error_msg=c;}}else {let l=this._pre_resolve_heuristic_edit(s);if(l)if(Array.isArray(l))for(let u of l)u._resolved_start_idx=u._match_start_index,u._parent_edit_ref=s,(s._resolved_start_idx===void 0||s._resolved_start_idx===null)&&(s._resolved_start_idx=u._resolved_start_idx),s._resolved_proxy_edit||(s._resolved_proxy_edit=u),a.push([u,u.new_text]);else l._resolved_start_idx=l._match_start_index,l._parent_edit_ref=s,s._resolved_start_idx=l._resolved_start_idx,s._resolved_proxy_edit=l,a.push([l,l.new_text]);else {n++,s._applied_status=false;let f=`- Failed to apply edit targeting: '${(s.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(f),s._error_msg=f;}}a.sort((s,l)=>(l[0]._resolved_start_idx||0)-(s[0]._resolved_start_idx||0));let i=[],o=new Set;for(let[s,l]of a){let u=s._resolved_start_idx||0,c=u+(s.target_text?s.target_text.length:0);if(i.some(([p,m])=>u<m&&c>p)){n++;let g=`- Skipped overlapping edit targeting: '${(s.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(g),s._applied_status=false,s._error_msg=g;let E=s._parent_edit_ref;E&&(E._applied_status=false,E._error_msg=g);continue}let d=false;if(s.type==="modify"?d=this._apply_single_edit_indexed(s,l,false):(s.type==="insert_row"||s.type==="delete_row")&&(d=this._apply_table_edit(s,false)),d){let p=s._split_group_id,m=p==null||!o.has(p);m&&p!==void 0&&p!==null&&o.add(p),m&&r++,i.push([u,c]),s._applied_status=true;let g=s._parent_edit_ref;if(g){g._applied_status=true,m&&(g._occurrences_modified=(g._occurrences_modified||0)+1);let[E,v]=this._get_heading_path_and_page(u,this.mapper.full_text,t),w=g._pages||[];w.includes(v)||w.unshift(v),g._pages=w,g._heading_path=E;}else {m&&(s._occurrences_modified=(s._occurrences_modified||0)+1);let[E,v]=this._get_heading_path_and_page(u,this.mapper.full_text,t),w=s._pages||[];w.includes(v)||w.unshift(v),s._pages=w,s._heading_path=E;}}else {n++;let g=`- Failed to apply edit targeting: '${(s.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(g),s._applied_status=false,s._error_msg=g;let E=s._parent_edit_ref;E&&(E._applied_status||(E._applied_status=false,E._error_msg=g));}}return [r,n]}apply_review_actions(e){let t=0,r=0;for(let n of e){let a=n.type;if(a==="reply"){let u=n.target_id.replace("Com:",""),c=this.comments_manager.addComment(this.author,n.text,u);this._anchor_reply_comment(u,c),t++;continue}let i=n.target_id.replace("Chg:",""),o=S(this.doc.element,"w:ins").filter(u=>u.getAttribute("w:id")===i),s=S(this.doc.element,"w:del").filter(u=>u.getAttribute("w:id")===i),l=[...o,...s];if(l.length===0){r++,this.skipped_details.push(`- Failed to apply action: Target ID ${n.target_id} not found.`);continue}for(let u of l){let c=u.tagName==="w:ins",d=(u.parentNode?u.parentNode.tagName:"")==="w:trPr";if(a==="accept")if(c)if(this._clean_wrapping_comments(u),d)u.parentNode?.removeChild(u);else {for(;u.firstChild;)u.parentNode?.insertBefore(u.firstChild,u);u.parentNode?.removeChild(u);}else if(this._clean_wrapping_comments(u),this._delete_comments_in_element(u),d){let p=u.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else u.parentNode?.removeChild(u);else if(a==="reject")if(c)if(this._clean_wrapping_comments(u),this._delete_comments_in_element(u),d){let p=u.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else u.parentNode?.removeChild(u);else if(this._clean_wrapping_comments(u),d)u.parentNode?.removeChild(u);else {let p=Array.from(u.getElementsByTagName("w:delText"));for(let m of p){let g=m.ownerDocument.createElement("w:t");g.textContent=m.textContent,m.hasAttribute("xml:space")&&g.setAttribute("xml:space","preserve"),m.parentNode?.replaceChild(g,m);}for(;u.firstChild;)u.parentNode?.insertBefore(u.firstChild,u);u.parentNode?.removeChild(u);}}t++;}return [t,r]}_apply_table_edit(e,t){let r=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,[n,a]=this.mapper.get_insertion_anchor(r,t),i=null;if(n?i=n._element:a&&(i=a._element),!i)return false;let o=i;for(;o&&o.tagName!=="w:tr";)o=o.parentNode;if(!o)return false;if(e.type==="delete_row"){let s=P(o,"w:trPr");return s||(s=o.ownerDocument.createElement("w:trPr"),o.insertBefore(s,o.firstChild)),s.appendChild(this._create_track_change_tag("w:del")),true}else if(e.type==="insert_row"){let s=o.ownerDocument.createElement("w:tr"),l=o.ownerDocument.createElement("w:trPr");s.appendChild(l),l.appendChild(this._create_track_change_tag("w:ins"));for(let u of e.cells){let c=o.ownerDocument.createElement("w:tc"),f=o.ownerDocument.createElement("w:p"),d=o.ownerDocument.createElement("w:r"),p=o.ownerDocument.createElement("w:t");p.textContent=u,u.trim()!==u&&p.setAttribute("xml:space","preserve"),d.appendChild(p),f.appendChild(d),c.appendChild(f),s.appendChild(c);}return e.position==="above"?o.parentNode?.insertBefore(s,o):Bt(s,o),true}return false}_pre_resolve_heuristic_edit(e){if(!e.target_text)return null;let t=e.regex||false,r=e.match_mode||"strict",n=this.mapper.find_all_match_indices(e.target_text,t),a=false;if(n.length===0)if(this.clean_mapper||(this.clean_mapper=new He(this.doc,true)),n=this.clean_mapper.find_all_match_indices(e.target_text,t),n.length>0)a=true;else return null;let i=a?this.clean_mapper:this.mapper,o=[];for(let[l,u]of n){let c=i.spans.filter(f=>f.run!==null&&f.end>l&&f.start<l+u);(c.length===0||c.some(f=>!f.del_id))&&o.push([l,u]);}if(o.length===0)return null;(r==="strict"||r==="first")&&(o=o.slice(0,1));let s=[];for(let[l,u]of o){let c=i.full_text.substring(l,l+u),f=e.new_text||"";if(/^\{#cell:[^}]+\}$/.test(c.trim())){let _=f;_=_.split(c.trim()).join(""),_?s.push({type:"modify",target_text:"",new_text:_,comment:e.comment,_match_start_index:l,_internal_op:"INSERTION",_active_mapper_ref:i}):e.comment&&s.push({type:"modify",target_text:"",new_text:"",comment:e.comment,_match_start_index:l,_internal_op:"COMMENT_ONLY",_active_mapper_ref:i});continue}if(t&&f)try{f=c.replace(new RegExp(e.target_text),f);}catch{}let[d,p]=this._parse_markdown_style(e.target_text),[m,g]=this._parse_markdown_style(f);if(p!==g){let[_]=this._parse_markdown_style(c),D=_,y=m,A=D===y?"STYLE_ONLY":"STYLE_AND_TEXT",N=c.indexOf(_),C=l+(N!==-1?N:0),M=g!==null?g:"Normal";s.push({type:"modify",target_text:D,new_text:y,comment:e.comment,_match_start_index:C,_internal_op:A,_new_style:M,_active_mapper_ref:i});continue}if(c===f||e.target_text===f){s.push({type:"modify",target_text:c,new_text:c,comment:e.comment,_match_start_index:l,_internal_op:"COMMENT_ONLY",_active_mapper_ref:i});continue}let E="",v="",w="",b=l;if(f.startsWith(c))E="INSERTION",w=f.substring(c.length),b=l+u;else {let[_,D]=jr(c,f),y=c.length-D,A=f.length-D;v=c.substring(_,y),w=f.substring(_,A),b=l+_;let N=c.split(`
|
|
72
72
|
|
|
73
73
|
`),C=f.split(`
|
|
74
74
|
|
|
75
75
|
`);if(c.includes(`
|
|
76
76
|
|
|
77
|
-
`)&&N.length===C.length){let M=[],T=l,R=false;for(let F=0;F<N.length;F++){let I=N[F],V=C[F];if(I!==V){let[U,B]=jr(I,V),L=I.substring(U,I.length-B),k=V.substring(U,V.length-B),W=T+U,Q;!L&&k?Q="INSERTION":L&&!k?Q="DELETION":L&&k?Q="MODIFICATION":Q="COMMENT_ONLY";let oe=e.comment&&!R?e.comment:null;oe&&(R=true),M.push({type:"modify",target_text:L,new_text:k,comment:oe,_match_start_index:W,_internal_op:Q,_active_mapper_ref:i,_split_group_id:l});}T+=I.length+2;}if(M.length>0){for(let F of M)s.push(F);continue}}!v&&w?b="INSERTION":v&&!w?b="DELETION":v&&w?b="MODIFICATION":b="COMMENT_ONLY";}s.push({type:"modify",target_text:v,new_text:w,comment:e.comment,_match_start_index:E,_internal_op:b,_active_mapper_ref:i});}return s.length===0?null:r==="all"||s.length>1?s:s[0]}_insert_and_split_ins(e,t,r){let n=e.parentNode;if(!n)return;let a=e.cloneNode(false),i=e.cloneNode(false),o=false;for(let s of Array.from(e.childNodes))e.removeChild(s),o?i.appendChild(s):(a.appendChild(s),s===t&&(o=true));a.childNodes.length>0&&n.insertBefore(a,e),n.insertBefore(r,e),i.childNodes.length>0&&n.insertBefore(i,e),n.removeChild(e);}_apply_single_edit_indexed(e,t,r){let n=e._internal_op,a=e._active_mapper_ref||this.mapper,i=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,o=e.target_text?e.target_text.length:0;if(n==="STYLE_ONLY"||n==="STYLE_AND_TEXT"){let[v,w]=a.get_insertion_anchor(i,r),E=null;if(w)E=w._element;else if(v){let _=v._element;for(;_&&_.tagName!=="w:p";)_=_.parentNode;E=_;}if(E&&e._new_style&&this._set_paragraph_style(E,e._new_style),n==="STYLE_ONLY"){if(e.comment){let _=a.find_target_runs_by_index(i,o,r);if(_.length>0){let D=_[0]._element,y=_[_.length-1]._element,A=D;for(;A&&A.tagName!=="w:p";)A=A.parentNode;let N=y;for(;N&&N.tagName!=="w:p";)N=N.parentNode;if(A&&N){let C=h((R,F)=>{let I=R;for(;I.parentNode&&I.parentNode!==F;)I=I.parentNode;return I},"ascend_to_paragraph_child"),M=C(D,A),T=C(y,N);A===N?this._attach_comment(A,M,T,e.comment):this._attach_comment_spanning(A,M,N,T,e.comment);}}}return true}e.target_text&&e.new_text?n="MODIFICATION":!e.target_text&&e.new_text?n="INSERTION":e.target_text&&!e.new_text?n="DELETION":n="COMMENT_ONLY";}let s=["DELETION","MODIFICATION"].includes(n)?this._getNextId():null,l=["INSERTION","MODIFICATION"].includes(n)?this._getNextId():null;if(n==="COMMENT_ONLY"){let v=a.find_target_runs_by_index(i,o,r);if(v.length===0)return false;if(!e.comment)return true;let w=v[0]._element,E=v[v.length-1]._element,_=w;for(;_&&_.tagName!=="w:p";)_=_.parentNode;let D=E;for(;D&&D.tagName!=="w:p";)D=D.parentNode;if(!_||!D)return false;let y=h((C,M)=>{let T=C;for(;T.parentNode&&T.parentNode!==M;)T=T.parentNode;return T},"ascend_to_paragraph_child"),A=y(w,_),N=y(E,D);return _===D?this._attach_comment(_,A,N,e.comment):this._attach_comment_spanning(_,A,D,N,e.comment),true}if(n==="INSERTION"){let[v,w]=a.get_insertion_anchor(i,r);if(!v&&!w)return false;let E=e.new_text||"",_=/\n\s*$/.test(E),D=null;{let N=a.spans.filter(C=>C.paragraph!==null&&C.start===i);N.length>0&&N[0].paragraph&&(D=N[0].paragraph._element);}if(_&&D&&D.parentNode){let N=D.parentNode,C=this.doc.part._element.ownerDocument,M=E.split(/[\r\n]+/).filter(I=>I!==""),T=null,R=null,F=null;for(let I of M){let[V,U]=this._parse_markdown_style(I),B=C.createElement("w:p");if(U)this._set_paragraph_style(B,U);else {let Q=P(D,"w:pPr");Q&&B.appendChild(Q.cloneNode(true));}let L=P(B,"w:pPr");L||(L=C.createElement("w:pPr"),B.insertBefore(L,B.firstChild));let k=P(L,"w:rPr");k||(k=C.createElement("w:rPr"),L.appendChild(k)),k.appendChild(this._create_track_change_tag("w:ins","",l));let W=this._build_tracked_ins_for_line(V,v,l,C);W&&B.appendChild(W),N.insertBefore(B,D),T||(T=B),R=B,F=W;}if(T){if(e.comment&&R&&F){let I=h((U,B)=>{let L=U;for(;L.parentNode&&L.parentNode!==B;)L=L.parentNode;return L},"ascend"),V=S(T,"w:ins")[0]||T;this._attach_comment_spanning(T,I(V,T),R,I(F,R),e.comment);}return true}}let y=this._track_insert_multiline(e.new_text||"",v,w,l);if(!y.first_node)return false;if(y.first_node.tagName==="w:ins")if(v){let N=v._element.parentNode;N&&N.tagName==="w:ins"?this._insert_and_split_ins(N,v._element,y.first_node):Bt(y.first_node,v._element);}else w&&w._element.appendChild(y.first_node);if(e.comment){let N=h((C,M)=>{let T=C;for(;T.parentNode&&T.parentNode!==M;)T=T.parentNode;return T},"ascend_to_paragraph_child");if(y.last_p&&y.last_ins){let C=y.first_node;for(;C&&C.tagName!=="w:p";)C=C.parentNode;if(C){let M=y.first_node;y.first_node.tagName==="w:p"&&(M=S(y.first_node,"w:ins")[0]||y.first_node);let T=N(M,C),R=N(y.last_ins,y.last_p);this._attach_comment_spanning(C,T,y.last_p,R,e.comment);}}else {let C=y.first_node;for(;C&&C.tagName!=="w:p";)C=C.parentNode;if(C){let M=y.first_node;y.first_node.tagName==="w:p"&&(M=S(y.first_node,"w:ins")[0]||y.first_node);let T=N(M,C);this._attach_comment(C,T,T,e.comment);}}}return true}let u=a.find_target_runs_by_index(i,o,r),c=a.get_virtual_spans_in_range(i,o);if(u.length===0&&c.length===0)return false;let f=new Set;for(let v of u){let w=v._element.parentNode;for(;w&&w.tagName!=="w:p";)w=w.parentNode;w&&f.add(w);}let d=null,p=null;for(let v of u){let w=this._create_track_change_tag("w:del","",s),E=v._element.cloneNode(true);Array.from(E.getElementsByTagName("w:t")).forEach(D=>{let y=E.ownerDocument.createElement("w:delText");y.textContent=D.textContent,D.hasAttribute("xml:space")&&y.setAttribute("xml:space","preserve"),E.replaceChild(y,D);}),w.appendChild(E),v._element.parentNode?.replaceChild(w,v._element),d===null&&(d=w),p=w;}let m=null,g=null,b=null;if(n==="MODIFICATION"&&e.new_text&&p){let v=p;for(;v&&v.tagName!=="w:p";)v=v.parentNode;let w=v?new ge(v,null):null,E=u.length>0?u[u.length-1]:null,_=this._track_insert_multiline(e.new_text,E,w,l);if(_.first_node){if(_.first_node.tagName==="w:ins"){let y=p.parentNode;y&&y.tagName==="w:ins"?this._insert_and_split_ins(y,p,_.first_node):Bt(_.first_node,p),m=_.first_node;}else m=_.last_ins;g=_.last_p,b=_.last_ins;}}if(n==="DELETION"||n==="MODIFICATION"){if(n==="MODIFICATION"&&u.length===0&&c.length>0&&e.new_text){let v=c[0];if(v.paragraph){let w=v.paragraph._element,E=S(w,"w:r"),_=E.length>0?new et(E[E.length-1],v.paragraph):null,D=this._track_insert_multiline(e.new_text,_,v.paragraph,l);D.first_node&&w.appendChild(D.first_node);}}for(let v of [...c].reverse())if(v.paragraph){let w=v.paragraph._element,E=lt(w);for(;E&&E.tagName!=="w:p";)E=lt(E);if(E&&E.tagName==="w:p"){let _=P(w,"w:pPr");_||(_=w.ownerDocument.createElement("w:pPr"),w.insertBefore(_,w.firstChild));let D=P(_,"w:rPr");D||(D=w.ownerDocument.createElement("w:rPr"),_.appendChild(D));let y=this._create_track_change_tag("w:del");D.appendChild(y);let A=Array.from(E.childNodes);for(let N of A)N.nodeType===1&&N.tagName==="w:pPr"||w.appendChild(N);E.parentNode&&E.parentNode.removeChild(E);}}}if(e.comment&&d!==null){let v,w;if(g&&b)v=b,w=g;else {let A=m!==null?m:p;for(v=A,w=A;w&&w.tagName!=="w:p";)w=w.parentNode;}let E=d;for(;E&&E.tagName!=="w:p";)E=E.parentNode;if(!E||!w)return true;let _=h((A,N)=>{let C=A;for(;C.parentNode&&C.parentNode!==N;)C=C.parentNode;return C},"ascend_to_paragraph_child"),D=_(d,E),y=_(v,w);E===w?this._attach_comment(E,D,y,e.comment):this._attach_comment_spanning(E,D,w,y,e.comment);}for(let v of f){let w=false;for(let E of ["w:t","w:tab","w:br"]){let _=S(v,E);for(let D of _){let y=false,A=D.parentNode;for(;A&&A!==v.parentNode;){if(A.tagName==="w:del"){y=true;break}A=A.parentNode;}if(!y){if(E==="w:t"&&!D.textContent)continue;w=true;break}}if(w)break}if(!w){let E=P(v,"w:pPr");E||(E=v.ownerDocument.createElement("w:pPr"),v.insertBefore(E,v.firstChild));let _=P(E,"w:rPr");if(_||(_=v.ownerDocument.createElement("w:rPr"),E.appendChild(_)),!P(_,"w:del")){let D=this._create_track_change_tag("w:del");_.appendChild(D);}}}return true}};function Le(e,t){let r=[],n=e.getElementsByTagName("*");for(let a=0;a<n.length;a++){let i=n[a].tagName;(i===t||i.endsWith(":"+t))&&r.push(n[a]);}return r}h(Le,"findDescendantsByLocalName");function Ml(e){let t=0;function r(o,s){let l=o?o.toString():"",u=s?s.toString():"";return l===u}h(r,"areRunsIdentical");function n(o){let s=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let l=0;l<o.childNodes.length;l++){let u=o.childNodes[l];if(u.nodeType===1){let c=u.tagName;if(!s.includes(c))return true}}return false}h(n,"hasSpecialContent");function a(o){let s=Array.from(o.childNodes).filter(u=>u.nodeType===1),l=0;for(;l<s.length-1;){let u=s[l],c=s[l+1];if(u.tagName==="w:r"&&c.tagName==="w:r"&&!n(u)&&!n(c)){let f=P(u,"w:rPr"),d=P(c,"w:rPr");if(r(f,d)){let p=null;for(let g=0;g<u.childNodes.length;g++){let b=u.childNodes[g];b.nodeType===1&&(b.tagName==="w:t"||b.tagName==="w:delText")&&(p=b);}let m=Array.from(c.childNodes).filter(g=>g.nodeType===1);for(let g of m)if(g.tagName!=="w:rPr")if((g.tagName==="w:t"||g.tagName==="w:delText")&&p&&p.tagName===g.tagName){let b=p.textContent||"",v=g.textContent||"",w=b+v;p.textContent=w,w.trim()!==w&&p.setAttribute("xml:space","preserve");}else u.appendChild(g),(g.tagName==="w:t"||g.tagName==="w:delText")&&(p=g);o.removeChild(c),s.splice(l+1,1),t++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&a(u),l++;}if(s.length>0){let u=s[s.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&a(u);}}h(a,"coalesceContainer");let i=S(e.element,"w:p");for(let o of i)a(o);return t?[`Adjacent identical runs coalesced: ${t}`]:[]}h(Ml,"coalesce_runs");function Rl(e){let t=0,r=["w:rsidR","w:rsidRPr","w:rsidRDefault","w:rsidP","w:rsidDel","w:rsidSect","w:rsidTr"],n=e.element.getElementsByTagName("*");for(let i=0;i<n.length;i++)for(let o of r)n[i].hasAttribute(o)&&(n[i].removeAttribute(o),t++);let a=S(e.element,"w:rsids");for(let i of a)i.parentNode&&(i.parentNode.removeChild(i),t++);return t?[`rsid attributes: ${t} removed`]:[]}h(Rl,"strip_rsid");function Bl(e){let t=0,r=["w14:paraId","w14:textId"],n=e.element.getElementsByTagName("*");for(let a=0;a<n.length;a++)for(let i of r)n[a].hasAttribute(i)&&(n[a].removeAttribute(i),t++);return t?[`Paragraph/text IDs: ${t} removed`]:[]}h(Bl,"strip_para_ids");function Fl(e){let t=S(e.element,"w:proofErr");return t.forEach(r=>r.parentNode?.removeChild(r)),t.length?[`Spell check markers: ${t.length} removed`]:[]}h(Fl,"strip_proof_errors");function Ll(e){let t=0;for(let r of ["w:rPr","w:pPr"]){let n=S(e.element,r);for(let a of n)(a.childNodes.length===0||a.childNodes.length===1&&a.childNodes[0].nodeType===3&&!a.childNodes[0].textContent?.trim())&&(a.parentNode?.removeChild(a),t++);}return t?[`Empty property elements: ${t} removed`]:[]}h(Ll,"strip_empty_properties");function $l(e){let t=0,r=S(e.element,"w:rPr");for(let n of r)if(P(n,"w:vanish")||P(n,"w:webHidden")){let a=n.parentNode;a&&a.tagName==="w:r"&&a.parentNode&&(a.parentNode.removeChild(a),t++);}return t?[`Hidden text runs: ${t} removed`]:[]}h($l,"strip_hidden_text");function Ta(e){let t=S(e.element,"w:ins").length,r=S(e.element,"w:del").length,n=S(e.element,"w:rPrChange").length+S(e.element,"w:pPrChange").length+S(e.element,"w:sectPrChange").length;return [t,r,n]}h(Ta,"count_tracked_changes");function Ul(e){let t=new Set;for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange","w:sectPrChange"])for(let n of S(e.element,r)){let a=n.getAttribute("w:author");a&&t.add(a);}return t}h(Ul,"get_track_change_authors");function Sa(e){let t=[],r=S(e,"w:t");for(let a of r)a.textContent&&t.push(a.textContent);let n=S(e,"w:delText");for(let a of n)a.textContent&&t.push(a.textContent);return t.join("")}h(Sa,"_getElementText");function Wr(e,t=60){let r=e.replace(/\n/g," ").trim();return r.length<=t?r:r.substring(0,t-3)+"..."}h(Wr,"_truncate");function ql(e){let t=[],r=S(e.element,"w:ins"),n=S(e.element,"w:del");for(let o of r){let s=Sa(o).trim();s&&t.push(` Accepted insertion: "${Wr(s,60)}"`);}for(let o of n){let s=Sa(o).trim();s&&t.push(` Accepted deletion of: "${Wr(s,60)}"`);}new Ln(e).accept_all_revisions();for(let o of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let s of S(e.element,o))s.parentNode?.removeChild(s);let i=r.length+n.length;return i?[`Tracked changes auto-accepted: ${i}`].concat(t):[]}h(ql,"accept_all_tracked_changes");function zl(e){let t=hr(e.pkg),r=[],n=0,a=0;for(let[i,o]of Object.entries(t))o.resolved?a++:n++,r.push({id:i,...o});return {total:r.length,open:n,resolved:a,comments:r}}h(zl,"get_comments_summary");function jl(e){let t=hr(e.pkg),r=Object.keys(t);if(r.length===0)return [];let n=[],a=new Ft(e);for(let[l,u]of Object.entries(t)){let c=u.resolved?"[Resolved]":"[Open]";n.push(` ${c} "${Wr(u.text||"",60)}" (${u.author||"Unknown"})`),a.deleteComment(l);}for(let l of ["w:commentRangeStart","w:commentRangeEnd"])for(let u of S(e.element,l))u.parentNode?.removeChild(u);let i=S(e.element,"w:commentReference");for(let l of i){let u=l.parentNode;u&&((u.tagName==="w:r"||u.tagName.endsWith(":r"))&&Array.from(u.childNodes).filter(f=>f.nodeType===1&&f.tagName!=="w:rPr"&&f.tagName!=="rPr").length<=1?u.parentNode?.removeChild(u):u.removeChild(l));}let o=Object.values(t).filter(l=>l.resolved).length,s=Object.values(t).filter(l=>!l.resolved).length;return [`Comments removed: ${r.length} (${o} resolved, ${s} open)`].concat(n)}h(jl,"remove_all_comments");function Wl(e){let t=e.pkg,r=new Set;for(let a of t.parts)if(a.partname.toLowerCase().includes("comments")){r.add(a.partname);let i=a.partname.startsWith("/")?a.partname:"/"+a.partname,o=a.partname.startsWith("/")?a.partname.substring(1):a.partname;r.add(i),r.add(o);}if(r.size===0)return;for(let a of t.parts)if(a.partname.endsWith(".rels")){let i=S(a._element,"Relationship"),o=[];for(let s of i)if((s.getAttribute("Target")||"").toLowerCase().includes("comments")){o.push(s);let u=a.partname.replace("/_rels/","/").replace(".rels",""),c=t.getPartByPath(u);if(c){let f=s.getAttribute("Id");f&&c.rels.delete(f);}}for(let s of o)s.parentNode?.removeChild(s);}let n=t.getPartByPath("[Content_Types].xml");if(n){let a=S(n._element,"Override"),i=[];for(let o of a){let s=o.getAttribute("PartName")||"";(r.has(s)||s.toLowerCase().includes("comments"))&&i.push(o);}for(let o of i)o.parentNode?.removeChild(o);}t.parts=t.parts.filter(a=>!a.partname.toLowerCase().includes("comments"));for(let a of Object.keys(t.unzipped))a.toLowerCase().includes("comments")&&delete t.unzipped[a];}h(Wl,"eject_comment_parts");function Hl(e,t){let r=new Ft(e);if(!r.commentsPart)return [];let n=new Set,a=S(r.commentsPart._element,"w:comment");for(let i of a){let o=i.getAttribute("w:author");if(o&&(n.add(o),i.setAttribute("w:author",t)),i.hasAttribute("w:initials")){let s=t.split(" ").filter(Boolean).map(l=>l[0]).join("").toUpperCase();i.setAttribute("w:initials",s);}}return n.size?[`Comment authors replaced: ${Array.from(n).sort().join(", ")} \u2192 "${t}"`]:[]}h(Hl,"replace_comment_authors");function Vl(e,t){let r=new Set;for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let a of S(e.element,n)){let i=a.getAttribute("w:author");i&&(r.add(i),a.setAttribute("w:author",t));}return r.size?[`Track change authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${t}"`]:[]}h(Vl,"replace_change_authors");function Gl(e){let t=0,r="2025-01-01T00:00:00Z";for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let a of S(e.element,n))a.hasAttribute("w:date")&&(a.setAttribute("w:date",r),t++);return t?[`Track change timestamps: ${t} normalized`]:[]}h(Gl,"normalize_change_dates");function Yl(e){let t=[],r=e.pkg.getPartByPath("docProps/core.xml");r&&(Le(r._element,"creator").forEach(s=>{s.textContent&&(t.push(`Author: ${s.textContent}`),s.textContent="");}),Le(r._element,"lastModifiedBy").forEach(s=>{s.textContent&&(t.push(`Last modified by: ${s.textContent}`),s.textContent="");}),Le(r._element,"revision").forEach(s=>{s.textContent&&parseInt(s.textContent)>1&&(t.push(`Revision count: ${s.textContent} \u2192 1`),s.textContent="1");}));let n=e.pkg.getPartByPath("docProps/app.xml");if(n){let a=n._element,i=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let s of i)Le(a,s).forEach(l=>{l.textContent&&l.textContent!=="0"&&(s==="TotalTime"&&t.push(`Total editing time: ${l.textContent} minutes`),l.textContent="0");});let o=["Template","Manager","Company"];for(let s of o)Le(a,s).forEach(l=>{l.textContent&&(t.push(`${s}: ${l.textContent}`),l.textContent="");});}return t.length?["Metadata scrubbed:",...t.map(a=>` ${a}`)]:[]}h(Yl,"scrub_doc_properties");function Xl(e){let t=false,r="1970-01-01T00:00:00Z",n=e.pkg.getPartByPath("docProps/core.xml");if(n)for(let a of ["created","modified","lastPrinted"])Le(n._element,a).forEach(i=>{i.textContent&&i.textContent!==r&&(i.textContent=r,t=true);});return t?["Timestamps normalized to epoch"]:[]}h(Xl,"scrub_timestamps");function Ql(e){let t=e.pkg.parts.filter(o=>o.partname.includes("/customXml"));if(t.length===0)return [];let r=new Set(t.map(o=>o.partname));e.pkg.parts=e.pkg.parts.filter(o=>!r.has(o.partname));let n=h(o=>{let s=[];for(let l of S(o._element,"Relationship")){let u=l.getAttribute("Target");u&&u.includes("customXml")&&s.push(l);}s.forEach(l=>l.parentNode?.removeChild(l));},"removeRelationsTo"),a=e.pkg.getPartByPath("_rels/.rels");a&&n(a);let i=e.pkg.getOrCreateRelsPart(e.part.partname);i&&n(i);for(let o of S(e.element,"w:sdtPr"))Lu(o,"w:dataBinding").forEach(s=>o.removeChild(s));return [`Custom XML parts: ${t.length} removed`]}h(Ql,"strip_custom_xml");function Jl(e){let t=0;for(let r of Le(e.element,"docPr")){let n=r.getAttribute("descr");if(n){let a=n.length<10,i=n.includes(".")&&n.length<60;(a||i)&&(r.removeAttribute("descr"),t++);}}return t?[`Image alt text: ${t} auto-generated descriptions removed`]:[]}h(Jl,"strip_image_alt_text");function Zl(e){let t=["sharepoint.com","onedrive.com",".internal","intranet","localhost","10.","192.168.","172.16."],r=[],n=e.pkg.getOrCreateRelsPart(e.part.partname);for(let a of S(n._element,"Relationship"))if(a.getAttribute("TargetMode")==="External"){let i=a.getAttribute("Target")||"";for(let o of t)if(i.toLowerCase().includes(o.toLowerCase())){r.push(`Hyperlink targets internal URL: ${Wr(i,80)}`);break}}return r}h(Zl,"audit_hyperlinks");function Kl(e,t,r=2){if(e===t)return 0;if(Math.abs(e.length-t.length)>r)return r+1;if(e.length===0)return t.length<=r?t.length:r+1;if(t.length===0)return e.length<=r?e.length:r+1;if(e.length>t.length){let a=e;e=t,t=a;}let n=Array.from({length:e.length+1},(a,i)=>i);for(let a=1;a<=t.length;a++){let i=[a],o=a;for(let s=1;s<=e.length;s++){let l=e[s-1]===t[a-1]?0:1,u=Math.min(n[s]+1,i[s-1]+1,n[s-1]+l);i.push(u),u<o&&(o=u);}if(o>r)return r+1;n=i;}return n[e.length]<=r?n[e.length]:r+1}h(Kl,"boundedLevenshtein");function ec(e){let t="",r=S(e._element,"w:r");for(let n of r)t+=ct(new et(n,e));return t}h(ec,"_get_paragraph_text");function tc(e,t){let r={},n=new Set,a={},i=[],o=/^(?:[\d.\-()a-zA-Z]+\s*)?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”]/,s=/\([^)]*?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”][^)]*?\)/g;for(let v of nt(e)){if(!(v instanceof ge))continue;let w=ec(v).trim();if(!w)continue;let E=[],_=w.match(o);_&&E.push(_[1].trim());let D=w.matchAll(s);for(let N of D)E.push(N[1].trim());for(let N of E)r[N]?n.add(N):r[N]={count:0};let y=w.length>60?w.substring(0,60)+"...":w,A=S(v._element,"*");for(let N of A){if(N.tagName==="w:bookmarkStart"){let M=N.getAttribute("w:name");M&&(!M.startsWith("_")||M.startsWith("_Ref"))&&(a[M]||(a[M]={anchored_to:y,referenced_from:[]}));}let C=null;if(N.tagName==="w:fldSimple"){let T=(N.getAttribute("w:instr")||"").trim().split(/\s+/);T.length>1&&T[0]==="REF"&&(C=T[1]);}else if(N.tagName==="w:instrText"){let T=(N.textContent||"").trim().split(/\s+/);T.length>1&&T[0]==="REF"&&(C=T[1]);}C&&i.push([C,y]);}}for(let[v,w]of i)a[v]&&a[v].referenced_from.push(w);let l=[],u=Object.keys(r);if(u.length>0){let v=u.sort((D,y)=>y.length-D.length),w=h(D=>D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),E=v.map(w).join("|"),_=new RegExp(`(?<!["\u201C])\\b(${E})\\b(?![\u201D"])`,"g");for(let D of t.matchAll(_)){let y=D[1];r[y]&&r[y].count++;}for(let D of u)r[D].count===0&&(delete r[D],n.delete(D));}for(let v of n)l.push(`[Error] Duplicate Definition: '${v}' is defined multiple times.`);let c=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),f=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,d=new Set(t.match(f)||[]),p=new Set(Object.keys(r)),m={};for(let v of p){let w=v[0].toLowerCase();m[w]||(m[w]=[]),m[w].push(v);}let g={};for(let v of d){let w=v.trim(),E=w.split(/\s+/);for(;E.length>0;){let y=E[0],A=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();if(c.has(A))E.shift();else break}if(w=E.join(" "),w.length<4||p.has(w))continue;let _=w[0].toLowerCase(),D=m[_]||[];if(w.length>5)for(let[y,A]of Object.entries(m))y!==_&&(D=D.concat(A));for(let y of D){if(Math.abs(w.length-y.length)>2||w===y+"s"||w===y+"es"||y===w+"s"||y===w+"es")continue;let A=Kl(w,y,2);A===0||A>2||y.length<=5&&(A>1||w[0].toLowerCase()!==y[0].toLowerCase())||(g[y]||(g[y]=[]),g[y].includes(w)||g[y].push(w));}}for(let[v,w]of Object.entries(g)){w.sort();let E=w.map(_=>`'${_}'`).join(", ");l.push(`[Info] Possible Typos for '${v}': Found ${E}`);}function b(v){return v.startsWith("[Error]")?0:v.startsWith("[Warning]")?1:2}return h(b,"diag_sort_key"),l.sort((v,w)=>{let E=b(v),_=b(w);return E!==_?E-_:v.localeCompare(w)}),[r,l,a]}h(tc,"extract_all_domain_metadata");function rc(e){let t=[],r=e.pkg.getPartByPath("word/settings.xml");if(!r)return t;let n=h(o=>{if(!o.hasAttribute("w:val"))return true;let s=(o.getAttribute("w:val")||"").toLowerCase();return s!=="0"&&s!=="false"&&s!=="off"},"isTruthy"),a=Le(r._element,"removePersonalInformation");a.length>0&&n(a[0])&&t.push("[Warning] Privacy flag `removePersonalInformation` is enabled in word/settings.xml. Microsoft Word will strip the `w:author`, `w:initials`, and `w:date` attributes from every tracked change and comment the next time this document is opened and saved. Edits made by this agent will lose attribution, breaking audit trails and any multi-turn workflow that relies on identifying prior edits.");let i=Le(r._element,"removeDateAndTime");return i.length>0&&n(i[0])&&t.push("[Warning] Privacy flag `removeDateAndTime` is enabled in word/settings.xml. Microsoft Word will strip the `w:date` attribute from every tracked change and comment the next time this document is opened and saved. Timestamps on this agent's edits will be lost on the next Word save."),t}h(rc,"extract_document_settings_warnings");function nc(e,t){let[r,n,a]=tc(e,t),i=rc(e),o=[`
|
|
77
|
+
`)&&N.length===C.length){let M=[],T=l,R=false;for(let F=0;F<N.length;F++){let I=N[F],V=C[F];if(I!==V){let[U,B]=jr(I,V),L=I.substring(U,I.length-B),k=V.substring(U,V.length-B),W=T+U,Q;!L&&k?Q="INSERTION":L&&!k?Q="DELETION":L&&k?Q="MODIFICATION":Q="COMMENT_ONLY";let oe=e.comment&&!R?e.comment:null;oe&&(R=true),M.push({type:"modify",target_text:L,new_text:k,comment:oe,_match_start_index:W,_internal_op:Q,_active_mapper_ref:i,_split_group_id:l});}T+=I.length+2;}if(M.length>0){for(let F of M)s.push(F);continue}}!v&&w?E="INSERTION":v&&!w?E="DELETION":v&&w?E="MODIFICATION":E="COMMENT_ONLY";}s.push({type:"modify",target_text:v,new_text:w,comment:e.comment,_match_start_index:b,_internal_op:E,_active_mapper_ref:i});}return s.length===0?null:r==="all"||s.length>1?s:s[0]}_insert_and_split_ins(e,t,r){let n=e.parentNode;if(!n)return;let a=e.cloneNode(false),i=e.cloneNode(false),o=false;for(let s of Array.from(e.childNodes))e.removeChild(s),o?i.appendChild(s):(a.appendChild(s),s===t&&(o=true));a.childNodes.length>0&&n.insertBefore(a,e),n.insertBefore(r,e),i.childNodes.length>0&&n.insertBefore(i,e),n.removeChild(e);}_apply_single_edit_indexed(e,t,r){let n=e._internal_op,a=e._active_mapper_ref||this.mapper,i=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,o=e.target_text?e.target_text.length:0;if(n==="STYLE_ONLY"||n==="STYLE_AND_TEXT"){let[v,w]=a.get_insertion_anchor(i,r),b=null;if(w)b=w._element;else if(v){let _=v._element;for(;_&&_.tagName!=="w:p";)_=_.parentNode;b=_;}if(b&&e._new_style&&this._set_paragraph_style(b,e._new_style),n==="STYLE_ONLY"){if(e.comment){let _=a.find_target_runs_by_index(i,o,r);if(_.length>0){let D=_[0]._element,y=_[_.length-1]._element,A=D;for(;A&&A.tagName!=="w:p";)A=A.parentNode;let N=y;for(;N&&N.tagName!=="w:p";)N=N.parentNode;if(A&&N){let C=h((R,F)=>{let I=R;for(;I.parentNode&&I.parentNode!==F;)I=I.parentNode;return I},"ascend_to_paragraph_child"),M=C(D,A),T=C(y,N);A===N?this._attach_comment(A,M,T,e.comment):this._attach_comment_spanning(A,M,N,T,e.comment);}}}return true}e.target_text&&e.new_text?n="MODIFICATION":!e.target_text&&e.new_text?n="INSERTION":e.target_text&&!e.new_text?n="DELETION":n="COMMENT_ONLY";}let s=["DELETION","MODIFICATION"].includes(n)?this._getNextId():null,l=["INSERTION","MODIFICATION"].includes(n)?this._getNextId():null;if(n==="COMMENT_ONLY"){let v=a.find_target_runs_by_index(i,o,r);if(v.length===0)return false;if(!e.comment)return true;let w=v[0]._element,b=v[v.length-1]._element,_=w;for(;_&&_.tagName!=="w:p";)_=_.parentNode;let D=b;for(;D&&D.tagName!=="w:p";)D=D.parentNode;if(!_||!D)return false;let y=h((C,M)=>{let T=C;for(;T.parentNode&&T.parentNode!==M;)T=T.parentNode;return T},"ascend_to_paragraph_child"),A=y(w,_),N=y(b,D);return _===D?this._attach_comment(_,A,N,e.comment):this._attach_comment_spanning(_,A,D,N,e.comment),true}if(n==="INSERTION"){let[v,w]=a.get_insertion_anchor(i,r);if(!v&&!w)return false;let b=e.new_text||"",_=/\n\s*$/.test(b),D=null;{let N=a.spans.filter(C=>C.paragraph!==null&&C.start===i);N.length>0&&N[0].paragraph&&(D=N[0].paragraph._element);}if(_&&D&&D.parentNode){let N=D.parentNode,C=this.doc.part._element.ownerDocument,M=b.split(/[\r\n]+/).filter(I=>I!==""),T=null,R=null,F=null;for(let I of M){let[V,U]=this._parse_markdown_style(I),B=C.createElement("w:p");if(U)this._set_paragraph_style(B,U);else {let Q=P(D,"w:pPr");Q&&B.appendChild(Q.cloneNode(true));}let L=P(B,"w:pPr");L||(L=C.createElement("w:pPr"),B.insertBefore(L,B.firstChild));let k=P(L,"w:rPr");k||(k=C.createElement("w:rPr"),L.appendChild(k)),k.appendChild(this._create_track_change_tag("w:ins","",l));let W=this._build_tracked_ins_for_line(V,v,l,C);W&&B.appendChild(W),N.insertBefore(B,D),T||(T=B),R=B,F=W;}if(T){if(e.comment&&R&&F){let I=h((U,B)=>{let L=U;for(;L.parentNode&&L.parentNode!==B;)L=L.parentNode;return L},"ascend"),V=S(T,"w:ins")[0]||T;this._attach_comment_spanning(T,I(V,T),R,I(F,R),e.comment);}return true}}let y=this._track_insert_multiline(e.new_text||"",v,w,l);if(!y.first_node)return false;if(y.first_node.tagName==="w:ins")if(v){let N=v._element.parentNode;N&&N.tagName==="w:ins"?this._insert_and_split_ins(N,v._element,y.first_node):Bt(y.first_node,v._element);}else w&&w._element.appendChild(y.first_node);if(e.comment){let N=h((C,M)=>{let T=C;for(;T.parentNode&&T.parentNode!==M;)T=T.parentNode;return T},"ascend_to_paragraph_child");if(y.last_p&&y.last_ins){let C=y.first_node;for(;C&&C.tagName!=="w:p";)C=C.parentNode;if(C){let M=y.first_node;y.first_node.tagName==="w:p"&&(M=S(y.first_node,"w:ins")[0]||y.first_node);let T=N(M,C),R=N(y.last_ins,y.last_p);this._attach_comment_spanning(C,T,y.last_p,R,e.comment);}}else {let C=y.first_node;for(;C&&C.tagName!=="w:p";)C=C.parentNode;if(C){let M=y.first_node;y.first_node.tagName==="w:p"&&(M=S(y.first_node,"w:ins")[0]||y.first_node);let T=N(M,C);this._attach_comment(C,T,T,e.comment);}}}return true}let u=a.find_target_runs_by_index(i,o,r),c=a.get_virtual_spans_in_range(i,o);if(u.length===0&&c.length===0)return false;let f=new Set;for(let v of u){let w=v._element.parentNode;for(;w&&w.tagName!=="w:p";)w=w.parentNode;w&&f.add(w);}let d=null,p=null;for(let v of u){let w=this._create_track_change_tag("w:del","",s),b=v._element.cloneNode(true);Array.from(b.getElementsByTagName("w:t")).forEach(D=>{let y=b.ownerDocument.createElement("w:delText");y.textContent=D.textContent,D.hasAttribute("xml:space")&&y.setAttribute("xml:space","preserve"),b.replaceChild(y,D);}),w.appendChild(b),v._element.parentNode?.replaceChild(w,v._element),d===null&&(d=w),p=w;}let m=null,g=null,E=null;if(n==="MODIFICATION"&&e.new_text&&p){let v=p;for(;v&&v.tagName!=="w:p";)v=v.parentNode;let w=v?new ge(v,null):null,b=u.length>0?u[u.length-1]:null,_=this._track_insert_multiline(e.new_text,b,w,l);if(_.first_node){if(_.first_node.tagName==="w:ins"){let y=p.parentNode;y&&y.tagName==="w:ins"?this._insert_and_split_ins(y,p,_.first_node):Bt(_.first_node,p),m=_.first_node;}else m=_.last_ins;g=_.last_p,E=_.last_ins;}}if(n==="DELETION"||n==="MODIFICATION"){if(n==="MODIFICATION"&&u.length===0&&c.length>0&&e.new_text){let v=c[0];if(v.paragraph){let w=v.paragraph._element,b=S(w,"w:r"),_=b.length>0?new et(b[b.length-1],v.paragraph):null,D=this._track_insert_multiline(e.new_text,_,v.paragraph,l);D.first_node&&w.appendChild(D.first_node);}}for(let v of [...c].reverse())if(v.paragraph){let w=v.paragraph._element,b=lt(w);for(;b&&b.tagName!=="w:p";)b=lt(b);if(b&&b.tagName==="w:p"){let _=P(w,"w:pPr");_||(_=w.ownerDocument.createElement("w:pPr"),w.insertBefore(_,w.firstChild));let D=P(_,"w:rPr");D||(D=w.ownerDocument.createElement("w:rPr"),_.appendChild(D));let y=this._create_track_change_tag("w:del");D.appendChild(y);let A=Array.from(b.childNodes);for(let N of A)N.nodeType===1&&N.tagName==="w:pPr"||w.appendChild(N);b.parentNode&&b.parentNode.removeChild(b);}}}if(e.comment&&d!==null){let v,w;if(g&&E)v=E,w=g;else {let A=m!==null?m:p;for(v=A,w=A;w&&w.tagName!=="w:p";)w=w.parentNode;}let b=d;for(;b&&b.tagName!=="w:p";)b=b.parentNode;if(!b||!w)return true;let _=h((A,N)=>{let C=A;for(;C.parentNode&&C.parentNode!==N;)C=C.parentNode;return C},"ascend_to_paragraph_child"),D=_(d,b),y=_(v,w);b===w?this._attach_comment(b,D,y,e.comment):this._attach_comment_spanning(b,D,w,y,e.comment);}for(let v of f){let w=false;for(let b of ["w:t","w:tab","w:br"]){let _=S(v,b);for(let D of _){let y=false,A=D.parentNode;for(;A&&A!==v.parentNode;){if(A.tagName==="w:del"){y=true;break}A=A.parentNode;}if(!y){if(b==="w:t"&&!D.textContent)continue;w=true;break}}if(w)break}if(!w){let b=P(v,"w:pPr");b||(b=v.ownerDocument.createElement("w:pPr"),v.insertBefore(b,v.firstChild));let _=P(b,"w:rPr");if(_||(_=v.ownerDocument.createElement("w:rPr"),b.appendChild(_)),!P(_,"w:del")){let D=this._create_track_change_tag("w:del");_.appendChild(D);}}}return true}};function Le(e,t){let r=[],n=e.getElementsByTagName("*");for(let a=0;a<n.length;a++){let i=n[a].tagName;(i===t||i.endsWith(":"+t))&&r.push(n[a]);}return r}h(Le,"findDescendantsByLocalName");function Ml(e){let t=0;function r(o,s){let l=o?o.toString():"",u=s?s.toString():"";return l===u}h(r,"areRunsIdentical");function n(o){let s=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let l=0;l<o.childNodes.length;l++){let u=o.childNodes[l];if(u.nodeType===1){let c=u.tagName;if(!s.includes(c))return true}}return false}h(n,"hasSpecialContent");function a(o){let s=Array.from(o.childNodes).filter(u=>u.nodeType===1),l=0;for(;l<s.length-1;){let u=s[l],c=s[l+1];if(u.tagName==="w:r"&&c.tagName==="w:r"&&!n(u)&&!n(c)){let f=P(u,"w:rPr"),d=P(c,"w:rPr");if(r(f,d)){let p=null;for(let g=0;g<u.childNodes.length;g++){let E=u.childNodes[g];E.nodeType===1&&(E.tagName==="w:t"||E.tagName==="w:delText")&&(p=E);}let m=Array.from(c.childNodes).filter(g=>g.nodeType===1);for(let g of m)if(g.tagName!=="w:rPr")if((g.tagName==="w:t"||g.tagName==="w:delText")&&p&&p.tagName===g.tagName){let E=p.textContent||"",v=g.textContent||"",w=E+v;p.textContent=w,w.trim()!==w&&p.setAttribute("xml:space","preserve");}else u.appendChild(g),(g.tagName==="w:t"||g.tagName==="w:delText")&&(p=g);o.removeChild(c),s.splice(l+1,1),t++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&a(u),l++;}if(s.length>0){let u=s[s.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&a(u);}}h(a,"coalesceContainer");let i=S(e.element,"w:p");for(let o of i)a(o);return t?[`Adjacent identical runs coalesced: ${t}`]:[]}h(Ml,"coalesce_runs");function Rl(e){let t=0,r=["w:rsidR","w:rsidRPr","w:rsidRDefault","w:rsidP","w:rsidDel","w:rsidSect","w:rsidTr"],n=e.element.getElementsByTagName("*");for(let i=0;i<n.length;i++)for(let o of r)n[i].hasAttribute(o)&&(n[i].removeAttribute(o),t++);let a=S(e.element,"w:rsids");for(let i of a)i.parentNode&&(i.parentNode.removeChild(i),t++);return t?[`rsid attributes: ${t} removed`]:[]}h(Rl,"strip_rsid");function Bl(e){let t=0,r=["w14:paraId","w14:textId"],n=e.element.getElementsByTagName("*");for(let a=0;a<n.length;a++)for(let i of r)n[a].hasAttribute(i)&&(n[a].removeAttribute(i),t++);return t?[`Paragraph/text IDs: ${t} removed`]:[]}h(Bl,"strip_para_ids");function Fl(e){let t=S(e.element,"w:proofErr");return t.forEach(r=>r.parentNode?.removeChild(r)),t.length?[`Spell check markers: ${t.length} removed`]:[]}h(Fl,"strip_proof_errors");function Ll(e){let t=0;for(let r of ["w:rPr","w:pPr"]){let n=S(e.element,r);for(let a of n)(a.childNodes.length===0||a.childNodes.length===1&&a.childNodes[0].nodeType===3&&!a.childNodes[0].textContent?.trim())&&(a.parentNode?.removeChild(a),t++);}return t?[`Empty property elements: ${t} removed`]:[]}h(Ll,"strip_empty_properties");function $l(e){let t=0,r=S(e.element,"w:rPr");for(let n of r)if(P(n,"w:vanish")||P(n,"w:webHidden")){let a=n.parentNode;a&&a.tagName==="w:r"&&a.parentNode&&(a.parentNode.removeChild(a),t++);}return t?[`Hidden text runs: ${t} removed`]:[]}h($l,"strip_hidden_text");function Ta(e){let t=S(e.element,"w:ins").length,r=S(e.element,"w:del").length,n=S(e.element,"w:rPrChange").length+S(e.element,"w:pPrChange").length+S(e.element,"w:sectPrChange").length;return [t,r,n]}h(Ta,"count_tracked_changes");function Ul(e){let t=new Set;for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange","w:sectPrChange"])for(let n of S(e.element,r)){let a=n.getAttribute("w:author");a&&t.add(a);}return t}h(Ul,"get_track_change_authors");function Sa(e){let t=[],r=S(e,"w:t");for(let a of r)a.textContent&&t.push(a.textContent);let n=S(e,"w:delText");for(let a of n)a.textContent&&t.push(a.textContent);return t.join("")}h(Sa,"_getElementText");function Wr(e,t=60){let r=e.replace(/\n/g," ").trim();return r.length<=t?r:r.substring(0,t-3)+"..."}h(Wr,"_truncate");function ql(e){let t=[],r=S(e.element,"w:ins"),n=S(e.element,"w:del");for(let o of r){let s=Sa(o).trim();s&&t.push(` Accepted insertion: "${Wr(s,60)}"`);}for(let o of n){let s=Sa(o).trim();s&&t.push(` Accepted deletion of: "${Wr(s,60)}"`);}new Ln(e).accept_all_revisions();for(let o of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let s of S(e.element,o))s.parentNode?.removeChild(s);let i=r.length+n.length;return i?[`Tracked changes auto-accepted: ${i}`].concat(t):[]}h(ql,"accept_all_tracked_changes");function zl(e){let t=hr(e.pkg),r=[],n=0,a=0;for(let[i,o]of Object.entries(t))o.resolved?a++:n++,r.push({id:i,...o});return {total:r.length,open:n,resolved:a,comments:r}}h(zl,"get_comments_summary");function jl(e){let t=hr(e.pkg),r=Object.keys(t);if(r.length===0)return [];let n=[],a=new Ft(e);for(let[l,u]of Object.entries(t)){let c=u.resolved?"[Resolved]":"[Open]";n.push(` ${c} "${Wr(u.text||"",60)}" (${u.author||"Unknown"})`),a.deleteComment(l);}for(let l of ["w:commentRangeStart","w:commentRangeEnd"])for(let u of S(e.element,l))u.parentNode?.removeChild(u);let i=S(e.element,"w:commentReference");for(let l of i){let u=l.parentNode;u&&((u.tagName==="w:r"||u.tagName.endsWith(":r"))&&Array.from(u.childNodes).filter(f=>f.nodeType===1&&f.tagName!=="w:rPr"&&f.tagName!=="rPr").length<=1?u.parentNode?.removeChild(u):u.removeChild(l));}let o=Object.values(t).filter(l=>l.resolved).length,s=Object.values(t).filter(l=>!l.resolved).length;return [`Comments removed: ${r.length} (${o} resolved, ${s} open)`].concat(n)}h(jl,"remove_all_comments");function Wl(e){let t=e.pkg,r=new Set;for(let a of t.parts)if(a.partname.toLowerCase().includes("comments")){r.add(a.partname);let i=a.partname.startsWith("/")?a.partname:"/"+a.partname,o=a.partname.startsWith("/")?a.partname.substring(1):a.partname;r.add(i),r.add(o);}if(r.size===0)return;for(let a of t.parts)if(a.partname.endsWith(".rels")){let i=S(a._element,"Relationship"),o=[];for(let s of i)if((s.getAttribute("Target")||"").toLowerCase().includes("comments")){o.push(s);let u=a.partname.replace("/_rels/","/").replace(".rels",""),c=t.getPartByPath(u);if(c){let f=s.getAttribute("Id");f&&c.rels.delete(f);}}for(let s of o)s.parentNode?.removeChild(s);}let n=t.getPartByPath("[Content_Types].xml");if(n){let a=S(n._element,"Override"),i=[];for(let o of a){let s=o.getAttribute("PartName")||"";(r.has(s)||s.toLowerCase().includes("comments"))&&i.push(o);}for(let o of i)o.parentNode?.removeChild(o);}t.parts=t.parts.filter(a=>!a.partname.toLowerCase().includes("comments"));for(let a of Object.keys(t.unzipped))a.toLowerCase().includes("comments")&&delete t.unzipped[a];}h(Wl,"eject_comment_parts");function Hl(e,t){let r=new Ft(e);if(!r.commentsPart)return [];let n=new Set,a=S(r.commentsPart._element,"w:comment");for(let i of a){let o=i.getAttribute("w:author");if(o&&(n.add(o),i.setAttribute("w:author",t)),i.hasAttribute("w:initials")){let s=t.split(" ").filter(Boolean).map(l=>l[0]).join("").toUpperCase();i.setAttribute("w:initials",s);}}return n.size?[`Comment authors replaced: ${Array.from(n).sort().join(", ")} \u2192 "${t}"`]:[]}h(Hl,"replace_comment_authors");function Vl(e,t){let r=new Set;for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let a of S(e.element,n)){let i=a.getAttribute("w:author");i&&(r.add(i),a.setAttribute("w:author",t));}return r.size?[`Track change authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${t}"`]:[]}h(Vl,"replace_change_authors");function Gl(e){let t=0,r="2025-01-01T00:00:00Z";for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let a of S(e.element,n))a.hasAttribute("w:date")&&(a.setAttribute("w:date",r),t++);return t?[`Track change timestamps: ${t} normalized`]:[]}h(Gl,"normalize_change_dates");function Yl(e){let t=[],r=e.pkg.getPartByPath("docProps/core.xml");r&&(Le(r._element,"creator").forEach(s=>{s.textContent&&(t.push(`Author: ${s.textContent}`),s.textContent="");}),Le(r._element,"lastModifiedBy").forEach(s=>{s.textContent&&(t.push(`Last modified by: ${s.textContent}`),s.textContent="");}),Le(r._element,"revision").forEach(s=>{s.textContent&&parseInt(s.textContent)>1&&(t.push(`Revision count: ${s.textContent} \u2192 1`),s.textContent="1");}));let n=e.pkg.getPartByPath("docProps/app.xml");if(n){let a=n._element,i=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let s of i)Le(a,s).forEach(l=>{l.textContent&&l.textContent!=="0"&&(s==="TotalTime"&&t.push(`Total editing time: ${l.textContent} minutes`),l.textContent="0");});let o=["Template","Manager","Company"];for(let s of o)Le(a,s).forEach(l=>{l.textContent&&(t.push(`${s}: ${l.textContent}`),l.textContent="");});}return t.length?["Metadata scrubbed:",...t.map(a=>` ${a}`)]:[]}h(Yl,"scrub_doc_properties");function Xl(e){let t=false,r="1970-01-01T00:00:00Z",n=e.pkg.getPartByPath("docProps/core.xml");if(n)for(let a of ["created","modified","lastPrinted"])Le(n._element,a).forEach(i=>{i.textContent&&i.textContent!==r&&(i.textContent=r,t=true);});return t?["Timestamps normalized to epoch"]:[]}h(Xl,"scrub_timestamps");function Ql(e){let t=e.pkg.parts.filter(o=>o.partname.includes("/customXml"));if(t.length===0)return [];let r=new Set(t.map(o=>o.partname));e.pkg.parts=e.pkg.parts.filter(o=>!r.has(o.partname));let n=h(o=>{let s=[];for(let l of S(o._element,"Relationship")){let u=l.getAttribute("Target");u&&u.includes("customXml")&&s.push(l);}s.forEach(l=>l.parentNode?.removeChild(l));},"removeRelationsTo"),a=e.pkg.getPartByPath("_rels/.rels");a&&n(a);let i=e.pkg.getOrCreateRelsPart(e.part.partname);i&&n(i);for(let o of S(e.element,"w:sdtPr"))Lu(o,"w:dataBinding").forEach(s=>o.removeChild(s));return [`Custom XML parts: ${t.length} removed`]}h(Ql,"strip_custom_xml");function Jl(e){let t=0;for(let r of Le(e.element,"docPr")){let n=r.getAttribute("descr");if(n){let a=n.length<10,i=n.includes(".")&&n.length<60;(a||i)&&(r.removeAttribute("descr"),t++);}}return t?[`Image alt text: ${t} auto-generated descriptions removed`]:[]}h(Jl,"strip_image_alt_text");function Zl(e){let t=["sharepoint.com","onedrive.com",".internal","intranet","localhost","10.","192.168.","172.16."],r=[],n=e.pkg.getOrCreateRelsPart(e.part.partname);for(let a of S(n._element,"Relationship"))if(a.getAttribute("TargetMode")==="External"){let i=a.getAttribute("Target")||"";for(let o of t)if(i.toLowerCase().includes(o.toLowerCase())){r.push(`Hyperlink targets internal URL: ${Wr(i,80)}`);break}}return r}h(Zl,"audit_hyperlinks");function Kl(e,t,r=2){if(e===t)return 0;if(Math.abs(e.length-t.length)>r)return r+1;if(e.length===0)return t.length<=r?t.length:r+1;if(t.length===0)return e.length<=r?e.length:r+1;if(e.length>t.length){let a=e;e=t,t=a;}let n=Array.from({length:e.length+1},(a,i)=>i);for(let a=1;a<=t.length;a++){let i=[a],o=a;for(let s=1;s<=e.length;s++){let l=e[s-1]===t[a-1]?0:1,u=Math.min(n[s]+1,i[s-1]+1,n[s-1]+l);i.push(u),u<o&&(o=u);}if(o>r)return r+1;n=i;}return n[e.length]<=r?n[e.length]:r+1}h(Kl,"boundedLevenshtein");function ec(e){let t="",r=S(e._element,"w:r");for(let n of r)t+=ct(new et(n,e));return t}h(ec,"_get_paragraph_text");function tc(e,t){let r={},n=new Set,a={},i=[],o=/^(?:[\d.\-()a-zA-Z]+\s*)?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”]/,s=/\([^)]*?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”][^)]*?\)/g;for(let v of nt(e)){if(!(v instanceof ge))continue;let w=ec(v).trim();if(!w)continue;let b=[],_=w.match(o);_&&b.push(_[1].trim());let D=w.matchAll(s);for(let N of D)b.push(N[1].trim());for(let N of b)r[N]?n.add(N):r[N]={count:0};let y=w.length>60?w.substring(0,60)+"...":w,A=S(v._element,"*");for(let N of A){if(N.tagName==="w:bookmarkStart"){let M=N.getAttribute("w:name");M&&(!M.startsWith("_")||M.startsWith("_Ref"))&&(a[M]||(a[M]={anchored_to:y,referenced_from:[]}));}let C=null;if(N.tagName==="w:fldSimple"){let T=(N.getAttribute("w:instr")||"").trim().split(/\s+/);T.length>1&&T[0]==="REF"&&(C=T[1]);}else if(N.tagName==="w:instrText"){let T=(N.textContent||"").trim().split(/\s+/);T.length>1&&T[0]==="REF"&&(C=T[1]);}C&&i.push([C,y]);}}for(let[v,w]of i)a[v]&&a[v].referenced_from.push(w);let l=[],u=Object.keys(r);if(u.length>0){let v=u.sort((D,y)=>y.length-D.length),w=h(D=>D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),b=v.map(w).join("|"),_=new RegExp(`(?<!["\u201C])\\b(${b})\\b(?![\u201D"])`,"g");for(let D of t.matchAll(_)){let y=D[1];r[y]&&r[y].count++;}for(let D of u)r[D].count===0&&(delete r[D],n.delete(D));}for(let v of n)l.push(`[Error] Duplicate Definition: '${v}' is defined multiple times.`);let c=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),f=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,d=new Set(t.match(f)||[]),p=new Set(Object.keys(r)),m={};for(let v of p){let w=v[0].toLowerCase();m[w]||(m[w]=[]),m[w].push(v);}let g={};for(let v of d){let w=v.trim(),b=w.split(/\s+/);for(;b.length>0;){let y=b[0],A=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();if(c.has(A))b.shift();else break}if(w=b.join(" "),w.length<4||p.has(w))continue;let _=w[0].toLowerCase(),D=m[_]||[];if(w.length>5)for(let[y,A]of Object.entries(m))y!==_&&(D=D.concat(A));for(let y of D){if(Math.abs(w.length-y.length)>2||w===y+"s"||w===y+"es"||y===w+"s"||y===w+"es")continue;let A=Kl(w,y,2);A===0||A>2||y.length<=5&&(A>1||w[0].toLowerCase()!==y[0].toLowerCase())||(g[y]||(g[y]=[]),g[y].includes(w)||g[y].push(w));}}for(let[v,w]of Object.entries(g)){w.sort();let b=w.map(_=>`'${_}'`).join(", ");l.push(`[Info] Possible Typos for '${v}': Found ${b}`);}function E(v){return v.startsWith("[Error]")?0:v.startsWith("[Warning]")?1:2}return h(E,"diag_sort_key"),l.sort((v,w)=>{let b=E(v),_=E(w);return b!==_?b-_:v.localeCompare(w)}),[r,l,a]}h(tc,"extract_all_domain_metadata");function rc(e){let t=[],r=e.pkg.getPartByPath("word/settings.xml");if(!r)return t;let n=h(o=>{if(!o.hasAttribute("w:val"))return true;let s=(o.getAttribute("w:val")||"").toLowerCase();return s!=="0"&&s!=="false"&&s!=="off"},"isTruthy"),a=Le(r._element,"removePersonalInformation");a.length>0&&n(a[0])&&t.push("[Warning] Privacy flag `removePersonalInformation` is enabled in word/settings.xml. Microsoft Word will strip the `w:author`, `w:initials`, and `w:date` attributes from every tracked change and comment the next time this document is opened and saved. Edits made by this agent will lose attribution, breaking audit trails and any multi-turn workflow that relies on identifying prior edits.");let i=Le(r._element,"removeDateAndTime");return i.length>0&&n(i[0])&&t.push("[Warning] Privacy flag `removeDateAndTime` is enabled in word/settings.xml. Microsoft Word will strip the `w:date` attribute from every tracked change and comment the next time this document is opened and saved. Timestamps on this agent's edits will be lost on the next Word save."),t}h(rc,"extract_document_settings_warnings");function nc(e,t){let[r,n,a]=tc(e,t),i=rc(e),o=[`
|
|
78
78
|
|
|
79
79
|
---`,"","<!-- READONLY_BOUNDARY_START -->","# Document Structure (Read-Only)","The content below is metadata describing the document's reference structure. Do not include this section in any tracked changes or edits \u2014 it is for your context only and will be discarded on write."],s=false;if(i.length>0){s=true,o.push(`
|
|
80
80
|
## Document Settings`);for(let l of i)o.push(`- ${l}`);}if(Object.keys(r).length>0){s=true,o.push(`
|
|
@@ -84,14 +84,14 @@ ${u}`,l++;else break}t.push([s,a]),r=l;}return t}h(Tl,"_merge_footnote_sections"
|
|
|
84
84
|
`):""}h(nc,"build_structural_appendix");async function ht(e,t=false){let r=await ft.load(e);return $n(r,t)}h(ht,"extractTextFromBuffer");function $n(e,t=false,r=true,n=false){let a=hr(e.pkg),i=[],o=new Map,s=0;for(let u of Fn(e)){let c=i.length>0?s+2:s,f=Un(u,a,t,c,n?o:void 0);f&&(i.length>0&&(s+=2),i.push(f),s+=f.length);}let l=i.join(`
|
|
85
85
|
|
|
86
86
|
`);if(r){let u=nc(e,l);u&&(l+=u);}return n?{text:l,paragraph_offsets:o}:l}h($n,"_extractTextFromDoc");function Un(e,t,r,n,a){let i=e.part||e,[o,s]=dr(i),l=[],u=n,c=true,f=true;if(e.constructor&&e.constructor.name==="NotesPart"){let p=`---
|
|
87
|
-
${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;l.push(p),u+=p.length,c=false;}for(let d of nt(e)){c||(u+=2);let p=u;if(d.constructor.name==="FootnoteItem"){let m=Un(d,t,r,p,a);m?(l.push(m),u=p+m.length,c=false):c||(u-=2);}else if(d instanceof ge){let m=rt(d,o,s);f&&e.constructor.name==="FootnoteItem"&&(m=`[^${e.note_type}-${e.id}]: `+m);let g=pr(d,t,r,o,s),
|
|
87
|
+
${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;l.push(p),u+=p.length,c=false;}for(let d of nt(e)){c||(u+=2);let p=u;if(d.constructor.name==="FootnoteItem"){let m=Un(d,t,r,p,a);m?(l.push(m),u=p+m.length,c=false):c||(u-=2);}else if(d instanceof ge){let m=rt(d,o,s);f&&e.constructor.name==="FootnoteItem"&&(m=`[^${e.note_type}-${e.id}]: `+m);let g=pr(d,t,r,o,s),E=m+g;l.push(E),a&&a.set(d._element,[p,E.length]),u=p+E.length,f=false,c=false;}else if(d instanceof tt){let m=Yr(d,t,r,p,a);m?(l.push(m),u=p+m.length,c=false):c||(u-=2),f=false;}}return l.join(`
|
|
88
88
|
|
|
89
|
-
`)}h(Un,"_extract_blocks");function Yr(e,t,r,n,a){let i=[],o=0,s=n;for(let l of e.rows){let u=[],c=new Set,f=P(l._element,"w:trPr"),d=f?P(f,"w:ins"):null,p=f?P(f,"w:del"):null;if(r&&p)continue;let m=s+(o>0?1:0),
|
|
90
|
-
`)}h(Yr,"extract_table");function pr(e,t,r,n,a){let i=[],o={},s={},l=new Set,u={},c=[],f="",d=["",""],p=["",""],m=Array.from(Gr(e)),g=Ua(e,n,a),
|
|
91
|
-
`)}h(Ia,"_build_merged_meta_block");var Ha=/^(#{1,6}) /,Va=3;function Ga(e,t,r,n,a=null){if(r.length!==n.length)throw new Error("body_pages and body_page_offsets length mismatch");if(a)return hc(e,t,n,a);let i=hr(e.pkg),o=oc(e,i),s=[];for(let u=0;u<o.length;u++){let c=o[u];c.is_paragraph&&fr(c.item)&&lc(c.item,i)&&s.push(u);}if(s.length===0)return [];let l=[];for(let u=0;u<s.length;u++){let c=s[u],f=o[c],d=f.item,p=Hr(d),m=Ja(d,i),g=Xr(d),
|
|
89
|
+
`)}h(Un,"_extract_blocks");function Yr(e,t,r,n,a){let i=[],o=0,s=n;for(let l of e.rows){let u=[],c=new Set,f=P(l._element,"w:trPr"),d=f?P(f,"w:ins"):null,p=f?P(f,"w:del"):null;if(r&&p)continue;let m=s+(o>0?1:0),E=m+(!r&&d||!r&&p?4:0),v=true;for(let b of l.cells){if(c.has(b))continue;c.add(b),v||(E+=3);let _=Un(b,t,r,E,a);if(!r){let D=b._element.getElementsByTagName("w:p")[0],y=D?D.getAttribute("w14:paraId"):null;if(y){let A=`{#cell:${y}}`;_=_+A;}}u.push(_),E+=_.length,v=false;}let w=u.join(" | ");r||(d?w=`{++ ${w} |Chg:${d.getAttribute("w:id")}++}`:p&&(w=`{-- ${w} |Chg:${p.getAttribute("w:id")}--}`)),i.push(w),s=m+w.length,o++;}return i.join(`
|
|
90
|
+
`)}h(Yr,"extract_table");function pr(e,t,r,n,a){let i=[],o={},s={},l=new Set,u={},c=[],f="",d=["",""],p=["",""],m=Array.from(Gr(e)),g=Ua(e,n,a),E=Bn(e,n,a),v=g;for(let w=0;w<m.length;w++){let b=m[w];if(b instanceof et){let[_,D]=qa(b,E),y=ct(b);if(r&&Object.keys(s).length>0)continue;if(v){if(!y||!y.trim())continue;v=false;}let A=yl(y,_,D);if(A){let N=r?["",""]:ic(o,s,l,u),C=[_,D];if(f&&N[0]===d[0]&&N[1]===d[1]?(C[0]===p[0]&&C[1]===p[1]&&p[0]!==""&&f.endsWith(p[1])&&A.startsWith(C[0])?f=f.slice(0,-p[1].length)+A.slice(C[0].length):f+=A,p=C):(f&&i.push(`${d[0]}${f}${d[1]}`),f=A,d=N,p=C),!r){(Object.keys(o).length>0||Object.keys(s).length>0||l.size>0||Object.keys(u).length>0)&&c.push([{...o},{...s},new Set(l),{...u}]);let T=false;if(Object.keys(o).length>0||Object.keys(s).length>0||Object.keys(u).length>0||l.size>0){let F=w+1,I=false,V=Object.keys(o).length,U=Object.keys(s).length,B=Object.keys(u).length,L=new Set(l);for(;F<m.length;){let k=m[F];if(k instanceof et){if(!ct(k)){F++;continue}(V>0||U>0||B>0||L.size>0)&&(I=true);break}else {let W=k;W.type==="ins_start"?V++:W.type==="ins_end"?V=Math.max(0,V-1):W.type==="del_start"?U++:W.type==="del_end"?U=Math.max(0,U-1):W.type==="fmt_start"?B++:W.type==="fmt_end"?B=Math.max(0,B-1):W.type==="start"?L.add(W.id):W.type==="end"&&L.delete(W.id);}F++;}I&&(T=true);}if(!T&&c.length>0){let F=Ia(c,t);F&&(f&&(i.push(`${d[0]}${f}${d[1]}`),f="",d=["",""],p=["",""]),i.push(`{>>${F}<<}`)),c.length=0;}}}}else {let _=b;v=false,["ins_start","ins_end","del_start","del_end","fmt_start","fmt_end"].includes(_.type)||f&&(i.push(`${d[0]}${f}${d[1]}`),f="",d=["",""],p=["",""]),_.type==="start"?l.add(_.id):_.type==="end"?l.delete(_.id):_.type==="ins_start"?o[_.id]=_:_.type==="ins_end"?delete o[_.id]:_.type==="del_start"?s[_.id]=_:_.type==="del_end"?delete s[_.id]:_.type==="fmt_start"?u[_.id]=_:_.type==="fmt_end"?delete u[_.id]:_.type==="footnote"||_.type==="endnote"?(f&&(i.push(`${d[0]}${f}${d[1]}`),f="",d=["",""],p=["",""]),i.push(`[^${_.type==="footnote"?"fn":"en"}-${_.id}]`)):_.type==="hyperlink_start"?(f&&(i.push(`${d[0]}${f}${d[1]}`),f="",d=["",""],p=["",""]),i.push("[")):_.type==="hyperlink_end"?(f&&(i.push(`${d[0]}${f}${d[1]}`),f="",d=["",""],p=["",""]),i.push(`](${_.date})`)):_.type==="xref_start"?(f&&(i.push(`${d[0]}${f}${d[1]}`),f="",d=["",""],p=["",""]),i.push("[~")):_.type==="xref_end"?(f&&(i.push(`${d[0]}${f}${d[1]}`),f="",d=["",""],p=["",""]),i.push(`~](#${_.id})`)):_.type==="bookmark"&&(f&&(i.push(`${d[0]}${f}${d[1]}`),f="",d=["",""],p=["",""]),i.push(`{#${_.id}}`));}}if(f&&i.push(`${d[0]}${f}${d[1]}`),c.length>0){let w=Ia(c,t);w&&i.push(`{>>${w}<<}`);}return i.join("")}h(pr,"build_paragraph_text");function ic(e,t,r,n){return Object.keys(t).length>0?["{--","--}"]:Object.keys(e).length>0?["{++","++}"]:r.size>0||Object.keys(n).length>0?["{==","==}"]:["",""]}h(ic,"_get_wrappers");function Ia(e,t){let r=[],n=[],a=new Set;for(let[o,s,l,u]of e){let c=h(function(p){if(!t[p])return;let m=`Com:${p}`;if(a.has(m))return;let g=t[p],E=`[${m}] ${g.author}`;if(g.date&&(E+=` @ ${g.date}`),g.resolved&&(E+="(RESOLVED)"),n.push(`${E}: ${g.text}`),a.add(m),f[p]){let v=f[p].sort((w,b)=>(t[w]?.date||"").localeCompare(t[b]?.date||""));for(let w of v)c(w);}},"render_comment2");for(let[p,m]of Object.entries(o)){let g=`Chg:${p}`;a.has(g)||(r.push(`[${g} insert] ${m.author||"Unknown"}`),a.add(g));}for(let[p,m]of Object.entries(s)){let g=`Chg:${p}`;a.has(g)||(r.push(`[${g} delete] ${m.author||"Unknown"}`),a.add(g));}for(let[p,m]of Object.entries(u)){let g=`Chg:${p}`;a.has(g)||(r.push(`[${g} format] ${m.author||"Unknown"}`),a.add(g));}let f={};for(let[p,m]of Object.entries(t)){let g=m.parent_id;g&&(f[g]||(f[g]=[]),f[g].push(p));}let d=Array.from(l).sort();for(let p of d)c(p);}return [...r,...n].join(`
|
|
91
|
+
`)}h(Ia,"_build_merged_meta_block");var Ha=/^(#{1,6}) /,Va=3;function Ga(e,t,r,n,a=null){if(r.length!==n.length)throw new Error("body_pages and body_page_offsets length mismatch");if(a)return hc(e,t,n,a);let i=hr(e.pkg),o=oc(e,i),s=[];for(let u=0;u<o.length;u++){let c=o[u];c.is_paragraph&&fr(c.item)&&lc(c.item,i)&&s.push(u);}if(s.length===0)return [];let l=[];for(let u=0;u<s.length;u++){let c=s[u],f=o[c],d=f.item,p=Hr(d),m=Ja(d,i),g=Xr(d),E=cc(o,s,u,p),v=o.slice(c+1,E),w=ac(o,c+1,E),b=fc(v),_=eo(f.start_offset,n);l.push({level:p,text:m,page:_,style:g,has_table:w,footnote_ids:b});}return l}h(Ga,"extract_outline");function ac(e,t,r){for(let n=t;n<r;n++){let a=e[n];if(a.is_paragraph&&fr(a.item))return false;if(a.is_table)return true}return false}h(ac,"_direct_has_table");function oc(e,t){let r=Array.from(Fn(e)),n=0,a=null;for(let l of r){if(l===e){a=l;break}let u=Qa(l,t);u&&(n>0&&(n+=2),n+=u.length);}a?n>0&&(n+=2):(a=e,n=0);let i=[],o=n,s=true;for(let l of nt(a))if(l instanceof ge){let u=rt(l),c=pr(l,t,false),f=(u+c).length;s||(o+=2),i.push({item:l,is_paragraph:true,is_table:false,start_offset:o,projected_length:f}),o+=f,s=false;}else if(l instanceof tt){let u=Yr(l,t,false,0),c=u?u.length:0;s||(o+=2);let f=o;i.push({item:l,is_paragraph:false,is_table:true,start_offset:f,projected_length:c}),Xa(l,f,i,t),o+=c,s=false;}return i}h(oc,"_walk_doc_body");function Ya(e,t,r,n){let a=t._element,i=r,o=0;for(let s of e.rows){o>0&&(i+=1);let l=new Set,u=0;for(let c of s.cells){if(l.has(c))continue;l.add(c),u>0&&(i+=3);let[f,d]=sc(c,a,i,n);if(d)return f;i=f,u++;}o++;}return r}h(Ya,"_compute_inner_block_offset");function sc(e,t,r,n){let a=r,i=true;for(let o of nt(e)){if(i||(a+=2),o instanceof ge){if(o._element===t)return [a,true];let s=rt(o),l=pr(o,n,false);a+=(s+l).length;}else if(o instanceof tt){let s=Ya(o,new ge(t,null),a,n);if(s!==a&&uc(t,o._element))return [s,true];let l=Yr(o,n,false,0);a+=l?l.length:0;}i=false;}return [a,false]}h(sc,"_walk_cell_for_offset");function uc(e,t){let r=e.parentNode;for(;r;){if(r===t)return true;r=r.parentNode;}return false}h(uc,"_element_is_descendant");function Xa(e,t,r,n){let a=new Set;for(let i of e.rows)for(let o of i.cells)if(!a.has(o)){a.add(o);for(let s of nt(o))if(s instanceof ge){let l=fr(s)?Ya(e,s,t,n):t;r.push({item:s,is_paragraph:true,is_table:false,start_offset:l,projected_length:0});}else s instanceof tt&&(r.push({item:s,is_paragraph:false,is_table:true,start_offset:t,projected_length:0}),Xa(s,t,r,n));}}h(Xa,"_record_table_inner_blocks_lite");function Qa(e,t){let r=[],n=e.constructor.name;if(n==="NotesPart"){let i=e.note_type==="fn"?"## Footnotes":"## Endnotes";r.push(`---
|
|
92
92
|
${i}`);}let a=true;for(let i of nt(e))if(i.constructor.name==="FootnoteItem"){let o=Qa(i,t);o&&r.push(o);}else if(i instanceof ge){let o=rt(i);a&&n==="FootnoteItem"&&(o=`[^${e.note_type}-${e.id}]: ${o}`);let s=pr(i,t,false);r.push(o+s),a=false;}else if(i instanceof tt){let o=Yr(i,t,false,0);o&&r.push(o),a=false;}return r.join(`
|
|
93
93
|
|
|
94
|
-
`)}h(Qa,"_project_part");function fr(e){return Ha.test(rt(e))}h(fr,"_is_heading");function lc(e,t){if(Xr(e)!=="(heuristic)")return true;let n=Ja(e,t);return n?(n.match(/\w+/g)||[]).length>=Va:false}h(lc,"_heading_passes_quality_filter");function Hr(e){let t=Ha.exec(rt(e));return t?Math.min(t[1].length,6):1}h(Hr,"_heading_level");function Ja(e,t){let r=pr(e,t,false),n=Za(r);return n=Ka(n),n.trim()}h(Ja,"_heading_text");function Za(e){return e?(e=e.replace(/\{--[\s\S]*?--\}/g,""),e=e.replace(/\{>>[\s\S]*?<<\}/g,""),e=e.replace(/\{\+\+([\s\S]*?)\+\+\}/g,"$1"),e=e.replace(/\{==([\s\S]*?)==\}/g,"$1"),e):""}h(Za,"_strip_critic_markup");function Ka(e){return e?(e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/__(.+?)__/g,"$1"),e=e.replace(/(?<!\w)_(\S(?:.*?\S)?)_(?!\w)/g,"$1"),e):""}h(Ka,"_strip_inline_formatting");function Xr(e){let[t,r]=dr(e._parent.part||e._parent),n=P(e._element,"w:pPr"),a=r;if(n){let u=P(n,"w:pStyle");u&&(a=u.getAttribute("w:val")||r);}let i=null,o=false;if(n){let u=P(n,"w:outlineLvl");u&&/^\d+$/.test(u.getAttribute("w:val")||"")&&(i=parseInt(u.getAttribute("w:val"),10));}i===null&&a&&t&&t[a]&&(i=t[a].outline_level,o=true);let l=a&&t&&t[a]?t[a].name:a;return l&&typeof l=="string"&&(l.toLowerCase().startsWith("heading")?l=l.replace(/^heading/i,"Heading"):l.toLowerCase()==="title"&&(l="Title")),o&&i!==null&&(l&&(l.startsWith("Heading")||l==="Title")||(i=null)),i!==null&&i>=0&&i<=8?l&&(l.startsWith("Heading")||l==="Title")?l:"(outline_level)":l&&(l.startsWith("Heading")||l==="Title")||l&&/Heading[ ]?([1-6])(?![0-9])/.test(l)?l:"(heuristic)"}h(Xr,"_determine_heading_style");function cc(e,t,r,n){for(let a=r+1;a<t.length;a++){let i=t[a];if(Hr(e[i].item)<=n)return i}return e.length}h(cc,"_find_owned_end");function fc(e){let t=new Set,r=[];for(let n of e)if(n.is_paragraph)for(let a of Gr(n.item)){if(!("type"in a))continue;let i="";if(a.type==="footnote")i=`fn-${a.id}`;else if(a.type==="endnote")i=`en-${a.id}`;else continue;t.has(i)||(t.add(i),r.push(i));}return r}h(fc,"_collect_footnote_ids");function eo(e,t){if(!t||t.length===0)return 1;let r=1;for(let n=0;n<t.length&&e>=t[n];n++)r=n+1;return r}h(eo,"_offset_to_page");function hc(e,t,r,n){let a=[],i=new Set;function o(u){for(let c of nt(u))if(c.constructor.name==="FootnoteItem")o(c);else if(c instanceof ge)a.push(["p",c]);else if(c instanceof tt){a.push(["t",c]);for(let d of c.rows)for(let p of d.cells)i.has(p._element)||(i.add(p._element),o(p));}}h(o,"walk"),o(e);let s=[];for(let u=0;u<a.length;u++){let[c,f]=a[u];if(c!=="p")continue;let d=false;n instanceof Map?d=n.has(f._element):d=f._element in n,d&&fr(f)&&dc(f,t,n)&&s.push(u);}if(s.length===0)return [];let l=[];for(let u=0;u<s.length;u++){let c=s[u],f=a[c][1],d=Hr(f),p=to(f,t,n),m=Xr(f),g=c;for(let D=u+1;D<s.length;D++){let y=s[D],A=a[y][1];if(Hr(A)<=d){g=y;break}}g===c&&(g=a.length);let
|
|
94
|
+
`)}h(Qa,"_project_part");function fr(e){return Ha.test(rt(e))}h(fr,"_is_heading");function lc(e,t){if(Xr(e)!=="(heuristic)")return true;let n=Ja(e,t);return n?(n.match(/\w+/g)||[]).length>=Va:false}h(lc,"_heading_passes_quality_filter");function Hr(e){let t=Ha.exec(rt(e));return t?Math.min(t[1].length,6):1}h(Hr,"_heading_level");function Ja(e,t){let r=pr(e,t,false),n=Za(r);return n=Ka(n),n.trim()}h(Ja,"_heading_text");function Za(e){return e?(e=e.replace(/\{--[\s\S]*?--\}/g,""),e=e.replace(/\{>>[\s\S]*?<<\}/g,""),e=e.replace(/\{\+\+([\s\S]*?)\+\+\}/g,"$1"),e=e.replace(/\{==([\s\S]*?)==\}/g,"$1"),e):""}h(Za,"_strip_critic_markup");function Ka(e){return e?(e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/__(.+?)__/g,"$1"),e=e.replace(/(?<!\w)_(\S(?:.*?\S)?)_(?!\w)/g,"$1"),e):""}h(Ka,"_strip_inline_formatting");function Xr(e){let[t,r]=dr(e._parent.part||e._parent),n=P(e._element,"w:pPr"),a=r;if(n){let u=P(n,"w:pStyle");u&&(a=u.getAttribute("w:val")||r);}let i=null,o=false;if(n){let u=P(n,"w:outlineLvl");u&&/^\d+$/.test(u.getAttribute("w:val")||"")&&(i=parseInt(u.getAttribute("w:val"),10));}i===null&&a&&t&&t[a]&&(i=t[a].outline_level,o=true);let l=a&&t&&t[a]?t[a].name:a;return l&&typeof l=="string"&&(l.toLowerCase().startsWith("heading")?l=l.replace(/^heading/i,"Heading"):l.toLowerCase()==="title"&&(l="Title")),o&&i!==null&&(l&&(l.startsWith("Heading")||l==="Title")||(i=null)),i!==null&&i>=0&&i<=8?l&&(l.startsWith("Heading")||l==="Title")?l:"(outline_level)":l&&(l.startsWith("Heading")||l==="Title")||l&&/Heading[ ]?([1-6])(?![0-9])/.test(l)?l:"(heuristic)"}h(Xr,"_determine_heading_style");function cc(e,t,r,n){for(let a=r+1;a<t.length;a++){let i=t[a];if(Hr(e[i].item)<=n)return i}return e.length}h(cc,"_find_owned_end");function fc(e){let t=new Set,r=[];for(let n of e)if(n.is_paragraph)for(let a of Gr(n.item)){if(!("type"in a))continue;let i="";if(a.type==="footnote")i=`fn-${a.id}`;else if(a.type==="endnote")i=`en-${a.id}`;else continue;t.has(i)||(t.add(i),r.push(i));}return r}h(fc,"_collect_footnote_ids");function eo(e,t){if(!t||t.length===0)return 1;let r=1;for(let n=0;n<t.length&&e>=t[n];n++)r=n+1;return r}h(eo,"_offset_to_page");function hc(e,t,r,n){let a=[],i=new Set;function o(u){for(let c of nt(u))if(c.constructor.name==="FootnoteItem")o(c);else if(c instanceof ge)a.push(["p",c]);else if(c instanceof tt){a.push(["t",c]);for(let d of c.rows)for(let p of d.cells)i.has(p._element)||(i.add(p._element),o(p));}}h(o,"walk"),o(e);let s=[];for(let u=0;u<a.length;u++){let[c,f]=a[u];if(c!=="p")continue;let d=false;n instanceof Map?d=n.has(f._element):d=f._element in n,d&&fr(f)&&dc(f,t,n)&&s.push(u);}if(s.length===0)return [];let l=[];for(let u=0;u<s.length;u++){let c=s[u],f=a[c][1],d=Hr(f),p=to(f,t,n),m=Xr(f),g=c;for(let D=u+1;D<s.length;D++){let y=s[D],A=a[y][1];if(Hr(A)<=d){g=y;break}}g===c&&(g=a.length);let E=a.slice(c+1,g),v=false;for(let[D,y]of E){if(D==="p"&&fr(y))break;if(D==="t"){v=true;break}}let w=pc(E),b;n instanceof Map?b=n.get(f._element):b=n[f._element];let _=1;if(b!==void 0){let[D]=b;_=eo(D,r);}l.push({level:d,text:p,page:_,style:m,has_table:v,footnote_ids:w});}return l}h(hc,"_extract_outline_fast");function dc(e,t,r){if(Xr(e)!=="(heuristic)")return true;let a=to(e,t,r);return a?(a.match(/\w+/g)||[]).length>=Va:false}h(dc,"_heading_passes_quality_filter_fast");function to(e,t,r){let n;if(r instanceof Map?n=r.get(e._element):n=r[e._element],n===void 0)return "";let[a,i]=n,o=t.substring(a,a+i),s=Za(o);return s=Ka(s),s=s.replace(/^#+\s+/,""),s.trim()}h(to,"_heading_text_fast");function pc(e){let t=new Set,r=[];for(let[n,a]of e)if(n==="p")for(let i of Gr(a)){if(!("type"in i))continue;let o="";if(i.type==="footnote")o=`fn-${i.id}`;else if(i.type==="endnote")o=`en-${i.id}`;else continue;t.has(o)||(t.add(o),r.push(o));}return r}h(pc,"_collect_footnote_ids_fast");var mc=class{static{h(this,"SanitizeReport");}filename;mode;author;tracked_changes_found=0;tracked_changes_accepted=0;tracked_changes_kept=0;change_lines=[];comments_removed=0;comments_kept=0;removed_comment_lines=[];kept_comment_lines=[];metadata_lines=[];structural_lines=[];warnings=[];status="clean";blocked_reason=null;constructor(e,t="full",r=null){this.filename=e,this.mode=t,this.author=r;}add_transform_lines(e){for(let t of e){let r=t.toLowerCase();r.includes("tracked change")||r.includes("insertion")||r.includes("deletion")||r.includes("accepted")?this.change_lines.push(t):r.includes("comment")||r.includes("[open]")||r.includes("[resolved]")?r.includes("kept")||r.includes("visible")?this.kept_comment_lines.push(t):this.removed_comment_lines.push(t):r.includes("author")||r.includes("template")||r.includes("company")||r.includes("manager")||r.includes("metadata")||r.includes("timestamp")||r.includes("custom xml")||r.includes("last modified by")||r.includes("revision count")||r.includes("last printed")?this.metadata_lines.push(t):r.includes("hyperlink")||r.includes("warning")?this.warnings.push(t):this.structural_lines.push(t);}}render(){let e="\u2550".repeat(50),t=[e,`Finalization Report: ${this.filename}`],r=[];if(this.mode==="keep-markup"&&r.push("--keep-markup"),this.author&&r.push(`--author "${this.author}"`),this.tracked_changes_accepted>0&&r.push("--accept-all"),r.length>0&&t.push(r.join(" ")),t.push(e),this.status==="blocked")return t.push(""),t.push(`BLOCKED: ${this.blocked_reason}`),t.push(e),t.join(`
|
|
95
95
|
`);if(this.mode==="keep-markup"&&(this.tracked_changes_kept>0||this.comments_kept>0)){if(t.push(""),t.push("VISIBLE TO COUNTERPARTY"),this.tracked_changes_kept>0&&t.push(` Tracked changes: ${this.tracked_changes_kept}`),this.comments_kept>0){t.push(` Open comments: ${this.comments_kept}`);for(let n of this.kept_comment_lines)t.push(` ${n}`);}this.author&&t.push(` Author on all markup: "${this.author}"`);}if(this.change_lines.length>0){t.push(""),t.push("TRACKED CHANGES");for(let n of this.change_lines)t.push(` ${n}`);}if(this.removed_comment_lines.length>0){t.push(""),t.push("COMMENTS (stripped)");for(let n of this.removed_comment_lines)t.push(` ${n}`);}if(this.metadata_lines.length>0){t.push(""),t.push("METADATA");for(let n of this.metadata_lines)t.push(` ${n}`);}if(this.structural_lines.length>0){t.push(""),t.push("STRUCTURAL & PROTECTION");for(let n of this.structural_lines)t.push(` ${n}`);}if(this.warnings.length>0){t.push(""),t.push("WARNINGS");for(let n of this.warnings)t.push(` \u26A0 ${n}`);}return t.push(""),t.push(e),this.warnings.length>0?t.push(`Result: CLEAN WITH WARNINGS (${this.warnings.length} warning${this.warnings.length>1?"s":""})`):t.push(`Result: CLEAN (${this.tracked_changes_found} changes resolved, ${this.comments_removed} comments removed)`),t.push(e),t.join(`
|
|
96
96
|
`)}};async function ro(e,t){let r=new mc(t.filename,t.sanitize_mode||"full",t.author||null);if(t.sanitize_mode==="full"){let i=Ta(e),o=i[0]+i[1]+i[2];if(r.tracked_changes_found=o,o>0&&!t.accept_all)return r.status="blocked",r.blocked_reason=`Document contains ${o} unresolved tracked changes (${i[0]} insertions, ${i[1]} deletions, ${i[2]} formatting). Review in Word first, or set accept_all=true.`,{reportText:r.render()};if(o>0){let l=Ul(e);l.size>1&&r.warnings.push(`Multiple authors detected in tracked changes: ${Array.from(l).sort().join(", ")}. Review per-change list before sending.`),r.add_transform_lines(ql(e)),r.tracked_changes_accepted=o;}let s=zl(e);r.comments_removed=s.total,r.add_transform_lines(jl(e)),Wl(e);}else if(t.sanitize_mode==="keep-markup"){let i=Ta(e);r.tracked_changes_found=i[0]+i[1]+i[2],r.tracked_changes_kept=r.tracked_changes_found,t.author&&(r.add_transform_lines(Hl(e,t.author)),r.add_transform_lines(Vl(e,t.author)));}r.add_transform_lines(Rl(e)),r.add_transform_lines(Bl(e)),r.add_transform_lines(Fl(e)),r.add_transform_lines(Ll(e)),r.add_transform_lines($l(e)),r.add_transform_lines(Ml(e)),r.add_transform_lines(Yl(e)),r.add_transform_lines(Xl(e)),r.add_transform_lines(Ql(e)),r.add_transform_lines(Jl(e));let n=Zl(e);for(let i of n)r.warnings.push(i);if(r.add_transform_lines(Gl(e)),t.protection_mode==="read_only"||t.protection_mode==="encrypt"){t.protection_mode==="encrypt"&&r.warnings.push("Encryption mode (AES compound wrappers) is strictly unsupported in the zero-dependency Node engine. Falling back to native Word Read-Only lock.");let i=e.pkg.getPartByPath("word/settings.xml");if(i){let o=i._element.ownerDocument,s=Le(i._element,"documentProtection")[0];s||(s=o.createElement("w:documentProtection"),i._element.appendChild(s)),s.setAttribute("w:edit","readOnly"),s.setAttribute("w:enforcement","1"),r.structural_lines.push("Document locked (Read-Only enforcement injected into settings.xml)");}}t.export_pdf&&r.warnings.push("PDF export requires the Python/Word COM environment and is skipped in this zero-dependency Node agent.");for(let i of e.pkg.parts)if((i===e.part||i.contentType.includes("wordprocessingml")&&i.contentType.endsWith("+xml"))&&i._element.hasAttribute("xmlns:w16du")){let o=false;if(Array.from(i._element.attributes||[]).some(s=>s.name.startsWith("w16du:")&&s.name!=="xmlns:w16du")&&(o=true),!o){let s=S(i._element,"*");for(let l of s)if(l.tagName.startsWith("w16du:")||Array.from(l.attributes||[]).some(u=>u.name.startsWith("w16du:"))){o=true;break}}o||i._element.removeAttribute("xmlns:w16du");}r.warnings.length>0&&(r.status="clean_with_warnings");let a=await e.save();return {reportText:r.render(),outBuffer:a}}h(ro,"finalize_document");var no=[{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. Must be a valid .docx (not .doc, .pdf, or another format).",displayOptions:{show:{resource:["document"],operation:["extractMarkdown"]}}},{displayName:"Clean View",name:"cleanView",type:"boolean",default:false,description:"Whether to project the document as if all pending tracked changes were accepted (simulates Accept All). When false (default), all tracked changes are surfaced inline as CriticMarkup ({++ins++}, {--del--}, {>>comment<<}) so an AI can review and resolve them. Use false to review counterparty edits; use true to generate net-new redlines against a clean baseline.",displayOptions:{show:{resource:["document"],operation:["extractMarkdown"]}}},{displayName:"Page",name:"page",type:"number",default:0,typeOptions:{minValue:0},description:"Optional 1-based page number to return only one page of the projected document (integer, default 0). When 0 (default), the full Markdown body plus the Structural Appendix is returned in the 'markdown' field and pagination metadata is omitted. When >= 1, only that page is returned in the 'markdown' field and the JSON output includes pagination metadata: page, total_pages, has_next, has_prev, tracked_change_count. Pages are ~19,000-character chunks of the projected body with the Structural Appendix appended to each page. Use the extractOutline operation first to discover how many pages exist and what each page contains. If the requested page exceeds total_pages, an error is thrown.",displayOptions:{show:{resource:["document"],operation:["extractMarkdown"]}}}];async function io(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("cleanView",e),n=this.getNodeParameter("page",e,0),i=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:o,fileName:s}=await Se.call(this,e,i),l=await ht(o,r);if(!n||n===0)return [{json:{fileName:s,cleanView:r,markdown:l},pairedItem:{item:e}}];let[u,c]=Lt(l),f=$t(u,c);if(n>f.total_pages)throw new n8nWorkflow.NodeOperationError(this.getNode(),`Requested page ${n} exceeds total_pages (${f.total_pages}). Call extractOutline to discover the page count first.`,{itemIndex:e});let d=f.pages[n-1];return [{json:{fileName:s,cleanView:r,markdown:d.page_content,page:d.page,total_pages:d.total_pages,has_next:d.has_next,has_prev:d.has_prev,tracked_change_count:d.tracked_change_count},pairedItem:{item:e}}]}h(io,"executeExtractMarkdown");var ao=[{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. Must be a valid .docx.",displayOptions:{show:{resource:["document"],operation:["extractOutline"]}}}];async function oo(e){let t=this.getNodeParameter("binaryPropertyName",e),n=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:a,fileName:i}=await Se.call(this,e,n),o=await ft.load(a),s=$n(o,false,true,true),[l]=Lt(s.text),u=$t(l,""),c=Ga(o,l,u.body_pages,u.body_page_offsets,s.paragraph_offsets);return [{json:{fileName:i,total_pages:u.total_pages,outline:c.map(f=>({level:f.level,text:f.text,page:f.page,style:f.style,has_table:f.has_table,footnote_ids:f.footnote_ids}))},pairedItem:{item:e}}]}h(oo,"executeExtractOutline");var so=[{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. The file must be a valid .docx.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the redlined .docx file (string, e.g. 'data'). If equal to the input property name, the original binary is overwritten on the outgoing item.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Author",name:"author",type:"string",default:"Adeu AI",placeholder:"e.g. AI Reviewer",description:"Author name attached to all tracked changes and comments produced by this operation (string, e.g. 'AI Reviewer'). Shows up in Word's review pane as the author of every redline and comment created in this batch.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Edits Source",name:"editsSource",type:"options",noDataExpression:true,default:"fromInputJson",description:"Where to read the list of DocumentChange objects from. Use 'Define Below' to read the array from the Changes (JSON) field on this node \u2014 this is the typical AI Agent path, since the LLM generates the array as a tool call argument that lands on that field via $fromAI(). Use 'From Input JSON' to read the array from a property on the upstream item's JSON, for deterministic pipelines where a non-AI node (HTTP Request, Code, etc.) has pre-populated it.",options:[{name:"Define Below",value:"defineBelow",description:"Read the array from the Changes (JSON) field on this node. Use for AI Agent workflows \u2014 the LLM populates that field via $fromAI() as a tool call argument."},{name:"From Input JSON",value:"fromInputJson",description:"Read the array from a property on the upstream item's JSON. Use for deterministic pipelines where a non-AI node has pre-populated the changes array."}],displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"JSON Path on Input Item",name:"editsJsonPath",type:"string",default:"changes",required:true,placeholder:"e.g. data.changes",description:"Property path on the input item JSON whose value is the array of DocumentChange objects (string, dot-notation supported, e.g. 'changes' or 'data.changes'). Must resolve to an array; throws an error otherwise.",displayOptions:{show:{resource:["document"],operation:["applyEdits"],editsSource:["fromInputJson"]}}},{displayName:"Changes (JSON)",name:"editsJson",type:"string",default:`[
|
|
97
97
|
{
|
|
@@ -100,4 +100,4 @@ ${i}`);}let a=true;for(let i of nt(e))if(i.constructor.name==="FootnoteItem"){le
|
|
|
100
100
|
"new_text": "State of Delaware",
|
|
101
101
|
"comment": "Standardizing governing law."
|
|
102
102
|
}
|
|
103
|
-
]`,required:true,description:`JSON-encoded string containing an array of DocumentChange objects. Each object has a 'type' field discriminator and type-specific fields. type='modify': requires target_text (string, copied EXACTLY from the source including punctuation, spacing, and case) and new_text (string); optional comment (string). Optional match_mode (one of 'strict' | 'first' | 'all', default 'strict'): 'strict' fails on ambiguous matches; 'first' silently anchors to the first occurrence; 'all' applies the same replacement to every occurrence in linear document order. Optional regex (boolean, default false): when true, target_text is interpreted as an ES2022 RegExp pattern and new_text may reference capture groups via $1, $2, etc. Combine with match_mode='all' for global regex replacements. Never include CriticMarkup tags like {++ ++} or {-- --} in new_text \u2014 the engine applies tracking automatically. Never target text already inside another author's pending tracked change. type='accept': requires target_id (string like 'Chg:12' from the Markdown projection); optional comment. type='reject': requires target_id (string like 'Chg:12'); optional comment. type='reply': requires target_id (string like 'Com:45') and text (string). type='insert_row': requires target_text (string anchoring a table cell), position ('above' or 'below'), and cells (array of strings, one per column). type='delete_row': requires target_text (string anchoring the row to delete). The whole batch is validated atomically: if any single edit fails (target text not found, ambiguous match under match_mode='strict', read-only target, overlapping another author's change), the entire batch is rejected and the document is left untouched. Example: '[{"type":"modify","target_text":"within thirty (30) days","new_text":"within forty-five (45) days","comment":"Per playbook.","match_mode":"all"}]'. Markdown code fences (\`\`\`json ... \`\`\`) wrapping the value are stripped automatically.`,typeOptions:{rows:10},displayOptions:{show:{resource:["document"],operation:["applyEdits"],editsSource:["defineBelow"]}}},{displayName:"Return Markdown Output",name:"returnMarkdown",type:"boolean",default:true,description:"Whether to auto-extract the post-edit document as Markdown (with CriticMarkup) and include it in the outgoing JSON under the 'markdown' field. Useful for feeding the updated state back into a downstream AI Agent for review or further edits. Adds extraction overhead per call. Has no effect when Dry Run is enabled \u2014 dry runs do not produce a post-edit buffer; inspect the per-edit 'critic_markup' / 'clean_text' previews on the returned 'edits' array instead.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Dry Run",name:"dryRun",type:"boolean",default:false,description:"Whether to preview edits without writing them to the document. When true, the engine validates every edit, simulates the application in-memory, and returns a detailed 'edits' report (per-edit status, CriticMarkup context preview, clean text preview, warnings, and errors) \u2014 but the document is NOT modified, no redlined binary is produced, and no static-data stash is written. The incoming binary passes through unchanged on the outgoing item. Use as a self-correction primitive: when an anchor's uniqueness or wording is uncertain, dry-run first, inspect each edit's 'critic_markup' preview, then re-call with Dry Run disabled to commit. Default false (commit edits normally). Important: invalid edits in a dry run do NOT throw a BatchValidationError \u2014 they return as failed entries in the 'edits' array. Wet runs still throw atomically on the first validation failure.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}}];async function uo(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("author",e),a=this.getNodeParameter("editsSource",e),i=this.getNodeParameter("returnMarkdown",e),o=this.getNodeParameter("dryRun",e,false),s;if(a==="fromInputJson"){let y=this.getNodeParameter("editsJsonPath",e),A=this.getInputData()[e].json;if(s=qn(A,y),s===void 0)throw new Error(`No property "${y}" found on the input item JSON. Verify the upstream node produced it, or switch "Edits Source" to "Define Below".`)}else {let y=this.getNodeParameter("editsJson",e);s=zn.call(this,y,e,"Changes (JSON)");}if(!Array.isArray(s))throw new Error("Changes must be an array of DocumentChange objects.");let u=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:c,fileName:f}=await Se.call(this,e,u),d=await ft.load(c),m=new Ln(d,n).process_batch(s,o),g=this.getInputData()[e].binary??{};if(o)return [{json:{fileName:f,author:n,dryRun:true,stats:m},binary:g,pairedItem:{item:e}}];let b=await d.save(),v=_r(f,"redlined"),w=await this.helpers.prepareBinaryData(b,v,it),E=typeof this.isToolExecution=="function"&&this.isToolExecution(),_;if(E&&w.id){let y=this.getWorkflowStaticData("global");y.adeu_last_redlined={id:w.id,fileName:v,mimeType:it,timestamp:Date.now()},_=w.id;}let D;return i&&(D=await ht(b,false)),[{json:{fileName:v,author:n,dryRun:false,stats:m,...D!==void 0?{markdown:D}:{},..._!==void 0?{redlinedBinaryId:_}:{}},binary:{...g,[r]:w},pairedItem:{item:e}}]}h(uo,"executeApplyEdits");var lo=[{displayName:"Original Document Source",name:"originalDocumentSource",type:"options",default:"fromInput",description:"Where to read the original (baseline) .docx file from. 'From Connected Input' reads from the current item; 'From Another Node' reads from a named upstream node \u2014 required when this node is called as an AI Agent tool.",options:[{name:"From Connected Input",value:"fromInput"},{name:"From Another Node",value:"fromNode"}],displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Original Source Node Name",name:"originalSourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Download Original",description:"Exact name of the node whose output binary holds the original (baseline) .docx (string, case-sensitive). Must match the node label in the canvas exactly.",displayOptions:{show:{resource:["document"],operation:["generateDiff"],originalDocumentSource:["fromNode"]}}},{displayName:"Original Binary Property",name:"originalBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the original (baseline) .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Modified Document Source",name:"modifiedDocumentSource",type:"options",default:"fromInput",description:"Where to read the modified (compared-to) .docx file from. 'From Connected Input' reads from the current item; 'From Another Node' reads from a named upstream node \u2014 required when this node is called as an AI Agent tool.",options:[{name:"From Connected Input",value:"fromInput"},{name:"From Another Node",value:"fromNode"}],displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Modified Source Node Name",name:"modifiedSourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Apply Edits",description:"Exact name of the node whose output binary holds the modified (compared-to) .docx (string, case-sensitive). Must match the node label in the canvas exactly.",displayOptions:{show:{resource:["document"],operation:["generateDiff"],modifiedDocumentSource:["fromNode"]}}},{displayName:"Modified Binary Property",name:"modifiedBinaryPropertyName",type:"string",default:"data2",required:true,placeholder:"e.g. data2",description:"Name of the binary property holding the modified (compared-to) .docx file (string, e.g. 'data2'). In 'From Connected Input' mode this reads from the current item and must be different from the original property; in 'From Another Node' mode this specifies which property on the source node's output to read.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Clean View",name:"cleanView",type:"boolean",default:true,description:"Whether to compare the Accept All clean view of both documents. When true (default, recommended), diffs reflect the final content as if all tracked changes were accepted. When false, diffs the raw CriticMarkup-projected text including pending change markers \u2014 useful for auditing tracked-change differences themselves.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}}];async function co(e){let t=this.getNodeParameter("originalBinaryPropertyName",e),r=this.getNodeParameter("modifiedBinaryPropertyName",e),n=this.getNodeParameter("cleanView",e),a=this.getNodeParameter("originalDocumentSource",e,"fromInput"),i=this.getNodeParameter("modifiedDocumentSource",e,"fromInput"),o=a==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("originalSourceNodeName",e,""),binaryPropertyName:t}:{mode:"fromInput",binaryPropertyName:t},s=i==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("modifiedSourceNodeName",e,""),binaryPropertyName:r}:{mode:"fromInput",binaryPropertyName:r},{buffer:l,fileName:u}=await Se.call(this,e,o),{buffer:c,fileName:f}=await Se.call(this,e,s),d=await ht(l,n),p=await ht(c,n),m=Wa(d,p,u,f);return [{json:{originalFileName:u,modifiedFileName:f,cleanView:n,diff:m},pairedItem:{item:e}}]}h(co,"executeGenerateDiff");var fo=[{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. The file must be a valid .docx.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the finalized .docx file (string, e.g. 'data'). If equal to the input property name, the original binary is overwritten on the outgoing item.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Sanitize Mode",name:"sanitizeMode",type:"options",default:"full",description:"How aggressively to sanitize the document before distribution. One of: 'baseline' (minimal metadata cleanup only), 'full' (strip metadata AND require all tracked changes resolved or auto-accepted), 'keep-markup' (strip metadata but preserve visible tracked changes and comments, optionally with author rewrite).",options:[{name:"Baseline",value:"baseline",description:"Minimal sanitization: strip RSID attributes, paragraph IDs, and proof errors only. Leaves tracked changes, comments, authors, and other metadata untouched."},{name:"Full",value:"full",description:"Strip metadata (authors, RSIDs, paragraph IDs, proof errors) and require all tracked changes and comments to be resolved. If pending tracked changes exist and 'Accept All Tracked Changes' is false, the operation is blocked and an error is thrown."},{name:"Keep Markup",value:"keep-markup",description:"Strip metadata but preserve all visible tracked changes and comments. Use 'Author Override' to rewrite the author name on every preserved redline and comment (e.g. replace 'AI Reviewer' with your firm name)."}],displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Accept All Tracked Changes",name:"acceptAll",type:"boolean",default:false,description:"Whether to auto-accept all pending tracked changes before sanitization. Only applies when Sanitize Mode is 'full'. When false (default), the operation throws an error if any pending tracked changes exist, forcing the caller to resolve them first. If multiple distinct authors are detected in pending changes, a warning is included in the report to alert you of potential silent smuggles.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"],sanitizeMode:["full"]}}},{displayName:"Author Override",name:"authorOverride",type:"string",default:"",placeholder:"e.g. My Firm",description:"Only applies when Sanitize Mode is 'keep-markup'. Optional string. When set, replaces the author name on every preserved tracked change and comment with this value (e.g. 'My Law Firm'). Leave empty to keep original authors intact.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"],sanitizeMode:["keep-markup"]}}},{displayName:"Protection Mode",name:"protectionMode",type:"options",default:"none",description:"Optionally lock the finalized document. 'none' (default) leaves the document unlocked. 'read_only' injects a native Word read-only enforcement flag into settings.xml \u2014 Word users see a read-only banner and cannot edit without explicitly unlocking. AES encryption is not supported in this engine.",options:[{name:"None",value:"none"},{name:"Read Only",value:"read_only"}],displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}}];async function ho(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("sanitizeMode",e),a=false;n==="full"&&(a=this.getNodeParameter("acceptAll",e));let i=null;if(n==="keep-markup"){let w=this.getNodeParameter("authorOverride",e);i=w.trim()===""?null:w;}let s=this.getNodeParameter("protectionMode",e)==="read_only"?"read_only":null,u=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:c,fileName:f}=await Se.call(this,e,u),d=await ft.load(c),{reportText:p,outBuffer:m}=await ro(d,{filename:f,sanitize_mode:n,accept_all:a,protection_mode:s,author:i});if(!m)throw new Error(p);let g=_r(f,"finalized"),b=await this.helpers.prepareBinaryData(m,g,it),v=this.getInputData()[e].binary??{};return [{json:{fileName:g,sanitizeMode:n,report:p},binary:{...v,[r]:b},pairedItem:{item:e}}]}h(ho,"executeFinalizeDocument");var po=[{displayName:"Operation",name:"operation",type:"options",noDataExpression:true,displayOptions:{show:{resource:["document"]}},options:[{name:"Apply Edits",value:"applyEdits",action:"Apply tracked changes to document",description:"Apply a JSON array of DocumentChange objects (modify, accept, reject, reply, insert_row, delete_row) as native Word tracked changes and comments. modify edits support match_mode ('strict'|'first'|'all') and regex (boolean) for targeted multi-occurrence writes. The whole batch is pre-validated atomically: if any single edit is invalid, the entire batch is rejected and the document is left untouched. Supports a Dry Run mode for previewing edits \u2014 when enabled, the engine returns a per-edit report (status, CriticMarkup preview, errors, warnings) without modifying the document or producing a redlined binary."},{name:"Extract Markdown",value:"extractMarkdown",action:"Extract markdown from document",description:"Project the .docx into LLM-friendly Markdown with CriticMarkup ({++ins++}, {--del--}, {>>comment<<}) plus a Semantic Appendix listing defined terms, cross-references, and potential typos. Each tracked change is tagged with a stable id (Chg:N, Com:N) for use in Apply Edits. Supports an optional Page parameter to fetch only one page of a large document (paired with Extract Outline for navigation)."},{name:"Extract Outline",value:"extractOutline",action:"Extract a structural outline (table of contents) of the document",description:"Return a token-cheap structural map of the .docx: a JSON array of headings with their level (1-6), text, page number, paragraph style, whether the section directly contains a table, and any footnote/endnote IDs scoped to that section. Also returns total_pages. Use this as a navigation primitive for large documents \u2014 call it first to discover structure, then call Extract Markdown with a specific Page to drill into the relevant section."},{name:"Finalize",value:"finalizeDocument",action:"Sanitize metadata and lock the document for distribution",description:"Strip author names, internal IDs, RSIDs, and proof errors; optionally auto-accept all pending tracked changes; optionally lock the document read-only. Use before sending to counterparties or signers."},{name:"Generate Diff",value:"generateDiff",action:"Generate diff between documents",description:"Produce a sub-word level @@ Word Patch @@ diff between two .docx files. Reads the document text via the same Markdown projection used by Extract Markdown, so the diff respects CriticMarkup and Clean View settings."},{name:"Hydrate Tool Output",value:"hydrateToolOutput",action:"Hydrate a redlined binary stashed by Apply Edits as a tool",description:"Read a binary's storage id from workflow static data (where Apply Edits stashes it when run as an AI Agent tool) and re-attach the binary to a main-flow item. Necessary because n8n's AI Agent tool wrapper strips binaries from tool outputs, so the redlined .docx produced by an apply_edits tool call cannot reach downstream nodes directly. Place this node downstream of the AI Agent on the main connection, then route its output into Write Binary File, Gmail (attachment), Slack (file upload), etc."}],default:"extractMarkdown"},{displayName:"Document Source",name:"documentSource",type:"options",default:"fromInput",description:"Where to read the .docx file from. 'From Connected Input' reads the binary on the current input item \u2014 use this in deterministic pipelines (e.g. Gmail Trigger \u2192 Adeu \u2192 Gmail Reply). 'From Another Node' fetches the binary from a named upstream node by name \u2014 use this when the Adeu node is called as an AI Agent tool, since the Agent cannot pass binary data through JSON arguments.",options:[{name:"From Connected Input",value:"fromInput",description:"Read the binary from the current item's binary attachment. Default behavior for deterministic workflows."},{name:"From Another Node",value:"fromNode",description:"Read the binary from a named upstream node. Required when this node is used as an AI Agent tool."}],displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"]}}},{displayName:"Source Node Name",name:"sourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Gmail Trigger",description:"Exact name of the node in this workflow whose output binary holds the .docx file (string, case-sensitive). Must match the node's label in the canvas exactly, including spaces and punctuation. The referenced node must have already executed in this run and produced binary output on the property named in 'Input Binary Property'.",displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"],documentSource:["fromNode"]}}},{displayName:"Source Binary ID",name:"sourceBinaryId",type:"string",default:"",placeholder:"e.g. filesystem-v2:...",description:"Optional. When set (such as by an AI Agent during a multi-turn conversation), the node will load the document directly from this binary storage ID instead of reading from the source node. Leave empty on the first call to default to the baseline source node.",displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"],documentSource:["fromNode"]}}},...no,...ao,...so,...lo,...fo,...Hn];var go=class{static{h(this,"Adeu");}description={displayName:"Adeu",name:"adeu",icon:"file:adeu.svg",group:["transform"],version:1,subtitle:'={{$parameter["operation"]}}',description:"Operate on Microsoft Word (.docx) files: extract LLM-friendly Markdown with CriticMarkup, navigate large documents via a structural outline, apply tracked changes and comments, generate sub-word diffs, and sanitize/finalize documents. Five operations on the Document resource: (1) Extract Markdown \u2014 project a .docx into Markdown plus a Semantic Appendix; toggle Clean View to simulate Accept All; pass an optional Page number to fetch only one page of a large document. (2) Extract Outline \u2014 return a token-cheap structural map (headings with level, page number, paragraph style, has_table, footnote IDs) plus total_pages. Pair with Extract Markdown to navigate large documents. (3) Apply Edits \u2014 apply a JSON array of DocumentChange objects as native Word tracked changes; modify edits support match_mode ('strict'|'first'|'all') and regex (boolean); the entire batch is pre-validated atomically and rejected if any single edit is invalid. Supports a Dry Run flag that previews edits without committing them. (4) Generate Diff \u2014 produce a @@ Word Patch @@ sub-word level diff between two .docx files. (5) Finalize Document \u2014 strip metadata, optionally accept all pending markup, and optionally lock the file read-only. DocumentChange schema (used by Apply Edits): each object has a 'type' field discriminator. type='modify' requires target_text (string, copied EXACTLY from the source including punctuation, spacing, and case) and new_text (string); optional comment (string); optional match_mode ('strict'|'first'|'all', default 'strict'); optional regex (boolean, default false \u2014 when true, target_text is an ES2022 RegExp pattern and new_text may reference $1, $2 capture groups). type='accept' or type='reject' requires target_id (string like 'Chg:12' from the Markdown projection); optional 'comment'. type='reply' requires target_id (string like 'Com:45') and text (string). type='insert_row' requires target_text (string), position ('above' or 'below'), and cells (array of strings). type='delete_row' requires target_text (string). Never wrap new_text in CriticMarkup tags like {++ ++} or {-- --}; the engine applies tracking automatically. Never target text already wrapped in another author's pending tracked change; accept or reject their change first by target_id. Binary handling for AI Agents: this tool cannot receive .docx files through JSON arguments because JSON cannot carry binary data. To process a document, set 'Document Source' to 'From Another Node' and 'Source Node Name' to the exact name of the workflow node that produced the .docx binary (typically the trigger node, e.g. 'Gmail Trigger', 'When clicking Test workflow', or an HTTP Request node configured to download a file). Node names are case-sensitive and must match the canvas label exactly. For the Generate Diff operation, set both 'Original Source Node Name' and 'Modified Source Node Name' independently.",defaults:{name:"Adeu"},usableAsTool:true,inputs:[n8nWorkflow.NodeConnectionTypes.Main],outputs:[n8nWorkflow.NodeConnectionTypes.Main],credentials:[],properties:[{displayName:"Resource",name:"resource",type:"options",noDataExpression:true,options:[{name:"Document",value:"document"}],default:"document"},...po]};async execute(){let t=this.getInputData(),r=[],n=this.getNodeParameter("resource",0),a=this.getNodeParameter("operation",0);for(let i=0;i<t.length;i++)try{let o;if(n==="document")switch(a){case "extractMarkdown":o=await io.call(this,i);break;case "extractOutline":o=await oo.call(this,i);break;case "applyEdits":o=await uo.call(this,i);break;case "generateDiff":o=await co.call(this,i);break;case "finalizeDocument":o=await ho.call(this,i);break;case "hydrateToolOutput":o=await Vn.call(this,i);break;default:throw new Error(`Unsupported operation: ${a}`)}else throw new Error(`Unsupported resource: ${n}`);r.push(...o);}catch(o){if(this.continueOnFail()){r.push({json:{error:o.message},pairedItem:{item:i}});continue}let s=o;throw s.name==="NodeOperationError"||s.name==="NodeApiError"?s:jn.call(this,s,i)}return [r]}};exports.Adeu=go;
|
|
103
|
+
]`,required:true,description:`JSON-encoded string containing an array of DocumentChange objects. Each object has a 'type' field discriminator and type-specific fields. type='modify': requires target_text (string, copied EXACTLY from the source including punctuation, spacing, and case) and new_text (string); optional comment (string). Optional match_mode (one of 'strict' | 'first' | 'all', default 'strict'): 'strict' fails on ambiguous matches; 'first' silently anchors to the first occurrence; 'all' applies the same replacement to every occurrence in linear document order. Optional regex (boolean, default false): when true, target_text is interpreted as an ES2022 RegExp pattern and new_text may reference capture groups via $1, $2, etc. Combine with match_mode='all' for global regex replacements. Never include CriticMarkup tags like {++ ++} or {-- --} in new_text \u2014 the engine applies tracking automatically. Never target text already inside another author's pending tracked change. type='accept': requires target_id (string like 'Chg:12' from the Markdown projection); optional comment. type='reject': requires target_id (string like 'Chg:12'); optional comment. type='reply': requires target_id (string like 'Com:45') and text (string). type='insert_row': requires target_text (string anchoring a table cell), position ('above' or 'below'), and cells (array of strings, one per column). type='delete_row': requires target_text (string anchoring the row to delete). The whole batch is validated atomically: if any single edit fails (target text not found, ambiguous match under match_mode='strict', read-only target, overlapping another author's change), the entire batch is rejected and the document is left untouched. Example: '[{"type":"modify","target_text":"within thirty (30) days","new_text":"within forty-five (45) days","comment":"Per playbook.","match_mode":"all"}]'. Markdown code fences (\`\`\`json ... \`\`\`) wrapping the value are stripped automatically.`,typeOptions:{rows:10},displayOptions:{show:{resource:["document"],operation:["applyEdits"],editsSource:["defineBelow"]}}},{displayName:"Return Markdown Output",name:"returnMarkdown",type:"boolean",default:true,description:"Whether to auto-extract the post-edit document as Markdown (with CriticMarkup) and include it in the outgoing JSON under the 'markdown' field. Useful for feeding the updated state back into a downstream AI Agent for review or further edits. Adds extraction overhead per call. Has no effect when Dry Run is enabled \u2014 dry runs do not produce a post-edit buffer; inspect the per-edit 'critic_markup' / 'clean_text' previews on the returned 'edits' array instead.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Dry Run",name:"dryRun",type:"boolean",default:false,description:"Whether to preview edits without writing them to the document. When true, the engine validates every edit, simulates the application in-memory, and returns a detailed 'edits' report (per-edit status, CriticMarkup context preview, clean text preview, warnings, and errors) \u2014 but the document is NOT modified, no redlined binary is produced, and no static-data stash is written. The incoming binary passes through unchanged on the outgoing item. Use as a self-correction primitive: when an anchor's uniqueness or wording is uncertain, dry-run first, inspect each edit's 'critic_markup' preview, then re-call with Dry Run disabled to commit. Default false (commit edits normally). Important: invalid edits in a dry run do NOT throw a BatchValidationError \u2014 they return as failed entries in the 'edits' array. Wet runs still throw atomically on the first validation failure.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}}];async function uo(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("author",e),a=this.getNodeParameter("editsSource",e),i=this.getNodeParameter("returnMarkdown",e),o=this.getNodeParameter("dryRun",e,false),s;if(a==="fromInputJson"){let y=this.getNodeParameter("editsJsonPath",e),A=this.getInputData()[e].json;if(s=qn(A,y),s===void 0)throw new Error(`No property "${y}" found on the input item JSON. Verify the upstream node produced it, or switch "Edits Source" to "Define Below".`)}else {let y=this.getNodeParameter("editsJson",e);s=zn.call(this,y,e,"Changes (JSON)");}if(!Array.isArray(s))throw new Error("Changes must be an array of DocumentChange objects.");let u=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:c,fileName:f}=await Se.call(this,e,u),d=await ft.load(c),m=new Ln(d,n).process_batch(s,o),g=this.getInputData()[e].binary??{};if(o)return [{json:{fileName:f,author:n,dryRun:true,stats:m},binary:g,pairedItem:{item:e}}];let E=await d.save(),v=_r(f,"redlined"),w=await this.helpers.prepareBinaryData(E,v,it),b=typeof this.isToolExecution=="function"&&this.isToolExecution(),_;if(b&&w.id){let y=this.getWorkflowStaticData("global");y.adeu_last_redlined={id:w.id,fileName:v,mimeType:it,timestamp:Date.now()},_=w.id;}let D;return i&&(D=await ht(E,false)),[{json:{fileName:v,author:n,dryRun:false,stats:m,...D!==void 0?{markdown:D}:{},..._!==void 0?{redlinedBinaryId:_}:{}},binary:{...g,[r]:w},pairedItem:{item:e}}]}h(uo,"executeApplyEdits");var lo=[{displayName:"Original Document Source",name:"originalDocumentSource",type:"options",default:"fromInput",description:"Where to read the original (baseline) .docx file from. 'From Connected Input' reads from the current item; 'From Another Node' reads from a named upstream node \u2014 required when this node is called as an AI Agent tool.",options:[{name:"From Connected Input",value:"fromInput"},{name:"From Another Node",value:"fromNode"}],displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Original Source Node Name",name:"originalSourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Download Original",description:"Exact name of the node whose output binary holds the original (baseline) .docx (string, case-sensitive). Must match the node label in the canvas exactly.",displayOptions:{show:{resource:["document"],operation:["generateDiff"],originalDocumentSource:["fromNode"]}}},{displayName:"Original Binary Property",name:"originalBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the original (baseline) .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Modified Document Source",name:"modifiedDocumentSource",type:"options",default:"fromInput",description:"Where to read the modified (compared-to) .docx file from. 'From Connected Input' reads from the current item; 'From Another Node' reads from a named upstream node \u2014 required when this node is called as an AI Agent tool.",options:[{name:"From Connected Input",value:"fromInput"},{name:"From Another Node",value:"fromNode"}],displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Modified Source Node Name",name:"modifiedSourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Apply Edits",description:"Exact name of the node whose output binary holds the modified (compared-to) .docx (string, case-sensitive). Must match the node label in the canvas exactly.",displayOptions:{show:{resource:["document"],operation:["generateDiff"],modifiedDocumentSource:["fromNode"]}}},{displayName:"Modified Binary Property",name:"modifiedBinaryPropertyName",type:"string",default:"data2",required:true,placeholder:"e.g. data2",description:"Name of the binary property holding the modified (compared-to) .docx file (string, e.g. 'data2'). In 'From Connected Input' mode this reads from the current item and must be different from the original property; in 'From Another Node' mode this specifies which property on the source node's output to read.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Clean View",name:"cleanView",type:"boolean",default:true,description:"Whether to compare the Accept All clean view of both documents. When true (default, recommended), diffs reflect the final content as if all tracked changes were accepted. When false, diffs the raw CriticMarkup-projected text including pending change markers \u2014 useful for auditing tracked-change differences themselves.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}}];async function co(e){let t=this.getNodeParameter("originalBinaryPropertyName",e),r=this.getNodeParameter("modifiedBinaryPropertyName",e),n=this.getNodeParameter("cleanView",e),a=this.getNodeParameter("originalDocumentSource",e,"fromInput"),i=this.getNodeParameter("modifiedDocumentSource",e,"fromInput"),o=a==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("originalSourceNodeName",e,""),binaryPropertyName:t}:{mode:"fromInput",binaryPropertyName:t},s=i==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("modifiedSourceNodeName",e,""),binaryPropertyName:r}:{mode:"fromInput",binaryPropertyName:r},{buffer:l,fileName:u}=await Se.call(this,e,o),{buffer:c,fileName:f}=await Se.call(this,e,s),d=await ht(l,n),p=await ht(c,n),m=Wa(d,p,u,f);return [{json:{originalFileName:u,modifiedFileName:f,cleanView:n,diff:m},pairedItem:{item:e}}]}h(co,"executeGenerateDiff");var fo=[{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. The file must be a valid .docx.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the finalized .docx file (string, e.g. 'data'). If equal to the input property name, the original binary is overwritten on the outgoing item.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Sanitize Mode",name:"sanitizeMode",type:"options",default:"full",description:"How aggressively to sanitize the document before distribution. One of: 'baseline' (minimal metadata cleanup only), 'full' (strip metadata AND require all tracked changes resolved or auto-accepted), 'keep-markup' (strip metadata but preserve visible tracked changes and comments, optionally with author rewrite).",options:[{name:"Baseline",value:"baseline",description:"Minimal sanitization: strip RSID attributes, paragraph IDs, and proof errors only. Leaves tracked changes, comments, authors, and other metadata untouched."},{name:"Full",value:"full",description:"Strip metadata (authors, RSIDs, paragraph IDs, proof errors) and require all tracked changes and comments to be resolved. If pending tracked changes exist and 'Accept All Tracked Changes' is false, the operation is blocked and an error is thrown."},{name:"Keep Markup",value:"keep-markup",description:"Strip metadata but preserve all visible tracked changes and comments. Use 'Author Override' to rewrite the author name on every preserved redline and comment (e.g. replace 'AI Reviewer' with your firm name)."}],displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Accept All Tracked Changes",name:"acceptAll",type:"boolean",default:false,description:"Whether to auto-accept all pending tracked changes before sanitization. Only applies when Sanitize Mode is 'full'. When false (default), the operation throws an error if any pending tracked changes exist, forcing the caller to resolve them first. If multiple distinct authors are detected in pending changes, a warning is included in the report to alert you of potential silent smuggles.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"],sanitizeMode:["full"]}}},{displayName:"Author Override",name:"authorOverride",type:"string",default:"",placeholder:"e.g. My Firm",description:"Only applies when Sanitize Mode is 'keep-markup'. Optional string. When set, replaces the author name on every preserved tracked change and comment with this value (e.g. 'My Law Firm'). Leave empty to keep original authors intact.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"],sanitizeMode:["keep-markup"]}}},{displayName:"Protection Mode",name:"protectionMode",type:"options",default:"none",description:"Optionally lock the finalized document. 'none' (default) leaves the document unlocked. 'read_only' injects a native Word read-only enforcement flag into settings.xml \u2014 Word users see a read-only banner and cannot edit without explicitly unlocking. AES encryption is not supported in this engine.",options:[{name:"None",value:"none"},{name:"Read Only",value:"read_only"}],displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}}];async function ho(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("sanitizeMode",e),a=false;n==="full"&&(a=this.getNodeParameter("acceptAll",e));let i=null;if(n==="keep-markup"){let w=this.getNodeParameter("authorOverride",e);i=w.trim()===""?null:w;}let s=this.getNodeParameter("protectionMode",e)==="read_only"?"read_only":null,u=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:c,fileName:f}=await Se.call(this,e,u),d=await ft.load(c),{reportText:p,outBuffer:m}=await ro(d,{filename:f,sanitize_mode:n,accept_all:a,protection_mode:s,author:i});if(!m)throw new Error(p);let g=_r(f,"finalized"),E=await this.helpers.prepareBinaryData(m,g,it),v=this.getInputData()[e].binary??{};return [{json:{fileName:g,sanitizeMode:n,report:p},binary:{...v,[r]:E},pairedItem:{item:e}}]}h(ho,"executeFinalizeDocument");var po=[{displayName:"Operation",name:"operation",type:"options",noDataExpression:true,displayOptions:{show:{resource:["document"]}},options:[{name:"Apply Edits",value:"applyEdits",action:"Apply tracked changes to document",description:"Apply a JSON array of DocumentChange objects (modify, accept, reject, reply, insert_row, delete_row) as native Word tracked changes and comments. modify edits support match_mode ('strict'|'first'|'all') and regex (boolean) for targeted multi-occurrence writes. The whole batch is pre-validated atomically: if any single edit is invalid, the entire batch is rejected and the document is left untouched. Supports a Dry Run mode for previewing edits \u2014 when enabled, the engine returns a per-edit report (status, CriticMarkup preview, errors, warnings) without modifying the document or producing a redlined binary."},{name:"Extract Markdown",value:"extractMarkdown",action:"Extract markdown from document",description:"Project the .docx into LLM-friendly Markdown with CriticMarkup ({++ins++}, {--del--}, {>>comment<<}) plus a Semantic Appendix listing defined terms, cross-references, and potential typos. Each tracked change is tagged with a stable id (Chg:N, Com:N) for use in Apply Edits. Supports an optional Page parameter to fetch only one page of a large document (paired with Extract Outline for navigation)."},{name:"Extract Outline",value:"extractOutline",action:"Extract a structural outline (table of contents) of the document",description:"Return a token-cheap structural map of the .docx: a JSON array of headings with their level (1-6), text, page number, paragraph style, whether the section directly contains a table, and any footnote/endnote IDs scoped to that section. Also returns total_pages. Use this as a navigation primitive for large documents \u2014 call it first to discover structure, then call Extract Markdown with a specific Page to drill into the relevant section."},{name:"Finalize",value:"finalizeDocument",action:"Sanitize metadata and lock the document for distribution",description:"Strip author names, internal IDs, RSIDs, and proof errors; optionally auto-accept all pending tracked changes; optionally lock the document read-only. Use before sending to counterparties or signers."},{name:"Generate Diff",value:"generateDiff",action:"Generate diff between documents",description:"Produce a sub-word level @@ Word Patch @@ diff between two .docx files. Reads the document text via the same Markdown projection used by Extract Markdown, so the diff respects CriticMarkup and Clean View settings."},{name:"Hydrate Tool Output",value:"hydrateToolOutput",action:"Hydrate a redlined binary stashed by Apply Edits as a tool",description:"Read a binary's storage id from workflow static data (where Apply Edits stashes it when run as an AI Agent tool) and re-attach the binary to a main-flow item. Necessary because n8n's AI Agent tool wrapper strips binaries from tool outputs, so the redlined .docx produced by an apply_edits tool call cannot reach downstream nodes directly. Place this node downstream of the AI Agent on the main connection, then route its output into Write Binary File, Gmail (attachment), Slack (file upload), etc."}],default:"extractMarkdown"},{displayName:"Document Source",name:"documentSource",type:"options",default:"fromInput",description:"Where to read the .docx file from. 'From Connected Input' reads the binary on the current input item \u2014 use this in deterministic pipelines (e.g. Gmail Trigger \u2192 Adeu \u2192 Gmail Reply). 'From Another Node' fetches the binary from a named upstream node by name \u2014 use this when the Adeu node is called as an AI Agent tool, since the Agent cannot pass binary data through JSON arguments.",options:[{name:"From Connected Input",value:"fromInput",description:"Read the binary from the current item's binary attachment. Default behavior for deterministic workflows."},{name:"From Another Node",value:"fromNode",description:"Read the binary from a named upstream node. Required when this node is used as an AI Agent tool."}],displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"]}}},{displayName:"Source Node Name",name:"sourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Gmail Trigger",description:"Exact name of the node in this workflow whose output binary holds the .docx file (string, case-sensitive). Must match the node's label in the canvas exactly, including spaces and punctuation. The referenced node must have already executed in this run and produced binary output on the property named in 'Input Binary Property'.",displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"],documentSource:["fromNode"]}}},{displayName:"Source Binary ID",name:"sourceBinaryId",type:"string",default:"",placeholder:"e.g. filesystem-v2:...",description:"Optional. When set (such as by an AI Agent during a multi-turn conversation), the node will load the document directly from this binary storage ID instead of reading from the source node. Leave empty on the first call to default to the baseline source node.",displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"],documentSource:["fromNode"]}}},...no,...ao,...so,...lo,...fo,...Hn];var go=class{static{h(this,"Adeu");}description={displayName:"Adeu",name:"adeu",icon:"file:adeu.svg",group:["transform"],version:1,subtitle:'={{$parameter["operation"]}}',description:"Operate on Microsoft Word (.docx) files: extract LLM-friendly Markdown with CriticMarkup, navigate large documents via a structural outline, apply tracked changes and comments, generate sub-word diffs, and sanitize/finalize documents. Five operations on the Document resource: (1) Extract Markdown \u2014 project a .docx into Markdown plus a Semantic Appendix; toggle Clean View to simulate Accept All; pass an optional Page number to fetch only one page of a large document. (2) Extract Outline \u2014 return a token-cheap structural map (headings with level, page number, paragraph style, has_table, footnote IDs) plus total_pages. Pair with Extract Markdown to navigate large documents. (3) Apply Edits \u2014 apply a JSON array of DocumentChange objects as native Word tracked changes; modify edits support match_mode ('strict'|'first'|'all') and regex (boolean); the entire batch is pre-validated atomically and rejected if any single edit is invalid. Supports a Dry Run flag that previews edits without committing them. (4) Generate Diff \u2014 produce a @@ Word Patch @@ sub-word level diff between two .docx files. (5) Finalize Document \u2014 strip metadata, optionally accept all pending markup, and optionally lock the file read-only. DocumentChange schema (used by Apply Edits): each object has a 'type' field discriminator. type='modify' requires target_text (string, copied EXACTLY from the source including punctuation, spacing, and case) and new_text (string); optional comment (string); optional match_mode ('strict'|'first'|'all', default 'strict'); optional regex (boolean, default false \u2014 when true, target_text is an ES2022 RegExp pattern and new_text may reference $1, $2 capture groups). type='accept' or type='reject' requires target_id (string like 'Chg:12' from the Markdown projection); optional 'comment'. type='reply' requires target_id (string like 'Com:45') and text (string). type='insert_row' requires target_text (string), position ('above' or 'below'), and cells (array of strings). type='delete_row' requires target_text (string). Never wrap new_text in CriticMarkup tags like {++ ++} or {-- --}; the engine applies tracking automatically. Never target text already wrapped in another author's pending tracked change; accept or reject their change first by target_id. Binary handling for AI Agents: this tool cannot receive .docx files through JSON arguments because JSON cannot carry binary data. To process a document, set 'Document Source' to 'From Another Node' and 'Source Node Name' to the exact name of the workflow node that produced the .docx binary (typically the trigger node, e.g. 'Gmail Trigger', 'When clicking Test workflow', or an HTTP Request node configured to download a file). Node names are case-sensitive and must match the canvas label exactly. For the Generate Diff operation, set both 'Original Source Node Name' and 'Modified Source Node Name' independently.",defaults:{name:"Adeu"},usableAsTool:true,inputs:[n8nWorkflow.NodeConnectionTypes.Main],outputs:[n8nWorkflow.NodeConnectionTypes.Main],credentials:[],properties:[{displayName:"Resource",name:"resource",type:"options",noDataExpression:true,options:[{name:"Document",value:"document"}],default:"document"},...po]};async execute(){let t=this.getInputData(),r=[],n=this.getNodeParameter("resource",0),a=this.getNodeParameter("operation",0);for(let i=0;i<t.length;i++)try{let o;if(n==="document")switch(a){case "extractMarkdown":o=await io.call(this,i);break;case "extractOutline":o=await oo.call(this,i);break;case "applyEdits":o=await uo.call(this,i);break;case "generateDiff":o=await co.call(this,i);break;case "finalizeDocument":o=await ho.call(this,i);break;case "hydrateToolOutput":o=await Vn.call(this,i);break;default:throw new Error(`Unsupported operation: ${a}`)}else throw new Error(`Unsupported resource: ${n}`);r.push(...o);}catch(o){if(this.continueOnFail()){r.push({json:{error:o.message},pairedItem:{item:i}});continue}let s=o;throw s.name==="NodeOperationError"||s.name==="NodeApiError"?s:jn.call(this,s,i)}return [r]}};exports.Adeu=go;
|