n8n-nodes-adeu 1.13.0 → 1.15.0
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,77 +1,89 @@
|
|
|
1
|
-
'use strict';var n8nWorkflow=require('n8n-workflow');var Ho=Object.create;var $r=Object.defineProperty;var Vo=Object.getOwnPropertyDescriptor;var Go=Object.getOwnPropertyNames;var Xo=Object.getPrototypeOf,Yo=Object.prototype.hasOwnProperty;var h=(e,t)=>$r(e,"name",{value:t,configurable:true});var Ie=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Qo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Go(t))!Yo.call(e,o)&&o!==r&&$r(e,o,{get:()=>t[o],enumerable:!(n=Vo(t,o))||n.enumerable});return e};var Ur=(e,t,r)=>(r=e!=null?Ho(Xo(e)):{},Qo($r(r,"default",{value:e,enumerable:true}),e));var Ln=Ie((Fl,Fn)=>{Fn.exports={createRequire:h(function(){return function(){return {}}},"createRequire")};});var rt=Ie(le=>{function Da(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(tt(e,n)){var o=e[n];if(t.call(void 0,o,n,e))return o}}h(Da,"find");function ht(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(ht,"freeze");function tt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}h(tt,"hasOwn");function ba(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var r in t)tt(t,r)&&(e[r]=t[r]);return e}h(ba,"assign");var ei=ht({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 Aa(e){return tt(ei,e.toLowerCase())}h(Aa,"isHTMLBooleanAttribute");var ti=ht({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 Na(e){return tt(ti,e.toLowerCase())}h(Na,"isHTMLVoidElement");var $t=ht({script:false,style:false,textarea:true,title:true});function Ca(e){var t=e.toLowerCase();return tt($t,t)&&!$t[t]}h(Ca,"isHTMLRawTextElement");function Ta(e){var t=e.toLowerCase();return tt($t,t)&&$t[t]}h(Ta,"isHTMLEscapableRawTextElement");function ri(e){return e===Ut.HTML}h(ri,"isHTMLMimeType");function xa(e){return ri(e)||e===Ut.XML_XHTML_APPLICATION}h(xa,"hasDefaultHTMLNamespace");var Ut=ht({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Sa=Object.keys(Ut).map(function(e){return Ut[e]});function Ia(e){return Sa.indexOf(e)>-1}h(Ia,"isValidMimeType");var ka=ht({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/"});le.assign=ba;le.find=Da;le.freeze=ht;le.HTML_BOOLEAN_ATTRIBUTES=ei;le.HTML_RAW_TEXT_ELEMENTS=$t;le.HTML_VOID_ELEMENTS=ti;le.hasDefaultHTMLNamespace=xa;le.hasOwn=tt;le.isHTMLBooleanAttribute=Aa;le.isHTMLRawTextElement=Ca;le.isHTMLEscapableRawTextElement=Ta;le.isHTMLMimeType=ri;le.isHTMLVoidElement=Na;le.isValidMimeType=Ia;le.MIME_TYPE=Ut;le.NAMESPACE=ka;});var Ht=Ie(Wt=>{var Pa=rt();function ii(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:true,writable:t}});}h(ii,"extendError");var zt=Pa.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"}),oi=Object.keys(zt);function ai(e){return typeof e=="number"&&e>=1&&e<=25}h(ai,"isValidDomExceptionCode");function Oa(e){return typeof e=="string"&&e.substring(e.length-zt.Error.length)===zt.Error}h(Oa,"endsWithError");function jt(e,t){ai(e)?(this.name=oi[e],this.message=t||""):(this.message=e,this.name=Oa(t)?t:zt.Error),Error.captureStackTrace&&Error.captureStackTrace(this,jt);}h(jt,"DOMException");ii(jt,true);Object.defineProperties(jt.prototype,{code:{enumerable:true,get:h(function(){var e=oi.indexOf(this.name);return ai(e)?e:0},"get")}});var si={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},en=Object.entries(si);for(qt=0;qt<en.length;qt++)ni=en[qt][0],jt[ni]=en[qt][1];var ni,qt;function tn(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,tn);}h(tn,"ParseError");ii(tn);Wt.DOMException=jt;Wt.DOMExceptionName=zt;Wt.ExceptionCode=si;Wt.ParseError=tn;});var ln=Ie(L=>{function pi(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(pi,"detectUnicodeSupport");var mt=pi();function We(e){if(e.source[0]!=="[")throw new Error(e+" can not be used with chars");return e.source.slice(1,e.source.lastIndexOf("]"))}h(We,"chars");function dt(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,""),mt?"u":"")}h(dt,"chars_without");function W(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(""),mt?"mu":"m")}h(W,"reg");function F(e){if(arguments.length===0)throw new Error("no parameters provided");return W.apply(F,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}h(F,"regg");var Ma="\uFFFD",He=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;mt&&(He=W("[",We(He),"\\u{10000}-\\u{10FFFF}","]"));var Ra=new RegExp("[^"+We(He)+"]",mt?"u":""),nn=/[\x20\x09\x0D\x0A]/,Ba=We(nn),Y=W(nn,"+"),ee=W(nn,"*"),Vt=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;mt&&(Vt=W("[",We(Vt),"\\u{10000}-\\u{10FFFF}","]"));var Fa=We(Vt),on=W("[",Fa,We(/[-.0-9\xB7]/),We(/[\u0300-\u036F\u203F-\u2040]/),"]"),be=W(Vt,on,"*"),ui=W(on,"+"),La=W("&",be,";"),$a=F(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Gt=F(La,"|",$a),Xt=W("%",be,";"),an=F(W('"',F(/[^%&"]/,"|",Xt,"|",Gt),"*",'"'),"|",W("'",F(/[^%&']/,"|",Xt,"|",Gt),"*","'")),Ua=F('"',F(/[^<&"]/,"|",Gt),"*",'"',"|","'",F(/[^<&']/,"|",Gt),"*","'"),qa=dt(Vt,":"),za=dt(on,":"),li=W(qa,za,"*"),Yt=W(li,F(":",li),"?"),ja=W("^",Yt,"$"),Wa=W("(",Yt,")"),pt=F(/"[^"]*"|'[^']*'/),Ha=W(/^<\?/,"(",be,")",F(Y,"(",He,"*?)"),"?",/\?>/),ci=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Qt=F('"',ci,'*"',"|","'",dt(ci,"'"),"*'"),mi="<!--",gi="-->",Va=W(mi,F(dt(He,"-"),"|",W("-",dt(He,"-"))),"*",gi),fi="#PCDATA",Ga=F(W(/\(/,ee,fi,F(ee,/\|/,ee,Yt),"*",ee,/\)\*/),"|",W(/\(/,ee,fi,ee,/\)/)),Xa=/[?*+]?/,Ya=W(/\([^>]+\)/,Xa),Qa=F("EMPTY","|","ANY","|",Ga,"|",Ya),Ja="<!ELEMENT",Za=W(Ja,Y,F(Yt,"|",Xt),Y,F(Qa,"|",Xt),ee,">"),Ka=W("NOTATION",Y,/\(/,ee,be,F(ee,/\|/,ee,be),"*",ee,/\)/),es=W(/\(/,ee,ui,F(ee,/\|/,ee,ui),"*",ee,/\)/),ts=F(Ka,"|",es),rs=F(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",ts),ns=F(/#REQUIRED|#IMPLIED/,"|",F(F("#FIXED",Y),"?",Ua)),is=F(Y,be,Y,rs,Y,ns),os="<!ATTLIST",as=W(os,Y,be,is,"*",ee,">"),rn="about:legacy-compat",ss=F('"'+rn+'"',"|","'"+rn+"'"),sn="SYSTEM",dr="PUBLIC",pr=F(F(sn,Y,pt),"|",F(dr,Y,Qt,Y,pt)),us=W("^",F(F(sn,Y,"(?<SystemLiteralOnly>",pt,")"),"|",F(dr,Y,"(?<PubidLiteral>",Qt,")",Y,"(?<SystemLiteral>",pt,")"))),ls=W("^",Qt,"$"),cs=W("^",pt,"$"),fs=F(Y,"NDATA",Y,be),hs=F(an,"|",F(pr,fs,"?")),_i="<!ENTITY",ds=W(_i,Y,be,Y,hs,ee,">"),ps=F(an,"|",pr),ms=W(_i,Y,"%",Y,be,Y,ps,ee,">"),gs=F(ds,"|",ms),_s=W(dr,Y,Qt),ws=W("<!NOTATION",Y,be,Y,F(pr,"|",_s),ee,">"),un=W(ee,"=",ee),hi=/1[.]\d+/,vs=W(Y,"version",un,F("'",hi,"'","|",'"',hi,'"')),di=/[A-Za-z][-A-Za-z0-9._]*/,ys=F(Y,"encoding",un,F('"',di,'"',"|","'",di,"'")),Es=F(Y,"standalone",un,F("'",F("yes","|","no"),"'","|",'"',F("yes","|","no"),'"')),Ds=W(/^<\?xml/,vs,ys,"?",Es,"?",ee,/\?>/),bs="<!DOCTYPE",As="<![CDATA[",Ns="]]>",Cs=/<!\[CDATA\[/,Ts=/\]\]>/,xs=W(He,"*?",Ts),Ss=W(Cs,xs);L.chars=We;L.chars_without=dt;L.detectUnicodeSupport=pi;L.reg=W;L.regg=F;L.ABOUT_LEGACY_COMPAT=rn;L.ABOUT_LEGACY_COMPAT_SystemLiteral=ss;L.AttlistDecl=as;L.CDATA_START=As;L.CDATA_END=Ns;L.CDSect=Ss;L.Char=He;L.Comment=Va;L.COMMENT_START=mi;L.COMMENT_END=gi;L.DOCTYPE_DECL_START=bs;L.elementdecl=Za;L.EntityDecl=gs;L.EntityValue=an;L.ExternalID=pr;L.ExternalID_match=us;L.Name=be;L.NotationDecl=ws;L.Reference=Gt;L.PEReference=Xt;L.PI=Ha;L.PUBLIC=dr;L.PubidLiteral=Qt;L.PubidLiteral_match=ls;L.QName=Yt;L.QName_exact=ja;L.QName_group=Wa;L.S=Y;L.SChar_s=Ba;L.S_OPT=ee;L.SYSTEM=sn;L.SystemLiteral=pt;L.SystemLiteral_match=cs;L.InvalidChar=Ra;L.UNICODE_REPLACEMENT_CHARACTER=Ma;L.UNICODE_SUPPORT=mt;L.XMLDecl=Ds;});var _n=Ie(ie=>{var Ce=rt(),Me=Ce.find,Is=Ce.hasDefaultHTMLNamespace,_t=Ce.hasOwn,ks=Ce.isHTMLMimeType,Ps=Ce.isHTMLRawTextElement,Os=Ce.isHTMLVoidElement,Jt=Ce.MIME_TYPE,Re=Ce.NAMESPACE,de=Symbol(),Ai=Ht(),k=Ai.DOMException,Ae=Ai.DOMExceptionName,ce=ln();function me(e){if(e!==de)throw new TypeError("Illegal constructor")}h(me,"checkSymbol");function Ms(e){return e!==""}h(Ms,"notEmptyString");function Rs(e){return e?e.split(/[\t\n\f\r ]+/).filter(Ms):[]}h(Rs,"splitOnASCIIWhitespace");function Bs(e,t){return _t(e,t)||(e[t]=true),e}h(Bs,"orderedSetReducer");function wi(e){if(!e)return [];var t=Rs(e);return Object.keys(t.reduce(Bs,{}))}h(wi,"toOrderedSet");function Fs(e){return function(t){return e&&e.indexOf(t)!==-1}}h(Fs,"arrayIncludes");function Ni(e){if(!ce.QName_exact.test(e))throw new k(k.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}h(Ni,"validateQualifiedName");function fn(e,t){Ni(t),e=e||null;var r=null,n=t;if(t.indexOf(":")>=0){var o=t.split(":");r=o[0],n=o[1];}if(r!==null&&e===null)throw new k(k.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(r==="xml"&&e!==Ce.NAMESPACE.XML)throw new k(k.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((r==="xmlns"||t==="xmlns")&&e!==Ce.NAMESPACE.XMLNS)throw new k(k.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(e===Ce.NAMESPACE.XMLNS&&r!=="xmlns"&&t!=="xmlns")throw new k(k.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return [e,r,n]}h(fn,"validateAndExtract");function yt(e,t){for(var r in e)_t(e,r)&&(t[r]=e[r]);}h(yt,"copy");function ge(e,t){var r=e.prototype;if(!(r instanceof t)){let n=function(){};h(n,"t"),n.prototype=t.prototype,n=new n,yt(r,n),e.prototype=r=n;}r.constructor!=e&&(r.constructor=e);}h(ge,"_extends");var _e={},Ne=_e.ELEMENT_NODE=1,wt=_e.ATTRIBUTE_NODE=2,_r=_e.TEXT_NODE=3,Ci=_e.CDATA_SECTION_NODE=4,Ti=_e.ENTITY_REFERENCE_NODE=5,Ls=_e.ENTITY_NODE=6,hn=_e.PROCESSING_INSTRUCTION_NODE=7,dn=_e.COMMENT_NODE=8,gt=_e.DOCUMENT_NODE=9,xi=_e.DOCUMENT_TYPE_NODE=10,Ve=_e.DOCUMENT_FRAGMENT_NODE=11,$s=_e.NOTATION_NODE=12,ne=Ce.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 Si(e,t){if(t.length<e.length)return Si(t,e);var r=null;for(var n in e){if(e[n]!==t[n])return r;r=e[n];}return r}h(Si,"commonAncestor");function vi(e){return e.guid||(e.guid=Math.random()),e.guid}h(vi,"docGUID");function ae(){}h(ae,"NodeList");ae.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++)gn(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")};ae.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 Oe(e,t){this._node=e,this._refresh=t,vr(this);}h(Oe,"LiveNodeList");function vr(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(qi(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)_t(e,n)&&delete e[n];yt(r,e),e._inc=t;}}h(vr,"_updateLiveList");Oe.prototype.item=function(e){return vr(this),this[e]||null};ge(Oe,ae);function vt(){}h(vt,"NamedNodeMap");function Ii(e,t){for(var r=0;r<e.length;){if(e[r]===t)return r;r++;}}h(Ii,"_findNodeIndex");function Us(e,t,r,n){if(n?t[Ii(t,n)]=r:(t[t.length]=r,t.length++),e){r.ownerElement=e;var o=e.ownerDocument;o&&(n&&Oi(o,e,n),qs(o,e,r));}}h(Us,"_addNamedNode");function yi(e,t,r){var n=Ii(t,r);if(n>=0){for(var o=t.length-1;n<=o;)t[n]=t[++n];if(t.length=o,e){var i=e.ownerDocument;i&&Oi(i,e,r),r.ownerElement=null;}}}h(yi,"_removeNamedNode");vt.prototype={length:0,item:ae.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 k(k.INUSE_ATTRIBUTE_ERR);var r=this.getNamedItemNS(e.namespaceURI,e.localName);return r===e?e:(Us(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 k(k.NOT_FOUND_ERR,e);return yi(this._ownerElement,this,t),t},"removeNamedItem"),removeNamedItemNS:h(function(e,t){var r=this.getNamedItemNS(e,t);if(!r)throw new k(k.NOT_FOUND_ERR,e?e+" : "+t:t);return yi(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")};vt.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 ki(){}h(ki,"DOMImplementation");ki.prototype={hasFeature:h(function(e,t){return true},"hasFeature"),createDocument:h(function(e,t,r){var n=Jt.XML_APPLICATION;e===Re.HTML?n=Jt.XML_XHTML_APPLICATION:e===Re.SVG&&(n=Jt.XML_SVG_IMAGE);var o=new qe(de,{contentType:n});if(o.implementation=this,o.childNodes=new ae,o.doctype=r||null,r&&o.appendChild(r),t){var i=o.createElementNS(e,t);o.appendChild(i);}return o},"createDocument"),createDocumentType:h(function(e,t,r,n){Ni(e);var o=new Dr(de);return o.name=e,o.nodeName=e,o.publicId=t||"",o.systemId=r||"",o.internalSubset=n||"",o.childNodes=new ae,o},"createDocumentType"),createHTMLDocument:h(function(e){var t=new qe(de,{contentType:Jt.HTML});if(t.implementation=this,t.childNodes=new ae,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 o=t.createElement("title");o.appendChild(t.createTextNode(e)),n.appendChild(o);}r.appendChild(t.createElement("body"));}return t},"createHTMLDocument")};function H(e){me(e);}h(H,"Node");H.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,o=r.other;if(n.nodeType!==o.nodeType)return false;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==o.name||n.publicId!==o.publicId||n.systemId!==o.systemId)return false;break;case n.ELEMENT_NODE:if(n.namespaceURI!==o.namespaceURI||n.prefix!==o.prefix||n.localName!==o.localName||n.attributes.length!==o.attributes.length)return false;for(var i=0;i<n.attributes.length;i++){var a=n.attributes.item(i),u=o.getAttributeNodeNS(a.namespaceURI,a.localName);if(!u)return false;t.push({node:a,other:u});}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==o.namespaceURI||n.localName!==o.localName||n.value!==o.value)return false;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==o.target||n.data!==o.data)return false;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==o.data)return false;break}if(n.childNodes.length!==o.childNodes.length)return false;for(var i=n.childNodes.length-1;i>=0;i--)t.push({node:n.childNodes[i],other:o.childNodes[i]});}return true},"isEqualNode"),isSameNode:h(function(e){return this===e},"isSameNode"),insertBefore:h(function(e,t){return wr(this,e,t)},"insertBefore"),replaceChild:h(function(e,t){wr(this,e,t,Fi),t&&this.removeChild(t);},"replaceChild"),removeChild:h(function(e){return Ri(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 Ui(this.ownerDocument||this,this,e)},"cloneNode"),normalize:h(function(){fe(this,null,{enter:h(function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===_r&&t.nodeType===_r?(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(_t(r,n)&&r[n]===e)return n}t=t.nodeType==wt?t.ownerDocument:t.parentNode;}return null},"lookupPrefix"),lookupNamespaceURI:h(function(e){for(var t=this;t;){var r=t._nsMap;if(r&&_t(r,e))return r[e];t=t.nodeType==wt?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,o=null;if(t instanceof nt&&(n=t,t=n.ownerElement),r instanceof nt&&(o=r,r=o.ownerElement,n&&t&&r===t))for(var i=0,a;a=r.attributes[i];i++){if(a===n)return ne.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ne.DOCUMENT_POSITION_PRECEDING;if(a===o)return ne.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ne.DOCUMENT_POSITION_FOLLOWING}if(!t||!r||r.ownerDocument!==t.ownerDocument)return ne.DOCUMENT_POSITION_DISCONNECTED+ne.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(vi(r.ownerDocument)>vi(t.ownerDocument)?ne.DOCUMENT_POSITION_FOLLOWING:ne.DOCUMENT_POSITION_PRECEDING);if(o&&t===r)return ne.DOCUMENT_POSITION_CONTAINS+ne.DOCUMENT_POSITION_PRECEDING;if(n&&t===r)return ne.DOCUMENT_POSITION_CONTAINED_BY+ne.DOCUMENT_POSITION_FOLLOWING;for(var u=[],l=t.parentNode;l;){if(!o&&l===r)return ne.DOCUMENT_POSITION_CONTAINED_BY+ne.DOCUMENT_POSITION_FOLLOWING;u.push(l),l=l.parentNode;}u.reverse();for(var s=[],f=r.parentNode;f;){if(!n&&f===t)return ne.DOCUMENT_POSITION_CONTAINS+ne.DOCUMENT_POSITION_PRECEDING;s.push(f),f=f.parentNode;}s.reverse();var c=Si(u,s);for(var d in c.childNodes){var p=c.childNodes[d];if(p===r)return ne.DOCUMENT_POSITION_FOLLOWING;if(p===t)return ne.DOCUMENT_POSITION_PRECEDING;if(s.indexOf(p)>=0)return ne.DOCUMENT_POSITION_FOLLOWING;if(u.indexOf(p)>=0)return ne.DOCUMENT_POSITION_PRECEDING}return 0},"compareDocumentPosition")};function Pi(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}h(Pi,"_xmlEncoder");yt(_e,H);yt(_e,H.prototype);yt(ne,H);yt(ne,H.prototype);function gr(e,t){fe(e,null,{enter:h(function(r){return t(r)?fe.STOP:true},"enter")});}h(gr,"_visitNode");function fe(e,t,r){for(var n=[{node:e,context:t,phase:fe.ENTER}];n.length>0;){var o=n.pop();if(o.phase===fe.ENTER){var i=r.enter(o.node,o.context);if(i===fe.STOP)return fe.STOP;if(n.push({node:o.node,context:i,phase:fe.EXIT}),i==null)continue;for(var a=o.node.lastChild;a;)n.push({node:a,context:i,phase:fe.ENTER}),a=a.previousSibling;}else r.exit&&r.exit(o.node,o.context);}}h(fe,"walkDOM");fe.STOP=Symbol("walkDOM.STOP");fe.ENTER=0;fe.EXIT=1;function qe(e,t){me(e);var r=t||{};this.ownerDocument=this,this.contentType=r.contentType||Jt.XML_APPLICATION,this.type=ks(this.contentType)?"html":"xml";}h(qe,"Document");function qs(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Re.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value);}h(qs,"_onAddAttribute");function Oi(e,t,r,n){e&&e._inc++;var o=r.namespaceURI;o===Re.XMLNS&&delete t._nsMap[r.prefix?r.localName:""];}h(Oi,"_onRemoveAttribute");function Mi(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r&&!r.nextSibling)n[n.length++]=r;else {for(var o=t.firstChild,i=0;o;)n[i++]=o,o=o.nextSibling;n.length=i,delete n[n.length];}}}h(Mi,"_onUpdateChild");function Ri(e,t){if(e!==t.parentNode)throw new k(k.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,Mi(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}h(Ri,"_removeChild");function zs(e){return e&&(e.nodeType===H.DOCUMENT_NODE||e.nodeType===H.DOCUMENT_FRAGMENT_NODE||e.nodeType===H.ELEMENT_NODE)}h(zs,"hasValidParentNodeType");function js(e){return e&&(e.nodeType===H.CDATA_SECTION_NODE||e.nodeType===H.COMMENT_NODE||e.nodeType===H.DOCUMENT_FRAGMENT_NODE||e.nodeType===H.DOCUMENT_TYPE_NODE||e.nodeType===H.ELEMENT_NODE||e.nodeType===H.PROCESSING_INSTRUCTION_NODE||e.nodeType===H.TEXT_NODE)}h(js,"hasInsertableNodeType");function Ge(e){return e&&e.nodeType===H.DOCUMENT_TYPE_NODE}h(Ge,"isDocTypeNode");function Ue(e){return e&&e.nodeType===H.ELEMENT_NODE}h(Ue,"isElementNode");function Bi(e){return e&&e.nodeType===H.TEXT_NODE}h(Bi,"isTextNode");function Ei(e,t){var r=e.childNodes||[];if(Me(r,Ue)||Ge(t))return false;var n=Me(r,Ge);return !(t&&n&&r.indexOf(n)>r.indexOf(t))}h(Ei,"isElementInsertionPossible");function Di(e,t){var r=e.childNodes||[];function n(i){return Ue(i)&&i!==t}if(h(n,"hasElementChildThatIsNotChild"),Me(r,n))return false;var o=Me(r,Ge);return !(t&&o&&r.indexOf(o)>r.indexOf(t))}h(Di,"isElementReplacementPossible");function Ws(e,t,r){if(!zs(e))throw new k(k.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new k(k.NOT_FOUND_ERR,"child not in parent");if(!js(t)||Ge(t)&&e.nodeType!==H.DOCUMENT_NODE)throw new k(k.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}h(Ws,"assertPreInsertionValidity1to5");function Hs(e,t,r){var n=e.childNodes||[],o=t.childNodes||[];if(t.nodeType===H.DOCUMENT_FRAGMENT_NODE){var i=o.filter(Ue);if(i.length>1||Me(o,Bi))throw new k(k.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!Ei(e,r))throw new k(k.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Ue(t)&&!Ei(e,r))throw new k(k.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Ge(t)){if(Me(n,Ge))throw new k(k.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=Me(n,Ue);if(r&&n.indexOf(a)<n.indexOf(r))throw new k(k.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!r&&a)throw new k(k.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}h(Hs,"assertPreInsertionValidityInDocument");function Fi(e,t,r){var n=e.childNodes||[],o=t.childNodes||[];if(t.nodeType===H.DOCUMENT_FRAGMENT_NODE){var i=o.filter(Ue);if(i.length>1||Me(o,Bi))throw new k(k.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!Di(e,r))throw new k(k.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Ue(t)&&!Di(e,r))throw new k(k.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Ge(t)){let u=function(l){return Ge(l)&&l!==r};if(h(u,"hasDoctypeChildThatIsNotChild"),Me(n,u))throw new k(k.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=Me(n,Ue);if(r&&n.indexOf(a)<n.indexOf(r))throw new k(k.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}h(Fi,"assertPreReplacementValidityInDocument");function wr(e,t,r,n){Ws(e,t,r),e.nodeType===H.DOCUMENT_NODE&&(n||Hs)(e,t,r);var o=t.parentNode;if(o&&o.removeChild(t),t.nodeType===Ve){var i=t.firstChild;if(i==null)return t;var a=t.lastChild;}else i=a=t;var u=r?r.previousSibling:e.lastChild;i.previousSibling=u,a.nextSibling=r,u?u.nextSibling=i:e.firstChild=i,r==null?e.lastChild=a:r.previousSibling=a;do i.parentNode=e;while(i!==a&&(i=i.nextSibling));return Mi(e.ownerDocument||e,e,t),t.nodeType==Ve&&(t.firstChild=t.lastChild=null),t}h(wr,"_insertBefore");qe.prototype={implementation:null,nodeName:"#document",nodeType:gt,doctype:null,documentElement:null,_inc:1,insertBefore:h(function(e,t){if(e.nodeType===Ve){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n;}return e}return wr(this,e,t),e.ownerDocument=this,this.documentElement===null&&e.nodeType===Ne&&(this.documentElement=e),e},"insertBefore"),removeChild:h(function(e){var t=Ri(this,e);return t===this.documentElement&&(this.documentElement=null),t},"removeChild"),replaceChild:h(function(e,t){wr(this,e,t,Fi),e.ownerDocument=this,t&&this.removeChild(t),Ue(e)&&(this.documentElement=e);},"replaceChild"),importNode:h(function(e,t){return Vs(this,e,t)},"importNode"),getElementById:h(function(e){var t=null;return gr(this.documentElement,function(r){if(r.nodeType==Ne&&r.getAttribute("id")==e)return t=r,true}),t},"getElementById"),createElement:h(function(e){var t=new ze(de);t.ownerDocument=this,this.type==="html"&&(e=e.toLowerCase()),Is(this.contentType)&&(t.namespaceURI=Re.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new ae;var r=t.attributes=new vt;return r._ownerElement=t,t},"createElement"),createDocumentFragment:h(function(){var e=new Dt(de);return e.ownerDocument=this,e.childNodes=new ae,e},"createDocumentFragment"),createTextNode:h(function(e){var t=new Zt(de);return t.ownerDocument=this,t.childNodes=new ae,t.appendData(e),t},"createTextNode"),createComment:h(function(e){var t=new yr(de);return t.ownerDocument=this,t.childNodes=new ae,t.appendData(e),t},"createComment"),createCDATASection:h(function(e){if(e.indexOf("]]>")!==-1)throw new k(k.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new Er(de);return t.ownerDocument=this,t.childNodes=new ae,t.appendData(e),t},"createCDATASection"),createProcessingInstruction:h(function(e,t){var r=new Ar(de);return r.ownerDocument=this,r.childNodes=new ae,r.nodeName=r.target=e,r.nodeValue=r.data=t,r},"createProcessingInstruction"),createAttribute:h(function(e){if(!ce.QName_exact.test(e))throw new k(k.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 nt(de);return t.ownerDocument=this,t.childNodes=new ae,t.name=e,t.nodeName=e,t.localName=e,t.specified=true,t},"_createAttribute"),createEntityReference:h(function(e){if(!ce.Name.test(e))throw new k(k.INVALID_CHARACTER_ERR,'not a valid xml name "'+e+'"');if(this.type==="html")throw new k("document is an html document",Ae.NotSupportedError);var t=new br(de);return t.ownerDocument=this,t.childNodes=new ae,t.nodeName=e,t},"createEntityReference"),createElementNS:h(function(e,t){var r=fn(e,t),n=new ze(de),o=n.attributes=new vt;return n.childNodes=new ae,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=r[0],n.prefix=r[1],n.localName=r[2],o._ownerElement=n,n},"createElementNS"),createAttributeNS:h(function(e,t){var r=fn(e,t),n=new nt(de);return n.ownerDocument=this,n.childNodes=new ae,n.nodeName=t,n.name=t,n.specified=true,n.namespaceURI=r[0],n.prefix=r[1],n.localName=r[2],n},"createAttributeNS")};ge(qe,H);function ze(e){me(e),this._nsMap=Object.create(null);}h(ze,"Element");ze.prototype={nodeType:Ne,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===Re.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=fn(e,t),o=n[2],i=this.getAttributeNodeNS(e,o);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=wi(e);return new Oe(this,function(r){var n=[];return t.length>0&&gr(r,function(o){if(o!==r&&o.nodeType===Ne){var i=o.getAttribute("class");if(i){var a=e===i;if(!a){var u=wi(i);a=t.every(Fs(u));}a&&n.push(o);}}}),n})},"getElementsByClassName"),getElementsByTagName:h(function(e){var t=(this.nodeType===gt?this:this.ownerDocument).type==="html",r=e.toLowerCase();return new Oe(this,function(n){var o=[];return gr(n,function(i){if(!(i===n||i.nodeType!==Ne))if(e==="*")o.push(i);else {var a=i.getQualifiedName(),u=t&&i.namespaceURI===Re.HTML?r:e;a===u&&o.push(i);}}),o})},"getElementsByTagName"),getElementsByTagNameNS:h(function(e,t){return new Oe(this,function(r){var n=[];return gr(r,function(o){o!==r&&o.nodeType===Ne&&(e==="*"||o.namespaceURI===e)&&(t==="*"||o.localName==t)&&n.push(o);}),n})},"getElementsByTagNameNS")};qe.prototype.getElementsByClassName=ze.prototype.getElementsByClassName;qe.prototype.getElementsByTagName=ze.prototype.getElementsByTagName;qe.prototype.getElementsByTagNameNS=ze.prototype.getElementsByTagNameNS;ge(ze,H);function nt(e){me(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null;}h(nt,"Attr");nt.prototype.nodeType=wt;ge(nt,H);function Et(e){me(e);}h(Et,"CharacterData");Et.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),o=this.data.substring(e+t);r=n+r+o,this.nodeValue=this.data=r,this.length=r.length;},"replaceData")};ge(Et,H);function Zt(e){me(e);}h(Zt,"Text");Zt.prototype={nodeName:"#text",nodeType:_r,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")};ge(Zt,Et);function yr(e){me(e);}h(yr,"Comment");yr.prototype={nodeName:"#comment",nodeType:dn};ge(yr,Et);function Er(e){me(e);}h(Er,"CDATASection");Er.prototype={nodeName:"#cdata-section",nodeType:Ci};ge(Er,Zt);function Dr(e){me(e);}h(Dr,"DocumentType");Dr.prototype.nodeType=xi;ge(Dr,H);function pn(e){me(e);}h(pn,"Notation");pn.prototype.nodeType=$s;ge(pn,H);function mn(e){me(e);}h(mn,"Entity");mn.prototype.nodeType=Ls;ge(mn,H);function br(e){me(e);}h(br,"EntityReference");br.prototype.nodeType=Ti;ge(br,H);function Dt(e){me(e);}h(Dt,"DocumentFragment");Dt.prototype.nodeName="#document-fragment";Dt.prototype.nodeType=Ve;ge(Dt,H);function Ar(e){me(e);}h(Ar,"ProcessingInstruction");Ar.prototype.nodeType=hn;ge(Ar,Et);function Li(){}h(Li,"XMLSerializer");Li.prototype.serializeToString=function(e,t){return $i.call(e,t)};H.prototype.toString=$i;function $i(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===gt&&this.documentElement||this,o=n.prefix,i=n.namespaceURI;if(i&&o==null){var o=n.lookupPrefix(i);if(o==null)var a=[{namespace:i,prefix:null}];}return gn(this,r,a,t),r.join("")}h($i,"nodeSerializeToString");function bi(e,t,r){var n=e.prefix||"",o=e.namespaceURI;if(!o||n==="xml"&&o===Re.XML||o===Re.XMLNS)return false;for(var i=r.length;i--;){var a=r[i];if(a.prefix===n)return a.namespace!==o}return true}h(bi,"needNamespaceDefine");function mr(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,Pi),'"');}h(mr,"addSerializedAttribute");function gn(e,t,r,n){r||(r=[]);var o=n.nodeFilter,i=n.requireWellFormed,a=n.splitCDATASections,u=e.nodeType===gt?e:e.ownerDocument,l=u.type==="html";fe(e,{ns:r},{enter:h(function(s,f){var c=f.ns;if(o)if(s=o(s),s){if(typeof s=="string")return t.push(s),null}else return null;switch(s.nodeType){case Ne:var d=s.attributes,p=d.length,m=s.tagName,g=m;if(!l&&!s.prefix&&s.namespaceURI){for(var b,_=0;_<d.length;_++)if(d.item(_).name==="xmlns"){b=d.item(_).value;break}if(!b)for(var v=c.length-1;v>=0;v--){var E=c[v];if(E.prefix===""&&E.namespace===s.namespaceURI){b=E.namespace;break}}if(b!==s.namespaceURI)for(var v=c.length-1;v>=0;v--){var E=c[v];if(E.namespace===s.namespaceURI){E.prefix&&(g=E.prefix+":"+m);break}}}t.push("<",g);for(var w=c.slice(),D=0;D<p;D++){var y=d.item(D);y.prefix=="xmlns"?w.push({prefix:y.localName,namespace:y.value}):y.nodeName=="xmlns"&&w.push({prefix:"",namespace:y.value});}for(var D=0;D<p;D++){var y=d.item(D);if(bi(y,l,w)){var A=y.prefix||"",C=y.namespaceURI;mr(t,A?"xmlns:"+A:"xmlns",C),w.push({prefix:A,namespace:C});}var N=o?o(y):y;N&&(typeof N=="string"?t.push(N):mr(t,N.name,N.value));}if(m===g&&bi(s,l,w)){var B=s.prefix||"",C=s.namespaceURI;mr(t,B?"xmlns:"+B:"xmlns",C),w.push({prefix:B,namespace:C});}var x=!s.firstChild;if(x&&(l||s.namespaceURI===Re.HTML)&&(x=Os(m)),x)return t.push("/>"),null;if(t.push(">"),l&&Ps(m)){for(var M=s.firstChild;M;)M.data?t.push(M.data):gn(M,t,w.slice(),n),M=M.nextSibling;return t.push("</",g,">"),null}return {ns:w,tag:g};case gt:case Ve:if(i&&s.nodeType===gt&&s.documentElement==null)throw new k("The Document has no documentElement",Ae.InvalidStateError);return {ns:c};case wt:return mr(t,s.name,s.value),null;case _r:if(i&&ce.InvalidChar.test(s.data))throw new k("The Text node data contains characters outside the XML Char production",Ae.InvalidStateError);return t.push(s.data.replace(/[<&>]/g,Pi)),null;case Ci:if(i&&s.data.indexOf("]]>")!==-1)throw new k('The CDATASection data contains "]]>"',Ae.InvalidStateError);return a?t.push(ce.CDATA_START,s.data.replace(/]]>/g,"]]]]><![CDATA[>"),ce.CDATA_END):t.push(ce.CDATA_START,s.data,ce.CDATA_END),null;case dn:if(i){if(ce.InvalidChar.test(s.data))throw new k("The comment node data contains characters outside the XML Char production",Ae.InvalidStateError);if(s.data.indexOf("--")!==-1||s.data[s.data.length-1]==="-")throw new k('The comment node data contains "--" or ends with "-"',Ae.InvalidStateError)}return t.push(ce.COMMENT_START,s.data,ce.COMMENT_END),null;case xi:var z=s.publicId,P=s.systemId;if(i){if(z&&!ce.PubidLiteral_match.test(z))throw new k("DocumentType publicId is not a valid PubidLiteral",Ae.InvalidStateError);if(P&&P!=="."&&!ce.SystemLiteral_match.test(P))throw new k("DocumentType systemId is not a valid SystemLiteral",Ae.InvalidStateError);if(s.internalSubset&&s.internalSubset.indexOf("]>")!==-1)throw new k('DocumentType internalSubset contains "]>"',Ae.InvalidStateError)}return t.push(ce.DOCTYPE_DECL_START," ",s.name),z?(t.push(" ",ce.PUBLIC," ",z),P&&P!=="."&&t.push(" ",P)):P&&P!=="."&&t.push(" ",ce.SYSTEM," ",P),s.internalSubset&&t.push(" [",s.internalSubset,"]"),t.push(">"),null;case hn:if(i){if(s.target.indexOf(":")!==-1||s.target.toLowerCase()==="xml")throw new k("The ProcessingInstruction target is not well-formed",Ae.InvalidStateError);if(ce.InvalidChar.test(s.data))throw new k("The ProcessingInstruction data contains characters outside the XML Char production",Ae.InvalidStateError);if(s.data.indexOf("?>")!==-1)throw new k('The ProcessingInstruction data contains "?>"',Ae.InvalidStateError)}return t.push("<?",s.target," ",s.data,"?>"),null;case Ti:return t.push("&",s.nodeName,";"),null;default:return t.push("??",s.nodeName),null}},"enter"),exit:h(function(s,f){f&&f.tag&&t.push("</",f.tag,">");},"exit")});}h(gn,"serializeToString");function Vs(e,t,r){var n;return fe(t,null,{enter:h(function(o,i){var a=o.cloneNode(false);a.ownerDocument=e,a.parentNode=null,i===null?n=a:i.appendChild(a);var u=o.nodeType===wt||r;return u?a:null},"enter")}),n}h(Vs,"importNode");function Ui(e,t,r){var n;return fe(t,null,{enter:h(function(o,i){var a=new o.constructor(de);for(var u in o)if(_t(o,u)){var l=o[u];typeof l!="object"&&l!=a[u]&&(a[u]=l);}o.childNodes&&(a.childNodes=new ae),a.ownerDocument=e;var s=r;switch(a.nodeType){case Ne:var f=o.attributes,c=a.attributes=new vt,d=f.length;c._ownerElement=a;for(var p=0;p<d;p++)a.setAttributeNode(Ui(e,f.item(p),true));break;case wt:s=true;}return i!==null?i.appendChild(a):n=a,s?a:null},"enter")}),n}h(Ui,"cloneNode");function qi(e,t,r){e[t]=r;}h(qi,"__set__");function cn(e){for(var t=[],r=e.firstChild;r;)r.nodeType===Ne&&t.push(r),r=r.nextSibling;return t}h(cn,"childrenRefresh");try{Object.defineProperty&&(Object.defineProperty(Oe.prototype,"length",{get:h(function(){return vr(this),this.$$length},"get")}),Object.defineProperty(H.prototype,"textContent",{get:h(function(){if(this.nodeType===Ne||this.nodeType===Ve){var e=[];return fe(this,null,{enter:h(function(t){if(t.nodeType===Ne||t.nodeType===Ve)return !0;if(t.nodeType===hn||t.nodeType===dn)return null;e.push(t.nodeValue);},"enter")}),e.join("")}return this.nodeValue},"get"),set:h(function(e){switch(this.nodeType){case Ne:case Ve: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(ze.prototype,"children",{get:h(function(){return new Oe(this,cn)},"get")}),Object.defineProperty(qe.prototype,"children",{get:h(function(){return new Oe(this,cn)},"get")}),Object.defineProperty(Dt.prototype,"children",{get:h(function(){return new Oe(this,cn)},"get")}),qi=h(function(e,t,r){e["$$"+t]=r;},"__set__"));}catch{}ie._updateLiveList=vr;ie.Attr=nt;ie.CDATASection=Er;ie.CharacterData=Et;ie.Comment=yr;ie.Document=qe;ie.DocumentFragment=Dt;ie.DocumentType=Dr;ie.DOMImplementation=ki;ie.Element=ze;ie.Entity=mn;ie.EntityReference=br;ie.LiveNodeList=Oe;ie.NamedNodeMap=vt;ie.Node=H;ie.NodeList=ae;ie.Notation=pn;ie.Text=Zt;ie.ProcessingInstruction=Ar;ie.walkDOM=fe;ie.XMLSerializer=Li;});var ji=Ie(Kt=>{var zi=rt().freeze;Kt.XML_ENTITIES=zi({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Kt.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"});Kt.entityMap=Kt.HTML_ENTITIES;});var eo=Ie(Cr=>{var Ct=rt(),U=ln(),Xi=Ht(),Gs=Ct.isHTMLEscapableRawTextElement,Xs=Ct.isHTMLMimeType,Ys=Ct.isHTMLRawTextElement,nr=Ct.hasOwn,Wi=Ct.NAMESPACE,Hi=Xi.ParseError,Qs=Xi.DOMException,er=0,Xe=1,bt=2,tr=3,At=4,Nt=5,rr=6,Nr=7;function Yi(){}h(Yi,"XMLReader");Yi.prototype={parse:h(function(e,t,r){var n=this.domBuilder;n.startDocument(),Qi(t,t=Object.create(null)),Js(e,t,r,n,this.errorHandler),n.endDocument();},"parse")};var wn=/&#?\w+;?/g;function Js(e,t,r,n,o){var i=Xs(n.mimeType);e.indexOf(U.UNICODE_REPLACEMENT_CHARACTER)>=0&&o.warning("Unicode replacement character detected, source encoding issues?");function a(I){if(I>65535){I-=65536;var Q=55296+(I>>10),K=56320+(I&1023);return String.fromCharCode(Q,K)}else return String.fromCharCode(I)}h(a,"fixedFromCharCode");function u(I){var Q=I[I.length-1]===";"?I:I+";";if(!i&&Q!==I)return o.error("EntityRef: expecting ;"),I;var K=U.Reference.exec(Q);if(!K||K[0].length!==Q.length)return o.error("entity not matching Reference production: "+I),I;var oe=Q.slice(1,-1);return nr(r,oe)?r[oe]:oe.charAt(0)==="#"?a(parseInt(oe.substring(1).replace("x","0x"))):(o.error("entity not found:"+I),I)}h(u,"entityReplacer");function l(I){if(I>b){var Q=e.substring(b,I).replace(wn,u);d&&p(b),n.characters(Q,0,I-b),b=I;}}h(l,"appendText");var s=0,f=0,c=/\r\n?|\n|$/g,d=n.locator;function p(I,Q){for(;I>=f&&(Q=c.exec(e));)s=f,f=Q.index+Q[0].length,d.lineNumber++;d.columnNumber=I-s+1;}h(p,"position");for(var m=[{currentNSMap:t}],g=[],b=0;;){try{var _=e.indexOf("<",b);if(_<0){if(!i&&g.length>0)return o.fatalError("unclosed xml tag(s): "+g.join(", "));if(!e.substring(b).match(/^\s*$/)){var v=n.doc,E=v.createTextNode(e.substring(b));if(v.documentElement)return o.error("Extra content at the end of the document");v.appendChild(E),n.currentElement=E;}return}if(_>b){var w=e.substring(b,_);!i&&g.length===0&&(w=w.replace(new RegExp(U.S_OPT.source,"g"),""),w&&o.error("Unexpected content outside root element: '"+w+"'")),l(_);}switch(e.charAt(_+1)){case "/":var P=e.indexOf(">",_+2),D=e.substring(_+2,P>0?P:void 0);if(!D)return o.fatalError("end tag name missing");var y=P>0&&U.reg("^",U.QName_group,U.S_OPT,"$").exec(D);if(!y)return o.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 C=y[1].toLowerCase();if(!i||A.toLowerCase()!==C)return o.fatalError('Opening and ending tag mismatch: "'+A+'" != "'+D+'"')}var N=m.pop();g.pop();var B=N.localNSMap;if(n.endElement(N.uri,N.localName,A),B)for(var x in B)nr(B,x)&&n.endPrefixMapping(x);P++;break;case "?":d&&p(_),P=tu(e,_,n,o);break;case "!":d&&p(_),P=Zi(e,_,n,o,i);break;default:d&&p(_);var M=new Ki,z=m[m.length-1].currentNSMap,P=Zs(e,_,M,z,u,o,i),G=M.length;if(M.closed||(i&&Ct.isHTMLVoidElement(M.tagName)?M.closed=!0:g.push(M.tagName)),d&&G){for(var $=Vi(d,{}),R=0;R<G;R++){var j=M[R];p(j.offset),j.locator=Vi(d,{});}n.locator=$,Gi(M,n,z)&&m.push(M),n.locator=d;}else Gi(M,n,z)&&m.push(M);i&&!M.closed?P=Ks(e,P,M.tagName,u,n):P++;}}catch(I){if(I instanceof Hi)throw I;if(I instanceof Qs)throw new Hi(I.name+": "+I.message,n.locator,I);o.error("element parse error: "+I),P=-1;}P>b?b=P:l(Math.max(_,b)+1);}}h(Js,"parse");function Vi(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}h(Vi,"copyLocator");function Zs(e,t,r,n,o,i,a){function u(p,m,g){if(nr(r.attributeNames,p))return i.fatalError("Attribute "+p+" redefined");if(!a&&m.indexOf("<")>=0)return i.fatalError("Unescaped '<' not allowed in attributes values");r.addValue(p,m.replace(/[\t\n\r]/g," ").replace(wn,o),g);}h(u,"addAttribute");for(var l,s,f=++t,c=er;;){var d=e.charAt(f);switch(d){case "=":if(c===Xe)l=e.slice(t,f),c=tr;else if(c===bt)c=tr;else throw new Error("attribute equal must after attrName");break;case "'":case '"':if(c===tr||c===Xe)if(c===Xe&&(i.warning('attribute value must after "="'),l=e.slice(t,f)),t=f+1,f=e.indexOf(d,t),f>0)s=e.slice(t,f),u(l,s,t-1),c=Nt;else throw new Error("attribute value no end '"+d+"' match");else if(c==At)s=e.slice(t,f),u(l,s,t),i.warning('attribute "'+l+'" missed start quot('+d+")!!"),t=f+1,c=Nt;else throw new Error('attribute value must after "="');break;case "/":switch(c){case er:r.setTagName(e.slice(t,f));case Nt:case rr:case Nr:c=Nr,r.closed=true;case At:case Xe:break;case bt:r.closed=true;break;default:throw new Error("attribute invalid close char('/')")}break;case "":return i.error("unexpected end of input"),c==er&&r.setTagName(e.slice(t,f)),f;case ">":switch(c){case er:r.setTagName(e.slice(t,f));case Nt:case rr:case Nr:break;case At:case Xe:s=e.slice(t,f),s.slice(-1)==="/"&&(r.closed=true,s=s.slice(0,-1));case bt:c===bt&&(s=l),c==At?(i.warning('attribute "'+s+'" missed quot(")!'),u(l,s,t)):(a||i.warning('attribute "'+s+'" missed value!! "'+s+'" instead!!'),u(s,s,t));break;case tr:if(!a)return i.fatalError(`AttValue: ' or " expected`)}return f;case "\x80":d=" ";default:if(d<=" ")switch(c){case er:r.setTagName(e.slice(t,f)),c=rr;break;case Xe:l=e.slice(t,f),c=bt;break;case At:var s=e.slice(t,f);i.warning('attribute "'+s+'" missed quot(")!!'),u(l,s,t);case Nt:c=rr;break}else switch(c){case bt:a||i.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),u(l,l,t),t=f,c=Xe;break;case Nt:i.warning('attribute space is required"'+l+'"!!');case rr:c=Xe,t=f;break;case tr:c=At,t=f;break;case Nr:throw new Error("elements closed character '/' and '>' must be connected to")}}f++;}}h(Zs,"parseElementStartPart");function Gi(e,t,r){for(var n=e.tagName,o=null,c=e.length;c--;){var i=e[c],a=i.qName,u=i.value,d=a.indexOf(":");if(d>0)var l=i.prefix=a.slice(0,d),s=a.slice(d+1),f=l==="xmlns"&&s;else s=a,l=null,f=a==="xmlns"&&"";i.localName=s,f!==false&&(o==null&&(o=Object.create(null),Qi(r,r=Object.create(null))),r[f]=o[f]=u,i.uri=Wi.XMLNS,t.startPrefixMapping(f,u));}for(var c=e.length;c--;)i=e[c],i.prefix&&(i.prefix==="xml"&&(i.uri=Wi.XML),i.prefix!=="xmlns"&&(i.uri=r[i.prefix]));var d=n.indexOf(":");d>0?(l=e.prefix=n.slice(0,d),s=e.localName=n.slice(d+1)):(l=null,s=e.localName=n);var p=e.uri=r[l||""];if(t.startElement(p,s,n,e),e.closed){if(t.endElement(p,s,n),o)for(l in o)nr(o,l)&&t.endPrefixMapping(l);}else return e.currentNSMap=r,e.localNSMap=o,true}h(Gi,"appendElement");function Ks(e,t,r,n,o){var i=Gs(r);if(i||Ys(r)){var a=e.indexOf("</"+r+">",t),u=e.substring(t+1,a);return i&&(u=u.replace(wn,n)),o.characters(u,0,u.length),a}return t+1}h(Ks,"parseHtmlSpecialContent");function Qi(e,t){for(var r in e)nr(e,r)&&(t[r]=e[r]);}h(Qi,"_copy");function Ji(e,t){var r=t;function n(f){return f=f||0,e.charAt(r+f)}h(n,"char");function o(f){f=f||1,r+=f;}h(o,"skip");function i(){for(var f=0;r<e.length;){var c=n();if(c!==" "&&c!==`
|
|
3
|
-
`&&c!==" "&&c!=="\r")return f;f++,
|
|
1
|
+
'use strict';var n8nWorkflow=require('n8n-workflow');var Xa=Object.create;var $r=Object.defineProperty;var Qa=Object.getOwnPropertyDescriptor;var Ja=Object.getOwnPropertyNames;var Za=Object.getPrototypeOf,Ka=Object.prototype.hasOwnProperty;var h=(e,t)=>$r(e,"name",{value:t,configurable:true});var Ie=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var es=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ja(t))!Ka.call(e,a)&&a!==r&&$r(e,a,{get:()=>t[a],enumerable:!(n=Qa(t,a))||n.enumerable});return e};var Ur=(e,t,r)=>(r=e!=null?Xa(Za(e)):{},es($r(r,"default",{value:e,enumerable:true}),e));var Ln=Ie((Xl,Fn)=>{Fn.exports={createRequire:h(function(){return function(){return {}}},"createRequire")};});var rt=Ie(ce=>{function Cs(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(tt(e,n)){var a=e[n];if(t.call(void 0,a,n,e))return a}}h(Cs,"find");function ht(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(ht,"freeze");function tt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}h(tt,"hasOwn");function Ts(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var r in t)tt(t,r)&&(e[r]=t[r]);return e}h(Ts,"assign");var ei=ht({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 xs(e){return tt(ei,e.toLowerCase())}h(xs,"isHTMLBooleanAttribute");var ti=ht({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 Ss(e){return tt(ti,e.toLowerCase())}h(Ss,"isHTMLVoidElement");var $t=ht({script:false,style:false,textarea:true,title:true});function Is(e){var t=e.toLowerCase();return tt($t,t)&&!$t[t]}h(Is,"isHTMLRawTextElement");function ks(e){var t=e.toLowerCase();return tt($t,t)&&$t[t]}h(ks,"isHTMLEscapableRawTextElement");function ri(e){return e===Ut.HTML}h(ri,"isHTMLMimeType");function Ps(e){return ri(e)||e===Ut.XML_XHTML_APPLICATION}h(Ps,"hasDefaultHTMLNamespace");var Ut=ht({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Os=Object.keys(Ut).map(function(e){return Ut[e]});function Ms(e){return Os.indexOf(e)>-1}h(Ms,"isValidMimeType");var Rs=ht({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=Ts;ce.find=Cs;ce.freeze=ht;ce.HTML_BOOLEAN_ATTRIBUTES=ei;ce.HTML_RAW_TEXT_ELEMENTS=$t;ce.HTML_VOID_ELEMENTS=ti;ce.hasDefaultHTMLNamespace=Ps;ce.hasOwn=tt;ce.isHTMLBooleanAttribute=xs;ce.isHTMLRawTextElement=Is;ce.isHTMLEscapableRawTextElement=ks;ce.isHTMLMimeType=ri;ce.isHTMLVoidElement=Ss;ce.isValidMimeType=Ms;ce.MIME_TYPE=Ut;ce.NAMESPACE=Rs;});var Ht=Ie(Wt=>{var Bs=rt();function ii(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:true,writable:t}});}h(ii,"extendError");var zt=Bs.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"}),ai=Object.keys(zt);function si(e){return typeof e=="number"&&e>=1&&e<=25}h(si,"isValidDomExceptionCode");function Fs(e){return typeof e=="string"&&e.substring(e.length-zt.Error.length)===zt.Error}h(Fs,"endsWithError");function jt(e,t){si(e)?(this.name=ai[e],this.message=t||""):(this.message=e,this.name=Fs(t)?t:zt.Error),Error.captureStackTrace&&Error.captureStackTrace(this,jt);}h(jt,"DOMException");ii(jt,true);Object.defineProperties(jt.prototype,{code:{enumerable:true,get:h(function(){var e=ai.indexOf(this.name);return si(e)?e:0},"get")}});var oi={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},en=Object.entries(oi);for(qt=0;qt<en.length;qt++)ni=en[qt][0],jt[ni]=en[qt][1];var ni,qt;function tn(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,tn);}h(tn,"ParseError");ii(tn);Wt.DOMException=jt;Wt.DOMExceptionName=zt;Wt.ExceptionCode=oi;Wt.ParseError=tn;});var ln=Ie($=>{function pi(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(pi,"detectUnicodeSupport");var mt=pi();function He(e){if(e.source[0]!=="[")throw new Error(e+" can not be used with chars");return e.source.slice(1,e.source.lastIndexOf("]"))}h(He,"chars");function dt(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,""),mt?"u":"")}h(dt,"chars_without");function W(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(""),mt?"mu":"m")}h(W,"reg");function F(e){if(arguments.length===0)throw new Error("no parameters provided");return W.apply(F,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}h(F,"regg");var Ls="\uFFFD",Ve=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;mt&&(Ve=W("[",He(Ve),"\\u{10000}-\\u{10FFFF}","]"));var $s=new RegExp("[^"+He(Ve)+"]",mt?"u":""),nn=/[\x20\x09\x0D\x0A]/,Us=He(nn),Q=W(nn,"+"),te=W(nn,"*"),Vt=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;mt&&(Vt=W("[",He(Vt),"\\u{10000}-\\u{10FFFF}","]"));var qs=He(Vt),an=W("[",qs,He(/[-.0-9\xB7]/),He(/[\u0300-\u036F\u203F-\u2040]/),"]"),be=W(Vt,an,"*"),ui=W(an,"+"),zs=W("&",be,";"),js=F(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Gt=F(zs,"|",js),Yt=W("%",be,";"),sn=F(W('"',F(/[^%&"]/,"|",Yt,"|",Gt),"*",'"'),"|",W("'",F(/[^%&']/,"|",Yt,"|",Gt),"*","'")),Ws=F('"',F(/[^<&"]/,"|",Gt),"*",'"',"|","'",F(/[^<&']/,"|",Gt),"*","'"),Hs=dt(Vt,":"),Vs=dt(an,":"),li=W(Hs,Vs,"*"),Xt=W(li,F(":",li),"?"),Gs=W("^",Xt,"$"),Ys=W("(",Xt,")"),pt=F(/"[^"]*"|'[^']*'/),Xs=W(/^<\?/,"(",be,")",F(Q,"(",Ve,"*?)"),"?",/\?>/),ci=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Qt=F('"',ci,'*"',"|","'",dt(ci,"'"),"*'"),mi="<!--",gi="-->",Qs=W(mi,F(dt(Ve,"-"),"|",W("-",dt(Ve,"-"))),"*",gi),fi="#PCDATA",Js=F(W(/\(/,te,fi,F(te,/\|/,te,Xt),"*",te,/\)\*/),"|",W(/\(/,te,fi,te,/\)/)),Zs=/[?*+]?/,Ks=W(/\([^>]+\)/,Zs),eo=F("EMPTY","|","ANY","|",Js,"|",Ks),to="<!ELEMENT",ro=W(to,Q,F(Xt,"|",Yt),Q,F(eo,"|",Yt),te,">"),no=W("NOTATION",Q,/\(/,te,be,F(te,/\|/,te,be),"*",te,/\)/),io=W(/\(/,te,ui,F(te,/\|/,te,ui),"*",te,/\)/),ao=F(no,"|",io),so=F(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",ao),oo=F(/#REQUIRED|#IMPLIED/,"|",F(F("#FIXED",Q),"?",Ws)),uo=F(Q,be,Q,so,Q,oo),lo="<!ATTLIST",co=W(lo,Q,be,uo,"*",te,">"),rn="about:legacy-compat",fo=F('"'+rn+'"',"|","'"+rn+"'"),on="SYSTEM",dr="PUBLIC",pr=F(F(on,Q,pt),"|",F(dr,Q,Qt,Q,pt)),ho=W("^",F(F(on,Q,"(?<SystemLiteralOnly>",pt,")"),"|",F(dr,Q,"(?<PubidLiteral>",Qt,")",Q,"(?<SystemLiteral>",pt,")"))),po=W("^",Qt,"$"),mo=W("^",pt,"$"),go=F(Q,"NDATA",Q,be),_o=F(sn,"|",F(pr,go,"?")),_i="<!ENTITY",wo=W(_i,Q,be,Q,_o,te,">"),vo=F(sn,"|",pr),yo=W(_i,Q,"%",Q,be,Q,vo,te,">"),Eo=F(wo,"|",yo),Do=W(dr,Q,Qt),bo=W("<!NOTATION",Q,be,Q,F(pr,"|",Do),te,">"),un=W(te,"=",te),hi=/1[.]\d+/,Ao=W(Q,"version",un,F("'",hi,"'","|",'"',hi,'"')),di=/[A-Za-z][-A-Za-z0-9._]*/,No=F(Q,"encoding",un,F('"',di,'"',"|","'",di,"'")),Co=F(Q,"standalone",un,F("'",F("yes","|","no"),"'","|",'"',F("yes","|","no"),'"')),To=W(/^<\?xml/,Ao,No,"?",Co,"?",te,/\?>/),xo="<!DOCTYPE",So="<![CDATA[",Io="]]>",ko=/<!\[CDATA\[/,Po=/\]\]>/,Oo=W(Ve,"*?",Po),Mo=W(ko,Oo);$.chars=He;$.chars_without=dt;$.detectUnicodeSupport=pi;$.reg=W;$.regg=F;$.ABOUT_LEGACY_COMPAT=rn;$.ABOUT_LEGACY_COMPAT_SystemLiteral=fo;$.AttlistDecl=co;$.CDATA_START=So;$.CDATA_END=Io;$.CDSect=Mo;$.Char=Ve;$.Comment=Qs;$.COMMENT_START=mi;$.COMMENT_END=gi;$.DOCTYPE_DECL_START=xo;$.elementdecl=ro;$.EntityDecl=Eo;$.EntityValue=sn;$.ExternalID=pr;$.ExternalID_match=ho;$.Name=be;$.NotationDecl=bo;$.Reference=Gt;$.PEReference=Yt;$.PI=Xs;$.PUBLIC=dr;$.PubidLiteral=Qt;$.PubidLiteral_match=po;$.QName=Xt;$.QName_exact=Gs;$.QName_group=Ys;$.S=Q;$.SChar_s=Us;$.S_OPT=te;$.SYSTEM=on;$.SystemLiteral=pt;$.SystemLiteral_match=mo;$.InvalidChar=$s;$.UNICODE_REPLACEMENT_CHARACTER=Ls;$.UNICODE_SUPPORT=mt;$.XMLDecl=To;});var _n=Ie(ae=>{var Ce=rt(),Me=Ce.find,Ro=Ce.hasDefaultHTMLNamespace,_t=Ce.hasOwn,Bo=Ce.isHTMLMimeType,Fo=Ce.isHTMLRawTextElement,Lo=Ce.isHTMLVoidElement,Jt=Ce.MIME_TYPE,Re=Ce.NAMESPACE,pe=Symbol(),Ai=Ht(),P=Ai.DOMException,Ae=Ai.DOMExceptionName,fe=ln();function ge(e){if(e!==pe)throw new TypeError("Illegal constructor")}h(ge,"checkSymbol");function $o(e){return e!==""}h($o,"notEmptyString");function Uo(e){return e?e.split(/[\t\n\f\r ]+/).filter($o):[]}h(Uo,"splitOnASCIIWhitespace");function qo(e,t){return _t(e,t)||(e[t]=true),e}h(qo,"orderedSetReducer");function wi(e){if(!e)return [];var t=Uo(e);return Object.keys(t.reduce(qo,{}))}h(wi,"toOrderedSet");function zo(e){return function(t){return e&&e.indexOf(t)!==-1}}h(zo,"arrayIncludes");function Ni(e){if(!fe.QName_exact.test(e))throw new P(P.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}h(Ni,"validateQualifiedName");function fn(e,t){Ni(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 P(P.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(r==="xml"&&e!==Ce.NAMESPACE.XML)throw new P(P.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((r==="xmlns"||t==="xmlns")&&e!==Ce.NAMESPACE.XMLNS)throw new P(P.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(e===Ce.NAMESPACE.XMLNS&&r!=="xmlns"&&t!=="xmlns")throw new P(P.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return [e,r,n]}h(fn,"validateAndExtract");function yt(e,t){for(var r in e)_t(e,r)&&(t[r]=e[r]);}h(yt,"copy");function _e(e,t){var r=e.prototype;if(!(r instanceof t)){let n=function(){};h(n,"t"),n.prototype=t.prototype,n=new n,yt(r,n),e.prototype=r=n;}r.constructor!=e&&(r.constructor=e);}h(_e,"_extends");var we={},Ne=we.ELEMENT_NODE=1,wt=we.ATTRIBUTE_NODE=2,_r=we.TEXT_NODE=3,Ci=we.CDATA_SECTION_NODE=4,Ti=we.ENTITY_REFERENCE_NODE=5,jo=we.ENTITY_NODE=6,hn=we.PROCESSING_INSTRUCTION_NODE=7,dn=we.COMMENT_NODE=8,gt=we.DOCUMENT_NODE=9,xi=we.DOCUMENT_TYPE_NODE=10,Ge=we.DOCUMENT_FRAGMENT_NODE=11,Wo=we.NOTATION_NODE=12,ie=Ce.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 Si(e,t){if(t.length<e.length)return Si(t,e);var r=null;for(var n in e){if(e[n]!==t[n])return r;r=e[n];}return r}h(Si,"commonAncestor");function vi(e){return e.guid||(e.guid=Math.random()),e.guid}h(vi,"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++)gn(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 Oe(e,t){this._node=e,this._refresh=t,vr(this);}h(Oe,"LiveNodeList");function vr(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(qi(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)_t(e,n)&&delete e[n];yt(r,e),e._inc=t;}}h(vr,"_updateLiveList");Oe.prototype.item=function(e){return vr(this),this[e]||null};_e(Oe,se);function vt(){}h(vt,"NamedNodeMap");function Ii(e,t){for(var r=0;r<e.length;){if(e[r]===t)return r;r++;}}h(Ii,"_findNodeIndex");function Ho(e,t,r,n){if(n?t[Ii(t,n)]=r:(t[t.length]=r,t.length++),e){r.ownerElement=e;var a=e.ownerDocument;a&&(n&&Oi(a,e,n),Vo(a,e,r));}}h(Ho,"_addNamedNode");function yi(e,t,r){var n=Ii(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&&Oi(i,e,r),r.ownerElement=null;}}}h(yi,"_removeNamedNode");vt.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 P(P.INUSE_ATTRIBUTE_ERR);var r=this.getNamedItemNS(e.namespaceURI,e.localName);return r===e?e:(Ho(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 P(P.NOT_FOUND_ERR,e);return yi(this._ownerElement,this,t),t},"removeNamedItem"),removeNamedItemNS:h(function(e,t){var r=this.getNamedItemNS(e,t);if(!r)throw new P(P.NOT_FOUND_ERR,e?e+" : "+t:t);return yi(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")};vt.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 ki(){}h(ki,"DOMImplementation");ki.prototype={hasFeature:h(function(e,t){return true},"hasFeature"),createDocument:h(function(e,t,r){var n=Jt.XML_APPLICATION;e===Re.HTML?n=Jt.XML_XHTML_APPLICATION:e===Re.SVG&&(n=Jt.XML_SVG_IMAGE);var a=new ze(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){Ni(e);var a=new Dr(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 ze(pe,{contentType:Jt.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 V(e){ge(e);}h(V,"Node");V.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 s=n.attributes.item(i),o=a.getAttributeNodeNS(s.namespaceURI,s.localName);if(!o)return false;t.push({node:s,other:o});}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 wr(this,e,t)},"insertBefore"),replaceChild:h(function(e,t){wr(this,e,t,Fi),t&&this.removeChild(t);},"replaceChild"),removeChild:h(function(e){return Ri(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 Ui(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===_r&&t.nodeType===_r?(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(_t(r,n)&&r[n]===e)return n}t=t.nodeType==wt?t.ownerDocument:t.parentNode;}return null},"lookupPrefix"),lookupNamespaceURI:h(function(e){for(var t=this;t;){var r=t._nsMap;if(r&&_t(r,e))return r[e];t=t.nodeType==wt?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 nt&&(n=t,t=n.ownerElement),r instanceof nt&&(a=r,r=a.ownerElement,n&&t&&r===t))for(var i=0,s;s=r.attributes[i];i++){if(s===n)return ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+ie.DOCUMENT_POSITION_PRECEDING;if(s===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+(vi(r.ownerDocument)>vi(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 o=[],l=t.parentNode;l;){if(!a&&l===r)return ie.DOCUMENT_POSITION_CONTAINED_BY+ie.DOCUMENT_POSITION_FOLLOWING;o.push(l),l=l.parentNode;}o.reverse();for(var u=[],f=r.parentNode;f;){if(!n&&f===t)return ie.DOCUMENT_POSITION_CONTAINS+ie.DOCUMENT_POSITION_PRECEDING;u.push(f),f=f.parentNode;}u.reverse();var c=Si(o,u);for(var d in c.childNodes){var p=c.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(o.indexOf(p)>=0)return ie.DOCUMENT_POSITION_PRECEDING}return 0},"compareDocumentPosition")};function Pi(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}h(Pi,"_xmlEncoder");yt(we,V);yt(we,V.prototype);yt(ie,V);yt(ie,V.prototype);function gr(e,t){he(e,null,{enter:h(function(r){return t(r)?he.STOP:true},"enter")});}h(gr,"_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 s=a.node.lastChild;s;)n.push({node:s,context:i,phase:he.ENTER}),s=s.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 ze(e,t){ge(e);var r=t||{};this.ownerDocument=this,this.contentType=r.contentType||Jt.XML_APPLICATION,this.type=Bo(this.contentType)?"html":"xml";}h(ze,"Document");function Vo(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Re.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value);}h(Vo,"_onAddAttribute");function Oi(e,t,r,n){e&&e._inc++;var a=r.namespaceURI;a===Re.XMLNS&&delete t._nsMap[r.prefix?r.localName:""];}h(Oi,"_onRemoveAttribute");function Mi(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(Mi,"_onUpdateChild");function Ri(e,t){if(e!==t.parentNode)throw new P(P.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,Mi(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}h(Ri,"_removeChild");function Go(e){return e&&(e.nodeType===V.DOCUMENT_NODE||e.nodeType===V.DOCUMENT_FRAGMENT_NODE||e.nodeType===V.ELEMENT_NODE)}h(Go,"hasValidParentNodeType");function Yo(e){return e&&(e.nodeType===V.CDATA_SECTION_NODE||e.nodeType===V.COMMENT_NODE||e.nodeType===V.DOCUMENT_FRAGMENT_NODE||e.nodeType===V.DOCUMENT_TYPE_NODE||e.nodeType===V.ELEMENT_NODE||e.nodeType===V.PROCESSING_INSTRUCTION_NODE||e.nodeType===V.TEXT_NODE)}h(Yo,"hasInsertableNodeType");function Ye(e){return e&&e.nodeType===V.DOCUMENT_TYPE_NODE}h(Ye,"isDocTypeNode");function qe(e){return e&&e.nodeType===V.ELEMENT_NODE}h(qe,"isElementNode");function Bi(e){return e&&e.nodeType===V.TEXT_NODE}h(Bi,"isTextNode");function Ei(e,t){var r=e.childNodes||[];if(Me(r,qe)||Ye(t))return false;var n=Me(r,Ye);return !(t&&n&&r.indexOf(n)>r.indexOf(t))}h(Ei,"isElementInsertionPossible");function Di(e,t){var r=e.childNodes||[];function n(i){return qe(i)&&i!==t}if(h(n,"hasElementChildThatIsNotChild"),Me(r,n))return false;var a=Me(r,Ye);return !(t&&a&&r.indexOf(a)>r.indexOf(t))}h(Di,"isElementReplacementPossible");function Xo(e,t,r){if(!Go(e))throw new P(P.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new P(P.NOT_FOUND_ERR,"child not in parent");if(!Yo(t)||Ye(t)&&e.nodeType!==V.DOCUMENT_NODE)throw new P(P.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}h(Xo,"assertPreInsertionValidity1to5");function Qo(e,t,r){var n=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===V.DOCUMENT_FRAGMENT_NODE){var i=a.filter(qe);if(i.length>1||Me(a,Bi))throw new P(P.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!Ei(e,r))throw new P(P.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(qe(t)&&!Ei(e,r))throw new P(P.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Ye(t)){if(Me(n,Ye))throw new P(P.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var s=Me(n,qe);if(r&&n.indexOf(s)<n.indexOf(r))throw new P(P.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!r&&s)throw new P(P.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}h(Qo,"assertPreInsertionValidityInDocument");function Fi(e,t,r){var n=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===V.DOCUMENT_FRAGMENT_NODE){var i=a.filter(qe);if(i.length>1||Me(a,Bi))throw new P(P.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!Di(e,r))throw new P(P.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(qe(t)&&!Di(e,r))throw new P(P.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Ye(t)){let o=function(l){return Ye(l)&&l!==r};if(h(o,"hasDoctypeChildThatIsNotChild"),Me(n,o))throw new P(P.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var s=Me(n,qe);if(r&&n.indexOf(s)<n.indexOf(r))throw new P(P.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}h(Fi,"assertPreReplacementValidityInDocument");function wr(e,t,r,n){Xo(e,t,r),e.nodeType===V.DOCUMENT_NODE&&(n||Qo)(e,t,r);var a=t.parentNode;if(a&&a.removeChild(t),t.nodeType===Ge){var i=t.firstChild;if(i==null)return t;var s=t.lastChild;}else i=s=t;var o=r?r.previousSibling:e.lastChild;i.previousSibling=o,s.nextSibling=r,o?o.nextSibling=i:e.firstChild=i,r==null?e.lastChild=s:r.previousSibling=s;do i.parentNode=e;while(i!==s&&(i=i.nextSibling));return Mi(e.ownerDocument||e,e,t),t.nodeType==Ge&&(t.firstChild=t.lastChild=null),t}h(wr,"_insertBefore");ze.prototype={implementation:null,nodeName:"#document",nodeType:gt,doctype:null,documentElement:null,_inc:1,insertBefore:h(function(e,t){if(e.nodeType===Ge){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n;}return e}return wr(this,e,t),e.ownerDocument=this,this.documentElement===null&&e.nodeType===Ne&&(this.documentElement=e),e},"insertBefore"),removeChild:h(function(e){var t=Ri(this,e);return t===this.documentElement&&(this.documentElement=null),t},"removeChild"),replaceChild:h(function(e,t){wr(this,e,t,Fi),e.ownerDocument=this,t&&this.removeChild(t),qe(e)&&(this.documentElement=e);},"replaceChild"),importNode:h(function(e,t){return Jo(this,e,t)},"importNode"),getElementById:h(function(e){var t=null;return gr(this.documentElement,function(r){if(r.nodeType==Ne&&r.getAttribute("id")==e)return t=r,true}),t},"getElementById"),createElement:h(function(e){var t=new je(pe);t.ownerDocument=this,this.type==="html"&&(e=e.toLowerCase()),Ro(this.contentType)&&(t.namespaceURI=Re.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new se;var r=t.attributes=new vt;return r._ownerElement=t,t},"createElement"),createDocumentFragment:h(function(){var e=new Dt(pe);return e.ownerDocument=this,e.childNodes=new se,e},"createDocumentFragment"),createTextNode:h(function(e){var t=new Zt(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createTextNode"),createComment:h(function(e){var t=new yr(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createComment"),createCDATASection:h(function(e){if(e.indexOf("]]>")!==-1)throw new P(P.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new Er(pe);return t.ownerDocument=this,t.childNodes=new se,t.appendData(e),t},"createCDATASection"),createProcessingInstruction:h(function(e,t){var r=new Ar(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 P(P.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 nt(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 P(P.INVALID_CHARACTER_ERR,'not a valid xml name "'+e+'"');if(this.type==="html")throw new P("document is an html document",Ae.NotSupportedError);var t=new br(pe);return t.ownerDocument=this,t.childNodes=new se,t.nodeName=e,t},"createEntityReference"),createElementNS:h(function(e,t){var r=fn(e,t),n=new je(pe),a=n.attributes=new vt;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=fn(e,t),n=new nt(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")};_e(ze,V);function je(e){ge(e),this._nsMap=Object.create(null);}h(je,"Element");je.prototype={nodeType:Ne,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===Re.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=fn(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=wi(e);return new Oe(this,function(r){var n=[];return t.length>0&&gr(r,function(a){if(a!==r&&a.nodeType===Ne){var i=a.getAttribute("class");if(i){var s=e===i;if(!s){var o=wi(i);s=t.every(zo(o));}s&&n.push(a);}}}),n})},"getElementsByClassName"),getElementsByTagName:h(function(e){var t=(this.nodeType===gt?this:this.ownerDocument).type==="html",r=e.toLowerCase();return new Oe(this,function(n){var a=[];return gr(n,function(i){if(!(i===n||i.nodeType!==Ne))if(e==="*")a.push(i);else {var s=i.getQualifiedName(),o=t&&i.namespaceURI===Re.HTML?r:e;s===o&&a.push(i);}}),a})},"getElementsByTagName"),getElementsByTagNameNS:h(function(e,t){return new Oe(this,function(r){var n=[];return gr(r,function(a){a!==r&&a.nodeType===Ne&&(e==="*"||a.namespaceURI===e)&&(t==="*"||a.localName==t)&&n.push(a);}),n})},"getElementsByTagNameNS")};ze.prototype.getElementsByClassName=je.prototype.getElementsByClassName;ze.prototype.getElementsByTagName=je.prototype.getElementsByTagName;ze.prototype.getElementsByTagNameNS=je.prototype.getElementsByTagNameNS;_e(je,V);function nt(e){ge(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null;}h(nt,"Attr");nt.prototype.nodeType=wt;_e(nt,V);function Et(e){ge(e);}h(Et,"CharacterData");Et.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")};_e(Et,V);function Zt(e){ge(e);}h(Zt,"Text");Zt.prototype={nodeName:"#text",nodeType:_r,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")};_e(Zt,Et);function yr(e){ge(e);}h(yr,"Comment");yr.prototype={nodeName:"#comment",nodeType:dn};_e(yr,Et);function Er(e){ge(e);}h(Er,"CDATASection");Er.prototype={nodeName:"#cdata-section",nodeType:Ci};_e(Er,Zt);function Dr(e){ge(e);}h(Dr,"DocumentType");Dr.prototype.nodeType=xi;_e(Dr,V);function pn(e){ge(e);}h(pn,"Notation");pn.prototype.nodeType=Wo;_e(pn,V);function mn(e){ge(e);}h(mn,"Entity");mn.prototype.nodeType=jo;_e(mn,V);function br(e){ge(e);}h(br,"EntityReference");br.prototype.nodeType=Ti;_e(br,V);function Dt(e){ge(e);}h(Dt,"DocumentFragment");Dt.prototype.nodeName="#document-fragment";Dt.prototype.nodeType=Ge;_e(Dt,V);function Ar(e){ge(e);}h(Ar,"ProcessingInstruction");Ar.prototype.nodeType=hn;_e(Ar,Et);function Li(){}h(Li,"XMLSerializer");Li.prototype.serializeToString=function(e,t){return $i.call(e,t)};V.prototype.toString=$i;function $i(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===gt&&this.documentElement||this,a=n.prefix,i=n.namespaceURI;if(i&&a==null){var a=n.lookupPrefix(i);if(a==null)var s=[{namespace:i,prefix:null}];}return gn(this,r,s,t),r.join("")}h($i,"nodeSerializeToString");function bi(e,t,r){var n=e.prefix||"",a=e.namespaceURI;if(!a||n==="xml"&&a===Re.XML||a===Re.XMLNS)return false;for(var i=r.length;i--;){var s=r[i];if(s.prefix===n)return s.namespace!==a}return true}h(bi,"needNamespaceDefine");function mr(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,Pi),'"');}h(mr,"addSerializedAttribute");function gn(e,t,r,n){r||(r=[]);var a=n.nodeFilter,i=n.requireWellFormed,s=n.splitCDATASections,o=e.nodeType===gt?e:e.ownerDocument,l=o.type==="html";he(e,{ns:r},{enter:h(function(u,f){var c=f.ns;if(a)if(u=a(u),u){if(typeof u=="string")return t.push(u),null}else return null;switch(u.nodeType){case Ne:var d=u.attributes,p=d.length,g=u.tagName,m=g;if(!l&&!u.prefix&&u.namespaceURI){for(var D,w=0;w<d.length;w++)if(d.item(w).name==="xmlns"){D=d.item(w).value;break}if(!D)for(var v=c.length-1;v>=0;v--){var E=c[v];if(E.prefix===""&&E.namespace===u.namespaceURI){D=E.namespace;break}}if(D!==u.namespaceURI)for(var v=c.length-1;v>=0;v--){var E=c[v];if(E.namespace===u.namespaceURI){E.prefix&&(m=E.prefix+":"+g);break}}}t.push("<",m);for(var _=c.slice(),b=0;b<p;b++){var y=d.item(b);y.prefix=="xmlns"?_.push({prefix:y.localName,namespace:y.value}):y.nodeName=="xmlns"&&_.push({prefix:"",namespace:y.value});}for(var b=0;b<p;b++){var y=d.item(b);if(bi(y,l,_)){var A=y.prefix||"",N=y.namespaceURI;mr(t,A?"xmlns:"+A:"xmlns",N),_.push({prefix:A,namespace:N});}var C=a?a(y):y;C&&(typeof C=="string"?t.push(C):mr(t,C.name,C.value));}if(g===m&&bi(u,l,_)){var M=u.prefix||"",N=u.namespaceURI;mr(t,M?"xmlns:"+M:"xmlns",N),_.push({prefix:M,namespace:N});}var x=!u.firstChild;if(x&&(l||u.namespaceURI===Re.HTML)&&(x=Lo(g)),x)return t.push("/>"),null;if(t.push(">"),l&&Fo(g)){for(var O=u.firstChild;O;)O.data?t.push(O.data):gn(O,t,_.slice(),n),O=O.nextSibling;return t.push("</",m,">"),null}return {ns:_,tag:m};case gt:case Ge:if(i&&u.nodeType===gt&&u.documentElement==null)throw new P("The Document has no documentElement",Ae.InvalidStateError);return {ns:c};case wt:return mr(t,u.name,u.value),null;case _r:if(i&&fe.InvalidChar.test(u.data))throw new P("The Text node data contains characters outside the XML Char production",Ae.InvalidStateError);return t.push(u.data.replace(/[<&>]/g,Pi)),null;case Ci:if(i&&u.data.indexOf("]]>")!==-1)throw new P('The CDATASection data contains "]]>"',Ae.InvalidStateError);return s?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 dn:if(i){if(fe.InvalidChar.test(u.data))throw new P("The comment node data contains characters outside the XML Char production",Ae.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new P('The comment node data contains "--" or ends with "-"',Ae.InvalidStateError)}return t.push(fe.COMMENT_START,u.data,fe.COMMENT_END),null;case xi:var U=u.publicId,I=u.systemId;if(i){if(U&&!fe.PubidLiteral_match.test(U))throw new P("DocumentType publicId is not a valid PubidLiteral",Ae.InvalidStateError);if(I&&I!=="."&&!fe.SystemLiteral_match.test(I))throw new P("DocumentType systemId is not a valid SystemLiteral",Ae.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new P('DocumentType internalSubset contains "]>"',Ae.InvalidStateError)}return t.push(fe.DOCTYPE_DECL_START," ",u.name),U?(t.push(" ",fe.PUBLIC," ",U),I&&I!=="."&&t.push(" ",I)):I&&I!=="."&&t.push(" ",fe.SYSTEM," ",I),u.internalSubset&&t.push(" [",u.internalSubset,"]"),t.push(">"),null;case hn:if(i){if(u.target.indexOf(":")!==-1||u.target.toLowerCase()==="xml")throw new P("The ProcessingInstruction target is not well-formed",Ae.InvalidStateError);if(fe.InvalidChar.test(u.data))throw new P("The ProcessingInstruction data contains characters outside the XML Char production",Ae.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new P('The ProcessingInstruction data contains "?>"',Ae.InvalidStateError)}return t.push("<?",u.target," ",u.data,"?>"),null;case Ti:return t.push("&",u.nodeName,";"),null;default:return t.push("??",u.nodeName),null}},"enter"),exit:h(function(u,f){f&&f.tag&&t.push("</",f.tag,">");},"exit")});}h(gn,"serializeToString");function Jo(e,t,r){var n;return he(t,null,{enter:h(function(a,i){var s=a.cloneNode(false);s.ownerDocument=e,s.parentNode=null,i===null?n=s:i.appendChild(s);var o=a.nodeType===wt||r;return o?s:null},"enter")}),n}h(Jo,"importNode");function Ui(e,t,r){var n;return he(t,null,{enter:h(function(a,i){var s=new a.constructor(pe);for(var o in a)if(_t(a,o)){var l=a[o];typeof l!="object"&&l!=s[o]&&(s[o]=l);}a.childNodes&&(s.childNodes=new se),s.ownerDocument=e;var u=r;switch(s.nodeType){case Ne:var f=a.attributes,c=s.attributes=new vt,d=f.length;c._ownerElement=s;for(var p=0;p<d;p++)s.setAttributeNode(Ui(e,f.item(p),true));break;case wt:u=true;}return i!==null?i.appendChild(s):n=s,u?s:null},"enter")}),n}h(Ui,"cloneNode");function qi(e,t,r){e[t]=r;}h(qi,"__set__");function cn(e){for(var t=[],r=e.firstChild;r;)r.nodeType===Ne&&t.push(r),r=r.nextSibling;return t}h(cn,"childrenRefresh");try{Object.defineProperty&&(Object.defineProperty(Oe.prototype,"length",{get:h(function(){return vr(this),this.$$length},"get")}),Object.defineProperty(V.prototype,"textContent",{get:h(function(){if(this.nodeType===Ne||this.nodeType===Ge){var e=[];return he(this,null,{enter:h(function(t){if(t.nodeType===Ne||t.nodeType===Ge)return !0;if(t.nodeType===hn||t.nodeType===dn)return null;e.push(t.nodeValue);},"enter")}),e.join("")}return this.nodeValue},"get"),set:h(function(e){switch(this.nodeType){case Ne:case Ge: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(je.prototype,"children",{get:h(function(){return new Oe(this,cn)},"get")}),Object.defineProperty(ze.prototype,"children",{get:h(function(){return new Oe(this,cn)},"get")}),Object.defineProperty(Dt.prototype,"children",{get:h(function(){return new Oe(this,cn)},"get")}),qi=h(function(e,t,r){e["$$"+t]=r;},"__set__"));}catch{}ae._updateLiveList=vr;ae.Attr=nt;ae.CDATASection=Er;ae.CharacterData=Et;ae.Comment=yr;ae.Document=ze;ae.DocumentFragment=Dt;ae.DocumentType=Dr;ae.DOMImplementation=ki;ae.Element=je;ae.Entity=mn;ae.EntityReference=br;ae.LiveNodeList=Oe;ae.NamedNodeMap=vt;ae.Node=V;ae.NodeList=se;ae.Notation=pn;ae.Text=Zt;ae.ProcessingInstruction=Ar;ae.walkDOM=he;ae.XMLSerializer=Li;});var ji=Ie(Kt=>{var zi=rt().freeze;Kt.XML_ENTITIES=zi({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Kt.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"});Kt.entityMap=Kt.HTML_ENTITIES;});var ea=Ie(Cr=>{var Ct=rt(),q=ln(),Yi=Ht(),Zo=Ct.isHTMLEscapableRawTextElement,Ko=Ct.isHTMLMimeType,eu=Ct.isHTMLRawTextElement,nr=Ct.hasOwn,Wi=Ct.NAMESPACE,Hi=Yi.ParseError,tu=Yi.DOMException,er=0,Xe=1,bt=2,tr=3,At=4,Nt=5,rr=6,Nr=7;function Xi(){}h(Xi,"XMLReader");Xi.prototype={parse:h(function(e,t,r){var n=this.domBuilder;n.startDocument(),Qi(t,t=Object.create(null)),ru(e,t,r,n,this.errorHandler),n.endDocument();},"parse")};var wn=/&#?\w+;?/g;function ru(e,t,r,n,a){var i=Ko(n.mimeType);e.indexOf(q.UNICODE_REPLACEMENT_CHARACTER)>=0&&a.warning("Unicode replacement character detected, source encoding issues?");function s(k){if(k>65535){k-=65536;var H=55296+(k>>10),K=56320+(k&1023);return String.fromCharCode(H,K)}else return String.fromCharCode(k)}h(s,"fixedFromCharCode");function o(k){var H=k[k.length-1]===";"?k:k+";";if(!i&&H!==k)return a.error("EntityRef: expecting ;"),k;var K=q.Reference.exec(H);if(!K||K[0].length!==H.length)return a.error("entity not matching Reference production: "+k),k;var ue=H.slice(1,-1);return nr(r,ue)?r[ue]:ue.charAt(0)==="#"?s(parseInt(ue.substring(1).replace("x","0x"))):(a.error("entity not found:"+k),k)}h(o,"entityReplacer");function l(k){if(k>D){var H=e.substring(D,k).replace(wn,o);d&&p(D),n.characters(H,0,k-D),D=k;}}h(l,"appendText");var u=0,f=0,c=/\r\n?|\n|$/g,d=n.locator;function p(k,H){for(;k>=f&&(H=c.exec(e));)u=f,f=H.index+H[0].length,d.lineNumber++;d.columnNumber=k-u+1;}h(p,"position");for(var g=[{currentNSMap:t}],m=[],D=0;;){try{var w=e.indexOf("<",D);if(w<0){if(!i&&m.length>0)return a.fatalError("unclosed xml tag(s): "+m.join(", "));if(!e.substring(D).match(/^\s*$/)){var v=n.doc,E=v.createTextNode(e.substring(D));if(v.documentElement)return a.error("Extra content at the end of the document");v.appendChild(E),n.currentElement=E;}return}if(w>D){var _=e.substring(D,w);!i&&m.length===0&&(_=_.replace(new RegExp(q.S_OPT.source,"g"),""),_&&a.error("Unexpected content outside root element: '"+_+"'")),l(w);}switch(e.charAt(w+1)){case "/":var I=e.indexOf(">",w+2),b=e.substring(w+2,I>0?I:void 0);if(!b)return a.fatalError("end tag name missing");var y=I>0&&q.reg("^",q.QName_group,q.S_OPT,"$").exec(b);if(!y)return a.fatalError('end tag name contains invalid characters: "'+b+'"');if(!n.currentElement&&!n.doc.documentElement)return;var A=m[m.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+'" != "'+b+'"')}var C=g.pop();m.pop();var M=C.localNSMap;if(n.endElement(C.uri,C.localName,A),M)for(var x in M)nr(M,x)&&n.endPrefixMapping(x);I++;break;case "?":d&&p(w),I=su(e,w,n,a);break;case "!":d&&p(w),I=Zi(e,w,n,a,i);break;default:d&&p(w);var O=new Ki,U=g[g.length-1].currentNSMap,I=nu(e,w,O,U,o,a,i),Y=O.length;if(O.closed||(i&&Ct.isHTMLVoidElement(O.tagName)?O.closed=!0:m.push(O.tagName)),d&&Y){for(var z=Vi(d,{}),B=0;B<Y;B++){var L=O[B];p(L.offset),L.locator=Vi(d,{});}n.locator=z,Gi(O,n,U)&&g.push(O),n.locator=d;}else Gi(O,n,U)&&g.push(O);i&&!O.closed?I=iu(e,I,O.tagName,o,n):I++;}}catch(k){if(k instanceof Hi)throw k;if(k instanceof tu)throw new Hi(k.name+": "+k.message,n.locator,k);a.error("element parse error: "+k),I=-1;}I>D?D=I:l(Math.max(w,D)+1);}}h(ru,"parse");function Vi(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}h(Vi,"copyLocator");function nu(e,t,r,n,a,i,s){function o(p,g,m){if(nr(r.attributeNames,p))return i.fatalError("Attribute "+p+" redefined");if(!s&&g.indexOf("<")>=0)return i.fatalError("Unescaped '<' not allowed in attributes values");r.addValue(p,g.replace(/[\t\n\r]/g," ").replace(wn,a),m);}h(o,"addAttribute");for(var l,u,f=++t,c=er;;){var d=e.charAt(f);switch(d){case "=":if(c===Xe)l=e.slice(t,f),c=tr;else if(c===bt)c=tr;else throw new Error("attribute equal must after attrName");break;case "'":case '"':if(c===tr||c===Xe)if(c===Xe&&(i.warning('attribute value must after "="'),l=e.slice(t,f)),t=f+1,f=e.indexOf(d,t),f>0)u=e.slice(t,f),o(l,u,t-1),c=Nt;else throw new Error("attribute value no end '"+d+"' match");else if(c==At)u=e.slice(t,f),o(l,u,t),i.warning('attribute "'+l+'" missed start quot('+d+")!!"),t=f+1,c=Nt;else throw new Error('attribute value must after "="');break;case "/":switch(c){case er:r.setTagName(e.slice(t,f));case Nt:case rr:case Nr:c=Nr,r.closed=true;case At:case Xe:break;case bt:r.closed=true;break;default:throw new Error("attribute invalid close char('/')")}break;case "":return i.error("unexpected end of input"),c==er&&r.setTagName(e.slice(t,f)),f;case ">":switch(c){case er:r.setTagName(e.slice(t,f));case Nt:case rr:case Nr:break;case At:case Xe:u=e.slice(t,f),u.slice(-1)==="/"&&(r.closed=true,u=u.slice(0,-1));case bt:c===bt&&(u=l),c==At?(i.warning('attribute "'+u+'" missed quot(")!'),o(l,u,t)):(s||i.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),o(u,u,t));break;case tr:if(!s)return i.fatalError(`AttValue: ' or " expected`)}return f;case "\x80":d=" ";default:if(d<=" ")switch(c){case er:r.setTagName(e.slice(t,f)),c=rr;break;case Xe:l=e.slice(t,f),c=bt;break;case At:var u=e.slice(t,f);i.warning('attribute "'+u+'" missed quot(")!!'),o(l,u,t);case Nt:c=rr;break}else switch(c){case bt:s||i.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,t),t=f,c=Xe;break;case Nt:i.warning('attribute space is required"'+l+'"!!');case rr:c=Xe,t=f;break;case tr:c=At,t=f;break;case Nr:throw new Error("elements closed character '/' and '>' must be connected to")}}f++;}}h(nu,"parseElementStartPart");function Gi(e,t,r){for(var n=e.tagName,a=null,c=e.length;c--;){var i=e[c],s=i.qName,o=i.value,d=s.indexOf(":");if(d>0)var l=i.prefix=s.slice(0,d),u=s.slice(d+1),f=l==="xmlns"&&u;else u=s,l=null,f=s==="xmlns"&&"";i.localName=u,f!==false&&(a==null&&(a=Object.create(null),Qi(r,r=Object.create(null))),r[f]=a[f]=o,i.uri=Wi.XMLNS,t.startPrefixMapping(f,o));}for(var c=e.length;c--;)i=e[c],i.prefix&&(i.prefix==="xml"&&(i.uri=Wi.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)nr(a,l)&&t.endPrefixMapping(l);}else return e.currentNSMap=r,e.localNSMap=a,true}h(Gi,"appendElement");function iu(e,t,r,n,a){var i=Zo(r);if(i||eu(r)){var s=e.indexOf("</"+r+">",t),o=e.substring(t+1,s);return i&&(o=o.replace(wn,n)),a.characters(o,0,o.length),s}return t+1}h(iu,"parseHtmlSpecialContent");function Qi(e,t){for(var r in e)nr(e,r)&&(t[r]=e[r]);}h(Qi,"_copy");function Ji(e,t){var r=t;function n(f){return f=f||0,e.charAt(r+f)}h(n,"char");function a(f){f=f||1,r+=f;}h(a,"skip");function i(){for(var f=0;r<e.length;){var c=n();if(c!==" "&&c!==`
|
|
3
|
+
`&&c!==" "&&c!=="\r")return f;f++,a();}return -1}h(i,"skipBlanks");function s(){return e.substring(r)}h(s,"substringFromIndex");function o(f){return e.substring(r,r+f.length)===f}h(o,"substringStartsWith");function l(f){return e.substring(r,r+f.length).toUpperCase()===f.toUpperCase()}h(l,"substringStartsWithCaseInsensitive");function u(f){var c=q.reg("^",f),d=c.exec(s());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:s,substringStartsWith:o,substringStartsWithCaseInsensitive:l}}h(Ji,"parseUtils");function au(e,t){function r(o,l){var u=q.PI.exec(o.substringFromIndex());return u?u[1].toLowerCase()==="xml"?l.fatalError("xml declaration is only allowed at the start of the document, but found at position "+o.getIndex()):(o.skip(u[0].length),u[0]):l.fatalError("processing instruction is not well-formed at position "+o.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 s=null;if(e.char()==="<"&&e.char(1)==="!")switch(e.char(2)){case "E":e.char(3)==="L"?s=e.getMatch(q.elementdecl):e.char(3)==="N"&&(s=e.getMatch(q.EntityDecl));break;case "A":s=e.getMatch(q.AttlistDecl);break;case "N":s=e.getMatch(q.NotationDecl);break;case "-":s=e.getMatch(q.Comment);break}else if(e.char()==="<"&&e.char(1)==="?")s=r(e,t);else if(e.char()==="%")s=e.getMatch(q.PEReference);else return t.fatalError("Error detected in Markup declaration");if(!s)return t.fatalError("Error in internal subset at position "+e.getIndex())}return t.fatalError("doctype internal subset is not well-formed, missing ]")}}h(au,"parseDoctypeInternalSubset");function Zi(e,t,r,n,a){var i=Ji(e,t);switch(a?i.char(2).toUpperCase():i.char(2)){case "-":var s=i.getMatch(q.Comment);return s?(r.comment(s,q.COMMENT_START.length,s.length-q.COMMENT_START.length-q.COMMENT_END.length),i.getIndex()):n.fatalError("comment is not well-formed at position "+i.getIndex());case "[":var o=i.getMatch(q.CDSect);return o?!a&&!r.currentElement?n.fatalError("CDATA outside of element"):(r.startCDATA(),r.characters(o,q.CDATA_START.length,o.length-q.CDATA_START.length-q.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(q.DOCTYPE_DECL_START):!i.substringStartsWith(q.DOCTYPE_DECL_START))return n.fatalError("Expected "+q.DOCTYPE_DECL_START+" at position "+i.getIndex());if(i.skip(q.DOCTYPE_DECL_START.length),i.skipBlanks()<1)return n.fatalError("Expected whitespace after "+q.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(q.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(q.PUBLIC)||i.substringStartsWith(q.SYSTEM)){var u=q.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(q.SYSTEM)){if(i.skip(q.SYSTEM.length),i.skipBlanks()<1)return n.fatalError("Expected whitespace after "+q.SYSTEM+" at position "+i.getIndex());if(l.systemId=i.getMatch(q.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return n.fatalError("Expected "+q.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+q.SYSTEM+" at position "+i.getIndex())}return a&&l.systemId&&!q.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+i.getIndex()),a||(i.skipBlanks(),l.internalSubset=au(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(Zi,"parseDoctypeCommentOrCData");function su(e,t,r,n){var a=e.substring(t).match(q.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(!q.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(su,"parseProcessingInstruction");function Ki(){this.attributeNames=Object.create(null);}h(Ki,"ElementAttributes");Ki.prototype={setTagName:h(function(e){if(!q.QName_exact.test(e))throw new Error("invalid tagName:"+e);this.tagName=e;},"setTagName"),addValue:h(function(e,t,r){if(!q.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")};Cr.XMLReader=Xi;Cr.parseUtils=Ji;Cr.parseDoctypeCommentOrCData=Zi;});var oa=Ie(xt=>{var it=rt(),ou=_n(),uu=Ht(),ta=ji(),lu=ea(),cu=ou.DOMImplementation,fu=it.hasDefaultHTMLNamespace,hu=it.isHTMLMimeType,du=it.isValidMimeType,ia=it.MIME_TYPE,vn=it.NAMESPACE,ra=uu.ParseError,pu=lu.XMLReader;function aa(e){return e.replace(/\r[\n\u0085]/g,`
|
|
4
4
|
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
5
|
-
`)}h(
|
|
6
|
-
`,f),c==-1&&(c=l.length-1);var p=l.substring(f,c+1);(n.hasOwnProperty?n.hasOwnProperty(p):n[p]!==void 0)?s+=String.fromCharCode(n[p]):(d==i&&(p=l.substring(f),c=l.length),s+=String.fromCharCode(d),n[p]=d,r[d++]=p),f=c+1;}return s}h(o,"diff_linesToCharsMunge_");var i=4e4,a=o(e);i=65535;var u=o(t);return {chars1:a,chars2:u,lineArray:r}};T.prototype.diff_charsToLines_=function(e,t){for(var r=0;r<e.length;r++){for(var n=e[r][1],o=[],i=0;i<n.length;i++)o[i]=t[n.charCodeAt(i)];e[r][1]=o.join("");}};T.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),o=n,i=0;r<o;)e.substring(i,o)==t.substring(i,o)?(r=o,i=r):n=o,o=Math.floor((n-r)/2+r);return o};T.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),o=n,i=0;r<o;)e.substring(e.length-o,e.length-i)==t.substring(t.length-o,t.length-i)?(r=o,i=r):n=o,o=Math.floor((n-r)/2+r);return o};T.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 o=Math.min(r,n);if(e==t)return o;for(var i=0,a=1;;){var u=e.substring(o-a),l=t.indexOf(u);if(l==-1)return i;a+=l,(l==0||e.substring(o-a)==t.substring(0,a))&&(i=a,a++);}};T.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 o=this;function i(m,g,b){for(var _=m.substring(b,b+Math.floor(m.length/4)),v=-1,E="",w,D,y,A;(v=g.indexOf(_,v+1))!=-1;){var C=o.diff_commonPrefix(m.substring(b),g.substring(v)),N=o.diff_commonSuffix(m.substring(0,b),g.substring(0,v));E.length<N+C&&(E=g.substring(v-N,v)+g.substring(v,v+C),w=m.substring(0,b-N),D=m.substring(b+C),y=g.substring(0,v-N),A=g.substring(v+C));}return E.length*2>=m.length?[w,D,y,A,E]:null}h(i,"diff_halfMatchI_");var a=i(r,n,Math.ceil(r.length/4)),u=i(r,n,Math.ceil(r.length/2)),l;if(!a&&!u)return null;u?a?l=a[4].length>u[4].length?a:u:l=u:l=a;var s,f,c,d;e.length>t.length?(s=l[0],f=l[1],c=l[2],d=l[3]):(c=l[0],d=l[1],s=l[2],f=l[3]);var p=l[4];return [s,f,c,d,p]};T.prototype.diff_cleanupSemantic=function(e){for(var t=false,r=[],n=0,o=null,i=0,a=0,u=0,l=0,s=0;i<e.length;)e[i][0]==q?(r[n++]=i,a=l,u=s,l=0,s=0,o=e[i][1]):(e[i][0]==Z?l+=e[i][1].length:s+=e[i][1].length,o&&o.length<=Math.max(a,u)&&o.length<=Math.max(l,s)&&(e.splice(r[n-1],0,new T.Diff(J,o)),e[r[n-1]+1][0]=Z,n--,n--,i=n>0?r[n-1]:-1,a=0,u=0,l=0,s=0,o=null,t=true)),i++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),i=1;i<e.length;){if(e[i-1][0]==J&&e[i][0]==Z){var f=e[i-1][1],c=e[i][1],d=this.diff_commonOverlap_(f,c),p=this.diff_commonOverlap_(c,f);d>=p?(d>=f.length/2||d>=c.length/2)&&(e.splice(i,0,new T.Diff(q,c.substring(0,d))),e[i-1][1]=f.substring(0,f.length-d),e[i+1][1]=c.substring(d),i++):(p>=f.length/2||p>=c.length/2)&&(e.splice(i,0,new T.Diff(q,f.substring(0,p))),e[i-1][0]=Z,e[i-1][1]=c.substring(0,c.length-p),e[i+1][0]=J,e[i+1][1]=f.substring(p),i++),i++;}i++;}};T.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),_=g.match(T.nonAlphaNumericRegex_),v=b.match(T.nonAlphaNumericRegex_),E=_&&g.match(T.whitespaceRegex_),w=v&&b.match(T.whitespaceRegex_),D=E&&g.match(T.linebreakRegex_),y=w&&b.match(T.linebreakRegex_),A=D&&p.match(T.blanklineEndRegex_),C=y&&m.match(T.blanklineStartRegex_);return A||C?5:D||y?4:_&&!E&&w?3:E||w?2:_||v?1:0}h(t,"diff_cleanupSemanticScore_");for(var r=1;r<e.length-1;){if(e[r-1][0]==q&&e[r+1][0]==q){var n=e[r-1][1],o=e[r][1],i=e[r+1][1],a=this.diff_commonSuffix(n,o);if(a){var u=o.substring(o.length-a);n=n.substring(0,n.length-a),o=u+o.substring(0,o.length-a),i=u+i;}for(var l=n,s=o,f=i,c=t(n,o)+t(o,i);o.charAt(0)===i.charAt(0);){n+=o.charAt(0),o=o.substring(1)+i.charAt(0),i=i.substring(1);var d=t(n,o)+t(o,i);d>=c&&(c=d,l=n,s=o,f=i);}e[r-1][1]!=l&&(l?e[r-1][1]=l:(e.splice(r-1,1),r--),e[r][1]=s,f?e[r+1][1]=f:(e.splice(r+1,1),r--));}r++;}};T.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;T.whitespaceRegex_=/\s/;T.linebreakRegex_=/[\r\n]/;T.blanklineEndRegex_=/\n\r?\n$/;T.blanklineStartRegex_=/^\r?\n\r?\n/;T.prototype.diff_cleanupEfficiency=function(e){for(var t=false,r=[],n=0,o=null,i=0,a=false,u=false,l=false,s=false;i<e.length;)e[i][0]==q?(e[i][1].length<this.Diff_EditCost&&(l||s)?(r[n++]=i,a=l,u=s,o=e[i][1]):(n=0,o=null),l=s=false):(e[i][0]==J?s=true:l=true,o&&(a&&u&&l&&s||o.length<this.Diff_EditCost/2&&a+u+l+s==3)&&(e.splice(r[n-1],0,new T.Diff(J,o)),e[r[n-1]+1][0]=Z,n--,o=null,a&&u?(l=s=true,n=0):(n--,i=n>0?r[n-1]:-1,l=s=false),t=true)),i++;t&&this.diff_cleanupMerge(e);};T.prototype.diff_cleanupMerge=function(e){e.push(new T.Diff(q,""));for(var t=0,r=0,n=0,o="",i="",a;t<e.length;)switch(e[t][0]){case Z:n++,i+=e[t][1],t++;break;case J:r++,o+=e[t][1],t++;break;case q:r+n>1?(r!==0&&n!==0&&(a=this.diff_commonPrefix(i,o),a!==0&&(t-r-n>0&&e[t-r-n-1][0]==q?e[t-r-n-1][1]+=i.substring(0,a):(e.splice(0,0,new T.Diff(q,i.substring(0,a))),t++),i=i.substring(a),o=o.substring(a)),a=this.diff_commonSuffix(i,o),a!==0&&(e[t][1]=i.substring(i.length-a)+e[t][1],i=i.substring(0,i.length-a),o=o.substring(0,o.length-a))),t-=r+n,e.splice(t,r+n),o.length&&(e.splice(t,0,new T.Diff(J,o)),t++),i.length&&(e.splice(t,0,new T.Diff(Z,i)),t++),t++):t!==0&&e[t-1][0]==q?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,n=0,r=0,o="",i="";break}e[e.length-1][1]===""&&e.pop();var u=false;for(t=1;t<e.length-1;)e[t-1][0]==q&&e[t+1][0]==q&&(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),u=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),u=true)),t++;u&&this.diff_cleanupMerge(e);};T.prototype.diff_xIndex=function(e,t){var r=0,n=0,o=0,i=0,a;for(a=0;a<e.length&&(e[a][0]!==Z&&(r+=e[a][1].length),e[a][0]!==J&&(n+=e[a][1].length),!(r>t));a++)o=r,i=n;return e.length!=a&&e[a][0]===J?i:i+(t-o)};T.prototype.diff_prettyHtml=function(e){for(var t=[],r=/&/g,n=/</g,o=/>/g,i=/\n/g,a=0;a<e.length;a++){var u=e[a][0],l=e[a][1],s=l.replace(r,"&").replace(n,"<").replace(o,">").replace(i,"¶<br>");switch(u){case Z:t[a]='<ins style="background:#e6ffe6;">'+s+"</ins>";break;case J:t[a]='<del style="background:#ffe6e6;">'+s+"</del>";break;case q:t[a]="<span>"+s+"</span>";break}}return t.join("")};T.prototype.diff_text1=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==Z&&(t[r]=e[r][1]);return t.join("")};T.prototype.diff_text2=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==J&&(t[r]=e[r][1]);return t.join("")};T.prototype.diff_levenshtein=function(e){for(var t=0,r=0,n=0,o=0;o<e.length;o++){var i=e[o][0],a=e[o][1];switch(i){case Z:r+=a.length;break;case J:n+=a.length;break;case q:t+=Math.max(r,n),r=0,n=0;break}}return t+=Math.max(r,n),t};T.prototype.diff_toDelta=function(e){for(var t=[],r=0;r<e.length;r++)switch(e[r][0]){case Z:t[r]="+"+encodeURI(e[r][1]);break;case J:t[r]="-"+e[r][1].length;break;case q:t[r]="="+e[r][1].length;break}return t.join(" ").replace(/%20/g," ")};T.prototype.diff_fromDelta=function(e,t){for(var r=[],n=0,o=0,i=t.split(/\t/g),a=0;a<i.length;a++){var u=i[a].substring(1);switch(i[a].charAt(0)){case "+":try{r[n++]=new T.Diff(Z,decodeURI(u));}catch{throw new Error("Illegal escape in diff_fromDelta: "+u)}break;case "-":case "=":var l=parseInt(u,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+u);var s=e.substring(o,o+=l);i[a].charAt(0)=="="?r[n++]=new T.Diff(q,s):r[n++]=new T.Diff(J,s);break;default:if(i[a])throw new Error("Invalid diff operation in diff_fromDelta: "+i[a])}}if(o!=e.length)throw new Error("Delta length ("+o+") does not equal source text length ("+e.length+").");return r};T.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};T.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),o=this;function i(w,D){var y=w/t.length,A=Math.abs(r-D);return o.Match_Distance?y+A/o.Match_Distance:A?1:y}h(i,"match_bitapScore_");var a=this.Match_Threshold,u=e.indexOf(t,r);u!=-1&&(a=Math.min(i(0,u),a),u=e.lastIndexOf(t,r+t.length),u!=-1&&(a=Math.min(i(0,u),a)));var l=1<<t.length-1;u=-1;for(var s,f,c=t.length+e.length,d,p=0;p<t.length;p++){for(s=0,f=c;s<f;)i(p,r+f)<=a?s=f:c=f,f=Math.floor((c-s)/2+s);c=f;var m=Math.max(1,r-f+1),g=Math.min(r+f,e.length)+t.length,b=Array(g+2);b[g+1]=(1<<p)-1;for(var _=g;_>=m;_--){var v=n[e.charAt(_-1)];if(p===0?b[_]=(b[_+1]<<1|1)&v:b[_]=(b[_+1]<<1|1)&v|((d[_+1]|d[_])<<1|1)|d[_+1],b[_]&l){var E=i(p,_-1);if(E<=a)if(a=E,u=_-1,u>r)m=Math.max(1,2*r-u);else break}}if(i(p+1,r)>a)break;d=b;}return u};T.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};T.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 o=t.substring(e.start2-n,e.start2);o&&e.diffs.unshift(new T.Diff(q,o));var i=t.substring(e.start2+e.length1,e.start2+e.length1+n);i&&e.diffs.push(new T.Diff(q,i)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+i.length,e.length2+=o.length+i.length;}};T.prototype.patch_make=function(e,t,r){var n,o;if(typeof e=="string"&&typeof t=="string"&&typeof r>"u")n=e,o=this.diff_main(n,t,true),o.length>2&&(this.diff_cleanupSemantic(o),this.diff_cleanupEfficiency(o));else if(e&&typeof e=="object"&&typeof t>"u"&&typeof r>"u")o=e,n=this.diff_text1(o);else if(typeof e=="string"&&t&&typeof t=="object"&&typeof r>"u")n=e,o=t;else if(typeof e=="string"&&typeof t=="string"&&r&&typeof r=="object")n=e,o=r;else throw new Error("Unknown call format to patch_make.");if(o.length===0)return [];for(var i=[],a=new T.patch_obj,u=0,l=0,s=0,f=n,c=n,d=0;d<o.length;d++){var p=o[d][0],m=o[d][1];switch(!u&&p!==q&&(a.start1=l,a.start2=s),p){case Z:a.diffs[u++]=o[d],a.length2+=m.length,c=c.substring(0,s)+m+c.substring(s);break;case J:a.length1+=m.length,a.diffs[u++]=o[d],c=c.substring(0,s)+c.substring(s+m.length);break;case q:m.length<=2*this.Patch_Margin&&u&&o.length!=d+1?(a.diffs[u++]=o[d],a.length1+=m.length,a.length2+=m.length):m.length>=2*this.Patch_Margin&&u&&(this.patch_addContext_(a,f),i.push(a),a=new T.patch_obj,u=0,f=c,l=s);break}p!==Z&&(l+=m.length),p!==J&&(s+=m.length);}return u&&(this.patch_addContext_(a,f),i.push(a)),i};T.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],o=new T.patch_obj;o.diffs=[];for(var i=0;i<n.diffs.length;i++)o.diffs[i]=new T.Diff(n.diffs[i][0],n.diffs[i][1]);o.start1=n.start1,o.start2=n.start2,o.length1=n.length1,o.length2=n.length2,t[r]=o;}return t};T.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,o=[],i=0;i<e.length;i++){var a=e[i].start2+n,u=this.diff_text1(e[i].diffs),l,s=-1;if(u.length>this.Match_MaxBits?(l=this.match_main(t,u.substring(0,this.Match_MaxBits),a),l!=-1&&(s=this.match_main(t,u.substring(u.length-this.Match_MaxBits),a+u.length-this.Match_MaxBits),(s==-1||l>=s)&&(l=-1))):l=this.match_main(t,u,a),l==-1)o[i]=false,n-=e[i].length2-e[i].length1;else {o[i]=true,n=l-a;var f;if(s==-1?f=t.substring(l,l+u.length):f=t.substring(l,s+this.Match_MaxBits),u==f)t=t.substring(0,l)+this.diff_text2(e[i].diffs)+t.substring(l+u.length);else {var c=this.diff_main(u,f,false);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(c)/u.length>this.Patch_DeleteThreshold)o[i]=false;else {this.diff_cleanupSemanticLossless(c);for(var d=0,p,m=0;m<e[i].diffs.length;m++){var g=e[i].diffs[m];g[0]!==q&&(p=this.diff_xIndex(c,d)),g[0]===Z?t=t.substring(0,l+p)+g[1]+t.substring(l+p):g[0]===J&&(t=t.substring(0,l+p)+t.substring(l+this.diff_xIndex(c,d+g[1].length))),g[0]!==J&&(d+=g[1].length);}}}}}return t=t.substring(r.length,t.length-r.length),[t,o]};T.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 o=e[0],i=o.diffs;if(i.length==0||i[0][0]!=q)i.unshift(new T.Diff(q,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>i[0][1].length){var a=t-i[0][1].length;i[0][1]=r.substring(i[0][1].length)+i[0][1],o.start1-=a,o.start2-=a,o.length1+=a,o.length2+=a;}if(o=e[e.length-1],i=o.diffs,i.length==0||i[i.length-1][0]!=q)i.push(new T.Diff(q,r)),o.length1+=t,o.length2+=t;else if(t>i[i.length-1][1].length){var a=t-i[i.length-1][1].length;i[i.length-1][1]+=r.substring(0,a),o.length1+=a,o.length2+=a;}return r};T.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 o=n.start1,i=n.start2,a="";n.diffs.length!==0;){var u=new T.patch_obj,l=true;for(u.start1=o-a.length,u.start2=i-a.length,a!==""&&(u.length1=u.length2=a.length,u.diffs.push(new T.Diff(q,a)));n.diffs.length!==0&&u.length1<t-this.Patch_Margin;){var s=n.diffs[0][0],f=n.diffs[0][1];s===Z?(u.length2+=f.length,i+=f.length,u.diffs.push(n.diffs.shift()),l=false):s===J&&u.diffs.length==1&&u.diffs[0][0]==q&&f.length>2*t?(u.length1+=f.length,o+=f.length,l=false,u.diffs.push(new T.Diff(s,f)),n.diffs.shift()):(f=f.substring(0,t-u.length1-this.Patch_Margin),u.length1+=f.length,o+=f.length,s===q?(u.length2+=f.length,i+=f.length):l=false,u.diffs.push(new T.Diff(s,f)),f==n.diffs[0][1]?n.diffs.shift():n.diffs[0][1]=n.diffs[0][1].substring(f.length));}a=this.diff_text2(u.diffs),a=a.substring(a.length-this.Patch_Margin);var c=this.diff_text1(n.diffs).substring(0,this.Patch_Margin);c!==""&&(u.length1+=c.length,u.length2+=c.length,u.diffs.length!==0&&u.diffs[u.diffs.length-1][0]===q?u.diffs[u.diffs.length-1][1]+=c:u.diffs.push(new T.Diff(q,c))),l||e.splice(++r,0,u);}}};T.prototype.patch_toText=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=e[r];return t.join("")};T.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var r=e.split(`
|
|
7
|
-
`),n=0,
|
|
8
|
-
`],n,
|
|
9
|
-
`;}return r.join("").replace(/%20/g," ")};It.exports=T;It.exports.diff_match_patch=T;It.exports.DIFF_DELETE=J;It.exports.DIFF_INSERT=Z;It.exports.DIFF_EQUAL=
|
|
10
|
-
`):r,
|
|
11
|
-
`+i;return
|
|
12
|
-
`+i):(
|
|
13
|
-
`+i),new n8nWorkflow.NodeApiError(this.getNode(),{message:i,errors:o},{message:u,description:l,itemIndex:t})}return a.includes("invalid docx")||a.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(On,"mapAdeuErrorToNodeApiError");function Zo(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(Zo,"isStashedBinaryEntry");var Rn=[{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 Bn(e){let t=this.getNodeParameter("staticDataKey",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("onMissing",e),o=this.getNodeParameter("clearAfterRead",e),i=this.getWorkflowStaticData("global"),a=i[t];if(!Zo(a)){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:u,fileName:l,mimeType:s}=a,f;try{let g=await this.helpers.getBinaryStream(u);f=await this.helpers.binaryToBuffer(g);}catch(g){throw new n8nWorkflow.NodeOperationError(this.getNode(),`Failed to load stashed binary (id=${u}) from external storage.`,{description:`The stash entry under "${t}" points at binary id "${u}", 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 c=s||et,d=await this.helpers.prepareBinaryData(f,l,c);o&&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",_=new Date().toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");m=p.replaceAll("{baseName}",g).replaceAll("{timestamp}",_).replaceAll("{fileName}",l).replaceAll("{ext}",b);}return [{json:{hydrated:true,fileName:l,sourceBinaryId:u,mimeType:c,...m!==void 0?{outputPath:m}:{}},binary:{[r]:d},pairedItem:{item:e}}]}h(Bn,"executeHydrateToolOutput");var Wn=Ur(Ln());var Ko=(0, Wn.createRequire)("/"),ft,ea,ta;try{ft=Ko("worker_threads"),ea=ft.Worker,ta=ft.isMarkedAsUntransferable;}catch{}var re=Uint8Array,ye=Uint16Array,Zr=Int32Array,cr=new re([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]),fr=new re([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]),Vr=new re([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hn=h(function(e,t){for(var r=new ye(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var o=new Zr(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)o[i]=i-r[n]<<5|n;return {b:r,r:o}},"freb"),ft=Hn(cr,2),Vn=ft.b,Gr=ft.r;Vn[28]=258,Gr[258]=28;var Gn=Hn(fr,0),ra=Gn.b,$n=Gn.r,Xr=new ye(32768);for(X=0;X<32768;++X)Le=(X&43690)>>1|(X&21845)<<1,Le=(Le&52428)>>2|(Le&13107)<<2,Le=(Le&61680)>>4|(Le&3855)<<4,Xr[X]=((Le&65280)>>8|(Le&255)<<8)>>1;var Le,X,Pe=h((function(e,t,r){for(var n=e.length,o=0,i=new ye(t);o<n;++o)e[o]&&++i[e[o]-1];var a=new ye(t);for(o=1;o<t;++o)a[o]=a[o-1]+i[o-1]<<1;var u;if(r){u=new ye(1<<t);var l=15-t;for(o=0;o<n;++o)if(e[o])for(var s=o<<4|e[o],f=t-e[o],c=a[e[o]-1]++<<f,d=c|(1<<f)-1;c<=d;++c)u[Xr[c]>>l]=s;}else for(u=new ye(n),o=0;o<n;++o)e[o]&&(u[o]=Xr[a[e[o]-1]++]>>15-e[o]);return u}),"hMap"),je=new re(288);for(X=0;X<144;++X)je[X]=8;var X;for(X=144;X<256;++X)je[X]=9;var X;for(X=256;X<280;++X)je[X]=7;var X;for(X=280;X<288;++X)je[X]=8;var X,Ft=new re(32);for(X=0;X<32;++X)Ft[X]=5;var X,na=Pe(je,9,0),ia=Pe(je,9,1),oa=Pe(Ft,5,0),aa=Pe(Ft,5,1),zr=h(function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},"max"),xe=h(function(e,t,r){var n=t/8|0;return (e[n]|e[n+1]<<8)>>(t&7)&r},"bits"),jr=h(function(e,t){var r=t/8|0;return (e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},"bits16"),Kr=h(function(e){return (e+7)/8|0},"shft"),Lt=h(function(e,t,r){return (t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new re(e.subarray(t,r))},"slc");var sa=["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"],he=h(function(e,t,r){var n=new Error(t||sa[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,he),!r)throw n;return n},"err"),ua=h(function(e,t,r,n){var o=e.length,i=n?n.length:0;if(!o||t.f&&!t.l)return r||new re(0);var a=!r,u=a||t.i!=2,l=t.i;a&&(r=new re(o*3));var s=h(function(Ot){var Mt=r.length;if(Ot>Mt){var ct=new re(Math.max(Mt*2,Ot));ct.set(r),r=ct;}},"cbuf"),f=t.f||0,c=t.p||0,d=t.b||0,p=t.l,m=t.d,g=t.m,b=t.n,_=o*8;do{if(!p){f=xe(e,c,1);var v=xe(e,c+1,3);if(c+=3,v)if(v==1)p=ia,m=aa,g=9,b=5;else if(v==2){var y=xe(e,c,31)+257,A=xe(e,c+10,15)+4,C=y+xe(e,c+5,31)+1;c+=14;for(var N=new re(C),B=new re(19),x=0;x<A;++x)B[Vr[x]]=xe(e,c+x*3,7);c+=A*3;for(var M=zr(B),z=(1<<M)-1,P=Pe(B,M,1),x=0;x<C;){var G=P[xe(e,c,z)];c+=G&15;var E=G>>4;if(E<16)N[x++]=E;else {var $=0,R=0;for(E==16?(R=3+xe(e,c,3),c+=2,$=N[x-1]):E==17?(R=3+xe(e,c,7),c+=3):E==18&&(R=11+xe(e,c,127),c+=7);R--;)N[x++]=$;}}var j=N.subarray(0,y),I=N.subarray(y);g=zr(j),b=zr(I),p=Pe(j,g,1),m=Pe(I,b,1);}else he(1);else {var E=Kr(c)+4,w=e[E-4]|e[E-3]<<8,D=E+w;if(D>o){l&&he(0);break}u&&s(d+w),r.set(e.subarray(E,D),d),t.b=d+=w,t.p=c=D*8,t.f=f;continue}if(c>_){l&&he(0);break}}u&&s(d+131072);for(var Q=(1<<g)-1,K=(1<<b)-1,oe=c;;oe=c){var $=p[jr(e,c)&Q],we=$>>4;if(c+=$&15,c>_){l&&he(0);break}if($||he(2),we<256)r[d++]=we;else if(we==256){oe=c,p=null;break}else {var ve=we-254;if(we>264){var x=we-257,te=cr[x];ve=xe(e,c,(1<<te)-1)+Vn[x],c+=te;}var Se=m[jr(e,c)&K],ut=Se>>4;Se||he(3),c+=Se&15;var I=ra[ut];if(ut>3){var te=fr[ut];I+=jr(e,c)&(1<<te)-1,c+=te;}if(c>_){l&&he(0);break}u&&s(d+131072);var lt=d+ve;if(d<I){var ar=i-I,sr=Math.min(I,lt);for(ar+d<0&&he(3);d<sr;++d)r[d]=n[ar+d];}for(;d<lt;++d)r[d]=r[d-I];}}t.l=p,t.p=oe,t.b=d,t.f=f,p&&(f=1,t.m=g,t.d=m,t.n=b);}while(!f);return d!=r.length&&a?Lt(r,0,d):r.subarray(0,d)},"inflt"),$e=h(function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8;},"wbits"),Rt=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"),Wr=h(function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var o=r.length,i=r.slice();if(!o)return {t:Yn,l:0};if(o==1){var a=new re(r[0].s+1);return a[r[0].s]=1,{t:a,l:1}}r.sort(function(D,y){return D.f-y.f}),r.push({s:-1,f:25001});var u=r[0],l=r[1],s=0,f=1,c=2;for(r[0]={s:-1,f:u.f+l.f,l:u,r:l};f!=o-1;)u=r[r[s].f<r[c].f?s++:c++],l=r[s!=f&&r[s].f<r[c].f?s++:c++],r[f++]={s:-1,f:u.f+l.f,l:u,r:l};for(var d=i[0].s,n=1;n<o;++n)i[n].s>d&&(d=i[n].s);var p=new ye(d+1),m=Yr(r[f-1],p,0);if(m>t){var n=0,g=0,b=m-t,_=1<<b;for(i.sort(function(y,A){return p[A.s]-p[y.s]||y.f-A.f});n<o;++n){var v=i[n].s;if(p[v]>t)g+=_-(1<<m-p[v]),p[v]=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 w=i[n].s;p[w]==t&&(--p[w],++g);}m=t;}return {t:new re(p),l:m}},"hTree"),Yr=h(function(e,t,r){return e.s==-1?Math.max(Yr(e.l,t,r+1),Yr(e.r,t,r+1)):t[e.s]=r},"ln"),Un=h(function(e){for(var t=e.length;t&&!e[--t];);for(var r=new ye(++t),n=0,o=e[0],i=1,a=h(function(l){r[n++]=l;},"w"),u=1;u<=t;++u)if(e[u]==o&&u!=t)++i;else {if(!o&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0);}else if(i>3){for(a(o),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0);}for(;i--;)a(o);i=1,o=e[u];}return {c:r.subarray(0,n),n:t}},"lc"),Bt=h(function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},"clen"),Xn=h(function(e,t,r){var n=r.length,o=Kr(t+2);e[o]=n&255,e[o+1]=n>>8,e[o+2]=e[o]^255,e[o+3]=e[o+1]^255;for(var i=0;i<n;++i)e[o+i+4]=r[i];return (o+4+n)*8},"wfblk"),qn=h(function(e,t,r,n,o,i,a,u,l,s,f){$e(t,f++,r),++o[256];for(var c=Wr(o,15),d=c.t,p=c.l,m=Wr(i,15),g=m.t,b=m.l,_=Un(d),v=_.c,E=_.n,w=Un(g),D=w.c,y=w.n,A=new ye(19),C=0;C<v.length;++C)++A[v[C]&31];for(var C=0;C<D.length;++C)++A[D[C]&31];for(var N=Wr(A,7),B=N.t,x=N.l,M=19;M>4&&!B[Vr[M-1]];--M);var z=s+5<<3,P=Bt(o,je)+Bt(i,Ft)+a,G=Bt(o,d)+Bt(i,g)+a+14+3*M+Bt(A,B)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&z<=P&&z<=G)return Xn(t,f,e.subarray(l,l+s));var $,R,j,I;if($e(t,f,1+(G<P)),f+=2,G<P){$=Pe(d,p,0),R=d,j=Pe(g,b,0),I=g;var Q=Pe(B,x,0);$e(t,f,E-257),$e(t,f+5,y-1),$e(t,f+10,M-4),f+=14;for(var C=0;C<M;++C)$e(t,f+3*C,B[Vr[C]]);f+=3*M;for(var K=[v,D],oe=0;oe<2;++oe)for(var we=K[oe],C=0;C<we.length;++C){var ve=we[C]&31;$e(t,f,Q[ve]),f+=B[ve],ve>15&&($e(t,f,we[C]>>5&127),f+=we[C]>>12);}}else $=na,R=je,j=oa,I=Ft;for(var C=0;C<u;++C){var te=n[C];if(te>255){var ve=te>>18&31;Rt(t,f,$[ve+257]),f+=R[ve+257],ve>7&&($e(t,f,te>>23&31),f+=cr[ve]);var Se=te&31;Rt(t,f,j[Se]),f+=I[Se],Se>3&&(Rt(t,f,te>>5&8191),f+=fr[Se]);}else Rt(t,f,$[te]),f+=R[te];}return Rt(t,f,$[256]),f+R[256]},"wblk"),la=new Zr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yn=new re(0),ca=h(function(e,t,r,n,o,i){var a=i.z||e.length,u=new re(n+a+5*(1+Math.ceil(a/7e3))+o),l=u.subarray(n,u.length-o),s=i.l,f=(i.r||0)&7;if(t){f&&(l[0]=i.r>>3);for(var c=la[t-1],d=c>>13,p=c&8191,m=(1<<r)-1,g=i.p||new ye(32768),b=i.h||new ye(m+1),_=Math.ceil(r/3),v=2*_,E=h(function(Lr){return (e[Lr]^e[Lr+1]<<_^e[Lr+2]<<v)&m},"hsh"),w=new Zr(25e3),D=new ye(288),y=new ye(32),A=0,C=0,N=i.i||0,B=0,x=i.w||0,M=0;N+2<a;++N){var z=E(N),P=N&32767,G=b[z];if(g[P]=G,b[z]=P,x<=N){var $=a-N;if((A>7e3||B>24576)&&($>423||!s)){f=qn(e,l,0,w,D,y,C,B,M,N-M,f),B=A=C=0,M=N;for(var R=0;R<286;++R)D[R]=0;for(var R=0;R<30;++R)y[R]=0;}var j=2,I=0,Q=p,K=P-G&32767;if($>2&&z==E(N-K))for(var oe=Math.min(d,$)-1,we=Math.min(32767,N),ve=Math.min(258,$);K<=we&&--Q&&P!=G;){if(e[N+j]==e[N+j-K]){for(var te=0;te<ve&&e[N+te]==e[N+te-K];++te);if(te>j){if(j=te,I=K,te>oe)break;for(var Se=Math.min(K,te-2),ut=0,R=0;R<Se;++R){var lt=N-K+R&32767,ar=g[lt],sr=lt-ar&32767;sr>ut&&(ut=sr,G=lt);}}}P=G,G=g[P],K+=P-G&32767;}if(I){w[B++]=268435456|Gr[j]<<18|$n[I];var Ot=Gr[j]&31,Mt=$n[I]&31;C+=cr[Ot]+fr[Mt],++D[257+Ot],++y[Mt],x=N+j,++A;}else w[B++]=e[N],++D[e[N]];}}for(N=Math.max(N,x);N<a;++N)w[B++]=e[N],++D[e[N]];f=qn(e,l,s,w,D,y,C,B,M,N-M,f),s||(i.r=f&7|l[f/8|0]<<3,f-=7,i.h=b,i.p=g,i.i=N,i.w=x);}else {for(var N=i.w||0;N<a+s;N+=65535){var ct=N+65535;ct>=a&&(l[f/8|0]=s,ct=a),f=Xn(l,f+1,e.subarray(N,ct));}i.i=a;}return Lt(u,0,n+Kr(f)+o)},"dflt"),fa=(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})(),ha=h(function(){var e=-1;return {p:h(function(t){for(var r=e,n=0;n<t.length;++n)r=fa[r&255^t[n]]^r>>>8;e=r;},"p"),d:h(function(){return ~e},"d")}},"crc");var da=h(function(e,t,r,n,o){if(!o&&(o={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),a=new re(i.length+e.length);a.set(i),a.set(e,i.length),e=a,o.w=i.length;}return ca(e,t.level==null?6:t.level,t.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,o)},"dopt"),Qn=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 ke=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"),Hr=h(function(e,t){return De(e,t)+De(e,t+4)*4294967296},"b8"),ue=h(function(e,t,r){for(;r;++t)e[t]=r,r>>>=8;},"wbytes");function pa(e,t){return da(e,t||{},0,0)}h(pa,"deflateSync");function ma(e,t){return ua(e,{i:2},t&&t.out,t&&t.dictionary)}h(ma,"inflateSync");var Jn=h(function(e,t,r,n){for(var o in e){var i=e[o],a=t+o,u=n;Array.isArray(i)&&(u=Qn(n,i[1]),i=i[0]),ArrayBuffer.isView(i)?r[a]=[i,u]:(r[a+="/"]=[new re(0),u],Jn(i,a,r,n));}},"fltn"),zn=typeof TextEncoder<"u"&&new TextEncoder,Qr=typeof TextDecoder<"u"&&new TextDecoder,ga=0;try{Qr.decode(Yn,{stream:!0}),ga=1;}catch{}var _a=h(function(e){for(var t="",r=0;;){var n=e[r++],o=(n>127)+(n>223)+(n>239);if(r+o>e.length)return {s:t,r:Lt(e,r-1)};o?o==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)):o&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 lr(e,t){if(t){for(var r=new re(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(zn)return zn.encode(e);for(var o=e.length,i=new re(e.length+(e.length>>1)),a=0,u=h(function(f){i[a++]=f;},"w"),n=0;n<o;++n){if(a+5>i.length){var l=new re(a+8+(o-n<<1));l.set(i),i=l;}var s=e.charCodeAt(n);s<128||t?u(s):s<2048?(u(192|s>>6),u(128|s&63)):s>55295&&s<57344?(s=65536+(s&1047552)|e.charCodeAt(++n)&1023,u(240|s>>18),u(128|s>>12&63),u(128|s>>6&63),u(128|s&63)):(u(224|s>>12),u(128|s>>6&63),u(128|s&63));}return Lt(i,0,a)}h(lr,"strToU8");function hr(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(Qr)return Qr.decode(e);var o=_a(e),i=o.s,r=o.r;return r.length&&he(8),i}}h(hr,"strFromU8");var wa=h(function(e,t){return t+30+ke(e,t+26)+ke(e,t+28)},"slzh"),va=h(function(e,t,r){var n=ke(e,t+28),o=ke(e,t+30),i=hr(e.subarray(t+46,t+46+n),!(ke(e,t+8)&2048)),a=t+46+n,u=ya(e,a,o,r,De(e,t+20),De(e,t+24),De(e,t+42)),l=u[0],s=u[1],f=u[2];return [ke(e,t+10),l,s,i,a+o+ke(e,t+32),f]},"zh"),ya=h(function(e,t,r,n,o,i,a){var u=o==4294967295,l=i==4294967295,s=a==4294967295,f=t+r,c=u+l+s;if(n&&c){for(;t+4<f;t+=4+ke(e,t+2))if(ke(e,t)==1)return [u?Hr(e,t+4+8*l):o,l?Hr(e,t+4):i,s?Hr(e,t+4+8*(l+u)):a,1];n<2&&he(13);}return [o,i,a,0]},"z64hs"),Jr=h(function(e){var t=0;if(e)for(var r in e){var n=e[r].length;n>65535&&he(9),t+=n+4;}return t},"exfl"),jn=h(function(e,t,r,n,o,i,a,u){var l=n.length,s=r.extra,f=u&&u.length,c=Jr(s);ue(e,t,a!=null?33639248:67324752),t+=4,a!=null&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(i<0&&8),e[t++]=o&&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)&&he(10),ue(e,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,i!=-1&&(ue(e,t,r.crc),ue(e,t+4,i<0?-i-2:i),ue(e,t+8,r.size)),ue(e,t+12,l),ue(e,t+14,c),t+=16,a!=null&&(ue(e,t,f),ue(e,t+6,r.attrs),ue(e,t+10,a),t+=14),e.set(n,t),t+=l,c)for(var m in s){var g=s[m],b=g.length;ue(e,t,+m),ue(e,t+2,b),e.set(g,t+4),t+=4+b;}return f&&(e.set(u,t),t+=f),t},"wzh"),Ea=h(function(e,t,r,n,o){ue(e,t,101010256),ue(e,t+8,r),ue(e,t+10,r),ue(e,t+12,n),ue(e,t+16,o);},"wzf");function Zn(e,t){t||(t={});var r={},n=[];Jn(e,"",r,t);var o=0,i=0;for(var a in r){var u=r[a],l=u[0],s=u[1],f=s.level==0?0:8,c=lr(a),d=c.length,p=s.comment,m=p&&lr(p),g=m&&m.length,b=Jr(s.extra);d>65535&&he(11);var _=f?pa(l,s):l,v=_.length,E=ha();E.p(l),n.push(Qn(s,{size:l.length,crc:E.d(),c:_,f:c,m,u:d!=a.length||m&&p.length!=g,o,compression:f})),o+=30+d+b+v,i+=76+2*(d+b)+(g||0)+v;}for(var w=new re(i+22),D=o,y=i-o,A=0;A<n.length;++A){var c=n[A];jn(w,c.o,c,c.f,c.u,c.c.length);var C=30+c.f.length+Jr(c.extra);w.set(c.c,c.o+C),jn(w,o,c,c.f,c.u,c.c.length,c.o,c.m),o+=16+C+(c.m?c.m.length:0);}return Ea(w,o,n.length,y,D),w}h(Zn,"zipSync");function Kn(e,t){for(var r={},n=e.length-22;De(e,n)!=101010256;--n)(!n||e.length-n>65558)&&he(13);var o=ke(e,n+8);if(!o)return {};var i=De(e,n+16),a=De(e,n-20)==117853008;if(a){var u=De(e,n-12);a=De(e,u)==101075792,a&&(o=De(e,u+32),i=De(e,u+48));}for(var l=t&&t.filter,s=0;s<o;++s){var f=va(e,i,a),c=f[0],d=f[1],p=f[2],m=f[3],g=f[4],b=f[5],_=wa(e,b);i=g,(!l||l({name:m,size:d,originalSize:p,compression:c}))&&(c?c==8?r[m]=ma(e.subarray(_,_+d),{out:new re(p)}):he(14,"unknown compression type "+c):r[m]=Lt(e,_,_+d));}return r}h(Kn,"unzipSync");var Rr=Ur(uo()),ko=Ur(lo());function O(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(O,"findChild");function hu(e,t){let r=[];for(let n=0;n<e.childNodes.length;n++){let o=e.childNodes[n];o.nodeType===1&&o.tagName===t&&r.push(o);}return r}h(hu,"findChildren");function S(e,t){return Array.from(e.getElementsByTagName(t))}h(S,"findAllDescendants");function Dn(e){return e.startsWith("\uFEFF")&&(e=e.slice(1)),new Rr.DOMParser().parseFromString(e,"text/xml")}h(Dn,"parseXml");function du(e){let t=new Rr.XMLSerializer().serializeToString(e),n=/<([a-zA-Z0-9_:]+)(\s+[^>]+?)(>|\/>)/.exec(t);if(n&&!n[1].startsWith("?")){let o=n.index,i=t.substring(0,o);if(!i.includes("<")||i.trim().startsWith("<?xml")&&(i.match(/</g)||[]).length===1){let u=n[0],l=`<${n[1]}`,s=n[2],f=n[3],c=/([a-zA-Z0-9_:]+)\s*=\s*(["'])(.*?)\2/g,d=[],p;for(;(p=c.exec(s))!==null;)d.push(p[0].trim());d.sort((g,b)=>{let _=g.split("=")[0].trim(),v=b.split("=")[0].trim(),E=_.startsWith("xmlns"),w=v.startsWith("xmlns");return E&&!w?-1:!E&&w?1:_<v?-1:_>v?1:0});let m=d.length>0?`${l} ${d.join(" ")}${f}`:`${l}${f}`;t=t.substring(0,o)+m+t.substring(o+u.length);}}return t}h(du,"serializeXml");var Or=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},_o=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 Or(e,t,r,n)),this.partname.endsWith(".rels")){let o=this._element.ownerDocument;if(o){let i=o.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);}}}},pu=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=Dn(r),o=new _o(e,r,n.documentElement,t);o.package=this,this.parts.push(o);let i=this.getPartByPath("[Content_Types].xml");if(i){let a=i._element.ownerDocument;if(a){let u=a.createElement("Override");u.setAttribute("PartName",e),u.setAttribute("ContentType",t),i._element.appendChild(u);}}return o}getOrCreateRelsPart(e){let t=e.split("/"),r=t.pop(),n=t.join("/")+"/_rels/"+r+".rels",o=this.getPartByPath(n);return o||(o=this.addPart(n,"application/vnd.openxmlformats-package.relationships+xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
14
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`)),
|
|
15
|
-
`+r),this.pkg.unzipped[t.partname.substring(1)]=lr(r);}return Buffer.from(Zn(this.pkg.unzipped))}},Ze=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}},Ke=class{static{h(this,"Run");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},mu=class{static{h(this,"Cell");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},gu=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 mu(r[n],this));}_element;_parent;cells=[]},An=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 gu(r[n],this));}_element;_parent;rows=[]},co=class{static{h(this,"NotesPart");}constructor(e,t){this.part=e,this.note_type=t,this._element=e._element;}part;note_type;_element},_u=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},pe={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"},Ee={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"},Ye={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"},ir=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(Ee.COMMENTS);if(e)return this._linkPart(e,Ye.COMMENTS);let t=this.doc.pkg.nextPartname("/word/comments%d.xml"),r=`<w:comments xmlns:w="${pe.w}" xmlns:w14="${pe.w14}" xmlns:w15="${pe.w15}" xmlns:w16cid="${pe.w16cid}" xmlns:w16cex="${pe.w16cex}" xmlns:mc="${pe.mc}" mc:Ignorable="w14 w15 w16cid w16cex"></w:comments>`;return e=this.doc.pkg.addPart(t,Ee.COMMENTS,r),this.doc.relateTo(e,Ye.COMMENTS),e}_getOrCreateExtendedPart(){let e=this._getExistingPartByType(Ee.EXTENDED);if(e)return this._linkPart(e,Ye.EXTENDED);let t=this.doc.pkg.nextPartname("/word/commentsExtended%d.xml"),r=`<w15:commentsEx xmlns:w15="${pe.w15}"></w15:commentsEx>`;return e=this.doc.pkg.addPart(t,Ee.EXTENDED,r),this.doc.relateTo(e,Ye.EXTENDED),e}_getOrCreateIdsPart(){let e=this._getExistingPartByType(Ee.IDS);if(e)return this._linkPart(e,Ye.IDS);let t=this.doc.pkg.nextPartname("/word/commentsIds%d.xml"),r=`<w16cid:commentsIds xmlns:w16cid="${pe.w16cid}"></w16cid:commentsIds>`;return e=this.doc.pkg.addPart(t,Ee.IDS,r),this.doc.relateTo(e,Ye.IDS),e}_getOrCreateExtensiblePart(){let e=this._getExistingPartByType(Ee.EXTENSIBLE);if(e)return this._linkPart(e,Ye.EXTENSIBLE);let t=this.doc.pkg.nextPartname("/word/commentsExtensible%d.xml"),r=`<w16cex:commentsExtensible xmlns:w16cex="${pe.w16cex}"></w16cex:commentsExtensible>`;return e=this.doc.pkg.addPart(t,Ee.EXTENSIBLE,r),this.doc.relateTo(e,Ye.EXTENSIBLE),e}_ensureNamespaces(){let e=this._commentsPart?._element;if(!e)return;let t=[["xmlns:w",pe.w],["xmlns:w14",pe.w14],["xmlns:w15",pe.w15],["xmlns:w16cid",pe.w16cid],["xmlns:w16cex",pe.w16cex],["xmlns:mc",pe.mc]];for(let[r,n]of t)e.getAttribute(r)||e.setAttribute(r,n);}_getNextCommentId(){let e=[0],t=this._getExistingPartByType(Ee.COMMENTS);if(t){let r=S(t._element,"w:comment");for(let n of r){let o=n.getAttribute("w:id");o&&e.push(parseInt(o,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(Ee.EXTENDED);if(!t||!r)return t;for(let n=0;n<r._element.childNodes.length;n++){let o=r._element.childNodes[n];if(o.nodeType===1&&o.getAttribute("w15:paraId")===t){let i=o.getAttribute("w15:paraIdParent");if(i)return i}}return t}addComment(e,t,r=null){let n=this.nextId.toString();this.nextId++;let o=new Date().toISOString().replace(/\.\d{3}Z$/,"Z"),i=this.commentsPart._element.ownerDocument,a=i.createElement("w:comment");a.setAttribute("w:id",n),a.setAttribute("w:author",e),a.setAttribute("w:date",o);let u=this._getInitials(e);u&&a.setAttribute("w:initials",u);let l=this._getExistingPartByType(Ee.EXTENDED);r&&!l&&a.setAttribute("w15:p",r);let s=this._generateHexId(),f=this._generateHexId(),c=i.createElement("w:p");c.setAttribute("w14:paraId",s),c.setAttribute("w14:textId","77777777"),c.setAttribute("w:rsidR",f),c.setAttribute("w:rsidRDefault",f),c.setAttribute("w:rsidP",f);let d=i.createElement("w:pPr"),p=i.createElement("w:pStyle");p.setAttribute("w:val","CommentText"),d.appendChild(p),c.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")),c.appendChild(m);let _=i.createElement("w:r"),v=i.createElement("w:t");if(v.textContent=t,_.appendChild(v),c.appendChild(_),a.appendChild(c),this.commentsPart._element.appendChild(a),this.extendedPart){let E=r?this._findThreadRootParaId(r):null,D=this.extendedPart._element.ownerDocument.createElement("w15:commentEx");D.setAttribute("w15:paraId",s),E&&D.setAttribute("w15:paraIdParent",E),D.setAttribute("w15:done","0"),this.extendedPart._element.appendChild(D);}if(this.idsPart){let w=this.idsPart._element.ownerDocument.createElement("w16cid:commentId");w.setAttribute("w16cid:paraId",s),w.setAttribute("w16cid:durableId",this._generateHexId()),this.idsPart._element.appendChild(w);}if(this.extensiblePart){let E=null;for(let w=0;w<this.idsPart._element.childNodes.length;w++){let D=this.idsPart._element.childNodes[w];if(D.nodeType===1&&D.getAttribute("w16cid:paraId")===s){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",o),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 o=n.getAttribute("w14:paraId");if(o){r=o;break}}if(r){let n=[];if(this.extendedPart)for(let i=0;i<this.extendedPart._element.childNodes.length;i++){let a=this.extendedPart._element.childNodes[i];if(a.nodeType===1&&a.getAttribute("w15:paraIdParent")===r){let u=a.getAttribute("w15:paraId");if(u){for(let l of S(this.commentsPart._element,"w:comment"))for(let s of S(l,"w:p"))if(s.getAttribute("w14:paraId")===u){let f=l.getAttribute("w:id");f&&n.push(f);break}}}}for(let i of n)this.deleteComment(i);let o=null;if(this.idsPart){let i=[];for(let a=0;a<this.idsPart._element.childNodes.length;a++){let u=this.idsPart._element.childNodes[a];u.nodeType===1&&u.getAttribute("w16cid:paraId")===r&&(o=u.getAttribute("w16cid:durableId"),i.push(u));}i.forEach(a=>this.idsPart._element.removeChild(a));}if(this.extendedPart){let i=[];for(let a=0;a<this.extendedPart._element.childNodes.length;a++){let u=this.extendedPart._element.childNodes[a];u.nodeType===1&&u.getAttribute("w15:paraId")===r&&i.push(u);}i.forEach(a=>this.extendedPart._element.removeChild(a));}if(o&&this.extensiblePart){let i=[];for(let a=0;a<this.extensiblePart._element.childNodes.length;a++){let u=this.extensiblePart._element.childNodes[a];u.nodeType===1&&u.getAttribute("w16cex:durableId")===o&&i.push(u);}i.forEach(a=>this.extensiblePart._element.removeChild(a));}}t.parentNode&&t.parentNode.removeChild(t);}};function Br(e){({part:e.mainDocumentPart,relateTo:h(()=>{},"relateTo")});let n={},o=e.parts.find(l=>l.contentType===Ee.COMMENTS);if(!o)return n;let i={},a=S(o._element,"w:comment");for(let l of a){let s=l.getAttribute("w:id");if(!s)continue;let f=l.getAttribute("w:author")||"Unknown",c=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 v of g){let E=v.getAttribute("w14:paraId");E&&(i[E]=s);}let b=[];for(let v of g){let E=S(v,"w:t");for(let w of E)w.textContent&&b.push(w.textContent);b.push(`
|
|
16
|
-
`);}let
|
|
5
|
+
`)}h(aa,"normalizeLineEndings");function sa(e){if(e=e||{},e.locator===void 0&&(e.locator=true),this.assign=e.assign||it.assign,this.domHandler=e.domHandler||xr,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||aa,this.locator=!!e.locator,this.xmlns=this.assign(Object.create(null),e.xmlns);}h(sa,"DOMParser");sa.prototype.parseFromString=function(e,t){if(!du(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var r=this.assign(Object.create(null),this.xmlns),n=ta.XML_ENTITIES,a=r[""]||null;fu(t)?(n=ta.HTML_ENTITIES,a=vn.HTML):t===ia.XML_SVG_IMAGE&&(a=vn.SVG),r[""]=a,r.xml=r.xml||vn.XML;var i=new this.domHandler({mimeType:t,defaultNamespace:a,onError:this.onError}),s=this.locator?{}:void 0;this.locator&&i.setDocumentLocator(s);var o=new pu;o.errorHandler=i,o.domBuilder=i;var l=!it.isHTMLMimeType(t);return l&&typeof e!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(e)),r,n),i.doc.documentElement||o.errorHandler.fatalError("missing root element"),i.doc};function xr(e){var t=e||{};this.mimeType=t.mimeType||ia.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(xr,"DOMHandler");function Tt(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber;}h(Tt,"position");xr.prototype={startDocument:h(function(){var e=new cu;this.doc=hu(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),s=n.length;Tr(this,i),this.currentElement=i,this.locator&&Tt(this.locator,i);for(var o=0;o<s;o++){var e=n.getURI(o),l=n.getValue(o),r=n.getQName(o),u=a.createAttributeNS(e,r);this.locator&&Tt(n.getLocator(o),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&&Tt(this.locator,r),Tr(this,r);},"processingInstruction"),ignorableWhitespace:h(function(e,t,r){},"ignorableWhitespace"),characters:h(function(e,t,r){if(e=na.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&&Tt(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=na.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Tt(this.locator,n),Tr(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&&Tt(this.locator,i),Tr(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 ra("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 ra(e,this.locator)},"fatalError")};function na(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(na,"_toString");"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){xr.prototype[e]=function(){return null};});function Tr(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t);}h(Tr,"appendElement");function mu(e){if(e==="error")throw "onErrorStopParsing"}h(mu,"onErrorStopParsing");function gu(){throw "onWarningStopParsing"}h(gu,"onWarningStopParsing");xt.__DOMHandler=xr;xt.DOMParser=sa;xt.normalizeLineEndings=aa;xt.onErrorStopParsing=mu;xt.onWarningStopParsing=gu;});var ua=Ie(G=>{var St=rt();G.assign=St.assign;G.hasDefaultHTMLNamespace=St.hasDefaultHTMLNamespace;G.isHTMLMimeType=St.isHTMLMimeType;G.isValidMimeType=St.isValidMimeType;G.MIME_TYPE=St.MIME_TYPE;G.NAMESPACE=St.NAMESPACE;var Sr=Ht();G.DOMException=Sr.DOMException;G.DOMExceptionName=Sr.DOMExceptionName;G.ExceptionCode=Sr.ExceptionCode;G.ParseError=Sr.ParseError;var oe=_n();G.Attr=oe.Attr;G.CDATASection=oe.CDATASection;G.CharacterData=oe.CharacterData;G.Comment=oe.Comment;G.Document=oe.Document;G.DocumentFragment=oe.DocumentFragment;G.DocumentType=oe.DocumentType;G.DOMImplementation=oe.DOMImplementation;G.Element=oe.Element;G.Entity=oe.Entity;G.EntityReference=oe.EntityReference;G.LiveNodeList=oe.LiveNodeList;G.NamedNodeMap=oe.NamedNodeMap;G.Node=oe.Node;G.NodeList=oe.NodeList;G.Notation=oe.Notation;G.ProcessingInstruction=oe.ProcessingInstruction;G.Text=oe.Text;G.XMLSerializer=oe.XMLSerializer;var Ir=oa();G.DOMParser=Ir.DOMParser;G.normalizeLineEndings=Ir.normalizeLineEndings;G.onErrorStopParsing=Ir.onErrorStopParsing;G.onWarningStopParsing=Ir.onWarningStopParsing;});var la=Ie((dc,It)=>{var T=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"),J=-1,Z=1,j=0;T.Diff=function(e,t){return [e,t]};T.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 T.Diff(j,e)]:[];typeof r>"u"&&(r=true);var i=r,s=this.diff_commonPrefix(e,t),o=e.substring(0,s);e=e.substring(s),t=t.substring(s),s=this.diff_commonSuffix(e,t);var l=e.substring(e.length-s);e=e.substring(0,e.length-s),t=t.substring(0,t.length-s);var u=this.diff_compute_(e,t,i,a);return o&&u.unshift(new T.Diff(j,o)),l&&u.push(new T.Diff(j,l)),this.diff_cleanupMerge(u),u};T.prototype.diff_compute_=function(e,t,r,n){var a;if(!e)return [new T.Diff(Z,t)];if(!t)return [new T.Diff(J,e)];var i=e.length>t.length?e:t,s=e.length>t.length?t:e,o=i.indexOf(s);if(o!=-1)return a=[new T.Diff(Z,i.substring(0,o)),new T.Diff(j,s),new T.Diff(Z,i.substring(o+s.length))],e.length>t.length&&(a[0][0]=a[2][0]=J),a;if(s.length==1)return [new T.Diff(J,e),new T.Diff(Z,t)];var l=this.diff_halfMatch_(e,t);if(l){var u=l[0],f=l[1],c=l[2],d=l[3],p=l[4],g=this.diff_main(u,c,r,n),m=this.diff_main(f,d,r,n);return g.concat([new T.Diff(j,p)],m)}return r&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,n):this.diff_bisect_(e,t,n)};T.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 T.Diff(j,""));for(var s=0,o=0,l=0,u="",f="";s<i.length;){switch(i[s][0]){case Z:l++,f+=i[s][1];break;case J:o++,u+=i[s][1];break;case j:if(o>=1&&l>=1){i.splice(s-o-l,o+l),s=s-o-l;for(var c=this.diff_main(u,f,false,r),d=c.length-1;d>=0;d--)i.splice(s,0,c[d]);s=s+c.length;}l=0,o=0,u="",f="";break}s++;}return i.pop(),i};T.prototype.diff_bisect_=function(e,t,r){for(var n=e.length,a=t.length,i=Math.ceil((n+a)/2),s=i,o=2*i,l=new Array(o),u=new Array(o),f=0;f<o;f++)l[f]=-1,u[f]=-1;l[s+1]=0,u[s+1]=0;for(var c=n-a,d=c%2!=0,p=0,g=0,m=0,D=0,w=0;w<i&&!(new Date().getTime()>r);w++){for(var v=-w+p;v<=w-g;v+=2){var E=s+v,_;v==-w||v!=w&&l[E-1]<l[E+1]?_=l[E+1]:_=l[E-1]+1;for(var b=_-v;_<n&&b<a&&e.charAt(_)==t.charAt(b);)_++,b++;if(l[E]=_,_>n)g+=2;else if(b>a)p+=2;else if(d){var y=s+c-v;if(y>=0&&y<o&&u[y]!=-1){var A=n-u[y];if(_>=A)return this.diff_bisectSplit_(e,t,_,b,r)}}}for(var N=-w+m;N<=w-D;N+=2){var y=s+N,A;N==-w||N!=w&&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)D+=2;else if(C>a)m+=2;else if(!d){var E=s+c-N;if(E>=0&&E<o&&l[E]!=-1){var _=l[E],b=s+_-E;if(A=n-A,_>=A)return this.diff_bisectSplit_(e,t,_,b,r)}}}}return [new T.Diff(J,e),new T.Diff(Z,t)]};T.prototype.diff_bisectSplit_=function(e,t,r,n,a){var i=e.substring(0,r),s=t.substring(0,n),o=e.substring(r),l=t.substring(n),u=this.diff_main(i,s,false,a),f=this.diff_main(o,l,false,a);return u.concat(f)};T.prototype.diff_linesToChars_=function(e,t){var r=[],n={};r[0]="";function a(l){for(var u="",f=0,c=-1,d=r.length;c<l.length-1;){c=l.indexOf(`
|
|
6
|
+
`,f),c==-1&&(c=l.length-1);var p=l.substring(f,c+1);(n.hasOwnProperty?n.hasOwnProperty(p):n[p]!==void 0)?u+=String.fromCharCode(n[p]):(d==i&&(p=l.substring(f),c=l.length),u+=String.fromCharCode(d),n[p]=d,r[d++]=p),f=c+1;}return u}h(a,"diff_linesToCharsMunge_");var i=4e4,s=a(e);i=65535;var o=a(t);return {chars1:s,chars2:o,lineArray:r}};T.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("");}};T.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};T.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};T.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,s=1;;){var o=e.substring(a-s),l=t.indexOf(o);if(l==-1)return i;s+=l,(l==0||e.substring(a-s)==t.substring(0,s))&&(i=s,s++);}};T.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(g,m,D){for(var w=g.substring(D,D+Math.floor(g.length/4)),v=-1,E="",_,b,y,A;(v=m.indexOf(w,v+1))!=-1;){var N=a.diff_commonPrefix(g.substring(D),m.substring(v)),C=a.diff_commonSuffix(g.substring(0,D),m.substring(0,v));E.length<C+N&&(E=m.substring(v-C,v)+m.substring(v,v+N),_=g.substring(0,D-C),b=g.substring(D+N),y=m.substring(0,v-C),A=m.substring(v+N));}return E.length*2>=g.length?[_,b,y,A,E]:null}h(i,"diff_halfMatchI_");var s=i(r,n,Math.ceil(r.length/4)),o=i(r,n,Math.ceil(r.length/2)),l;if(!s&&!o)return null;o?s?l=s[4].length>o[4].length?s:o:l=o:l=s;var u,f,c,d;e.length>t.length?(u=l[0],f=l[1],c=l[2],d=l[3]):(c=l[0],d=l[1],u=l[2],f=l[3]);var p=l[4];return [u,f,c,d,p]};T.prototype.diff_cleanupSemantic=function(e){for(var t=false,r=[],n=0,a=null,i=0,s=0,o=0,l=0,u=0;i<e.length;)e[i][0]==j?(r[n++]=i,s=l,o=u,l=0,u=0,a=e[i][1]):(e[i][0]==Z?l+=e[i][1].length:u+=e[i][1].length,a&&a.length<=Math.max(s,o)&&a.length<=Math.max(l,u)&&(e.splice(r[n-1],0,new T.Diff(J,a)),e[r[n-1]+1][0]=Z,n--,n--,i=n>0?r[n-1]:-1,s=0,o=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]==J&&e[i][0]==Z){var f=e[i-1][1],c=e[i][1],d=this.diff_commonOverlap_(f,c),p=this.diff_commonOverlap_(c,f);d>=p?(d>=f.length/2||d>=c.length/2)&&(e.splice(i,0,new T.Diff(j,c.substring(0,d))),e[i-1][1]=f.substring(0,f.length-d),e[i+1][1]=c.substring(d),i++):(p>=f.length/2||p>=c.length/2)&&(e.splice(i,0,new T.Diff(j,f.substring(0,p))),e[i-1][0]=Z,e[i-1][1]=c.substring(0,c.length-p),e[i+1][0]=J,e[i+1][1]=f.substring(p),i++),i++;}i++;}};T.prototype.diff_cleanupSemanticLossless=function(e){function t(p,g){if(!p||!g)return 6;var m=p.charAt(p.length-1),D=g.charAt(0),w=m.match(T.nonAlphaNumericRegex_),v=D.match(T.nonAlphaNumericRegex_),E=w&&m.match(T.whitespaceRegex_),_=v&&D.match(T.whitespaceRegex_),b=E&&m.match(T.linebreakRegex_),y=_&&D.match(T.linebreakRegex_),A=b&&p.match(T.blanklineEndRegex_),N=y&&g.match(T.blanklineStartRegex_);return A||N?5:b||y?4:w&&!E&&_?3:E||_?2:w||v?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],s=this.diff_commonSuffix(n,a);if(s){var o=a.substring(a.length-s);n=n.substring(0,n.length-s),a=o+a.substring(0,a.length-s),i=o+i;}for(var l=n,u=a,f=i,c=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>=c&&(c=d,l=n,u=a,f=i);}e[r-1][1]!=l&&(l?e[r-1][1]=l:(e.splice(r-1,1),r--),e[r][1]=u,f?e[r+1][1]=f:(e.splice(r+1,1),r--));}r++;}};T.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;T.whitespaceRegex_=/\s/;T.linebreakRegex_=/[\r\n]/;T.blanklineEndRegex_=/\n\r?\n$/;T.blanklineStartRegex_=/^\r?\n\r?\n/;T.prototype.diff_cleanupEfficiency=function(e){for(var t=false,r=[],n=0,a=null,i=0,s=false,o=false,l=false,u=false;i<e.length;)e[i][0]==j?(e[i][1].length<this.Diff_EditCost&&(l||u)?(r[n++]=i,s=l,o=u,a=e[i][1]):(n=0,a=null),l=u=false):(e[i][0]==J?u=true:l=true,a&&(s&&o&&l&&u||a.length<this.Diff_EditCost/2&&s+o+l+u==3)&&(e.splice(r[n-1],0,new T.Diff(J,a)),e[r[n-1]+1][0]=Z,n--,a=null,s&&o?(l=u=true,n=0):(n--,i=n>0?r[n-1]:-1,l=u=false),t=true)),i++;t&&this.diff_cleanupMerge(e);};T.prototype.diff_cleanupMerge=function(e){e.push(new T.Diff(j,""));for(var t=0,r=0,n=0,a="",i="",s;t<e.length;)switch(e[t][0]){case Z:n++,i+=e[t][1],t++;break;case J:r++,a+=e[t][1],t++;break;case j:r+n>1?(r!==0&&n!==0&&(s=this.diff_commonPrefix(i,a),s!==0&&(t-r-n>0&&e[t-r-n-1][0]==j?e[t-r-n-1][1]+=i.substring(0,s):(e.splice(0,0,new T.Diff(j,i.substring(0,s))),t++),i=i.substring(s),a=a.substring(s)),s=this.diff_commonSuffix(i,a),s!==0&&(e[t][1]=i.substring(i.length-s)+e[t][1],i=i.substring(0,i.length-s),a=a.substring(0,a.length-s))),t-=r+n,e.splice(t,r+n),a.length&&(e.splice(t,0,new T.Diff(J,a)),t++),i.length&&(e.splice(t,0,new T.Diff(Z,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 o=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),o=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),o=true)),t++;o&&this.diff_cleanupMerge(e);};T.prototype.diff_xIndex=function(e,t){var r=0,n=0,a=0,i=0,s;for(s=0;s<e.length&&(e[s][0]!==Z&&(r+=e[s][1].length),e[s][0]!==J&&(n+=e[s][1].length),!(r>t));s++)a=r,i=n;return e.length!=s&&e[s][0]===J?i:i+(t-a)};T.prototype.diff_prettyHtml=function(e){for(var t=[],r=/&/g,n=/</g,a=/>/g,i=/\n/g,s=0;s<e.length;s++){var o=e[s][0],l=e[s][1],u=l.replace(r,"&").replace(n,"<").replace(a,">").replace(i,"¶<br>");switch(o){case Z:t[s]='<ins style="background:#e6ffe6;">'+u+"</ins>";break;case J:t[s]='<del style="background:#ffe6e6;">'+u+"</del>";break;case j:t[s]="<span>"+u+"</span>";break}}return t.join("")};T.prototype.diff_text1=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==Z&&(t[r]=e[r][1]);return t.join("")};T.prototype.diff_text2=function(e){for(var t=[],r=0;r<e.length;r++)e[r][0]!==J&&(t[r]=e[r][1]);return t.join("")};T.prototype.diff_levenshtein=function(e){for(var t=0,r=0,n=0,a=0;a<e.length;a++){var i=e[a][0],s=e[a][1];switch(i){case Z:r+=s.length;break;case J:n+=s.length;break;case j:t+=Math.max(r,n),r=0,n=0;break}}return t+=Math.max(r,n),t};T.prototype.diff_toDelta=function(e){for(var t=[],r=0;r<e.length;r++)switch(e[r][0]){case Z:t[r]="+"+encodeURI(e[r][1]);break;case J:t[r]="-"+e[r][1].length;break;case j:t[r]="="+e[r][1].length;break}return t.join(" ").replace(/%20/g," ")};T.prototype.diff_fromDelta=function(e,t){for(var r=[],n=0,a=0,i=t.split(/\t/g),s=0;s<i.length;s++){var o=i[s].substring(1);switch(i[s].charAt(0)){case "+":try{r[n++]=new T.Diff(Z,decodeURI(o));}catch{throw new Error("Illegal escape in diff_fromDelta: "+o)}break;case "-":case "=":var l=parseInt(o,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+o);var u=e.substring(a,a+=l);i[s].charAt(0)=="="?r[n++]=new T.Diff(j,u):r[n++]=new T.Diff(J,u);break;default:if(i[s])throw new Error("Invalid diff operation in diff_fromDelta: "+i[s])}}if(a!=e.length)throw new Error("Delta length ("+a+") does not equal source text length ("+e.length+").");return r};T.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};T.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(_,b){var y=_/t.length,A=Math.abs(r-b);return a.Match_Distance?y+A/a.Match_Distance:A?1:y}h(i,"match_bitapScore_");var s=this.Match_Threshold,o=e.indexOf(t,r);o!=-1&&(s=Math.min(i(0,o),s),o=e.lastIndexOf(t,r+t.length),o!=-1&&(s=Math.min(i(0,o),s)));var l=1<<t.length-1;o=-1;for(var u,f,c=t.length+e.length,d,p=0;p<t.length;p++){for(u=0,f=c;u<f;)i(p,r+f)<=s?u=f:c=f,f=Math.floor((c-u)/2+u);c=f;var g=Math.max(1,r-f+1),m=Math.min(r+f,e.length)+t.length,D=Array(m+2);D[m+1]=(1<<p)-1;for(var w=m;w>=g;w--){var v=n[e.charAt(w-1)];if(p===0?D[w]=(D[w+1]<<1|1)&v:D[w]=(D[w+1]<<1|1)&v|((d[w+1]|d[w])<<1|1)|d[w+1],D[w]&l){var E=i(p,w-1);if(E<=s)if(s=E,o=w-1,o>r)g=Math.max(1,2*r-o);else break}}if(i(p+1,r)>s)break;d=D;}return o};T.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};T.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 T.Diff(j,a));var i=t.substring(e.start2+e.length1,e.start2+e.length1+n);i&&e.diffs.push(new T.Diff(j,i)),e.start1-=a.length,e.start2-=a.length,e.length1+=a.length+i.length,e.length2+=a.length+i.length;}};T.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=[],s=new T.patch_obj,o=0,l=0,u=0,f=n,c=n,d=0;d<a.length;d++){var p=a[d][0],g=a[d][1];switch(!o&&p!==j&&(s.start1=l,s.start2=u),p){case Z:s.diffs[o++]=a[d],s.length2+=g.length,c=c.substring(0,u)+g+c.substring(u);break;case J:s.length1+=g.length,s.diffs[o++]=a[d],c=c.substring(0,u)+c.substring(u+g.length);break;case j:g.length<=2*this.Patch_Margin&&o&&a.length!=d+1?(s.diffs[o++]=a[d],s.length1+=g.length,s.length2+=g.length):g.length>=2*this.Patch_Margin&&o&&(this.patch_addContext_(s,f),i.push(s),s=new T.patch_obj,o=0,f=c,l=u);break}p!==Z&&(l+=g.length),p!==J&&(u+=g.length);}return o&&(this.patch_addContext_(s,f),i.push(s)),i};T.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],a=new T.patch_obj;a.diffs=[];for(var i=0;i<n.diffs.length;i++)a.diffs[i]=new T.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};T.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 s=e[i].start2+n,o=this.diff_text1(e[i].diffs),l,u=-1;if(o.length>this.Match_MaxBits?(l=this.match_main(t,o.substring(0,this.Match_MaxBits),s),l!=-1&&(u=this.match_main(t,o.substring(o.length-this.Match_MaxBits),s+o.length-this.Match_MaxBits),(u==-1||l>=u)&&(l=-1))):l=this.match_main(t,o,s),l==-1)a[i]=false,n-=e[i].length2-e[i].length1;else {a[i]=true,n=l-s;var f;if(u==-1?f=t.substring(l,l+o.length):f=t.substring(l,u+this.Match_MaxBits),o==f)t=t.substring(0,l)+this.diff_text2(e[i].diffs)+t.substring(l+o.length);else {var c=this.diff_main(o,f,false);if(o.length>this.Match_MaxBits&&this.diff_levenshtein(c)/o.length>this.Patch_DeleteThreshold)a[i]=false;else {this.diff_cleanupSemanticLossless(c);for(var d=0,p,g=0;g<e[i].diffs.length;g++){var m=e[i].diffs[g];m[0]!==j&&(p=this.diff_xIndex(c,d)),m[0]===Z?t=t.substring(0,l+p)+m[1]+t.substring(l+p):m[0]===J&&(t=t.substring(0,l+p)+t.substring(l+this.diff_xIndex(c,d+m[1].length))),m[0]!==J&&(d+=m[1].length);}}}}}return t=t.substring(r.length,t.length-r.length),[t,a]};T.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 T.Diff(j,r)),a.start1-=t,a.start2-=t,a.length1+=t,a.length2+=t;else if(t>i[0][1].length){var s=t-i[0][1].length;i[0][1]=r.substring(i[0][1].length)+i[0][1],a.start1-=s,a.start2-=s,a.length1+=s,a.length2+=s;}if(a=e[e.length-1],i=a.diffs,i.length==0||i[i.length-1][0]!=j)i.push(new T.Diff(j,r)),a.length1+=t,a.length2+=t;else if(t>i[i.length-1][1].length){var s=t-i[i.length-1][1].length;i[i.length-1][1]+=r.substring(0,s),a.length1+=s,a.length2+=s;}return r};T.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,s="";n.diffs.length!==0;){var o=new T.patch_obj,l=true;for(o.start1=a-s.length,o.start2=i-s.length,s!==""&&(o.length1=o.length2=s.length,o.diffs.push(new T.Diff(j,s)));n.diffs.length!==0&&o.length1<t-this.Patch_Margin;){var u=n.diffs[0][0],f=n.diffs[0][1];u===Z?(o.length2+=f.length,i+=f.length,o.diffs.push(n.diffs.shift()),l=false):u===J&&o.diffs.length==1&&o.diffs[0][0]==j&&f.length>2*t?(o.length1+=f.length,a+=f.length,l=false,o.diffs.push(new T.Diff(u,f)),n.diffs.shift()):(f=f.substring(0,t-o.length1-this.Patch_Margin),o.length1+=f.length,a+=f.length,u===j?(o.length2+=f.length,i+=f.length):l=false,o.diffs.push(new T.Diff(u,f)),f==n.diffs[0][1]?n.diffs.shift():n.diffs[0][1]=n.diffs[0][1].substring(f.length));}s=this.diff_text2(o.diffs),s=s.substring(s.length-this.Patch_Margin);var c=this.diff_text1(n.diffs).substring(0,this.Patch_Margin);c!==""&&(o.length1+=c.length,o.length2+=c.length,o.diffs.length!==0&&o.diffs[o.diffs.length-1][0]===j?o.diffs[o.diffs.length-1][1]+=c:o.diffs.push(new T.Diff(j,c))),l||e.splice(++r,0,o);}}};T.prototype.patch_toText=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=e[r];return t.join("")};T.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var r=e.split(`
|
|
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 s=new T.patch_obj;for(t.push(s),s.start1=parseInt(i[1],10),i[2]===""?(s.start1--,s.length1=1):i[2]=="0"?s.length1=0:(s.start1--,s.length1=parseInt(i[2],10)),s.start2=parseInt(i[3],10),i[4]===""?(s.start2--,s.length2=1):i[4]=="0"?s.length2=0:(s.start2--,s.length2=parseInt(i[4],10)),n++;n<r.length;){var o=r[n].charAt(0);try{var l=decodeURI(r[n].substring(1));}catch{throw new Error("Illegal escape in patch_fromText: "+l)}if(o=="-")s.diffs.push(new T.Diff(J,l));else if(o=="+")s.diffs.push(new T.Diff(Z,l));else if(o==" ")s.diffs.push(new T.Diff(j,l));else {if(o=="@")break;if(o!=="")throw new Error('Invalid patch mode "'+o+'" in: '+l)}n++;}}return t};T.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0;};T.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
|
+
`],n,a=0;a<this.diffs.length;a++){switch(this.diffs[a][0]){case Z:n="+";break;case J:n="-";break;case j:n=" ";break}r[a+1]=n+encodeURI(this.diffs[a][1])+`
|
|
9
|
+
`;}return r.join("").replace(/%20/g," ")};It.exports=T;It.exports.diff_match_patch=T;It.exports.DIFF_DELETE=J;It.exports.DIFF_INSERT=Z;It.exports.DIFF_EQUAL=j;});var et="application/vnd.openxmlformats-officedocument.wordprocessingml.document";function kn(e,t){return t.split(".").reduce((r,n)=>{if(r&&typeof r=="object")return r[n]},e)}h(kn,"getNestedProperty");async function ts(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(ts,"getDocxBuffer");async function Le(e,t){if(t.mode==="fromInput")return ts.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 c=await this.helpers.getBinaryStream(a);return {buffer:await this.helpers.binaryToBuffer(c),fileName:"document.docx"}}catch(c){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:c.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,"\\'"),s=`{{ $('${i}').first().binary.${n} }}`,o;try{o=this.evaluateExpression(s,e);}catch(c){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:c.message},{message:`Failed to resolve binary from source node '${r}'.`,description:`Could not evaluate '${s}'. Verify the source node name is exactly correct (case-sensitive, including spaces and punctuation). Underlying error: ${c.message}`,itemIndex:e})}if(o==null||typeof o!="object"){let c=`{{ $('${i}').first().json }}`,d;try{d=this.evaluateExpression(c,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 '${s}' 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 g=this.evaluateExpression(`{{ Object.keys($('${i}').first().binary || {}) }}`,e);Array.isArray(g)&&g.length>0?p=` Available binary properties on '${r}': `+g.map(m=>`'${m}'`).join(", ")+".":Array.isArray(g)&&g.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 '${s}' 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=o,u;try{if(l.id){let c=await this.helpers.getBinaryStream(l.id);u=await this.helpers.binaryToBuffer(c);}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(c){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:c.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: ${c.message}`,itemIndex:e})}let f=l.fileName??"document.docx";return {buffer:u,fileName:f}}h(Le,"getDocxBufferFromSource");function ur(e,t){let r=e.lastIndexOf(".");return `${r===-1?e:e.substring(0,r)}_${t}.docx`}h(ur,"buildOutputFileName");function Pn(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(Pn,"parseJsonParameter");function On(e,t){let r=e.message??"Unknown error",n=e.name??"",a=e.errors,i=Array.isArray(a)?a.join(`
|
|
10
|
+
`):r,s=i.toLowerCase();if(n==="BatchValidationError"){let o="Batch validation failed.",l=`Review the listed failures:
|
|
11
|
+
`+i;return s.includes("target text not found")?(o="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):s.includes("ambiguous match")?(o="An edit matched multiple locations in the document.",l="Provide more surrounding context in `target_text` to uniquely identify the location:\n"+i):s.includes("read-only")||s.includes("readonly")?(o="An edit targeted a read-only structural element.",l=`Cross-references, footnotes, hyperlinks, and the Structural Appendix cannot be modified via text replacement:
|
|
12
|
+
`+i):(s.includes("another author")||s.includes("nested"))&&(o="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:o,description:l,itemIndex:t})}return s.includes("invalid docx")||s.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(On,"mapAdeuErrorToNodeApiError");function rs(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(rs,"isStashedBinaryEntry");var Rn=[{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 Bn(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"),s=i[t];if(!rs(s)){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:o,fileName:l,mimeType:u}=s,f;try{let m=await this.helpers.getBinaryStream(o);f=await this.helpers.binaryToBuffer(m);}catch(m){throw new n8nWorkflow.NodeOperationError(this.getNode(),`Failed to load stashed binary (id=${o}) from external storage.`,{description:`The stash entry under "${t}" points at binary id "${o}", 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: ${m.message}`,itemIndex:e})}let c=u||et,d=await this.helpers.prepareBinaryData(f,l,c);a&&delete i[t];let p=this.getNodeParameter("outputPathTemplate",e,""),g;if(p.trim()!==""){let m=l.replace(/\.docx$/i,""),D=l.match(/\.docx$/i)?.[0]??".docx",w=new Date().toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");g=p.replaceAll("{baseName}",m).replaceAll("{timestamp}",w).replaceAll("{fileName}",l).replaceAll("{ext}",D);}return [{json:{hydrated:true,fileName:l,sourceBinaryId:o,mimeType:c,...g!==void 0?{outputPath:g}:{}},binary:{[r]:d},pairedItem:{item:e}}]}h(Bn,"executeHydrateToolOutput");var Wn=Ur(Ln());var ns=(0, Wn.createRequire)("/"),ft,is,as;try{ft=ns("worker_threads"),is=ft.Worker,as=ft.isMarkedAsUntransferable;}catch{}var ne=Uint8Array,ye=Uint16Array,Zr=Int32Array,cr=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]),fr=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]),Vr=new ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hn=h(function(e,t){for(var r=new ye(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var a=new Zr(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"),ft=Hn(cr,2),Vn=ft.b,Gr=ft.r;Vn[28]=258,Gr[258]=28;var Gn=Hn(fr,0),ss=Gn.b,$n=Gn.r,Yr=new ye(32768);for(X=0;X<32768;++X)$e=(X&43690)>>1|(X&21845)<<1,$e=($e&52428)>>2|($e&13107)<<2,$e=($e&61680)>>4|($e&3855)<<4,Yr[X]=(($e&65280)>>8|($e&255)<<8)>>1;var $e,X,Pe=h((function(e,t,r){for(var n=e.length,a=0,i=new ye(t);a<n;++a)e[a]&&++i[e[a]-1];var s=new ye(t);for(a=1;a<t;++a)s[a]=s[a-1]+i[a-1]<<1;var o;if(r){o=new ye(1<<t);var l=15-t;for(a=0;a<n;++a)if(e[a])for(var u=a<<4|e[a],f=t-e[a],c=s[e[a]-1]++<<f,d=c|(1<<f)-1;c<=d;++c)o[Yr[c]>>l]=u;}else for(o=new ye(n),a=0;a<n;++a)e[a]&&(o[a]=Yr[s[e[a]-1]++]>>15-e[a]);return o}),"hMap"),We=new ne(288);for(X=0;X<144;++X)We[X]=8;var X;for(X=144;X<256;++X)We[X]=9;var X;for(X=256;X<280;++X)We[X]=7;var X;for(X=280;X<288;++X)We[X]=8;var X,Ft=new ne(32);for(X=0;X<32;++X)Ft[X]=5;var X,os=Pe(We,9,0),us=Pe(We,9,1),ls=Pe(Ft,5,0),cs=Pe(Ft,5,1),zr=h(function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},"max"),xe=h(function(e,t,r){var n=t/8|0;return (e[n]|e[n+1]<<8)>>(t&7)&r},"bits"),jr=h(function(e,t){var r=t/8|0;return (e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},"bits16"),Kr=h(function(e){return (e+7)/8|0},"shft"),Lt=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 fs=["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||fs[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,de),!r)throw n;return n},"err"),hs=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 s=!r,o=s||t.i!=2,l=t.i;s&&(r=new ne(a*3));var u=h(function(Ot){var Mt=r.length;if(Ot>Mt){var ct=new ne(Math.max(Mt*2,Ot));ct.set(r),r=ct;}},"cbuf"),f=t.f||0,c=t.p||0,d=t.b||0,p=t.l,g=t.d,m=t.m,D=t.n,w=a*8;do{if(!p){f=xe(e,c,1);var v=xe(e,c+1,3);if(c+=3,v)if(v==1)p=us,g=cs,m=9,D=5;else if(v==2){var y=xe(e,c,31)+257,A=xe(e,c+10,15)+4,N=y+xe(e,c+5,31)+1;c+=14;for(var C=new ne(N),M=new ne(19),x=0;x<A;++x)M[Vr[x]]=xe(e,c+x*3,7);c+=A*3;for(var O=zr(M),U=(1<<O)-1,I=Pe(M,O,1),x=0;x<N;){var Y=I[xe(e,c,U)];c+=Y&15;var E=Y>>4;if(E<16)C[x++]=E;else {var z=0,B=0;for(E==16?(B=3+xe(e,c,3),c+=2,z=C[x-1]):E==17?(B=3+xe(e,c,7),c+=3):E==18&&(B=11+xe(e,c,127),c+=7);B--;)C[x++]=z;}}var L=C.subarray(0,y),k=C.subarray(y);m=zr(L),D=zr(k),p=Pe(L,m,1),g=Pe(k,D,1);}else de(1);else {var E=Kr(c)+4,_=e[E-4]|e[E-3]<<8,b=E+_;if(b>a){l&&de(0);break}o&&u(d+_),r.set(e.subarray(E,b),d),t.b=d+=_,t.p=c=b*8,t.f=f;continue}if(c>w){l&&de(0);break}}o&&u(d+131072);for(var H=(1<<m)-1,K=(1<<D)-1,ue=c;;ue=c){var z=p[jr(e,c)&H],ee=z>>4;if(c+=z&15,c>w){l&&de(0);break}if(z||de(2),ee<256)r[d++]=ee;else if(ee==256){ue=c,p=null;break}else {var ve=ee-254;if(ee>264){var x=ee-257,re=cr[x];ve=xe(e,c,(1<<re)-1)+Vn[x],c+=re;}var Se=g[jr(e,c)&K],ut=Se>>4;Se||de(3),c+=Se&15;var k=ss[ut];if(ut>3){var re=fr[ut];k+=jr(e,c)&(1<<re)-1,c+=re;}if(c>w){l&&de(0);break}o&&u(d+131072);var lt=d+ve;if(d<k){var sr=i-k,or=Math.min(k,lt);for(sr+d<0&&de(3);d<or;++d)r[d]=n[sr+d];}for(;d<lt;++d)r[d]=r[d-k];}}t.l=p,t.p=ue,t.b=d,t.f=f,p&&(f=1,t.m=m,t.d=g,t.n=D);}while(!f);return d!=r.length&&s?Lt(r,0,d):r.subarray(0,d)},"inflt"),Ue=h(function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8;},"wbits"),Rt=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"),Wr=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:Xn,l:0};if(a==1){var s=new ne(r[0].s+1);return s[r[0].s]=1,{t:s,l:1}}r.sort(function(b,y){return b.f-y.f}),r.push({s:-1,f:25001});var o=r[0],l=r[1],u=0,f=1,c=2;for(r[0]={s:-1,f:o.f+l.f,l:o,r:l};f!=a-1;)o=r[r[u].f<r[c].f?u++:c++],l=r[u!=f&&r[u].f<r[c].f?u++:c++],r[f++]={s:-1,f:o.f+l.f,l:o,r:l};for(var d=i[0].s,n=1;n<a;++n)i[n].s>d&&(d=i[n].s);var p=new ye(d+1),g=Xr(r[f-1],p,0);if(g>t){var n=0,m=0,D=g-t,w=1<<D;for(i.sort(function(y,A){return p[A.s]-p[y.s]||y.f-A.f});n<a;++n){var v=i[n].s;if(p[v]>t)m+=w-(1<<g-p[v]),p[v]=t;else break}for(m>>=D;m>0;){var E=i[n].s;p[E]<t?m-=1<<t-p[E]++-1:++n;}for(;n>=0&&m;--n){var _=i[n].s;p[_]==t&&(--p[_],++m);}g=t;}return {t:new ne(p),l:g}},"hTree"),Xr=h(function(e,t,r){return e.s==-1?Math.max(Xr(e.l,t,r+1),Xr(e.r,t,r+1)):t[e.s]=r},"ln"),Un=h(function(e){for(var t=e.length;t&&!e[--t];);for(var r=new ye(++t),n=0,a=e[0],i=1,s=h(function(l){r[n++]=l;},"w"),o=1;o<=t;++o)if(e[o]==a&&o!=t)++i;else {if(!a&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0);}else if(i>3){for(s(a),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0);}for(;i--;)s(a);i=1,a=e[o];}return {c:r.subarray(0,n),n:t}},"lc"),Bt=h(function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},"clen"),Yn=h(function(e,t,r){var n=r.length,a=Kr(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"),qn=h(function(e,t,r,n,a,i,s,o,l,u,f){Ue(t,f++,r),++a[256];for(var c=Wr(a,15),d=c.t,p=c.l,g=Wr(i,15),m=g.t,D=g.l,w=Un(d),v=w.c,E=w.n,_=Un(m),b=_.c,y=_.n,A=new ye(19),N=0;N<v.length;++N)++A[v[N]&31];for(var N=0;N<b.length;++N)++A[b[N]&31];for(var C=Wr(A,7),M=C.t,x=C.l,O=19;O>4&&!M[Vr[O-1]];--O);var U=u+5<<3,I=Bt(a,We)+Bt(i,Ft)+s,Y=Bt(a,d)+Bt(i,m)+s+14+3*O+Bt(A,M)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&U<=I&&U<=Y)return Yn(t,f,e.subarray(l,l+u));var z,B,L,k;if(Ue(t,f,1+(Y<I)),f+=2,Y<I){z=Pe(d,p,0),B=d,L=Pe(m,D,0),k=m;var H=Pe(M,x,0);Ue(t,f,E-257),Ue(t,f+5,y-1),Ue(t,f+10,O-4),f+=14;for(var N=0;N<O;++N)Ue(t,f+3*N,M[Vr[N]]);f+=3*O;for(var K=[v,b],ue=0;ue<2;++ue)for(var ee=K[ue],N=0;N<ee.length;++N){var ve=ee[N]&31;Ue(t,f,H[ve]),f+=M[ve],ve>15&&(Ue(t,f,ee[N]>>5&127),f+=ee[N]>>12);}}else z=os,B=We,L=ls,k=Ft;for(var N=0;N<o;++N){var re=n[N];if(re>255){var ve=re>>18&31;Rt(t,f,z[ve+257]),f+=B[ve+257],ve>7&&(Ue(t,f,re>>23&31),f+=cr[ve]);var Se=re&31;Rt(t,f,L[Se]),f+=k[Se],Se>3&&(Rt(t,f,re>>5&8191),f+=fr[Se]);}else Rt(t,f,z[re]),f+=B[re];}return Rt(t,f,z[256]),f+B[256]},"wblk"),ds=new Zr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Xn=new ne(0),ps=h(function(e,t,r,n,a,i){var s=i.z||e.length,o=new ne(n+s+5*(1+Math.ceil(s/7e3))+a),l=o.subarray(n,o.length-a),u=i.l,f=(i.r||0)&7;if(t){f&&(l[0]=i.r>>3);for(var c=ds[t-1],d=c>>13,p=c&8191,g=(1<<r)-1,m=i.p||new ye(32768),D=i.h||new ye(g+1),w=Math.ceil(r/3),v=2*w,E=h(function(Lr){return (e[Lr]^e[Lr+1]<<w^e[Lr+2]<<v)&g},"hsh"),_=new Zr(25e3),b=new ye(288),y=new ye(32),A=0,N=0,C=i.i||0,M=0,x=i.w||0,O=0;C+2<s;++C){var U=E(C),I=C&32767,Y=D[U];if(m[I]=Y,D[U]=I,x<=C){var z=s-C;if((A>7e3||M>24576)&&(z>423||!u)){f=qn(e,l,0,_,b,y,N,M,O,C-O,f),M=A=N=0,O=C;for(var B=0;B<286;++B)b[B]=0;for(var B=0;B<30;++B)y[B]=0;}var L=2,k=0,H=p,K=I-Y&32767;if(z>2&&U==E(C-K))for(var ue=Math.min(d,z)-1,ee=Math.min(32767,C),ve=Math.min(258,z);K<=ee&&--H&&I!=Y;){if(e[C+L]==e[C+L-K]){for(var re=0;re<ve&&e[C+re]==e[C+re-K];++re);if(re>L){if(L=re,k=K,re>ue)break;for(var Se=Math.min(K,re-2),ut=0,B=0;B<Se;++B){var lt=C-K+B&32767,sr=m[lt],or=lt-sr&32767;or>ut&&(ut=or,Y=lt);}}}I=Y,Y=m[I],K+=I-Y&32767;}if(k){_[M++]=268435456|Gr[L]<<18|$n[k];var Ot=Gr[L]&31,Mt=$n[k]&31;N+=cr[Ot]+fr[Mt],++b[257+Ot],++y[Mt],x=C+L,++A;}else _[M++]=e[C],++b[e[C]];}}for(C=Math.max(C,x);C<s;++C)_[M++]=e[C],++b[e[C]];f=qn(e,l,u,_,b,y,N,M,O,C-O,f),u||(i.r=f&7|l[f/8|0]<<3,f-=7,i.h=D,i.p=m,i.i=C,i.w=x);}else {for(var C=i.w||0;C<s+u;C+=65535){var ct=C+65535;ct>=s&&(l[f/8|0]=u,ct=s),f=Yn(l,f+1,e.subarray(C,ct));}i.i=s;}return Lt(o,0,n+Kr(f)+a)},"dflt"),ms=(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})(),gs=h(function(){var e=-1;return {p:h(function(t){for(var r=e,n=0;n<t.length;++n)r=ms[r&255^t[n]]^r>>>8;e=r;},"p"),d:h(function(){return ~e},"d")}},"crc");var _s=h(function(e,t,r,n,a){if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),s=new ne(i.length+e.length);s.set(i),s.set(e,i.length),e=s,a.w=i.length;}return ps(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"),Qn=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 ke=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"),Hr=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 ws(e,t){return _s(e,t||{},0,0)}h(ws,"deflateSync");function vs(e,t){return hs(e,{i:2},t&&t.out,t&&t.dictionary)}h(vs,"inflateSync");var Jn=h(function(e,t,r,n){for(var a in e){var i=e[a],s=t+a,o=n;Array.isArray(i)&&(o=Qn(n,i[1]),i=i[0]),ArrayBuffer.isView(i)?r[s]=[i,o]:(r[s+="/"]=[new ne(0),o],Jn(i,s,r,n));}},"fltn"),zn=typeof TextEncoder<"u"&&new TextEncoder,Qr=typeof TextDecoder<"u"&&new TextDecoder,ys=0;try{Qr.decode(Xn,{stream:!0}),ys=1;}catch{}var Es=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:Lt(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 lr(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)),s=0,o=h(function(f){i[s++]=f;},"w"),n=0;n<a;++n){if(s+5>i.length){var l=new ne(s+8+(a-n<<1));l.set(i),i=l;}var u=e.charCodeAt(n);u<128||t?o(u):u<2048?(o(192|u>>6),o(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++n)&1023,o(240|u>>18),o(128|u>>12&63),o(128|u>>6&63),o(128|u&63)):(o(224|u>>12),o(128|u>>6&63),o(128|u&63));}return Lt(i,0,s)}h(lr,"strToU8");function hr(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(Qr)return Qr.decode(e);var a=Es(e),i=a.s,r=a.r;return r.length&&de(8),i}}h(hr,"strFromU8");var Ds=h(function(e,t){return t+30+ke(e,t+26)+ke(e,t+28)},"slzh"),bs=h(function(e,t,r){var n=ke(e,t+28),a=ke(e,t+30),i=hr(e.subarray(t+46,t+46+n),!(ke(e,t+8)&2048)),s=t+46+n,o=As(e,s,a,r,De(e,t+20),De(e,t+24),De(e,t+42)),l=o[0],u=o[1],f=o[2];return [ke(e,t+10),l,u,i,s+a+ke(e,t+32),f]},"zh"),As=h(function(e,t,r,n,a,i,s){var o=a==4294967295,l=i==4294967295,u=s==4294967295,f=t+r,c=o+l+u;if(n&&c){for(;t+4<f;t+=4+ke(e,t+2))if(ke(e,t)==1)return [o?Hr(e,t+4+8*l):a,l?Hr(e,t+4):i,u?Hr(e,t+4+8*(l+o)):s,1];n<2&&de(13);}return [a,i,s,0]},"z64hs"),Jr=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"),jn=h(function(e,t,r,n,a,i,s,o){var l=n.length,u=r.extra,f=o&&o.length,c=Jr(u);le(e,t,s!=null?33639248:67324752),t+=4,s!=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,c),t+=16,s!=null&&(le(e,t,f),le(e,t+6,r.attrs),le(e,t+10,s),t+=14),e.set(n,t),t+=l,c)for(var g in u){var m=u[g],D=m.length;le(e,t,+g),le(e,t+2,D),e.set(m,t+4),t+=4+D;}return f&&(e.set(o,t),t+=f),t},"wzh"),Ns=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 Zn(e,t){t||(t={});var r={},n=[];Jn(e,"",r,t);var a=0,i=0;for(var s in r){var o=r[s],l=o[0],u=o[1],f=u.level==0?0:8,c=lr(s),d=c.length,p=u.comment,g=p&&lr(p),m=g&&g.length,D=Jr(u.extra);d>65535&&de(11);var w=f?ws(l,u):l,v=w.length,E=gs();E.p(l),n.push(Qn(u,{size:l.length,crc:E.d(),c:w,f:c,m:g,u:d!=s.length||g&&p.length!=m,o:a,compression:f})),a+=30+d+D+v,i+=76+2*(d+D)+(m||0)+v;}for(var _=new ne(i+22),b=a,y=i-a,A=0;A<n.length;++A){var c=n[A];jn(_,c.o,c,c.f,c.u,c.c.length);var N=30+c.f.length+Jr(c.extra);_.set(c.c,c.o+N),jn(_,a,c,c.f,c.u,c.c.length,c.o,c.m),a+=16+N+(c.m?c.m.length:0);}return Ns(_,a,n.length,y,b),_}h(Zn,"zipSync");function Kn(e,t){for(var r={},n=e.length-22;De(e,n)!=101010256;--n)(!n||e.length-n>65558)&&de(13);var a=ke(e,n+8);if(!a)return {};var i=De(e,n+16),s=De(e,n-20)==117853008;if(s){var o=De(e,n-12);s=De(e,o)==101075792,s&&(a=De(e,o+32),i=De(e,o+48));}for(var l=t&&t.filter,u=0;u<a;++u){var f=bs(e,i,s),c=f[0],d=f[1],p=f[2],g=f[3],m=f[4],D=f[5],w=Ds(e,D);i=m,(!l||l({name:g,size:d,originalSize:p,compression:c}))&&(c?c==8?r[g]=vs(e.subarray(w,w+d),{out:new ne(p)}):de(14,"unknown compression type "+c):r[g]=Lt(e,w,w+d));}return r}h(Kn,"unzipSync");var Rr=Ur(ua()),Ra=Ur(la());function R(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(R,"findChild");function _u(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(_u,"findChildren");function S(e,t){return Array.from(e.getElementsByTagName(t))}h(S,"findAllDescendants");function Dn(e){return e.startsWith("\uFEFF")&&(e=e.slice(1)),new Rr.DOMParser().parseFromString(e,"text/xml")}h(Dn,"parseXml");function wu(e){let t=new Rr.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 o=n[0],l=`<${n[1]}`,u=n[2],f=n[3],c=/([a-zA-Z0-9_:]+)\s*=\s*(["'])(.*?)\2/g,d=[],p;for(;(p=c.exec(u))!==null;)d.push(p[0].trim());d.sort((m,D)=>{let w=m.split("=")[0].trim(),v=D.split("=")[0].trim(),E=w.startsWith("xmlns"),_=v.startsWith("xmlns");return E&&!_?-1:!E&&_?1:w<v?-1:w>v?1:0});let g=d.length>0?`${l} ${d.join(" ")}${f}`:`${l}${f}`;t=t.substring(0,a)+g+t.substring(a+o.length);}}return t}h(wu,"serializeXml");var Or=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},Ea=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 Or(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);}}}},vu=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=Dn(r),a=new Ea(e,r,n.documentElement,t);a.package=this,this.parts.push(a);let i=this.getPartByPath("[Content_Types].xml");if(i){let s=i._element.ownerDocument;if(s){let o=s.createElement("Override");o.setAttribute("PartName",e),o.setAttribute("ContentType",t),i._element.appendChild(o);}}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
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`)),a}},ar=class Da{static{h(this,"_DocumentObject");}constructor(t,r){this.pkg=t,this.part=r;}pkg;part;settings={oddAndEvenPagesHeaderFooter:false};sections=[];get element(){return R(this.part._element,"w:body")||this.part._element}static async load(t){let r=t instanceof Uint8Array?t:new Uint8Array(t),n=Kn(r),a=new vu(n),i=n["[Content_Types].xml"],s={};if(i){let u=Dn(hr(i)),f=S(u.documentElement,"Override");for(let c of f)s[c.getAttribute("PartName")||""]=c.getAttribute("ContentType")||"";}for(let[u,f]of Object.entries(n))if(u.endsWith(".xml")||u.endsWith(".rels")){let c=hr(f),d=Dn(c),p=s["/"+u]||"application/xml",g=new Ea("/"+u,c,d.documentElement,p);g.package=a,a.parts.push(g);}let o=a.getPartByPath("word/document.xml");if(!o)throw new Error("Invalid DOCX: Missing word/document.xml");a.mainDocumentPart=o;let l=a.getPartByPath("word/_rels/document.xml.rels");if(l){let u=S(l._element,"Relationship");for(let f of u){let c=f.getAttribute("Id"),d=f.getAttribute("Target"),p=f.getAttribute("Type"),g=f.getAttribute("TargetMode");c&&d&&p&&o.rels.set(c,new Or(c,p,d,g==="External"));}}return new Da(a,o)}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 Or(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 Or(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=wu(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)]=lr(r);}return Buffer.from(Zn(this.pkg.unzipped))}},Ze=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}},Ke=class{static{h(this,"Run");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},yu=class{static{h(this,"Cell");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},Eu=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 yu(r[n],this));}_element;_parent;cells=[]},An=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 Eu(r[n],this));}_element;_parent;rows=[]},ca=class{static{h(this,"NotesPart");}constructor(e,t){this.part=e,this.note_type=t,this._element=e._element;}part;note_type;_element},Du=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"},Ee={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"},Qe={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"},ir=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(Ee.COMMENTS);if(e)return this._linkPart(e,Qe.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,Ee.COMMENTS,r),this.doc.relateTo(e,Qe.COMMENTS),e}_getOrCreateExtendedPart(){let e=this._getExistingPartByType(Ee.EXTENDED);if(e)return this._linkPart(e,Qe.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,Ee.EXTENDED,r),this.doc.relateTo(e,Qe.EXTENDED),e}_getOrCreateIdsPart(){let e=this._getExistingPartByType(Ee.IDS);if(e)return this._linkPart(e,Qe.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,Ee.IDS,r),this.doc.relateTo(e,Qe.IDS),e}_getOrCreateExtensiblePart(){let e=this._getExistingPartByType(Ee.EXTENSIBLE);if(e)return this._linkPart(e,Qe.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,Ee.EXTENSIBLE,r),this.doc.relateTo(e,Qe.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(Ee.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(Ee.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,s=i.createElement("w:comment");s.setAttribute("w:id",n),s.setAttribute("w:author",e),s.setAttribute("w:date",a);let o=this._getInitials(e);o&&s.setAttribute("w:initials",o);let l=this._getExistingPartByType(Ee.EXTENDED);r&&!l&&s.setAttribute("w15:p",r);let u=this._generateHexId(),f=this._generateHexId(),c=i.createElement("w:p");c.setAttribute("w14:paraId",u),c.setAttribute("w14:textId","77777777"),c.setAttribute("w:rsidR",f),c.setAttribute("w:rsidRDefault",f),c.setAttribute("w:rsidP",f);let d=i.createElement("w:pPr"),p=i.createElement("w:pStyle");p.setAttribute("w:val","CommentText"),d.appendChild(p),c.appendChild(d);let g=i.createElement("w:r"),m=i.createElement("w:rPr"),D=i.createElement("w:rStyle");D.setAttribute("w:val","CommentReference"),m.appendChild(D),g.appendChild(m),g.appendChild(i.createElement("w:annotationRef")),c.appendChild(g);let w=i.createElement("w:r"),v=i.createElement("w:t");if(v.textContent=t,w.appendChild(v),c.appendChild(w),s.appendChild(c),this.commentsPart._element.appendChild(s),this.extendedPart){let E=r?this._findThreadRootParaId(r):null,b=this.extendedPart._element.ownerDocument.createElement("w15:commentEx");b.setAttribute("w15:paraId",u),E&&b.setAttribute("w15:paraIdParent",E),b.setAttribute("w15:done","0"),this.extendedPart._element.appendChild(b);}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 b=this.idsPart._element.childNodes[_];if(b.nodeType===1&&b.getAttribute("w16cid:paraId")===u){E=b.getAttribute("w16cid:durableId");break}}if(E){let b=this.extensiblePart._element.ownerDocument.createElement("w16cex:commentExtensible");b.setAttribute("w16cex:durableId",E),b.setAttribute("w16cex:dateUtc",a),this.extensiblePart._element.appendChild(b);}}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 s=this.extendedPart._element.childNodes[i];if(s.nodeType===1&&s.getAttribute("w15:paraIdParent")===r){let o=s.getAttribute("w15:paraId");if(o){for(let l of S(this.commentsPart._element,"w:comment"))for(let u of S(l,"w:p"))if(u.getAttribute("w14:paraId")===o){let f=l.getAttribute("w:id");f&&n.push(f);break}}}}for(let i of n)this.deleteComment(i);let a=null;if(this.idsPart){let i=[];for(let s=0;s<this.idsPart._element.childNodes.length;s++){let o=this.idsPart._element.childNodes[s];o.nodeType===1&&o.getAttribute("w16cid:paraId")===r&&(a=o.getAttribute("w16cid:durableId"),i.push(o));}i.forEach(s=>this.idsPart._element.removeChild(s));}if(this.extendedPart){let i=[];for(let s=0;s<this.extendedPart._element.childNodes.length;s++){let o=this.extendedPart._element.childNodes[s];o.nodeType===1&&o.getAttribute("w15:paraId")===r&&i.push(o);}i.forEach(s=>this.extendedPart._element.removeChild(s));}if(a&&this.extensiblePart){let i=[];for(let s=0;s<this.extensiblePart._element.childNodes.length;s++){let o=this.extensiblePart._element.childNodes[s];o.nodeType===1&&o.getAttribute("w16cex:durableId")===a&&i.push(o);}i.forEach(s=>this.extensiblePart._element.removeChild(s));}}t.parentNode&&t.parentNode.removeChild(t);}};function Br(e){({part:e.mainDocumentPart,relateTo:h(()=>{},"relateTo")});let n={},a=e.parts.find(l=>l.contentType===Ee.COMMENTS);if(!a)return n;let i={},s=S(a._element,"w:comment");for(let l of s){let u=l.getAttribute("w:id");if(!u)continue;let f=l.getAttribute("w:author")||"Unknown",c=l.getAttribute("w:date")||"",d=false,p=l.getAttribute("w15:done");(p==="1"||p==="true"||p==="on")&&(d=true);let g=l.getAttribute("w15:p")||null,m=S(l,"w:p");for(let v of m){let E=v.getAttribute("w14:paraId");E&&(i[E]=u);}let D=[];for(let v of m){let E=S(v,"w:t");for(let _ of E)_.textContent&&D.push(_.textContent);D.push(`
|
|
16
|
+
`);}let w=D.join("").trim();n[u]={author:f,text:w,date:c,resolved:d,parent_id:g};}let o=e.parts.find(l=>l.contentType===Ee.EXTENDED);if(o){let l=o._element.childNodes;for(let u=0;u<l.length;u++){let f=l[u];if(f.nodeType!==1)continue;let c=f.getAttribute("w15:paraId"),d=f.getAttribute("w15:paraIdParent"),p=f.getAttribute("w15:done");if(c){let g=i[c];if(g&&n[g]){if(d){let m=i[d];m&&(n[g].parent_id=m);}(p==="1"||p==="true"||p==="on")&&(n[g].resolved=true);}}}}return n}h(Br,"extract_comments_data");var bu="w:p",ba="w:r",Aa="w:t",Au="w:delText",Nu="w:tab",Cu="w:br",Tu="w:cr",Nn="w:rPr",xu="w:rPrChange",Su="w:commentReference",Iu="w:footnoteReference",ku="w:endnoteReference",Pu="w:fldChar",Ou="w:fldCharType",Mu="w:instrText",Ru="w:ins",Bu="w:del",Je="w:id",yn="w:author",En="w:date",Fu="w:commentRangeStart",Lu="w:commentRangeEnd",$u="w:hyperlink",Uu="r:id",qu="w:fldSimple",zu="w:instr",ju="w:bookmarkStart",Wu="w:name",Hu="w:sdt",Vu="w:smartTag",Gu="w:sdtContent",Na="w:b",Yu="w:i",Te="w:val",Ca="w:pPr",Ta="w:pStyle",xa="w:outlineLvl",Xu="w:numPr",Qu="w:numId",Ju="w:ilvl",Zu=/Heading[ ]?([1-6])(?![0-9])/;function Fr(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 s=S(i._element,"w:style");for(let u of s){let f=u.getAttribute("w:styleId");if(!f)continue;let c=u.getAttribute("w:type"),d=u.getAttribute("w:default")==="1"||u.getAttribute("w:default")==="true";c==="paragraph"&&d&&(n=f);let p=R(u,"w:name"),g=p?p.getAttribute("w:val"):f;g&&typeof g=="string"&&(g.toLowerCase().startsWith("heading")?g=g.replace(/^heading/i,"Heading"):g.toLowerCase()==="title"&&(g="Title"));let m=R(u,"w:basedOn"),D=m?m.getAttribute("w:val"):null,w=null,v=R(u,"w:pPr");if(v){let b=R(v,"w:outlineLvl");if(b){let y=b.getAttribute("w:val");y&&/^\d+$/.test(y)&&(w=parseInt(y,10));}}let E=null,_=R(u,"w:rPr");if(_){let b=R(_,"w:b");if(b){let y=b.getAttribute("w:val");E=y!=="0"&&y!=="false"&&y!=="off";}}a[f]={name:g,based_on:D,outline_level:w,bold:E};}let o=h((u,f)=>{if(r[u])return r[u];if(f.has(u)||!a[u])return {name:u,outline_level:null,bold:false};f.add(u);let c=a[u],d=c.based_on,p=c.outline_level,g=c.bold!==null?c.bold:false;if(d){let D=o(d,f);p===null&&(p=D.outline_level),c.bold===null&&(g=D.bold);}let m={name:c.name,outline_level:p,bold:g};return r[u]=m,m},"resolve_style");for(let u in a)o(u,new Set);let l=[r,n];return t&&(t._adeu_style_cache=l),l}h(Fr,"_get_style_cache");function Sa(e){if(!e)return null;let t=e.match(Zu);return t?parseInt(t[1],10):null}h(Sa,"_detect_heading_level_from_name");function Cn(e,t,r){t||([t,r]=Fr(e._parent.part||e._parent));let n=R(e._element,Ca);if(n){let o=R(n,xa);if(o){let l=o.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 o=R(n,Ta);o&&(a=o.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 s=i?i.name:a;return s&&typeof s=="string"&&s.toLowerCase().startsWith("heading")&&(s=s.replace(/^heading/i,"Heading")),!!(s?.startsWith("Heading")||s==="Title"||s&&s!=="Normal"&&Sa(s)!==null)}h(Cn,"is_native_heading");function Tn(e,t,r){t||([t,r]=Fr(e._parent.part||e._parent));let n=R(e._element,Ca);if(n){let o=R(n,xa);if(o){let l=o.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 o=R(n,Ta);o&&(a=o.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 s=i?i.name:a;if(s&&typeof s=="string"&&s.toLowerCase().startsWith("heading")&&(s=s.replace(/^heading/i,"Heading")),s?.startsWith("Heading")){let o=s.replace("Heading","").trim();if(/^\d+$/.test(o))return "#".repeat(parseInt(o,10))+" "}if(s==="Title")return "# ";if(n){let o=R(n,Xu);if(o){let l=R(o,Qu);if(l&&l.getAttribute(Te)!=="0"){let u=0,f=R(o,Ju);if(f){let c=f.getAttribute(Te);c&&(u=parseInt(c,10)||0);}return " ".repeat(u)+"* "}}}if(s&&s!=="Normal"){let o=Sa(s);if(o!==null)return "#".repeat(o)+" "}if(!s||s==="Normal"){let o=e.text.trim();if(o&&o.length<100&&o===o.toUpperCase()){let l=false;if(i?.bold)l=true;else {let u=S(e._element,ba);for(let f of u)if(S(f,Aa).map(p=>p.textContent||"").join("").trim()){let p=R(f,Nn);if(p){let g=R(p,Na);g&&g.getAttribute(Te)!=="0"&&g.getAttribute(Te)!=="false"&&(l=true);}break}}if(l)return "## "}}return ""}h(Tn,"get_paragraph_prefix");function Ia(e,t,r){let n=Tn(e,t,r);if(!n)return false;let a=n.trimEnd();return a.length>0&&a==="#".repeat(a.length)}h(Ia,"is_heading_paragraph");function ka(e,t=null){let r="",n="",a=R(e._element,Nn),i=false,s=false;if(a){let o=R(a,Na);o&&o.getAttribute(Te)!=="0"&&o.getAttribute(Te)!=="false"&&(i=true);let l=R(a,Yu);l&&l.getAttribute(Te)!=="0"&&l.getAttribute(Te)!=="false"&&(s=true);}if(t===null){let o=e._parent;t=o instanceof Ze?Cn(o):false;}return i&&!t&&(r+="**",n="**"+n),s&&(r+="_",n="_"+n),[r,n]}h(ka,"get_run_style_markers");function Ku(e,t,r){return !t&&!r?e:e?e.includes(`
|
|
17
17
|
`)?e.split(`
|
|
18
|
-
`).map(
|
|
19
|
-
`):`${t}${e}${r}`:""}h(
|
|
20
|
-
`);}return t}h(
|
|
18
|
+
`).map(a=>a?`${t}${a}${r}`:"").join(`
|
|
19
|
+
`):`${t}${e}${r}`:""}h(Ku,"apply_formatting_to_segments");function st(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===Aa||n.tagName===Au){let a=n.textContent||"";t+=a.replace(/\t/g," ");}else n.tagName===Nu?t+=" ":(n.tagName===Cu||n.tagName===Tu)&&(t+=`
|
|
20
|
+
`);}return t}h(st,"get_run_text");function*xn(e){let t=e._element||e.element||e;if(e.constructor.name==="NotesPart"){let r=e.note_type==="fn"?"w:footnote":"w:endnote",n=S(t,r);for(let a of n)a.getAttribute("w:type")==="separator"||a.getAttribute("w:type")==="continuationSeparator"||(yield new Du(a,e,e.note_type));return}for(let r=0;r<t.childNodes.length;r++){let n=t.childNodes[r];n.nodeType===1&&(n.tagName===bu?yield new Ze(n,e):n.tagName==="w:tbl"&&(yield new An(n,e)));}}h(xn,"iter_block_items");function*Pa(e){let t=e.pkg.parts.filter(i=>i.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml");for(let i of t)yield i;yield e;let r=e.pkg.parts.filter(i=>i.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml");for(let i of r)yield i;let n=e.pkg.getPartByPath("word/footnotes.xml"),a=e.pkg.getPartByPath("word/endnotes.xml");n&&(yield new ca(n,"fn")),a&&(yield new ca(a,"en"));}h(Pa,"iter_document_parts");function el(e){if(!e)return false;let t=e.toUpperCase().trim().split(/\s+/);return t.length>0&&(t[0]==="PAGE"||t[0]==="NUMPAGES")}h(el,"_is_page_instr");function Oa(e){return e?e.part?e.part:e.pkg&&e.pkg.mainDocumentPart?e.pkg.mainDocumentPart:e._parent?Oa(e._parent):null:null}h(Oa,"_get_part");function*Ma(e){let t=false,r="",n=false;function*a(s){let o=null,l=R(s,Nn);if(l){let u=R(l,xu);u&&(o=u.getAttribute(Je),yield {type:"fmt_start",id:o,author:u.getAttribute(yn)||void 0,date:u.getAttribute(En)||void 0});}for(let u=0;u<s.childNodes.length;u++){let f=s.childNodes[u];if(f.nodeType!==1)continue;let c=f.tagName;if(c===Su){let d=f.getAttribute(Je);d&&(yield {type:"ref",id:d});}else if(c===Iu){let d=f.getAttribute(Je);d&&(yield {type:"footnote",id:d});}else if(c===ku){let d=f.getAttribute(Je);d&&(yield {type:"endnote",id:d});}else if(c===Pu){let d=f.getAttribute(Ou);if(d==="begin")t=true,r="";else if(d==="separate")if(el(r))n=true;else {let p=r.trim().split(/\s+/);p.length>1&&p[0]==="REF"&&(yield {type:"xref_start",id:p[1]});}else if(d==="end"){if(!n){let p=r.trim().split(/\s+/);p.length>1&&p[0]==="REF"&&(yield {type:"xref_end",id:p[1]});}t=false,r="",n=false;}}else c===Mu&&t&&!n&&(r+=f.textContent||"");}n||(yield new Ke(s,e)),o!==null&&(yield {type:"fmt_end",id:o});}h(a,"process_run_element");function*i(s){for(let o=0;o<s.childNodes.length;o++){let l=s.childNodes[o];if(l.nodeType!==1)continue;let u=l.tagName;if(u===ba)yield*a(l);else if(u===Ru){let f=l.getAttribute(Je);yield {type:"ins_start",id:f,author:l.getAttribute(yn)||void 0,date:l.getAttribute(En)||void 0},yield*i(l),yield {type:"ins_end",id:f};}else if(u===Bu){let f=l.getAttribute(Je);yield {type:"del_start",id:f,author:l.getAttribute(yn)||void 0,date:l.getAttribute(En)||void 0},yield*i(l),yield {type:"del_end",id:f};}else if(u===Fu)yield {type:"start",id:l.getAttribute(Je)};else if(u===Lu)yield {type:"end",id:l.getAttribute(Je)};else if(u===$u){let f=l.getAttribute(Uu)||l.getAttribute("id"),c="",d=Oa(e._parent);if(f&&d){let p=d.rels.get(f);p&&p.isExternal&&(c=p.target);}c&&(yield {type:"hyperlink_start",id:f,date:c}),yield*i(l),c&&(yield {type:"hyperlink_end",id:f,date:c});}else if(u===qu){let c=(l.getAttribute(zu)||"").trim().split(/\s+/),d=c.length>1&&c[0]==="REF"?c[1]:"";d&&(yield {type:"xref_start",id:d}),yield*i(l),d&&(yield {type:"xref_end",id:d});}else if(u===ju){let f=l.getAttribute(Wu);f&&(!f.startsWith("_")||f.startsWith("_Ref"))&&(yield {type:"bookmark",id:f});}else (u===Hu||u===Vu||u===Gu)&&(yield*i(l));}}h(i,"traverse_node"),yield*i(e._element);}h(Ma,"iter_paragraph_content");var kt=class{static{h(this,"DocumentMapper");}doc;clean_view;original_view;comments_map;full_text="";spans=[];appendix_start_index=-1;_text_chunks=[];constructor(e,t=false,r=false){this.doc=e,this.clean_view=t,this.original_view=r,this.comments_map=Br(e.pkg),this._build_map();}_build_map(){let e=0;this.spans=[],this._text_chunks=[],this.full_text="";for(let t of Pa(this.doc))e=this._map_blocks(t,e),this.spans.length>0&&this.spans[this.spans.length-1].text!==`
|
|
21
21
|
|
|
22
22
|
`&&(this._add_virtual_text(`
|
|
23
23
|
|
|
24
24
|
`,e,null),e+=2);for(;this.spans.length>0&&this.spans[this.spans.length-1].text===`
|
|
25
25
|
|
|
26
|
-
`;)this.spans.pop(),this._text_chunks.pop();this.full_text=this._text_chunks.join(""),this.appendix_start_index=-1;}_map_blocks(e,t){let r=t,n=e.constructor.name,
|
|
26
|
+
`;)this.spans.pop(),this._text_chunks.pop();this.full_text=this._text_chunks.join(""),this.appendix_start_index=-1;}_map_blocks(e,t){let r=t,n=e.constructor.name,a=e.part||e,[i,s]=Fr(a);if(n==="NotesPart"){let f=`---
|
|
27
27
|
${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;this._add_virtual_text(f,r,null),r+=f.length,this._add_virtual_text(`
|
|
28
28
|
|
|
29
|
-
`,r,null),r+=2;}let
|
|
29
|
+
`,r,null),r+=2;}let o=true,l=null;for(let u of xn(e))if(u.constructor.name==="FootnoteItem")r=this._map_blocks(u,r);else if(u instanceof Ze){if(!o){let d=l instanceof Ze?l:null;this._add_virtual_text(`
|
|
30
30
|
|
|
31
|
-
`,r,d),r+=2;}let c=Tn(
|
|
31
|
+
`,r,d),r+=2;}let c=Tn(u,i,s);o&&n==="FootnoteItem"&&(c=`[^${e.note_type}-${e.id}]: `+c),c&&(this._add_virtual_text(c,r,u),r+=c.length),r=this._map_paragraph_content(u,r,i,s),o=false,l=u;}else if(u instanceof An){if(!o){let c=l instanceof Ze?l:null;this._add_virtual_text(`
|
|
32
32
|
|
|
33
|
-
`,r,c),r+=2;}r=this._map_table(
|
|
34
|
-
`,r,null),r+=1),
|
|
35
|
-
`)&&(y||A)){let
|
|
36
|
-
`);for(let
|
|
37
|
-
`,
|
|
38
|
-
`)}_add_virtual_text(e,t,r,n=null){let
|
|
33
|
+
`,r,c),r+=2;}r=this._map_table(u,r),o=false,l=u;}return r}_map_table(e,t){let r=t,n=0;for(let a of e.rows){let i=a._element,s=R(i,"w:trPr"),o=s?R(s,"w:ins"):null,l=s?R(s,"w:del"):null;if(this.clean_view&&l||this.original_view&&o)continue;n>0&&(this._add_virtual_text(`
|
|
34
|
+
`,r,null),r+=1),o&&!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,f=0;for(let c of a.cells)u.has(c)||(u.add(c),f>0&&(this._add_virtual_text(" | ",r,null),r+=3),r=this._map_blocks(c,r),f+=1);if(o&&!this.clean_view&&!this.original_view){let c=` |Chg:${o.getAttribute("w:id")}++}`;this._add_virtual_text(c,r,null),r+=c.length;}else if(l&&!this.clean_view&&!this.original_view){let c=` |Chg:${l.getAttribute("w:id")}--}`;this._add_virtual_text(c,r,null),r+=c.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 s=new Set,o={},l={},u={},f=[],c=["",""],d=["",""],p=null,g=[],m=h(()=>{if(g.length===0)return;let[_,b]=c;_&&(this._add_virtual_text(_,a,e),a+=_.length);for(let[y,A,N,C,M,x]of g){if(y==="virtual")this._add_virtual_text(A,a,e,p);else {let O={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:x.length>0?x:void 0};this.spans.push(O),this._text_chunks.push(A);}a+=A.length;}b&&(this._add_virtual_text(b,a,e),a+=b.length),g=[];},"flush_pending_runs"),D=Array.from(Ma(e)),w=Ia(e,r,n),v=Cn(e,r,n),E=w;for(let _=0;_<D.length;_++){let b=D[_];if(b instanceof Ke){let[y,A]=ka(b,v),N=[],C=st(b);if(E){if(C===""||/^\s*$/.test(C))continue;E=false;}if(C.includes(`
|
|
35
|
+
`)&&(y||A)){let U=C.split(`
|
|
36
|
+
`);for(let I=0;I<U.length;I++)I>0&&N.push(["real",`
|
|
37
|
+
`,b]),U[I]&&(y&&N.push(["virtual",y,null]),N.push(["real",U[I],b]),A&&N.push(["virtual",A,null]));}else y&&N.push(["virtual",y,null]),C&&N.push(["real",C,b]),A&&N.push(["virtual",A,null]);this.clean_view&&Object.keys(l).length>0,this.original_view&&Object.keys(o).length>0;let M=N.map(U=>U[1]).join(""),x=Object.keys(o).pop()||null,O=Object.keys(l).pop()||null;if(M&&!(this.clean_view&&O)&&!(this.original_view&&x)){let U=this.clean_view||this.original_view?["",""]:this._get_wrappers(x,O,s,u),I=[y,A];if(g.length>0&&U[0]===c[0]&&U[1]===c[1]){let Y=false;I[0]===d[0]&&I[1]===d[1]&&d[0]!==""&&g[g.length-1][0]==="virtual"&&g[g.length-1][1]===d[1]&&(g.pop(),Y=true);let z=Array.from(s);for(let[B,L,k]of N){if(Y&&B==="virtual"&&L===I[0]){Y=false;continue}g.push([B,L,k,x,O,z]);}d=I;}else {m(),c=U,d=I;let Y=Array.from(s);for(let[z,B,L]of N)g.push([z,B,L,x,O,Y]);}}if(!this.clean_view&&!this.original_view){(Object.keys(o).length>0||Object.keys(l).length>0||s.size>0||Object.keys(u).length>0)&&f.push([{...o},{...l},new Set(s),{...u}]);let I=false;if(x!==null||O!==null||Object.keys(u).length>0||s.size>0){let z=_+1,B=false,L=Object.keys(o).length,k=Object.keys(l).length,H=Object.keys(u).length,K=new Set(s);for(;z<D.length;){let ue=D[z];if(ue instanceof Ke){if(!st(ue)){z++;continue}(L>0||k>0||H>0||K.size>0)&&(B=true);break}else {let ee=ue;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"?H++:ee.type==="fmt_end"?H=Math.max(0,H-1):ee.type==="start"?K.add(ee.id):ee.type==="end"&&K.delete(ee.id);}z++;}B&&(I=true);}if(!I&&f.length>0){let z=this._build_merged_meta_block(f);if(z){m(),c=["",""],d=["",""];let B=`{>>${z}<<}`;this._add_virtual_text(B,a,e),a+=B.length;}f=[];}}}else {let y=b;if(E=false,m(),c=["",""],d=["",""],y.type==="start")s.add(y.id);else if(y.type==="end")s.delete(y.id);else if(y.type==="ins_start")o[y.id]=y;else if(y.type==="ins_end")delete o[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"){m(),c=["",""],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")m(),c=["",""],d=["",""],this._add_virtual_text("[",a,e,y.id),a+=1,p=y.id;else if(y.type==="hyperlink_end"){m(),c=["",""],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")m(),c=["",""],d=["",""],this._add_virtual_text("[~",a,e),a+=2;else if(y.type==="xref_end"){m(),c=["",""],d=["",""];let A=`~](#${y.id})`;this._add_virtual_text(A,a,e),a+=A.length;}else if(y.type==="bookmark"){m(),c=["",""],d=["",""];let A=`{#${y.id}}`;this._add_virtual_text(A,a,e),a+=A.length;}}}if(m(),f.length>0){let _=this._build_merged_meta_block(f);if(_){let b=`{>>${_}<<}`;this._add_virtual_text(b,a,e),a+=b.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,s,o]of e){for(let[u,f]of Object.entries(a)){let c=`Chg:${u}`;if(!n.has(c)){let d=f.author||"Unknown";t.push(`[${c} insert] ${d}`),n.add(c);}}for(let[u,f]of Object.entries(i)){let c=`Chg:${u}`;if(!n.has(c)){let d=f.author||"Unknown";t.push(`[${c} delete] ${d}`),n.add(c);}}for(let[u,f]of Object.entries(o)){let c=`Chg:${u}`;if(!n.has(c)){let d=f.author||"Unknown";t.push(`[${c} format] ${d}`),n.add(c);}}let l=Array.from(s).sort();for(let u of l){if(!this.comments_map[u])continue;let f=`Com:${u}`;if(!n.has(f)){let c=this.comments_map[u],d=`[${f}] ${c.author}`;c.date&&(d+=` @ ${c.date}`),c.resolved&&(d+="(RESOLVED)"),r.push(`${d}: ${c.text}`),n.add(f);}}}return [...t,...r].join(`
|
|
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(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp");for(;(a=r.exec(e))!==null;){let o=e.substring(n,a.index);o&&t.push(i(o));let l=a[1],u=a[2],f=a[3],c=a[4];l?t.push("\\[_+\\]"):u?(t.push("(?:\\*\\*|__|\\*|_)?"),t.push("\\s+"),t.push("(?:\\*\\*|__|\\*|_)?")):f?f==="'"?t.push("[\u2018\u2019']"):t.push('["\u201C\u201D]'):c&&(t.push("(?:\\*\\*|__|\\*|_)?"),t.push(i(c)),t.push("(?:\\*\\*|__|\\*|_)?")),n=r.lastIndex;}let s=e.substring(n);return s&&t.push(i(s)),t.join("")}find_match_index(e,t=false){if(t){try{let o=new RegExp(e).exec(this.full_text);if(o)return [o.index,o[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 o=new RegExp(this._make_fuzzy_regex(e)).exec(this.full_text);if(o)return [o.index,o[0].length]}catch{}return [-1,0]}find_all_match_indices(e,t=false){if(!e)return [];if(t){try{let o=new RegExp(e,"g"),l=[...this.full_text.matchAll(o)];if(l.length>0)return l.map(u=>[u.index,u[0].length])}catch{}return []}let r=h(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),n=[...this.full_text.matchAll(new RegExp(r(e),"g"))];if(n.length>0)return n.map(o=>[o.index,o[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(o=>[o.index,o[0].length]);let s=this._strip_markdown_formatting(e);if(n=[...this.full_text.matchAll(new RegExp(r(s),"g"))],n.length>0)return n.map(o=>[o.index,o[0].length]);try{let o=new RegExp(this._make_fuzzy_regex(e),"g");if(n=[...this.full_text.matchAll(o)],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(
|
|
41
|
-
`;)n--;
|
|
42
|
-
`)break;p--;}if(!
|
|
43
|
-
`)}h(
|
|
44
|
-
|
|
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,s=n.find(u=>u.run!==null),o=0;if(s){let u=e-s.start;if(u>0){let[,c]=this._split_run_at_index(a[0],u);a[0]=c,i=true,o=u;}}let l=[...n].reverse().find(u=>u.run!==null);if(l){let u=s===l,f=a[a.length-1],d=Math.min(l.end,t)-l.start;u&&o>0&&(d-=o);let p=st(f);if(d>0&&d<p.length){let[g]=this._split_run_at_index(f,d);a[a.length-1]=g,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 s=e-i.start,[o]=this._split_run_at_index(i.run,s);return t&&this._build_map(),[o,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=st(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 s=new Ke(i,e._parent);return [e,s]}_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 fa(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 s=false;r>0&&a(e[r-1])&&r<n-1&&a(e[r+1])&&(s=true),!i&&!s&&t++;}r++;}return t}h(fa,"_count_standalone_underscores");function bn(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]),f=!r(t[n-1])&&!r(t[n]);if(u||f)n--;else break}for(;n>0;){if(n<e.length){let m=e.substring(n-1,n+1);if(m==="**"||m==="__"){n--;continue}}let u=e.substring(0,n),f=(u.match(/\*\*/g)||[]).length,c=(u.match(/__/g)||[]).length,d=fa(u);if(f%2!==0){n=u.lastIndexOf("**");continue}if(c%2!==0){n=u.lastIndexOf("__");continue}if(d%2!==0){let m=u.length-1,D=h(w=>/[a-zA-Z0-9]/.test(w),"isAlnum");for(;m>=0;){if(u[m]==="_"&&(m===0||u[m-1]!=="_")&&(m===u.length-1||u[m+1]!=="_")&&!(m>0&&D(u[m-1])&&m<u.length-1&&D(u[m+1]))){n=m;break}m--;}continue}let p=n,g=false;for(;p>0;){let m=e[p-1];if(m==="#"){for(n=p-1;n>0&&e[n-1]!==`
|
|
41
|
+
`;)n--;g=true;break}if(m===`
|
|
42
|
+
`)break;p--;}if(!g)break}let i=0,s=e.length-n,o=t.length-n,l=Math.min(s,o);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 f=false;if(i<t.length&&(f=!r(t[t.length-1-i])&&!r(t[t.length-i])),u||f)i--;else break}for(;i>0;){let u=e.length-i;if(u>0){let g=e.substring(u-1,u+1);if(g==="**"||g==="__"){i--;continue}}let f=e.substring(e.length-i),c=(f.match(/\*\*/g)||[]).length,d=(f.match(/__/g)||[]).length,p=fa(f);if(c%2!==0){i-=f.indexOf("**")+2;continue}if(d%2!==0){i-=f.indexOf("__")+2;continue}if(p%2!==0){let g=0,m=h(D=>/[a-zA-Z0-9]/.test(D),"isAlnum");for(;g<f.length;){if(f[g]==="_"&&(g===0||f[g-1]!=="_")&&(g===f.length-1||f[g+1]!=="_")&&!(g>0&&m(f[g-1])&&g<f.length-1&&m(f[g+1]))){i-=g+1;break}g++;}continue}break}i>0&&/^\s+$/.test(e.substring(e.length-i))&&(i=0);for(let u of ["**","__","_"]){let f=u.length,c=e.substring(n,e.length-i),d=t.substring(n,t.length-i);c.startsWith(u)&&d.startsWith(u)&&c.endsWith(u)&&d.endsWith(u)&&c.length>=2*f&&d.length>=2*f&&(n+=f,i+=f);}return [n,i]}h(bn,"trim_common_context");function tl(e,t){let r=[],n={},a=/(\s+|[\p{L}\p{N}_]+|[^\p{L}\p{N}_\s])/gu,i=h(s=>{let o=s.split(a).filter(Boolean),l="";for(let u of o)if(u in n)l+=String.fromCharCode(n[u]);else {let f=r.length;n[u]=f,r.push(u),l+=String.fromCharCode(f);}return l},"encode_text");return [i(e),i(t),r]}h(tl,"_words_to_chars");function rl(e,t){let r=new Ra.default.diff_match_patch;r.Diff_Timeout=2;let[n,a,i]=tl(e,t),s=r.diff_main(n,a,false);r.diff_cleanupSemantic(s);for(let f=0;f<s.length;f++){let c=s[f][1],d="";for(let p=0;p<c.length;p++)d+=i[c.charCodeAt(p)];s[f][1]=d;}let o=[],l=0,u=null;for(let[f,c]of s)if(f===0){if(u){let[d,p]=u;o.push({type:"modify",target_text:p,new_text:"",comment:"Diff: Text deleted",_match_start_index:d}),u=null;}l+=c.length;}else if(f===-1)u=[l,c],l+=c.length;else if(f===1)if(u){let[d,p]=u;o.push({type:"modify",target_text:p,new_text:c,comment:"Diff: Replacement",_match_start_index:d}),u=null;}else o.push({type:"modify",target_text:"",new_text:c,comment:"Diff: Text inserted",_match_start_index:l});if(u){let[f,c]=u;o.push({type:"modify",target_text:c,new_text:"",comment:"Diff: Text deleted",_match_start_index:f});}return o}h(rl,"generate_edits_from_text");function Ba(e,t,r="Original",n="Modified"){let a=rl(e,t),i=[`--- ${r}`,`+++ ${n}`,""],s=40;for(let o of a){let l=o._match_start_index||0,u=o.target_text||"",f=o.new_text||"",[c,d]=bn(u,f),p=u.length-d,g=f.length-d,m=u.substring(c,p),D=f.substring(c,g),w=l+c,v=w+m.length,E=Math.max(0,w-s),_=e.substring(E,w);E>0&&(_="..."+_);let b=Math.min(e.length,v+s),y=e.substring(v,b);b<e.length&&(y=y+"..."),_=_.replace(/\n/g," ").replace(/\r/g,""),y=y.replace(/\n/g," ").replace(/\r/g,""),i.push("@@ Word Patch @@"),i.push(` ${_}`),m&&i.push(`- ${m}`),D&&i.push(`+ ${D}`),i.push(` ${y}`),i.push("");}return i.join(`
|
|
43
|
+
`)}h(Ba,"create_word_patch_diff");var ha=19e3,nl="<!-- READONLY_BOUNDARY_START -->",da={"{++":"++}","{--":"--}","{==":"==}","{>>":"<<}"},il=/\bChg:(\d+)\b/g;function pa(e){if(!e)return ["",""];let t=e.indexOf(nl);if(t===-1)return [e,""];let r=e.lastIndexOf(`
|
|
44
|
+
`,t)+1,n=e.substring(0,r).trimEnd(),a=e.substring(r);return [n,a]}h(pa,"split_structural_appendix");function ma(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:ga(u),page_content:u}],total_pages:1,body_pages:[""],body_page_offsets:[0]}}let r=al(e),[n,a]=ul(r),i;if(t&&t.trim()){let l=t.trim();i=n.map(u=>u?`${u}
|
|
45
|
+
|
|
46
|
+
${l}`:l);}else i=[...n];let s=i.length;return {pages:i.map((l,u)=>({page:u+1,total_pages:s,has_next:u+1<s,has_prev:u+1>1,tracked_change_count:ga(l),page_content:l})),total_pages:s,body_pages:n,body_page_offsets:a}}h(ma,"paginate");function al(e){let t=sl(e);return ol(t)}h(al,"_tokenize_into_atomic_blocks");function sl(e){let t={"++}":0,"--}":0,"==}":0,"<<}":0},r=[],n=0,a=0,i=e.length;for(;a<i;){let s=false;for(let[l,u]of Object.entries(da))if(e.startsWith(l,a)){t[u]++,a+=l.length,s=true;break}if(s)continue;let o=false;for(let l of Object.values(da))if(e.startsWith(l,a)){t[l]>0&&t[l]--,a+=l.length,o=true;break}if(!o){if(e[a]===`
|
|
47
|
+
`&&a+1<i&&e[a+1]===`
|
|
48
|
+
`&&Object.values(t).every(l=>l===0)){let l=e.substring(n,a);l&&r.push([l,n]);let u=a;for(;u<i&&e[u]===`
|
|
49
|
+
`;)u++;a=u,n=a;continue}a++;}}if(n<i){let s=e.substring(n,i);s&&r.push([s,n]);}return r}h(sl,"_split_on_safe_paragraph_breaks");function ol(e){if(!e.length)return e;let t=[],r=0;for(;r<e.length;){let[n,a]=e[r],i=n.trimStart();if(!(i.startsWith("## Footnotes")||i.startsWith("## Endnotes"))){t.push([n,a]),r++;continue}let o=n,l=r+1;for(;l<e.length;){let[u]=e[l],f=u.trimStart();if(f.startsWith("[^fn-")||f.startsWith("[^en-"))o=`${o}
|
|
50
|
+
|
|
51
|
+
${u}`,l++;else break}t.push([o,a]),r=l;}return t}h(ol,"_merge_footnote_sections");function ul(e){if(!e.length)return [[""],[0]];let t=[],r=[],n=[],a=0,i=-1,s=h(()=>{n.length>0&&(t.push(n.join(`
|
|
52
|
+
|
|
53
|
+
`)),r.push(i)),n=[],a=0,i=-1;},"flush_current");for(let[o,l]of e){let u=o.length,f=u+(n.length>0?2:0);if(n.length>0&&a+f>ha&&s(),n.length===0&&u>ha){t.push(o),r.push(l);continue}n.length===0&&(i=l),n.push(o),a+=a>0?f:u;}return s(),t.length?[t,r]:[[""],[0]]}h(ul,"_assemble_pages");function ga(e){let t=[...e.matchAll(il)];return new Set(t.map(n=>n[1])).size}h(ga,"_count_tracked_changes");var ll=5,_a=50;function cl(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,ll),s=a-i.length,o=[`- Edit ${e} Failed: Ambiguous match. Target text appears ${a} times. First ${i.length} occurrences:`];for(let l=0;l<i.length;l++){let[u,f]=i[l],c=Math.max(0,u-_a),d=Math.min(r.length,f+_a),p=r.substring(c,u).replace(/\n/g," "),g=r.substring(f,d).replace(/\n/g," "),m=r.substring(u,f).replace(/\n/g," ");m.length>50&&(m=m.substring(0,25)+"..."+m.substring(m.length-20));let D=c>0?"...":"",w=d<r.length?"...":"";o.push(` ${l+1}. "${D}${p}[${m}]${g}${w}"`);}return s>0&&o.push(` ... and ${s} more occurrence(s) not shown.`),o.push(" Please provide more surrounding context in your target_text to uniquely identify the location."),o.join(`
|
|
54
|
+
`)}h(cl,"format_ambiguity_error");function at(e){let t=e.nextSibling;for(;t;){if(t.nodeType===1)return t;t=t.nextSibling;}return null}h(at,"getNextElement");function kr(e){let t=e.previousSibling;for(;t;){if(t.nodeType===1)return t;t=t.previousSibling;}return null}h(kr,"getPreviousElement");function Pt(e,t){t.parentNode&&t.parentNode.insertBefore(e,t.nextSibling);}h(Pt,"insertAfter");var Pr=class extends Error{static{h(this,"BatchValidationError");}errors;constructor(e){super(`Batch validation failed:
|
|
45
55
|
`+e.join(`
|
|
46
|
-
`)),this.name="BatchValidationError",this.errors=e;}};function el(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],o=n.target_text||"",i=n.new_text||"";if((i.includes("{++")||i.includes("{--")||i.includes("{>>")||i.includes("{=="))&&t.push(`- Edit ${r+1} Failed: Do not manually write CriticMarkup tags ({++, {--, {>>, {==) in \`new_text\`. The engine handles redlining automatically. To add a comment, use the \`comment\` parameter.`),o.includes("[^")||i.includes("[^")){let a=(o.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort(),u=(i.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort();JSON.stringify(a)!==JSON.stringify(u)&&(u.length>a.length||u.some(l=>u.filter(s=>s===l).length>a.filter(s=>s===l).length)?t.push(`- Edit ${r+1} Failed: Cannot insert footnote/endnote markers via text replace. Markers like \`[^fn-N]\` are read-only projections. Use Word's References menu.`):t.push(`- Edit ${r+1} Failed: Cannot delete footnote/endnote references via text replace. The marker corresponds to a structural XML element.`));}if(o.includes("](")||i.includes("](")){let a=(o.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort(),u=(i.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort();a.length!==u.length?u.length>a.length?t.push(`- Edit ${r+1} Failed: Cannot insert hyperlinks via text replace. Use a dedicated structural operation.`):t.push(`- Edit ${r+1} Failed: Cannot delete hyperlinks via text replace. The marker corresponds to a structural XML element.`):a.length>1&&JSON.stringify(a)!==JSON.stringify(u)&&t.push(`- Edit ${r+1} Failed: Can only edit or retarget one hyperlink per text replacement. Please split into multiple edits.`);}if(o.includes("[~")||i.includes("[~")){let a=o.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[],u=i.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[];a.length!==u.length?u.length>a.length?t.push(`- Edit ${r+1} Failed: Cannot insert cross-references via text replace. Markers are read-only projections.`):t.push(`- Edit ${r+1} Failed: Cannot delete cross-references via text replace. The marker corresponds to a structural XML element.`):JSON.stringify(a)!==JSON.stringify(u)&&t.push(`- Edit ${r+1} Failed: Modifying or retargeting cross-reference markers is disallowed to prevent dependency corruption.`);}if(o.includes("{#")||i.includes("{#")){let a=o.match(/\{#[^\}]+\}/g)||[],u=i.match(/\{#[^\}]+\}/g)||[];for(let l of u)if(u.filter(s=>s===l).length>a.filter(s=>s===l).length){t.push(`- Edit ${r+1} Failed: Cannot modify or insert internal anchor markers (\`{#...}\`). These represent structural XML bookmarks.`);break}}if(n.type==="modify"&&i){let a=i.split(/[\r\n]+/);for(let u of a){let l=u.trimStart();if(l.startsWith("#######")){let s=l.length-l.replace(/^#+/,"").length;if(l.substring(s).startsWith(" ")||l.substring(s)===""){t.push(`- Edit ${r+1} Failed: Heading level ${s} is not supported (maximum is 6).`);break}}}}(o.includes("READONLY_BOUNDARY_START")||i.includes("READONLY_BOUNDARY_START")||o.includes("# Document Structure (Read-Only)")||i.includes("# Document Structure (Read-Only)"))&&t.push(`- Edit ${r+1} Failed: Modification targets the read-only boundary (Structural Appendix). This section cannot be edited.`);}return t}h(el,"validate_edit_strings");var Sn=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.contentType.includes("wordprocessingml")&&n.contentType.endsWith("+xml"))&&(n._element.hasAttribute("xmlns:w16du")||n._element.setAttribute("xmlns:w16du",r));this.current_id=this._scan_existing_ids(),this.mapper=new kt(this.doc),this.comments_manager=new ir(this.doc);}_check_punctuation_warning(e){return e&&(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}_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||"",o=r.length,a=(e._active_mapper_ref||this.mapper).full_text;if(!a)return [null,null];let u=Math.max(0,t-30),l=a.substring(u,t),s=a.substring(t+o,t+o+30),f=`${l}{--${r}--}{++${n}++}${s}`,c=f;return c=c.replace(/\{>>.*?<<\}/gs,""),c=c.replace(/\{--.*?--\}/gs,""),c=c.replace(/\{\+\+(.*?)\+\+\}/gs,"$1"),[f,c]}_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 o=parseInt(n.getAttribute("w:id")||"0",10);!isNaN(o)&&o>e&&(e=o);}}return e}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 o=S(n,"w:ins");for(let u of o){this._clean_wrapping_comments(u);let l=u.parentNode;if(l){if(l.tagName==="w:trPr"){l.removeChild(u);continue}for(;u.firstChild;)l.insertBefore(u.firstChild,u);l.removeChild(u);}}let i=S(n,"w:p");for(let u of i){let l=O(u,"w:pPr");if(l){let s=O(l,"w:rPr"),f=s?O(s,"w:del"):null;if(s&&f){let c=false;for(let d of ["w:t","w:tab","w:br"]){for(let p of S(u,d)){if(d==="w:t"&&!p.textContent)continue;let m=false,g=p.parentNode;for(;g&&g!==u;){if(g.tagName==="w:del"){m=true;break}g=g.parentNode;}if(!m){c=true;break}}if(c)break}c?s.removeChild(f):(this._clean_wrapping_comments(u),this._delete_comments_in_element(u),u.parentNode&&u.parentNode.removeChild(u));}}}let a=S(n,"w:del");for(let u of a){this._clean_wrapping_comments(u),this._delete_comments_in_element(u);let l=u.parentNode;if(l)if(l.tagName==="w:trPr"){let s=l.parentNode;s&&s.parentNode&&s.parentNode.removeChild(s);}else l.removeChild(u);}}for(let n of e){for(let i of ["w:commentRangeStart","w:commentRangeEnd"])for(let a of S(n,i))a.parentNode?.removeChild(a);let o=S(n,"w:commentReference");for(let i of o){let a=i.parentNode;a&&((a.tagName==="w:r"||a.tagName.endsWith(":r"))&&Array.from(a.childNodes).filter(l=>l.nodeType===1&&l.tagName!=="w:rPr"&&l.tagName!=="rPr").length<=1?a.parentNode?.removeChild(a):a.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 o=n.partname.startsWith("/")?n.partname:"/"+n.partname,i=n.partname.startsWith("/")?n.partname.substring(1):n.partname;r.add(o),r.add(i);}if(r.size>0){for(let o of t.parts)if(o.partname.endsWith(".rels")){let i=S(o._element,"Relationship"),a=[];for(let u of i)if((u.getAttribute("Target")||"").toLowerCase().includes("comments")){a.push(u);let s=o.partname.replace("/_rels/","/").replace(".rels",""),f=t.getPartByPath(s);if(f){let c=u.getAttribute("Id");c&&f.rels.delete(c);}}for(let u of a)u.parentNode?.removeChild(u);}let n=t.getPartByPath("[Content_Types].xml");if(n){let o=S(n._element,"Override"),i=[];for(let a of o){let u=a.getAttribute("PartName")||"";(r.has(u)||u.toLowerCase().includes("comments"))&&i.push(a);}for(let a of i)a.parentNode?.removeChild(a);}t.parts=t.parts.filter(o=>!o.partname.toLowerCase().includes("comments"));for(let o of Object.keys(t.unzipped))o.toLowerCase().includes("comments")&&delete t.unzipped[o];}}_getNextId(){return this.current_id++,this.current_id.toString()}_create_track_change_tag(e,t="",r=null){let o=this.doc.part._element.ownerDocument.createElement(e),i=r!==null?r:this._getNextId();return o.setAttribute("w:id",i),o.setAttribute("w:author",t||this.author),o.setAttribute("w:date",this.timestamp),o.setAttribute("w16du:dateUtc",this.timestamp),o}_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 o=this.comments_manager.addComment(this.author,n),i=e.ownerDocument,a=i.createElement("w:commentRangeStart");a.setAttribute("w:id",o);let u=i.createElement("w:commentRangeEnd");u.setAttribute("w:id",o);let l=i.createElement("w:r"),s=i.createElement("w:rPr"),f=i.createElement("w:rStyle");f.setAttribute("w:val","CommentReference"),s.appendChild(f),l.appendChild(s);let c=i.createElement("w:commentReference");c.setAttribute("w:id",o),l.appendChild(c),e.insertBefore(a,t);let d=r.nextSibling;d?(e.insertBefore(u,d),e.insertBefore(l,u.nextSibling)):(e.appendChild(u),e.appendChild(l));}_attach_comment_spanning(e,t,r,n,o){if(!o)return;let i=this.comments_manager.addComment(this.author,o),a=e.ownerDocument,u=r.ownerDocument,l=a.createElement("w:commentRangeStart");l.setAttribute("w:id",i);let s=u.createElement("w:commentRangeEnd");s.setAttribute("w:id",i);let f=u.createElement("w:r"),c=u.createElement("w:rPr"),d=u.createElement("w:rStyle");d.setAttribute("w:val","CommentReference"),c.appendChild(d),f.appendChild(c);let p=u.createElement("w:commentReference");p.setAttribute("w:id",i),f.appendChild(p),e.insertBefore(l,t);let m=n.nextSibling;m?(r.insertBefore(s,m),r.insertBefore(f,s.nextSibling)):(r.appendChild(s),r.appendChild(f));}_track_insert_multiline(e,t,r,n){if(!e)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let o=this.doc.part._element.ownerDocument,i=e.split(/[\r\n]+/),a=null;if(r!==null)a=r._element;else if(t!==null){let E=t._element;for(;E&&E.tagName!=="w:p";)E=E.parentNode;a=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[u,l]=this._parse_markdown_style(i[0]),f=l!==null&&a!==null,c=null,d=null;f||(d=this._build_tracked_ins_for_line((u===i[0],i[0]),t,n,o),c=d);let p=f?i:i.slice(1);if(p.length===0)return {first_node:c,last_p:null,last_ins:d,used_block_mode:false};if(!a)return {first_node:c,last_p:null,last_ins:d,used_block_mode:false};let m=a.parentNode;if(!m)return {first_node:c,last_p:null,last_ins:d,used_block_mode:false};let g=h((E,w)=>{m.insertBefore(E,w.nextSibling);},"insertAfterEl"),b=null,_=null,v=a;for(let E=0;E<p.length;E++){let w=p[E],[D,y]=this._parse_markdown_style(w),A=o.createElement("w:p");if(y)this._set_paragraph_style(A,y);else {let M=O(a,"w:pPr");M&&A.appendChild(M.cloneNode(true));}let C=O(A,"w:pPr");C||(C=o.createElement("w:pPr"),A.insertBefore(C,A.firstChild));let N=O(C,"w:rPr");N||(N=o.createElement("w:rPr"),C.appendChild(N));let B=this._create_track_change_tag("w:ins","",n);N.appendChild(B);let x=this._build_tracked_ins_for_line(D,t,n,o);x&&A.appendChild(x),g(A,v),v=A,b=A,_=x,c||(c=A);}return {first_node:c,last_p:b,last_ins:_,used_block_mode:f}}_build_tracked_ins_for_line(e,t,r,n){if(!e&&e!=="")return null;let o=this._create_track_change_tag("w:ins","",r),i=this._parse_inline_markdown(e);if(i.length===0)return null;for(let[a,u]of i){let l=n.createElement("w:r");if(t&&t._element){let f=O(t._element,"w:rPr");if(f){let c=f.cloneNode(true);for(let d of ["w:vanish","w:strike","w:dstrike","w:i","w:iCs","w:b","w:bCs"]){let p=O(c,d);p&&c.removeChild(p);}l.appendChild(c);}}this._apply_run_props(l,u,false);let s=n.createElement("w:t");this._set_text_content(s,a),l.appendChild(s),o.appendChild(l);}return o}_parse_markdown_style(e){let t=e.trimStart();if(t.startsWith("#")){let n=0,o=t;for(;o.startsWith("#");)n++,o=o.substring(1);if(o.startsWith(" "))return [o.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 o=n.index,i=n[0],a=o+i.length,u=i.startsWith("**"),l=u?i.substring(2,i.length-2):i.substring(1,i.length-1),s=e.substring(0,o),f=e.substring(a),c=[];s&&c.push([s,t]);let d={...t};return u?d.bold=true:d.italic=true,c.push(...this._parse_inline_markdown(l,d)),c.push(...this._parse_inline_markdown(f,t)),c}_apply_run_props(e,t,r=false){if(!t){if(!r)return;t={};}let n=O(e,"w:rPr");if(!n&&(t.bold||t.italic||r)&&(n=e.ownerDocument.createElement("w:rPr"),e.appendChild(n)),n){let o=e.ownerDocument;if(t.bold){let i=O(n,"w:b");i||(i=o.createElement("w:b"),n.appendChild(i)),i.setAttribute("w:val","1");}else if(r){let i=O(n,"w:b");i&&n.removeChild(i);}if(t.italic){let i=O(n,"w:i");i||(i=o.createElement("w:i"),n.appendChild(i)),i.setAttribute("w:val","1");}else if(r){let i=O(n,"w:i");i&&n.removeChild(i);}}}_set_paragraph_style(e,t){let r=e.ownerDocument,n=O(e,"w:pPr");n&&e.removeChild(n);let o=r.createElement("w:pPr"),i=r.createElement("w:pStyle"),a=t.replace(/\s+/g,"");i.setAttribute("w:val",a),o.appendChild(i),e.insertBefore(o,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 o=n[0],i=r.createElement("w:commentRangeStart");i.setAttribute("w:id",t),Pt(i,o);let a=S(this.doc.element,"w:commentRangeEnd").filter(g=>g.getAttribute("w:id")===e);if(a.length===0)return;let u=a[0],l=S(this.doc.element,"w:commentReference").filter(g=>g.getAttribute("w:id")===e),s=u;if(l.length>0){let g=l[0];g.parentNode&&g.parentNode.tagName==="w:r"&&(s=g.parentNode);}let f=r.createElement("w:commentRangeEnd");f.setAttribute("w:id",t),Pt(f,s);let c=r.createElement("w:r"),d=r.createElement("w:rPr"),p=r.createElement("w:rStyle");p.setAttribute("w:val","CommentReference"),d.appendChild(p),c.appendChild(d);let m=r.createElement("w:commentReference");m.setAttribute("w:id",t),c.appendChild(m),Pt(c,f);}_clean_wrapping_comments(e){let t=e;for(;;){let l=kr(t);if(l&&(l.tagName==="w:ins"||l.tagName==="w:del"))t=l;else break}let r=e;for(;;){let l=ot(r);if(l&&(l.tagName==="w:ins"||l.tagName==="w:del"))r=l;else break}let n=[],o=kr(t);for(;o;)if(o.tagName==="w:commentRangeStart")n.push(o),o=kr(o);else if(o.tagName==="w:rPr"||o.tagName==="w:pPr")o=kr(o);else break;let i=[],a=ot(r);for(;a;)if(a.tagName==="w:commentRangeEnd")i.push(a),a=ot(a);else if(a.tagName==="w:r"&&S(a,"w:commentReference").length>0)i.push(a),a=ot(a);else if(a.tagName==="w:commentReference")i.push(a),a=ot(a);else break;let u=new Set;for(let l of i)if(l.tagName==="w:commentRangeEnd"){let s=l.getAttribute("w:id");s&&u.add(s);}else {let s=S(l,"w:commentReference")[0];if(!s&&l.tagName==="w:commentReference"&&(s=l),s){let f=s.getAttribute("w:id");f&&u.add(f);}}for(let l of n){let s=l.getAttribute("w:id");if(s&&u.has(s)){this.comments_manager.deleteComment(s),l.parentNode&&l.parentNode.removeChild(l);for(let f of i){let c=null;if(f.tagName==="w:commentRangeEnd")c=f.getAttribute("w:id");else {let d=S(f,"w:commentReference")[0];!d&&f.tagName==="w:commentReference"&&(d=f),d&&(c=d.getAttribute("w:id"));}c===s&&f.parentNode&&f.parentNode.removeChild(f);}}}}_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 o of ["w:commentRangeStart","w:commentRangeEnd"]){let i=S(this.doc.element,o);for(let a of i)a.getAttribute("w:id")===n&&a.parentNode&&a.parentNode.removeChild(a);}}}}validate_edits(e){let t=[];this.mapper.full_text||this.mapper._build_map(),t.push(...el(e));for(let r=0;r<e.length;r++){let n=e[r];if(!n.target_text)continue;let o=this.mapper.find_all_match_indices(n.target_text),i=this.mapper.full_text;this.mapper;o.length===0&&(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),o=this.clean_mapper.find_all_match_indices(n.target_text),o.length>0&&(i=this.clean_mapper.full_text,this.clean_mapper)),i===this.mapper.full_text&&o.length>0&&(o=o.filter(([f,c])=>{let d=this.mapper.spans.filter(p=>p.run!==null&&p.end>f&&p.start<f+c);return d.length===0?true:d.some(p=>!p.del_id)}));let u=false,l=new Set;if(o.length===0){this.original_mapper||(this.original_mapper=new kt(this.doc,false,true));let s=this.original_mapper.find_all_match_indices(n.target_text);if(s.length>0){u=true;for(let[f,c]of s){let d=this.original_mapper.spans.filter(p=>p.end>f&&p.start<f+c);for(let p of d)if(p.run!==null){let m=p.run._element;for(;m;){if(m.nodeType===1&&m.tagName==="w:del"){let g=m.getAttribute("w:author");g&&l.add(g);break}m=m.parentNode;}}}}}if(o.length===0)if(u){let s=l.size>0?`by ${Array.from(l).sort().join(", ")}`:"by an existing revision";t.push(`- Edit ${r+1} Failed: Target text matches text inside a tracked deletion ${s}. Reject/accept that change first or target the active replacement text instead.`);}else t.push(`- Edit ${r+1} Failed: Target text not found in document:
|
|
47
|
-
"${n.target_text}"`);else if(o.length>1){let s=o.map(([f,c])=>[f,f+c]);t.push(Ku(r+1,n.target_text,i,s));}if(o.length===1){let[s,f]=o[0],c=i.substring(s,s+f),[d,p]=bn(c,n.new_text||""),m=c.length-p,g=c.substring(d,m),b=(n.new_text||"").substring(d,(n.new_text||"").length-p);if(g.includes(`
|
|
56
|
+
`)),this.name="BatchValidationError",this.errors=e;}};function fl(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],a=n.target_text||"",i=n.new_text||"";if((i.includes("{++")||i.includes("{--")||i.includes("{>>")||i.includes("{=="))&&t.push(`- Edit ${r+1} Failed: Do not manually write CriticMarkup tags ({++, {--, {>>, {==) in \`new_text\`. The engine handles redlining automatically. To add a comment, use the \`comment\` parameter.`),a.includes("[^")||i.includes("[^")){let s=(a.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort(),o=(i.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort();JSON.stringify(s)!==JSON.stringify(o)&&(o.length>s.length||o.some(l=>o.filter(u=>u===l).length>s.filter(u=>u===l).length)?t.push(`- Edit ${r+1} Failed: Cannot insert footnote/endnote markers via text replace. Markers like \`[^fn-N]\` are read-only projections. Use Word's References menu.`):t.push(`- Edit ${r+1} Failed: Cannot delete footnote/endnote references via text replace. The marker corresponds to a structural XML element.`));}if(a.includes("](")||i.includes("](")){let s=(a.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort(),o=(i.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort();s.length!==o.length?o.length>s.length?t.push(`- Edit ${r+1} Failed: Cannot insert hyperlinks via text replace. Use a dedicated structural operation.`):t.push(`- Edit ${r+1} Failed: Cannot delete hyperlinks via text replace. The marker corresponds to a structural XML element.`):s.length>1&&JSON.stringify(s)!==JSON.stringify(o)&&t.push(`- Edit ${r+1} Failed: Can only edit or retarget one hyperlink per text replacement. Please split into multiple edits.`);}if(a.includes("[~")||i.includes("[~")){let s=a.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[],o=i.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[];s.length!==o.length?o.length>s.length?t.push(`- Edit ${r+1} Failed: Cannot insert cross-references via text replace. Markers are read-only projections.`):t.push(`- Edit ${r+1} Failed: Cannot delete cross-references via text replace. The marker corresponds to a structural XML element.`):JSON.stringify(s)!==JSON.stringify(o)&&t.push(`- Edit ${r+1} Failed: Modifying or retargeting cross-reference markers is disallowed to prevent dependency corruption.`);}if(a.includes("{#")||i.includes("{#")){let s=a.match(/\{#[^\}]+\}/g)||[],o=i.match(/\{#[^\}]+\}/g)||[];for(let l of o)if(o.filter(u=>u===l).length>s.filter(u=>u===l).length){t.push(`- Edit ${r+1} Failed: Cannot modify or insert internal anchor markers (\`{#...}\`). These represent structural XML bookmarks.`);break}}if(n.type==="modify"&&i){let s=i.split(/[\r\n]+/);for(let o of s){let l=o.trimStart();if(l.startsWith("#######")){let u=l.length-l.replace(/^#+/,"").length;if(l.substring(u).startsWith(" ")||l.substring(u)===""){t.push(`- Edit ${r+1} Failed: Heading level ${u} is not supported (maximum is 6).`);break}}}}(a.includes("READONLY_BOUNDARY_START")||i.includes("READONLY_BOUNDARY_START")||a.includes("# Document Structure (Read-Only)")||i.includes("# Document Structure (Read-Only)"))&&t.push(`- Edit ${r+1} Failed: Modification targets the read-only boundary (Structural Appendix). This section cannot be edited.`);}return t}h(fl,"validate_edit_strings");var Sn=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.contentType.includes("wordprocessingml")&&n.contentType.endsWith("+xml"))&&(n._element.hasAttribute("xmlns:w16du")||n._element.setAttribute("xmlns:w16du",r));this.current_id=this._scan_existing_ids(),this.mapper=new kt(this.doc),this.comments_manager=new ir(this.doc);}_check_punctuation_warning(e){return e&&(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}_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=r.length,s=(e._active_mapper_ref||this.mapper).full_text;if(!s)return [null,null];let o=Math.max(0,t-30),l=s.substring(o,t),u=s.substring(t+a,t+a+30),f=n?`{++${n}++}`:"",c=`${l}{--${r}--}${f}${u}`,d=c;return d=d.replace(/\{>>.*?<<\}/gs,""),d=d.replace(/\{--.*?--\}/gs,""),d=d.replace(/\{\+\+(.*?)\+\+\}/gs,"$1"),[c,d]}_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(`
|
|
57
|
+
`),s=[],o=999;for(let l=i.length-1;l>=0;l--){let f=i[l].match(/^(#{1,6})\s+(.*)/);if(f){let c=f[1].length;if(c<o){let d=f[2].replace(/\*\*|__|[*_]/g,"").replace(/\{#[^}]+\}/g,"").trim();if(d.length>80&&(d=d.substring(0,80)+"..."),s.unshift(d),o=c,c===1)break}}}return [s.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 o of a){this._clean_wrapping_comments(o);let l=o.parentNode;if(l){if(l.tagName==="w:trPr"){l.removeChild(o);continue}for(;o.firstChild;)l.insertBefore(o.firstChild,o);l.removeChild(o);}}let i=S(n,"w:p");for(let o of i){let l=R(o,"w:pPr");if(l){let u=R(l,"w:rPr"),f=u?R(u,"w:del"):null;if(u&&f){let c=false;for(let d of ["w:t","w:tab","w:br"]){for(let p of S(o,d)){if(d==="w:t"&&!p.textContent)continue;let g=false,m=p.parentNode;for(;m&&m!==o;){if(m.tagName==="w:del"){g=true;break}m=m.parentNode;}if(!g){c=true;break}}if(c)break}c?u.removeChild(f):(this._clean_wrapping_comments(o),this._delete_comments_in_element(o),o.parentNode&&o.parentNode.removeChild(o));}}}let s=S(n,"w:del");for(let o of s){this._clean_wrapping_comments(o),this._delete_comments_in_element(o);let l=o.parentNode;if(l)if(l.tagName==="w:trPr"){let u=l.parentNode;u&&u.parentNode&&u.parentNode.removeChild(u);}else l.removeChild(o);}}for(let n of e){for(let i of ["w:commentRangeStart","w:commentRangeEnd"])for(let s of S(n,i))s.parentNode?.removeChild(s);let a=S(n,"w:commentReference");for(let i of a){let s=i.parentNode;s&&((s.tagName==="w:r"||s.tagName.endsWith(":r"))&&Array.from(s.childNodes).filter(l=>l.nodeType===1&&l.tagName!=="w:rPr"&&l.tagName!=="rPr").length<=1?s.parentNode?.removeChild(s):s.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"),s=[];for(let o of i)if((o.getAttribute("Target")||"").toLowerCase().includes("comments")){s.push(o);let u=a.partname.replace("/_rels/","/").replace(".rels",""),f=t.getPartByPath(u);if(f){let c=o.getAttribute("Id");c&&f.rels.delete(c);}}for(let o of s)o.parentNode?.removeChild(o);}let n=t.getPartByPath("[Content_Types].xml");if(n){let a=S(n._element,"Override"),i=[];for(let s of a){let o=s.getAttribute("PartName")||"";(r.has(o)||o.toLowerCase().includes("comments"))&&i.push(s);}for(let s of i)s.parentNode?.removeChild(s);}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];}}_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,s=i.createElement("w:commentRangeStart");s.setAttribute("w:id",a);let o=i.createElement("w:commentRangeEnd");o.setAttribute("w:id",a);let l=i.createElement("w:r"),u=i.createElement("w:rPr"),f=i.createElement("w:rStyle");f.setAttribute("w:val","CommentReference"),u.appendChild(f),l.appendChild(u);let c=i.createElement("w:commentReference");c.setAttribute("w:id",a),l.appendChild(c),e.insertBefore(s,t);let d=r.nextSibling;d?(e.insertBefore(o,d),e.insertBefore(l,o.nextSibling)):(e.appendChild(o),e.appendChild(l));}_attach_comment_spanning(e,t,r,n,a){if(!a)return;let i=this.comments_manager.addComment(this.author,a),s=e.ownerDocument,o=r.ownerDocument,l=s.createElement("w:commentRangeStart");l.setAttribute("w:id",i);let u=o.createElement("w:commentRangeEnd");u.setAttribute("w:id",i);let f=o.createElement("w:r"),c=o.createElement("w:rPr"),d=o.createElement("w:rStyle");d.setAttribute("w:val","CommentReference"),c.appendChild(d),f.appendChild(c);let p=o.createElement("w:commentReference");p.setAttribute("w:id",i),f.appendChild(p),e.insertBefore(l,t);let g=n.nextSibling;g?(r.insertBefore(u,g),r.insertBefore(f,u.nextSibling)):(r.appendChild(u),r.appendChild(f));}_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]+/),s=null;if(r!==null)s=r._element;else if(t!==null){let E=t._element;for(;E&&E.tagName!=="w:p";)E=E.parentNode;s=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[o,l]=this._parse_markdown_style(i[0]),f=l!==null&&s!==null,c=null,d=null;f||(d=this._build_tracked_ins_for_line((o===i[0],i[0]),t,n,a),c=d);let p=f?i:i.slice(1);if(p.length===0)return {first_node:c,last_p:null,last_ins:d,used_block_mode:false};if(!s)return {first_node:c,last_p:null,last_ins:d,used_block_mode:false};let g=s.parentNode;if(!g)return {first_node:c,last_p:null,last_ins:d,used_block_mode:false};let m=h((E,_)=>{g.insertBefore(E,_.nextSibling);},"insertAfterEl"),D=null,w=null,v=s;for(let E=0;E<p.length;E++){let _=p[E],[b,y]=this._parse_markdown_style(_),A=a.createElement("w:p");if(y)this._set_paragraph_style(A,y);else {let O=R(s,"w:pPr");O&&A.appendChild(O.cloneNode(true));}let N=R(A,"w:pPr");N||(N=a.createElement("w:pPr"),A.insertBefore(N,A.firstChild));let C=R(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 x=this._build_tracked_ins_for_line(b,t,n,a);x&&A.appendChild(x),m(A,v),v=A,D=A,w=x,c||(c=A);}return {first_node:c,last_p:D,last_ins:w,used_block_mode:f}}_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[s,o]of i){let l=n.createElement("w:r");if(t&&t._element){let f=R(t._element,"w:rPr");if(f){let c=f.cloneNode(true);for(let d of ["w:vanish","w:strike","w:dstrike","w:i","w:iCs","w:b","w:bCs"]){let p=R(c,d);p&&c.removeChild(p);}l.appendChild(c);}}this._apply_run_props(l,o,false);let u=n.createElement("w:t");this._set_text_content(u,s),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],s=a+i.length,o=i.startsWith("**"),l=o?i.substring(2,i.length-2):i.substring(1,i.length-1),u=e.substring(0,a),f=e.substring(s),c=[];u&&c.push([u,t]);let d={...t};return o?d.bold=true:d.italic=true,c.push(...this._parse_inline_markdown(l,d)),c.push(...this._parse_inline_markdown(f,t)),c}_apply_run_props(e,t,r=false){if(!t){if(!r)return;t={};}let n=R(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=R(n,"w:b");i||(i=a.createElement("w:b"),n.appendChild(i)),i.setAttribute("w:val","1");}else if(r){let i=R(n,"w:b");i&&n.removeChild(i);}if(t.italic){let i=R(n,"w:i");i||(i=a.createElement("w:i"),n.appendChild(i)),i.setAttribute("w:val","1");}else if(r){let i=R(n,"w:i");i&&n.removeChild(i);}}}_set_paragraph_style(e,t){let r=e.ownerDocument,n=R(e,"w:pPr");n&&e.removeChild(n);let a=r.createElement("w:pPr"),i=r.createElement("w:pStyle"),s=t.replace(/\s+/g,"");i.setAttribute("w:val",s),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(m=>m.getAttribute("w:id")===e);if(n.length===0)return;let a=n[0],i=r.createElement("w:commentRangeStart");i.setAttribute("w:id",t),Pt(i,a);let s=S(this.doc.element,"w:commentRangeEnd").filter(m=>m.getAttribute("w:id")===e);if(s.length===0)return;let o=s[0],l=S(this.doc.element,"w:commentReference").filter(m=>m.getAttribute("w:id")===e),u=o;if(l.length>0){let m=l[0];m.parentNode&&m.parentNode.tagName==="w:r"&&(u=m.parentNode);}let f=r.createElement("w:commentRangeEnd");f.setAttribute("w:id",t),Pt(f,u);let c=r.createElement("w:r"),d=r.createElement("w:rPr"),p=r.createElement("w:rStyle");p.setAttribute("w:val","CommentReference"),d.appendChild(p),c.appendChild(d);let g=r.createElement("w:commentReference");g.setAttribute("w:id",t),c.appendChild(g),Pt(c,f);}_clean_wrapping_comments(e){let t=e;for(;;){let l=kr(t);if(l&&(l.tagName==="w:ins"||l.tagName==="w:del"))t=l;else break}let r=e;for(;;){let l=at(r);if(l&&(l.tagName==="w:ins"||l.tagName==="w:del"))r=l;else break}let n=[],a=kr(t);for(;a;)if(a.tagName==="w:commentRangeStart")n.push(a),a=kr(a);else if(a.tagName==="w:rPr"||a.tagName==="w:pPr")a=kr(a);else break;let i=[],s=at(r);for(;s;)if(s.tagName==="w:commentRangeEnd")i.push(s),s=at(s);else if(s.tagName==="w:r"&&S(s,"w:commentReference").length>0)i.push(s),s=at(s);else if(s.tagName==="w:commentReference")i.push(s),s=at(s);else break;let o=new Set;for(let l of i)if(l.tagName==="w:commentRangeEnd"){let u=l.getAttribute("w:id");u&&o.add(u);}else {let u=S(l,"w:commentReference")[0];if(!u&&l.tagName==="w:commentReference"&&(u=l),u){let f=u.getAttribute("w:id");f&&o.add(f);}}for(let l of n){let u=l.getAttribute("w:id");if(u&&o.has(u)){this.comments_manager.deleteComment(u),l.parentNode&&l.parentNode.removeChild(l);for(let f of i){let c=null;if(f.tagName==="w:commentRangeEnd")c=f.getAttribute("w:id");else {let d=S(f,"w:commentReference")[0];!d&&f.tagName==="w:commentReference"&&(d=f),d&&(c=d.getAttribute("w:id"));}c===u&&f.parentNode&&f.parentNode.removeChild(f);}}}}_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 s of i)s.getAttribute("w:id")===n&&s.parentNode&&s.parentNode.removeChild(s);}}}}validate_edits(e){let t=[];this.mapper.full_text||this.mapper._build_map(),t.push(...fl(e));for(let r=0;r<e.length;r++){let n=e[r];if(!n.target_text)continue;let a=n.regex||false,i=n.match_mode||"strict",s=this.mapper.find_all_match_indices(n.target_text,a),o=this.mapper.full_text;this.mapper;s.length===0&&(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),s=this.clean_mapper.find_all_match_indices(n.target_text,a),s.length>0&&(o=this.clean_mapper.full_text,this.clean_mapper)),o===this.mapper.full_text&&s.length>0&&(s=s.filter(([d,p])=>{let g=this.mapper.spans.filter(m=>m.run!==null&&m.end>d&&m.start<d+p);return g.length===0?true:g.some(m=>!m.del_id)}));let u=false,f=new Set;if(s.length===0){this.original_mapper||(this.original_mapper=new kt(this.doc,false,true));let c=this.original_mapper.find_all_match_indices(n.target_text,a);if(c.length>0){u=true;for(let[d,p]of c){let g=this.original_mapper.spans.filter(m=>m.end>d&&m.start<d+p);for(let m of g)if(m.run!==null){let D=m.run._element;for(;D;){if(D.nodeType===1&&D.tagName==="w:del"){let w=D.getAttribute("w:author");w&&f.add(w);break}D=D.parentNode;}}}}}if(s.length===0)if(u){let c=f.size>0?`by ${Array.from(f).sort().join(", ")}`:"by an existing revision";t.push(`- Edit ${r+1} Failed: Target text matches text inside a tracked deletion ${c}. Reject/accept that change first or target the active replacement text instead.`);}else t.push(`- Edit ${r+1} Failed: Target text not found in document:
|
|
58
|
+
"${n.target_text}"`);else if(s.length>1&&i==="strict"){let c=s.map(([d,p])=>[d,d+p]);t.push(cl(r+1,n.target_text,o,c));}if(s.length===1){let[c,d]=s[0],p=o.substring(c,c+d),[g,m]=bn(p,n.new_text||""),D=p.length-m,w=p.substring(g,D),v=(n.new_text||"").substring(g,(n.new_text||"").length-m);if(w.includes(`
|
|
48
59
|
|
|
49
|
-
`))if(
|
|
60
|
+
`))if(v.includes(`
|
|
50
61
|
|
|
51
|
-
`)){let
|
|
62
|
+
`)){let E=p.split(`
|
|
52
63
|
|
|
53
|
-
`);
|
|
64
|
+
`);E.length>=2&&E[0].trim()!==""&&E[E.length-1].trim()!==""&&t.push(`- Edit ${r+1} 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 E=w.split(`
|
|
54
65
|
|
|
55
|
-
`);_.length>=2&&_[0].trim()!==""&&_[_.length-1].trim()!==""&&t.push(`- Edit ${r+1} 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[s,f]of o){let c=this.mapper.spans.filter(p=>p.end>s&&p.start<s+f),d=new Set;for(let p of c)if(p.ins_id){let m=S(this.doc.element,"w:ins").filter(g=>g.getAttribute("w:id")===p.ins_id);if(m.length>0){let g=m[0].getAttribute("w:author");g&&g!==this.author&&d.add(g);}}d.size>0&&t.push(`- Edit ${r+1} Failed: Modification targets an active insertion from another author (${Array.from(d).join(", ")}). Accept that change first or scope your edit outside of it.`);}}return t}validate_review_actions(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],o=n.type;if(o==="reply"){let i=n.target_id.replace("Com:",""),a=false,u=this.doc.pkg.parts.find(l=>l.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");u&&(a=S(u._element,"w:comment").some(s=>s.getAttribute("w:id")===i)),a||t.push(`- Action ${r+1} Failed: Target comment ID ${n.target_id} not found.`);}else if(o==="accept"||o==="reject"){let i=n.target_id.replace("Chg:",""),a=S(this.doc.element,"w:ins").filter(l=>l.getAttribute("w:id")===i),u=S(this.doc.element,"w:del").filter(l=>l.getAttribute("w:id")===i);a.length===0&&u.length===0&&t.push(`- Action ${r+1} Failed: Target ID ${n.target_id} not found.`);}}return t}process_batch(e,t=false){if(t){let r=new Map;for(let n of this.doc.pkg.parts)n._element&&r.set(n,n._element.cloneNode(true));try{return this._process_batch_internal(e,!0)}finally{for(let[n,o]of r.entries()){let i=n._element.ownerDocument;i&&i.documentElement&&i.replaceChild(o,i.documentElement),n._element=o;}this.mapper=new kt(this.doc),this.comments_manager=new ir(this.doc),this.clean_mapper=null;}}else return this._process_batch_internal(e,false)}_process_batch_internal(e,t=false){this.skipped_details=[];let r=e.filter(s=>["accept","reject","reply"].includes(s.type)),n=e.filter(s=>!["accept","reject","reply"].includes(s.type));if(t){if(r.length>0){let s=this.validate_review_actions(r);if(s.length>0)throw new Pr(s)}}else {let s=[];if(r.length>0&&s.push(...this.validate_review_actions(r)),n.length>0&&s.push(...this.validate_edits(n)),s.length>0)throw new Pr(s)}let o=0,i=0;if(r.length>0){let s=this.apply_review_actions(r);if(o=s[0],i=s[1],i>0)throw new Pr(this.skipped_details);o>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let a=[],u=0,l=0;if(n.length>0)if(t)for(let s of n){let f=this.validate_edits([s]),c=this._check_punctuation_warning(s.target_text||"");if(f.length>0){l++,a.push({status:"failed",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:f[0],critic_markup:null,clean_text:null});continue}if(this.apply_edits([s])[0]>0){u++;let m=this._build_edit_context_previews(s);a.push({status:"applied",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:null,critic_markup:m[0],clean_text:m[1]});}else {l++;let m=this.skipped_details.length>0?this.skipped_details[this.skipped_details.length-1]:"Failed to apply edit";a.push({status:"failed",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:m,critic_markup:null,clean_text:null});}}else {let s=this.validate_edits(n);if(s.length>0)throw new Pr(s);let f=n.map(d=>JSON.parse(JSON.stringify(d))),c=this.apply_edits(f);u=c[0],l=c[1];for(let d of f){let p=d._applied_status||false,m=d._error_msg||null,g=this._check_punctuation_warning(d.target_text||""),b=null,_=null;if(p){let v=this._build_edit_context_previews(d);b=v[0],_=v[1];}a.push({status:p?"applied":"failed",target_text:d.target_text||"",new_text:d.new_text||"",warning:g,error:m,critic_markup:b,clean_text:_});}}return {actions_applied:o,actions_skipped:i,edits_applied:u,edits_skipped:l,skipped_details:this.skipped_details,edits:a,engine:"node",version:"1.10.0"}}apply_edits(e){let t=0,r=0,n=[];for(let i of e)i._applied_status=false,i._error_msg=null;for(let i of e)if(i._resolved_start_idx!==void 0&&i._resolved_start_idx!==null)n.push([i,i.new_text||null]);else if(i._match_start_index!==void 0&&i._match_start_index!==null)i._resolved_start_idx=i._match_start_index,n.push([i,i.new_text||null]);else if(i.type==="insert_row"||i.type==="delete_row"){let a=this.mapper.find_all_match_indices(i.target_text);if(a.length===0&&(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),a=this.clean_mapper.find_all_match_indices(i.target_text)),a.length>0)i._resolved_start_idx=a[0][0],n.push([i,null]);else {r++,i._applied_status=false;let l=`- Failed to locate row target: '${(i.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(l),i._error_msg=l;}}else {let a=this._pre_resolve_heuristic_edit(i);if(a)if(Array.isArray(a))for(let u of a)u._resolved_start_idx=u._match_start_index,u._parent_edit_ref=i,(i._resolved_start_idx===void 0||i._resolved_start_idx===null)&&(i._resolved_start_idx=u._resolved_start_idx),i._resolved_proxy_edit||(i._resolved_proxy_edit=u),n.push([u,u.new_text]);else a._resolved_start_idx=a._match_start_index,a._parent_edit_ref=i,i._resolved_start_idx=a._resolved_start_idx,i._resolved_proxy_edit=a,n.push([a,a.new_text]);else {r++,i._applied_status=false;let s=`- Failed to apply edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(s),i._error_msg=s;}}n.sort((i,a)=>(a[0]._resolved_start_idx||0)-(i[0]._resolved_start_idx||0));let o=[];for(let[i,a]of n){let u=i._resolved_start_idx||0,l=u+(i.target_text?i.target_text.length:0);if(o.some(([c,d])=>u<d&&l>c)){r++;let p=`- Skipped overlapping edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(p),i._applied_status=false,i._error_msg=p;let m=i._parent_edit_ref;m&&(m._applied_status=false,m._error_msg=p);continue}let f=false;if(i.type==="modify"?f=this._apply_single_edit_indexed(i,a,false):(i.type==="insert_row"||i.type==="delete_row")&&(f=this._apply_table_edit(i,false)),f){t++,o.push([u,l]),i._applied_status=true;let c=i._parent_edit_ref;c&&(c._applied_status=true);}else {r++;let p=`- Failed to apply edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(p),i._applied_status=false,i._error_msg=p;let m=i._parent_edit_ref;m&&(m._applied_status||(m._applied_status=false,m._error_msg=p));}}return [t,r]}apply_review_actions(e){let t=0,r=0;for(let n of e){let o=n.type;if(o==="reply"){let s=n.target_id.replace("Com:",""),f=this.comments_manager.addComment(this.author,n.text,s);this._anchor_reply_comment(s,f),t++;continue}let i=n.target_id.replace("Chg:",""),a=S(this.doc.element,"w:ins").filter(s=>s.getAttribute("w:id")===i),u=S(this.doc.element,"w:del").filter(s=>s.getAttribute("w:id")===i),l=[...a,...u];if(l.length===0){r++,this.skipped_details.push(`- Failed to apply action: Target ID ${n.target_id} not found.`);continue}for(let s of l){let f=s.tagName==="w:ins",d=(s.parentNode?s.parentNode.tagName:"")==="w:trPr";if(o==="accept")if(f)if(this._clean_wrapping_comments(s),d)s.parentNode?.removeChild(s);else {for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.parentNode?.removeChild(s);}else if(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),d){let p=s.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else s.parentNode?.removeChild(s);else if(o==="reject")if(f)if(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),d){let p=s.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else s.parentNode?.removeChild(s);else if(this._clean_wrapping_comments(s),d)s.parentNode?.removeChild(s);else {let p=Array.from(s.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(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.parentNode?.removeChild(s);}}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,o]=this.mapper.get_insertion_anchor(r,t),i=null;if(n?i=n._element:o&&(i=o._element),!i)return false;let a=i;for(;a&&a.tagName!=="w:tr";)a=a.parentNode;if(!a)return false;if(e.type==="delete_row"){let u=O(a,"w:trPr");return u||(u=a.ownerDocument.createElement("w:trPr"),a.insertBefore(u,a.firstChild)),u.appendChild(this._create_track_change_tag("w:del")),true}else if(e.type==="insert_row"){let u=a.ownerDocument.createElement("w:tr"),l=a.ownerDocument.createElement("w:trPr");u.appendChild(l),l.appendChild(this._create_track_change_tag("w:ins"));for(let s of e.cells){let f=a.ownerDocument.createElement("w:tc"),c=a.ownerDocument.createElement("w:p"),d=a.ownerDocument.createElement("w:r"),p=a.ownerDocument.createElement("w:t");p.textContent=s,s.trim()!==s&&p.setAttribute("xml:space","preserve"),d.appendChild(p),c.appendChild(d),f.appendChild(c),u.appendChild(f);}return e.position==="above"?a.parentNode?.insertBefore(u,a):Pt(u,a),true}return false}_first_live_match(e){let t=this.mapper.find_all_match_indices(e);if(t.length<=1)return this.mapper.find_match_index(e);for(let[r,n]of t){let o=this.mapper.spans.filter(i=>i.run!==null&&i.end>r&&i.start<r+n);if(o.length===0)return [r,n];if(o.some(i=>!i.del_id))return [r,n]}return this.mapper.find_match_index(e)}_pre_resolve_heuristic_edit(e){if(!e.target_text)return null;let[t,r]=this._first_live_match(e.target_text),n=false;if(t===-1)if(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),[t,r]=this.clean_mapper.find_match_index(e.target_text),t!==-1)n=true;else return null;let o=n?this.clean_mapper:this.mapper,i=e.new_text||"",a=this.mapper.full_text.substring(t,t+r);if(a===i||e.target_text===i)return {type:"modify",target_text:a,new_text:a,comment:e.comment,_match_start_index:t,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o};let u="",l="",s="",f=t;if(i.startsWith(a))u="INSERTION",s=i.substring(a.length),f=t+r;else {let[c,d]=bn(a,i),p=a.length-d,m=i.length-d;l=a.substring(c,p),s=i.substring(c,m),f=t+c,!l&&s?u="INSERTION":l&&!s?u="DELETION":l&&s?u="MODIFICATION":u="COMMENT_ONLY";}return {type:"modify",target_text:l,new_text:s,comment:e.comment,_match_start_index:f,_internal_op:u,_active_mapper_ref:o}}_apply_single_edit_indexed(e,t,r){let n=e._internal_op,o=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,a=e.target_text?e.target_text.length:0,u=["DELETION","MODIFICATION"].includes(n)?this._getNextId():null,l=["INSERTION","MODIFICATION"].includes(n)?this._getNextId():null;if(n==="COMMENT_ONLY"){let _=o.find_target_runs_by_index(i,a,r);if(_.length===0)return false;if(!e.comment)return true;let v=_[0]._element,E=_[_.length-1]._element,w=v;for(;w&&w.tagName!=="w:p";)w=w.parentNode;let D=E;for(;D&&D.tagName!=="w:p";)D=D.parentNode;if(!w||!D)return false;let y=h((N,B)=>{let x=N;for(;x.parentNode&&x.parentNode!==B;)x=x.parentNode;return x},"ascend_to_paragraph_child"),A=y(v,w),C=y(E,D);return w===D?this._attach_comment(w,A,C,e.comment):this._attach_comment_spanning(w,A,D,C,e.comment),true}if(n==="INSERTION"){let[_,v]=o.get_insertion_anchor(i,r);if(!_&&!v)return false;let E=e.new_text||"",w=/\n\s*$/.test(E),D=null;{let C=o.spans.filter(N=>N.paragraph!==null&&N.start===i);C.length>0&&C[0].paragraph&&(D=C[0].paragraph._element);}if(w&&D&&D.parentNode){let C=D.parentNode,N=this.doc.part._element.ownerDocument,B=E.split(/[\r\n]+/).filter(P=>P!==""),x=null,M=null,z=null;for(let P of B){let[G,$]=this._parse_markdown_style(P),R=N.createElement("w:p");if($)this._set_paragraph_style(R,$);else {let K=O(D,"w:pPr");K&&R.appendChild(K.cloneNode(true));}let j=O(R,"w:pPr");j||(j=N.createElement("w:pPr"),R.insertBefore(j,R.firstChild));let I=O(j,"w:rPr");I||(I=N.createElement("w:rPr"),j.appendChild(I)),I.appendChild(this._create_track_change_tag("w:ins","",l));let Q=this._build_tracked_ins_for_line(G,_,l,N);Q&&R.appendChild(Q),C.insertBefore(R,D),x||(x=R),M=R,z=Q;}if(x){if(e.comment&&M&&z){let P=h(($,R)=>{let j=$;for(;j.parentNode&&j.parentNode!==R;)j=j.parentNode;return j},"ascend"),G=S(x,"w:ins")[0]||x;this._attach_comment_spanning(x,P(G,x),M,P(z,M),e.comment);}return true}}let y=this._track_insert_multiline(e.new_text||"",_,v,l);if(!y.first_node)return false;if(y.first_node.tagName==="w:ins"&&(_?Pt(y.first_node,_._element):v&&v._element.appendChild(y.first_node)),e.comment){let C=h((N,B)=>{let x=N;for(;x.parentNode&&x.parentNode!==B;)x=x.parentNode;return x},"ascend_to_paragraph_child");if(y.last_p&&y.last_ins){let N=y.first_node;for(;N&&N.tagName!=="w:p";)N=N.parentNode;if(N){let B=y.first_node;y.first_node.tagName==="w:p"&&(B=S(y.first_node,"w:ins")[0]||y.first_node);let x=C(B,N),M=C(y.last_ins,y.last_p);this._attach_comment_spanning(N,x,y.last_p,M,e.comment);}}else {let N=y.first_node;for(;N&&N.tagName!=="w:p";)N=N.parentNode;if(N){let B=y.first_node;y.first_node.tagName==="w:p"&&(B=S(y.first_node,"w:ins")[0]||y.first_node);let x=C(B,N);this._attach_comment(N,x,x,e.comment);}}}return true}let s=o.find_target_runs_by_index(i,a,r),f=o.get_virtual_spans_in_range(i,a);if(s.length===0&&f.length===0)return false;let c=new Set;for(let _ of s){let v=_._element.parentNode;for(;v&&v.tagName!=="w:p";)v=v.parentNode;v&&c.add(v);}let d=null,p=null;for(let _ of s){let v=this._create_track_change_tag("w:del","",u),E=_._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);}),v.appendChild(E),_._element.parentNode?.replaceChild(v,_._element),d===null&&(d=v),p=v;}let m=null,g=null,b=null;if(n==="MODIFICATION"&&e.new_text&&p){let _=p;for(;_&&_.tagName!=="w:p";)_=_.parentNode;let v=_?new Ze(_,null):null,E=s.length>0?s[s.length-1]:null,w=this._track_insert_multiline(e.new_text,E,v,l);w.first_node&&(w.first_node.tagName==="w:ins"?(Pt(w.first_node,p),m=w.first_node):m=w.last_ins,g=w.last_p,b=w.last_ins);}if(n==="DELETION"||n==="MODIFICATION"){if(n==="MODIFICATION"&&s.length===0&&f.length>0&&e.new_text){let _=f[0];if(_.paragraph){let v=_.paragraph._element,E=S(v,"w:r"),w=E.length>0?new Ke(E[E.length-1],_.paragraph):null,D=this._track_insert_multiline(e.new_text,w,_.paragraph,l);D.first_node&&v.appendChild(D.first_node);}}for(let _ of [...f].reverse())if(_.paragraph){let v=_.paragraph._element,E=ot(v);for(;E&&E.tagName!=="w:p";)E=ot(E);if(E&&E.tagName==="w:p"){let w=O(v,"w:pPr");w||(w=v.ownerDocument.createElement("w:pPr"),v.insertBefore(w,v.firstChild));let D=O(w,"w:rPr");D||(D=v.ownerDocument.createElement("w:rPr"),w.appendChild(D));let y=this._create_track_change_tag("w:del");D.appendChild(y);let A=Array.from(E.childNodes);for(let C of A)C.nodeType===1&&C.tagName==="w:pPr"||v.appendChild(C);E.parentNode&&E.parentNode.removeChild(E);}}}if(e.comment&&d!==null){let _,v;if(g&&b)_=b,v=g;else {let A=m!==null?m:p;for(_=A,v=A;v&&v.tagName!=="w:p";)v=v.parentNode;}let E=d;for(;E&&E.tagName!=="w:p";)E=E.parentNode;if(!E||!v)return true;let w=h((A,C)=>{let N=A;for(;N.parentNode&&N.parentNode!==C;)N=N.parentNode;return N},"ascend_to_paragraph_child"),D=w(d,E),y=w(_,v);E===v?this._attach_comment(E,D,y,e.comment):this._attach_comment_spanning(E,D,v,y,e.comment);}for(let _ of c){let v=false;for(let E of ["w:t","w:tab","w:br"]){let w=S(_,E);for(let D of w){let y=false,A=D.parentNode;for(;A&&A!==_.parentNode;){if(A.tagName==="w:del"){y=true;break}A=A.parentNode;}if(!y){if(E==="w:t"&&!D.textContent)continue;v=true;break}}if(v)break}if(!v){let E=O(_,"w:pPr");E||(E=_.ownerDocument.createElement("w:pPr"),_.insertBefore(E,_.firstChild));let w=O(E,"w:rPr");if(w||(w=_.ownerDocument.createElement("w:rPr"),E.appendChild(w)),!O(w,"w:del")){let D=this._create_track_change_tag("w:del");w.appendChild(D);}}}return true}};function tl(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 o=e;e=t,t=o;}let n=Array.from({length:e.length+1},(o,i)=>i);for(let o=1;o<=t.length;o++){let i=[o],a=o;for(let u=1;u<=e.length;u++){let l=e[u-1]===t[o-1]?0:1,s=Math.min(n[u]+1,i[u-1]+1,n[u-1]+l);i.push(s),s<a&&(a=s);}if(a>r)return r+1;n=i;}return n[e.length]<=r?n[e.length]:r+1}h(tl,"boundedLevenshtein");function rl(e){let t="",r=S(e._element,"w:r");for(let n of r)t+=at(new Ke(n,e));return t}h(rl,"_get_paragraph_text");function nl(e,t){let r={},n=new Set,o={},i=[],a=/^(?:[\d.\-()a-zA-Z]+\s*)?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”]/,u=/\([^)]*?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”][^)]*?\)/g;for(let _ of xn(e)){if(!(_ instanceof Ze))continue;let v=rl(_).trim();if(!v)continue;let E=[],w=v.match(a);w&&E.push(w[1].trim());let D=v.matchAll(u);for(let C of D)E.push(C[1].trim());for(let C of E)r[C]?n.add(C):r[C]={count:0};let y=v.length>60?v.substring(0,60)+"...":v,A=S(_._element,"*");for(let C of A){if(C.tagName==="w:bookmarkStart"){let B=C.getAttribute("w:name");B&&(!B.startsWith("_")||B.startsWith("_Ref"))&&(o[B]||(o[B]={anchored_to:y,referenced_from:[]}));}let N=null;if(C.tagName==="w:fldSimple"){let x=(C.getAttribute("w:instr")||"").trim().split(/\s+/);x.length>1&&x[0]==="REF"&&(N=x[1]);}else if(C.tagName==="w:instrText"){let x=(C.textContent||"").trim().split(/\s+/);x.length>1&&x[0]==="REF"&&(N=x[1]);}N&&i.push([N,y]);}}for(let[_,v]of i)o[_]&&o[_].referenced_from.push(v);let l=[],s=Object.keys(r);if(s.length>0){let _=s.sort((D,y)=>y.length-D.length),v=h(D=>D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),E=_.map(v).join("|"),w=new RegExp(`(?<!["\u201C])\\b(${E})\\b(?![\u201D"])`,"g");for(let D of t.matchAll(w)){let y=D[1];r[y]&&r[y].count++;}for(let D of s)r[D].count===0&&(delete r[D],n.delete(D));}for(let _ of n)l.push(`[Error] Duplicate Definition: '${_}' is defined multiple times.`);let f=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),c=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,d=new Set(t.match(c)||[]),p=new Set(Object.keys(r)),m={};for(let _ of p){let v=_[0].toLowerCase();m[v]||(m[v]=[]),m[v].push(_);}let g={};for(let _ of d){let v=_.trim(),E=v.split(/\s+/);for(;E.length>0;){let y=E[0],A=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();if(f.has(A))E.shift();else break}if(v=E.join(" "),v.length<4||p.has(v))continue;let w=v[0].toLowerCase(),D=m[w]||[];if(v.length>5)for(let[y,A]of Object.entries(m))y!==w&&(D=D.concat(A));for(let y of D){if(Math.abs(v.length-y.length)>2||v===y+"s"||v===y+"es"||y===v+"s"||y===v+"es")continue;let A=tl(v,y,2);A===0||A>2||y.length<=5&&(A>1||v[0].toLowerCase()!==y[0].toLowerCase())||(g[y]||(g[y]=[]),g[y].includes(v)||g[y].push(v));}}for(let[_,v]of Object.entries(g)){v.sort();let E=v.map(w=>`'${w}'`).join(", ");l.push(`[Info] Possible Typos for '${_}': Found ${E}`);}function b(_){return _.startsWith("[Error]")?0:_.startsWith("[Warning]")?1:2}return h(b,"diag_sort_key"),l.sort((_,v)=>{let E=b(_),w=b(v);return E!==w?E-w:_.localeCompare(v)}),[r,l,o]}h(nl,"extract_all_domain_metadata");function il(e,t){let[r,n,o]=nl(e,t),i=[`
|
|
66
|
+
`);E.length>=2&&E[0].trim()!==""&&E[E.length-1].trim()!==""&&t.push(`- Edit ${r+1} 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[c,d]of s){let p=this.mapper.spans.filter(m=>m.end>c&&m.start<c+d),g=new Set;for(let m of p){if(m.ins_id){let D=S(this.doc.element,"w:ins").filter(w=>w.getAttribute("w:id")===m.ins_id);if(D.length>0){let w=D[0].getAttribute("w:author");w&&w!==this.author&&g.add(w);}}if(m.comment_ids)for(let D of m.comment_ids){let w=this.mapper.comments_map[D];w&&w.author&&w.author!==this.author&&g.add(w.author);}}g.size>0&&t.push(`- Edit ${r+1} Failed: Modification targets an active insertion from another author (${Array.from(g).join(", ")}). Accept that change first or scope your edit outside of it.`);}}return t}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:",""),s=false,o=this.doc.pkg.parts.find(l=>l.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");o&&(s=S(o._element,"w:comment").some(u=>u.getAttribute("w:id")===i)),s||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:",""),s=S(this.doc.element,"w:ins").filter(l=>l.getAttribute("w:id")===i),o=S(this.doc.element,"w:del").filter(l=>l.getAttribute("w:id")===i);s.length===0&&o.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=new Map;for(let n of this.doc.pkg.parts)n._element&&r.set(n,n._element.cloneNode(true));try{return this._process_batch_internal(e,!0)}finally{for(let[n,a]of r.entries()){let i=n._element.ownerDocument;i&&i.documentElement&&i.replaceChild(a,i.documentElement),n._element=a;}this.mapper=new kt(this.doc),this.comments_manager=new ir(this.doc),this.clean_mapper=null;}}else return this._process_batch_internal(e,false)}_process_batch_internal(e,t=false){this.skipped_details=[];let r=e.filter(d=>["accept","reject","reply"].includes(d.type)),n=e.filter(d=>!["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 Pr(d)}}else {let d=[];if(r.length>0&&d.push(...this.validate_review_actions(r)),n.length>0&&d.push(...this.validate_edits(n)),d.length>0)throw new Pr(d)}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 Pr(this.skipped_details);a>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let[s]=pa(this.mapper.full_text),l=ma(s,"").body_page_offsets,u=[],f=0,c=0;if(n.length>0)if(t)for(let d of n){let p=this.validate_edits([d]),g=this._check_punctuation_warning(d.target_text||"");if(p.length>0){c++,u.push({status:"failed",target_text:d.target_text||"",new_text:d.new_text||"",warning:g,error:p[0],critic_markup:null,clean_text:null});continue}this.apply_edits([d],l);if(d._applied_status){f++;let D=this._build_edit_context_previews(d);u.push({status:"applied",target_text:d.target_text||"",new_text:d.new_text||"",warning:g,error:null,critic_markup:D[0],clean_text:D[1],pages:d._pages||[],heading_path:d._heading_path||"",occurrences_modified:d._occurrences_modified||0,match_mode:d.match_mode||"strict"});}else {c++;let D=this.skipped_details.length>0?this.skipped_details[this.skipped_details.length-1]:"Failed to apply edit";u.push({status:"failed",target_text:d.target_text||"",new_text:d.new_text||"",warning:g,error:D,critic_markup:null,clean_text:null});}}else {let d=this.validate_edits(n);if(d.length>0)throw new Pr(d);let p=n.map(m=>JSON.parse(JSON.stringify(m)));this.apply_edits(p,l);f=p.filter(m=>m._applied_status).length,c=p.length-f;for(let m of p){let D=m._applied_status||false,w=m._error_msg||null,v=this._check_punctuation_warning(m.target_text||""),E=null,_=null;if(D){let b=this._build_edit_context_previews(m);E=b[0],_=b[1];}u.push({status:D?"applied":"failed",target_text:m.target_text||"",new_text:m.new_text||"",warning:v,error:w,critic_markup:E,clean_text:_,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:f,edits_skipped:c,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]=pa(this.mapper.full_text);t=ma(s,"").body_page_offsets;}let a=[];for(let s of e)s._applied_status=false,s._error_msg=null;for(let s of e)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 o=this.mapper.find_all_match_indices(s.target_text);if(o.length===0&&(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),o=this.clean_mapper.find_all_match_indices(s.target_text)),o.length>0)s._resolved_start_idx=o[0][0],a.push([s,null]);else {n++,s._applied_status=false;let u=`- Failed to locate row target: '${(s.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(u),s._error_msg=u;}}else {let o=this._pre_resolve_heuristic_edit(s);if(o)if(Array.isArray(o))for(let l of o)l._resolved_start_idx=l._match_start_index,l._parent_edit_ref=s,(s._resolved_start_idx===void 0||s._resolved_start_idx===null)&&(s._resolved_start_idx=l._resolved_start_idx),s._resolved_proxy_edit||(s._resolved_proxy_edit=l),a.push([l,l.new_text]);else o._resolved_start_idx=o._match_start_index,o._parent_edit_ref=s,s._resolved_start_idx=o._resolved_start_idx,s._resolved_proxy_edit=o,a.push([o,o.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,o)=>(o[0]._resolved_start_idx||0)-(s[0]._resolved_start_idx||0));let i=[];for(let[s,o]of a){let l=s._resolved_start_idx||0,u=l+(s.target_text?s.target_text.length:0);if(i.some(([d,p])=>l<p&&u>d)){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 m=s._parent_edit_ref;m&&(m._applied_status=false,m._error_msg=g);continue}let c=false;if(s.type==="modify"?c=this._apply_single_edit_indexed(s,o,false):(s.type==="insert_row"||s.type==="delete_row")&&(c=this._apply_table_edit(s,false)),c){r++,i.push([l,u]),s._applied_status=true;let d=s._parent_edit_ref;if(d){d._applied_status=true,d._occurrences_modified=(d._occurrences_modified||0)+1;let[p,g]=this._get_heading_path_and_page(l,this.mapper.full_text,t),m=d._pages||[];m.includes(g)||m.unshift(g),d._pages=m,d._heading_path=p;}else {s._occurrences_modified=(s._occurrences_modified||0)+1;let[p,g]=this._get_heading_path_and_page(l,this.mapper.full_text,t),m=s._pages||[];m.includes(g)||m.unshift(g),s._pages=m,s._heading_path=p;}}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 m=s._parent_edit_ref;m&&(m._applied_status||(m._applied_status=false,m._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:",""),f=this.comments_manager.addComment(this.author,n.text,u);this._anchor_reply_comment(u,f),t++;continue}let i=n.target_id.replace("Chg:",""),s=S(this.doc.element,"w:ins").filter(u=>u.getAttribute("w:id")===i),o=S(this.doc.element,"w:del").filter(u=>u.getAttribute("w:id")===i),l=[...s,...o];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 f=u.tagName==="w:ins",d=(u.parentNode?u.parentNode.tagName:"")==="w:trPr";if(a==="accept")if(f)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(f)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 g of p){let m=g.ownerDocument.createElement("w:t");m.textContent=g.textContent,g.hasAttribute("xml:space")&&m.setAttribute("xml:space","preserve"),g.parentNode?.replaceChild(m,g);}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 s=i;for(;s&&s.tagName!=="w:tr";)s=s.parentNode;if(!s)return false;if(e.type==="delete_row"){let o=R(s,"w:trPr");return o||(o=s.ownerDocument.createElement("w:trPr"),s.insertBefore(o,s.firstChild)),o.appendChild(this._create_track_change_tag("w:del")),true}else if(e.type==="insert_row"){let o=s.ownerDocument.createElement("w:tr"),l=s.ownerDocument.createElement("w:trPr");o.appendChild(l),l.appendChild(this._create_track_change_tag("w:ins"));for(let u of e.cells){let f=s.ownerDocument.createElement("w:tc"),c=s.ownerDocument.createElement("w:p"),d=s.ownerDocument.createElement("w:r"),p=s.ownerDocument.createElement("w:t");p.textContent=u,u.trim()!==u&&p.setAttribute("xml:space","preserve"),d.appendChild(p),c.appendChild(d),f.appendChild(c),o.appendChild(f);}return e.position==="above"?s.parentNode?.insertBefore(o,s):Pt(o,s),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 kt(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,s=[];for(let[l,u]of n){let f=i.spans.filter(c=>c.run!==null&&c.end>l&&c.start<l+u);(f.length===0||f.some(c=>!c.del_id))&&s.push([l,u]);}if(s.length===0)return null;(r==="strict"||r==="first")&&(s=s.slice(0,1));let o=[];for(let[l,u]of s){let f=i.full_text.substring(l,l+u),c=e.new_text||"";if(t&&c)try{c=f.replace(new RegExp(e.target_text),c);}catch{}let[d,p]=this._parse_markdown_style(e.target_text),[g,m]=this._parse_markdown_style(c);if(p!==m){let[_]=this._parse_markdown_style(f),b=_,y=g,A=b===y?"STYLE_ONLY":"STYLE_AND_TEXT",N=f.indexOf(_),C=l+(N!==-1?N:0),M=m!==null?m:"Normal";o.push({type:"modify",target_text:b,new_text:y,comment:e.comment,_match_start_index:C,_internal_op:A,_new_style:M,_active_mapper_ref:i});continue}if(f===c||e.target_text===c){o.push({type:"modify",target_text:f,new_text:f,comment:e.comment,_match_start_index:l,_internal_op:"COMMENT_ONLY",_active_mapper_ref:i});continue}let D="",w="",v="",E=l;if(c.startsWith(f))D="INSERTION",v=c.substring(f.length),E=l+u;else {let[_,b]=bn(f,c),y=f.length-b,A=c.length-b;w=f.substring(_,y),v=c.substring(_,A),E=l+_,!w&&v?D="INSERTION":w&&!v?D="DELETION":w&&v?D="MODIFICATION":D="COMMENT_ONLY";}o.push({type:"modify",target_text:w,new_text:v,comment:e.comment,_match_start_index:E,_internal_op:D,_active_mapper_ref:i});}return o.length===0?null:r==="all"||o.length>1?o:o[0]}_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,s=e.target_text?e.target_text.length:0;if(n==="STYLE_ONLY"||n==="STYLE_AND_TEXT"){let[w,v]=a.get_insertion_anchor(i,r),E=null;if(v)E=v._element;else if(w){let _=w._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,s,r);if(_.length>0){let b=_[0]._element,y=_[_.length-1]._element,A=b;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((O,U)=>{let I=O;for(;I.parentNode&&I.parentNode!==U;)I=I.parentNode;return I},"ascend_to_paragraph_child"),M=C(b,A),x=C(y,N);A===N?this._attach_comment(A,M,x,e.comment):this._attach_comment_spanning(A,M,N,x,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 o=["DELETION","MODIFICATION"].includes(n)?this._getNextId():null,l=["INSERTION","MODIFICATION"].includes(n)?this._getNextId():null;if(n==="COMMENT_ONLY"){let w=a.find_target_runs_by_index(i,s,r);if(w.length===0)return false;if(!e.comment)return true;let v=w[0]._element,E=w[w.length-1]._element,_=v;for(;_&&_.tagName!=="w:p";)_=_.parentNode;let b=E;for(;b&&b.tagName!=="w:p";)b=b.parentNode;if(!_||!b)return false;let y=h((C,M)=>{let x=C;for(;x.parentNode&&x.parentNode!==M;)x=x.parentNode;return x},"ascend_to_paragraph_child"),A=y(v,_),N=y(E,b);return _===b?this._attach_comment(_,A,N,e.comment):this._attach_comment_spanning(_,A,b,N,e.comment),true}if(n==="INSERTION"){let[w,v]=a.get_insertion_anchor(i,r);if(!w&&!v)return false;let E=e.new_text||"",_=/\n\s*$/.test(E),b=null;{let N=a.spans.filter(C=>C.paragraph!==null&&C.start===i);N.length>0&&N[0].paragraph&&(b=N[0].paragraph._element);}if(_&&b&&b.parentNode){let N=b.parentNode,C=this.doc.part._element.ownerDocument,M=E.split(/[\r\n]+/).filter(I=>I!==""),x=null,O=null,U=null;for(let I of M){let[Y,z]=this._parse_markdown_style(I),B=C.createElement("w:p");if(z)this._set_paragraph_style(B,z);else {let K=R(b,"w:pPr");K&&B.appendChild(K.cloneNode(true));}let L=R(B,"w:pPr");L||(L=C.createElement("w:pPr"),B.insertBefore(L,B.firstChild));let k=R(L,"w:rPr");k||(k=C.createElement("w:rPr"),L.appendChild(k)),k.appendChild(this._create_track_change_tag("w:ins","",l));let H=this._build_tracked_ins_for_line(Y,w,l,C);H&&B.appendChild(H),N.insertBefore(B,b),x||(x=B),O=B,U=H;}if(x){if(e.comment&&O&&U){let I=h((z,B)=>{let L=z;for(;L.parentNode&&L.parentNode!==B;)L=L.parentNode;return L},"ascend"),Y=S(x,"w:ins")[0]||x;this._attach_comment_spanning(x,I(Y,x),O,I(U,O),e.comment);}return true}}let y=this._track_insert_multiline(e.new_text||"",w,v,l);if(!y.first_node)return false;if(y.first_node.tagName==="w:ins"&&(w?Pt(y.first_node,w._element):v&&v._element.appendChild(y.first_node)),e.comment){let N=h((C,M)=>{let x=C;for(;x.parentNode&&x.parentNode!==M;)x=x.parentNode;return x},"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 x=N(M,C),O=N(y.last_ins,y.last_p);this._attach_comment_spanning(C,x,y.last_p,O,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 x=N(M,C);this._attach_comment(C,x,x,e.comment);}}}return true}let u=a.find_target_runs_by_index(i,s,r),f=a.get_virtual_spans_in_range(i,s);if(u.length===0&&f.length===0)return false;let c=new Set;for(let w of u){let v=w._element.parentNode;for(;v&&v.tagName!=="w:p";)v=v.parentNode;v&&c.add(v);}let d=null,p=null;for(let w of u){let v=this._create_track_change_tag("w:del","",o),E=w._element.cloneNode(true);Array.from(E.getElementsByTagName("w:t")).forEach(b=>{let y=E.ownerDocument.createElement("w:delText");y.textContent=b.textContent,b.hasAttribute("xml:space")&&y.setAttribute("xml:space","preserve"),E.replaceChild(y,b);}),v.appendChild(E),w._element.parentNode?.replaceChild(v,w._element),d===null&&(d=v),p=v;}let g=null,m=null,D=null;if(n==="MODIFICATION"&&e.new_text&&p){let w=p;for(;w&&w.tagName!=="w:p";)w=w.parentNode;let v=w?new Ze(w,null):null,E=u.length>0?u[u.length-1]:null,_=this._track_insert_multiline(e.new_text,E,v,l);_.first_node&&(_.first_node.tagName==="w:ins"?(Pt(_.first_node,p),g=_.first_node):g=_.last_ins,m=_.last_p,D=_.last_ins);}if(n==="DELETION"||n==="MODIFICATION"){if(n==="MODIFICATION"&&u.length===0&&f.length>0&&e.new_text){let w=f[0];if(w.paragraph){let v=w.paragraph._element,E=S(v,"w:r"),_=E.length>0?new Ke(E[E.length-1],w.paragraph):null,b=this._track_insert_multiline(e.new_text,_,w.paragraph,l);b.first_node&&v.appendChild(b.first_node);}}for(let w of [...f].reverse())if(w.paragraph){let v=w.paragraph._element,E=at(v);for(;E&&E.tagName!=="w:p";)E=at(E);if(E&&E.tagName==="w:p"){let _=R(v,"w:pPr");_||(_=v.ownerDocument.createElement("w:pPr"),v.insertBefore(_,v.firstChild));let b=R(_,"w:rPr");b||(b=v.ownerDocument.createElement("w:rPr"),_.appendChild(b));let y=this._create_track_change_tag("w:del");b.appendChild(y);let A=Array.from(E.childNodes);for(let N of A)N.nodeType===1&&N.tagName==="w:pPr"||v.appendChild(N);E.parentNode&&E.parentNode.removeChild(E);}}}if(e.comment&&d!==null){let w,v;if(m&&D)w=D,v=m;else {let A=g!==null?g:p;for(w=A,v=A;v&&v.tagName!=="w:p";)v=v.parentNode;}let E=d;for(;E&&E.tagName!=="w:p";)E=E.parentNode;if(!E||!v)return true;let _=h((A,N)=>{let C=A;for(;C.parentNode&&C.parentNode!==N;)C=C.parentNode;return C},"ascend_to_paragraph_child"),b=_(d,E),y=_(w,v);E===v?this._attach_comment(E,b,y,e.comment):this._attach_comment_spanning(E,b,v,y,e.comment);}for(let w of c){let v=false;for(let E of ["w:t","w:tab","w:br"]){let _=S(w,E);for(let b of _){let y=false,A=b.parentNode;for(;A&&A!==w.parentNode;){if(A.tagName==="w:del"){y=true;break}A=A.parentNode;}if(!y){if(E==="w:t"&&!b.textContent)continue;v=true;break}}if(v)break}if(!v){let E=R(w,"w:pPr");E||(E=w.ownerDocument.createElement("w:pPr"),w.insertBefore(E,w.firstChild));let _=R(E,"w:rPr");if(_||(_=w.ownerDocument.createElement("w:rPr"),E.appendChild(_)),!R(_,"w:del")){let b=this._create_track_change_tag("w:del");_.appendChild(b);}}}return true}};function Be(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(Be,"findDescendantsByLocalName");function hl(e){let t=0;function r(s,o){let l=s?s.toString():"",u=o?o.toString():"";return l===u}h(r,"areRunsIdentical");function n(s){let o=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let l=0;l<s.childNodes.length;l++){let u=s.childNodes[l];if(u.nodeType===1){let f=u.tagName;if(!o.includes(f))return true}}return false}h(n,"hasSpecialContent");function a(s){let o=Array.from(s.childNodes).filter(u=>u.nodeType===1),l=0;for(;l<o.length-1;){let u=o[l],f=o[l+1];if(u.tagName==="w:r"&&f.tagName==="w:r"&&!n(u)&&!n(f)){let c=R(u,"w:rPr"),d=R(f,"w:rPr");if(r(c,d)){let p=null;for(let m=0;m<u.childNodes.length;m++){let D=u.childNodes[m];D.nodeType===1&&(D.tagName==="w:t"||D.tagName==="w:delText")&&(p=D);}let g=Array.from(f.childNodes).filter(m=>m.nodeType===1);for(let m of g)if(m.tagName!=="w:rPr")if((m.tagName==="w:t"||m.tagName==="w:delText")&&p&&p.tagName===m.tagName){let D=p.textContent||"",w=m.textContent||"",v=D+w;p.textContent=v,v.trim()!==v&&p.setAttribute("xml:space","preserve");}else u.appendChild(m),(m.tagName==="w:t"||m.tagName==="w:delText")&&(p=m);s.removeChild(f),o.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(o.length>0){let u=o[o.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 s of i)a(s);return t?[`Adjacent identical runs coalesced: ${t}`]:[]}h(hl,"coalesce_runs");function dl(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 s of r)n[i].hasAttribute(s)&&(n[i].removeAttribute(s),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(dl,"strip_rsid");function pl(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(pl,"strip_para_ids");function ml(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(ml,"strip_proof_errors");function gl(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(gl,"strip_empty_properties");function _l(e){let t=0,r=S(e.element,"w:rPr");for(let n of r)if(R(n,"w:vanish")||R(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 wa(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(wa,"count_tracked_changes");function wl(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(wl,"get_track_change_authors");function va(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(va,"_getElementText");function Mr(e,t=60){let r=e.replace(/\n/g," ").trim();return r.length<=t?r:r.substring(0,t-3)+"..."}h(Mr,"_truncate");function vl(e){let t=[],r=S(e.element,"w:ins"),n=S(e.element,"w:del");for(let s of r){let o=va(s).trim();o&&t.push(` Accepted insertion: "${Mr(o,60)}"`);}for(let s of n){let o=va(s).trim();o&&t.push(` Accepted deletion of: "${Mr(o,60)}"`);}new Sn(e).accept_all_revisions();for(let s of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let o of S(e.element,s))o.parentNode?.removeChild(o);let i=r.length+n.length;return i?[`Tracked changes auto-accepted: ${i}`].concat(t):[]}h(vl,"accept_all_tracked_changes");function yl(e){let t=Br(e.pkg),r=[],n=0,a=0;for(let[i,s]of Object.entries(t))s.resolved?a++:n++,r.push({id:i,...s});return {total:r.length,open:n,resolved:a,comments:r}}h(yl,"get_comments_summary");function El(e){let t=Br(e.pkg),r=Object.keys(t);if(r.length===0)return [];let n=[],a=new ir(e);for(let[l,u]of Object.entries(t)){let f=u.resolved?"[Resolved]":"[Open]";n.push(` ${f} "${Mr(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(c=>c.nodeType===1&&c.tagName!=="w:rPr"&&c.tagName!=="rPr").length<=1?u.parentNode?.removeChild(u):u.removeChild(l));}let s=Object.values(t).filter(l=>l.resolved).length,o=Object.values(t).filter(l=>!l.resolved).length;return [`Comments removed: ${r.length} (${s} resolved, ${o} open)`].concat(n)}h(El,"remove_all_comments");function Dl(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,s=a.partname.startsWith("/")?a.partname.substring(1):a.partname;r.add(i),r.add(s);}if(r.size===0)return;for(let a of t.parts)if(a.partname.endsWith(".rels")){let i=S(a._element,"Relationship"),s=[];for(let o of i)if((o.getAttribute("Target")||"").toLowerCase().includes("comments")){s.push(o);let u=a.partname.replace("/_rels/","/").replace(".rels",""),f=t.getPartByPath(u);if(f){let c=o.getAttribute("Id");c&&f.rels.delete(c);}}for(let o of s)o.parentNode?.removeChild(o);}let n=t.getPartByPath("[Content_Types].xml");if(n){let a=S(n._element,"Override"),i=[];for(let s of a){let o=s.getAttribute("PartName")||"";(r.has(o)||o.toLowerCase().includes("comments"))&&i.push(s);}for(let s of i)s.parentNode?.removeChild(s);}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(Dl,"eject_comment_parts");function bl(e,t){let r=new ir(e);if(!r.commentsPart)return [];let n=new Set,a=S(r.commentsPart._element,"w:comment");for(let i of a){let s=i.getAttribute("w:author");if(s&&(n.add(s),i.setAttribute("w:author",t)),i.hasAttribute("w:initials")){let o=t.split(" ").filter(Boolean).map(l=>l[0]).join("").toUpperCase();i.setAttribute("w:initials",o);}}return n.size?[`Comment authors replaced: ${Array.from(n).sort().join(", ")} \u2192 "${t}"`]:[]}h(bl,"replace_comment_authors");function Al(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(Al,"replace_change_authors");function Nl(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(Nl,"normalize_change_dates");function Cl(e){let t=[],r=e.pkg.getPartByPath("docProps/core.xml");r&&(Be(r._element,"creator").forEach(o=>{o.textContent&&(t.push(`Author: ${o.textContent}`),o.textContent="");}),Be(r._element,"lastModifiedBy").forEach(o=>{o.textContent&&(t.push(`Last modified by: ${o.textContent}`),o.textContent="");}),Be(r._element,"revision").forEach(o=>{o.textContent&&parseInt(o.textContent)>1&&(t.push(`Revision count: ${o.textContent} \u2192 1`),o.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 o of i)Be(a,o).forEach(l=>{l.textContent&&l.textContent!=="0"&&(o==="TotalTime"&&t.push(`Total editing time: ${l.textContent} minutes`),l.textContent="0");});let s=["Template","Manager","Company"];for(let o of s)Be(a,o).forEach(l=>{l.textContent&&(t.push(`${o}: ${l.textContent}`),l.textContent="");});}return t.length?["Metadata scrubbed:",...t.map(a=>` ${a}`)]:[]}h(Cl,"scrub_doc_properties");function Tl(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"])Be(n._element,a).forEach(i=>{i.textContent&&i.textContent!==r&&(i.textContent=r,t=true);});return t?["Timestamps normalized to epoch"]:[]}h(Tl,"scrub_timestamps");function xl(e){let t=e.pkg.parts.filter(s=>s.partname.includes("/customXml"));if(t.length===0)return [];let r=new Set(t.map(s=>s.partname));e.pkg.parts=e.pkg.parts.filter(s=>!r.has(s.partname));let n=h(s=>{let o=[];for(let l of S(s._element,"Relationship")){let u=l.getAttribute("Target");u&&u.includes("customXml")&&o.push(l);}o.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 s of S(e.element,"w:sdtPr"))_u(s,"w:dataBinding").forEach(o=>s.removeChild(o));return [`Custom XML parts: ${t.length} removed`]}h(xl,"strip_custom_xml");function Sl(e){let t=0;for(let r of Be(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(Sl,"strip_image_alt_text");function Il(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 s of t)if(i.toLowerCase().includes(s.toLowerCase())){r.push(`Hyperlink targets internal URL: ${Mr(i,80)}`);break}}return r}h(Il,"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],s=a;for(let o=1;o<=e.length;o++){let l=e[o-1]===t[a-1]?0:1,u=Math.min(n[o]+1,i[o-1]+1,n[o-1]+l);i.push(u),u<s&&(s=u);}if(s>r)return r+1;n=i;}return n[e.length]<=r?n[e.length]:r+1}h(kl,"boundedLevenshtein");function Pl(e){let t="",r=S(e._element,"w:r");for(let n of r)t+=st(new Ke(n,e));return t}h(Pl,"_get_paragraph_text");function Ol(e,t){let r={},n=new Set,a={},i=[],s=/^(?:[\d.\-()a-zA-Z]+\s*)?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”]/,o=/\([^)]*?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”][^)]*?\)/g;for(let w of xn(e)){if(!(w instanceof Ze))continue;let v=Pl(w).trim();if(!v)continue;let E=[],_=v.match(s);_&&E.push(_[1].trim());let b=v.matchAll(o);for(let N of b)E.push(N[1].trim());for(let N of E)r[N]?n.add(N):r[N]={count:0};let y=v.length>60?v.substring(0,60)+"...":v,A=S(w._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 x=(N.getAttribute("w:instr")||"").trim().split(/\s+/);x.length>1&&x[0]==="REF"&&(C=x[1]);}else if(N.tagName==="w:instrText"){let x=(N.textContent||"").trim().split(/\s+/);x.length>1&&x[0]==="REF"&&(C=x[1]);}C&&i.push([C,y]);}}for(let[w,v]of i)a[w]&&a[w].referenced_from.push(v);let l=[],u=Object.keys(r);if(u.length>0){let w=u.sort((b,y)=>y.length-b.length),v=h(b=>b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),E=w.map(v).join("|"),_=new RegExp(`(?<!["\u201C])\\b(${E})\\b(?![\u201D"])`,"g");for(let b of t.matchAll(_)){let y=b[1];r[y]&&r[y].count++;}for(let b of u)r[b].count===0&&(delete r[b],n.delete(b));}for(let w of n)l.push(`[Error] Duplicate Definition: '${w}' is defined multiple times.`);let f=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),c=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,d=new Set(t.match(c)||[]),p=new Set(Object.keys(r)),g={};for(let w of p){let v=w[0].toLowerCase();g[v]||(g[v]=[]),g[v].push(w);}let m={};for(let w of d){let v=w.trim(),E=v.split(/\s+/);for(;E.length>0;){let y=E[0],A=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();if(f.has(A))E.shift();else break}if(v=E.join(" "),v.length<4||p.has(v))continue;let _=v[0].toLowerCase(),b=g[_]||[];if(v.length>5)for(let[y,A]of Object.entries(g))y!==_&&(b=b.concat(A));for(let y of b){if(Math.abs(v.length-y.length)>2||v===y+"s"||v===y+"es"||y===v+"s"||y===v+"es")continue;let A=kl(v,y,2);A===0||A>2||y.length<=5&&(A>1||v[0].toLowerCase()!==y[0].toLowerCase())||(m[y]||(m[y]=[]),m[y].includes(v)||m[y].push(v));}}for(let[w,v]of Object.entries(m)){v.sort();let E=v.map(_=>`'${_}'`).join(", ");l.push(`[Info] Possible Typos for '${w}': Found ${E}`);}function D(w){return w.startsWith("[Error]")?0:w.startsWith("[Warning]")?1:2}return h(D,"diag_sort_key"),l.sort((w,v)=>{let E=D(w),_=D(v);return E!==_?E-_:w.localeCompare(v)}),[r,l,a]}h(Ol,"extract_all_domain_metadata");function Ml(e){let t=[],r=e.pkg.getPartByPath("word/settings.xml");if(!r)return t;let n=h(s=>{if(!s.hasAttribute("w:val"))return true;let o=(s.getAttribute("w:val")||"").toLowerCase();return o!=="0"&&o!=="false"&&o!=="off"},"isTruthy"),a=Be(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=Be(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(Ml,"extract_document_settings_warnings");function Rl(e,t){let[r,n,a]=Ol(e,t),i=Ml(e),s=[`
|
|
56
67
|
|
|
57
|
-
---`,"","<!-- 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."],
|
|
58
|
-
##
|
|
59
|
-
##
|
|
60
|
-
##
|
|
61
|
-
`)
|
|
68
|
+
---`,"","<!-- 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."],o=false;if(i.length>0){o=true,s.push(`
|
|
69
|
+
## Document Settings`);for(let l of i)s.push(`- ${l}`);}if(Object.keys(r).length>0){o=true,s.push(`
|
|
70
|
+
## Defined Terms`);for(let[l,u]of Object.entries(r))s.push(`- "${l}" \u2014 used ${u.count} times.`);}if(n.length>0){o=true,s.push(`
|
|
71
|
+
## Semantic Diagnostics`);for(let l of n)s.push(`- ${l}`);}if(Object.keys(a).length>0){o=true,s.push(`
|
|
72
|
+
## Named Anchors`);for(let[l,u]of Object.entries(a)){s.push(`- ${l} \u2192 Anchored to: "${u.anchored_to}"`);for(let f of u.referenced_from)s.push(` - Referenced from: "${f}"`);}}return o?s.join(`
|
|
73
|
+
`):""}h(Rl,"build_structural_appendix");async function ot(e,t=false){let r=await ar.load(e);return Bl(r,t)}h(ot,"extractTextFromBuffer");function Bl(e,t=false,r=true,n=false){let a=Br(e.pkg),i=[],s=new Map,o=0;for(let u of Pa(e)){let f=i.length>0?o+2:o,c=In(u,a,t,f,n?s:void 0);c&&(i.length>0&&(o+=2),i.push(c),o+=c.length);}let l=i.join(`
|
|
62
74
|
|
|
63
|
-
`);if(r){let
|
|
64
|
-
${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;l.push(p),
|
|
75
|
+
`);if(r){let u=Rl(e,l);u&&(l+=u);}return n?{text:l,paragraph_offsets:s}:l}h(Bl,"_extractTextFromDoc");function In(e,t,r,n,a){let i=e.part||e,[s,o]=Fr(i),l=[],u=n,f=true,c=true;if(e.constructor&&e.constructor.name==="NotesPart"){let p=`---
|
|
76
|
+
${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;l.push(p),u+=p.length,f=false;}for(let d of xn(e)){f||(u+=2);let p=u;if(d.constructor.name==="FootnoteItem"){let g=In(d,t,r,p,a);g?(l.push(g),u=p+g.length,f=false):f||(u-=2);}else if(d instanceof Ze){let g=Tn(d,s,o);c&&e.constructor.name==="FootnoteItem"&&(g=`[^${e.note_type}-${e.id}]: `+g);let m=Ll(d,t,r,s,o),D=g+m;l.push(D),a&&a.set(d._element,[p,D.length]),u=p+D.length,c=false,f=false;}else if(d instanceof An){let g=Fl(d,t,r,p,a);g?(l.push(g),u=p+g.length,f=false):f||(u-=2),c=false;}}return l.join(`
|
|
65
77
|
|
|
66
|
-
`)}h(In,"_extract_blocks");function
|
|
67
|
-
`)}h(
|
|
68
|
-
`)}h(
|
|
78
|
+
`)}h(In,"_extract_blocks");function Fl(e,t,r,n,a){let i=[],s=0,o=n;for(let l of e.rows){let u=[],f=new Set,c=R(l._element,"w:trPr"),d=c?R(c,"w:ins"):null,p=c?R(c,"w:del"):null;if(r&&p)continue;let g=o+(s>0?1:0),D=g+(!r&&d||!r&&p?4:0),w=true;for(let E of l.cells){if(f.has(E))continue;f.add(E),w||(D+=3);let _=In(E,t,r,D,a);u.push(_),D+=_.length,w=false;}let v=u.join(" | ");r||(d?v=`{++ ${v} |Chg:${d.getAttribute("w:id")}++}`:p&&(v=`{-- ${v} |Chg:${p.getAttribute("w:id")}--}`)),i.push(v),o=g+v.length,s++;}return i.join(`
|
|
79
|
+
`)}h(Fl,"extract_table");function Ll(e,t,r,n,a){let i=[],s={},o={},l=new Set,u={},f=[],c="",d=["",""],p=["",""],g=Array.from(Ma(e)),m=Ia(e,n,a),D=Cn(e,n,a),w=m;for(let v=0;v<g.length;v++){let E=g[v];if(E instanceof Ke){let[_,b]=ka(E,D),y=st(E);if(r&&Object.keys(o).length>0)continue;if(w){if(!y||!y.trim())continue;w=false;}let A=Ku(y,_,b);if(A){let N=r?["",""]:$l(s,o,l,u),C=[_,b];if(c&&N[0]===d[0]&&N[1]===d[1]?(C[0]===p[0]&&C[1]===p[1]&&p[0]!==""&&c.endsWith(p[1])&&A.startsWith(C[0])?c=c.slice(0,-p[1].length)+A.slice(C[0].length):c+=A,p=C):(c&&i.push(`${d[0]}${c}${d[1]}`),c=A,d=N,p=C),!r){(Object.keys(s).length>0||Object.keys(o).length>0||l.size>0||Object.keys(u).length>0)&&f.push([{...s},{...o},new Set(l),{...u}]);let x=false;if(Object.keys(s).length>0||Object.keys(o).length>0||Object.keys(u).length>0||l.size>0){let U=v+1,I=false,Y=Object.keys(s).length,z=Object.keys(o).length,B=Object.keys(u).length,L=new Set(l);for(;U<g.length;){let k=g[U];if(k instanceof Ke){if(!st(k)){U++;continue}(Y>0||z>0||B>0||L.size>0)&&(I=true);break}else {let H=k;H.type==="ins_start"?Y++:H.type==="ins_end"?Y=Math.max(0,Y-1):H.type==="del_start"?z++:H.type==="del_end"?z=Math.max(0,z-1):H.type==="fmt_start"?B++:H.type==="fmt_end"?B=Math.max(0,B-1):H.type==="start"?L.add(H.id):H.type==="end"&&L.delete(H.id);}U++;}I&&(x=true);}if(!x&&f.length>0){let U=ya(f,t);U&&(c&&(i.push(`${d[0]}${c}${d[1]}`),c="",d=["",""],p=["",""]),i.push(`{>>${U}<<}`)),f.length=0;}}}}else {let _=E;w=false,["ins_start","ins_end","del_start","del_end","fmt_start","fmt_end"].includes(_.type)||c&&(i.push(`${d[0]}${c}${d[1]}`),c="",d=["",""],p=["",""]),_.type==="start"?l.add(_.id):_.type==="end"?l.delete(_.id):_.type==="ins_start"?s[_.id]=_:_.type==="ins_end"?delete s[_.id]:_.type==="del_start"?o[_.id]=_:_.type==="del_end"?delete o[_.id]:_.type==="fmt_start"?u[_.id]=_:_.type==="fmt_end"?delete u[_.id]:_.type==="footnote"||_.type==="endnote"?(c&&(i.push(`${d[0]}${c}${d[1]}`),c="",d=["",""],p=["",""]),i.push(`[^${_.type==="footnote"?"fn":"en"}-${_.id}]`)):_.type==="hyperlink_start"?(c&&(i.push(`${d[0]}${c}${d[1]}`),c="",d=["",""],p=["",""]),i.push("[")):_.type==="hyperlink_end"?(c&&(i.push(`${d[0]}${c}${d[1]}`),c="",d=["",""],p=["",""]),i.push(`](${_.date})`)):_.type==="xref_start"?(c&&(i.push(`${d[0]}${c}${d[1]}`),c="",d=["",""],p=["",""]),i.push("[~")):_.type==="xref_end"?(c&&(i.push(`${d[0]}${c}${d[1]}`),c="",d=["",""],p=["",""]),i.push(`~](#${_.id})`)):_.type==="bookmark"&&(c&&(i.push(`${d[0]}${c}${d[1]}`),c="",d=["",""],p=["",""]),i.push(`{#${_.id}}`));}}if(c&&i.push(`${d[0]}${c}${d[1]}`),f.length>0){let v=ya(f,t);v&&i.push(`{>>${v}<<}`);}return i.join("")}h(Ll,"build_paragraph_text");function $l(e,t,r,n){return Object.keys(t).length>0?["{--","--}"]:Object.keys(e).length>0?["{++","++}"]:r.size>0||Object.keys(n).length>0?["{==","==}"]:["",""]}h($l,"_get_wrappers");function ya(e,t){let r=[],n=[],a=new Set;for(let[s,o,l,u]of e){let f=h(function(p){if(!t[p])return;let g=`Com:${p}`;if(a.has(g))return;let m=t[p],D=`[${g}] ${m.author}`;if(m.date&&(D+=` @ ${m.date}`),m.resolved&&(D+="(RESOLVED)"),n.push(`${D}: ${m.text}`),a.add(g),c[p]){let w=c[p].sort((v,E)=>(t[v]?.date||"").localeCompare(t[E]?.date||""));for(let v of w)f(v);}},"render_comment2");for(let[p,g]of Object.entries(s)){let m=`Chg:${p}`;a.has(m)||(r.push(`[${m} insert] ${g.author||"Unknown"}`),a.add(m));}for(let[p,g]of Object.entries(o)){let m=`Chg:${p}`;a.has(m)||(r.push(`[${m} delete] ${g.author||"Unknown"}`),a.add(m));}for(let[p,g]of Object.entries(u)){let m=`Chg:${p}`;a.has(m)||(r.push(`[${m} format] ${g.author||"Unknown"}`),a.add(m));}let c={};for(let[p,g]of Object.entries(t)){let m=g.parent_id;m&&(c[m]||(c[m]=[]),c[m].push(p));}let d=Array.from(l).sort();for(let p of d)f(p);}return [...r,...n].join(`
|
|
80
|
+
`)}h(ya,"_build_merged_meta_block");var Ul=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(`
|
|
69
81
|
`);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(`
|
|
70
|
-
`)}};function Je(e,t){let r=[],n=e.getElementsByTagName("*");for(let o=0;o<n.length;o++){let i=n[o].tagName;(i===t||i.endsWith(":"+t))&&r.push(n[o]);}return r}h(Je,"findDescendantsByLocalName");function cl(e){let t=0;function r(a,u){let l=a?a.toString():"",s=u?u.toString():"";return l===s}h(r,"areRunsIdentical");function n(a){let u=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let l=0;l<a.childNodes.length;l++){let s=a.childNodes[l];if(s.nodeType===1){let f=s.tagName;if(!u.includes(f))return true}}return false}h(n,"hasSpecialContent");function o(a){let u=Array.from(a.childNodes).filter(s=>s.nodeType===1),l=0;for(;l<u.length-1;){let s=u[l],f=u[l+1];if(s.tagName==="w:r"&&f.tagName==="w:r"&&!n(s)&&!n(f)){let c=O(s,"w:rPr"),d=O(f,"w:rPr");if(r(c,d)){let p=null;for(let g=0;g<s.childNodes.length;g++){let b=s.childNodes[g];b.nodeType===1&&(b.tagName==="w:t"||b.tagName==="w:delText")&&(p=b);}let m=Array.from(f.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||"",_=g.textContent||"",v=b+_;p.textContent=v,v.trim()!==v&&p.setAttribute("xml:space","preserve");}else s.appendChild(g),(g.tagName==="w:t"||g.tagName==="w:delText")&&(p=g);a.removeChild(f),u.splice(l+1,1),t++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(s.tagName)&&o(s),l++;}if(u.length>0){let s=u[u.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(s.tagName)&&o(s);}}h(o,"coalesceContainer");let i=S(e.element,"w:p");for(let a of i)o(a);return t?[`Adjacent identical runs coalesced: ${t}`]:[]}h(cl,"coalesce_runs");function fl(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 a of r)n[i].hasAttribute(a)&&(n[i].removeAttribute(a),t++);let o=S(e.element,"w:rsids");for(let i of o)i.parentNode&&(i.parentNode.removeChild(i),t++);return t?[`rsid attributes: ${t} removed`]:[]}h(fl,"strip_rsid");function hl(e){let t=0,r=["w14:paraId","w14:textId"],n=e.element.getElementsByTagName("*");for(let o=0;o<n.length;o++)for(let i of r)n[o].hasAttribute(i)&&(n[o].removeAttribute(i),t++);return t?[`Paragraph/text IDs: ${t} removed`]:[]}h(hl,"strip_para_ids");function dl(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(dl,"strip_proof_errors");function pl(e){let t=0;for(let r of ["w:rPr","w:pPr"]){let n=S(e.element,r);for(let o of n)(o.childNodes.length===0||o.childNodes.length===1&&o.childNodes[0].nodeType===3&&!o.childNodes[0].textContent?.trim())&&(o.parentNode?.removeChild(o),t++);}return t?[`Empty property elements: ${t} removed`]:[]}h(pl,"strip_empty_properties");function ml(e){let t=0,r=S(e.element,"w:rPr");for(let n of r)if(O(n,"w:vanish")||O(n,"w:webHidden")){let o=n.parentNode;o&&o.tagName==="w:r"&&o.parentNode&&(o.parentNode.removeChild(o),t++);}return t?[`Hidden text runs: ${t} removed`]:[]}h(ml,"strip_hidden_text");function mo(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(mo,"count_tracked_changes");function gl(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 o=n.getAttribute("w:author");o&&t.add(o);}return t}h(gl,"get_track_change_authors");function go(e){let t=[],r=S(e,"w:t");for(let o of r)o.textContent&&t.push(o.textContent);let n=S(e,"w:delText");for(let o of n)o.textContent&&t.push(o.textContent);return t.join("")}h(go,"_getElementText");function Mr(e,t=60){let r=e.replace(/\n/g," ").trim();return r.length<=t?r:r.substring(0,t-3)+"..."}h(Mr,"_truncate");function _l(e){let t=[],r=S(e.element,"w:ins"),n=S(e.element,"w:del");for(let a of r){let u=go(a).trim();u&&t.push(` Accepted insertion: "${Mr(u,60)}"`);}for(let a of n){let u=go(a).trim();u&&t.push(` Accepted deletion of: "${Mr(u,60)}"`);}new Sn(e).accept_all_revisions();for(let a of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let u of S(e.element,a))u.parentNode?.removeChild(u);let i=r.length+n.length;return i?[`Tracked changes auto-accepted: ${i}`].concat(t):[]}h(_l,"accept_all_tracked_changes");function wl(e){let t=Br(e.pkg),r=[],n=0,o=0;for(let[i,a]of Object.entries(t))a.resolved?o++:n++,r.push({id:i,...a});return {total:r.length,open:n,resolved:o,comments:r}}h(wl,"get_comments_summary");function vl(e){let t=Br(e.pkg),r=Object.keys(t);if(r.length===0)return [];let n=[],o=new ir(e);for(let[l,s]of Object.entries(t)){let f=s.resolved?"[Resolved]":"[Open]";n.push(` ${f} "${Mr(s.text||"",60)}" (${s.author||"Unknown"})`),o.deleteComment(l);}for(let l of ["w:commentRangeStart","w:commentRangeEnd"])for(let s of S(e.element,l))s.parentNode?.removeChild(s);let i=S(e.element,"w:commentReference");for(let l of i){let s=l.parentNode;s&&((s.tagName==="w:r"||s.tagName.endsWith(":r"))&&Array.from(s.childNodes).filter(c=>c.nodeType===1&&c.tagName!=="w:rPr"&&c.tagName!=="rPr").length<=1?s.parentNode?.removeChild(s):s.removeChild(l));}let a=Object.values(t).filter(l=>l.resolved).length,u=Object.values(t).filter(l=>!l.resolved).length;return [`Comments removed: ${r.length} (${a} resolved, ${u} open)`].concat(n)}h(vl,"remove_all_comments");function yl(e){let t=e.pkg,r=new Set;for(let o of t.parts)if(o.partname.toLowerCase().includes("comments")){r.add(o.partname);let i=o.partname.startsWith("/")?o.partname:"/"+o.partname,a=o.partname.startsWith("/")?o.partname.substring(1):o.partname;r.add(i),r.add(a);}if(r.size===0)return;for(let o of t.parts)if(o.partname.endsWith(".rels")){let i=S(o._element,"Relationship"),a=[];for(let u of i)if((u.getAttribute("Target")||"").toLowerCase().includes("comments")){a.push(u);let s=o.partname.replace("/_rels/","/").replace(".rels",""),f=t.getPartByPath(s);if(f){let c=u.getAttribute("Id");c&&f.rels.delete(c);}}for(let u of a)u.parentNode?.removeChild(u);}let n=t.getPartByPath("[Content_Types].xml");if(n){let o=S(n._element,"Override"),i=[];for(let a of o){let u=a.getAttribute("PartName")||"";(r.has(u)||u.toLowerCase().includes("comments"))&&i.push(a);}for(let a of i)a.parentNode?.removeChild(a);}t.parts=t.parts.filter(o=>!o.partname.toLowerCase().includes("comments"));for(let o of Object.keys(t.unzipped))o.toLowerCase().includes("comments")&&delete t.unzipped[o];}h(yl,"eject_comment_parts");function El(e,t){let r=new ir(e);if(!r.commentsPart)return [];let n=new Set,o=S(r.commentsPart._element,"w:comment");for(let i of o){let a=i.getAttribute("w:author");if(a&&(n.add(a),i.setAttribute("w:author",t)),i.hasAttribute("w:initials")){let u=t.split(" ").filter(Boolean).map(l=>l[0]).join("").toUpperCase();i.setAttribute("w:initials",u);}}return n.size?[`Comment authors replaced: ${Array.from(n).sort().join(", ")} \u2192 "${t}"`]:[]}h(El,"replace_comment_authors");function Dl(e,t){let r=new Set;for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let o of S(e.element,n)){let i=o.getAttribute("w:author");i&&(r.add(i),o.setAttribute("w:author",t));}return r.size?[`Track change authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${t}"`]:[]}h(Dl,"replace_change_authors");function bl(e){let t=0,r="2025-01-01T00:00:00Z";for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let o of S(e.element,n))o.hasAttribute("w:date")&&(o.setAttribute("w:date",r),t++);return t?[`Track change timestamps: ${t} normalized`]:[]}h(bl,"normalize_change_dates");function Al(e){let t=[],r=e.pkg.getPartByPath("docProps/core.xml");r&&(Je(r._element,"creator").forEach(u=>{u.textContent&&(t.push(`Author: ${u.textContent}`),u.textContent="");}),Je(r._element,"lastModifiedBy").forEach(u=>{u.textContent&&(t.push(`Last modified by: ${u.textContent}`),u.textContent="");}),Je(r._element,"revision").forEach(u=>{u.textContent&&parseInt(u.textContent)>1&&(t.push(`Revision count: ${u.textContent} \u2192 1`),u.textContent="1");}));let n=e.pkg.getPartByPath("docProps/app.xml");if(n){let o=n._element,i=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let u of i)Je(o,u).forEach(l=>{l.textContent&&l.textContent!=="0"&&(u==="TotalTime"&&t.push(`Total editing time: ${l.textContent} minutes`),l.textContent="0");});let a=["Template","Manager","Company"];for(let u of a)Je(o,u).forEach(l=>{l.textContent&&(t.push(`${u}: ${l.textContent}`),l.textContent="");});}return t.length?["Metadata scrubbed:",...t.map(o=>` ${o}`)]:[]}h(Al,"scrub_doc_properties");function Nl(e){let t=false,r="1970-01-01T00:00:00Z",n=e.pkg.getPartByPath("docProps/core.xml");if(n)for(let o of ["created","modified","lastPrinted"])Je(n._element,o).forEach(i=>{i.textContent&&i.textContent!==r&&(i.textContent=r,t=true);});return t?["Timestamps normalized to epoch"]:[]}h(Nl,"scrub_timestamps");function Cl(e){let t=e.pkg.parts.filter(a=>a.partname.includes("/customXml"));if(t.length===0)return [];let r=new Set(t.map(a=>a.partname));e.pkg.parts=e.pkg.parts.filter(a=>!r.has(a.partname));let n=h(a=>{let u=[];for(let l of S(a._element,"Relationship")){let s=l.getAttribute("Target");s&&s.includes("customXml")&&u.push(l);}u.forEach(l=>l.parentNode?.removeChild(l));},"removeRelationsTo"),o=e.pkg.getPartByPath("_rels/.rels");o&&n(o);let i=e.pkg.getOrCreateRelsPart(e.part.partname);i&&n(i);for(let a of S(e.element,"w:sdtPr"))hu(a,"w:dataBinding").forEach(u=>a.removeChild(u));return [`Custom XML parts: ${t.length} removed`]}h(Cl,"strip_custom_xml");function Tl(e){let t=0;for(let r of Je(e.element,"docPr")){let n=r.getAttribute("descr");if(n){let o=n.length<10,i=n.includes(".")&&n.length<60;(o||i)&&(r.removeAttribute("descr"),t++);}}return t?[`Image alt text: ${t} auto-generated descriptions removed`]:[]}h(Tl,"strip_image_alt_text");function xl(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 o of S(n._element,"Relationship"))if(o.getAttribute("TargetMode")==="External"){let i=o.getAttribute("Target")||"";for(let a of t)if(i.toLowerCase().includes(a.toLowerCase())){r.push(`Hyperlink targets internal URL: ${Mr(i,80)}`);break}}return r}h(xl,"audit_hyperlinks");async function Oo(e,t){let r=new ll(t.filename,t.sanitize_mode||"full",t.author||null);if(t.sanitize_mode==="full"){let i=mo(e),a=i[0]+i[1]+i[2];if(r.tracked_changes_found=a,a>0&&!t.accept_all)return r.status="blocked",r.blocked_reason=`Document contains ${a} 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(a>0){let l=gl(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(_l(e)),r.tracked_changes_accepted=a;}let u=wl(e);r.comments_removed=u.total,r.add_transform_lines(vl(e)),yl(e);}else if(t.sanitize_mode==="keep-markup"){let i=mo(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(El(e,t.author)),r.add_transform_lines(Dl(e,t.author)));}r.add_transform_lines(fl(e)),r.add_transform_lines(hl(e)),r.add_transform_lines(dl(e)),r.add_transform_lines(pl(e)),r.add_transform_lines(ml(e)),r.add_transform_lines(cl(e)),r.add_transform_lines(Al(e)),r.add_transform_lines(Nl(e)),r.add_transform_lines(Cl(e)),r.add_transform_lines(Tl(e));let n=xl(e);for(let i of n)r.warnings.push(i);if(r.add_transform_lines(bl(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 a=i._element.ownerDocument,u=Je(i._element,"documentProtection")[0];u||(u=a.createElement("w:documentProtection"),i._element.appendChild(u)),u.setAttribute("w:edit","readOnly"),u.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 a=false;if(Array.from(i._element.attributes||[]).some(u=>u.name.startsWith("w16du:")&&u.name!=="xmlns:w16du")&&(a=true),!a){let u=S(i._element,"*");for(let l of u)if(l.tagName.startsWith("w16du:")||Array.from(l.attributes||[]).some(s=>s.name.startsWith("w16du:"))){a=true;break}}a||i._element.removeAttribute("xmlns:w16du");}r.warnings.length>0&&(r.status="clean_with_warnings");let o=await e.save();return {reportText:r.render(),outBuffer:o}}h(Oo,"finalize_document");var Mo=[{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"]}}}];async function Ro(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("cleanView",e),o=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:i,fileName:a}=await Fe.call(this,e,o),u=await st(i,r);return [{json:{fileName:a,cleanView:r,markdown:u},pairedItem:{item:e}}]}h(Ro,"executeExtractMarkdown");var Bo=[{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:`[
|
|
82
|
+
`)}};async function Fa(e,t){let r=new Ul(t.filename,t.sanitize_mode||"full",t.author||null);if(t.sanitize_mode==="full"){let i=wa(e),s=i[0]+i[1]+i[2];if(r.tracked_changes_found=s,s>0&&!t.accept_all)return r.status="blocked",r.blocked_reason=`Document contains ${s} 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(s>0){let l=wl(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(vl(e)),r.tracked_changes_accepted=s;}let o=yl(e);r.comments_removed=o.total,r.add_transform_lines(El(e)),Dl(e);}else if(t.sanitize_mode==="keep-markup"){let i=wa(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(bl(e,t.author)),r.add_transform_lines(Al(e,t.author)));}r.add_transform_lines(dl(e)),r.add_transform_lines(pl(e)),r.add_transform_lines(ml(e)),r.add_transform_lines(gl(e)),r.add_transform_lines(_l(e)),r.add_transform_lines(hl(e)),r.add_transform_lines(Cl(e)),r.add_transform_lines(Tl(e)),r.add_transform_lines(xl(e)),r.add_transform_lines(Sl(e));let n=Il(e);for(let i of n)r.warnings.push(i);if(r.add_transform_lines(Nl(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 s=i._element.ownerDocument,o=Be(i._element,"documentProtection")[0];o||(o=s.createElement("w:documentProtection"),i._element.appendChild(o)),o.setAttribute("w:edit","readOnly"),o.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 s=false;if(Array.from(i._element.attributes||[]).some(o=>o.name.startsWith("w16du:")&&o.name!=="xmlns:w16du")&&(s=true),!s){let o=S(i._element,"*");for(let l of o)if(l.tagName.startsWith("w16du:")||Array.from(l.attributes||[]).some(u=>u.name.startsWith("w16du:"))){s=true;break}}s||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(Fa,"finalize_document");var La=[{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"]}}}];async function $a(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("cleanView",e),a=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:i,fileName:s}=await Le.call(this,e,a),o=await ot(i,r);return [{json:{fileName:s,cleanView:r,markdown:o},pairedItem:{item:e}}]}h($a,"executeExtractMarkdown");var Ua=[{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:`[
|
|
71
83
|
{
|
|
72
84
|
"type": "modify",
|
|
73
85
|
"target_text": "State of New York",
|
|
74
86
|
"new_text": "State of Delaware",
|
|
75
87
|
"comment": "Standardizing governing law."
|
|
76
88
|
}
|
|
77
|
-
]`,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). 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, 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."}]'. 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 Fo(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("author",e),o=this.getNodeParameter("editsSource",e),i=this.getNodeParameter("returnMarkdown",e),a=this.getNodeParameter("dryRun",e,false),u;if(o==="fromInputJson"){let y=this.getNodeParameter("editsJsonPath",e),A=this.getInputData()[e].json;if(u=kn(A,y),u===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);u=Pn.call(this,y,e,"Changes (JSON)");}if(!Array.isArray(u))throw new Error("Changes must be an array of DocumentChange objects.");let s=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:f,fileName:c}=await Fe.call(this,e,s),d=await or.load(f),m=new Sn(d,n).process_batch(u,a),g=this.getInputData()[e].binary??{};if(a)return [{json:{fileName:c,author:n,dryRun:true,stats:m},binary:g,pairedItem:{item:e}}];let b=await d.save(),_=ur(c,"redlined"),v=await this.helpers.prepareBinaryData(b,_,et),E=typeof this.isToolExecution=="function"&&this.isToolExecution(),w;if(E&&v.id){let y=this.getWorkflowStaticData("global");y.adeu_last_redlined={id:v.id,fileName:_,mimeType:et,timestamp:Date.now()},w=v.id;}let D;return i&&(D=await st(b,false)),[{json:{fileName:_,author:n,dryRun:false,stats:m,...D!==void 0?{markdown:D}:{},...w!==void 0?{redlinedBinaryId:w}:{}},binary:{...g,[r]:v},pairedItem:{item:e}}]}h(Fo,"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 $o(e){let t=this.getNodeParameter("originalBinaryPropertyName",e),r=this.getNodeParameter("modifiedBinaryPropertyName",e),n=this.getNodeParameter("cleanView",e),o=this.getNodeParameter("originalDocumentSource",e,"fromInput"),i=this.getNodeParameter("modifiedDocumentSource",e,"fromInput"),a=o==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("originalSourceNodeName",e,""),binaryPropertyName:t}:{mode:"fromInput",binaryPropertyName:t},u=i==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("modifiedSourceNodeName",e,""),binaryPropertyName:r}:{mode:"fromInput",binaryPropertyName:r},{buffer:l,fileName:s}=await Fe.call(this,e,a),{buffer:f,fileName:c}=await Fe.call(this,e,u),d=await st(l,n),p=await st(f,n),m=Po(d,p,s,c);return [{json:{originalFileName:s,modifiedFileName:c,cleanView:n,diff:m},pairedItem:{item:e}}]}h($o,"executeGenerateDiff");var Uo=[{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 qo(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("outputBinaryPropertyName",e),n=this.getNodeParameter("sanitizeMode",e),o=false;n==="full"&&(o=this.getNodeParameter("acceptAll",e));let i=null;if(n==="keep-markup"){let v=this.getNodeParameter("authorOverride",e);i=v.trim()===""?null:v;}let u=this.getNodeParameter("protectionMode",e)==="read_only"?"read_only":null,s=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:f,fileName:c}=await Fe.call(this,e,s),d=await or.load(f),{reportText:p,outBuffer:m}=await Oo(d,{filename:c,sanitize_mode:n,accept_all:o,protection_mode:u,author:i});if(!m)throw new Error(p);let g=ur(c,"finalized"),b=await this.helpers.prepareBinaryData(m,g,et),_=this.getInputData()[e].binary??{};return [{json:{fileName:g,sanitizeMode:n,report:p},binary:{..._,[r]:b},pairedItem:{item:e}}]}h(qo,"executeFinalizeDocument");var zo=[{displayName:"Operation",name:"operation",type:"options",noDataExpression:true,displayOptions:{show:{resource:["document"]}},options:[{name:"Apply Edits",value:"applyEdits",action:"Apply a batch of tracked changes to the document",description:"Apply a JSON array of DocumentChange objects (modify, accept, reject, reply, insert_row, delete_row) as native Word tracked changes and comments. 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 a Markdown representation of the 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."},{name:"Finalize Document",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 a Word Patch diff between two 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","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","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","finalizeDocument"],documentSource:["fromNode"]}}},...Mo,...Bo,...Lo,...Uo,...Rn];var Wo=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, apply tracked changes and comments, generate sub-word diffs, and sanitize/finalize documents. Four operations on the Document resource: (1) Extract Markdown \u2014 project a .docx into Markdown plus a Semantic Appendix (defined terms, cross-references, typos); toggle Clean View to simulate Accept All. (2) Apply Edits \u2014 apply a JSON array of DocumentChange objects as native Word tracked changes; 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, returning a per-edit report with CriticMarkup context snippets so an AI Agent can self-correct anchor mistakes before issuing a real call. (3) Generate Diff \u2014 produce a @@ Word Patch @@ sub-word level diff between two .docx files. (4) 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' attaches a comment bubble. 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"},...zo]};async execute(){let t=this.getInputData(),r=[],n=this.getNodeParameter("resource",0),o=this.getNodeParameter("operation",0);for(let i=0;i<t.length;i++)try{let a;if(n==="document")switch(o){case "extractMarkdown":a=await Ro.call(this,i);break;case "applyEdits":a=await Fo.call(this,i);break;case "generateDiff":a=await $o.call(this,i);break;case "finalizeDocument":a=await qo.call(this,i);break;case "hydrateToolOutput":a=await Bn.call(this,i);break;default:throw new Error(`Unsupported operation: ${o}`)}else throw new Error(`Unsupported resource: ${n}`);r.push(...a);}catch(a){if(this.continueOnFail()){r.push({json:{error:a.message},pairedItem:{item:i}});continue}let u=a;throw u.name==="NodeOperationError"||u.name==="NodeApiError"?u:On.call(this,u,i)}return [r]}};exports.Adeu=Wo;
|
|
89
|
+
]`,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). 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, 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."}]'. 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 qa(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),s=this.getNodeParameter("dryRun",e,false),o;if(a==="fromInputJson"){let y=this.getNodeParameter("editsJsonPath",e),A=this.getInputData()[e].json;if(o=kn(A,y),o===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);o=Pn.call(this,y,e,"Changes (JSON)");}if(!Array.isArray(o))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:f,fileName:c}=await Le.call(this,e,u),d=await ar.load(f),g=new Sn(d,n).process_batch(o,s),m=this.getInputData()[e].binary??{};if(s)return [{json:{fileName:c,author:n,dryRun:true,stats:g},binary:m,pairedItem:{item:e}}];let D=await d.save(),w=ur(c,"redlined"),v=await this.helpers.prepareBinaryData(D,w,et),E=typeof this.isToolExecution=="function"&&this.isToolExecution(),_;if(E&&v.id){let y=this.getWorkflowStaticData("global");y.adeu_last_redlined={id:v.id,fileName:w,mimeType:et,timestamp:Date.now()},_=v.id;}let b;return i&&(b=await ot(D,false)),[{json:{fileName:w,author:n,dryRun:false,stats:g,...b!==void 0?{markdown:b}:{},..._!==void 0?{redlinedBinaryId:_}:{}},binary:{...m,[r]:v},pairedItem:{item:e}}]}h(qa,"executeApplyEdits");var za=[{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 ja(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"),s=a==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("originalSourceNodeName",e,""),binaryPropertyName:t}:{mode:"fromInput",binaryPropertyName:t},o=i==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("modifiedSourceNodeName",e,""),binaryPropertyName:r}:{mode:"fromInput",binaryPropertyName:r},{buffer:l,fileName:u}=await Le.call(this,e,s),{buffer:f,fileName:c}=await Le.call(this,e,o),d=await ot(l,n),p=await ot(f,n),g=Ba(d,p,u,c);return [{json:{originalFileName:u,modifiedFileName:c,cleanView:n,diff:g},pairedItem:{item:e}}]}h(ja,"executeGenerateDiff");var Wa=[{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 Ha(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 v=this.getNodeParameter("authorOverride",e);i=v.trim()===""?null:v;}let o=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:f,fileName:c}=await Le.call(this,e,u),d=await ar.load(f),{reportText:p,outBuffer:g}=await Fa(d,{filename:c,sanitize_mode:n,accept_all:a,protection_mode:o,author:i});if(!g)throw new Error(p);let m=ur(c,"finalized"),D=await this.helpers.prepareBinaryData(g,m,et),w=this.getInputData()[e].binary??{};return [{json:{fileName:m,sanitizeMode:n,report:p},binary:{...w,[r]:D},pairedItem:{item:e}}]}h(Ha,"executeFinalizeDocument");var Va=[{displayName:"Operation",name:"operation",type:"options",noDataExpression:true,displayOptions:{show:{resource:["document"]}},options:[{name:"Apply Edits",value:"applyEdits",action:"Apply a batch of tracked changes to the document",description:"Apply a JSON array of DocumentChange objects (modify, accept, reject, reply, insert_row, delete_row) as native Word tracked changes and comments. 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 a Markdown representation of the 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."},{name:"Finalize Document",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 a Word Patch diff between two 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","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","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","finalizeDocument"],documentSource:["fromNode"]}}},...La,...Ua,...za,...Wa,...Rn];var Ya=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, apply tracked changes and comments, generate sub-word diffs, and sanitize/finalize documents. Four operations on the Document resource: (1) Extract Markdown \u2014 project a .docx into Markdown plus a Semantic Appendix (defined terms, cross-references, typos); toggle Clean View to simulate Accept All. (2) Apply Edits \u2014 apply a JSON array of DocumentChange objects as native Word tracked changes; 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, returning a per-edit report with CriticMarkup context snippets so an AI Agent can self-correct anchor mistakes before issuing a real call. (3) Generate Diff \u2014 produce a @@ Word Patch @@ sub-word level diff between two .docx files. (4) 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' attaches a comment bubble. 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"},...Va]};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 s;if(n==="document")switch(a){case "extractMarkdown":s=await $a.call(this,i);break;case "applyEdits":s=await qa.call(this,i);break;case "generateDiff":s=await ja.call(this,i);break;case "finalizeDocument":s=await Ha.call(this,i);break;case "hydrateToolOutput":s=await Bn.call(this,i);break;default:throw new Error(`Unsupported operation: ${a}`)}else throw new Error(`Unsupported resource: ${n}`);r.push(...s);}catch(s){if(this.continueOnFail()){r.push({json:{error:s.message},pairedItem:{item:i}});continue}let o=s;throw o.name==="NodeOperationError"||o.name==="NodeApiError"?o:On.call(this,o,i)}return [r]}};exports.Adeu=Ya;
|