openrosa-xpath-evaluator
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("node-forge")):"function"==typeof define&&define.amd?define("orxe",["node-forge"],e):"object"==typeof exports?exports.orxe=e(require("node-forge")):t.orxe=e(t["node-forge"])}(window,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";t.exports={DATE_STRING:/^\d\d\d\d-\d{1,2}-\d{1,2}(?:T\d\d:\d\d:\d\d\.?\d?\d?(?:Z|[+-]\d\d:\d\d)|.*)?$/,dateToDays:function(t,e){var n=null;t.indexOf("T")>0?n=new Date(t):(n=t.split("-"),n=new Date(n[0],n[1]-1,n[2]));var r=n.getTime()/864e5;return!1===e?r:Math.round(1e5*r)/1e5}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";t.exports={allowStringComparison:!1,includeTimeForTodayString:!1,returnCurrentTimeForToday:!1}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";t.exports={getNamespaceAtts:function(t){for(var e,n=[];e=t.iterateNext();)e.name.indexOf(":")>0&&n.unshift(e);return n},toNodes:function(t){for(var e,n=[];e=t.iterateNext();)n.push(e);return n},toSnapshotResult:function(t,e,n){return r=0,{resultType:e,singleNodeValue:t.length?n||t[0]:null,snapshotLength:t.length,snapshotItem:function(e){return t[e]},iterateNext:function(){return t.length>r?t[r++]:null}};var r}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports={nodes:function(t){return{t:"nodes",v:t}},boolean:function(t){return{t:"bool",v:t}},number:function(t){return{t:"num",v:t}},string:function(t){return{t:"str",v:t}},date:function(t){if(!(t instanceof Date))throw new Error("Cannot create date from "+t+" ("+e(t)+")");return{t:"date",v:t}}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";t.exports=n(5)})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";n(6);var e=n(7),r=n(13),o=n(1),a=r(o);t.exports=function(){var t={extendedXPathEvaluator:e,openrosaXPathExtensions:r,config:o,customXPathFunction:a.customXPathFunction,getCurrentDomLevel3XPathBindings:function(){return{window:{XPathException:window.XPathException,XPathExpression:window.XPathExpression,XPathNSResolver:window.XPathNSResolver,XPathResult:window.XPathResult,XPathNamespace:window.XPathNamespace},document:{createExpression:document.createExpression,createNSResolver:document.createNSResolver,evaluate:document.evaluate}}},createDomLevel3XPathBindings:function(t){var n=new XPathEvaluator(t);return{document:{evaluate:function(t,r,o,i,u){var s=function(t,e,a){(i<7||t.startsWith("//"))&&(i=null);var s=a||i||XPathResult.ANY_TYPE;return n.evaluate(t,e||r,o,s||XPathResult.ANY_TYPE,u)},l=new e(s,a);return l.evaluate.apply(l,arguments)}}}},bindDomLevel3XPath:function(e,n){var r,o=n||t.createDomLevel3XPathBindings(),a=t.getCurrentDomLevel3XPathBindings();for(r in e=e||document,o.document)e[r]=o.document[r];return a}};return t}()})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";Date.prototype.toISOLocalString=function(){if("Invalid Date"===this.toString())return this.toString();var t=new Date(this.getTime()-60*this.getTimezoneOffset()*1e3).toISOString().replace("Z",this.getTimezoneOffsetAsTime());return t.indexOf("T00:00:00.000")>0?t.split("T")[0]:t},Date.prototype.getTimezoneOffsetAsTime=function(){var t,e=function(t){return t<10?"0"+t:t};return"Invalid Date"===this.toString()?this.toString():((t=this.getTimezoneOffset())<0?"+":"-")+e(Math.floor(Math.abs(t/60)))+":"+e(Math.floor(Math.abs(t%60)))}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(1),r=n(8),o=n(9),a=o.isNamespaceExpr,i=o.handleNamespaceExpr,u=n(10).handleOperation,s=n(11),l=s.isNativeFunction,v=s.preprocessNativeArgs,f=n(0),c=f.DATE_STRING,h=f.dateToDays,g=n(2),d=g.toNodes,p=g.toSnapshotResult,m=n(12),b=m.inputArgs,N=m.preprocessInput,x=n(3),w=[["|"],["&"],["=","!="],["<","<=",">=",">"],["+","-"],["*","/","%"]],y=/[0-9]/,T=/^[a-z]/,E=/(>|<)/,P=/(=)/,R=/(true\(\)|false\(\))/,M=/(=|<|>)/,S=new Error("invalid args"),O=new Error("too many args"),I=new Error("too few args");t.exports=function(t,n){var o=n.func||{},s=n.process||{},f=function(t){var e,n;if(t.resultType===XPathResult.NUMBER_TYPE)return{t:"num",v:t.numberValue};if(t.resultType===XPathResult.BOOLEAN_TYPE)return{t:"bool",v:t.booleanValue};if(t.resultType===XPathResult.UNORDERED_NODE_ITERATOR_TYPE){for(n=[];e=t.iterateNext();)n.push(e.textContent);return{t:"arr",v:n}}return{t:"str",v:t.stringValue}},g=function(t,e,n){if(o.hasOwnProperty(t))return n&&/^(date|now$|today$|randomize$)/.test(t)&&e.push(n),/^(true$|false$)/.test(t)&&e.push(n||XPathResult.BOOLEAN_TYPE),m(t,e);if("normalize-space"===t&&e.length){var r=e[0].v;return{t:"str",v:r=(r=(r=(r=(r=(r=(r=r.replace(/\f/g,"\\f")).replace(/\r\v/g,"\v")).replace(/\v/g,"\\v")).replace(/\s+/g," ")).replace(/^\s+|\s+$/g,"")).replace(/\\v/g,"\v")).replace(/\\f/g,"\f")}}return"string"===t&&e.length>0&&(e[0].v===Number.POSITIVE_INFINITY||e[0].v===Number.NEGATIVE_INFINITY||e[0].v!=e[0].v)?{t:"str",v:e[0].v}:_(t,v(t,e))},m=function(t,e){var n,r=[];for(n=0;n<e.length;++n)r.push(e[n]);return o[t].apply(null,r)},_=function(e,n){var r,o,a,i="";for(a=0;a<n.length;++a)"num"!==(r=n[a]).t&&"bool"!==r.t&&(i+=o=-1===r.v.indexOf('"')?'"':"'"),i+=r.v,"bool"===r.t&&(i+="()"),"num"!==r.t&&"bool"!==r.t&&(i+=o),a<n.length-1&&(i+=", ");return f(t(e+"("+i+")"))},D=function(t){if(s.typefor){var e=s.typefor(t);if(e)return e}return"boolean"==typeof t?"bool":"number"==typeof t?"num":"str"};this.evaluate=function(n,o,v,m){if(n=N(n,m),a(n))return i(n,o);if(l(n)){var x=b(n);if(x.length&&x[0].length&&!isNaN(x[0]))throw S;if("lang()"===n)throw I;/^lang\(/.test(n)&&2===o.nodeType&&(o=o.ownerElement);var _=t(n,o);if(m===XPathResult.NUMBER_TYPE&&(_.resultType===XPathResult.UNORDERED_NODE_ITERATOR_TYPE||_.resultType===XPathResult.UNORDERED_NODE_ITERATOR_TYPE)){var X=parseInt(_.iterateNext().textContent);return{resultType:XPathResult.NUMBER_TYPE,numberValue:X,stringValue:X}}return _}if(m>3&&!n.startsWith("randomize")||/^count\(|boolean\(/.test(n)){if(n.startsWith("count(")){if(n.indexOf(",")>0)throw O;if("count()"===n)throw I;if(!isNaN(/\((.*)\)/.exec(n)[1]))throw S}if(n.startsWith("boolean(")){if("boolean()"===n)throw I;if(n.substring(8,n.indexOf(")")).split(",").length>1)throw O}return"/"===n&&(o=o.ownerDocument||o),t(n,o)}m===XPathResult.BOOLEAN_TYPE&&n.indexOf("(")<0&&n.indexOf("/")<0&&n.indexOf("=")<0&&n.indexOf("!=")<0&&(n="boolean-from-string("+(n=(n=(n=n.replace(/(\n|\r|\t)/g,"")).replace(/"(\d)"/g,"$1")).replace(/'(\d)'/g,"$1"))+")"),m===XPathResult.NUMBER_TYPE&&n.indexOf("string-length")<0&&(n=n.replace(/(\n|\r|\t)/g,""));var k,Y,A,B=[{t:"root",tokens:[]}],$=function(){return B[B.length-1]},V=function(t){throw new Error((t||"")+" [stack="+JSON.stringify(B)+"] [cur="+JSON.stringify(Y)+"]")},F=function(){Y={t:"?",v:""}},L=function(t){$().tokens.push({t:"op",v:t}),F()},U=function(t,n){var r=function(t,n,r){if(s.handleInfix){var o=s.handleInfix(V,t,n,r);if(o&&"continue"===o.t&&(t=o.lhs,n=o.op,r=o.rhs,o=null),null!=o)return o}return u(t,n,r,e)}(t[n-1],t[n],t[n+1]);null!=r&&(t.splice(n,2),t[n-1]={t:D(r),v:r})},C=function(){var t,e,n,r;for(r=$().tokens,e=w.length-1;e>=0;--e)for(n=w[e],t=1;t<r.length-1;)"op"===r[t].t&&-1!==n.indexOf(r[t].v)?U(r,t):++t},j=function(){var e,n=Y.v;e=["position"].includes($().v)?t(n):m>3||Y.v.indexOf("position()=")>=0&&1===B.length&&!/^[a-z]*[(|[]{1}/.test(Y.v)?d(t(n)):n.startsWith("$")?n:f(t(n,o)),$().tokens.push(e),F()},G=function(){return n.charAt(k+1)},z=function(){Y.v=parseFloat(Y.string),$().tokens.push(Y),F()},q=function(t){return t>="0"&&t<="9"};for(F(),k=0;k<n.length;++k){var W=n.charAt(k);if(Y.sq)Y.v+=W,"]"===W?--Y.sq:"["===W&&++Y.sq;else if("str"!==Y.t){if("num"===Y.t){if(y.test(W)||["e",'"',"'"].includes(W)||"-"===W&&"e"===n[k-1]){Y.string+=W;continue}if(" "===W&&"-"===Y.string)continue;"."!==W||Y.decimal?z():(Y.decimal=1,Y.string+=W)}if(q(W))""===Y.v?Y={t:"num",string:W}:Y.v+=W;else switch(W){case"'":case'"':""===Y.v?Y={t:"str",quote:W,v:""}:V("Not sure how to handle: "+W);break;case"(":Y.t="fn",Y.tokens=[],B.push(Y),"once"===Y.v&&(F(),Y.v=".",j()),F();break;case")":if("["===G()){var H=B.pop();H.v=H.v+"("+Y.v+W,H.t="?",Y=H;break}if(""!==Y.v&&j(),C(),"fn"!==(Y=B.pop()).t&&V(),Y.v){var Z=m;m===XPathResult.BOOLEAN_TYPE&&(E.test(n)&&!R.test(n)&&(Z=XPathResult.NUMBER_TYPE),P.test(n)&&(Z=XPathResult.BOOLEAN_TYPE),M.test(n)&&"fn"===Y.t&&/^(date|date-time)$/.test(Y.v)&&(Z=XPathResult.STRING_TYPE));var J=g(Y.v,Y.tokens,Z);"node"===Y.v&&"arr"===J.t&&J.v.length>0&&(J.v=[J.v[0]]),$().tokens.push(J)}else 1!==Y.tokens.length&&V(),$().tokens.push(Y.tokens[0]);F();break;case",":""!==Y.v&&j(),"fn"!==$().t&&V();break;case"*":"*"!==W||""===Y.v&&0!==$().tokens.length?""!==Y.v||![")",""].includes(G())&&")"!==n.substring(k+1).trim()?L(W):(Y.v=W,j()):(Y.v+=W,"./*"===Y.v&&j());break;case"-":var K=(A=void 0,(A=$().tokens)[A.length-1]);if(""!==Y.v&&" "!==G()&&" "!==n.charAt(k-1))Y.v+=W;else if(0===$().tokens.length&&""===Y.v||K&&"op"===K.t||K&&"num"===K.t&&B.length>1&&"fn"===B[1].t||K&&"num"!==K.t&&q(G()))Y={t:"num",string:"-"};else{if(""!==Y.v){if(!y.test(Y.v)&&" "!==n[k-1])throw S;$().tokens.push(Y)}L(W)}break;case"=":if("<"===Y.v||"<"===Y.v||">"===Y.v||">"===Y.v||"!"===Y.v)switch(Y.v+=W,Y.v){case"<=":case"<=":L("<=");break;case">=":case">=":L(">=");break;case"!=":L("!=")}else Y.v&&j(),L(W);break;case";":switch(Y.v){case"<":Y.v="",W="<";break;case">":Y.v="",W=">";break;default:Y.v+=W;continue}case">":case"<":if(Y.v&&j(),"="===G()){Y.v=W;break}case"+":L(W);break;case" ":switch(Y.v){case"":break;case"mod":L("%");break;case"div":L("/");break;case"and":L("&");break;case"or":L("|");break;default:var Q=Y.v.toLowerCase();if(/^(mod|div|and|or)$/.test(Q))throw S;T.test(Y.v)||j()}break;case"[":Y.sq=(Y.sq||0)+1;case".":if(""===Y.v&&")"===G()){Y.v=W,j();break}if(""===Y.v&&q(G())){Y={t:"num",string:W};break}default:Y.v+=W}}else W===Y.quote?($().tokens.push(Y),F()):Y.v+=W}return"num"===Y.t&&z(),"?"===Y.t&&""!==Y.v&&j(),("?"!==Y.t||""!==Y.v||Y.tokens&&Y.tokens.length)&&V("Current item not evaluated!"),B.length>1&&V("Stuff left on stack."),"root"!==B[0].t&&V("Weird stuff on stack."),0===B[0].tokens.length&&V("No tokens."),B[0].tokens.length>=3&&C(),B[0].tokens.length>1&&V("Too many tokens."),function(t,e){if(s.toExternalResult){var n=s.toExternalResult(t);if(n)return n}if(t.v&&"function"==typeof t.v.then&&e===XPathResult.STRING_TYPE)return{resultType:XPathResult.STRING_TYPE,stringValue:t.v};if("arr"===t.t&&e===XPathResult.NUMBER_TYPE&&c.test(t.v[0])||"str"===t.t&&e===XPathResult.NUMBER_TYPE&&c.test(t.v)){var o="arr"===t.t?t.v[0]:t.v,a=h(o);return{resultType:XPathResult.NUMBER_TYPE,numberValue:a,stringValue:a}}if("num"===t.t)return{resultType:XPathResult.NUMBER_TYPE,numberValue:t.v,stringValue:t.v.toString()};if("bool"===t.t)return{resultType:XPathResult.BOOLEAN_TYPE,booleanValue:t.v,stringValue:t.v.toString()};if(e>3)return t=r(t[0],t[1]),p(t,XPathResult.UNORDERED_SNAPSHOT_TYPE);if(!t.t&&Array.isArray(t)){if(e===XPathResult.NUMBER_TYPE){var i=parseInt(t[0].textContent);return{resultType:XPathResult.NUMBER_TYPE,numberValue:i,stringValue:i.toString()}}if(e===XPathResult.STRING_TYPE)return{resultType:XPathResult.STRING_TYPE,stringValue:t.length?t[0]:""}}return{resultType:XPathResult.STRING_TYPE,stringValue:null===t.v?"":t.v.toString()}}(B[0].tokens[0],m)},this.customXPathFunction={type:{StringType:x.string,NumberType:x.number,BooleanType:x.boolean,DateType:x.date},add:function(t,e){o[t]=e},remove:function(t){delete o[t]},all:function(){return o}}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=2147483647;function n(t){this._seed=t%e,this._seed<=0&&(this._seed+=e-1)}n.prototype.next=function(){return this._seed=16807*this._seed%e,this._seed},n.prototype.nextFloat=function(){return(this.next()-1)/(e-1)},t.exports=function(t,e){var r,o=[];if(void 0!==e){if(!Number.isInteger(e))throw new Error("Invalid seed argument. Integer required.");var a=new n(e);r=a.nextFloat.bind(a)}else r=Math.random;for(var i=0;i<t.length;++i){var u=Math.floor(r()*(i+1));u!==i&&(o[i]=o[u]),o[u]=t[i]}return o}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(2).toSnapshotResult;t.exports={isNamespaceExpr:function(t){return/^(namespace::node\(\)|namespace::\*)$/.test(t)||/^namespace::/.test(t)},handleNamespaceExpr:function(t,n){return/^(namespace::node\(\)|namespace::\*)$/.test(t)?function(t){for(var n=[],r={},o=[],a=t;a;){if(a.attributes)for(var i=0;i<a.attributes.length;i++){var u=a.attributes[i],s=u.ownerElement.getAttributeNode(u.name);if(s.nodeName.startsWith("xmlns")&&!r[s.nodeName]){var l=s.nodeName.split(":");r[s.nodeName]=s.nodeName,s.nodeValue.length&&(o.push(s),n.push({nodeName:"#namespace",localName:l.length>1?l[1]:"",namespaceURI:s.nodeValue}))}}a=1===t.nodeType?a.parentNode:null}return n.length>0&&!r.xmlns&&n.push({nodeName:"#namespace",localName:"xmlns",namespaceURI:"http://www.w3.org/1999/xhtml"}),n.length>0&&!r.xml&&n.push({nodeName:"#namespace",localName:"xml",namespaceURI:"http://www.w3.org/XML/1998/namespace"}),n=n.sort(function(t,e){return t.localName<e.localName?-1:t.localName>e.localName?1:0}),e(n,7,o[0])}(n):/^namespace::/.test(t)?function(t,n){var r=t.substring(11),o=[],a=[];if(n.attributes)for(var i=0;i<n.attributes.length;i++){var u=n.attributes[i],s=u.ownerElement.getAttributeNode(u.name);s.nodeName==="xmlns:"+r&&(a.push(s),o.push({nodeName:"#namespace",localName:r,namespaceURI:s.nodeValue}))}return e(o)}(t,n):void 0}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(0).dateToDays;function r(t){if("string"==typeof t){var e=t.replace(/["']/g,"");return e.trim().length&&!isNaN(e.trim())}return"number"==typeof t}t.exports={handleOperation:function(t,n,o,a){if("+"===n.v&&r(t.v)&&r(o.v)&&(t.v=Number(t.v),o.v=Number(o.v)),"arr"===t.t&&1===t.v.length&&"num"===o.t&&/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(t.v[0])&&(t={t:"num",v:e(t.v[0],!1)}),"arr"===o.t&&1===o.v.length&&"num"===t.t&&/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(o.v[0])&&(o={t:"num",v:e(o.v[0],!1)}),"arr"===t.t&&1===t.v.length&&"str"===o.t&&(t={t:"str",v:t.v[0]}),"arr"===o.t&&1===o.v.length&&"str"===t.t&&(o={t:"str",v:o.v[0]}),"arr"===o.t&&1===o.v.length&&"arr"===t.t&&1===t.v.length&&(t={t:"str",v:t.v[0]},o={t:"str",v:o.v[0]}),"str"===t.t&&/^\d\d\d\d-\d{1,2}-\d{1,2}/.test(t.v)&&(t={t:"num",v:e(t.v,!1)}),"str"===o.t&&/^\d\d\d\d-\d{1,2}-\d{1,2}/.test(o.v)&&(o={t:"num",v:e(o.v,!1)}),"-"===n.v&&(isNaN(t.v)||isNaN(o.v)))return NaN;switch(/^(=|!=)$/.test(n.v)&&("str"===t.t&&"bool"===o.t&&(t=t.v.length>0&&"1"===t.v?{t:"bool",v:!0}:""===t.v?{t:"bool",v:!1}:{t:"bool",v:void 0}),"str"===o.t&&"bool"===t.t&&(o=o.v.length>0&&"1"===o.v?{t:"bool",v:!0}:""===o.v?{t:"bool",v:!1}:{t:"bool",v:void 0}),"num"===t.t&&"bool"===o.t&&(t={t:"bool",v:Boolean(t.v)}),"num"===o.t&&"bool"===t.t&&(o={t:"bool",v:Boolean(o.v)})),n.v){case"+":return t.v+o.v;case"-":return t.v-o.v;case"*":return t.v*o.v;case"/":return t.v/o.v;case"%":return t.v%o.v;case"=":return/^(num|str)$/.test(t.t)&&"arr"===o.t?o.v.includes(t.string||t.v):/^(num|str)$/.test(o.t)&&"arr"===t.t?t.v.includes(o.string||o.v):"bool"===t.t&&"arr"===o.t?t.v===o.v.length>0:"bool"===o.t&&"arr"===t.t?o.v===t.v.length>0:t.v==o.v;case"<":if("bool"===t.t)return!1===t.v&&"arr"===o.t&&o.v.length>0||(!0===t.v&&"num"===o.t?1<o.v:!1===t.v&&"num"===o.t?0<o.v:!1===t.v&&"bool"===o.t&&!0===o.v);if("bool"===o.t)return!0===o.v&&"arr"===t.t&&0===t.v.length||!0===o.v&&"num"===t.t&&t.v<1;if("arr"===t.t&&t.v.length>0){for(var i=0;i<t.v.length;i++)if(Number(t.v[i])<o.v)return!0;return!1}if("arr"===o.t&&o.v.length>0){for(var u=0;u<o.v.length;u++)if(t.v<Number(o.v[u]))return!0;return!1}return"arr"===t.t&&0===t.v.length&&(t={t:"num",string:"0",v:0}),"arr"===o.t&&0===o.v.length&&(o={t:"num",string:"0",v:0}),"str"===t.t&&"str"===o.t&&a.allowStringComparison?t.v<o.v:!(!r(t.v)||!r(o.v))&&t.v<o.v;case">":if("bool"===t.t)return!0===t.v&&"arr"===o.t&&0===o.v.length||(!0===t.v&&"num"===o.t?1>o.v:!0===t.v&&"bool"===o.t&&1>(!0===o.v?1:0));if("bool"===o.t)return!1===o.v&&"arr"===t.t&&t.v.length>0||(!1===o.v&&"num"===t.t?t.v>0:!0===o.v&&"num"===t.t?t.v>1:"num"===t.t&&(t.v>o.v==1?1:0));if("arr"===t.t&&t.v.length>0){for(var s=0;s<t.v.length;s++)if(Number(t.v[s])>o.v)return!0;return!1}if("arr"===o.t&&o.v.length>0){for(var l=0;l<o.v.length;l++)if(t.v>Number(o.v[l]))return!0;return!1}return"arr"===t.t&&0===t.v.length&&(t={t:"num",string:"0",v:0}),"bool"===t.t&&!0===t.v&&(t={t:"num",string:"1",v:1}),"bool"===t.t&&!1===t.v&&(t={t:"num",string:"0",v:0}),"arr"===o.t&&0===o.v.length&&(o={t:"num",string:"0",v:0}),"bool"===o.t&&!0===o.v&&(o={t:"num",string:"1",v:1}),"bool"===o.t&&!1===o.v&&(o={t:"num",string:"0",v:0}),"str"===t.t&&"str"===o.t&&a.allowStringComparison?t.v>o.v:!(!r(t.v)||!r(o.v))&&t.v>o.v;case"<=":if("arr"===o.t&&0===o.v.length&&t.string&&t.string.length>0)return!1;if("arr"===t.t&&0===t.v.length&&o.string&&o.string.length>0)return!1;if("bool"===o.t&&!1===o.v&&"arr"===t.t&&t.v.length>0)return!1;if("bool"===t.t&&(t={t:"num",v:!0===t.v?1:0,string:!0===t.v?"1":"0"}),"bool"===o.t&&(o={t:"num",v:!0===o.v?1:0,string:!0===t.v?"1":"0"}),"arr"===t.t&&t.v.length>0){for(var v=0;v<t.v.length;v++)if(Number(t.v[v])<=o.v)return!0;return!1}if("arr"===o.t&&o.v.length>0){for(var f=0;f<o.v.length;f++)if(t.v<=Number(o.v[f]))return!0;return!1}return"arr"===o.t&&0===o.v.length&&(o={t:"num",string:"0",v:0}),"arr"===t.t&&0===t.v.length&&(t={t:"num",string:"0",v:0}),"bool"===t.t&&!0===t.v&&(t={t:"num",string:"1",v:1}),"bool"===t.t&&!1===t.v&&(t={t:"num",string:"0",v:0}),"bool"===o.t&&!0===o.v&&(o={t:"num",string:"1",v:1}),"bool"===o.t&&!1===o.v&&(o={t:"num",string:"0",v:0}),"str"===t.t&&"str"===o.t&&a.allowStringComparison?t.v<=o.v:!(!r(t.v)||!r(o.v))&&t.v<=o.v;case">=":if("arr"===o.t&&0===o.v.length&&t.string&&t.string.length>0)return!1;if("arr"===o.t&&o.v.length>0&&!1===t.v)return!1;if("arr"===t.t&&0===t.v.length)return("str"!==o.t||""!==o.v)&&("str"===o.t?o.v.length>=0:o.v.length>=0||!1===o.v);if("bool"===t.t&&(t={t:"num",v:!0===t.v?1:0,string:!0===t.v?"1":"0"}),"bool"===o.t&&(o={t:"num",v:!0===o.v?1:0,string:!0===t.v?"1":"0"}),"arr"===t.t&&t.v.length>0){for(var c=0;c<t.v.length;c++)if(Number(t.v[c])>=o.v)return!0;return!1}if("arr"===o.t&&o.v.length>0){for(var h=0;h<o.v.length;h++)if(t.v>=Number(o.v[h]))return!0;return!1}return"arr"===t.t&&0===t.v.length&&(t={t:"num",string:"0",v:0}),"bool"===t.t&&!0===t.v&&(t={t:"num",string:"1",v:1}),"bool"===t.t&&!1===t.v&&(t={t:"num",string:"0",v:0}),"arr"===o.t&&0===o.v.length&&(o={t:"num",string:"0",v:0}),"bool"===o.t&&!0===o.v&&(o={t:"num",string:"1",v:1}),"bool"===o.t&&!1===o.v&&(o={t:"num",string:"0",v:0}),"str"===t.t&&"str"===o.t&&a.allowStringComparison?t.v>=o.v:!(!r(t.v)||!r(o.v))&&t.v>=o.v;case"!=":return"bool"===t.t&&"arr"===o.t?t.v===o.v.length<1:"bool"===o.t&&"arr"===t.t?o.v===t.v.length<1:t.v!=o.v;case"&":return Boolean(t.v&&o.v);case"|":return Boolean(t.v||o.v)}}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(0),r=e.DATE_STRING,o=e.dateToDays,a=new Error("too many args"),i=new Error("too few args"),u=new Error("invalid args"),s=/^id\(|^\([a-zA-Z]|lang\(|local-name|namespace-uri|last\(|name\(|child::|parent::|descendant::|descendant-or-self::|ancestor::|ancestor-or-self::sibling|following::|following-sibling::|preceding-sibling::|preceding::|attribute::/;function l(t,e,n){if(null!=e&&t.length<e)throw i;if(null!=n&&t.length>n)throw a}t.exports={isNativeFunction:function(t){return s.test(t)},preprocessNativeArgs:function(t,e){if("number"===t&&e.length&&("arr"===e[0].t?e=[{t:"num",v:e[0].v[0]}]:"str"===e[0].t&&r.test(e[0].v)?e=[{t:"num",v:o(e[0].v)}]:"num"===e[0].t&&e[0].v.toString().indexOf("e-")>0&&(e=[{t:"num",v:0}])),"name"===t&&e.length<2)throw i;if("namespace-uri"===t){if(e.length>1)throw a;if(0===e.length)throw i;if(1===e.length&&!isNaN(e[0].v))throw u}if("local-name"===t){if(e.length>1)throw a;if(1===e.length&&!isNaN(e[0].v))throw u}return"substring"===t&&e.length>2&&e[1].v===Number.NEGATIVE_INFINITY&&e[2].v===Number.POSITIVE_INFINITY&&(e[0].v=""),"substring"===t&&e.length>1&&e[1].v<0&&(e[1].v=0),"substring"===t&&e.length>2&&e[2].v===Number.POSITIVE_INFINITY&&(e[2].v=e[0].v.length+1),function(t,e){"last"===t?l(e,null,0):/^(boolean|lang|ceiling|name|floor)$/.test(t)?l(e,1,1):/^(number|string|normalize-space|string-length)$/.test(t)?l(e,null,1):"substring"===t?l(e,2,3):/^(starts-with|contains|substring-before|substring-after)$/.test(t)?l(e,2,2):"translate"===t&&l(e,3,3)}(t,e),e}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=/\(\s*([^)]*)\)$/;t.exports={inputArgs:function(t){var n=t.match(e);return n?n[1].split(","):[]},preprocessInput:function(t,e){return function(t,e){return e===XPathResult.NUMBER_TYPE&&t.indexOf("(")<0&&!t.startsWith("/")}(t,e)&&((t=t.replace("\n","")).indexOf("mod")>0&&(t=t.replace("mod"," mod ")),t.indexOf("div")>0&&(t=t.replace("div"," div "))),"string(namespace::node())"===t&&(t=t.replace("namespace::node()","namespace-uri(/*)")),t}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(14),r=e.area,o=e.distance,a=e.areaOrDistance,i=n(15).digest,u=n(17).randomToken,s=n(3);t.exports=function(t){var e,n,l=new Error("too many args"),v=new Error("too few args"),f=/^(-?[0-9]+)(\.[0-9]+)?$/,c=/^\d\d\d\d-\d{1,2}-\d{1,2}(?:T\d\d:\d\d:\d\d\.?\d?\d?(?:Z|[+-]\d\d:\d\d)|.*)?$/,h=s,g=function(t,e){for(e=e||2,t=t.toString();t.length<e;)t="0"+t;return t},d=function(t){return Math.round(p(t))},p=function(t){return"num"===t.t?t.v:parseFloat(m(t))},m=function(t){return"arr"===t.t?t.v.length?t.v[0].toString():"":t.v.toString()},b=function(t){return t<0?-Math.round(-t):Math.round(t)},N=function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)},x=function(t,e){var n,r;if(t.v instanceof Date)return new Date(t.v);if(t=m(t),f.test(t))return(n=new Date(1970,0,1)).setDate(1+parseInt(t,10)),n;if(c.test(t))return e&&t.indexOf("T")>0?new Date(t):(-1!==(r=t.indexOf("T"))&&(t=t.substring(0,r)),n=t.split("-"),n=new Date(n[0],n[1]-1,n[2]));var o=new Date(t);return"Invalid Date"==o?null:o},w=function(t,e){return e===XPathResult.BOOLEAN_TYPE?t?h.boolean(!isNaN(new Date(t).getTime())):h.boolean(!1):e===XPathResult.NUMBER_TYPE?t?h.number(new Date(t).getTime()/864e5):h.number(0):e===XPathResult.STRING_TYPE?t?h.string(new Date(t).toISOLocalString()):h.string("Invalid Date"):t?h.date(t):h.string("Invalid Date")},y=function(t,e){return t=x(t),w(t,e)},T={},E=function(t,e){return w(T._now(e),t)};return(e={abs:function(t){return h.number(Math.abs(t.v))},acos:function(t){return h.number(Math.acos(t.v))},asin:function(t){return h.number(Math.asin(t.v))},atan:function(t){return h.number(Math.atan(t.v))},atan2:function(t){if(arguments.length>1){var e=arguments[0].v,n=arguments[1].v;return h.number(Math.atan2(e,n))}return h.number(Math.atan2(t.v))},"boolean-from-string":function(t){return t=m(t),h.boolean("1"===t||"true"===t)},area:function(t){if(0===arguments.length)throw v;return a(h.number,r,t)},checklist:function(t,e){var n,r,o=0;for(t=t.v,e=e.v,n=2;n<arguments.length;n++){var a=arguments[n];if("bool"===a.t&&Boolean(a.v))o++;else if("arr"===a.t)for(r=0;r<a.v.length;r++)a.v[r]&&o++}return h.boolean((t<0||o>=t)&&(e<0||o<=e))},coalesce:function(t,e){return h.string(m(t)||m(e))},concat:function(){for(var t=[],e=0;e<arguments.length;e++)"arr"===arguments[e].t?t.push(arguments[e].v.join("")):t.push(arguments[e].v);return h.string(t.join(""))},cos:function(t){return h.number(Math.cos(t.v))},"count-non-empty":function(t){if(0===arguments.length||"arr"!==t.t)throw v;for(var e=0,n=0;n<t.v.length;n++)e+=""===t.v[n]?0:1;return h.number(e)},"count-selected":function(t){for(var e=m(t).split(" "),n=e.length,r=0;--n>=0;)e[n].length&&++r;return h.number(r)},date:function(t,e){return t=x(t),w(t,e)},"decimal-date":function(t){if(arguments.length>1)throw l;var e=Date.parse(m(t))/864e5;return h.number(e)},"decimal-time":function(t){if(arguments.length>1)throw l;if("num"===t.t)return h.number(NaN);var e,n=t.v,r=n.match(/^(\d\d):(\d\d):(\d\d)(\.\d\d?\d?)?(\+|-)(\d\d):(\d\d)$/);if(r&&r[1]<24&&r[1]>=0&&r[2]<60&&r[2]>=0&&r[3]<60&&r[3]>=0&&r[6]<24&&r[6]>=0&&r[7]<60&&r[7]>=0){var o=function(t){return t<10?"0"+t:t},a=new Date,i=new Date(a.getFullYear()+"-"+o(a.getMonth()+1)+"-"+o(a.getDate())+"T"+n);e="Invalid Date"===i.toString()?NaN:(i.getSeconds()/3600+i.getMinutes()/60+i.getHours())/24}else e=NaN;return h.number(e)},digest:function(t,e,n){return h.string(i(t,e,n))},distance:function(t){if(0===arguments.length)throw v;return a(h.number,o,t)},exp:function(t){return h.number(Math.exp(t.v))},exp10:function(t){return h.number(Math.pow(10,t.v))},false:function(t){if(t===XPathResult.NUMBER_TYPE)return h.number(0);if(arguments.length>1)throw l;return h.boolean(!1)},"format-date":function(t,e){return h.string(function(t,e){if(t=x(t,!0),!e)return"";if(e=m(e),!t)return"Invalid Date";var n,r,o="",a={year:1900+t.getYear(),month:1+t.getMonth(),day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millis:t.getMilliseconds(),secTicks:t.getTime(),dow:1+t.getDay()},i=window?window.enketoFormLocale:void 0;for(r=0;r<e.length;++r)if("%"===(n=e.charAt(r))){if(++r>=e.length)throw new Error("date format string ends with %");if("%"===(n=e.charAt(r)))o+="%";else if("Y"===n)o+=g(a.year,4);else if("y"===n)o+=g(a.year,4).substring(2);else if("m"===n)o+=g(a.month,2);else if("n"===n)o+=a.month;else if("b"===n)o+=t.toLocaleDateString(i,{month:"short"});else if("d"===n)o+=g(a.day,2);else if("e"===n)o+=a.day;else if("H"===n)o+=g(a.hour,2);else if("h"===n)o+=a.hour;else if("M"===n)o+=g(a.minute,2);else if("S"===n)o+=g(a.second,2);else if("3"===n)o+=g(a.millis,3);else{if("a"!==n)throw"Z"===n||"A"===n||"B"===n?new Error("unsupported escape in date format string [%"+n+"]"):new Error("unrecognized escape in date format string [%"+n+"]");o+=t.toLocaleDateString(i,{weekday:"short"})}}else o+=n;return o}(t,e))},if:function(t,e,n){if("bool"===t.t)return h.string(t.v?e.v:n.v);if("arr"===t.t){var r=t.v.length&&null!==t.v[0];return h.string(r?e.v:n.v)}return h.string(n.v)},"ends-with":function(t,e){if(arguments.length>2)throw l;if(arguments.length<2)throw v;return h.boolean(t.v.endsWith(e.v))},int:function(t){return"str"===t.t&&t.v.indexOf("e-")>0?h.number(NaN):(t=m(t)).indexOf("e-")>0?h.number(0):h.number(parseInt(t,10))},join:function(){var t=arguments[0];if(arguments.length<2)return h.string("");if(arguments.length>2){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n].v);return h.string(e.join(m(t)))}return h.string(arguments[1].v.join(m(t)))},log:function(t){return h.number(Math.log(t.v))},log10:function(t){return h.number(Math.log10(t.v))},max:function(){if(arguments.length>1){for(var t=[],e=0;e<arguments.length;e++)t.push(arguments[e].v);return h.number(Math.max.apply(null,t))}var n,r,o=arguments[0].v;if(!(r=o.length))return h.number(NaN);for(n=parseFloat(o[0]);--r;)n=Math.max(n,parseFloat(o[r]));return h.number(n)},min:function(){if(arguments.length>1){for(var t=[],e=0;e<arguments.length;e++)t.push(arguments[e].v);return h.number(Math.min.apply(null,t))}var n,r,o=arguments[0].v;if(!(r=o.length))return h.number(NaN);for(n=parseFloat(o[0]);--r;)n=Math.min(n,parseFloat(o[r]));return h.number(n)},not:function(t){if(0===arguments.length)throw v;if(arguments.length>1)throw l;return h.boolean(!t.v)},now:function(t){return E(t)},today:function(e){var n=E(e,!t.returnCurrentTimeForToday);return e!==XPathResult.STRING_TYPE||t.includeTimeForTodayString||(n.v=n.v.split("T")[0]),n},once:function(t,e){return t.v.length&&t.v[0].length?h.string(t.v[0]):e.v==1/0?h.string(""):"num"===e.t&&0===e.v?h.string(""):h.string(e.v)},pi:function(){return h.number(Math.PI)},position:function(t){var e=1;if(t)for(var n=t.iterateNext(),r=n.tagName;n.previousElementSibling&&n.previousElementSibling.tagName===r;)n=n.previousElementSibling,e++;return h.number(e)},pow:function(t,e){return h.number(Math.pow(p(t),p(e)))},random:function(){return h.number(Math.random())},randomize:function(t){if(1===arguments.length)throw v;if(arguments.length>3)throw l;var e=arguments.length>2?arguments[1]:arguments[2],n=arguments[arguments.length-1];return n===XPathResult.BOOLEAN_TYPE?h.boolean(t.v.length>0):n===XPathResult.STRING_TYPE?t.v.length<1?"":h.string(t.v[0]):Array.isArray(e)&&e.length&&1===e[0].nodeType?[t,parseInt(e[0].textContent)]:[t,e&&e.v]},regex:function(t,e){return h.boolean(new RegExp(m(e)).test(m(t)))},round:function(t,e){if(0===arguments.length)throw v;if(arguments.length>2)throw l;if(t=p(t),!e)return h.number(b(t));e=d(e);var n=Math.pow(10,Math.abs(e));return e>0?h.number(b(t*n)/n):h.number(n*b(t/n))},selected:function(t,e){return h.boolean(-1!==m(t).split(" ").indexOf(m(e).trim()))},"selected-at":function(t,e){if(!e)throw new Error(JSON.stringify(t));return h.string(m(t).split(" ")[d(e)]||"")},sin:function(t){return h.number(Math.sin(t.v))},sqrt:function(t){return h.number(Math.sqrt(t.v))},substr:function(t,e,n){return h.string(m(t).slice(d(e),n&&d(n)))},sum:function(t){if(arguments.length>1)throw l;for(var e=0,n=0;n<t.v.length;n++)f.test(t.v[n])||h.number(NaN),e+=parseInt(t.v[n],10);return h.number(e)},tan:function(t){return h.number(Math.tan(t.v))},true:function(t){if(t===XPathResult.NUMBER_TYPE)return h.number(1);if(arguments.length>1)throw l;return h.boolean(!0)},uuid:function(t){return t&&t.v?h.string(u(t.v)):h.string("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,N))},"weighted-checklist":function(t,e){var n,r=[],o=[],a=0;for(t=t.v,e=e.v,n=2;n<arguments.length;n+=2){var i=arguments[n],u=arguments[n+1];i&&u&&(r.push("arr"===i.t?i.v[0]:i.v),o.push("arr"===u.t?u.v[0]:u.v))}for(n=0;n<r.length;n++)r[n]&&(a+=o[n]);return h.boolean((t<0||a>=t)&&(e<0||a<=e))}})["date-time"]=e.date,e["decimal-date-time"]=e["decimal-date"],e["format-date-time"]=e["format-date"],n={toExternalResult:function(t){if("date"===t.t)return{resultType:XPathResult.STRING_TYPE,numberValue:t.v.getTime(),stringValue:(e=t.v,e.getFullYear()+"-"+g(e.getMonth()+1)+"-"+g(e.getDate()))};var e},typefor:function(t){if(t instanceof Date)return"date"},handleInfix:function(t,e,n,r){if("date"===e.t||"date"===r.t){if("="===n.v||"<"===n.v||">"===n.v||"<="===n.v||">="===n.v||"!="===n.v){if("arr"!==e.t&&"str"!==e.t||(e=y(e)),"arr"!==r.t&&"str"!==r.t||(r=y(r)),"date"!==e.t||"date"!==r.t)return"!="===n.v;e={t:"num",v:e.v.getTime()},r={t:"num",v:r.v.getTime()}}else if("+"===n.v||"-"===n.v){"date"===e.t&&"date"===r.t&&t();var o="date"===e.t?e.v:r.v,a="date"!==e.t?d(e):d(r),i=new Date(o.getTime());return"-"===n.v&&(a=-a),i.setDate(o.getDate()+a),i}return{t:"continue",lhs:e,op:n,rhs:r}}}},T.func=e,T.process=n,T.XPR=h,T._now=function(t){var e=new Date;return t?new Date(e.getFullYear(),e.getMonth(),e.getDate()):e},T}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=6378100,n=100;function r(t){return t.map(function(t){return t.trim().split(" ")})}function o(t){return t*Math.PI/180}function a(t){return t.every(function(t){return""!==t[0]&&t[0]>=-90&&t[0]<=90&&""!==t[1]&&t[1]>=-180&&t[1]<=180&&(void 0===t[2]||!isNaN(t[2]))&&(void 0===t[3]||!isNaN(t[3])&&t[3]>=0)})}function i(t,n){var r=o(t.lng-n.lng),a=o(t.lat),i=o(n.lat);return Math.acos(Math.sin(a)*Math.sin(i)+Math.cos(a)*Math.cos(i)*Math.cos(r))*e}t.exports={area:function(t){var i=r(t);if(!a(i))return Number.NaN;var u=i.length,s=0;if(u>2){for(var l=0;l<u;l++){var v={lat:i[l][0],lng:i[l][1]},f={lat:i[(l+1)%u][0],lng:i[(l+1)%u][1]};s+=o(f.lng-v.lng)*(2+Math.sin(o(v.lat))+Math.sin(o(f.lat)))}s=s*e*e/2}return Math.abs(Math.round(s*n))/n},areaOrDistance:function(t,e,n){var r=[];return"str"===n.t&&(r=n.v.split(";")),"arr"===n.t&&(r=1===n.v.length?n.v[0].split(";"):n.v),t(e(r))},distance:function(t){var e=r(t);if(!a(e))return Number.NaN;var o=e.length,u=0;if(o>1)for(var s=1;s<o;s++)u+=i({lat:e[s-1][0],lng:e[s-1][1]},{lat:e[s][0],lng:e[s][1]});return Math.abs(Math.round(u*n))/n}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(16);t.exports={digest:function(t,n,r){if(t=t.v,n=n&&n.v&&n.v.toLowerCase(),r=r&&r.v&&r.v.toLowerCase()||"base64",!n||!/^(md5|sha-1|sha-256|sha-384|sha-512)$/.test(n))throw new Error("Invalid algo.");if(!/^(base64|hex)$/.test(r))throw new Error("Invalid encoding.");var o=e.md[n.replace("-","")].create();o.update(t);var a=o.digest();return r&&"base64"!==r?o.digest().toHex():e.util.encode64(a.bytes())}}})?r.apply(e,o):r)||(t.exports=a)},function(e,n){e.exports=t},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";function e(){return Math.random().toString(16).substring(2)}t.exports={randomToken:function(t){var n=Math.ceil(t/13);return new Array(n).fill(e).reduce(function(t,e){return t+e()},"").substring(0,t)}}})?r.apply(e,o):r)||(t.exports=a)}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("node-forge")):"function"==typeof define&&define.amd?define("orxe",["node-forge"],e):"object"==typeof exports?exports.orxe=e(require("node-forge")):t.orxe=e(t["node-forge"])}(window,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";t.exports={DATE_STRING:/^\d\d\d\d-\d{1,2}-\d{1,2}(?:T\d\d:\d\d:\d\d\.?\d?\d?(?:Z|[+-]\d\d:\d\d)|.*)?$/,dateToDays:function(t,e){var n=null;t.indexOf("T")>0?n=new Date(t):(n=t.split("-"),n=new Date(n[0],n[1]-1,n[2]));var r=n.getTime()/864e5;return!1===e?r:Math.round(1e5*r)/1e5}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";t.exports={allowStringComparison:!1,includeTimeForTodayString:!1,returnCurrentTimeForToday:!1}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";t.exports={getNamespaceAtts:function(t){for(var e,n=[];e=t.iterateNext();)e.name.indexOf(":")>0&&n.unshift(e);return n},toNodes:function(t){for(var e,n=[];e=t.iterateNext();)n.push(e);return n},toSnapshotResult:function(t,e,n){return r=0,{resultType:e,singleNodeValue:t.length?n||t[0]:null,snapshotLength:t.length,snapshotItem:function(e){return t[e]},iterateNext:function(){return t.length>r?t[r++]:null}};var r}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports={nodes:function(t){return{t:"nodes",v:t}},boolean:function(t){return{t:"bool",v:t}},number:function(t){return{t:"num",v:t}},string:function(t){return{t:"str",v:t}},date:function(t){if(!(t instanceof Date))throw new Error("Cannot create date from "+t+" ("+e(t)+")");return{t:"date",v:t}}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";t.exports=n(5)})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";n(6);var e=n(7),r=n(13),o=n(1),a=r(o);t.exports=function(){var t={extendedXPathEvaluator:e,openrosaXPathExtensions:r,config:o,customXPathFunction:a.customXPathFunction,getCurrentDomLevel3XPathBindings:function(){return{window:{XPathException:window.XPathException,XPathExpression:window.XPathExpression,XPathNSResolver:window.XPathNSResolver,XPathResult:window.XPathResult,XPathNamespace:window.XPathNamespace},document:{createExpression:document.createExpression,createNSResolver:document.createNSResolver,evaluate:document.evaluate}}},createDomLevel3XPathBindings:function(t){var n=new XPathEvaluator(t);return{document:{evaluate:function(t,r,o,i,u){var s=function(t,e,a){(i<7||t.startsWith("//"))&&(i=null);var s=a||i||XPathResult.ANY_TYPE;return n.evaluate(t,e||r,o,s||XPathResult.ANY_TYPE,u)},l=new e(s,a);return l.evaluate.apply(l,arguments)}}}},bindDomLevel3XPath:function(e,n){var r,o=n||t.createDomLevel3XPathBindings(),a=t.getCurrentDomLevel3XPathBindings();for(r in e=e||document,o.document)e[r]=o.document[r];return a}};return t}()})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";Date.prototype.toISOLocalString=function(){if("Invalid Date"===this.toString())return this.toString();var t=new Date(this.getTime()-60*this.getTimezoneOffset()*1e3).toISOString().replace("Z",this.getTimezoneOffsetAsTime());return t.indexOf("T00:00:00.000")>0?t.split("T")[0]:t},Date.prototype.getTimezoneOffsetAsTime=function(){var t,e=function(t){return t<10?"0"+t:t};return"Invalid Date"===this.toString()?this.toString():((t=this.getTimezoneOffset())<0?"+":"-")+e(Math.floor(Math.abs(t/60)))+":"+e(Math.floor(Math.abs(t%60)))}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(1),r=n(8),o=n(9),a=o.isNamespaceExpr,i=o.handleNamespaceExpr,u=n(10).handleOperation,s=n(11),l=s.isNativeFunction,v=s.preprocessNativeArgs,f=n(0),c=f.DATE_STRING,h=f.dateToDays,g=n(2),d=g.toNodes,p=g.toSnapshotResult,m=n(12),b=m.inputArgs,N=m.preprocessInput,x=(n(3),[["|"],["&"],["=","!="],["<","<=",">=",">"],["+","-"],["*","/","%"]]),w=/[0-9]/,y=/^[a-z]/,T=/(>|<)/,E=/(=)/,P=/(true\(\)|false\(\))/,R=/(=|<|>)/,M=new Error("invalid args"),S=new Error("too many args"),O=new Error("too few args");t.exports=function(t,n){var o=n.func||{},s=n.process||{},f=function(t){var e,n;if(t.resultType===XPathResult.NUMBER_TYPE)return{t:"num",v:t.numberValue};if(t.resultType===XPathResult.BOOLEAN_TYPE)return{t:"bool",v:t.booleanValue};if(t.resultType===XPathResult.UNORDERED_NODE_ITERATOR_TYPE){for(n=[];e=t.iterateNext();)n.push(e.textContent);return{t:"arr",v:n}}return{t:"str",v:t.stringValue}},g=function(t,e,n){if(o.hasOwnProperty(t))return n&&/^(date|now$|today$|randomize$)/.test(t)&&e.push(n),/^(true$|false$)/.test(t)&&e.push(n||XPathResult.BOOLEAN_TYPE),m(t,e);if("normalize-space"===t&&e.length){var r=e[0].v;return{t:"str",v:r=(r=(r=(r=(r=(r=(r=r.replace(/\f/g,"\\f")).replace(/\r\v/g,"\v")).replace(/\v/g,"\\v")).replace(/\s+/g," ")).replace(/^\s+|\s+$/g,"")).replace(/\\v/g,"\v")).replace(/\\f/g,"\f")}}return"string"===t&&e.length>0&&(e[0].v===Number.POSITIVE_INFINITY||e[0].v===Number.NEGATIVE_INFINITY||e[0].v!=e[0].v)?{t:"str",v:e[0].v}:I(t,v(t,e))},m=function(t,e){var n,r=[];for(n=0;n<e.length;++n)r.push(e[n]);return o[t].apply(null,r)},I=function(e,n){var r,o,a,i="";for(a=0;a<n.length;++a)"num"!==(r=n[a]).t&&"bool"!==r.t&&(i+=o=-1===r.v.indexOf('"')?'"':"'"),i+=r.v,"bool"===r.t&&(i+="()"),"num"!==r.t&&"bool"!==r.t&&(i+=o),a<n.length-1&&(i+=", ");return f(t(e+"("+i+")"))},_=function(t){if(s.typefor){var e=s.typefor(t);if(e)return e}return"boolean"==typeof t?"bool":"number"==typeof t?"num":"str"};this.evaluate=function(n,o,v,m){if(n=N(n,m),a(n))return i(n,o);if(l(n)){var I=b(n);if(I.length&&I[0].length&&!isNaN(I[0]))throw M;if("lang()"===n)throw O;/^lang\(/.test(n)&&2===o.nodeType&&(o=o.ownerElement);var D=t(n,o);if(m===XPathResult.NUMBER_TYPE&&(D.resultType===XPathResult.UNORDERED_NODE_ITERATOR_TYPE||D.resultType===XPathResult.UNORDERED_NODE_ITERATOR_TYPE)){var X=parseInt(D.iterateNext().textContent);return{resultType:XPathResult.NUMBER_TYPE,numberValue:X,stringValue:X}}return D}if(m>3&&!n.startsWith("randomize")||/^count\(|boolean\(/.test(n)){if(n.startsWith("count(")){if(n.indexOf(",")>0)throw S;if("count()"===n)throw O;if(!isNaN(/\((.*)\)/.exec(n)[1]))throw M}if(n.startsWith("boolean(")){if("boolean()"===n)throw O;if(n.substring(8,n.indexOf(")")).split(",").length>1)throw S}return"/"===n&&(o=o.ownerDocument||o),t(n,o)}m===XPathResult.BOOLEAN_TYPE&&n.indexOf("(")<0&&n.indexOf("/")<0&&n.indexOf("=")<0&&n.indexOf("!=")<0&&(n="boolean-from-string("+(n=(n=(n=n.replace(/(\n|\r|\t)/g,"")).replace(/"(\d)"/g,"$1")).replace(/'(\d)'/g,"$1"))+")"),m===XPathResult.NUMBER_TYPE&&n.indexOf("string-length")<0&&(n=n.replace(/(\n|\r|\t)/g,""));var k,Y,A,B=[{t:"root",tokens:[]}],$=function(){return B[B.length-1]},V=function(t){throw new Error((t||"")+" [stack="+JSON.stringify(B)+"] [cur="+JSON.stringify(Y)+"]")},F=function(){Y={t:"?",v:""}},L=function(t){$().tokens.push({t:"op",v:t}),F()},U=function(t,n){var r=function(t,n,r){if(s.handleInfix){var o=s.handleInfix(V,t,n,r);if(o&&"continue"===o.t&&(t=o.lhs,n=o.op,r=o.rhs,o=null),null!=o)return o}return u(t,n,r,e)}(t[n-1],t[n],t[n+1]);null!=r&&(t.splice(n,2),t[n-1]={t:_(r),v:r})},C=function(){var t,e,n,r;for(r=$().tokens,e=x.length-1;e>=0;--e)for(n=x[e],t=1;t<r.length-1;)"op"===r[t].t&&-1!==n.indexOf(r[t].v)?U(r,t):++t},j=function(){var e,n=Y.v;e=["position"].includes($().v)?t(n):m>3||Y.v.indexOf("position()=")>=0&&1===B.length&&!/^[a-z]*[(|[]{1}/.test(Y.v)?d(t(n)):n.startsWith("$")?n:f(t(n,o)),$().tokens.push(e),F()},G=function(){return n.charAt(k+1)},z=function(){Y.v=parseFloat(Y.string),$().tokens.push(Y),F()},q=function(t){return t>="0"&&t<="9"};for(F(),k=0;k<n.length;++k){var W=n.charAt(k);if(Y.sq)Y.v+=W,"]"===W?--Y.sq:"["===W&&++Y.sq;else if("str"!==Y.t){if("num"===Y.t){if(w.test(W)||["e",'"',"'"].includes(W)||"-"===W&&"e"===n[k-1]){Y.string+=W;continue}if(" "===W&&"-"===Y.string)continue;"."!==W||Y.decimal?z():(Y.decimal=1,Y.string+=W)}if(q(W))""===Y.v?Y={t:"num",string:W}:Y.v+=W;else switch(W){case"'":case'"':""===Y.v?Y={t:"str",quote:W,v:""}:V("Not sure how to handle: "+W);break;case"(":Y.t="fn",Y.tokens=[],B.push(Y),"once"===Y.v&&(F(),Y.v=".",j()),F();break;case")":if("["===G()){var H=B.pop();H.v=H.v+"("+Y.v+W,H.t="?",Y=H;break}if(""!==Y.v&&j(),C(),"fn"!==(Y=B.pop()).t&&V(),Y.v){var Z=m;m===XPathResult.BOOLEAN_TYPE&&(T.test(n)&&!P.test(n)&&(Z=XPathResult.NUMBER_TYPE),E.test(n)&&(Z=XPathResult.BOOLEAN_TYPE),R.test(n)&&"fn"===Y.t&&/^(date|date-time)$/.test(Y.v)&&(Z=XPathResult.STRING_TYPE)),D=g(Y.v,Y.tokens,Z),"node"===Y.v&&"arr"===D.t&&D.v.length>0&&(D.v=[D.v[0]]),$().tokens.push(D)}else 1!==Y.tokens.length&&V(),$().tokens.push(Y.tokens[0]);F();break;case",":""!==Y.v&&j(),"fn"!==$().t&&V();break;case"*":"*"!==W||""===Y.v&&0!==$().tokens.length?""!==Y.v||![")",""].includes(G())&&")"!==n.substring(k+1).trim()?L(W):(Y.v=W,j()):(Y.v+=W,"./*"===Y.v&&j());break;case"-":var J=(A=void 0,(A=$().tokens)[A.length-1]);if(""!==Y.v&&" "!==G()&&" "!==n.charAt(k-1))Y.v+=W;else if(0===$().tokens.length&&""===Y.v||J&&"op"===J.t||J&&"num"===J.t&&B.length>1&&"fn"===B[1].t||J&&"num"!==J.t&&q(G()))Y={t:"num",string:"-"};else{if(""!==Y.v){if(!w.test(Y.v)&&" "!==n[k-1])throw M;$().tokens.push(Y)}L(W)}break;case"=":if("<"===Y.v||"<"===Y.v||">"===Y.v||">"===Y.v||"!"===Y.v)switch(Y.v+=W,Y.v){case"<=":case"<=":L("<=");break;case">=":case">=":L(">=");break;case"!=":L("!=")}else Y.v&&j(),L(W);break;case";":switch(Y.v){case"<":Y.v="",W="<";break;case">":Y.v="",W=">";break;default:Y.v+=W;continue}case">":case"<":if(Y.v&&j(),"="===G()){Y.v=W;break}case"+":L(W);break;case" ":switch(Y.v){case"":break;case"mod":L("%");break;case"div":L("/");break;case"and":L("&");break;case"or":L("|");break;default:var K=Y.v.toLowerCase();if(/^(mod|div|and|or)$/.test(K))throw M;y.test(Y.v)||j()}break;case"[":Y.sq=(Y.sq||0)+1;case".":if(""===Y.v&&")"===G()){Y.v=W,j();break}if(""===Y.v&&q(G())){Y={t:"num",string:W};break}default:Y.v+=W}}else W===Y.quote?($().tokens.push(Y),F()):Y.v+=W}return"num"===Y.t&&z(),"?"===Y.t&&""!==Y.v&&j(),("?"!==Y.t||""!==Y.v||Y.tokens&&Y.tokens.length)&&V("Current item not evaluated!"),B.length>1&&V("Stuff left on stack."),"root"!==B[0].t&&V("Weird stuff on stack."),0===B[0].tokens.length&&V("No tokens."),B[0].tokens.length>=3&&C(),B[0].tokens.length>1&&V("Too many tokens."),function(t,e){if(s.toExternalResult){var n=s.toExternalResult(t);if(n)return n}if(t.v&&"function"==typeof t.v.then&&e===XPathResult.STRING_TYPE)return{resultType:XPathResult.STRING_TYPE,stringValue:t.v};if("arr"===t.t&&e===XPathResult.NUMBER_TYPE&&c.test(t.v[0])||"str"===t.t&&e===XPathResult.NUMBER_TYPE&&c.test(t.v)){var o="arr"===t.t?t.v[0]:t.v,a=h(o);return{resultType:XPathResult.NUMBER_TYPE,numberValue:a,stringValue:a}}if("num"===t.t)return{resultType:XPathResult.NUMBER_TYPE,numberValue:t.v,stringValue:t.v.toString()};if("bool"===t.t)return{resultType:XPathResult.BOOLEAN_TYPE,booleanValue:t.v,stringValue:t.v.toString()};if(e>3)return t=r(t[0],t[1]),p(t,XPathResult.UNORDERED_SNAPSHOT_TYPE);if(!t.t&&Array.isArray(t)){if(e===XPathResult.NUMBER_TYPE){var i=parseInt(t[0].textContent);return{resultType:XPathResult.NUMBER_TYPE,numberValue:i,stringValue:i.toString()}}if(e===XPathResult.STRING_TYPE)return{resultType:XPathResult.STRING_TYPE,stringValue:t.length?t[0]:""}}return{resultType:XPathResult.STRING_TYPE,stringValue:null===t.v?"":t.v.toString()}}(B[0].tokens[0],m)}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=2147483647;function n(t){this._seed=t%e,this._seed<=0&&(this._seed+=e-1)}n.prototype.next=function(){return this._seed=16807*this._seed%e,this._seed},n.prototype.nextFloat=function(){return(this.next()-1)/(e-1)},t.exports=function(t,e){var r,o=[];if(void 0!==e){if(!Number.isInteger(e))throw new Error("Invalid seed argument. Integer required.");var a=new n(e);r=a.nextFloat.bind(a)}else r=Math.random;for(var i=0;i<t.length;++i){var u=Math.floor(r()*(i+1));u!==i&&(o[i]=o[u]),o[u]=t[i]}return o}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(2).toSnapshotResult;t.exports={isNamespaceExpr:function(t){return/^(namespace::node\(\)|namespace::\*)$/.test(t)||/^namespace::/.test(t)},handleNamespaceExpr:function(t,n){return/^(namespace::node\(\)|namespace::\*)$/.test(t)?function(t){for(var n=[],r={},o=[],a=t;a;){if(a.attributes)for(var i=0;i<a.attributes.length;i++){var u=a.attributes[i],s=u.ownerElement.getAttributeNode(u.name);if(s.nodeName.startsWith("xmlns")&&!r[s.nodeName]){var l=s.nodeName.split(":");r[s.nodeName]=s.nodeName,s.nodeValue.length&&(o.push(s),n.push({nodeName:"#namespace",localName:l.length>1?l[1]:"",namespaceURI:s.nodeValue}))}}a=1===t.nodeType?a.parentNode:null}return n.length>0&&!r.xmlns&&n.push({nodeName:"#namespace",localName:"xmlns",namespaceURI:"http://www.w3.org/1999/xhtml"}),n.length>0&&!r.xml&&n.push({nodeName:"#namespace",localName:"xml",namespaceURI:"http://www.w3.org/XML/1998/namespace"}),n=n.sort(function(t,e){return t.localName<e.localName?-1:t.localName>e.localName?1:0}),e(n,7,o[0])}(n):/^namespace::/.test(t)?function(t,n){var r=t.substring(11),o=[],a=[];if(n.attributes)for(var i=0;i<n.attributes.length;i++){var u=n.attributes[i],s=u.ownerElement.getAttributeNode(u.name);s.nodeName==="xmlns:"+r&&(a.push(s),o.push({nodeName:"#namespace",localName:r,namespaceURI:s.nodeValue}))}return e(o)}(t,n):void 0}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(0).dateToDays;function r(t){if("string"==typeof t){var e=t.replace(/["']/g,"");return e.trim().length&&!isNaN(e.trim())}return"number"==typeof t}t.exports={handleOperation:function(t,n,o,a){if("+"===n.v&&r(t.v)&&r(o.v)&&(t.v=Number(t.v),o.v=Number(o.v)),"arr"===t.t&&1===t.v.length&&"num"===o.t&&/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(t.v[0])&&(t={t:"num",v:e(t.v[0],!1)}),"arr"===o.t&&1===o.v.length&&"num"===t.t&&/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(o.v[0])&&(o={t:"num",v:e(o.v[0],!1)}),"arr"===t.t&&1===t.v.length&&"str"===o.t&&(t={t:"str",v:t.v[0]}),"arr"===o.t&&1===o.v.length&&"str"===t.t&&(o={t:"str",v:o.v[0]}),"arr"===o.t&&1===o.v.length&&"arr"===t.t&&1===t.v.length&&(t={t:"str",v:t.v[0]},o={t:"str",v:o.v[0]}),"str"===t.t&&/^\d\d\d\d-\d{1,2}-\d{1,2}/.test(t.v)&&(t={t:"num",v:e(t.v,!1)}),"str"===o.t&&/^\d\d\d\d-\d{1,2}-\d{1,2}/.test(o.v)&&(o={t:"num",v:e(o.v,!1)}),"-"===n.v&&(isNaN(t.v)||isNaN(o.v)))return NaN;switch(/^(=|!=)$/.test(n.v)&&("str"===t.t&&"bool"===o.t&&(t=t.v.length>0&&"1"===t.v?{t:"bool",v:!0}:""===t.v?{t:"bool",v:!1}:{t:"bool",v:void 0}),"str"===o.t&&"bool"===t.t&&(o=o.v.length>0&&"1"===o.v?{t:"bool",v:!0}:""===o.v?{t:"bool",v:!1}:{t:"bool",v:void 0}),"num"===t.t&&"bool"===o.t&&(t={t:"bool",v:Boolean(t.v)}),"num"===o.t&&"bool"===t.t&&(o={t:"bool",v:Boolean(o.v)})),n.v){case"+":return t.v+o.v;case"-":return t.v-o.v;case"*":return t.v*o.v;case"/":return t.v/o.v;case"%":return t.v%o.v;case"=":return/^(num|str)$/.test(t.t)&&"arr"===o.t?o.v.includes(t.string||t.v):/^(num|str)$/.test(o.t)&&"arr"===t.t?t.v.includes(o.string||o.v):"bool"===t.t&&"arr"===o.t?t.v===o.v.length>0:"bool"===o.t&&"arr"===t.t?o.v===t.v.length>0:t.v==o.v;case"<":if("bool"===t.t)return!1===t.v&&"arr"===o.t&&o.v.length>0||(!0===t.v&&"num"===o.t?1<o.v:!1===t.v&&"num"===o.t?0<o.v:!1===t.v&&"bool"===o.t&&!0===o.v);if("bool"===o.t)return!0===o.v&&"arr"===t.t&&0===t.v.length||!0===o.v&&"num"===t.t&&t.v<1;if("arr"===t.t&&t.v.length>0){for(var i=0;i<t.v.length;i++)if(Number(t.v[i])<o.v)return!0;return!1}if("arr"===o.t&&o.v.length>0){for(var u=0;u<o.v.length;u++)if(t.v<Number(o.v[u]))return!0;return!1}return"arr"===t.t&&0===t.v.length&&(t={t:"num",string:"0",v:0}),"arr"===o.t&&0===o.v.length&&(o={t:"num",string:"0",v:0}),"str"===t.t&&"str"===o.t&&a.allowStringComparison?t.v<o.v:!(!r(t.v)||!r(o.v))&&t.v<o.v;case">":if("bool"===t.t)return!0===t.v&&"arr"===o.t&&0===o.v.length||(!0===t.v&&"num"===o.t?1>o.v:!0===t.v&&"bool"===o.t&&1>(!0===o.v?1:0));if("bool"===o.t)return!1===o.v&&"arr"===t.t&&t.v.length>0||(!1===o.v&&"num"===t.t?t.v>0:!0===o.v&&"num"===t.t?t.v>1:"num"===t.t&&(t.v>o.v==1?1:0));if("arr"===t.t&&t.v.length>0){for(var s=0;s<t.v.length;s++)if(Number(t.v[s])>o.v)return!0;return!1}if("arr"===o.t&&o.v.length>0){for(var l=0;l<o.v.length;l++)if(t.v>Number(o.v[l]))return!0;return!1}return"arr"===t.t&&0===t.v.length&&(t={t:"num",string:"0",v:0}),"bool"===t.t&&!0===t.v&&(t={t:"num",string:"1",v:1}),"bool"===t.t&&!1===t.v&&(t={t:"num",string:"0",v:0}),"arr"===o.t&&0===o.v.length&&(o={t:"num",string:"0",v:0}),"bool"===o.t&&!0===o.v&&(o={t:"num",string:"1",v:1}),"bool"===o.t&&!1===o.v&&(o={t:"num",string:"0",v:0}),"str"===t.t&&"str"===o.t&&a.allowStringComparison?t.v>o.v:!(!r(t.v)||!r(o.v))&&t.v>o.v;case"<=":if("arr"===o.t&&0===o.v.length&&t.string&&t.string.length>0)return!1;if("arr"===t.t&&0===t.v.length&&o.string&&o.string.length>0)return!1;if("bool"===o.t&&!1===o.v&&"arr"===t.t&&t.v.length>0)return!1;if("bool"===t.t&&(t={t:"num",v:!0===t.v?1:0,string:!0===t.v?"1":"0"}),"bool"===o.t&&(o={t:"num",v:!0===o.v?1:0,string:!0===t.v?"1":"0"}),"arr"===t.t&&t.v.length>0){for(var v=0;v<t.v.length;v++)if(Number(t.v[v])<=o.v)return!0;return!1}if("arr"===o.t&&o.v.length>0){for(var f=0;f<o.v.length;f++)if(t.v<=Number(o.v[f]))return!0;return!1}return"arr"===o.t&&0===o.v.length&&(o={t:"num",string:"0",v:0}),"arr"===t.t&&0===t.v.length&&(t={t:"num",string:"0",v:0}),"bool"===t.t&&!0===t.v&&(t={t:"num",string:"1",v:1}),"bool"===t.t&&!1===t.v&&(t={t:"num",string:"0",v:0}),"bool"===o.t&&!0===o.v&&(o={t:"num",string:"1",v:1}),"bool"===o.t&&!1===o.v&&(o={t:"num",string:"0",v:0}),"str"===t.t&&"str"===o.t&&a.allowStringComparison?t.v<=o.v:!(!r(t.v)||!r(o.v))&&t.v<=o.v;case">=":if("arr"===o.t&&0===o.v.length&&t.string&&t.string.length>0)return!1;if("arr"===o.t&&o.v.length>0&&!1===t.v)return!1;if("arr"===t.t&&0===t.v.length)return("str"!==o.t||""!==o.v)&&("str"===o.t?o.v.length>=0:o.v.length>=0||!1===o.v);if("bool"===t.t&&(t={t:"num",v:!0===t.v?1:0,string:!0===t.v?"1":"0"}),"bool"===o.t&&(o={t:"num",v:!0===o.v?1:0,string:!0===t.v?"1":"0"}),"arr"===t.t&&t.v.length>0){for(var c=0;c<t.v.length;c++)if(Number(t.v[c])>=o.v)return!0;return!1}if("arr"===o.t&&o.v.length>0){for(var h=0;h<o.v.length;h++)if(t.v>=Number(o.v[h]))return!0;return!1}return"arr"===t.t&&0===t.v.length&&(t={t:"num",string:"0",v:0}),"bool"===t.t&&!0===t.v&&(t={t:"num",string:"1",v:1}),"bool"===t.t&&!1===t.v&&(t={t:"num",string:"0",v:0}),"arr"===o.t&&0===o.v.length&&(o={t:"num",string:"0",v:0}),"bool"===o.t&&!0===o.v&&(o={t:"num",string:"1",v:1}),"bool"===o.t&&!1===o.v&&(o={t:"num",string:"0",v:0}),"str"===t.t&&"str"===o.t&&a.allowStringComparison?t.v>=o.v:!(!r(t.v)||!r(o.v))&&t.v>=o.v;case"!=":return"bool"===t.t&&"arr"===o.t?t.v===o.v.length<1:"bool"===o.t&&"arr"===t.t?o.v===t.v.length<1:t.v!=o.v;case"&":return Boolean(t.v&&o.v);case"|":return Boolean(t.v||o.v)}}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(0),r=e.DATE_STRING,o=e.dateToDays,a=new Error("too many args"),i=new Error("too few args"),u=new Error("invalid args"),s=/^id\(|^\([a-zA-Z]|lang\(|local-name|namespace-uri|last\(|name\(|child::|parent::|descendant::|descendant-or-self::|ancestor::|ancestor-or-self::sibling|following::|following-sibling::|preceding-sibling::|preceding::|attribute::|^[0-9\+\-\*\(\)\s\\]*$/;function l(t,e,n){if(null!=e&&t.length<e)throw i;if(null!=n&&t.length>n)throw a}t.exports={isNativeFunction:function(t){return s.test(t)},preprocessNativeArgs:function(t,e){if("number"===t&&e.length&&("arr"===e[0].t?e=[{t:"num",v:e[0].v[0]}]:"str"===e[0].t&&r.test(e[0].v)?e=[{t:"num",v:o(e[0].v)}]:"num"===e[0].t&&e[0].v.toString().indexOf("e-")>0&&(e=[{t:"num",v:0}])),"name"===t&&e.length<2)throw i;if("namespace-uri"===t){if(e.length>1)throw a;if(0===e.length)throw i;if(1===e.length&&!isNaN(e[0].v))throw u}if("local-name"===t){if(e.length>1)throw a;if(1===e.length&&!isNaN(e[0].v))throw u}return"substring"===t&&e.length>2&&e[1].v===Number.NEGATIVE_INFINITY&&e[2].v===Number.POSITIVE_INFINITY&&(e[0].v=""),"substring"===t&&e.length>1&&e[1].v<0&&(e[1].v=0),"substring"===t&&e.length>2&&e[2].v===Number.POSITIVE_INFINITY&&(e[2].v=e[0].v.length+1),function(t,e){"last"===t?l(e,null,0):/^(boolean|lang|ceiling|name|floor)$/.test(t)?l(e,1,1):/^(number|string|normalize-space|string-length)$/.test(t)?l(e,null,1):"substring"===t?l(e,2,3):/^(starts-with|contains|substring-before|substring-after)$/.test(t)?l(e,2,2):"translate"===t&&l(e,3,3)}(t,e),e}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=/\(\s*([^)]*)\)$/;t.exports={inputArgs:function(t){var n=t.match(e);return n?n[1].split(","):[]},preprocessInput:function(t,e){return function(t,e){return e===XPathResult.NUMBER_TYPE&&t.indexOf("(")<0&&!t.startsWith("/")}(t,e)&&((t=t.replace("\n","")).indexOf("mod")>0&&(t=t.replace("mod"," mod ")),t.indexOf("div")>0&&(t=t.replace("div"," div "))),"string(namespace::node())"===t&&(t=t.replace("namespace::node()","namespace-uri(/*)")),t}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(14),r=e.area,o=e.distance,a=e.areaOrDistance,i=n(15).digest,u=n(17).randomToken,s=n(3);t.exports=function(t){var e,n,l=new Error("too many args"),v=new Error("too few args"),f=/^(-?[0-9]+)(\.[0-9]+)?$/,c=/^\d\d\d\d-\d{1,2}-\d{1,2}(?:T\d\d:\d\d:\d\d\.?\d?\d?(?:Z|[+-]\d\d:\d\d)|.*)?$/,h=s,g=function(t,e){for(e=e||2,t=t.toString();t.length<e;)t="0"+t;return t},d=function(t){return Math.round(p(t))},p=function(t){return"num"===t.t?t.v:parseFloat(m(t))},m=function(t){return"arr"===t.t?t.v.length?t.v[0].toString():"":t.v.toString()},b=function(t){return t<0?-Math.round(-t):Math.round(t)},N=function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)},x=function(t,e){var n,r;if(t.v instanceof Date)return new Date(t.v);if(t=m(t),f.test(t))return(n=new Date(1970,0,1)).setDate(1+parseInt(t,10)),n;if(c.test(t))return e&&t.indexOf("T")>0?new Date(t):(-1!==(r=t.indexOf("T"))&&(t=t.substring(0,r)),n=t.split("-"),n=new Date(n[0],n[1]-1,n[2]));var o=new Date(t);return"Invalid Date"==o?null:o},w=function(t,e){return e===XPathResult.BOOLEAN_TYPE?t?h.boolean(!isNaN(new Date(t).getTime())):h.boolean(!1):e===XPathResult.NUMBER_TYPE?t?h.number(new Date(t).getTime()/864e5):h.number(0):e===XPathResult.STRING_TYPE?t?h.string(new Date(t).toISOLocalString()):h.string("Invalid Date"):t?h.date(t):h.string("Invalid Date")},y=function(t,e){return t=x(t),w(t,e)},T={},E=function(t,e){return w(T._now(e),t)};return(e={abs:function(t){return h.number(Math.abs(t.v))},acos:function(t){return h.number(Math.acos(t.v))},asin:function(t){return h.number(Math.asin(t.v))},atan:function(t){return h.number(Math.atan(t.v))},atan2:function(t){if(arguments.length>1){var e=arguments[0].v,n=arguments[1].v;return h.number(Math.atan2(e,n))}return h.number(Math.atan2(t.v))},"boolean-from-string":function(t){return t=m(t),h.boolean("1"===t||"true"===t)},area:function(t){if(0===arguments.length)throw v;return a(h.number,r,t)},checklist:function(t,e){var n,r,o=0;for(t=t.v,e=e.v,n=2;n<arguments.length;n++){var a=arguments[n];if("bool"===a.t&&Boolean(a.v))o++;else if("arr"===a.t)for(r=0;r<a.v.length;r++)a.v[r]&&o++}return h.boolean((t<0||o>=t)&&(e<0||o<=e))},coalesce:function(t,e){return h.string(m(t)||m(e))},concat:function(){for(var t=[],e=0;e<arguments.length;e++)"arr"===arguments[e].t?t.push(arguments[e].v.join("")):t.push(arguments[e].v);return h.string(t.join(""))},cos:function(t){return h.number(Math.cos(t.v))},"count-non-empty":function(t){if(0===arguments.length||"arr"!==t.t)throw v;for(var e=0,n=0;n<t.v.length;n++)e+=""===t.v[n]?0:1;return h.number(e)},"count-selected":function(t){for(var e=m(t).split(" "),n=e.length,r=0;--n>=0;)e[n].length&&++r;return h.number(r)},date:function(t,e){return t=x(t),w(t,e)},"decimal-date":function(t){if(arguments.length>1)throw l;var e=Date.parse(m(t))/864e5;return h.number(e)},"decimal-time":function(t){if(arguments.length>1)throw l;if("num"===t.t)return h.number(NaN);var e,n=t.v,r=n.match(/^(\d\d):(\d\d):(\d\d)(\.\d\d?\d?)?(\+|-)(\d\d):(\d\d)$/);if(r&&r[1]<24&&r[1]>=0&&r[2]<60&&r[2]>=0&&r[3]<60&&r[3]>=0&&r[6]<24&&r[6]>=0&&r[7]<60&&r[7]>=0){var o=function(t){return t<10?"0"+t:t},a=new Date,i=new Date(a.getFullYear()+"-"+o(a.getMonth()+1)+"-"+o(a.getDate())+"T"+n);e="Invalid Date"===i.toString()?NaN:(i.getSeconds()/3600+i.getMinutes()/60+i.getHours())/24}else e=NaN;return h.number(e)},digest:function(t,e,n){return h.string(i(t,e,n))},distance:function(t){if(0===arguments.length)throw v;return a(h.number,o,t)},exp:function(t){return h.number(Math.exp(t.v))},exp10:function(t){return h.number(Math.pow(10,t.v))},false:function(t){if(t===XPathResult.NUMBER_TYPE)return h.number(0);if(arguments.length>1)throw l;return h.boolean(!1)},"format-date":function(t,e){return h.string(function(t,e){if(t=x(t,!0),!e)return"";if(e=m(e),!t)return"Invalid Date";var n,r,o="",a={year:1900+t.getYear(),month:1+t.getMonth(),day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millis:t.getMilliseconds(),secTicks:t.getTime(),dow:1+t.getDay()},i=window?window.enketoFormLocale:void 0;for(r=0;r<e.length;++r)if("%"===(n=e.charAt(r))){if(++r>=e.length)throw new Error("date format string ends with %");if("%"===(n=e.charAt(r)))o+="%";else if("Y"===n)o+=g(a.year,4);else if("y"===n)o+=g(a.year,4).substring(2);else if("m"===n)o+=g(a.month,2);else if("n"===n)o+=a.month;else if("b"===n)o+=t.toLocaleDateString(i,{month:"short"});else if("d"===n)o+=g(a.day,2);else if("e"===n)o+=a.day;else if("H"===n)o+=g(a.hour,2);else if("h"===n)o+=a.hour;else if("M"===n)o+=g(a.minute,2);else if("S"===n)o+=g(a.second,2);else if("3"===n)o+=g(a.millis,3);else{if("a"!==n)throw"Z"===n||"A"===n||"B"===n?new Error("unsupported escape in date format string [%"+n+"]"):new Error("unrecognized escape in date format string [%"+n+"]");o+=t.toLocaleDateString(i,{weekday:"short"})}}else o+=n;return o}(t,e))},if:function(t,e,n){if("bool"===t.t)return h.string(t.v?e.v:n.v);if("arr"===t.t){var r=t.v.length&&null!==t.v[0];return h.string(r?e.v:n.v)}return h.string(n.v)},"ends-with":function(t,e){if(arguments.length>2)throw l;if(arguments.length<2)throw v;return h.boolean(t.v.endsWith(e.v))},int:function(t){return"str"===t.t&&t.v.indexOf("e-")>0?h.number(NaN):(t=m(t)).indexOf("e-")>0?h.number(0):h.number(parseInt(t,10))},join:function(){var t=arguments[0];if(arguments.length<2)return h.string("");if(arguments.length>2){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n].v);return h.string(e.join(m(t)))}return h.string(arguments[1].v.join(m(t)))},log:function(t){return h.number(Math.log(t.v))},log10:function(t){return h.number(Math.log10(t.v))},max:function(){if(arguments.length>1){for(var t=[],e=0;e<arguments.length;e++)t.push(arguments[e].v);return h.number(Math.max.apply(null,t))}var n,r,o=arguments[0].v;if(!(r=o.length))return h.number(NaN);for(n=parseFloat(o[0]);--r;)n=Math.max(n,parseFloat(o[r]));return h.number(n)},min:function(){if(arguments.length>1){for(var t=[],e=0;e<arguments.length;e++)t.push(arguments[e].v);return h.number(Math.min.apply(null,t))}var n,r,o=arguments[0].v;if(!(r=o.length))return h.number(NaN);for(n=parseFloat(o[0]);--r;)n=Math.min(n,parseFloat(o[r]));return h.number(n)},not:function(t){if(0===arguments.length)throw v;if(arguments.length>1)throw l;return h.boolean(!t.v)},now:function(t){return E(t)},today:function(e){var n=E(e,!t.returnCurrentTimeForToday);return e!==XPathResult.STRING_TYPE||t.includeTimeForTodayString||(n.v=n.v.split("T")[0]),n},once:function(t,e){return t.v.length&&t.v[0].length?h.string(t.v[0]):e.v==1/0?h.string(""):"num"===e.t&&0===e.v?h.string(""):h.string(e.v)},pi:function(){return h.number(Math.PI)},position:function(t){var e=1;if(t)for(var n=t.iterateNext(),r=n.tagName;n.previousElementSibling&&n.previousElementSibling.tagName===r;)n=n.previousElementSibling,e++;return h.number(e)},pow:function(t,e){return h.number(Math.pow(p(t),p(e)))},random:function(){return h.number(Math.random())},randomize:function(t){if(1===arguments.length)throw v;if(arguments.length>3)throw l;var e=arguments.length>2?arguments[1]:arguments[2],n=arguments[arguments.length-1];return n===XPathResult.BOOLEAN_TYPE?h.boolean(t.v.length>0):n===XPathResult.STRING_TYPE?t.v.length<1?"":h.string(t.v[0]):Array.isArray(e)&&e.length&&1===e[0].nodeType?[t,parseInt(e[0].textContent)]:[t,e&&e.v]},regex:function(t,e){return h.boolean(new RegExp(m(e)).test(m(t)))},round:function(t,e){if(0===arguments.length)throw v;if(arguments.length>2)throw l;if(t=p(t),!e)return h.number(b(t));e=d(e);var n=Math.pow(10,Math.abs(e));return e>0?h.number(b(t*n)/n):h.number(n*b(t/n))},selected:function(t,e){return h.boolean(-1!==m(t).split(" ").indexOf(m(e).trim()))},"selected-at":function(t,e){if(!e)throw new Error(JSON.stringify(t));return h.string(m(t).split(" ")[d(e)]||"")},sin:function(t){return h.number(Math.sin(t.v))},sqrt:function(t){return h.number(Math.sqrt(t.v))},substr:function(t,e,n){return h.string(m(t).slice(d(e),n&&d(n)))},sum:function(t){if(arguments.length>1)throw l;for(var e=0,n=0;n<t.v.length;n++)f.test(t.v[n])||h.number(NaN),e+=parseInt(t.v[n],10);return h.number(e)},tan:function(t){return h.number(Math.tan(t.v))},true:function(t){if(t===XPathResult.NUMBER_TYPE)return h.number(1);if(arguments.length>1)throw l;return h.boolean(!0)},uuid:function(t){return t&&t.v?h.string(u(t.v)):h.string("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,N))},"weighted-checklist":function(t,e){var n,r=[],o=[],a=0;for(t=t.v,e=e.v,n=2;n<arguments.length;n+=2){var i=arguments[n],u=arguments[n+1];i&&u&&(r.push("arr"===i.t?i.v[0]:i.v),o.push("arr"===u.t?u.v[0]:u.v))}for(n=0;n<r.length;n++)r[n]&&(a+=o[n]);return h.boolean((t<0||a>=t)&&(e<0||a<=e))}})["date-time"]=e.date,e["decimal-date-time"]=e["decimal-date"],e["format-date-time"]=e["format-date"],n={toExternalResult:function(t){if("date"===t.t)return{resultType:XPathResult.STRING_TYPE,numberValue:t.v.getTime(),stringValue:(e=t.v,e.getFullYear()+"-"+g(e.getMonth()+1)+"-"+g(e.getDate()))};var e},typefor:function(t){if(t instanceof Date)return"date"},handleInfix:function(t,e,n,r){if("date"===e.t||"date"===r.t){if("="===n.v||"<"===n.v||">"===n.v||"<="===n.v||">="===n.v||"!="===n.v){if("arr"!==e.t&&"str"!==e.t||(e=y(e)),"arr"!==r.t&&"str"!==r.t||(r=y(r)),"date"!==e.t||"date"!==r.t)return"!="===n.v;e={t:"num",v:e.v.getTime()},r={t:"num",v:r.v.getTime()}}else if("+"===n.v||"-"===n.v){"date"===e.t&&"date"===r.t&&t();var o="date"===e.t?e.v:r.v,a="date"!==e.t?d(e):d(r),i=new Date(o.getTime());return"-"===n.v&&(a=-a),i.setDate(o.getDate()+a),i}return{t:"continue",lhs:e,op:n,rhs:r}}}},T.func=e,T.process=n,T.XPR=h,T._now=function(t){var e=new Date;return t?new Date(e.getFullYear(),e.getMonth(),e.getDate()):e},T.customXPathFunction={type:{StringType:h.string,NumberType:h.number,BooleanType:h.boolean,DateType:h.date},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},all:function(){return e}},T}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=6378100,n=100;function r(t){return t.map(function(t){return t.trim().split(" ")})}function o(t){return t*Math.PI/180}function a(t){return t.every(function(t){return""!==t[0]&&t[0]>=-90&&t[0]<=90&&""!==t[1]&&t[1]>=-180&&t[1]<=180&&(void 0===t[2]||!isNaN(t[2]))&&(void 0===t[3]||!isNaN(t[3])&&t[3]>=0)})}function i(t,n){var r=o(t.lng-n.lng),a=o(t.lat),i=o(n.lat);return Math.acos(Math.sin(a)*Math.sin(i)+Math.cos(a)*Math.cos(i)*Math.cos(r))*e}t.exports={area:function(t){var i=r(t);if(!a(i))return Number.NaN;var u=i.length,s=0;if(u>2){for(var l=0;l<u;l++){var v={lat:i[l][0],lng:i[l][1]},f={lat:i[(l+1)%u][0],lng:i[(l+1)%u][1]};s+=o(f.lng-v.lng)*(2+Math.sin(o(v.lat))+Math.sin(o(f.lat)))}s=s*e*e/2}return Math.abs(Math.round(s*n))/n},areaOrDistance:function(t,e,n){var r=[];return"str"===n.t&&(r=n.v.split(";")),"arr"===n.t&&(r=1===n.v.length?n.v[0].split(";"):n.v),t(e(r))},distance:function(t){var e=r(t);if(!a(e))return Number.NaN;var o=e.length,u=0;if(o>1)for(var s=1;s<o;s++)u+=i({lat:e[s-1][0],lng:e[s-1][1]},{lat:e[s][0],lng:e[s][1]});return Math.abs(Math.round(u*n))/n}}})?r.apply(e,o):r)||(t.exports=a)},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";var e=n(16);t.exports={digest:function(t,n,r){if(t=t.v,n=n&&n.v&&n.v.toLowerCase(),r=r&&r.v&&r.v.toLowerCase()||"base64",!n||!/^(md5|sha-1|sha-256|sha-384|sha-512)$/.test(n))throw new Error("Invalid algo.");if(!/^(base64|hex)$/.test(r))throw new Error("Invalid encoding.");var o=e.md[n.replace("-","")].create();o.update(t);var a=o.digest();return r&&"base64"!==r?o.digest().toHex():e.util.encode64(a.bytes())}}})?r.apply(e,o):r)||(t.exports=a)},function(e,n){e.exports=t},function(t,e,n){var r,o,a;o=[],void 0===(a="function"==typeof(r=function(){"use strict";function e(){return Math.random().toString(16).substring(2)}t.exports={randomToken:function(t){var n=Math.ceil(t/13);return new Array(n).fill(e).reduce(function(t,e){return t+e()},"").substring(0,t)}}})?r.apply(e,o):r)||(t.exports=a)}])}); |
{ | ||
"name": "openrosa-xpath-evaluator", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"description": "Wrapper for browsers' XPath evaluator with added support for OpenRosa extensions.", | ||
@@ -5,0 +5,0 @@ "main": "src/orxe.js", |
@@ -162,3 +162,3 @@ var config = require('./config'); | ||
if(/^lang\(/.test(input) && cN.nodeType === 2) cN = cN.ownerElement; | ||
const res = wrapped(input, cN); | ||
var res = wrapped(input, cN); | ||
if(rT === XPathResult.NUMBER_TYPE && | ||
@@ -165,0 +165,0 @@ (res.resultType === XPathResult.UNORDERED_NODE_ITERATOR_TYPE || |
@@ -554,6 +554,6 @@ var {area, distance, areaOrDistance} = require('./geo'); | ||
type: { | ||
StringType: xpr.string, | ||
NumberType: xpr.number, | ||
BooleanType: xpr.boolean, | ||
DateType: xpr.date | ||
StringType: XPR.string, | ||
NumberType: XPR.number, | ||
BooleanType: XPR.boolean, | ||
DateType: XPR.date | ||
}, | ||
@@ -560,0 +560,0 @@ add: function(name, fnObj) { |
@@ -7,3 +7,3 @@ var {DATE_STRING, dateToDays} = require('./date'); | ||
var NATIVE_FUNS = /^id\(|^\([a-zA-Z]|lang\(|local-name|namespace-uri|last\(|name\(|child::|parent::|descendant::|descendant-or-self::|ancestor::|ancestor-or-self::sibling|following::|following-sibling::|preceding-sibling::|preceding::|attribute::/; | ||
var NATIVE_FUNS = /^id\(|^\([a-zA-Z]|lang\(|local-name|namespace-uri|last\(|name\(|child::|parent::|descendant::|descendant-or-self::|ancestor::|ancestor-or-self::sibling|following::|following-sibling::|preceding-sibling::|preceding::|attribute::|^[0-9\+\-\*\(\)\s\\]*$/; | ||
@@ -10,0 +10,0 @@ function isNativeFunction(input) { |
@@ -1,2 +0,2 @@ | ||
const {assertBoolean, assertString} = require('../helpers'); | ||
const {assertBoolean, assertString, assertNumberValue} = require('../helpers'); | ||
@@ -180,3 +180,18 @@ describe('infix operators', () => { | ||
}); | ||
describe('number operations', () => { | ||
it( '*,+,-,mod,div precendence rules are applied correctly', () => { | ||
[ | ||
[ "1+2*3", 7 ], | ||
[ "2*3+1", 7 ], | ||
[ "1-10 mod 3 div 3", 0.6666666666666667 ], | ||
[ "4-3*4+5-1", -4 ], | ||
[ "(4-3)*4+5-1", 8 ], | ||
[ "8 div 2 + 4", 8 ] | ||
].forEach(([expr, expected]) => { | ||
assertNumberValue(expr, expected); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
618058
10460