/*! For license information please see module.js.LICENSE.txt */ define(["@emotion/css","@grafana/data","@grafana/runtime","@grafana/ui","emotion","lodash","moment","react"],((e,t,r,n,a,o,i,s)=>(()=>{var u=[e=>{"use strict";e.exports=s},e=>{"use strict";e.exports=n},e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},e=>{"use strict";e.exports=t},(e,t,r)=>{var n=r(10),a=r(30),o=r(31),i="[object Null]",s="[object Undefined]",u=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?s:i:u&&u in Object(e)?a(e):o(e)}},(e,t,r)=>{var n=r(11),a="object"==typeof self&&self&&self.Object===Object&&self,o=n||a||Function("return this")();e.exports=o},e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},(e,t,r)=>{var n=r(21),a=r(12),o=r(37),i=r(38),s=Object.prototype,u=s.hasOwnProperty,c=n((function(e,t){e=Object(e);var r=-1,n=t.length,c=n>2?t[2]:void 0;for(c&&o(t[0],t[1],c)&&(n=1);++r{e.exports=function(e){return e}},(e,t,r)=>{var n=r(4),a=r(2),o="[object AsyncFunction]",i="[object Function]",s="[object GeneratorFunction]",u="[object Proxy]";e.exports=function(e){if(!a(e))return!1;var t=n(e);return t==i||t==s||t==o||t==u}},(e,t,r)=>{var n=r(5).Symbol;e.exports=n},(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},(e,t,r)=>{var n=r(9),a=r(14);e.exports=function(e){return null!=e&&a(e.length)&&!n(e)}},e=>{var t=9007199254740991;e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=t}},e=>{var t=9007199254740991,r=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var a=typeof e;return!!(n=null==n?t:n)&&("number"==a||"symbol"!=a&&r.test(e))&&e>-1&&e%1==0&&e{e=r.nmd(e);var n=r(5),a=r(44),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o?n.Buffer:void 0,u=(s?s.isBuffer:void 0)||a;e.exports=u},(e,t,r)=>{e=r.nmd(e);var n=r(11),a=t&&!t.nodeType&&t,o=a&&e&&!e.nodeType&&e,i=o&&o.exports===a&&n.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s},function(e){e.exports=function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",a="second",o="minute",i="hour",s="day",u="week",c="month",l="quarter",f="year",p="date",h="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},g=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},m={s:g,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),a=r%60;return(t<=0?"+":"-")+g(n,2,"0")+":"+g(a,2,"0")},m:function e(t,r){if(t.date()1)return e(i[0])}else{var s=t.name;w[s]=t,a=s}return!n&&a&&(b=a),a||!n&&b},E=function(e,t){if(x(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new A(r)},S=m;S.l=k,S.i=x,S.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var A=function(){function y(e){this.$L=k(e.locale,null,!0),this.parse(e)}var g=y.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(S.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(d);if(n){var a=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],a,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],a,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},g.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},g.$utils=function(){return S},g.isValid=function(){return!(this.$d.toString()===h)},g.isSame=function(e,t){var r=E(e);return this.startOf(t)<=r&&r<=this.endOf(t)},g.isAfter=function(e,t){return E(e){"use strict";t.exports=e},e=>{"use strict";e.exports=a},(e,t,r)=>{var n=r(8),a=r(22),o=r(24);e.exports=function(e,t){return o(a(e,t,n),e+"")}},(e,t,r)=>{var n=r(23),a=Math.max;e.exports=function(e,t,r){return t=a(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,s=a(o.length-t,0),u=Array(s);++i{e.exports=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}},(e,t,r)=>{var n=r(25),a=r(36)(n);e.exports=a},(e,t,r)=>{var n=r(26),a=r(27),o=r(8),i=a?function(e,t){return a(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:o;e.exports=i},e=>{e.exports=function(e){return function(){return e}}},(e,t,r)=>{var n=r(28),a=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=a},(e,t,r)=>{var n=r(29),a=r(35);e.exports=function(e,t){var r=a(e,t);return n(r)?r:void 0}},(e,t,r)=>{var n=r(9),a=r(32),o=r(2),i=r(34),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,p=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||a(e))&&(n(e)?p:s).test(i(e))}},(e,t,r)=>{var n=r(10),a=Object.prototype,o=a.hasOwnProperty,i=a.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var a=i.call(e);return n&&(t?e[s]=r:delete e[s]),a}},e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},(e,t,r)=>{var n,a=r(33),o=(n=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},(e,t,r)=>{var n=r(5)["__core-js_shared__"];e.exports=n},e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},e=>{var t=800,r=16,n=Date.now;e.exports=function(e){var a=0,o=0;return function(){var i=n(),s=r-(i-o);if(o=i,s>0){if(++a>=t)return arguments[0]}else a=0;return e.apply(void 0,arguments)}}},(e,t,r)=>{var n=r(12),a=r(13),o=r(15),i=r(2);e.exports=function(e,t,r){if(!i(r))return!1;var s=typeof t;return!!("number"==s?a(r)&&o(t,r.length):"string"==s&&t in r)&&n(r[t],e)}},(e,t,r)=>{var n=r(39),a=r(48),o=r(13);e.exports=function(e){return o(e)?n(e,!0):a(e)}},(e,t,r)=>{var n=r(40),a=r(41),o=r(43),i=r(16),s=r(15),u=r(45),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=o(e),l=!r&&a(e),f=!r&&!l&&i(e),p=!r&&!l&&!f&&u(e),h=r||l||f||p,d=h?n(e.length,String):[],v=d.length;for(var y in e)!t&&!c.call(e,y)||h&&("length"==y||f&&("offset"==y||"parent"==y)||p&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||s(y,v))||d.push(y);return d}},e=>{e.exports=function(e,t){for(var r=-1,n=Array(e);++r{var n=r(42),a=r(6),o=Object.prototype,i=o.hasOwnProperty,s=o.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return a(e)&&i.call(e,"callee")&&!s.call(e,"callee")};e.exports=u},(e,t,r)=>{var n=r(4),a=r(6),o="[object Arguments]";e.exports=function(e){return a(e)&&n(e)==o}},e=>{var t=Array.isArray;e.exports=t},e=>{e.exports=function(){return!1}},(e,t,r)=>{var n=r(46),a=r(47),o=r(17),i=o&&o.isTypedArray,s=i?a(i):n;e.exports=s},(e,t,r)=>{var n=r(4),a=r(14),o=r(6),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&a(e.length)&&!!i[n(e)]}},e=>{e.exports=function(e){return function(t){return e(t)}}},(e,t,r)=>{var n=r(2),a=r(49),o=r(50),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return o(e);var t=a(e),r=[];for(var s in e)("constructor"!=s||!t&&i.call(e,s))&&r.push(s);return r}},e=>{var t=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}},e=>{e.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},e=>{"use strict";e.exports=r},(e,t,r)=>{e.exports=function(){function e(t,r,n){function a(i,s){if(!r[i]){if(!t[i]){if(o)return o(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[i]={exports:{}};t[i][0].call(c.exports,(function(e){return a(t[i][1][e]||e)}),c,c.exports,e,t,r,n)}return r[i].exports}for(var o=void 0,i=0;i0?u+="-"+i(r,!1,s):s&&(u=u.substring(0,u.length-1)+"ieth")}else if(e<1e3){const r=Math.floor(e/100),a=e%100;u=(n?", ":"")+t[r]+" Hundred",a>0?u+=i(a,!0,s):s&&(u+="th")}else{var c=Math.floor(Math.log10(e)/3);c>o.length&&(c=o.length);const t=Math.pow(10,3*c),r=Math.floor(e/t),a=e-r*t;u=(n?", ":"")+i(r,!1,!1)+" "+o[c-1],a>0?u+=i(a,!0,s):s&&(u+="th")}return u};return i(e,!1,n)}const s={};function u(e){const t=e.split(/,\s|\sand\s|[\s\\-]/).map((e=>s[e]));let r=[0];return t.forEach((e=>{if(e<100){let t=r.pop();t>=1e3&&(r.push(t),t=0),r.push(t+e)}else r.push(r.pop()*e)})),r.reduce(((e,t)=>e+t),0)}t.forEach((function(e,t){s[e.toLowerCase()]=t})),r.forEach((function(e,t){s[e.toLowerCase()]=t})),a.forEach((function(e,t){const r=e.toLowerCase();s[r]=10*(t+2),s[r.substring(0,e.length-1)+"ieth"]=s[r]})),s.hundredth=100,o.forEach((function(e,t){const r=e.toLowerCase(),n=Math.pow(10,3*(t+1));s[r]=n,s[r+"th"]=n}));const c=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],l={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function f(e){for(var t=0;t=r[0])return r[1]+f(e-r[0])}return""}function p(e){for(var t=0,r=1,n=e.length-1;n>=0;n--){const a=e[n],o=l[a];o0;)r.unshift(String.fromCharCode((e-1)%26+n)),e=Math.floor((e-1)/26);return r.join("")}function d(e,t){for(var r=t.charCodeAt(0),n=0,a=0;a0){var s=new Array(o+1).join("0");n=s+n}if(48!==r.zeroCode&&(n=e(n).map((e=>String.fromCodePoint(e.codePointAt(0)+r.zeroCode-48))).join("")),r.regular)for(let e=Math.floor((n.length-1)/r.groupingSeparators.position);e>0;e--){const t=n.length-e*r.groupingSeparators.position;n=n.substr(0,t)+r.groupingSeparators.character+n.substr(t)}else r.groupingSeparators.reverse().forEach((e=>{const t=n.length-e.position;n=n.substr(0,t)+e.character+n.substr(t)}));if(r.ordinal){var u={1:"st",2:"nd",3:"rd"}[n[n.length-1]];(!u||n.length>1&&"1"===n[n.length-2])&&(u="th"),n+=u}break;case y.SEQUENCE:throw{code:"D3130",value:r.token}}return a&&(n="-"+n),n}const b=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function w(t){const r={type:"integer",primary:y.DECIMAL,case:g.LOWER,ordinal:!1};let n,a;const o=t.lastIndexOf(";");switch(-1===o?n=t:(n=t.substring(0,o),a=t.substring(o+1),"o"===a[0]&&(r.ordinal=!0)),n){case"A":r.case=g.UPPER;case"a":r.primary=y.LETTERS;break;case"I":r.case=g.UPPER;case"i":r.primary=y.ROMAN;break;case"W":r.case=g.UPPER,r.primary=y.WORDS;break;case"Ww":r.case=g.TITLE,r.primary=y.WORDS;break;case"w":r.primary=y.WORDS;break;default:{let t=null,a=0,o=0,i=[],s=0;if(e(n).map((e=>e.codePointAt(0))).reverse().forEach((e=>{let r=!1;for(let n=0;n=o&&e<=o+9){if(r=!0,a++,s++,null===t)t=o;else if(o!==t)throw{code:"D3131"};break}}r||(35===e?(s++,o++):i.push({position:s,character:String.fromCodePoint(e)}))})),a>0){r.primary=y.DECIMAL,r.zeroCode=t,r.mandatoryDigits=a,r.optionalDigits=o;const e=function(e){if(0===e.length)return 0;const t=e[0].character;for(let r=1;re.position)),n=function(e,t){return 0===t?e:n(t,e%t)},a=r.reduce(n);for(let e=1;e<=r.length;e++)if(-1===r.indexOf(e*a))return 0;return a}(i);e>0?(r.regular=!0,r.groupingSeparators={position:e,character:i[0].character}):(r.regular=!1,r.groupingSeparators=i)}else r.primary=y.SEQUENCE,r.token=n}}return r}const x={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function k(e){var t=[];const r={type:"datetime",parts:t},n=function(r,n){if(n>r){let a=e.substring(r,n);a=a.split("]]").join("]"),t.push({type:"literal",value:a})}};for(var a=0,o=0;o1){var c=i.charAt(i.length-1);-1!=="atco".indexOf(c)?(s.presentation2=c,"o"===c&&(s.ordinal=!0),s.presentation1=i.substring(0,i.length-1)):s.presentation1=i}else s.presentation1=x[s.component];if(void 0===s.presentation1)throw{code:"D3132",value:s.component};if("n"===s.presentation1[0])s.names=g.LOWER;else if("N"===s.presentation1[0])"n"===s.presentation1[1]?s.names=g.TITLE:s.names=g.UPPER;else if(-1!=="YMDdFWwXxHhmsf".indexOf(s.component)){var l=s.presentation1;if(s.presentation2&&(l+=";"+s.presentation2),s.integerFormat=w(l),s.width&&void 0!==s.width.min&&s.integerFormat.mandatoryDigits=2&&(s.n=f)}}"Z"!==s.component&&"z"!==s.component||(s.integerFormat=w(s.presentation1)),t.push(s),a=o+1}o++}return n(a,o),r}const E=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],S=["January","February","March","April","May","June","July","August","September","October","November","December"],A=864e5,O=function(e){const t=Date.UTC(e.year,e.month);var r=new Date(t).getUTCDay();return 0===r&&(r=7),r>4?t+(8-r)*A:t-(r-1)*A},_=function(e,t){return{year:e,month:t,nextMonth:function(){return 11===t?_(e+1,0):_(e,t+1)},previousMonth:function(){return 0===t?_(e-1,11):_(e,t-1)},nextYear:function(){return _(e+1,t)},previousYear:function(){return _(e-1,t)}}},j=function(e,t){return(t-e)/(7*A)+1},T=(e,t)=>{let r;switch(t){case"Y":r=e.getUTCFullYear();break;case"M":r=e.getUTCMonth()+1;break;case"D":r=e.getUTCDate();break;case"d":r=(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(e.getUTCFullYear(),0))/A+1;break;case"F":r=e.getUTCDay(),0===r&&(r=7);break;case"W":{const t=_(e.getUTCFullYear(),0),n=O(t),a=Date.UTC(t.year,e.getUTCMonth(),e.getUTCDate());let o=j(n,a);if(o>52)a>=O(t.nextYear())&&(o=1);else if(o<1){const e=O(t.previousYear());o=j(e,a)}r=Math.floor(o);break}case"w":{const t=_(e.getUTCFullYear(),e.getUTCMonth()),n=O(t),a=Date.UTC(t.year,t.month,e.getUTCDate());let o=j(n,a);if(o>4)a>=O(t.nextMonth())&&(o=1);else if(o<1){const e=O(t.previousMonth());o=j(e,a)}r=Math.floor(o);break}case"X":{const t=_(e.getUTCFullYear(),0),n=O(t),a=O(t.nextYear()),o=e.getTime();r=o=a?t.year+1:t.year;break}case"x":{const t=_(e.getUTCFullYear(),e.getUTCMonth()),n=O(t),a=t.nextMonth(),o=O(a),i=e.getTime();r=i=o?a.month+1:t.month+1;break}case"H":r=e.getUTCHours();break;case"h":r=e.getUTCHours(),r%=12,0===r&&(r=12);break;case"P":r=e.getUTCHours()>=12?"pm":"am";break;case"m":r=e.getUTCMinutes();break;case"s":r=e.getUTCSeconds();break;case"f":r=e.getUTCMilliseconds();break;case"Z":case"z":break;case"C":case"E":r="ISO"}return r};let F=null;function C(e,t,r){var n=0,a=0;if(void 0!==r){const e=parseInt(r);n=Math.floor(e/100),a=e%100}var o=function(e,t){var r=T(e,t.component);if(-1!=="YMDdFWwXxHhms".indexOf(t.component))if("Y"===t.component&&-1!==t.n&&(r%=Math.pow(10,t.n)),t.names){if("M"===t.component||"x"===t.component)r=S[r-1];else{if("F"!==t.component)throw{code:"D3133",value:t.component};r=E[r]}t.names===g.UPPER?r=r.toUpperCase():t.names===g.LOWER&&(r=r.toLowerCase()),t.width&&r.length>t.width.max&&(r=r.substring(0,t.width.max))}else r=m(r,t.integerFormat);else if("f"===t.component)r=m(r,t.integerFormat);else if("Z"===t.component||"z"===t.component){const e=100*n+a;if(t.integerFormat.regular)r=m(e,t.integerFormat);else{const o=t.integerFormat.mandatoryDigits;if(1===o||2===o)r=m(n,t.integerFormat),0!==a&&(r+=":"+v(a,"00"));else{if(3!==o&&4!==o)throw{code:"D3134",value:o};r=m(e,t.integerFormat)}}e>=0&&(r="+"+r),"z"===t.component&&(r="GMT"+r),0===e&&"t"===t.presentation2&&(r="Z")}return r};let i;void 0===t?(null===F&&(F=k("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),i=F):i=k(t);const s=new Date(e+60*(60*n+a)*1e3);let u="";return i.parts.forEach((function(e){"literal"===e.type?u+=e.value:u+=o(s,e)})),u}function D(e){var t={};if("datetime"===e.type)t.type="datetime",t.parts=e.parts.map((function(e){var t={};if("literal"===e.type)t.regex=e.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if("Z"===e.component||"z"===e.component){let r;Array.isArray(e.integerFormat.groupingSeparators)||(r=e.integerFormat.groupingSeparators),t.regex="","z"===e.component&&(t.regex="GMT"),t.regex+="[-+][0-9]+",r&&(t.regex+=r.character+"[0-9]+"),t.parse=function(t){"z"===e.component&&(t=t.substring(3));let n=0,a=0;return r?(n=Number.parseInt(t.substring(0,t.indexOf(r.character))),a=Number.parseInt(t.substring(t.indexOf(r.character)+1))):t.length-1<=2?n=Number.parseInt(t):(n=Number.parseInt(t.substring(0,3)),a=Number.parseInt(t.substring(3))),60*n+a}}else if(e.integerFormat)e.integerFormat.n=e.n,t=D(e.integerFormat);else{t.regex="[a-zA-Z]+";var r={};if("M"===e.component||"x"===e.component)S.forEach((function(t,n){e.width&&e.width.max?r[t.substring(0,e.width.max)]=n+1:r[t]=n+1}));else if("F"===e.component)E.forEach((function(t,n){n>0&&(e.width&&e.width.max?r[t.substring(0,e.width.max)]=n:r[t]=n)}));else{if("P"!==e.component)throw{code:"D3133",value:e.component};r={am:0,AM:0,pm:1,PM:1}}t.parse=function(e){return r[e]}}return t.component=e.component,t}));else{t.type="integer";const r=e.case===g.UPPER;let n;switch(n=e.n&&e.n>0?0===e.optionalDigits?`{${e.n}}`:`{${e.n-e.optionalDigits},${e.n}}`:"+",e.primary){case y.LETTERS:t.regex=r?"[A-Z]+":"[a-z]+",t.parse=function(e){return d(e,r?"A":"a")};break;case y.ROMAN:t.regex=r?"[MDCLXVI]+":"[mdclxvi]+",t.parse=function(e){return p(r?e:e.toUpperCase())};break;case y.WORDS:t.regex="(?:"+Object.keys(s).concat("and","[\\-, ]").join("|")+")+",t.parse=function(e){return u(e.toLowerCase())};break;case y.DECIMAL:t.regex=`[0-9]${n}`,e.ordinal&&(t.regex+="(?:th|st|nd|rd)"),t.parse=function(t){let r=t;return e.ordinal&&(r=t.substring(0,t.length-2)),e.regular?r=r.split(",").join(""):e.groupingSeparators.forEach((e=>{r=r.split(e.character).join("")})),48!==e.zeroCode&&(r=r.split("").map((t=>String.fromCodePoint(t.codePointAt(0)-e.zeroCode+48))).join("")),parseInt(r)};break;case y.SEQUENCE:throw{code:"D3130",value:e.token}}}return t}function P(e,t){if(void 0!==e)return D(w(t)).parse(e)}function I(e,t){const r=D(k(t)),n="^"+r.parts.map((e=>"("+e.regex+")")).join("")+"$";var a=new RegExp(n,"i").exec(e);if(null!==a){const e=161,t=130,n=84,i=72,s=23,u=47,c={};for(let e=1;e{l<<=1,l+=e?1:0},p=e=>!(~e&l||!(e&l));"YXMxWwdD".split("").forEach((e=>f(c[e])));const h=!p(e)&&p(t),d=p(n),v=!d&&p(i);l=0,"PHhmsf".split("").forEach((e=>f(c[e])));const y=!p(s)&&p(u),g=(h?"YD":d?"XxwF":v?"XWF":"YMD")+(y?"Phmsf":"Hmsf"),m=this.environment.timestamp;let b=!1,w=!1;if(g.split("").forEach((e=>{if(void 0===c[e])b?(c[e]=-1!=="MDd".indexOf(e)?1:0,w=!0):c[e]=T(m,e);else if(b=!0,w)throw{code:"D3136"}})),c.M>0?c.M-=1:c.M=0,h){const e=Date.UTC(c.Y,0),t=1e3*(c.d-1)*60*60*24,r=new Date(e+t);c.M=r.getUTCMonth(),c.D=r.getUTCDate()}if(d)throw{code:"D3136"};if(v)throw{code:"D3136"};y&&(c.H=12===c.h?0:c.h,1===c.P&&(c.H+=12));var o=Date.UTC(c.Y,c.M,c.D,c.H,c.m,c.s,c.f);return(c.Z||c.z)&&(o-=60*(c.Z||c.z)*1e3),o}}var N=new RegExp("^\\d{4}(-[01]\\d)*(-[0-3]\\d)*(T[0-2]\\d:[0-5]\\d:[0-5]\\d)*(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function $(e,t){if(void 0!==e){if(void 0===t){if(!N.test(e))throw{stack:(new Error).stack,code:"D3110",value:e};return Date.parse(e)}return I.call(this,e,t)}}function M(e,t,r){if(void 0!==e)return C.call(this,e,t,r)}return{formatInteger:v,parseInteger:P,fromMillis:M,toMillis:$}}();t.exports=a},{"./utils":6}],2:[function(e,t,n){(function(r){(function(){var n=e("./utils");const a=(()=>{"use strict";var e=n.isNumeric,t=n.isArrayOfStrings,a=n.isArrayOfNumbers,o=n.createSequence,i=n.isSequence,s=n.isFunction,u=n.isLambda,c=n.isIterable,l=n.getFunctionArity,f=n.isDeepEqual,p=n.stringToArray;function h(e){if(void 0!==e){var t=0;return e.forEach((function(e){t+=e})),t}}function d(e){return void 0===e?0:e.length}function v(e){if(void 0!==e&&0!==e.length)return Math.max.apply(Math,e)}function y(e){if(void 0!==e&&0!==e.length)return Math.min.apply(Math,e)}function g(e){if(void 0!==e&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),t/e.length}}function m(t,r=!1){if(void 0!==t){var n;if("string"==typeof t)n=t;else if(s(t))n="";else{if("number"==typeof t&&!isFinite(t))throw{code:"D3001",value:t,stack:(new Error).stack};var a=r?2:0;Array.isArray(t)&&t.outerWrapper&&(t=t[0]),n=JSON.stringify(t,(function(t,r){return null!=r&&r.toPrecision&&e(r)?Number(r.toPrecision(15)):r&&s(r)?"":r}),a)}return n}}function b(e,t,r){if(void 0!==e){var n=p(e),a=n.length;if(a+t<0&&(t=0),void 0!==r){if(r<=0)return"";var o=t>=0?t+r:a+t+r;return n.slice(t,o).join("")}return n.slice(t).join("")}}function w(e,t){if(void 0!==e){var r=e.indexOf(t);return r>-1?e.substr(0,r):e}}function x(e,t){if(void 0!==e){var r=e.indexOf(t);return r>-1?e.substr(r+t.length):e}}function k(e){if(void 0!==e)return e.toLowerCase()}function E(e){if(void 0!==e)return e.toUpperCase()}function S(e){if(void 0!==e)return p(e).length}function A(e){if(void 0!==e){var t=e.replace(/[ \t\n\r]+/gm," ");return" "===t.charAt(0)&&(t=t.substring(1))," "===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t}}function O(e,t,r){if(void 0!==e){var n;void 0!==r&&0!==r.length||(r=" ");var a=Math.abs(t)-S(e);if(a>0){var o=new Array(a+1).join(r);r.length>1&&(o=b(o,0,a)),n=t>0?e+o:o+e}else n=e;return n}}function*_(e,t){var r=e.apply(this,[t]);if(c(r)&&(r=yield*r),r&&"number"!=typeof r.start&&"number"!==r.end&&!Array.isArray(r.groups)&&!s(r.next))throw{code:"T1010",stack:(new Error).stack};return r}function*j(e,t){if(void 0!==e)return"string"==typeof t?-1!==e.indexOf(t):void 0!==(yield*_(t,e))}function*T(e,t,r){if(void 0!==e){if(r<0)throw{stack:(new Error).stack,value:r,code:"D3040",index:3};var n=o();if(void 0===r||r>0){var a=0,i=yield*_(t,e);if(void 0!==i)for(;void 0!==i&&(void 0===r||a1&&a>e.groups.length&&(a=parseInt(r.substring(n,n+i-1),10)),isNaN(a))t+="$";else{if(e.groups.length>0){var s=e.groups[a-1];void 0!==s&&(t+=s)}n+=a.toString().length}}a=r.indexOf("$",n)}return t+=r.substring(n)}:r;var i="",s=0;if(void 0===n||n>0){var u=0;if("string"==typeof t){for(var l=e.indexOf(t,s);-1!==l&&(void 0===n||u0)if("string"==typeof t)n=e.split(t,r);else{var a=0,o=yield*_(t,e);if(void 0!==o){for(var i=0;void 0!==o&&(void 0===r||a2)throw{code:"D3080",stack:(new Error).stack};var c=function(e){var t,r,a,o,i=function(){for(var t,r=0;r=0;r--)if(t=e.charAt(r),-1!==s.indexOf(t)&&t!==n["exponent-separator"])return e.substring(r+1)}(),c=e.substring(i.length,e.length-u.length),l=e.indexOf(n["exponent-separator"],i.length);-1===l||l>e.length-u.length?(t=c,r=void 0):(t=c.substring(0,l),r=c.substring(l+1));var f=t.indexOf(n["decimal-separator"]);return-1===f?(a=t,o=u):(a=t.substring(0,f),o=t.substring(f+1)),{prefix:i,suffix:u,activePart:c,mantissaPart:t,exponentPart:r,integerPart:a,fractionalPart:o,subpicture:e}},l=function(e){var t,r,o=e.subpicture,i=o.indexOf(n["decimal-separator"]);i!==o.lastIndexOf(n["decimal-separator"])&&(t="D3081"),o.indexOf(n.percent)!==o.lastIndexOf(n.percent)&&(t="D3082"),o.indexOf(n["per-mille"])!==o.lastIndexOf(n["per-mille"])&&(t="D3083"),-1!==o.indexOf(n.percent)&&-1!==o.indexOf(n["per-mille"])&&(t="D3084");var u=!1;for(r=0;r-1})).length>0&&(t="D3090"),-1!==(l=e.fractionalPart.lastIndexOf(n.digit))&&e.fractionalPart.substring(l).split("").filter((function(e){return a.indexOf(e)>-1})).length>0&&(t="D3091");var f="string"==typeof e.exponentPart;if(f&&e.exponentPart.length>0&&(-1!==o.indexOf(n.percent)||-1!==o.indexOf(n["per-mille"]))&&(t="D3092"),f&&(0===e.exponentPart.length||e.exponentPart.split("").filter((function(e){return-1===a.indexOf(e)})).length>0)&&(t="D3093"),t)throw{code:t,stack:(new Error).stack}},f=function(e){var t=function(t,r){for(var o=[],i=t.indexOf(n["grouping-separator"]);-1!==i;){var s=(r?t.substring(0,i):t.substring(i)).split("").filter((function(e){return-1!==a.indexOf(e)||e===n.digit})).length;o.push(s),i=e.integerPart.indexOf(n["grouping-separator"],i+1)}return o},r=t(e.integerPart),o=function(e){if(0===e.length)return 0;for(var t=function(e,r){return 0===r?e:t(r,e%r)},r=e.reduce(t),n=1;n<=e.length;n++)if(-1===e.indexOf(n*r))return 0;return r}(r),i=t(e.fractionalPart,!0),s=e.integerPart.split("").filter((function(e){return-1!==a.indexOf(e)})).length,u=s,c=e.fractionalPart.split(""),l=c.filter((function(e){return-1!==a.indexOf(e)})).length,f=c.filter((function(e){return-1!==a.indexOf(e)||e===n.digit})).length,p="string"==typeof e.exponentPart;0===s&&0===f&&(p?(l=1,f=1):s=1),p&&0===s&&-1!==e.integerPart.indexOf(n.digit)&&(s=1),0===s&&0===l&&(l=1);var h=0;return p&&(h=e.exponentPart.split("").filter((function(e){return-1!==a.indexOf(e)})).length),{integerPartGroupingPositions:r,regularGrouping:o,minimumIntegerPartSize:s,scalingFactor:u,prefix:e.prefix,fractionalPartGroupingPositions:i,minimumFactionalPartSize:l,maximumFactionalPartSize:f,minimumExponentSize:h,suffix:e.suffix,picture:e.subpicture}},p=u.map(c);p.forEach(l);var h,d,v,y,g=p.map(f),m=n["minus-sign"],b=n["zero-digit"],w=n["decimal-separator"],x=n["grouping-separator"];if(1===g.length&&(g.push(JSON.parse(JSON.stringify(g[0]))),g[1].prefix=m+g[1].prefix),d=-1!==(h=e>=0?g[0]:g[1]).picture.indexOf(n.percent)?100*e:-1!==h.picture.indexOf(n["per-mille"])?1e3*e:e,0===h.minimumExponentSize)v=d;else{var k=Math.pow(10,h.scalingFactor),E=Math.pow(10,h.scalingFactor-1);for(v=d,y=0;vk;)v/=10,y+=1}var S=function(e,t){var r=Math.abs(e).toFixed(t);return"0"!==b&&(r=r.split("").map((function(e){return e>="0"&&e<="9"?a[e.charCodeAt(0)-48]:e})).join("")),r},A=S(W(v,h.maximumFactionalPartSize),h.maximumFactionalPartSize),O=A.indexOf(".");for(-1===O?A+=w:A=A.replace(".",w);A.charAt(0)===b;)A=A.substring(1);for(;A.charAt(A.length-1)===b;)A=A.substring(0,A.length-1);O=A.indexOf(w);var _=h.minimumIntegerPartSize-O,j=h.minimumFactionalPartSize-(A.length-O-1);if(A=(_>0?new Array(_+1).join(b):"")+A,A+=j>0?new Array(j+1).join(b):"",O=A.indexOf(w),h.regularGrouping>0)for(var T=Math.floor((O-1)/h.regularGrouping),F=1;F<=T;F++)A=[A.slice(0,O-F*h.regularGrouping),x,A.slice(O-F*h.regularGrouping)].join("");else h.integerPartGroupingPositions.forEach((function(e){A=[A.slice(0,O-e),x,A.slice(O-e)].join(""),O++}));if(O=A.indexOf(w),h.fractionalPartGroupingPositions.forEach((function(e){A=[A.slice(0,e+O+1),x,A.slice(e+O+1)].join("")})),O=A.indexOf(w),-1!==h.picture.indexOf(w)&&O!==A.length-1||(A=A.substring(0,A.length-1)),void 0!==y){var C=S(y,0);(_=h.minimumExponentSize-C.length)>0&&(C=new Array(_+1).join(b)+C),A=A+n["exponent-separator"]+(y<0?m:"")+C}return A=h.prefix+A+h.suffix}}function z(e,t){if(void 0!==e){if(e=W(e),(t=void 0===t?10:W(t))<2||t>36)throw{code:"D3100",stack:(new Error).stack,value:t};return e.toString(t)}}function U(e){var t;if(void 0!==e){if("number"==typeof e)t=e;else if("string"==typeof e&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(e)&&!isNaN(parseFloat(e))&&isFinite(e))t=parseFloat(e);else if(!0===e)t=1;else{if(!1!==e)throw{code:"D3030",value:e,stack:(new Error).stack,index:1};t=0}return t}}function q(e){if(void 0!==e)return Math.abs(e)}function B(e){if(void 0!==e)return Math.floor(e)}function G(e){if(void 0!==e)return Math.ceil(e)}function W(e,t){var r;if(void 0!==e){if(t){var n=e.toString().split("e");e=+(n[0]+"e"+(n[1]?+n[1]+t:t))}var a=(r=Math.round(e))-e;return.5===Math.abs(a)&&1===Math.abs(r%2)&&(r-=1),t&&(n=r.toString().split("e"),r=+(n[0]+"e"+(n[1]?+n[1]-t:-t))),Object.is(r,-0)&&(r=0),r}}function Y(e){if(void 0!==e){if(e<0)throw{stack:(new Error).stack,code:"D3060",index:1,value:e};return Math.sqrt(e)}}function H(e,t){var r;if(void 0!==e){if(r=Math.pow(e,t),!isFinite(r))throw{stack:(new Error).stack,code:"D3061",index:1,value:e,exp:t};return r}}function J(){return Math.random()}function V(t){if(void 0!==t){var r=!1;return Array.isArray(t)?1===t.length?r=V(t[0]):t.length>1&&(r=t.filter((function(e){return V(e)})).length>0):"string"==typeof t?t.length>0&&(r=!0):e(t)?0!==t&&(r=!0):null!==t&&"object"==typeof t?Object.keys(t).length>0&&(r=!0):"boolean"==typeof t&&!0===t&&(r=!0),r}}function Z(e){if(void 0!==e)return!V(e)}function Q(e,t,r,n){var a=[t],o=l(e);return o>=2&&a.push(r),o>=3&&a.push(n),a}function*X(e,t){if(void 0!==e){for(var r=o(),n=0;ne[n]));e.push(a)}return e}function*re(e,t,r){if(void 0!==e){var n,a,o=l(t);if(o<2)throw{stack:(new Error).stack,code:"D3050",index:1};for(void 0===r&&e.length>0?(n=e[0],a=1):(n=r,a=0);a=3&&i.push(a),o>=4&&i.push(e),n=yield*t.apply(this,i),a++}return n}}function ne(e){var t=o();if(Array.isArray(e)){var r={};e.forEach((function(e){ne(e).forEach((function(e){r[e]=!0}))})),t=ne(r)}else null===e||"object"!=typeof e||u(e)||Object.keys(e).forEach((e=>t.push(e)));return t}function ae(e,t){var r;if(Array.isArray(e)){r=o();for(var n=0;nr.push(e))):r.push(a))}}else null!==e&&"object"==typeof e&&(r=e[t]);return r}function oe(e,t){return void 0===e?t:void 0===t?e:(Array.isArray(e)||(e=o(e)),Array.isArray(t)||(t=[t]),e.concat(t))}function ie(e){return void 0!==e}function se(e){var t=o();if(Array.isArray(e))e.forEach((function(e){t=oe(t,se(e))}));else if(null===e||"object"!=typeof e||u(e))t=e;else for(var r in e){var n={};n[r]=e[r],t.push(n)}return t}function ue(e){if(void 0!==e){var t={};return e.forEach((function(e){for(var r in e)t[r]=e[r]})),t}}function ce(e){if(void 0!==e){if(e.length<=1)return e;for(var t=e.length,r=new Array(t),n=0;nt}}else n=r;var o=function*(e,t){var r=function*(e,t,a){0===t.length?Array.prototype.push.apply(e,a):0===a.length?Array.prototype.push.apply(e,t):(yield*n(t[0],a[0]))?(e.push(a[0]),yield*r(e,t,a.slice(1))):(e.push(t[0]),yield*r(e,t.slice(1),a))},a=[];return yield*r(a,e,t),a},i=function*(e){if(!Array.isArray(e)||e.length<=1)return e;var t=Math.floor(e.length/2),r=e.slice(0,t),n=e.slice(t);return r=yield*i(r),n=yield*i(n),yield*o(r,n)};return yield*i(e)}}function ve(e){if(void 0!==e){if(e.length<=1)return e;for(var t=new Array(e.length),r=0;rl.push(e)))})),l}function*w(e,t,r){for(var n=t,a=0;a({"@":e}))));for(var l=0;l":case">=":n=P(a,s,o);break;case"&":n=M(a,s);break;case"..":n=z(a,s);break;case"in":n=I(a,s)}}catch(t){throw t.position=e.position,t.token=o,t}return n}function*S(t,r,n){var o;switch(t.value){case"-":if(void 0===(o=yield*y(t.expression,r,n)))o=void 0;else{if(!e(o))throw{code:"D1002",stack:(new Error).stack,position:t.position,token:t.value,value:o};o=-o}break;case"[":o=[];for(var i=0;i0&&(t=t[0]),null!==t&&"object"==typeof t&&Object.keys(t).forEach((function(e){var n=t[e];Array.isArray(n)?(n=j(n),r=a.append(r,n)):r.push(n)})),r}function j(e,t){return void 0===t&&(t=[]),Array.isArray(e)?e.forEach((function(e){j(e,t)})):t.push(e),t}function T(e,t){var r,n=u();return void 0!==t&&(F(t,n),r=1===n.length?n[0]:n),r}function F(e,t){Array.isArray(e)||t.push(e),Array.isArray(e)?e.forEach((function(e){F(e,t)})):null!==e&&"object"==typeof e&&Object.keys(e).forEach((function(r){F(e[r],t)}))}function C(t,r,n){var a;if(void 0!==t&&!e(t))throw{code:"T2001",stack:(new Error).stack,value:t};if(void 0!==r&&!e(r))throw{code:"T2002",stack:(new Error).stack,value:r};if(void 0===t||void 0===r)return a;switch(n){case"+":a=t+r;break;case"-":a=t-r;break;case"*":a=t*r;break;case"/":a=t/r;break;case"%":a=t%r}return a}function D(e,t,r){var n;if(void 0===e||void 0===t)return!1;switch(r){case"=":n=d(e,t);break;case"!=":n=!d(e,t)}return n}function P(e,t,r){var n,a=typeof e,o=typeof t;if("undefined"!==a&&"string"!==a&&"number"!==a||"undefined"!==o&&"string"!==o&&"number"!==o)throw{code:"T2010",stack:(new Error).stack,value:"string"!==a&&"number"!==a?e:t};if("undefined"!==a&&"undefined"!==o){if(a!==o)throw{code:"T2009",stack:(new Error).stack,value:e,value2:t};switch(r){case"<":n=e":n=e>t;break;case">=":n=e>=t}return n}}function I(e,t){var r=!1;if(void 0===e||void 0===t)return!1;Array.isArray(t)||(t=[t]);for(var n=0;nt)return r;var n=t-e+1;if(n>1e7)throw{code:"D2014",stack:(new Error).stack,value:n};r=new Array(n);for(var a=e,o=0;a<=t;a++,o++)r[o]=a;return r.sequence=!0,r}function*U(e,t,r){var n=yield*y(e.rhs,t,r);return r.bind(e.lhs.value,n),n}function*q(e,t,r){var n,o=yield*y(e.condition,t,r);return a.boolean(o)?n=yield*y(e.then,t,r):void 0!==e.else&&(n=yield*y(e.else,t,r)),n}function*B(e,t,r){for(var n,a=le(r),o=0;o1)for(var s=1;s=n.length)){var a=r(n,t.lastIndex);if(a&&""===a.match)throw{code:"D1004",stack:(new Error).stack,position:e.position,value:e.value.source};return a}}}return o};return r}function W(e,t,r){return""===e.value?t&&t.outerWrapper?t[0]:t:r.lookup(e.value)}function*Y(e,t,r){var n=t,o=!!t.tupleStream,i=function*(t,n){for(var a=0,i=0;0===a&&i")}var J=i("function($f, $g) { function($x){ $g($f($x)) } }");function*V(e,t,r){var n,a=yield*y(e.lhs,t,r);if("function"===e.rhs.type)n=yield*Z(e.rhs,t,r,{context:a});else{var o=yield*y(e.rhs,t,r);if(!l(o))throw{code:"T2006",stack:(new Error).stack,position:e.position,value:o};if(l(a)){var i=yield*y(J,null,r);n=yield*Q(i,[a,o],null,r)}else n=yield*Q(o,[a],null,r)}return n}function*Z(e,t,r,n){var a,o=yield*y(e.procedure,t,r);if(void 0===o&&"path"===e.procedure.type&&r.lookup(e.procedure.steps[0].value))throw{code:"T1005",stack:(new Error).stack,position:e.position,token:e.procedure.steps[0].value};var i=[];void 0!==n&&i.push(n.context);for(var s=0;s:n>")),v.bind("count",se(a.count,"")),v.bind("max",se(a.max,":n>")),v.bind("min",se(a.min,":n>")),v.bind("average",se(a.average,":n>")),v.bind("string",se(a.string,"")),v.bind("substring",se(a.substring,"")),v.bind("substringBefore",se(a.substringBefore,"")),v.bind("substringAfter",se(a.substringAfter,"")),v.bind("lowercase",se(a.lowercase,"")),v.bind("uppercase",se(a.uppercase,"")),v.bind("length",se(a.length,"")),v.bind("trim",se(a.trim,"")),v.bind("pad",se(a.pad,"")),v.bind("match",se(a.match,"n?:a>")),v.bind("contains",se(a.contains,"")),v.bind("replace",se(a.replace,"")),v.bind("split",se(a.split,">")),v.bind("join",se(a.join,"s?:s>")),v.bind("formatNumber",se(a.formatNumber,"")),v.bind("formatBase",se(a.formatBase,"")),v.bind("formatInteger",se(n.formatInteger,"")),v.bind("parseInteger",se(n.parseInteger,"")),v.bind("number",se(a.number,"<(nsb)-:n>")),v.bind("floor",se(a.floor,"")),v.bind("ceil",se(a.ceil,"")),v.bind("round",se(a.round,"")),v.bind("abs",se(a.abs,"")),v.bind("sqrt",se(a.sqrt,"")),v.bind("power",se(a.power,"")),v.bind("random",se(a.random,"<:n>")),v.bind("boolean",se(a.boolean,"")),v.bind("not",se(a.not,"")),v.bind("map",se(a.map,"")),v.bind("zip",se(a.zip,"")),v.bind("filter",se(a.filter,"")),v.bind("single",se(a.single,"")),v.bind("reduce",se(a.foldLeft,"")),v.bind("sift",se(a.sift,"")),v.bind("keys",se(a.keys,">")),v.bind("lookup",se(a.lookup,"")),v.bind("append",se(a.append,"")),v.bind("exists",se(a.exists,"")),v.bind("spread",se(a.spread,">")),v.bind("merge",se(a.merge,":o>")),v.bind("reverse",se(a.reverse,"")),v.bind("each",se(a.each,"")),v.bind("error",se(a.error,"")),v.bind("assert",se(a.assert,"")),v.bind("type",se(a.type,"")),v.bind("sort",se(a.sort,"")),v.bind("shuffle",se(a.shuffle,"")),v.bind("distinct",se(a.distinct,"")),v.bind("base64encode",se(a.base64encode,"")),v.bind("base64decode",se(a.base64decode,"")),v.bind("encodeUrlComponent",se(a.encodeUrlComponent,"")),v.bind("encodeUrl",se(a.encodeUrl,"")),v.bind("decodeUrlComponent",se(a.decodeUrlComponent,"")),v.bind("decodeUrl",se(a.decodeUrl,"")),v.bind("eval",se(ue,"")),v.bind("toMillis",se(n.toMillis,"")),v.bind("fromMillis",se(n.fromMillis,"")),v.bind("clone",se(ce,"<(oa)-:o>"));var fe={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e6. Attempted to allocate {{value}}.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function pe(e){var t=fe[e.code];if(void 0!==t){var r=t.replace(/\{\{\{([^}]+)}}}/g,(function(){return e[arguments[1]]}));r=r.replace(/\{\{([^}]+)}}/g,(function(){return JSON.stringify(e[arguments[1]])})),e.message=r}}function he(e,t){var r,a;try{r=i(e,t&&t.recover),a=r.errors,delete r.errors}catch(e){throw pe(e),e}var o=le(v),s=new Date;return o.bind("now",se((function(e,t){return n.fromMillis(s.getTime(),e,t)}),"")),o.bind("millis",se((function(){return s.getTime()}),"<:n>")),t&&t.RegexEngine?he.RegexEngine=t.RegexEngine:he.RegexEngine=RegExp,{evaluate:function(e,t,n){if(void 0!==a){var i={code:"S0500",position:0};throw pe(i),i}var l,f,p;if(void 0!==t)for(var h in l=le(o),t)l.bind(h,t[h]);else l=o;if(l.bind("$",e),s=new Date,l.timestamp=s,Array.isArray(e)&&!c(e)&&((e=u(e)).outerWrapper=!0),"function"==typeof n){l.async=!0;var d=function(e){pe(e),n(e,null)},v=function(e){(f=p.next(e)).done?n(null,f.value):f.value.then(v).catch(d)};p=y(r,e,l),(f=p.next()).value.then(v).catch(d)}else try{for(p=y(r,e,l),f=p.next();!f.done;)f=p.next(f.value);return f.value}catch(i){throw pe(i),i}},assign:function(e,t){o.bind(e,t)},registerFunction:function(e,t,r){var n=se(t,r);o.bind(e,n)},ast:function(){return r},errors:function(){return a}}}return he.parser=i,he}();t.exports=u},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(e,t,r){var n=e("./signature");const a=(()=>{"use strict";var e={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},t={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},r=function(r){var n=0,a=r.length,o=function(e,t){return{type:e,value:t,position:n}},i=function(){for(var e,t,o=n,i=0;n=a)return null;for(var c=r.charAt(n);n-1;)n++,c=r.charAt(n);if("/"===c&&"*"===r.charAt(n+1)){var l=n;for(n+=2,c=r.charAt(n);"*"!==c||"/"!==r.charAt(n+1);)if(c=r.charAt(++n),n>=a)throw{code:"S0106",stack:(new Error).stack,position:l};return n+=2,c=r.charAt(n),s(u)}if(!0!==u&&"/"===c)return n++,o("regex",i());if("."===c&&"."===r.charAt(n+1))return n+=2,o("operator","..");if(":"===c&&"="===r.charAt(n+1))return n+=2,o("operator",":=");if("!"===c&&"="===r.charAt(n+1))return n+=2,o("operator","!=");if(">"===c&&"="===r.charAt(n+1))return n+=2,o("operator",">=");if("<"===c&&"="===r.charAt(n+1))return n+=2,o("operator","<=");if("*"===c&&"*"===r.charAt(n+1))return n+=2,o("operator","**");if("~"===c&&">"===r.charAt(n+1))return n+=2,o("operator","~>");if(Object.prototype.hasOwnProperty.call(e,c))return n++,o("operator",c);if('"'===c||"'"===c){var f=c;n++;for(var p="";n-1||Object.prototype.hasOwnProperty.call(e,b)){if("$"===r.charAt(n))return v=r.substring(n+1,w),n=w,o("variable",v);switch(v=r.substring(n,w),n=w,v){case"or":case"in":case"and":return o("operator",v);case"true":return o("value",!0);case"false":return o("value",!1);case"null":return o("value",null);default:return n===a&&""===v?null:o("name",v)}}else w++};return s};return function(t,a){var o,i,s={},u=[],c=function(){var e=[];"(end)"!==o.id&&e.push({type:o.type,value:o.value,position:o.position});for(var t=i();null!==t;)e.push(t),t=i();return e},l={nud:function(){var e={code:"S0211",token:this.value,position:this.position};if(a)return e.remaining=c(),e.type="error",u.push(e),e;throw e.stack=(new Error).stack,e}},f=function(e,t){var r=s[e];return t=t||0,r?t>=r.lbp&&(r.lbp=t):((r=Object.create(l)).id=r.value=e,r.lbp=t,s[e]=r),r},p=function(e){if(a){e.remaining=c(),u.push(e);var t=s["(error)"];return(o=Object.create(t)).error=e,o.type="(error)",o}throw e.stack=(new Error).stack,e},h=function(e,r){if(e&&o.id!==e){var n={code:"(end)"===o.id?"S0203":"S0202",position:o.position,token:o.value,value:e};return p(n)}var a=i(r);if(null===a)return(o=s["(end)"]).position=t.length,o;var u,c=a.value,l=a.type;switch(l){case"name":case"variable":u=s["(name)"];break;case"operator":if(!(u=s[c]))return p({code:"S0204",stack:(new Error).stack,position:a.position,token:c});break;case"string":case"number":case"value":u=s["(literal)"];break;case"regex":l="regex",u=s["(regex)"];break;default:return p({code:"S0205",stack:(new Error).stack,position:a.position,token:c})}return(o=Object.create(u)).value=c,o.type=l,o.position=a.position,o},d=function(e){var t,r=o;for(h(null,!0),t=r.nud();e"),y("!="),y("<="),y(">="),y("&"),y("and"),y("or"),y("in"),v("and"),v("or"),v("in"),m("-"),y("~>"),g("(error)",10,(function(e){return this.lhs=e,this.error=o.error,this.remaining=c(),this.type="error",this})),m("*",(function(){return this.type="wildcard",this})),m("**",(function(){return this.type="descendant",this})),m("%",(function(){return this.type="parent",this})),y("(",e["("],(function(e){if(this.procedure=e,this.type="function",this.arguments=[],")"!==o.id)for(;"operator"===o.type&&"?"===o.id?(this.type="partial",this.arguments.push(o),h("?")):this.arguments.push(d(0)),","===o.id;)h(",");if(h(")",!0),"name"===e.type&&("function"===e.value||"λ"===e.value)){if(this.arguments.forEach((function(e,t){if("variable"!==e.type)return p({code:"S0208",stack:(new Error).stack,position:e.position,token:e.value,value:t+1})})),this.type="lambda","<"===o.id){for(var t=o.position,r=1,a="<";r>0&&"{"!==o.id&&"(end)"!==o.id;){var i=h();">"===i.id?r--:"<"===i.id&&r++,a+=i.value}h(">");try{this.signature=n(a)}catch(e){return e.position=t+e.offset,p(e)}}h("{"),this.body=d(0),h("}")}return this})),m("(",(function(){for(var e=[];")"!==o.id&&(e.push(d(0)),";"===o.id);)h(";");return h(")",!0),this.type="block",this.expressions=e,this})),m("[",(function(){var e=[];if("]"!==o.id)for(;;){var t=d(0);if(".."===o.id){var r={type:"binary",value:"..",position:o.position,lhs:t};h(".."),r.rhs=d(0),t=r}if(e.push(t),","!==o.id)break;h(",")}return h("]",!0),this.expressions=e,this.type="unary",this})),y("[",e["["],(function(t){if("]"===o.id){for(var r=t;r&&"binary"===r.type&&"["===r.value;)r=r.lhs;return r.keepArray=!0,h("]"),t}return this.lhs=t,this.rhs=d(e["]"]),this.type="binary",h("]",!0),this})),y("^",e["^"],(function(e){h("(");for(var t=[];;){var r={descending:!1};if("<"===o.id?h("<"):">"===o.id&&(r.descending=!0,h(">")),r.expression=d(0),t.push(r),","!==o.id)break;h(",")}return h(")"),this.lhs=e,this.rhs=t,this.type="binary",this}));var b=function(e){var t=[];if("}"!==o.id)for(;;){var r=d(0);h(":");var n=d(0);if(t.push([r,n]),","!==o.id)break;h(",")}return h("}",!0),void 0===e?(this.lhs=t,this.type="unary"):(this.lhs=e,this.rhs=t,this.type="binary"),this};m("{",b),y("{",e["{"],b),g(":=",e[":="],(function(t){return"variable"!==t.type?p({code:"S0212",stack:(new Error).stack,position:t.position,token:t.value}):(this.lhs=t,this.rhs=d(e[":="]-1),this.type="binary",this)})),y("@",e["@"],(function(t){return this.lhs=t,this.rhs=d(e["@"]),"variable"!==this.rhs.type?p({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)})),y("#",e["#"],(function(t){return this.lhs=t,this.rhs=d(e["#"]),"variable"!==this.rhs.type?p({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)})),y("?",e["?"],(function(e){return this.type="condition",this.condition=e,this.then=d(0),":"===o.id&&(h(":"),this.else=d(0)),this})),m("|",(function(){return this.type="transform",this.pattern=d(0),h("|"),this.update=d(0),","===o.id&&(h(","),this.delete=d(0)),h("|"),this}));var w=function(e){var t;if("function"!==e.type||e.predicate)if("condition"===e.type)e.then=w(e.then),void 0!==e.else&&(e.else=w(e.else)),t=e;else if("block"===e.type){var r=e.expressions.length;r>0&&(e.expressions[r-1]=w(e.expressions[r-1])),t=e}else t=e;else{var n={type:"lambda",thunk:!0,arguments:[],position:e.position};n.body=e,t=n}return t},x=0,k=0,E=[],S=function(e,t){switch(e.type){case"name":case"wildcard":t.level--,0===t.level&&(void 0===e.ancestor||(E[t.index].slot.label=e.ancestor.label),e.ancestor=t,e.tuple=!0);break;case"parent":t.level++;break;case"block":e.expressions.length>0&&(e.tuple=!0,t=S(e.expressions[e.expressions.length-1],t));break;case"path":e.tuple=!0;var r=e.steps.length-1;for(t=S(e.steps[r--],t);t.level>0&&r>=0;)t=S(e.steps[r--],t);break;default:throw{code:"S0217",token:e.type,position:e.position}}return t},A=function(e,t){if(void 0!==t.seekingParent||"parent"===t.type){var r=void 0!==t.seekingParent?t.seekingParent:[];"parent"===t.type&&r.push(t.slot),void 0===e.seekingParent?e.seekingParent=r:Array.prototype.push.apply(e.seekingParent,r)}},O=function(e){var t=e.steps.length-1,r=e.steps[t],n=void 0!==r.seekingParent?r.seekingParent:[];"parent"===r.type&&n.push(r.slot);for(var a=0;a0;){if(t<0){void 0===e.seekingParent?e.seekingParent=[o]:e.seekingParent.push(o);break}for(var i=e.steps[t--];t>=0&&i.focus&&e.steps[t].focus;)i=e.steps[t--];o=S(i,o)}}},_=function(e){var t;switch(e.type){case"binary":switch(e.value){case".":var r=_(e.lhs);t="path"===r.type?r:{type:"path",steps:[r]},"parent"===r.type&&(t.seekingParent=[r.slot]);var n=_(e.rhs);"function"===n.type&&"path"===n.procedure.type&&1===n.procedure.steps.length&&"name"===n.procedure.steps[0].type&&"function"===t.steps[t.steps.length-1].type&&(t.steps[t.steps.length-1].nextFunction=n.procedure.steps[0].value),"path"===n.type?Array.prototype.push.apply(t.steps,n.steps):(void 0!==n.predicate&&(n.stages=n.predicate,delete n.predicate),t.steps.push(n)),t.steps.filter((function(e){if("number"===e.type||"value"===e.type)throw{code:"S0213",stack:(new Error).stack,position:e.position,value:e.value};return"string"===e.type})).forEach((function(e){e.type="name"})),t.steps.filter((function(e){return!0===e.keepArray})).length>0&&(t.keepSingletonArray=!0);var o=t.steps[0];"unary"===o.type&&"["===o.value&&(o.consarray=!0);var i=t.steps[t.steps.length-1];"unary"===i.type&&"["===i.value&&(i.consarray=!0),O(t);break;case"[":var s=t=_(e.lhs),c="predicate";if("path"===t.type&&(s=t.steps[t.steps.length-1],c="stages"),void 0!==s.group)throw{code:"S0209",stack:(new Error).stack,position:e.position};void 0===s[c]&&(s[c]=[]);var l=_(e.rhs);void 0!==l.seekingParent&&(l.seekingParent.forEach((e=>{1===e.level?S(s,e):e.level--})),A(s,l)),s[c].push({type:"filter",expr:l,position:e.position});break;case"{":if(void 0!==(t=_(e.lhs)).group)throw{code:"S0210",stack:(new Error).stack,position:e.position};t.group={lhs:e.rhs.map((function(e){return[_(e[0]),_(e[1])]})),position:e.position};break;case"^":"path"!==(t=_(e.lhs)).type&&(t={type:"path",steps:[t]});var f={type:"sort",position:e.position};f.terms=e.rhs.map((function(e){var t=_(e.expression);return A(f,t),{descending:e.descending,expression:t}})),t.steps.push(f),O(t);break;case":=":(t={type:"bind",value:e.value,position:e.position}).lhs=_(e.lhs),t.rhs=_(e.rhs),A(t,t.rhs);break;case"@":if(t=_(e.lhs),s=t,"path"===t.type&&(s=t.steps[t.steps.length-1]),void 0!==s.stages||void 0!==s.predicate)throw{code:"S0215",stack:(new Error).stack,position:e.position};if("sort"===s.type)throw{code:"S0216",stack:(new Error).stack,position:e.position};e.keepArray&&(s.keepArray=!0),s.focus=e.rhs.value,s.tuple=!0;break;case"#":t=_(e.lhs),s=t,"path"===t.type?s=t.steps[t.steps.length-1]:(t={type:"path",steps:[t]},void 0!==s.predicate&&(s.stages=s.predicate,delete s.predicate)),void 0===s.stages?s.index=e.rhs.value:s.stages.push({type:"index",value:e.rhs.value,position:e.position}),s.tuple=!0;break;case"~>":(t={type:"apply",value:e.value,position:e.position}).lhs=_(e.lhs),t.rhs=_(e.rhs);break;default:(t={type:e.type,value:e.value,position:e.position}).lhs=_(e.lhs),t.rhs=_(e.rhs),A(t,t.lhs),A(t,t.rhs)}break;case"unary":t={type:e.type,value:e.value,position:e.position},"["===e.value?t.expressions=e.expressions.map((function(e){var r=_(e);return A(t,r),r})):"{"===e.value?t.lhs=e.lhs.map((function(e){var r=_(e[0]);A(t,r);var n=_(e[1]);return A(t,n),[r,n]})):(t.expression=_(e.expression),"-"===e.value&&"number"===t.expression.type?(t=t.expression).value=-t.value:A(t,t.expression));break;case"function":case"partial":(t={type:e.type,name:e.name,value:e.value,position:e.position}).arguments=e.arguments.map((function(e){var r=_(e);return A(t,r),r})),t.procedure=_(e.procedure);break;case"lambda":t={type:e.type,arguments:e.arguments,signature:e.signature,position:e.position};var p=_(e.body);t.body=w(p);break;case"condition":(t={type:e.type,position:e.position}).condition=_(e.condition),A(t,t.condition),t.then=_(e.then),A(t,t.then),void 0!==e.else&&(t.else=_(e.else),A(t,t.else));break;case"transform":(t={type:e.type,position:e.position}).pattern=_(e.pattern),t.update=_(e.update),void 0!==e.delete&&(t.delete=_(e.delete));break;case"block":(t={type:e.type,position:e.position}).expressions=e.expressions.map((function(e){var r=_(e);return A(t,r),(r.consarray||"path"===r.type&&r.steps[0].consarray)&&(t.consarray=!0),r}));break;case"name":t={type:"path",steps:[e]},e.keepArray&&(t.keepSingletonArray=!0);break;case"parent":t={type:"parent",slot:{label:"!"+x++,level:1,index:k++}},E.push(t);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":t=e;break;case"operator":if("and"===e.value||"or"===e.value||"in"===e.value)e.type="name",t=_(e);else{if("?"!==e.value)throw{code:"S0201",stack:(new Error).stack,position:e.position,token:e.value};t=e}break;case"error":t=e,e.lhs&&(t=_(e.lhs));break;default:var h="S0206";"(end)"===e.id&&(h="S0207");var d={code:h,position:e.position,token:e.value};if(a)return u.push(d),{type:"error",error:d};throw d.stack=(new Error).stack,d}return e.keepArray&&(t.keepArray=!0),t};i=r(t),h();var j=d(0);if("(end)"!==o.id){var T={code:"S0201",position:o.position,token:o.value};p(T)}if("parent"===(j=_(j)).type||void 0!==j.seekingParent)throw{code:"S0217",token:j.type,position:j.position};return u.length>0&&(j.errors=u),j}})();t.exports=a},{"./signature":5}],5:[function(e,t,r){var n=e("./utils");const a=(()=>{"use strict";var e={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function t(t){for(var r=1,a=[],o={},i=o;r");i.subtype=t.substring(r+1,p),r=p}r++}var h="^"+a.map((function(e){return"("+e.regex+")"})).join("")+"$",d=new RegExp(h),v=function(e){var t;if(n.isFunction(e))t="f";else switch(typeof e){case"string":t="s";break;case"number":t="n";break;case"boolean":t="b";break;case"object":t=null===e?"l":Array.isArray(e)?"a":"o";break;default:t="m"}return t},y=function(e,t){for(var r="^",n=0,o=0;o0){var o=v(u[0]);a=o===n.subtype.charAt(0)&&0===u.filter((function(e){return v(e)!==o})).length}if(!a)throw{code:"T0412",stack:(new Error).stack,value:u,index:s+1,type:e[n.subtype]};"a"!==r&&(u=[u])}i.push(u),s++}else i.push(u),s++}))})),i}y(t,n)}}}return t})();t.exports=a},{"./utils":6}],6:[function(e,t,r){const n=(()=>{"use strict";function e(e){var t=!1;if("number"==typeof e&&(t=!isNaN(e))&&!isFinite(e))throw{code:"D1001",value:e,stack:(new Error).stack};return t}function t(e){var t=!1;return Array.isArray(e)&&(t=0===e.filter((function(e){return"string"!=typeof e})).length),t}function r(t){var r=!1;return Array.isArray(t)&&(r=0===t.filter((function(t){return!e(t)})).length),r}function n(){var e=[];return e.sequence=!0,1===arguments.length&&e.push(arguments[0]),e}function a(e){return!0===e.sequence&&Array.isArray(e)}function o(e){return e&&(!0===e._jsonata_function||!0===e._jsonata_lambda)||"function"==typeof e}function i(e){return"number"==typeof e.arity?e.arity:"function"==typeof e.implementation?e.implementation.length:"number"==typeof e.length?e.length:e.arguments.length}function s(e){return e&&!0===e._jsonata_lambda}var u=("function"==typeof Symbol?Symbol:{}).iterator||"@@iterator";function c(e){return"object"==typeof e&&null!==e&&u in e&&"next"in e&&"function"==typeof e.next}function l(e,t){if(e===t)return!0;if("object"==typeof e&&"object"==typeof t&&null!==e&&null!==t){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var r=0;r{"use strict";function t(){var e=Object.create(null),t=0,r=0,n=0,a=!1;function o(t){n--,delete e[t]}this.put=function(t,r,a,i){if(void 0!==a&&("number"!=typeof a||isNaN(a)||a<=0))throw new Error("Cache timeout must be a positive number");if(void 0!==i&&"function"!=typeof i)throw new Error("Cache timeout callback must be a function");var s=e[t];s?clearTimeout(s.timeout):n++;var u={value:r,expire:a+Date.now()};return isNaN(u.expire)||(u.timeout=setTimeout(function(){o(t),i&&i(t,r)}.bind(this),a)),e[t]=u,r},this.del=function(t){var r=!0,n=e[t];return n?(clearTimeout(n.timeout),!isNaN(n.expire)&&n.expire=Date.now())return a&&t++,i.value;a&&r++,n--,delete e[o]}else a&&r++;return null},this.size=function(){return n},this.memsize=function(){var t,r=0;for(t in e)r++;return r},this.debug=function(e){a=e},this.hits=function(){return t},this.misses=function(){return r},this.keys=function(){return Object.keys(e)},this.exportJson=function(){var t={};for(var r in e){var n=e[r];t[r]={value:n.value,expire:n.expire||"NaN"}}return JSON.stringify(t)},this.importJson=function(t,r){var n=JSON.parse(t),a=Date.now(),o=r&&r.skipDuplicates;for(var i in n)if(n.hasOwnProperty(i)){if(o)if(e[i])continue;var s=n[i],u=s.expire-a;if(u<=0){this.del(i);continue}u=u>0?u:void 0,this.put(i,s.value,u)}return this.size()}}e.exports=new t,e.exports.Cache=t},,e=>{"use strict";e.exports=o},e=>{"use strict";e.exports=i}],c={};function l(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={id:e,loaded:!1,exports:{}};return u[e].call(r.exports,r,r.exports,l),r.loaded=!0,r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var f={};return(()=>{"use strict";l.r(f),l.d(f,{plugin:()=>ur});var e=l(3);function t(e,r){return Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t(e,r)}var r=l(0),n=l.n(r);var a=function(){function e(e){this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.before=null}var t=e.prototype;return t.insert=function(e){if(this.ctr%(this.isSpeedy?65e3:1)==0){var t,r=function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t}(this);t=0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling,this.container.insertBefore(r,t),this.tags.push(r)}var n=this.tags[this.tags.length-1];if(this.isSpeedy){var a=function(e){if(e.sheet)return e.sheet;for(var t=0;th)&&(R=(q=q.replace(" ",":")).length),0n&&(n=(t=t.trim()).charCodeAt(0)),n){case 38:return t.replace(y,"$1"+e.trim());case 58:return e.trim()+t.replace(y,"$1"+e.trim());default:if(0<1*r&&0u.charCodeAt(8))break;case 115:i=i.replace(u,"-webkit-"+u)+";"+i;break;case 207:case 102:i=i.replace(u,"-webkit-"+(102n.charCodeAt(0)&&(n=n.trim()),n=[n],0=4;++n,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(t>>>16)<<16),r=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(a){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)};const y={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var g=/[A-Z]|^ms/g,m=/_EMO_([^_]+?)_([^]*?)_EMO_/g,b=function(e){return 45===e.charCodeAt(1)},w=function(e){return null!=e&&"boolean"!=typeof e},x=function(e){var t={};return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}((function(e){return b(e)?e:e.replace(g,"-$&").toLowerCase()})),k=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(m,(function(e,t,r){return S={name:t,styles:r,next:S},t}))}return 1===y[e]||b(e)||"number"!=typeof t||0===t?t:t+"px"};function E(e,t,r,n){if(null==r)return"";if(void 0!==r.__emotion_styles)return r;switch(typeof r){case"boolean":return"";case"object":if(1===r.anim)return S={name:r.name,styles:r.styles,next:S},r.name;if(void 0!==r.styles){var a=r.next;if(void 0!==a)for(;void 0!==a;)S={name:a.name,styles:a.styles,next:S},a=a.next;return r.styles+";"}return function(e,t,r){var n="";if(Array.isArray(r))for(var a=0;ae.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&c.shift(),this._hasParentSelector=null;var l=this._trace(c,t,["$"],o,i,r).filter((function(e){return e&&!e.isParentSelector}));return l.length?u||1!==l.length||l[0].hasArrExpr?l.reduce((function(e,t){var r=a._getPreferredOutput(t);return s&&Array.isArray(r)?e=e.concat(r):e.push(r),e}),[]):this._getPreferredOutput(l[0]):u?[]:void 0}},H.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case"all":var r=Array.isArray(e.path)?e.path:H.toPathArray(e.path);return e.pointer=H.toPointer(r),e.path="string"==typeof e.path?e.path:H.toPathString(e.path),e;case"value":case"parent":case"parentProperty":return e[t];case"path":return H.toPathString(e[t]);case"pointer":return H.toPointer(e.path);default:throw new TypeError("Unknown result type")}},H.prototype._handleCallback=function(e,t,r){if(t){var n=this._getPreferredOutput(e);e.path="string"==typeof e.path?e.path:H.toPathString(e.path),t(n,r,e)}},H.prototype._trace=function(e,t,r,n,a,o,i,s){var u,c=this;if(!e.length)return u={path:r,value:t,parent:n,parentProperty:a,hasArrExpr:i},this._handleCallback(u,o,"value"),u;var l=e[0],f=e.slice(1),p=[];function h(e){Array.isArray(e)?e.forEach((function(e){p.push(e)})):p.push(e)}if(("string"!=typeof l||s)&&t&&B.call(t,l))h(this._trace(f,t[l],G(r,l),t,l,o,i));else if("*"===l)this._walk(l,f,t,r,n,a,o,(function(e,t,r,n,a,o,i,s){h(c._trace(W(e,r),n,a,o,i,s,!0,!0))}));else if(".."===l)h(this._trace(f,t,r,n,a,o,i)),this._walk(l,f,t,r,n,a,o,(function(e,t,r,n,a,o,i,s){"object"===P(n[e])&&h(c._trace(W(t,r),n[e],G(a,e),n,e,s,!0))}));else{if("^"===l)return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:f,isParentSelector:!0};if("~"===l)return u={path:G(r,l),value:a,parent:n,parentProperty:null},this._handleCallback(u,o,"property"),u;if("$"===l)h(this._trace(f,t,r,null,null,o,i));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(l))h(this._slice(l,f,t,r,n,a,o));else if(0===l.indexOf("?(")){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(l,f,t,r,n,a,o,(function(e,t,r,n,a,o,i,s){c._eval(t.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1"),n[e],e,a,o,i)&&h(c._trace(W(e,r),n,a,o,i,s,!0))}))}else if("("===l[0]){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(W(this._eval(l,t,r[r.length-1],r.slice(0,-1),n,a),f),t,r,n,a,o,i))}else if("@"===l[0]){var d=!1,v=l.slice(1,-2);switch(v){case"scalar":t&&["object","function"].includes(P(t))||(d=!0);break;case"boolean":case"string":case"undefined":case"function":P(t)===v&&(d=!0);break;case"integer":!Number.isFinite(t)||t%1||(d=!0);break;case"number":Number.isFinite(t)&&(d=!0);break;case"nonFinite":"number"!=typeof t||Number.isFinite(t)||(d=!0);break;case"object":t&&P(t)===v&&(d=!0);break;case"array":Array.isArray(t)&&(d=!0);break;case"other":d=this.currOtherTypeCallback(t,r,n,a);break;case"null":null===t&&(d=!0);break;default:throw new TypeError("Unknown value type "+v)}if(d)return u={path:r,value:t,parent:n,parentProperty:a},this._handleCallback(u,o,"value"),u}else if("`"===l[0]&&t&&B.call(t,l.slice(1))){var y=l.slice(1);h(this._trace(f,t[y],G(r,y),t,y,o,i,!0))}else if(l.includes(",")){var g,m=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=U(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}(l.split(","));try{for(m.s();!(g=m.n()).done;){var b=g.value;h(this._trace(W(b,f),t,r,n,a,o,!0))}}catch(e){m.e(e)}finally{m.f()}}else!s&&t&&B.call(t,l)&&h(this._trace(f,t[l],G(r,l),t,l,o,i,!0))}if(this._hasParentSelector)for(var w=0;w-1?e.slice(0,i+1)+" return "+e.slice(i+1):" return "+e;return M(Function,z(r).concat([s])).apply(void 0,z(a))}};var ae=function(e){var t=e.query,r=e.onChange,a=e.onRunQuery,o=e.editorContext,i=t.experimentalGroupByField,s=function(e){r(ne({},t,{experimentalGroupByField:e})),a()},u=t.experimentalMetricField,c=function(e){r(ne({},t,{experimentalMetricField:e})),a()},l=t.experimentalVariableTextField,f=function(e){r(ne({},t,{experimentalVariableTextField:e})),a()},p=t.experimentalVariableValueField,h=function(e){r(ne({},t,{experimentalVariableValueField:e})),a()},d=t.fields.map((function(e){if("jsonpath"===e.language){if(e.name)return e.name;var t=H.toPathArray(e.jsonPath);return t[t.length-1]}return e.name})).filter((function(e){return e})).map((function(e){return{label:e,value:e}}));return n().createElement(n().Fragment,null,n().createElement(C.InfoBox,{severity:"warning",style:{maxWidth:"700px",whiteSpace:"normal"}},J||(J=n().createElement("p",null,"The features listed here are experimental. They might change or be removed without notice. In the tooltip for\n each feature, there's a link to a pull request where you can submit feedback for that feature."))),"default"===o&&n().createElement(n().Fragment,null,n().createElement(C.InlineFieldRow,null,n().createElement(C.InlineField,{labelWidth:12,label:"Group by",tooltip:n().createElement(n().Fragment,null,V||(V=n().createElement("p",null,"Groups the query result into multiple results. This can be useful when you want to graph multiple time series in the same panel.")),Z||(Z=n().createElement("a",{href:"https://github.com/grafana/grafana-json-datasource/issues/36",target:"_blank",rel:"noreferrer"},"Share feedback")))},n().createElement(C.Select,{placeholder:"Field",width:20,isClearable:!0,value:d.find((function(e){return e.value===i})),options:d,onChange:function(e){return s(null==e?void 0:e.value)}}))),n().createElement(C.InlineFieldRow,null,n().createElement(C.InlineField,{labelWidth:12,label:"Metric",tooltip:n().createElement(n().Fragment,null,Q||(Q=n().createElement("p",null,"Set the display name of the selected field to the name of the query result.")),X||(X=n().createElement("a",{href:"https://github.com/grafana/grafana-json-datasource/issues/36",target:"_blank",rel:"noreferrer"},"Share feedback")))},n().createElement(C.Select,{placeholder:"Field",width:20,isClearable:!0,value:d.find((function(e){return e.value===u})),options:d,onChange:function(e){return c(null==e?void 0:e.value)}})))),"variables"===o&&n().createElement(n().Fragment,null,n().createElement(C.InlineFieldRow,null,n().createElement(C.InlineField,{labelWidth:15,label:"Variable text",tooltip:n().createElement(n().Fragment,null,K||(K=n().createElement("p",null,"Field to use for the text label of a variable query.")),ee||(ee=n().createElement("a",{href:"https://github.com/grafana/grafana-json-datasource/issues/79",target:"_blank",rel:"noreferrer"},"Share feedback")))},n().createElement(C.Select,{placeholder:"Field",width:20,isClearable:!0,value:d.find((function(e){return e.value===l})),options:d,onChange:function(e){return f(null==e?void 0:e.value)}}))),n().createElement(C.InlineFieldRow,null,n().createElement(C.InlineField,{labelWidth:15,label:"Variable value",tooltip:n().createElement(n().Fragment,null,te||(te=n().createElement("p",null,"Field to use for the value of a variable query.")),re||(re=n().createElement("a",{href:"https://github.com/grafana/grafana-json-datasource/issues/79",target:"_blank",rel:"noreferrer"},"Share feedback")))},n().createElement(C.Select,{placeholder:"Field",width:20,isClearable:!0,value:d.find((function(e){return e.value===p})),options:d,onChange:function(e){return h(null==e?void 0:e.value)}})))))},oe=function(e){var t=e.query,r=e.onBlur,a=e.onChange,o=[(0,C.BracesPlugin)(),(0,C.SlatePrism)({onlyIn:function(e){return"code_block"===e.type},getSyntax:function(){return"js"}})];return n().createElement(C.QueryField,{additionalPlugins:o,query:t,onRunQuery:r,onChange:a,portalOrigin:"jsonapi",placeholder:"$sum(orders.(price*quantity))"})};function ie(){return ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;S(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:O(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return le(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return le(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);rs.lastIndexOf("]"),p=f?s.slice(0,s.lastIndexOf("[")+1)+":]":i.slice(0,i.lastIndexOf(".")),e.next=22,r();case 22:if(h=e.sent,"object"===fe((d=se({path:p,json:h}))[0])){e.next=26;break}return e.abrupt("return",a);case 26:return e.abrupt("return",{suggestions:[{label:"Elements",items:Object.entries(d[0]).map((function(e){var t=ce(e,2),r=t[0],n=t[1];return Array.isArray(n)?{label:r,insertText:r+"[]",move:-1,documentation:"_array (".concat(n.length,")_")}:{label:r,documentation:"_".concat(fe(n),"_\n\n**Preview:**\n\n`").concat(n,"`")}}))}]});case 27:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){pe(o,n,a,i,s,"next",e)}function s(e){pe(o,n,a,i,s,"throw",e)}i(void 0)}))});return function(e,r){return t.apply(this,arguments)}}(),ge=function(e){var t=e.query,r=e.onBlur,a=e.onChange,o=e.onData,i=[(0,C.BracesPlugin)(),(0,C.SlatePrism)({onlyIn:function(e){return"code_block"===e.type},getSyntax:function(){return"js"}})];return n().createElement(C.QueryField,{additionalPlugins:i,query:t,cleanText:function(e){return e.replace(/[{}[\]="(),!~+\-*/^%\|\$@\.]/g,"").trim()},onTypeahead:function(e){return ye(e,o)},onRunQuery:r,onChange:a,portalOrigin:"jsonapi",placeholder:"$.items[*].name"})};function me(e){return function(e){if(Array.isArray(e))return be(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return be(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return be(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?n().createElement("a",{className:"gf-form-label",onClick:f(t)},ve||(ve=n().createElement(C.Icon,{name:"minus"}))):null)})))},ke=l(20),Ee=l(7),Se=l.n(Ee),Ae=function(){function e(e,t){for(var r=0;r div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',o=r.head||r.getElementsByTagName("head")[0],i=r.createElement("style");i.id="detectElementResize",i.type="text/css",null!=e&&i.setAttribute("nonce",e),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(r.createTextNode(n)),o.appendChild(i)}}(l),o.__resizeLast__={},o.__resizeListeners__=[],(o.__resizeTriggers__=l.createElement("div")).className="resize-triggers";var p=l.createElement("div");p.className="expand-trigger",p.appendChild(l.createElement("div"));var h=l.createElement("div");h.className="contract-trigger",o.__resizeTriggers__.appendChild(p),o.__resizeTriggers__.appendChild(h),o.appendChild(o.__resizeTriggers__),i(o),o.addEventListener("scroll",s,!0),n&&(o.__resizeTriggers__.__animationListener__=function(e){e.animationName===r&&i(o)},o.__resizeTriggers__.addEventListener(n,o.__resizeTriggers__.__animationListener__))}o.__resizeListeners__.push(c)}},removeResizeListener:function(e,t){if(u)e.detachEvent("onresize",t);else if(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),!e.__resizeListeners__.length){e.removeEventListener("scroll",s,!0),e.__resizeTriggers__.__animationListener__&&(e.__resizeTriggers__.removeEventListener(n,e.__resizeTriggers__.__animationListener__),e.__resizeTriggers__.__animationListener__=null);try{e.__resizeTriggers__=!e.removeChild(e.__resizeTriggers__)}catch(e){}}}}}null==Ie||null==Ne?(Fe=De,Ce=function(e){return Pe(e,20)}):(Fe=function(e){var t=je(e,2),r=t[0],n=t[1];Ie(r),De(n)},Ce=function(e){var t=Ne((function(){De(r),e()})),r=Pe((function(){Ie(t),e()}),20);return[t,r]});var Me=function(e){function t(){var e,r,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,o=Array(a),i=0;ie.length)&&(t=e.length);for(var r=0,n=new Array(t);r * {\n margin-right: ",";\n }\n & > *:last-child {\n margin-right: 0;\n }\n "])),s.spacing.xs)},n().createElement("a",{className:(0,ke.css)(ze||(ze=Xe(["\n display: flex;\n background: ",";\n padding: "," ",";\n align-items: center;\n border-radius: ",";\n "])),s.colors.bg2,s.spacing.xs,s.spacing.sm,s.border.radius.sm),onClick:function(){return l(t)}},Ue||(Ue=n().createElement(C.Icon,{name:"plus"}))),n().createElement("a",{className:(0,ke.css)(qe||(qe=Xe(["\n display: flex;\n background: ",";\n padding: "," ",";\n align-items: center;\n border-radius: ",";\n "])),s.colors.bg2,s.spacing.xs,s.spacing.sm,s.border.radius.sm),onClick:function(){return e=t,void a([].concat(Ke(r.slice(0,e)),Ke(r.slice(e+1))));var e}},Be||(Be=n().createElement(C.Icon,{name:"minus"}))))))}))))},ot=(0,C.stylesFactory)((function(e){return{root:(0,ke.css)(Ge||(Ge=Xe(["\n table-layout: auto;\n border: 1px solid ",";\n border-collapse: separate;\n border-radius: ",";\n border-spacing: 0;\n border-left: 0;\n width: 100%;\n "])),e.colors.formInputBorder,e.border.radius.sm),thead:(0,ke.css)(We||(We=Xe(["\n display: table-header-group;\n vertical-align: middle;\n border-color: inherit;\n border-collapse: separate;\n\n &:first-child tr:first-child th:first-child {\n border-radius: "," 0 0 0;\n }\n &:last-child tr:last-child th:first-child {\n border-radius: 0 0 0 ",";\n }\n "])),e.border.radius.sm,e.border.radius.sm),tbody:(0,ke.css)(Ye||(Ye=Xe(["\n &:first-child tr:first-child td:first-child {\n border-radius: "," 0 0 0;\n }\n\n &:last-child tr:last-child td:first-child {\n border-radius: 0 0 0 ",";\n }\n "])),e.border.radius.sm,e.border.radius.sm),input:(0,ke.css)(He||(He=Xe(["\n outline: none;\n border: 0;\n background: transparent;\n width: 100%;\n "]))),row:(0,ke.css)(Je||(Je=Xe(["\n display: table-row;\n vertical-align: inherit;\n border-color: inherit;\n "]))),th:(0,ke.css)(Ve||(Ve=Xe(["\n padding: "," ",";\n border-left: solid "," 1px;\n font-size: ",";\n color: ",";\n font-weight: ",";\n\n &:last-child {\n border-left: 0;\n }\n "])),e.spacing.xs,e.spacing.sm,e.colors.formInputBorder,e.typography.size.sm,e.colors.textSemiWeak,e.typography.weight.regular),td:(0,ke.css)(Ze||(Ze=Xe(["\n padding: "," ",";\n border: 1px solid transparent;\n border-left: solid "," 1px;\n border-top: solid "," 1px;\n background-color: ",";\n &:last-child {\n border-left: 0;\n width: 32px;\n padding-left: 0;\n padding-right: ",";\n }\n "])),e.spacing.xs,e.spacing.sm,e.colors.formInputBorder,e.colors.formInputBorder,e.colors.formInputBg,e.spacing.xs)}})),it=function(e){var t=e.method,r=e.onMethodChange,a=e.path,o=e.onPathChange;return n().createElement(C.InlineFieldRow,null,n().createElement(C.InlineField,null,n().createElement(C.Select,{value:t,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"}],onChange:function(e){var t;return r(null!==(t=e.value)&&void 0!==t?t:"GET")}})),n().createElement(C.InlineField,{grow:!0},n().createElement(C.Input,{placeholder:"/orders/${orderId}",value:a,onChange:function(e){return o(e.currentTarget.value)}})))};function st(){return st=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;S(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:O(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function At(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ot(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ot(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(s=s+(s.search(/\?/)>=0?"&":"?")+a.map((function(e){var t=At(e,2),r=t[0],n=t[1];return"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n))})).join("&")),this.lastCacheDuration!==t&&this.cache.del(s),this.lastCacheDuration=t,!(u=this.cache.get(s))){e.next=11;break}return e.abrupt("return",Promise.resolve(u));case 11:return e.next=13,this.get(r,n,a,o,i);case 13:return c=e.sent,this.cache.put(s,c,1e3*t),e.abrupt("return",c);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,o,i){return a.apply(this,arguments)})},{key:"_request",value:function(e,t,r,n,a){var o={};(null!=n?n:[]).filter((function(e){var t=At(e,2),r=t[0];return t[1],r})).forEach((function(e){var t=At(e,2),r=t[0],n=t[1];o[r]=n}));var i={url:this.baseUrl+t,method:e,headers:o};return"GET"!==i.method&&a&&(i.data=a),i.url=i.url.replace(/[\/]+/g,"/"),r&&Object.keys(r).length>0&&(i.url=i.url+(i.url.search(/\?/)>=0?"&":"?")+Object.entries(r).map((function(e){var t=At(e,2),r=t[0],n=t[1];return"".concat(encodeURIComponent(r.replace(/__\d+$/,"")),"=").concat(encodeURIComponent(n))})).join("&")),(0,yt.getBackendSrv)().fetch(i)}}],r&&Tt(t.prototype,r),n&&Tt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),Pt=l(56),It=l.n(Pt),Nt=function(t){return t.every((function(e){return null===e}))?e.FieldType.string:t.filter((function(e){return null!==e})).every((function(e){return It()(e,[It().defaultFormat,"YYYY-MM-DD"],!0).isValid()}))?e.FieldType.time:t.every((function(e){return"number"==typeof e}))?e.FieldType.number:t.every((function(e){return"boolean"==typeof e}))?e.FieldType.boolean:e.FieldType.string},$t=l(18),Mt=l.n($t);function Lt(e){return Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lt(e)}var Rt=function(t,r){switch(r){case e.FieldType.time:if(t.filter((function(e){return e})).every((function(e){return"string"==typeof e})))return t.map((function(e){return null!==e?Mt()(e).valueOf():e}));if(t.filter((function(e){return e})).every((function(e){return"number"==typeof e}))){return t.filter((function(e){return e})).every((function(e){return e<1e12}))?t.map((function(e){return null!==e?1e3*e:e})):t}throw new Error("Unsupported time property");case e.FieldType.string:return t.every((function(e){return"string"==typeof e}))?t:t.map((function(e){return null===e?e:"object"===Lt(e)?JSON.stringify(e):e.toString()}));case e.FieldType.number:return t.every((function(e){return"number"==typeof e}))?t:t.map((function(e){return null!==e?parseFloat(e):e}));case e.FieldType.boolean:return t.every((function(e){return"boolean"==typeof e}))?t:t.map((function(e){if(null===e)return e;switch(e.toString()){case"0":case"false":case"FALSE":case"False":return!1;case"1":case"true":case"TRUE":case"True":return!0;default:throw new Error("Found non-boolean values in a field of type boolean: "+e.toString())}}));default:throw new Error("Unsupported field type")}};function zt(e){return zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zt(e)}function Ut(e){return function(e){if(Array.isArray(e))return Gt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Bt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||Bt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bt(e,t){if(e){if("string"==typeof e)return Gt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gt(e,t):void 0}}function Gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;S(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:O(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function Ht(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function Jt(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){Ht(o,n,a,i,s,"next",e)}function s(e){Ht(o,n,a,i,s,"throw",e)}i(void 0)}))}}function Vt(e,t){for(var r=0;r1?"result".concat(a):"result"),type:t.type?t.type:Nt(p),values:new e.ArrayVector(p),config:{}}}var h=i(t.jsonPath),d=se({path:h,json:s}),v=H.toPathArray(h),y=t.type?t.type:Nt(d),g=Rt(d,y);return{name:i(null!==(u=t.name)&&void 0!==u?u:"")||v[v.length-1],type:y,values:new e.ArrayVector(g),config:{}}})),c=u.map((function(e){return e.values.length})),!(Array.from(new Set(c)).length>1)){t.next=11;break}throw new Error("Fields have different lengths");case 11:return l=r.experimentalGroupByField?or((0,e.toDataFrame)({name:r.refId,refId:r.refId,fields:u}),r.experimentalGroupByField):[(0,e.toDataFrame)({name:r.refId,refId:r.refId,fields:u})],f=l.map((function(e){return Wt({},e,{fields:e.fields.map((function(t){return t.name===r.experimentalMetricField?Wt({},t,{config:{displayNameFromDS:e.name}}):t}))})})),t.abrupt("return",f);case 14:case"end":return t.stop()}}),t,this)}))),function(e,t,r){return i.apply(this,arguments)})},{key:"requestJson",value:(o=Jt(Yt().mark((function e(t,r){var n,a,o;return Yt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e){var t=qt(e,2),n=t[0],a=t[1];return[r(n),r(a)]},e.next=3,this.api.cachedGet(t.cacheDurationSeconds,t.method,r(t.urlPath),(null!==(n=t.params)&&void 0!==n?n:[]).map(o),(null!==(a=t.headers)&&void 0!==a?a:[]).map(o),r(t.body));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})}],n&&Vt(r.prototype,n),a&&Vt(r,a),Object.defineProperty(r,"prototype",{writable:!1}),p}(e.DataSourceApi),nr=function(e,t){return function(r){return ar((0,yt.getTemplateSrv)().replace(r,e),t)}},ar=function(e,t){return t?e.replace(/\$__unixEpochFrom\(\)/g,t.from.unix().toString()).replace(/\$__unixEpochTo\(\)/g,t.to.unix().toString()).replace(/\$__isoFrom\(\)/g,t.from.toISOString()).replace(/\$__isoTo\(\)/g,t.to.toISOString()):e},or=function(t,r){var n=t.fields.find((function(e){return e.name===r}));return n?Ut(new Set(n.values.toArray())).map((function(r){var a=t.fields.filter((function(e){return e.name.toString()!==n.name})).map((function(t){return Wt({},t,{values:new e.ArrayVector(t.values.toArray().filter((function(e,t){return n.values.get(t)===r})))})}));return(0,e.toDataFrame)({name:r,refId:t.refId,fields:a})})):[t]},ir=function(e){var t=[];return(0,yt.getTemplateSrv)().replace("$".concat(e),{},(function(e){return Array.isArray(e)?t.push.apply(t,Ut(e)):t.push(e),""})),t},sr=["__dashboard","__from","__to","__interval","__interval_ms","__name","__org","__user","__range","__rate_interval","timeFilter","__timeFilter"],ur=new e.DataSourcePlugin(rr).setConfigEditor((function(e){var t=e.options,r=e.onOptionsChange;return n().createElement(n().Fragment,null,n().createElement(C.DataSourceHttpSettings,{defaultUrl:"http://localhost:8080",dataSourceConfig:t,onChange:r}),F||(F=n().createElement("h3",{className:"page-heading"},"Misc")),n().createElement(C.InlineFieldRow,null,n().createElement(C.InlineField,{label:"Query string",tooltip:"Add a custom query string to your queries."},n().createElement(C.Input,{width:50,value:t.jsonData.queryParams,onChange:function(e){r(D({},t,{jsonData:D({},t.jsonData,{queryParams:e.currentTarget.value})}))},spellCheck:!1,placeholder:"page=1&limit=100"}))))})).setQueryEditor(dt).setVariableQueryEditor((function(e){var t=e.query,r=e.onChange,a=Se()(t,Qe);return n().createElement(dt,vt({},e,{onRunQuery:function(){},onChange:function(e){e&&r(e,e.fields[0].jsonPath)},query:a,limitFields:2,editorContext:"variables"}))}))})(),f})())); //# sourceMappingURL=module.js.map