Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 | 25x | import{JSDOM as e}from"jsdom";import t from"puppeteer";import r from"axios";import s from"lodash.get";const n=async(e,r)=>{const s=await t.launch({executablePath:r?.executablePath?r.executablePath:t.executablePath(),...r}),n=await s.newPage();await n.goto(e),await(async e=>{await e.evaluate((async()=>{await new Promise((e=>{let t=0,r=setInterval((()=>{let s=document.body.scrollHeight;window.scrollBy(0,100),t+=100,t>=s&&(clearInterval(r),e(!0))}),100)}))}))})(n);const o=await n.content();return await s.close(),o},o=async e=>{try{return(await r.get(e)).data}catch(t){throw new Error(`Error fetching data from ${e}: ${t.message}`)}},i=(e,t)=>{const r={};for(const[s,n]of Object.entries(t)){const t=e.querySelectorAll(n.selector);if(t.length){Iif(1===t.length)r[s]=n?.attribute?t[0].getAttribute(n?.attribute)||"":t[0].textContent?.trim()||"";else Eif(t.length>1){const e=Array.from(t,(e=>n?.attribute?e.getAttribute(n?.attribute)||"":e.textContent?.trim()||""));r[s]=e}}else Er[s]=""}return r},a=async(t,{selectors:r,spa:s={enable:!1,browserConfig:{}}})=>{const a=await(async(t,r)=>{const{selectors:s,spa:a}=r;Iif(a?.enable){const r=await n(t,a.browserConfig),o=new e(r).window.document;return i(o,s)}{const r=await o(t),n=new e(r).window.document;return i(n,s)}})(t,{selectors:r,spa:s});return a},u=(e,{selectors:t})=>((e,t)=>{const r={};if(Array.isArray(e))return e.map((e=>{const r={};for(const[n,o]of Object.entries(t))r[n]=s(e,o.selector,"");return r}));for(const[n,o]of Object.entries(t))r[n]=s(e,o.selector,"");return r})(e,t),l=async(e,{selectors:t})=>{const r=await o(e);return u(r,{selectors:t})};var c={},h={};Object.defineProperty(h,"__esModule",{value:!0});h.XPath=class{constructor(e){this.expression=e}toString(){return this.expression.toString()}evaluate(e){return e.contextNode=e.expressionContextNode,e.contextSize=1,e.contextPosition=1,e.isHtml&&(void 0===e.caseInsensitive&&(e.caseInsensitive=!0),void 0===e.allowAnyNamespaceForNoPrefix&&(e.allowAnyNamespaceForNoPrefix=!0)),void 0===e.caseInsensitive&&(e.caseInsensitive=!1),this.expression.evaluate(e)}};var p={},d={},f={},E={},N={};Object.defineProperty(N,"__esModule",{value:!0}),N.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",N.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/";var m={};function g(e){return e>=65&&e<=90||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=255||e>=256&&e<=305||e>=308&&e<=318||e>=321&&e<=328||e>=330&&e<=382||e>=384&&e<=451||e>=461&&e<=496||e>=500&&e<=501||e>=506&&e<=535||e>=592&&e<=680||e>=699&&e<=705||902===e||e>=904&&e<=906||908===e||e>=910&&e<=929||e>=931&&e<=974||e>=976&&e<=982||986===e||988===e||990===e||992===e||e>=994&&e<=1011||e>=1025&&e<=1036||e>=1038&&e<=1103||e>=1105&&e<=1116||e>=1118&&e<=1153||e>=1168&&e<=1220||e>=1223&&e<=1224||e>=1227&&e<=1228||e>=1232&&e<=1259||e>=1262&&e<=1269||e>=1272&&e<=1273||e>=1329&&e<=1366||1369===e||e>=1377&&e<=1414||e>=1488&&e<=1514||e>=1520&&e<=1522||e>=1569&&e<=1594||e>=1601&&e<=1610||e>=1649&&e<=1719||e>=1722&&e<=1726||e>=1728&&e<=1742||e>=1744&&e<=1747||1749===e||e>=1765&&e<=1766||e>=2309&&e<=2361||2365===e||e>=2392&&e<=2401||e>=2437&&e<=2444||e>=2447&&e<=2448||e>=2451&&e<=2472||e>=2474&&e<=2480||2482===e||e>=2486&&e<=2489||e>=2524&&e<=2525||e>=2527&&e<=2529||e>=2544&&e<=2545||e>=2565&&e<=2570||e>=2575&&e<=2576||e>=2579&&e<=2600||e>=2602&&e<=2608||e>=2610&&e<=2611||e>=2613&&e<=2614||e>=2616&&e<=2617||e>=2649&&e<=2652||2654===e||e>=2674&&e<=2676||e>=2693&&e<=2699||2701===e||e>=2703&&e<=2705||e>=2707&&e<=2728||e>=2730&&e<=2736||e>=2738&&e<=2739||e>=2741&&e<=2745||2749===e||2784===e||e>=2821&&e<=2828||e>=2831&&e<=2832||e>=2835&&e<=2856||e>=2858&&e<=2864||e>=2866&&e<=2867||e>=2870&&e<=2873||2877===e||e>=2908&&e<=2909||e>=2911&&e<=2913||e>=2949&&e<=2954||e>=2958&&e<=2960||e>=2962&&e<=2965||e>=2969&&e<=2970||2972===e||e>=2974&&e<=2975||e>=2979&&e<=2980||e>=2984&&e<=2986||e>=2990&&e<=2997||e>=2999&&e<=3001||e>=3077&&e<=3084||e>=3086&&e<=3088||e>=3090&&e<=3112||e>=3114&&e<=3123||e>=3125&&e<=3129||e>=3168&&e<=3169||e>=3205&&e<=3212||e>=3214&&e<=3216||e>=3218&&e<=3240||e>=3242&&e<=3251||e>=3253&&e<=3257||3294===e||e>=3296&&e<=3297||e>=3333&&e<=3340||e>=3342&&e<=3344||e>=3346&&e<=3368||e>=3370&&e<=3385||e>=3424&&e<=3425||e>=3585&&e<=3630||3632===e||e>=3634&&e<=3635||e>=3648&&e<=3653||e>=3713&&e<=3714||3716===e||e>=3719&&e<=3720||3722===e||3725===e||e>=3732&&e<=3735||e>=3737&&e<=3743||e>=3745&&e<=3747||3749===e||3751===e||e>=3754&&e<=3755||e>=3757&&e<=3758||3760===e||e>=3762&&e<=3763||3773===e||e>=3776&&e<=3780||e>=3904&&e<=3911||e>=3913&&e<=3945||e>=4256&&e<=4293||e>=4304&&e<=4342||4352===e||e>=4354&&e<=4355||e>=4357&&e<=4359||4361===e||e>=4363&&e<=4364||e>=4366&&e<=4370||4412===e||4414===e||4416===e||4428===e||4430===e||4432===e||e>=4436&&e<=4437||4441===e||e>=4447&&e<=4449||4451===e||4453===e||4455===e||4457===e||e>=4461&&e<=4462||e>=4466&&e<=4467||4469===e||4510===e||4520===e||4523===e||e>=4526&&e<=4527||e>=4535&&e<=4536||4538===e||e>=4540&&e<=4546||4587===e||4592===e||4601===e||e>=7680&&e<=7835||e>=7840&&e<=7929||e>=7936&&e<=7957||e>=7960&&e<=7965||e>=7968&&e<=8005||e>=8008&&e<=8013||e>=8016&&e<=8023||8025===e||8027===e||8029===e||e>=8031&&e<=8061||e>=8064&&e<=8116||e>=8118&&e<=8124||8126===e||e>=8130&&e<=8132||e>=8134&&e<=8140||e>=8144&&e<=8147||e>=8150&&e<=8155||e>=8160&&e<=8172||e>=8178&&e<=8180||e>=8182&&e<=8188||8486===e||e>=8490&&e<=8491||8494===e||e>=8576&&e<=8578||e>=12353&&e<=12436||e>=12449&&e<=12538||e>=12549&&e<=12588||e>=44032&&e<=55203||e>=19968&&e<=40869||12295===e||e>=12321&&e<=12329}Object.defineProperty(m,"__esModule",{value:!0}),m.isSpace=function(e){return 9===e||13===e||10===e||32===e},m.isLetter=g,m.isNCNameChar=function(e){return e>=48&&e<=57||e>=1632&&e<=1641||e>=1776&&e<=1785||e>=2406&&e<=2415||e>=2534&&e<=2543||e>=2662&&e<=2671||e>=2790&&e<=2799||e>=2918&&e<=2927||e>=3047&&e<=3055||e>=3174&&e<=3183||e>=3302&&e<=3311||e>=3430&&e<=3439||e>=3664&&e<=3673||e>=3792&&e<=3801||e>=3872&&e<=3881||46===e||45===e||95===e||g(e)||e>=768&&e<=837||e>=864&&e<=865||e>=1155&&e<=1158||e>=1425&&e<=1441||e>=1443&&e<=1465||e>=1467&&e<=1469||1471===e||e>=1473&&e<=1474||1476===e||e>=1611&&e<=1618||1648===e||e>=1750&&e<=1756||e>=1757&&e<=1759||e>=1760&&e<=1764||e>=1767&&e<=1768||e>=1770&&e<=1773||e>=2305&&e<=2307||2364===e||e>=2366&&e<=2380||2381===e||e>=2385&&e<=2388||e>=2402&&e<=2403||e>=2433&&e<=2435||2492===e||2494===e||2495===e||e>=2496&&e<=2500||e>=2503&&e<=2504||e>=2507&&e<=2509||2519===e||e>=2530&&e<=2531||2562===e||2620===e||2622===e||2623===e||e>=2624&&e<=2626||e>=2631&&e<=2632||e>=2635&&e<=2637||e>=2672&&e<=2673||e>=2689&&e<=2691||2748===e||e>=2750&&e<=2757||e>=2759&&e<=2761||e>=2763&&e<=2765||e>=2817&&e<=2819||2876===e||e>=2878&&e<=2883||e>=2887&&e<=2888||e>=2891&&e<=2893||e>=2902&&e<=2903||e>=2946&&e<=2947||e>=3006&&e<=3010||e>=3014&&e<=3016||e>=3018&&e<=3021||3031===e||e>=3073&&e<=3075||e>=3134&&e<=3140||e>=3142&&e<=3144||e>=3146&&e<=3149||e>=3157&&e<=3158||e>=3202&&e<=3203||e>=3262&&e<=3268||e>=3270&&e<=3272||e>=3274&&e<=3277||e>=3285&&e<=3286||e>=3330&&e<=3331||e>=3390&&e<=3395||e>=3398&&e<=3400||e>=3402&&e<=3405||3415===e||3633===e||e>=3636&&e<=3642||e>=3655&&e<=3662||3761===e||e>=3764&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=3864&&e<=3865||3893===e||3895===e||3897===e||3902===e||3903===e||e>=3953&&e<=3972||e>=3974&&e<=3979||e>=3984&&e<=3989||3991===e||e>=3993&&e<=4013||e>=4017&&e<=4023||4025===e||e>=8400&&e<=8412||8417===e||e>=12330&&e<=12335||12441===e||12442===e||183===e||720===e||721===e||903===e||1600===e||3654===e||3782===e||12293===e||e>=12337&&e<=12341||e>=12445&&e<=12446||e>=12540&&e<=12542};var S={};function A(e){return null!=e&&(2===e.nodeType||e.specified)}Object.defineProperty(S,"__esModule",{value:!0}),S.isElement=function(e){return null!=e&&1===e.nodeType},S.isAttribute=A,S.isText=function(e){return null!=e&&3===e.nodeType},S.isCData=function(e){return null!=e&&4===e.nodeType},S.isDocument=function(e){return null!=e&&9===e.nodeType},S.isFragment=function(e){return null!=e&&11===e.nodeType},S.isProcessingInstruction=function(e){return null!=e&&7===e.nodeType},S.isNamespaceNode=function(e){return!!A(e)&&("xmlns"===e.localName||"xmlns"===e.prefix)},S.isNSResolver=function(e){return null!=e&&void 0!==e.lookupNamespaceURI};var T={};Object.defineProperty(T,"__esModule",{value:!0});const b=S;function v(e){const t=e.indexOf(":");return-1===t?[null,e]:[e.substring(0,t),e.substring(t+1)]}T.splitQName=v,T.resolveQName=function(e,t,r,s){const n=v(e);return null!=n[0]?n[0]=t.getNamespace(n[0],r):s?(n[0]=t.getNamespace("",r),null==n[0]&&(n[0]="")):n[0]="",n},T.getElementById=function e(t,r){if(b.isElement(t)&&(t.getAttribute("id")===r||t.getAttributeNS(null,"id")===r))return t;for(let s=t.firstChild;null!=s;s=s.nextSibling){const t=e(s,r);if(null!=t)return t}return null};var R={},O={};Object.defineProperty(O,"__esModule",{value:!0});const P=S;class w{constructor(e){this.left=null,this.right=null,this.node=e,this.depth=1}balance(){const e=null==this.left?0:this.left.depth,t=null==this.right?0:this.right.depth;if(e>t+1){(null==this.left.left?0:this.left.left.depth)<(null==this.left.right?0:this.left.right.depth)&&this.left.rotateRR(),this.rotateLL()}else if(e+1<t){const e=null==this.right.right?0:this.right.right.depth;(null==this.right.left?0:this.right.left.depth)>e&&this.right.rotateLL(),this.rotateRR()}}rotateLL(){const e=this.node,t=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=t,this.right.node=e,this.right.updateInNewLocation(),this.updateInNewLocation()}rotateRR(){const e=this.node,t=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=t,this.left.node=e,this.left.updateInNewLocation(),this.updateInNewLocation()}updateInNewLocation(){this.getDepthFromChildren()}getDepthFromChildren(){this.depth=null==this.node?0:1,null!=this.left&&(this.depth=this.left.depth+1),null!=this.right&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)}add(e){if(e===this.node)return!1;const t=function(e,t){if(e===t)return 0;if(void 0!==e.compareDocumentPosition&&void 0!==t.compareDocumentPosition)try{const r=e.compareDocumentPosition(t);return 1&r||10&r?1:20&r?-1:0}catch(e){}let r=0,s=0;for(let t=e;null!=t;t=_(t))r++;for(let e=t;null!=e;e=_(e))s++;if(r>s){for(;r>s;)e=_(e),r--;if(e===t)return 1}else if(s>r){for(;s>r;)t=_(t),s--;if(e===t)return-1}let n=_(e),o=_(t);for(;n!==o;)t=o,n=_(e=n),o=_(t);const i=P.isAttribute(e),a=P.isAttribute(t);if(i&&!a)return-1;if(!i&&a)return 1;if(n){const r=i?n.attributes:n.childNodes,s=r.length;for(let n=0;n<s;n+=1){const s=r[n];if(s===e)return-1;if(s===t)return 1}}throw new Error("Unexpected: could not determine node order")}(e,this.node);let r=!1;return-1===t?null==this.left?(this.left=new w(e),r=!0):(r=this.left.add(e),r&&this.balance()):1===t&&(null==this.right?(this.right=new w(e),r=!0):(r=this.right.add(e),r&&this.balance())),r&&this.getDepthFromChildren(),r}}function _(e){return P.isAttribute(e)?e.ownerElement:e.parentNode}O.AVLTree=w,Object.defineProperty(R,"__esModule",{value:!0});const x=O,I=S;class D{toString(){return"<Expression>"}evaluate(e){throw new Error("Could not evaluate expression.")}get string(){throw new Error("Could not evaluate expression.")}get number(){throw new Error("Could not evaluate expression.")}get bool(){throw new Error("Could not evaluate expression.")}get nodeset(){throw new Error("Could not evaluate expression.")}get stringValue(){throw new Error("Could not evaluate expression.")}get numberValue(){throw new Error("Could not evaluate expression.")}get booleanValue(){throw new Error("Could not evaluate expression.")}equals(e){throw new Error("Could not evaluate expression.")}notequal(e){throw new Error("Could not evaluate expression.")}lessthan(e){throw new Error("Could not evaluate expression.")}greaterthan(e){throw new Error("Could not evaluate expression.")}lessthanorequal(e){throw new Error("Could not evaluate expression.")}greaterthanorequal(e){throw new Error("Could not evaluate expression.")}}R.Expression=D;class y extends D{constructor(e){super(),this.b=Boolean(e)}toString(){return this.b.toString()}evaluate(e){return this}get string(){return new L(this.b)}get number(){return new C(this.b)}get bool(){return this}get nodeset(){throw new Error("Cannot convert boolean to nodeset")}get stringValue(){return this.string.stringValue}get numberValue(){return this.number.numberValue}get booleanValue(){return this.b}not(){return new y(!this.b)}equals(e){if(e instanceof L||e instanceof C)return this.equals(e.bool);if(e instanceof X)return e.compareWithBoolean(this,M.equals);if(e instanceof y)return new y(this.b===e.b);throw new Error("Unsupported type")}notequal(e){if(e instanceof L||e instanceof C)return this.notequal(e.bool);if(e instanceof X)return e.compareWithBoolean(this,M.notequal);if(e instanceof y)return new y(this.b!==e.b);throw new Error("Unsupported type")}lessthan(e){return this.number.lessthan(e)}greaterthan(e){return this.number.greaterthan(e)}lessthanorequal(e){return this.number.lessthanorequal(e)}greaterthanorequal(e){return this.number.greaterthanorequal(e)}}y.TRUE=new y(!0),y.FALSE=new y(!1),R.XBoolean=y;class C extends D{constructor(e){super(),this.num="string"==typeof e?this.parse(e):Number(e)}get numberFormat(){return/^\s*-?[0-9]*\.?[0-9]+\s*$/}parse(e){return this.numberFormat.test(e)?parseFloat(e):Number.NaN}toString(){const e=this.num.toString();return-1!==e.indexOf("e-")?function(e){const t=e.split("e-");let r=t[0].replace(".","");const s=Number(t[1]);for(let e=0;e<s-1;e+=1)r="0"+r;return"0."+r}(e):-1!==e.indexOf("e")?function(e){const t=e.split("e");let r=t[0].replace(".","");const s=Number(t[1])+1-r.length;for(let e=0;e<s;e+=1)r+="0";return r}(e):e}evaluate(e){return this}get string(){return new L(this.toString())}get number(){return this}get bool(){return new y(this.num)}get nodeset(){throw new Error("Cannot convert string to nodeset")}get stringValue(){return this.string.stringValue}get numberValue(){return this.num}get booleanValue(){return this.bool.booleanValue}negate(){return new C(-this.num)}equals(e){if(e instanceof y)return this.bool.equals(e);if(e instanceof L)return this.string.equals(e);if(e instanceof X)return e.compareWithNumber(this,M.equals);if(e instanceof C)return new y(this.num===e.num);throw new Error("Unsupported type")}notequal(e){if(e instanceof y)return this.bool.notequal(e);if(e instanceof L)return this.notequal(e.number);if(e instanceof X)return e.compareWithNumber(this,M.notequal);if(e instanceof C)return new y(this.num!==e.num);throw new Error("Unsupported type")}lessthan(e){if(e instanceof X)return e.compareWithNumber(this,M.greaterthan);if(e instanceof y||e instanceof L)return this.lessthan(e.number);if(e instanceof C)return new y(this.num<e.num);throw new Error("Unsupported type")}greaterthan(e){if(e instanceof X)return e.compareWithNumber(this,M.lessthan);if(e instanceof y||e instanceof L)return this.greaterthan(e.number);if(e instanceof C)return new y(this.num>e.num);throw new Error("Unsupported type")}lessthanorequal(e){if(e instanceof X)return e.compareWithNumber(this,M.greaterthanorequal);if(e instanceof y||e instanceof L)return this.lessthanorequal(e.number);if(e instanceof C)return new y(this.num<=e.num);throw new Error("Unsupported type")}greaterthanorequal(e){if(e instanceof X)return e.compareWithNumber(this,M.lessthanorequal);if(e instanceof y||e instanceof L)return this.greaterthanorequal(e.number);if(e instanceof C)return new y(this.num>=e.num);throw new Error("Unsupported type")}plus(e){return new C(this.num+e.num)}minus(e){return new C(this.num-e.num)}multiply(e){return new C(this.num*e.num)}div(e){return new C(this.num/e.num)}mod(e){return new C(this.num%e.num)}}R.XNumber=C;class L extends D{constructor(e){super(),this.str=String(e)}toString(){return this.str}evaluate(e){return this}get string(){return this}get number(){return new C(this.str)}get bool(){return new y(this.str)}get nodeset(){throw new Error("Cannot convert string to nodeset")}get stringValue(){return this.str}get numberValue(){return this.number.numberValue}get booleanValue(){return this.bool.booleanValue}equals(e){if(e instanceof y)return this.bool.equals(e);if(e instanceof C)return this.number.equals(e);if(e instanceof X)return e.compareWithString(this,M.equals);if(e instanceof L)return new y(this.str===e.str);throw new Error("Unsupported type")}notequal(e){if(e instanceof y)return this.bool.notequal(e);if(e instanceof C)return this.number.notequal(e);if(e instanceof X)return e.compareWithString(this,M.notequal);if(e instanceof L)return new y(this.str!==e.str);throw new Error("Unsupported type")}lessthan(e){return this.number.lessthan(e)}greaterthan(e){return this.number.greaterthan(e)}lessthanorequal(e){return this.number.lessthanorequal(e)}greaterthanorequal(e){return this.number.greaterthanorequal(e)}}R.XString=L;class X extends D{constructor(){super(),this.equals=X.compareWith(M.equals),this.notequal=X.compareWith(M.notequal),this.lessthan=X.compareWith(M.lessthan),this.greaterthan=X.compareWith(M.greaterthan),this.lessthanorequal=X.compareWith(M.lessthanorequal),this.greaterthanorequal=X.compareWith(M.greaterthanorequal),this.tree=null,this.nodes=[],this.size=0}static compareWith(e){return function(t){if(t instanceof L)return this.compareWithString(t,e);if(t instanceof C)return this.compareWithNumber(t,e);if(t instanceof y)return this.compareWithBoolean(t,e);if(t instanceof X)return this.compareWithNodeSet(t,e);throw new Error("Unsupported type")}}toString(){const e=this.first();return null==e?"":this.stringForNode(e)||""}evaluate(e){return this}get string(){return new L(this.toString())}get stringValue(){return this.toString()}get number(){return new C(this.string)}get numberValue(){return Number(this.string)}get bool(){return new y(this.booleanValue)}get booleanValue(){return!!this.size}get nodeset(){return this}stringForNode(e){return I.isDocument(e)||I.isElement(e)||I.isFragment(e)?this.stringForContainerNode(e):I.isAttribute(e)?e.value||e.nodeValue||"":I.isNamespaceNode(e)?e.value:e.nodeValue||""}stringForContainerNode(e){let t="";for(let r=e.firstChild;null!=r;r=r.nextSibling)(I.isElement(r)||I.isText(r)||I.isCData(r)||I.isDocument(r)||I.isFragment(r))&&(t+=this.stringForNode(r));return t}buildTree(){if(!this.tree&&this.nodes.length){this.tree=new x.AVLTree(this.nodes[0]);for(let e=1;e<this.nodes.length;e+=1)this.tree.add(this.nodes[e])}return this.tree}first(){let e=this.buildTree();if(null==e)return null;for(;null!=e.left;)e=e.left;return e.node}add(e){for(let t=0;t<this.nodes.length;t+=1)if(e===this.nodes[t])return;this.tree=null,this.nodes.push(e),this.size+=1}addArray(e){const t=this;e.forEach((e=>t.add(e)))}toArray(){const e=[];return this.toArrayRec(this.buildTree(),e),e}toArrayRec(e,t){null!=e&&(this.toArrayRec(e.left,t),t.push(e.node),this.toArrayRec(e.right,t))}toUnsortedArray(){return this.nodes.slice()}compareWithString(e,t){const r=this.toUnsortedArray();for(let s=0;s<r.length;s++){const n=r[s],o=t(new L(this.stringForNode(n)),e);if(o.booleanValue)return o}return new y(!1)}compareWithNumber(e,t){const r=this.toUnsortedArray();for(let s=0;s<r.length;s++){const n=r[s],o=t(new C(this.stringForNode(n)),e);if(o.booleanValue)return o}return new y(!1)}compareWithBoolean(e,t){return t(this.bool,e)}compareWithNodeSet(e,t){const r=this.toUnsortedArray(),s=(e,r)=>t(r,e);for(let t=0;t<r.length;t++){const n=new L(this.stringForNode(r[t])),o=e.compareWithString(n,s);if(o.booleanValue)return o}return new y(!1)}union(e){const t=new X;return t.addArray(this.toUnsortedArray()),t.addArray(e.toUnsortedArray()),t}}R.XNodeSet=X;class F{constructor(e,t,r){this.variableResolver=e,this.namespaceResolver=t,this.functionResolver=r,this.virtualRoot=null,this.contextSize=0,this.contextPosition=0}clone(){return Object.assign(new F(this.variableResolver,this.namespaceResolver,this.functionResolver),this)}extend(e){return Object.assign(new F(this.variableResolver,this.namespaceResolver,this.functionResolver),this,e)}}R.XPathContext=F;class M{static equals(e,t){return e.equals(t)}static notequal(e,t){return e.notequal(t)}static lessthan(e,t){return e.lessthan(t)}static greaterthan(e,t){return e.greaterthan(t)}static lessthanorequal(e,t){return e.lessthanorequal(t)}static greaterthanorequal(e,t){return e.greaterthanorequal(t)}}R.Operators=M,Object.defineProperty(E,"__esModule",{value:!0});const U=N,V=m,B=S,H=T,Y=R;function G(e,t,r){if("number"==typeof e&&(e=[e]),!e.includes(t.length))throw new Error(`Function ${r} expects ${e.join(" or ")} arguments instead of ${t.length}`)}E.Functions=class{static last(e,...t){return G(0,t,"last"),new Y.XNumber(e.contextSize)}static position(e,...t){return G(0,t,"position"),new Y.XNumber(e.contextPosition)}static count(e,...t){G(1,t,"count");const r=t[0].evaluate(e);if(!(r instanceof Y.XNodeSet))throw new Error("Function count expects (node-set)");return new Y.XNumber(r.size)}static id(e,...t){G(1,t,"id");const r=t[0].evaluate(e);let s;if(r instanceof Y.XNodeSet)s=r.toArray().map((e=>Y.XNodeSet.prototype.stringForNode(e)));else{s=r.stringValue.split(/[\x0d\x0a\x09\x20]+/)}const n=new Y.XNodeSet,o=B.isDocument(e.contextNode)?e.contextNode:e.contextNode.ownerDocument;for(let e=0;e<s.length;e++){let t;t=o.getElementById?o.getElementById(s[e]):H.getElementById(o,s[e]),null!=t&&n.add(t)}return n}static localName(e,...t){let r;if(G([0,1],t,"local-name"),0===t.length)r=e.contextNode;else{const s=t[0].evaluate(e);if(!(s instanceof Y.XNodeSet))throw new Error("Function local-name expects (node-set?)");r=s.first()}return null==r?new Y.XString(""):(B.isElement(r)||B.isAttribute(r))&&null!=r.localName?new Y.XString(r.localName):B.isProcessingInstruction(r)?new Y.XString(r.target):new Y.XString(null!=r.nodeName?r.nodeName:"")}static namespaceURI(e,...t){let r;if(G([0,1],t,"namespace-uri"),0===t.length)r=e.contextNode;else{const s=t[0].evaluate(e);if(!(s instanceof Y.XNodeSet))throw new Error("Function namspace-uri expects (node-set?)");r=s.first()}return null==r?new Y.XString(""):new Y.XString(r.namespaceURI)}static name_(e,...t){let r;if(G([0,1],t,"name"),0===t.length)r=e.contextNode;else{const s=t[0].evaluate(e);if(!(s instanceof Y.XNodeSet))throw new Error("Function name expects (node-set?)");r=s.first()}return null==r?new Y.XString(""):B.isElement(r)?new Y.XString(r.nodeName):B.isAttribute(r)?new Y.XString(r.name||r.nodeName):B.isProcessingInstruction(r)?new Y.XString(r.target||r.nodeName):null==r.localName?new Y.XString(""):new Y.XString(r.localName)}static string(e,...t){return G([0,1],t,"string"),0===t.length?new Y.XString(Y.XNodeSet.prototype.stringForNode(e.contextNode)):t[0].evaluate(e).string}static concat(e,...t){if(t.length<2)throw new Error("Function concat expects (string, string[, string]*)");let r="";for(let s=0;s<t.length;s++)r+=t[s].evaluate(e).stringValue;return new Y.XString(r)}static startsWith(e,...t){G(2,t,"starts-with");const r=t[0].evaluate(e).stringValue,s=t[1].evaluate(e).stringValue;return new Y.XBoolean(r.substring(0,s.length)===s)}static contains(e,...t){G(2,t,"contains");const r=t[0].evaluate(e).stringValue,s=t[1].evaluate(e).stringValue;return new Y.XBoolean(-1!==r.indexOf(s))}static substringBefore(e,...t){G(2,t,"substring-before");const r=t[0].evaluate(e).stringValue,s=t[1].evaluate(e).stringValue;return new Y.XString(r.substring(0,r.indexOf(s)))}static substringAfter(e,...t){G(2,t,"substring-after");const r=t[0].evaluate(e).stringValue,s=t[1].evaluate(e).stringValue;if(0===s.length)return new Y.XString(r);const n=r.indexOf(s);return-1===n?new Y.XString(""):new Y.XString(r.substring(n+s.length))}static substring(e,...t){G([2,3],t,"substring");const r=t[0].evaluate(e).stringValue,s=Math.round(t[1].evaluate(e).numberValue)-1,n=3===t.length?s+Math.round(t[2].evaluate(e).numberValue):void 0;return new Y.XString(r.substring(s,n))}static stringLength(e,...t){let r;return G([0,1],t,"string-length"),r=0===t.length?Y.XNodeSet.prototype.stringForNode(e.contextNode)||"":t[0].evaluate(e).stringValue,new Y.XNumber(r.length)}static normalizeSpace(e,...t){let r;G([0,1],t,"normalize-space"),r=0===t.length?Y.XNodeSet.prototype.stringForNode(e.contextNode):t[0].evaluate(e).stringValue;let s=0,n=r.length-1;for(;V.isSpace(r.charCodeAt(n));)n--;let o="";for(;s<=n&&V.isSpace(r.charCodeAt(s));)s++;for(;s<=n;)if(V.isSpace(r.charCodeAt(s)))for(o+=" ";s<=n&&V.isSpace(r.charCodeAt(s));)s++;else o+=r.charAt(s),s++;return new Y.XString(o)}static translate(e,...t){G(3,t,"translate");const r=t[0].evaluate(e).stringValue,s=t[1].evaluate(e).stringValue,n=t[2].evaluate(e).stringValue,o=[...s].reduce(((e,t,r)=>(t in e||(e[t]=r>n.length?"":n[r]),e)),{}),i=[...r].map((e=>e in o?o[e]:e)).join("");return new Y.XString(i)}static boolean_(e,...t){return G(1,t,"boolean"),t[0].evaluate(e).bool}static not(e,...t){return G(1,t,"not"),t[0].evaluate(e).bool.not()}static true_(e,...t){return G(0,t,"true"),Y.XBoolean.TRUE}static false_(e,...t){return G(0,t,"false"),Y.XBoolean.FALSE}static lang(e,...t){G(1,t,"lang");let r=null;for(let t=e.contextNode;null!=t&&!B.isDocument(t);t=t.parentNode)if(B.isElement(t)){const e=t.getAttributeNS(U.XML_NAMESPACE_URI,"lang");if(null!=e){r=String(e);break}}if(null==r)return Y.XBoolean.FALSE;const s=t[0].evaluate(e).stringValue;return new Y.XBoolean(r.substring(0,s.length)===s&&(r.length===s.length||"-"===r.charAt(s.length)))}static number(e,...t){return G([0,1],t,"number"),0===t.length?new Y.XNumber(Y.XNodeSet.prototype.stringForNode(e.contextNode)):t[0].evaluate(e).number}static sum(e,...t){G(1,t,"sum");const r=t[0].evaluate(e);if(!(r instanceof Y.XNodeSet))throw new Error("Function sum expects (node-set)");const s=r.toUnsortedArray();let n=0;for(let e=0;e<s.length;e++)n+=new Y.XNumber(Y.XNodeSet.prototype.stringForNode(s[e])).numberValue;return new Y.XNumber(n)}static floor(e,...t){return G(1,t,"floor"),new Y.XNumber(Math.floor(t[0].evaluate(e).numberValue))}static ceiling(e,...t){return G(1,t,"ceiling"),new Y.XNumber(Math.ceil(t[0].evaluate(e).numberValue))}static round(e,...t){return G(1,t,"round"),new Y.XNumber(Math.round(t[0].evaluate(e).numberValue))}},Object.defineProperty(f,"__esModule",{value:!0});const q=E,W=T;f.FunctionResolverImpl=class{static getFunctionFromContext(e,t){const r=W.resolveQName(e,t.namespaceResolver,t.contextNode,!1);if(null===r[0])throw new Error("Cannot resolve QName "+name);return t.functionResolver.getFunction(r[1],r[0])}constructor(){this.functions={},this.addStandardFunctions()}addStandardFunctions(){this.functions["{}last"]=q.Functions.last,this.functions["{}position"]=q.Functions.position,this.functions["{}count"]=q.Functions.count,this.functions["{}id"]=q.Functions.id,this.functions["{}local-name"]=q.Functions.localName,this.functions["{}namespace-uri"]=q.Functions.namespaceURI,this.functions["{}name"]=q.Functions.name_,this.functions["{}string"]=q.Functions.string,this.functions["{}concat"]=q.Functions.concat,this.functions["{}starts-with"]=q.Functions.startsWith,this.functions["{}contains"]=q.Functions.contains,this.functions["{}substring-before"]=q.Functions.substringBefore,this.functions["{}substring-after"]=q.Functions.substringAfter,this.functions["{}substring"]=q.Functions.substring,this.functions["{}string-length"]=q.Functions.stringLength,this.functions["{}normalize-space"]=q.Functions.normalizeSpace,this.functions["{}translate"]=q.Functions.translate,this.functions["{}boolean"]=q.Functions.boolean_,this.functions["{}not"]=q.Functions.not,this.functions["{}true"]=q.Functions.true_,this.functions["{}false"]=q.Functions.false_,this.functions["{}lang"]=q.Functions.lang,this.functions["{}number"]=q.Functions.number,this.functions["{}sum"]=q.Functions.sum,this.functions["{}floor"]=q.Functions.floor,this.functions["{}ceiling"]=q.Functions.ceiling,this.functions["{}round"]=q.Functions.round}addFunction(e,t,r){this.functions["{"+e+"}"+t]=r}getFunction(e,t){return this.functions["{"+t+"}"+e]}},Object.defineProperty(d,"__esModule",{value:!0});const j=f,k=R;class Q extends k.Expression{constructor(e,t){super(),this.functionName=e,this.arguments=t}evaluate(e){const t=j.FunctionResolverImpl.getFunctionFromContext(this.functionName,e);if(void 0===t)throw new Error("Unknown function "+this.functionName);return t(e,...this.arguments)}toString(){const e=this.arguments.map((e=>e.toString())).join(", ");return`${this.functionName}(${e})`}}d.FunctionCall=Q;var J={};Object.defineProperty(J,"__esModule",{value:!0});J.LocationPath=class{constructor(e,t){this.absolute=e,this.steps=t}toString(){return(this.absolute?"/":"")+this.steps.map((e=>e.toString())).join("/")}};var $={},K={};Object.defineProperty(K,"__esModule",{value:!0});class Z{constructor(e,t,r){this.isXPathNamespace=!0,this.nodeName="#namespace",this.appendChild=z,this.cloneNode=z,this.compareDocumentPosition=z,this.contains=z,this.getRootNode=z,this.hasChildNodes=z,this.insertBefore=z,this.isDefaultNamespace=z,this.isEqualNode=z,this.isSameNode=z,this.lookupNamespaceURI=z,this.lookupPrefix=z,this.normalize=z,this.removeChild=z,this.replaceChild=z,this.addEventListener=z,this.dispatchEvent=z,this.removeEventListener=z,this.isXPathNamespace=!0,this.ownerDocument=r.ownerDocument,this.nodeName="#namespace",this.prefix=e,this.localName=e,this.namespaceURI=t,this.nodeValue=t,this.ownerElement=r,this.nodeType=Z.XPATH_NAMESPACE_NODE}toString(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'}}function z(){throw new Error("Unsupported")}Z.XPATH_NAMESPACE_NODE=13,K.XPathNamespace=Z,Object.defineProperty($,"__esModule",{value:!0});const ee=K;class te{constructor(e){this.type=e}static isNodeType(e){return t=>e.includes(t.nodeType)||t.specified&&e.includes(2)}static makeNodeTypeTest(e,t,r){return new class extends te{constructor(){super(e),this.matches=te.isNodeType(t),this.toString=()=>r}}}static hasPrefix(e){return e.prefix||-1!==(e.nodeName||e.tagName).indexOf(":")}static nameSpaceMatches(e,t,r){const s=r.namespaceURI||"";if(!e)return!s||t.allowAnyNamespaceForNoPrefix&&!te.hasPrefix(r);const n=t.namespaceResolver.getNamespace(e,r);return null!=n&&n===s}toString(){return"<unknown nodetest type>"}matches(e,t){return console.warn("unknown node test type"),!1}}te.NAMETESTANY=0,te.NAMETESTPREFIXANY=1,te.NAMETESTQNAME=2,te.COMMENT=3,te.TEXT=4,te.PI=5,te.NODE=6,te.isElementOrAttribute=te.isNodeType([1,2]),te.localNameMatches=(e,t,r)=>{const s=r.localName||r.nodeName;return t.caseInsensitive?e.toLowerCase()===s.toLowerCase():e===s},te.NameTestPrefixAny=class extends te{constructor(e){super(te.NAMETESTPREFIXANY),this.prefix=e}matches(e,t){return te.isElementOrAttribute(e)&&te.nameSpaceMatches(this.prefix,t,e)}toString(){return this.prefix+":*"}},te.NameTestQName=class extends te{constructor(e){super(te.NAMETESTQNAME);const t=e.split(":");this.name=e,this.prefix=t.length>1?t[0]:null,this.localName=t[t.length>1?1:0]}matches(e,t){return te.isNodeType([1,2,ee.XPathNamespace.XPATH_NAMESPACE_NODE])(e)&&te.nameSpaceMatches(this.prefix,t,e)&&te.localNameMatches(this.localName,t,e)}toString(){return this.name}},te.PITest=class extends te{constructor(e){super(te.PI),this.name=e}matches(e,t){return te.isNodeType([7])(e)&&(e.target||e.nodeName)===this.name}toString(){return`processing-instruction("${this.name}")`}},te.nameTestAny=te.makeNodeTypeTest(te.NAMETESTANY,[1,2,ee.XPathNamespace.XPATH_NAMESPACE_NODE],"*"),te.textTest=te.makeNodeTypeTest(te.TEXT,[3,4],"text()"),te.commentTest=te.makeNodeTypeTest(te.COMMENT,[8],"comment()"),te.nodeTest=te.makeNodeTypeTest(te.NODE,[1,2,3,4,7,8,9],"node()"),te.anyPiTest=te.makeNodeTypeTest(te.PI,[7],"processing-instruction()"),$.NodeTest=te;var re={},se={};Object.defineProperty(se,"__esModule",{value:!0});const ne=R;class oe extends ne.Expression{constructor(e,t){super(),this.lhs=e,this.rhs=t}}se.BinaryOperation=oe,Object.defineProperty(re,"__esModule",{value:!0});const ie=se;class ae extends ie.BinaryOperation{evaluate(e){const t=this.lhs.evaluate(e).bool;return t.booleanValue?this.rhs.evaluate(e).bool:t}toString(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"}}re.AndOperation=ae;var ue={};Object.defineProperty(ue,"__esModule",{value:!0});const le=se;class ce extends le.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).nodeset.union(this.rhs.evaluate(e).nodeset)}toString(){return this.lhs.toString()+" | "+this.rhs.toString()}}ue.BarOperation=ce;var he={};Object.defineProperty(he,"__esModule",{value:!0});const pe=se;class de extends pe.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).number.div(this.rhs.evaluate(e).number)}toString(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"}}he.DivOperation=de;var fe={};Object.defineProperty(fe,"__esModule",{value:!0});const Ee=se;class Ne extends Ee.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).equals(this.rhs.evaluate(e))}toString(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"}}fe.EqualsOperation=Ne;var me={};Object.defineProperty(me,"__esModule",{value:!0});const ge=se;class Se extends ge.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).greaterthan(this.rhs.evaluate(e))}toString(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"}}me.GreaterThanOperation=Se;var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});const Te=se;class be extends Te.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).greaterthanorequal(this.rhs.evaluate(e))}toString(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"}}Ae.GreaterThanOrEqualOperation=be;var ve={};Object.defineProperty(ve,"__esModule",{value:!0});const Re=se;class Oe extends Re.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).lessthan(this.rhs.evaluate(e))}toString(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"}}ve.LessThanOperation=Oe;var Pe={};Object.defineProperty(Pe,"__esModule",{value:!0});const we=se;class _e extends we.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).lessthanorequal(this.rhs.evaluate(e))}toString(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"}}Pe.LessThanOrEqualOperation=_e;var xe={};Object.defineProperty(xe,"__esModule",{value:!0});const Ie=se;class De extends Ie.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).number.minus(this.rhs.evaluate(e).number)}toString(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"}}xe.MinusOperation=De;var ye={};Object.defineProperty(ye,"__esModule",{value:!0});const Ce=se;class Le extends Ce.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).number.mod(this.rhs.evaluate(e).number)}toString(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"}}ye.ModOperation=Le;var Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});const Fe=se;class Me extends Fe.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).number.multiply(this.rhs.evaluate(e).number)}toString(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"}}Xe.MultiplyOperation=Me;var Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});const Ve=se;class Be extends Ve.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).notequal(this.rhs.evaluate(e))}toString(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"}}Ue.NotEqualOperation=Be;var He={};Object.defineProperty(He,"__esModule",{value:!0});const Ye=se;class Ge extends Ye.BinaryOperation{evaluate(e){const t=this.lhs.evaluate(e).bool;return t.booleanValue?t:this.rhs.evaluate(e).bool}toString(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"}}He.OrOperation=Ge;var qe={};Object.defineProperty(qe,"__esModule",{value:!0});const We=se;class je extends We.BinaryOperation{evaluate(e){return this.lhs.evaluate(e).number.plus(this.rhs.evaluate(e).number)}toString(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"}}qe.PlusOperation=je;var ke={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});const Je=R;class $e extends Je.Expression{constructor(e){super(),this.rhs=e}}Qe.UnaryOperation=$e,Object.defineProperty(ke,"__esModule",{value:!0});const Ke=Qe;class Ze extends Ke.UnaryOperation{evaluate(e){return this.rhs.evaluate(e).number.negate()}toString(){return"-"+this.rhs.toString()}}ke.UnaryMinusOperation=Ze;var ze={},et={};Object.defineProperty(et,"__esModule",{value:!0});class tt{constructor(e,t,r){this.axis=e,this.nodeTest=t,this.predicates=r}toString(){return tt.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+tt.predicatesString(this.predicates)}}tt.ANCESTOR=0,tt.ANCESTORORSELF=1,tt.ATTRIBUTE=2,tt.CHILD=3,tt.DESCENDANT=4,tt.DESCENDANTORSELF=5,tt.FOLLOWING=6,tt.FOLLOWINGSIBLING=7,tt.NAMESPACE=8,tt.PARENT=9,tt.PRECEDING=10,tt.PRECEDINGSIBLING=11,tt.SELF=12,tt.STEPNAMES=[[tt.ANCESTOR,"ancestor"],[tt.ANCESTORORSELF,"ancestor-or-self"],[tt.ATTRIBUTE,"attribute"],[tt.CHILD,"child"],[tt.DESCENDANT,"descendant"],[tt.DESCENDANTORSELF,"descendant-or-self"],[tt.FOLLOWING,"following"],[tt.FOLLOWINGSIBLING,"following-sibling"],[tt.NAMESPACE,"namespace"],[tt.PARENT,"parent"],[tt.PRECEDING,"preceding"],[tt.PRECEDINGSIBLING,"preceding-sibling"],[tt.SELF,"self"]].reduce(((e,t)=>(e[t[0]]=t[1],e)),{}),tt.predicateString=e=>`[${e.toString()}]`,tt.predicatesString=e=>e.map(tt.predicateString).join(""),et.Step=tt,Object.defineProperty(ze,"__esModule",{value:!0});const rt=N,st=et,nt=S,ot=K,it=R;class at extends it.Expression{constructor(e,t,r){super(),this.filter=e,this.filterPredicates=t,this.locationPath=r}static predicateMatches(e,t){const r=e.evaluate(t);return r instanceof it.XNumber?t.contextPosition===r.numberValue:r.booleanValue}static applyLocationPath(e,t,r){if(!e)return r;const s=e.absolute?[at.getRoot(t,r)]:r;return at.applySteps(e.steps,t,s)}static applyStep(e,t,r){const s=[];switch(t.contextNode=r,e.axis){case st.Step.ANCESTOR:{if(t.contextNode===t.virtualRoot)break;let r;for(r=nt.isAttribute(t.contextNode)?at.getOwnerElement(t.contextNode):t.contextNode.parentNode;null!=r&&(e.nodeTest.matches(r,t)&&s.push(r),r!==t.virtualRoot);)r=r.parentNode;break}case st.Step.ANCESTORORSELF:for(let r=t.contextNode;null!=r&&(e.nodeTest.matches(r,t)&&s.push(r),r!==t.virtualRoot);r=nt.isAttribute(r)?at.getOwnerElement(r):r.parentNode);break;case st.Step.ATTRIBUTE:{const r=t.contextNode.attributes;if(null!=r)for(let n=0;n<r.length;n++){const o=r.item(n);e.nodeTest.matches(o,t)&&s.push(o)}break}case st.Step.CHILD:for(let r=t.contextNode.firstChild;null!=r;r=r.nextSibling)e.nodeTest.matches(r,t)&&s.push(r);break;case st.Step.DESCENDANT:{const r=[t.contextNode.firstChild];for(;r.length>0;)for(let n=r.pop();null!=n;)e.nodeTest.matches(n,t)&&s.push(n),null!=n.firstChild?(r.push(n.nextSibling),n=n.firstChild):n=n.nextSibling;break}case st.Step.DESCENDANTORSELF:{e.nodeTest.matches(t.contextNode,t)&&s.push(t.contextNode);const r=[t.contextNode.firstChild];for(;r.length>0;)for(let n=r.pop();null!=n;)e.nodeTest.matches(n,t)&&s.push(n),null!=n.firstChild?(r.push(n.nextSibling),n=n.firstChild):n=n.nextSibling;break}case st.Step.FOLLOWING:if(t.contextNode===t.virtualRoot)break;for(let r=t.contextNode;null!=r;r=r.parentNode)for(let n=r.nextSibling;null!=n;n=n.nextSibling)e.nodeTest.matches(n,t)&&s.push(n);break;case st.Step.FOLLOWINGSIBLING:if(t.contextNode===t.virtualRoot)break;for(let r=t.contextNode.nextSibling;null!=r;r=r.nextSibling)e.nodeTest.matches(r,t)&&s.push(r);break;case st.Step.NAMESPACE:{const r={};if(nt.isElement(t.contextNode)){r.xml=rt.XML_NAMESPACE_URI,r.xmlns=rt.XMLNS_NAMESPACE_URI;for(let e=t.contextNode;null!=e&&nt.isElement(e);e=e.parentNode)for(let t=0;t<e.attributes.length;t++){const s=e.attributes.item(t),n=String(s.name);if("xmlns"===n)void 0===r[""]&&(r[""]=s.value);else if(n.length>6&&"xmlns:"===n.substring(0,6)){const e=n.substring(6,n.length);void 0===r[e]&&(r[e]=s.value)}}for(const n in r){const o=new ot.XPathNamespace(n,r[n],t.contextNode);e.nodeTest.matches(o,t)&&s.push(o)}}break}case st.Step.PARENT:{let r=null;t.contextNode!==t.virtualRoot&&(r=nt.isAttribute(t.contextNode)?at.getOwnerElement(t.contextNode):t.contextNode.parentNode),null!=r&&e.nodeTest.matches(r,t)&&s.push(r);break}case st.Step.PRECEDING:if(t.contextNode===t.virtualRoot)break;for(let r=t.contextNode;null!=r;r=r.parentNode)for(let n=r.previousSibling;null!=n;n=n.previousSibling)e.nodeTest.matches(n,t)&&s.push(n);break;case st.Step.PRECEDINGSIBLING:if(t.contextNode===t.virtualRoot)break;for(let r=t.contextNode.previousSibling;null!=r;r=r.previousSibling)e.nodeTest.matches(r,t)&&s.push(r);break;case st.Step.SELF:e.nodeTest.matches(t.contextNode,t)&&s.push(t.contextNode)}return s}static getRoot(e,t){const r=t[0];if(nt.isDocument(r))return r;if(e.virtualRoot)return e.virtualRoot;const s=r.ownerDocument;if(s)return s;let n=r;for(;null!=n.parentNode;)n=n.parentNode;return n}static applySteps(e,t,r){return e.reduce(((e,r)=>e.map((e=>at.applyPredicates(r.predicates,t,at.applyStep(r,t,e)))).flat()),r)}static getOwnerElement(e){return e.ownerElement?e.ownerElement:null}static applyPredicates(e,t,r){return e.reduce(((e,r)=>{const s=t.extend({contextSize:e.length});return e.filter(((e,t)=>at.predicateMatches(r,s.extend({contextNode:e,contextPosition:t+1}))))}),r)}applyFilter(e,t){if(!this.filter)return{nodes:[e.contextNode]};const r=this.filter.evaluate(e);if(!(r instanceof it.XNodeSet)){if(null!=this.filterPredicates&&this.filterPredicates.length>0||null!=this.locationPath)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:r}}return{nodes:at.applyPredicates(this.filterPredicates||[],t,r.toUnsortedArray())}}evaluate(e){const t=e.clone(),r=this.applyFilter(e,t);if(void 0!==r.nonNodes)return r.nonNodes;const s=new it.XNodeSet;return s.addArray(at.applyLocationPath(this.locationPath,t,r.nodes)),s}toString(){if(void 0!==this.filter){const e=this.filter.toString();return this.filter instanceof it.XString?`'${e}'`:void 0!==this.filterPredicates&&this.filterPredicates.length?`(${e})`+at.predicatesString(this.filterPredicates):void 0!==this.locationPath?e+(this.locationPath.absolute?"":"/")+this.locationPath.toString():e}return void 0!==this.locationPath?this.locationPath.toString():"<Empty PathExpr>"}}at.predicateString=e=>`[${e.toString()}]`,at.predicatesString=e=>e.map(at.predicateString).join(""),ze.PathExpr=at;var ut={},lt={};Object.defineProperty(lt,"__esModule",{value:!0});class ct extends Error{constructor(e,t,r){super(function(e,t){const r=t?": "+t.toString():"";switch(e){case ct.INVALID_EXPRESSION_ERR:return"Invalid expression"+r;case ct.TYPE_ERR:return"Type error"+r}return}(e,t)||r),this.code=e,this.exception=t}static fromMessage(e,t){return new ct(void 0,t,e)}toString(){return this.message}}ct.INVALID_EXPRESSION_ERR=51,ct.TYPE_ERR=52,lt.XPathException=ct,Object.defineProperty(ut,"__esModule",{value:!0});const ht=T,pt=lt,dt=R;class ft extends dt.Expression{constructor(e){super(),this.variable=e}toString(){return"$"+this.variable}evaluate(e){const t=ht.resolveQName(this.variable,e.namespaceResolver,e.contextNode,!1);if(null==t[0])throw new Error("Cannot resolve QName "+this.variable);const r=e.variableResolver.getVariable(t[1],t[0]);if(!r)throw pt.XPathException.fromMessage("Undeclared variable: "+this.toString());return r}}ut.VariableReference=ft,Object.defineProperty(p,"__esModule",{value:!0});const Et=d,Nt=J,mt=$,gt=re,St=ue,At=he,Tt=fe,bt=me,vt=Ae,Rt=ve,Ot=Pe,Pt=xe,wt=ye,_t=Xe,xt=Ue,It=He,Dt=qe,yt=ke,Ct=ze,Lt=et,Xt=m,Ft=ut,Mt=h,Ut=lt,Vt=R;class Bt{constructor(){this.reduceActions=[],this.reduceActions[3]=e=>new It.OrOperation(e[0],e[2]),this.reduceActions[5]=e=>new gt.AndOperation(e[0],e[2]),this.reduceActions[7]=e=>new Tt.EqualsOperation(e[0],e[2]),this.reduceActions[8]=e=>new xt.NotEqualOperation(e[0],e[2]),this.reduceActions[10]=e=>new Rt.LessThanOperation(e[0],e[2]),this.reduceActions[11]=e=>new bt.GreaterThanOperation(e[0],e[2]),this.reduceActions[12]=e=>new Ot.LessThanOrEqualOperation(e[0],e[2]),this.reduceActions[13]=e=>new vt.GreaterThanOrEqualOperation(e[0],e[2]),this.reduceActions[15]=e=>new Dt.PlusOperation(e[0],e[2]),this.reduceActions[16]=e=>new Pt.MinusOperation(e[0],e[2]),this.reduceActions[18]=e=>new _t.MultiplyOperation(e[0],e[2]),this.reduceActions[19]=e=>new At.DivOperation(e[0],e[2]),this.reduceActions[20]=e=>new wt.ModOperation(e[0],e[2]),this.reduceActions[22]=e=>new yt.UnaryMinusOperation(e[1]),this.reduceActions[24]=e=>new St.BarOperation(e[0],e[2]),this.reduceActions[25]=e=>new Ct.PathExpr(void 0,void 0,e[0]),this.reduceActions[27]=e=>(e[0].locationPath=e[2],e[0]),this.reduceActions[28]=e=>(e[0].locationPath=e[2],e[0].locationPath.steps.unshift(new Lt.Step(Lt.Step.DESCENDANTORSELF,mt.NodeTest.nodeTest,[])),e[0]),this.reduceActions[29]=e=>new Ct.PathExpr(e[0],[],void 0),this.reduceActions[30]=e=>e[0]instanceof Ct.PathExpr?(void 0===e[0].filterPredicates&&(e[0].filterPredicates=[]),e[0].filterPredicates.push(e[1]),e[0]):new Ct.PathExpr(e[0],[e[1]],void 0),this.reduceActions[32]=e=>e[1],this.reduceActions[33]=e=>new Vt.XString(e[0]),this.reduceActions[34]=e=>new Vt.XNumber(e[0]),this.reduceActions[36]=e=>new Et.FunctionCall(e[0],[]),this.reduceActions[37]=e=>new Et.FunctionCall(e[0],e[2]),this.reduceActions[38]=e=>[e[0]],this.reduceActions[39]=e=>(e[2].unshift(e[0]),e[2]),this.reduceActions[43]=e=>new Nt.LocationPath(!0,[]),this.reduceActions[44]=e=>(e[1].absolute=!0,e[1]),this.reduceActions[46]=e=>new Nt.LocationPath(!1,[e[0]]),this.reduceActions[47]=e=>(e[0].steps.push(e[2]),e[0]),this.reduceActions[49]=e=>new Lt.Step(e[0],e[1],[]),this.reduceActions[50]=e=>new Lt.Step(Lt.Step.CHILD,e[0],[]),this.reduceActions[51]=e=>new Lt.Step(e[0],e[1],e[2]),this.reduceActions[52]=e=>new Lt.Step(Lt.Step.CHILD,e[0],e[1]),this.reduceActions[54]=e=>[e[0]],this.reduceActions[55]=e=>(e[1].unshift(e[0]),e[1]),this.reduceActions[56]=e=>"ancestor"===e[0]?Lt.Step.ANCESTOR:"ancestor-or-self"===e[0]?Lt.Step.ANCESTORORSELF:"attribute"===e[0]?Lt.Step.ATTRIBUTE:"child"===e[0]?Lt.Step.CHILD:"descendant"===e[0]?Lt.Step.DESCENDANT:"descendant-or-self"===e[0]?Lt.Step.DESCENDANTORSELF:"following"===e[0]?Lt.Step.FOLLOWING:"following-sibling"===e[0]?Lt.Step.FOLLOWINGSIBLING:"namespace"===e[0]?Lt.Step.NAMESPACE:"parent"===e[0]?Lt.Step.PARENT:"preceding"===e[0]?Lt.Step.PRECEDING:"preceding-sibling"===e[0]?Lt.Step.PRECEDINGSIBLING:"self"===e[0]?Lt.Step.SELF:-1,this.reduceActions[57]=e=>Lt.Step.ATTRIBUTE,this.reduceActions[59]=e=>"comment"===e[0]?mt.NodeTest.commentTest:"text"===e[0]?mt.NodeTest.textTest:"processing-instruction"===e[0]?mt.NodeTest.anyPiTest:"node"===e[0]?mt.NodeTest.nodeTest:new mt.NodeTest(-1),this.reduceActions[60]=e=>new mt.NodeTest.PITest(e[2]),this.reduceActions[61]=e=>e[1],this.reduceActions[63]=e=>(e[1].absolute=!0,e[1].steps.unshift(new Lt.Step(Lt.Step.DESCENDANTORSELF,mt.NodeTest.nodeTest,[])),e[1]),this.reduceActions[64]=e=>(e[0].steps.push(new Lt.Step(Lt.Step.DESCENDANTORSELF,mt.NodeTest.nodeTest,[])),e[0].steps.push(e[2]),e[0]),this.reduceActions[65]=e=>new Lt.Step(Lt.Step.SELF,mt.NodeTest.nodeTest,[]),this.reduceActions[66]=e=>new Lt.Step(Lt.Step.PARENT,mt.NodeTest.nodeTest,[]),this.reduceActions[67]=e=>new Ft.VariableReference(e[1]),this.reduceActions[68]=e=>mt.NodeTest.nameTestAny,this.reduceActions[69]=e=>new mt.NodeTest.NameTestPrefixAny(e[0].split(":")[0]),this.reduceActions[70]=e=>new mt.NodeTest.NameTestQName(e[0])}tokenize(e){const t=e+"\0",r=[],s=[];let n=0,o=t.charAt(n++);for(;;){for(;" "===o||"\t"===o||"\r"===o||"\n"===o;)o=t.charAt(n++);if("\0"===o||n>=t.length)break;if("("!==o)if(")"!==o)if("["!==o)if("]"!==o)if("@"!==o)if(","!==o)if("|"!==o)if("+"!==o)if("-"!==o)if("="!==o)if("$"!==o)if("."!==o)if("'"!==o&&'"'!==o)if(o>="0"&&o<="9"){let e=o;for(o=t.charAt(n++);o>="0"&&o<="9";)e+=o,o=t.charAt(n++);if("."===o&&t.charAt(n)>="0"&&t.charAt(n)<="9")for(e+=o,e+=t.charAt(n++),o=t.charAt(n++);o>="0"&&o<="9";)e+=o,o=t.charAt(n++);r.push(Bt.NUMBER),s.push(e)}else if("*"!==o)if(":"!==o||":"!==t.charAt(n))if("/"!==o)if("!"!==o||"="!==t.charAt(n))if("<"!==o)if(">"!==o){if("_"!==o&&!Xt.isLetter(o.charCodeAt(0)))throw new Error("Unexpected character "+o);{let e=o;for(o=t.charAt(n++);Xt.isNCNameChar(o.charCodeAt(0));)e+=o,o=t.charAt(n++);if(r.length>0){const t=r[r.length-1];if(t!==Bt.AT&&t!==Bt.DOUBLECOLON&&t!==Bt.LEFTPARENTHESIS&&t!==Bt.LEFTBRACKET&&t!==Bt.AND&&t!==Bt.OR&&t!==Bt.MOD&&t!==Bt.DIV&&t!==Bt.MULTIPLYOPERATOR&&t!==Bt.SLASH&&t!==Bt.DOUBLESLASH&&t!==Bt.BAR&&t!==Bt.PLUS&&t!==Bt.MINUS&&t!==Bt.EQUALS&&t!==Bt.NOTEQUAL&&t!==Bt.LESSTHAN&&t!==Bt.LESSTHANOREQUAL&&t!==Bt.GREATERTHAN&&t!==Bt.GREATERTHANOREQUAL){if("and"===e){r.push(Bt.AND),s.push(e);continue}if("or"===e){r.push(Bt.OR),s.push(e);continue}if("mod"===e){r.push(Bt.MOD),s.push(e);continue}if("div"===e){r.push(Bt.DIV),s.push(e);continue}}}if(":"===o){if("*"===t.charAt(n)){r.push(Bt.NCNAMECOLONASTERISK),s.push(e+":*"),n++,o=t.charAt(n++);continue}if("_"===t.charAt(n)||Xt.isLetter(t.charCodeAt(n))){for(e+=":",o=t.charAt(n++);Xt.isNCNameChar(o.charCodeAt(0));)e+=o,o=t.charAt(n++);if("("===o){r.push(Bt.FUNCTIONNAME),s.push(e);continue}r.push(Bt.QNAME),s.push(e);continue}if(":"===t.charAt(n)){r.push(Bt.AXISNAME),s.push(e);continue}}if("("===o){if("comment"===e||"text"===e||"node"===e){r.push(Bt.NODETYPE),s.push(e);continue}if("processing-instruction"===e){")"===t.charAt(n)?r.push(Bt.NODETYPE):r.push(Bt.PROCESSINGINSTRUCTIONWITHLITERAL),s.push(e);continue}r.push(Bt.FUNCTIONNAME),s.push(e);continue}r.push(Bt.QNAME),s.push(e)}}else{if("="===t.charAt(n)){r.push(Bt.GREATERTHANOREQUAL),s.push(">="),n++,o=t.charAt(n++);continue}r.push(Bt.GREATERTHAN),s.push(">"),o=t.charAt(n++)}else{if("="===t.charAt(n)){r.push(Bt.LESSTHANOREQUAL),s.push("<="),n++,o=t.charAt(n++);continue}r.push(Bt.LESSTHAN),s.push("<"),o=t.charAt(n++)}else r.push(Bt.NOTEQUAL),s.push("!="),n++,o=t.charAt(n++);else{if(o=t.charAt(n++),"/"===o){r.push(Bt.DOUBLESLASH),s.push("//"),o=t.charAt(n++);continue}r.push(Bt.SLASH),s.push("/")}else r.push(Bt.DOUBLECOLON),s.push("::"),n++,o=t.charAt(n++);else{if(r.length>0){const e=r[r.length-1];if(e!==Bt.AT&&e!==Bt.DOUBLECOLON&&e!==Bt.LEFTPARENTHESIS&&e!==Bt.LEFTBRACKET&&e!==Bt.AND&&e!==Bt.OR&&e!==Bt.MOD&&e!==Bt.DIV&&e!==Bt.MULTIPLYOPERATOR&&e!==Bt.SLASH&&e!==Bt.DOUBLESLASH&&e!==Bt.BAR&&e!==Bt.PLUS&&e!==Bt.MINUS&&e!==Bt.EQUALS&&e!==Bt.NOTEQUAL&&e!==Bt.LESSTHAN&&e!==Bt.LESSTHANOREQUAL&&e!==Bt.GREATERTHAN&&e!==Bt.GREATERTHANOREQUAL){r.push(Bt.MULTIPLYOPERATOR),s.push(o),o=t.charAt(n++);continue}}r.push(Bt.ASTERISKNAMETEST),s.push(o),o=t.charAt(n++)}else{const e=o;let i="";for(;n<t.length&&(o=t.charAt(n))!==e;)i+=o,n+=1;if(o!==e)throw Ut.XPathException.fromMessage("Unterminated string literal: "+e+i);n+=1,r.push(Bt.LITERAL),s.push(i),o=t.charAt(n++)}else{if(o=t.charAt(n++),"."===o){r.push(Bt.DOUBLEDOT),s.push(".."),o=t.charAt(n++);continue}if(o>="0"&&o<="9"){let e="."+o;for(o=t.charAt(n++);o>="0"&&o<="9";)e+=o,o=t.charAt(n++);r.push(Bt.NUMBER),s.push(e);continue}r.push(Bt.DOT),s.push(".")}else r.push(Bt.DOLLAR),s.push(o),o=t.charAt(n++);else r.push(Bt.EQUALS),s.push(o),o=t.charAt(n++);else r.push(Bt.MINUS),s.push(o),o=t.charAt(n++);else r.push(Bt.PLUS),s.push(o),o=t.charAt(n++);else r.push(Bt.BAR),s.push(o),o=t.charAt(n++);else r.push(Bt.COMMA),s.push(o),o=t.charAt(n++);else r.push(Bt.AT),s.push(o),o=t.charAt(n++);else r.push(Bt.RIGHTBRACKET),s.push(o),o=t.charAt(n++);else r.push(Bt.LEFTBRACKET),s.push(o),o=t.charAt(n++);else r.push(Bt.RIGHTPARENTHESIS),s.push(o),o=t.charAt(n++);else r.push(Bt.LEFTPARENTHESIS),s.push(o),o=t.charAt(n++)}return r.push(1),s.push("[EOF]"),[r,s]}parse(e){const t=this.tokenize(e),r=t[0],s=t[1];let n=0;const o=[],i=[],a=[];let u,l,c;for(o.push(0),i.push(1),a.push("_S"),l=r[n],c=s[n++];;)switch(u=o[o.length-1],Bt.actionTable[u].charAt(l-1)){case Bt.SHIFT:i.push(-l),a.push(c),o.push(Bt.actionTableNumber[u].charCodeAt(l-1)-32),l=r[n],c=s[n++];break;case Bt.REDUCE:const e=Bt.productions[Bt.actionTableNumber[u].charCodeAt(l-1)-32][1],t=[];for(let r=0;r<e;r++)i.pop(),t.unshift(a.pop()),o.pop();const h=o[o.length-1];i.push(Bt.productions[Bt.actionTableNumber[u].charCodeAt(l-1)-32][0]),void 0===this.reduceActions[Bt.actionTableNumber[u].charCodeAt(l-1)-32]?a.push(t[0]):a.push(this.reduceActions[Bt.actionTableNumber[u].charCodeAt(l-1)-32](t)),o.push(Bt.gotoTable[h].charCodeAt(Bt.productions[Bt.actionTableNumber[u].charCodeAt(l-1)-32][0]-2)-33);break;case Bt.ACCEPT:const p=a.pop();if(!(p instanceof Vt.Expression))throw new Error("XPath parse error. Wrong result type.");return new Mt.XPath(p);default:throw new Error("XPath parse error")}throw new Error("XPath parse error")}}Bt.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],Bt.actionTableNumber=[" 1 0 /.-,+*)(' & %$ # \"!"," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY "," 1 0 /.-,+*)(' & %$ # \"!","K1 KKKKKKKK . +*)('KKKKKK KK# K\" "," 1 0 /.-,+*)(' & %$ # \"!"," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q "," 1 . +*)(' # \" ","b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX "," 1 0 /.-,+*)(' & %$m # \"!","_ f________ ______e __ _ "," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 . +*)(' # \" "," 1 . +*)(' # \" ","> >>>>>>>>> >>>>>>> >> >> "," 1 . +*)(' # \" "," 1 . +*)(' # \" ","Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," "," F ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE "," 1 0 /.-,+*)(' & %$ # \"!","] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],Bt.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","456789:;<=>?@ AB CDEFGH IJ"," EFGH IJ "," EFGH IJ "," "," GH IJ "," GH IJ "," i "," i "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABqCDEFGH IJ "," "," "],Bt.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],Bt.DOUBLEDOT=2,Bt.DOUBLECOLON=3,Bt.DOUBLESLASH=4,Bt.NOTEQUAL=5,Bt.LESSTHANOREQUAL=6,Bt.GREATERTHANOREQUAL=7,Bt.AND=8,Bt.OR=9,Bt.MOD=10,Bt.DIV=11,Bt.MULTIPLYOPERATOR=12,Bt.FUNCTIONNAME=13,Bt.AXISNAME=14,Bt.LITERAL=15,Bt.NUMBER=16,Bt.ASTERISKNAMETEST=17,Bt.QNAME=18,Bt.NCNAMECOLONASTERISK=19,Bt.NODETYPE=20,Bt.PROCESSINGINSTRUCTIONWITHLITERAL=21,Bt.EQUALS=22,Bt.LESSTHAN=23,Bt.GREATERTHAN=24,Bt.PLUS=25,Bt.MINUS=26,Bt.BAR=27,Bt.SLASH=28,Bt.LEFTPARENTHESIS=29,Bt.RIGHTPARENTHESIS=30,Bt.COMMA=31,Bt.AT=32,Bt.LEFTBRACKET=33,Bt.RIGHTBRACKET=34,Bt.DOT=35,Bt.DOLLAR=36,Bt.SHIFT="s",Bt.REDUCE="r",Bt.ACCEPT="a",p.XPathParser=Bt;var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});const Yt=lt,Gt=R;class qt{constructor(e,t){switch(this.ANY_TYPE=qt.ANY_TYPE,this.NUMBER_TYPE=qt.NUMBER_TYPE,this.STRING_TYPE=qt.STRING_TYPE,this.BOOLEAN_TYPE=qt.BOOLEAN_TYPE,this.UNORDERED_NODE_ITERATOR_TYPE=qt.UNORDERED_NODE_ITERATOR_TYPE,this.ORDERED_NODE_ITERATOR_TYPE=qt.ORDERED_NODE_ITERATOR_TYPE,this.UNORDERED_NODE_SNAPSHOT_TYPE=qt.UNORDERED_NODE_SNAPSHOT_TYPE,this.ORDERED_NODE_SNAPSHOT_TYPE=qt.ORDERED_NODE_SNAPSHOT_TYPE,this.ANY_UNORDERED_NODE_TYPE=qt.ANY_UNORDERED_NODE_TYPE,this.FIRST_ORDERED_NODE_TYPE=qt.FIRST_ORDERED_NODE_TYPE,t===qt.ANY_TYPE&&(e instanceof Gt.XString?t=qt.STRING_TYPE:e instanceof Gt.XNumber?t=qt.NUMBER_TYPE:e instanceof Gt.XBoolean?t=qt.BOOLEAN_TYPE:e instanceof Gt.XNodeSet&&(t=qt.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=t,t){case qt.NUMBER_TYPE:case qt.STRING_TYPE:case qt.BOOLEAN_TYPE:return this.numberValue=e.numberValue,this.stringValue=e.stringValue,void(this.booleanValue=e.booleanValue);case qt.ANY_UNORDERED_NODE_TYPE:case qt.FIRST_ORDERED_NODE_TYPE:if(e instanceof Gt.XNodeSet){const t=e.first();return this.singleNodeValue=t,this.numberValue=e.numberValue,this.stringValue=e.stringValue,this.booleanValue=e.booleanValue,void(this.nodes=null!=t?[t]:[])}break;case qt.UNORDERED_NODE_ITERATOR_TYPE:case qt.ORDERED_NODE_ITERATOR_TYPE:if(e instanceof Gt.XNodeSet)return this.invalidIteratorState=!1,this.nodes=e.toArray(),this.iteratorIndex=0,this.numberValue=e.numberValue,this.stringValue=e.stringValue,void(this.booleanValue=e.booleanValue);break;case qt.UNORDERED_NODE_SNAPSHOT_TYPE:case qt.ORDERED_NODE_SNAPSHOT_TYPE:if(e instanceof Gt.XNodeSet)return this.nodes=e.toArray(),this.snapshotLength=this.nodes.length,this.numberValue=e.numberValue,this.stringValue=e.stringValue,void(this.booleanValue=e.booleanValue)}throw new Yt.XPathException(Yt.XPathException.TYPE_ERR)}iterateNext(){if(this.resultType!==qt.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!==qt.ORDERED_NODE_ITERATOR_TYPE)throw new Yt.XPathException(Yt.XPathException.TYPE_ERR);return this.iteratorIndex===this.nodes.length?null:this.nodes[this.iteratorIndex++]}snapshotItem(e){if(this.resultType!==qt.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!==qt.ORDERED_NODE_SNAPSHOT_TYPE)throw new Yt.XPathException(Yt.XPathException.TYPE_ERR);return this.nodes[e]}}qt.ANY_TYPE=0,qt.NUMBER_TYPE=1,qt.STRING_TYPE=2,qt.BOOLEAN_TYPE=3,qt.UNORDERED_NODE_ITERATOR_TYPE=4,qt.ORDERED_NODE_ITERATOR_TYPE=5,qt.UNORDERED_NODE_SNAPSHOT_TYPE=6,qt.ORDERED_NODE_SNAPSHOT_TYPE=7,qt.ANY_UNORDERED_NODE_TYPE=8,qt.FIRST_ORDERED_NODE_TYPE=9,Ht.XPathResultImpl=qt;var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});const jt=N,kt=ze,Qt=S;Wt.NamespaceResolverImpl=class{getNamespace(e,t){if("xml"===e)return jt.XML_NAMESPACE_URI;if("xmlns"===e)return jt.XMLNS_NAMESPACE_URI;for(Qt.isDocument(t)?t=t.documentElement:Qt.isAttribute(t)&&(t=kt.PathExpr.getOwnerElement(t));null!=t&&Qt.isElement(t);){const r=t.attributes;for(let t=0;t<r.length;t++){const s=r.item(t),n=s.name||s.nodeName;if("xmlns"===n&&""===e||n==="xmlns:"+e)return String(s.value||s.nodeValue)}t=t.parentNode}return null}};var Jt={};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.VariableResolverImpl=class{getVariable(e,t){return null}};var $t={},Kt={};Object.defineProperty(Kt,"__esModule",{value:!0});const Zt=Wt;Kt.NodeXPathNSResolver=class{constructor(e){this.node=e,this.namespaceResolver=new Zt.NamespaceResolverImpl}lookupNamespaceURI(e){return this.namespaceResolver.getNamespace(e,void 0!==this.node?this.node:null)}};var zt={};Object.defineProperty(zt,"__esModule",{value:!0});const er=f,tr=Wt,rr=S,sr=Jt,nr=p,or=Ht,ir=R;class ar{static getOwnerDocument(e){return rr.isDocument(e)?e:e.ownerDocument}static detectHtmlDom(e){if(!e)return!1;const t=ar.getOwnerDocument(e);try{return null==t||t.implementation.hasFeature("HTML","2.0")}catch(e){return!0}}constructor(e,{vr:t=new sr.VariableResolverImpl,nr:r=new tr.NamespaceResolverImpl,fr:s=new er.FunctionResolverImpl,p:n=new nr.XPathParser}){this.xpath=n.parse(e),this.context=new ir.XPathContext(t,r,s)}evaluate(e,t,r){this.context.expressionContextNode=e,this.context.caseInsensitive=ar.detectHtmlDom(e);const s=this.xpath.evaluate(this.context);return new or.XPathResultImpl(s,t)}}zt.XPathExpressionImpl=ar;var ur={};Object.defineProperty(ur,"__esModule",{value:!0});const lr=S;ur.XPathNSResolverWrapper=class{constructor(e){lr.isNSResolver(e)?this.xpathNSResolver=e:this.xpathNSResolver=null}getNamespace(e,t){return null==this.xpathNSResolver?null:this.xpathNSResolver.lookupNamespaceURI(e)}},Object.defineProperty($t,"__esModule",{value:!0});const cr=Kt,hr=S,pr=lt,dr=zt,fr=ur;$t.XPathEvaluatorImpl=class{constructor({fr:e,vr:t,p:r}){this.functionResolver=e,this.variableResolver=t,this.parser=r}createExpression(e,t){try{return new dr.XPathExpressionImpl(e,{fr:this.functionResolver,nr:null==t?this.namespaceResolver:new fr.XPathNSResolverWrapper(t),vr:this.variableResolver,p:this.parser})}catch(e){throw new pr.XPathException(pr.XPathException.INVALID_EXPRESSION_ERR,e)}}createNSResolver(e){return new cr.NodeXPathNSResolver(e)}evaluate(e,t,r,s,n){if(s<0||s>9)throw{code:0,toString:()=>"Request type not supported"};null!=r&&(r=function(e){if(null==e)return{lookupNamespaceURI:e=>null};if(hr.isNSResolver(e))return e;{const t=e;return{lookupNamespaceURI:e=>t(e)}}}(r));return this.createExpression(e,r).evaluate(t,s,n)}};var Er={};Object.defineProperty(Er,"__esModule",{value:!0});const Nr=$t,mr=Ht,gr=new Nr.XPathEvaluatorImpl({});function Sr(e,t,r=!1){return Ar(e,t,null,r)}function Ar(e,t,r,s=!1){const n=Tr(e,t,r,mr.XPathResultImpl.ANY_TYPE,null);return n.resultType===mr.XPathResultImpl.STRING_TYPE?n.stringValue:n.resultType===mr.XPathResultImpl.NUMBER_TYPE?n.numberValue:n.resultType===mr.XPathResultImpl.BOOLEAN_TYPE?n.booleanValue:s?n.nodes[0]:n.nodes}function Tr(e,t,r,s=0,n){return gr.evaluate(e,t,r||null,s,n||null)}Er.select1=function(e,t){return Sr(e,t,!0)},Er.select=Sr,Er.useNamespaces=function(e){const t={mappings:e||{},lookupNamespaceURI(e){return void 0!==this.mappings[e]?this.mappings[e]:null}};return(e,r,s=!1)=>Ar(e,r,t,s)},Er.selectWithResolver=Ar,Er.evaluate=Tr,Er.installXPathSupport=function(e,{fr:t,vr:r,p:s}){const n=new Nr.XPathEvaluatorImpl({fr:t,vr:r,p:s});return e.createExpression=n.createExpression,e.createNSResolver=n.createNSResolver,e.evaluate=n.evaluate,e};var br={};Object.defineProperty(br,"__esModule",{value:!0});const vr=f,Rr=Wt,Or=Jt,Pr=R,wr=new p.XPathParser,_r=new Rr.NamespaceResolverImpl,xr=new vr.FunctionResolverImpl,Ir=new Or.VariableResolverImpl;function Dr(e){return{getNamespace:(t,r)=>e(t,r)||_r.getNamespace(t,r)}}function yr(e){return e&&"function"==typeof e.getNamespace?Dr((t=e).getNamespace.bind(t)):"function"==typeof e?Dr(e):"object"==typeof e?(r=e,Dr((e=>r[e]))):_r;var t,r}function Cr(e){if(null==e)return null;if(e instanceof Pr.XString||e instanceof Pr.XBoolean||e instanceof Pr.XNumber||e instanceof Pr.XNodeSet)return e;switch(typeof e){case"string":return new Pr.XString(e);case"boolean":return new Pr.XBoolean(e);case"number":return new Pr.XNumber(e)}const t=new Pr.XNodeSet;return t.addArray([].concat(e)),t}function Lr(e){return{getFunction(t,r){const s=e(t,r);return null!=s?function(e){return(t,...r)=>(r=r.map((e=>e.evaluate(t))),Cr(e(t,...r)))}(s):xr.getFunction(t,r)}}}function Xr(e){return e&&"function"==typeof e.getFunction?Lr((t=e).getFunction.bind(t)):"function"==typeof e?Lr(e):"object"==typeof e?(r=e,Lr((e=>r[e]))):xr;var t,r}function Fr(e){return{getVariable:(t,r)=>Cr(e(t,r))}}function Mr(e){if(e){if("function"==typeof e.getVariable)return Fr(e.getVariable.bind(e));if("function"==typeof e)return Fr(e);if("object"==typeof e)return Fr((t=>e[t]))}return Ir}function Ur(e,t,r){e in r&&(t[e]=r[e])}function Vr(e,t){const r=function(e){const t=new Pr.XPathContext(new Or.VariableResolverImpl,new Rr.NamespaceResolverImpl,new vr.FunctionResolverImpl);return void 0!==e?(t.namespaceResolver=yr(e.namespaces),t.functionResolver=Xr(e.functions),t.variableResolver=Mr(e.variables),t.expressionContextNode=e.node,Ur("allowAnyNamespaceForNoPrefix",t,e),Ur("isHtml",t,e)):t.namespaceResolver=_r,t}(t);return e.evaluate(r)}br.makeNSResolver=yr,br.convertValue=Cr,br.makeFunctionResolver=Xr,br.makeVariableResolver=Mr,br.parse=function(e){const t=wr.parse(e);return new class{constructor(){this.expression=t}evaluate(e){return Vr(this.expression,e)}evaluateNumber(e){return this.evaluate(e).numberValue}evaluateString(e){return this.evaluate(e).stringValue}evaluateBoolean(e){return this.evaluate(e).booleanValue}evaluateNodeSet(e){return this.evaluate(e).nodeset}select(e){return this.evaluateNodeSet(e).toArray()}select1(e){return this.select(e)[0]}}},Object.defineProperty(c,"__esModule",{value:!0});var Br=h;c.XPath=Br.XPath;var Hr=p;c.XPathParser=Hr.XPathParser;var Yr=Ht,Gr=c.XPathResult=Yr.XPathResultImpl,qr=et;c.Step=qr.Step;var Wr=$;c.NodeTest=Wr.NodeTest;var jr=ue;c.BarOperation=jr.BarOperation;var kr=Wt;c.NamespaceResolver=kr.NamespaceResolverImpl;var Qr=f;c.FunctionResolver=Qr.FunctionResolverImpl;var Jr=Jt;c.VariableResolver=Jr.VariableResolverImpl;var $r=$t;c.XPathEvaluator=$r.XPathEvaluatorImpl;var Kr=R;c.Expression=Kr.Expression,c.XNodeSet=Kr.XNodeSet,c.XBoolean=Kr.XBoolean,c.XString=Kr.XString,c.XNumber=Kr.XNumber,c.XPathContext=Kr.XPathContext;var Zr=Er;c.evaluate=Zr.evaluate,c.select=Zr.select,c.useNamespaces=Zr.useNamespaces,c.selectWithResolver=Zr.selectWithResolver,c.select1=Zr.select1,c.installXPathSupport=Zr.installXPathSupport;var zr=br;c.convertValue=zr.convertValue,c.makeFunctionResolver=zr.makeFunctionResolver,c.makeNSResolver=zr.makeNSResolver,c.makeVariableResolver=zr.makeVariableResolver,c.parse=zr.parse;const es=async(t,{selectors:r})=>((e,t)=>{const r={};for(const[s,n]of Object.entries(t)){const t=c.evaluate(n.selector,e,null,Gr.ANY_TYPE,null),o=[];let i=t.iterateNext();for(;i;)o.push(i.textContent||""),i=t.iterateNext();r[s]=1===o.length?o[0]:o}return r})(new e(t,{contentType:"text/xml"}).window.document,r),ts=async(e,{selectors:t})=>{const r=await o(e);return await es(r,{selectors:t})},rs={html:a,json:l,xml:ts},ss=async({url:e,engine:t,options:r})=>await rs[t](e,r);export{ss as parse,a as parseHtml,l as parseJson,ts as parseXml}; //# sourceMappingURL=bundle.esm.js.map |